Re: [FFmpeg-devel] [PATCH] avformat/dashenc: Support HTTP persistent for init segments as well

2018-10-26 Thread Jeyapal, Karthick

On 10/21/18 6:50 AM, Karthick J wrote:
> ---
>  libavformat/dashenc.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index b0a59af3ee..4e2ea2ebf2 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -355,8 +355,11 @@ static int flush_init_segment(AVFormatContext *s, 
> OutputStream *os)
>  return ret;
>  
>  os->pos = os->init_range_length = range_length;
> -if (!c->single_file)
> -ff_format_io_close(s, &os->out);
> +if (!c->single_file) {
> +char filename[1024];
> +snprintf(filename, sizeof(filename), "%s%s", c->dirname, 
> os->initfile);
> +dashenc_io_close(s, &os->out, filename);
> +}
>  return 0;
>  }
>  
Pushed.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavdevice/libndi_newtek: Added extra_ips option to libndi_newtek allowing use remote network sources

2018-10-26 Thread Anton Platov
Signed-off-by: Anton Platov 
---
 libavdevice/libndi_newtek_dec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavdevice/libndi_newtek_dec.c b/libavdevice/libndi_newtek_dec.c
index 4fb7197..a781edc 100644
--- a/libavdevice/libndi_newtek_dec.c
+++ b/libavdevice/libndi_newtek_dec.c
@@ -33,6 +33,7 @@ struct NDIContext {
 int find_sources;
 int64_t wait_sources;
 int allow_video_fields;
+char *extra_ips;
 
 /* Runtime */
 NDIlib_recv_create_t *recv;
@@ -99,7 +100,7 @@ static int ndi_find_sources(AVFormatContext *avctx, const 
char *name, NDIlib_sou
 struct NDIContext *ctx = avctx->priv_data;
 const NDIlib_source_t *ndi_srcs = NULL;
 const NDIlib_find_create_t find_create_desc = { .show_local_sources = true,
-.p_groups = NULL, .p_extra_ips = NULL };
+.p_groups = NULL, .p_extra_ips = ctx->extra_ips };
 
 if (!ctx->ndi_find)
 ctx->ndi_find = NDIlib_find_create2(&find_create_desc);
@@ -317,6 +318,7 @@ static const AVOption options[] = {
 { "find_sources", "Find available sources"  , OFFSET(find_sources), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
 { "wait_sources", "Time to wait until the number of online sources have 
changed"  , OFFSET(wait_sources), AV_OPT_TYPE_DURATION, { .i64 = 100 }, 
10, 2000, DEC },
 { "allow_video_fields", "When this flag is FALSE, all video that you 
receive will be progressive"  , OFFSET(allow_video_fields), AV_OPT_TYPE_BOOL, { 
.i64 = 1 }, 0, 1, DEC },
+{ "extra_ips", "Find available sources on extra ip addresses",   
OFFSET(extra_ips), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC },
 { NULL },
 };
 
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/dashenc: Disable writing CODECS tag for HEVC streams

2018-10-26 Thread Jeyapal, Karthick

On 10/21/18 4:45 PM, Jeyapal, Karthick wrote:
>
> On 10/21/18 2:28 PM, Hendrik Leppkes wrote:
>> On Sun, Oct 21, 2018 at 10:41 AM Karthick J  wrote:
>>>
>>> For HEVC streams, only the FourCC tag is written without profile, level 
>>> etc.,
>>> This is breaking playout support in native Safari.
>>> Native Safari playout expects the full info in CODECS tag or None at all.
>>
>> Generating the full string shouldn't be that impossible for HEVC
>> either, why not go that more complete route?
> Two reasons:
> 1. I was not sure what is the right format of that string. I saw some 
> examples, like hvc1.2.4.L123.B0. But I didn't know what that meant.
> If somebody here could provide some explanation or the relevant spec, I will 
> hold off this patch and would definitely try implementing it.
>
> 2. I heard recently in a demuxed talk that for 2K and 4K resolution Apple 
> clients don't playout properly even when properly constructed CODEC tag is 
> there(hvc1.2.4.L153).
> But they played properly without a CODEC tag. 
> https://www.twitch.tv/videos/323919819 , Seek to 42:30 for the relevant info.
>
> For the above two reasons, I assumed it is going to be a time-consuming job. 
> Hence, I decided to atleast restore the earlier status for HEVC, so that we 
> don't break anything that was working properly earlier.
Hi Hendrik,

Please let me know if I can proceed with the push. I am relatively new to this 
ffmpeg forum and hence not sure how to proceed further for such comments.
I don't see it as a strong veto from you, but I just wanted to confirm before 
the push.

At least for time being this patch will enable people to use HEVC, while we add 
support the HEVC CODECS tags later.

Regards,
Karthick
>>
>> - Hendrik
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Enquiry re resolving errors reported by stream analysers after transcoding with FFmpeg

2018-10-26 Thread Michael Niedermayer
Hi

On Thu, Oct 25, 2018 at 08:36:26AM +, Stephenson, Angelica wrote:
> Hello,
> 
> I’m emailing to seek your advice. For the past few months, a team here at Sky 
> UK has performed testing to determine whether FFmpeg would be a suitable 
> transcode resource for a variety of use cases. Some tests failed due to 
> stream analysers reporting errors, summary listed below. What would be 
> required to make a sensible and indicative estimate on cost and level of 
> effort required for you or someone in your team to resolve the errors being 
> reported?
> 
> Errors reported by analysers
> 
>   *   Unable to insert PCR on PES (TR-8 requirement from Sky's VRP video spec 
> for PDL)
>   *   MPEG and AAC audio buffer overflows (Manzanita)
>   *   PES header data_alignment_indicator flag not set for video and audio 
> (Manzanita)
>   *   Failed HRD conformance check (Tektronix Cerify)
>   *   TB overflows (A/V Codec Analyser)
>   *   PTS (Presentation Timestamp) interval is not constant in audio stream 
> (A/V Codec Analyser)
>   *   PTS must occur after end of Access Unit (A/V Codec Analyser)
>   *   PCR discontinuities (A/V Codec Analyser)

reproducable testcases would very usefull.
Iam sure there are bugs in our mpeg ts muxer but possibly some of these are 
also just
configuration issues.

More generally and a maybe this is a little bit a rant ;)
If all these slightly expensive Analysers would have been available to the
wider community then the developers who worked on the related code would
have been aware of the problems with details and would have been able to fix 
these when
the code was originally written or at least long ago.
As it is, its not unknown there are problems in the code but with no details
and no easy way to test potential fixes, its not so easy to fix for many
developers. There may be a very small number of developers who know mpeg-ts
so well they can understand and fix bugs without any way to test but i think
there are many more people who have a more shallow understaning and who have
more time who could with detailed information of what is wrong and with the
ability to test changes be able to fix these as well

I hope my slightly random comment helps
Iam not sure i have enough time to work on these myself but i would possibly
be in principle be interrested to try/play with fixing some of these if there
maybe was some sort of bounty on a working fix for each and i wouldnt have to 
commit myself to fixing it. mpeg-ts is not exactly my most favorite format and
some of these might be non trivial or end up requiring large scale changes, 
i am also no mpeg-ts expert, i know the format only approximatly.
Thats just my personal view, iam sure others have other views about mpeg-ts,
our (buggy) implementation and how to best improve it. 
I do not know if theres someone who knows mpeg-ts well, has plenty of time
and wants to fix all the issues. But if so, that would of course be best.

Thanks

> 
> Thanks in advance,
> Angelica.
> 
> Angelica Stephenson
> Senior Technical Lead
> 
> Sky UK
> Tel:   +44 (0) 7596 352 078
> Email:angelica.stephen...@sky.uk
> Website:www.sky.comhttp://www.sky.com/>
> 
> [cid:image001.png@01D32B1F.A2CDE760]
> Information in this email including any attachments may be privileged, 
> confidential and is intended exclusively for the addressee. The views 
> expressed may not be official policy, but the personal views of the 
> originator. If you have received it in error, please notify the sender by 
> return e-mail and delete it from your system. You should not reproduce, 
> distribute, store, retransmit, use or disclose its contents to anyone. Please 
> note we reserve the right to monitor all e-mail communication through our 
> internal and external networks. SKY and the SKY marks are trademarks of Sky 
> plc and Sky International AG and are used under licence.
> 
> Sky UK Limited (Registration No. 2906991), Sky-In-Home Service Limited 
> (Registration No. 2067075), Sky Subscribers Services Limited (Registration 
> No. 2340150) and Sky CP Limited (Registration No. 9513259) are direct or 
> indirect subsidiaries of Sky plc (Registration No. 2247735). All of the 
> companies mentioned in this paragraph are incorporated in England and Wales 
> and share the same registered office at Grant Way, Isleworth, Middlesex TW7 
> 5QD



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/qsv: make a copy as libmfx alignment requirement for uploading

2018-10-26 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Rogozhkin, Dmitry V
> Sent: Friday, October 26, 2018 8:37 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/qsv: make a copy as
> libmfx alignment requirement for uploading
> 
> On Wed, 2018-10-24 at 23:47 +0100, Mark Thompson wrote:
> > On 24/10/18 21:45, Rogozhkin, Dmitry V wrote:
> > > On Tue, 2018-10-23 at 23:46 +0100, Mark Thompson wrote:
> > > > On 23/10/18 08:49, Li, Zhong wrote:
> > > > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org]
> > > > > > On
> > > > > > Behalf
> > > > > > Of Mark Thompson
> > > > > > Sent: Sunday, October 14, 2018 12:36 AM
> > > > > > To: ffmpeg-devel@ffmpeg.org
> > > > > > Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/qsv: make a
> > > > > > copy as libmfx alignment requirement for uploading
> > > > > >
> > > > > > On 11/10/18 06:38, Zhong Li wrote:
> > > > > > > ffmpeg | branch: master | Zhong Li  |
> > > > > > > Mon Sep 17
> > > > > > > 19:16:44 2018 +0800|
> > > > > > > [681aa7d14f97fd98181ca6d61e11be48fe65692d]
> > > > > > > >
> > > > > > >
> > > > > > > committer: Zhong Li
> > > > > > >
> > > > > > > lavu/qsv: make a copy as libmfx alignment requirement for
> > > > > > > uploading
> > > > > > >
> > > > > > > Libmfx requires 16 bytes aligned input/output for uploading.
> > > > > > > Currently only output is 16 byte aligned and assigning same
> > > > > > > width/height to input with smaller buffer size actually,
> > > > > > > thus definitely will
> > > > > >
> > > > > > cause segment fault.
> > > > > > >
> > > > > > > Can reproduce with any 1080p nv12 rawvideo input:
> > > > > > > ffmpeg -init_hw_device qsv=qsv:hw -hwaccel qsv
> > > > > > > -filter_hw_device qsv -f rawvideo -pix_fmt nv12 -s:v
> > > > > > > 1920x1080 -i 1080p_nv12.yuv -vf
> > > > > > >
> 'format=nv12,hwupload=extra_hw_frames=16,hwdownload,format=
> > > > > > > nv12
> > > > > > > '
> > > > > >
> > > > > > -an
> > > > > > > -y out_nv12.yuv
> > > > > > >
> > > > > > > It can fix #7418
> > > > > > >
> > > > > > > Signed-off-by: Zhong Li 
> > > > > > >
> > > > > > > >
> > > > > >
> > > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=681
> > > > > > aa7d
> > > > > > 14f9
> > > > > > > > 7fd98181ca6d61e11be48fe65692d
> > > > > > >
> > > > > > > ---
> > > > > > >
> > > > > > >  libavutil/hwcontext_qsv.c | 31
> > > > > > > +--
> > > > > > >  1 file changed, 29 insertions(+), 2 deletions(-)
> > > > > > >
> > > > > > > diff --git a/libavutil/hwcontext_qsv.c
> > > > > > > b/libavutil/hwcontext_qsv.c index 33e121b416..814ce215ce
> > > > > > > 100644
> > > > > > > --- a/libavutil/hwcontext_qsv.c
> > > > > > > +++ b/libavutil/hwcontext_qsv.c
> > > > > > > @@ -862,6 +862,10 @@ static int
> > > > > >
> > > > > > qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
> > > > > > >  mfxSyncPoint sync = NULL;
> > > > > > >  mfxStatus err;
> > > > > > >  int ret = 0;
> > > > > > > +/* make a copy if the input is not padded as libmfx
> > > > > > > requires */
> > > > > > > +AVFrame tmp_frame, *src_frame;
> > > > > > > +int realigned = 0;
> > > > > > > +
> > > > > > >
> > > > > > >  while (!s->session_upload_init && !s->session_upload &&
> > > > > > > !ret) {
> > > > > > > #if HAVE_PTHREADS @@ -887,16 +891,36 @@ static int
> > > > > > > qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
> > > > > > >  if (ret < 0)
> > > > > > >  return ret;
> > > > > > >
> > > > > > > +
> > > > > > > +if (src->height & 16 || src->linesize[0] & 16) {
> > > > > >
> > > > > > Doesn't this still need to check that the layout is compatible
> > > > > > with other the limitations that libmfx has before trying to do
> > > > > > the upload?  In particular, that the pitches for the different
> > > > > > planes are actually all the same - I certainly wouldn't expect
> > > > > > them to be for YUV420P.
> > > > >
> > > > > Do you mean our previous discussion on https://lists.libav.org/
> > > > > pipe rmail/libav-devel/2018-April/086070.html ?
> > > > > If yes, I will try to reproduce it with hwupload pipeline
> > > > > instead of transcoding pipeline, and then give an update patch.
> > > >
> > > > Yes.  You might need to write a small test program to generation
> > > > an arbitrary allocation pattern, since libavutil only has a fixed
> > > > layout.
> > > >
> > > > > >
> > > > > > (IIRC there was a requirement 0 < frame->data[N] - frame-
> > > > > > >data[0]
> > > > > > < 2^24
> > > > > > as well (or something like that, I might be wrong), which also
> > > > > > need not be
> > > > > > true.)
> > > > >
> > > > > I don't know such a requirement, could it be found from MSDK
> > > > > guide?
> > > >
> > > > That came from discussion of hardware capabilities around VAAPI, I
> > > > think.
> > >
> > > There are upper size frame limitations which HW can support. And
> > > this limitation can be different for different operations, for
> >

[FFmpeg-devel] [PATCH] add the protection for http range get request starting from file size

2018-10-26 Thread shenqichao
Signed-off-by: shenqichao 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3a35bc7eac..129f683d15 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1669,7 +1669,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t 
off, int whence, int fo
 int old_buf_size, ret;
 AVDictionary *options = NULL;
 
-if (whence == AVSEEK_SIZE)
+if (whence == AVSEEK_SIZE || (whence == SEEK_SET && off == s->filesize))
 return s->filesize;
 else if (!force_reconnect &&
  ((whence == SEEK_CUR && off == 0) ||
-- 
2.19.0


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH vFINAL] fate: add api-h264-slice test

2018-10-26 Thread Josh de Kock

On 24/10/2018 19:02, jos...@ob-encoder.com wrote:

From: Josh de Kock 

This test ensures that you are able to send N number of slice NALUs in slice 
threaded mode to be decoded simultaneously
---

  tests/api/Makefile  |   1 +
  tests/api/api-h264-slice-test.c | 221 +++
  tests/fate/api.mak  |   4 +
  tests/ref/fate/api-h264-slice   | 309 
  4 files changed, 535 insertions(+)
  create mode 100644 tests/api/api-h264-slice-test.c
  create mode 100644 tests/ref/fate/api-h264-slice

[...]


Pushed.

--
Josh
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add xstack filter

2018-10-26 Thread Moritz Barsnick
On Thu, Oct 25, 2018 at 14:34:49 -0800, Lou Logan wrote:
> On Wed, Oct 24, 2018, at 11:04 AM, Paul B Mahol wrote:

Additional nit:

> > +The filter accept the following option:
^ accepts

Otherwise I agree with Lou's corrections.

Practical filter btw., should save users from a lot of fiddling with
padding and math.

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/5] lavc/qsvenc: add an option to set h264 pps for every frame

2018-10-26 Thread Moritz Barsnick
On Thu, Oct 25, 2018 at 20:36:10 +0800, Zhong Li wrote:
> RepeatPPS is enabled by default in mfx. It is not necessary mostly and
> wasting encoding bits.
> Add an option to control it and disable it by default.

Could this change in behavior surprise anyone? If it's okay to change,
perhaps at least bump lavc's micro version?

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton

2018-10-26 Thread Moritz Barsnick
On Thu, Oct 25, 2018 at 20:36:07 +0800, Zhong Li wrote:
> +{ "forced_idr", "Forcing I frames as IDR frames", 
> OFFSET(qsv.forced_idr), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, 
> VE }, \

ffmpeg uses imperative (mostly): "Force I frames as IDR frames".

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavdevice/libndi_newtek: Added extra_ips option to libndi_newtek allowing use remote network sources

2018-10-26 Thread Moritz Barsnick
On Fri, Oct 26, 2018 at 11:16:02 +0300, Anton Platov wrote:
> +{ "extra_ips", "Find available sources on extra ip addresses",   
> OFFSET(extra_ips), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC },
   ^

This makes it sound like a boolean option (i.e. whether to find). In
reality, you want a comma separated string of IP addresses[1]. You
should say so, e.g.

"Extra IP addresses to find available sources on (comma separated)".

Moritz

[1] 
https://github.com/Palakis/obs-ndi/blob/3b9772bb64eb7b53e02df863720d48798cfe30f0/lib/ndi/Include/Processing.NDI.Find.h#L42
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-26 Thread Rostislav Pehlivanov
On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary  wrote:

>
>
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> > sean darcy
> > Sent: Thursday, October 25, 2018 11:51 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> > rotation feature via call Intel iHD driver
> >
> > On 10/25/18 2:52 AM, Zachary Zhou wrote:
> > > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > > va/va_vpp.h, tested following command line on SKL platform
> > >
> > > dir=0 for 0   degree
> > > dir=1 for 90  degree
> > > dir=2 for 180 degree
> > > dir=3 for 270 degree
> > >
> > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> > > -c:v h264_vaapi output.h264
> > >
> > > Signed-off-by: Zachary Zhou 
> > > ---
> > >   configure |   3 +
> > >   libavfilter/Makefile  |   1 +
> > >   libavfilter/allfilters.c  |   1 +
> > >   libavfilter/vaapi_vpp.h   |   1 +
> > >   libavfilter/vf_rotate_vaapi.c | 252
> ++
> > >   5 files changed, 258 insertions(+)
> > >   create mode 100644 libavfilter/vf_rotate_vaapi.c
> > >
> > > diff --git a/configure b/configure
> > > index 85d5dd5962..33aced3d78 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -6390,6 +6390,9 @@ if enabled vaapi; then
> > >   fi
> > >
> > >   check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
> > > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"
> rotation_flags;
> > then
> > > +disable rotation_vaapi_filter
> > > +fi
> > >   fi
> > >
> > >   if enabled_all opencl libdrm ; then
> > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > > 108a2f87d7..534650364a 100644
> > > --- a/libavfilter/Makefile
> > > +++ b/libavfilter/Makefile
> > > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> > vf_setparams.o
> > >   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> > >   OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> > >   OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> > vaapi_vpp.o
> > > +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
> > vaapi_vpp.o
> > >   OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> > >   OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> > >   OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > > 557590850b..4b90a7f440 100644
> > > --- a/libavfilter/allfilters.c
> > > +++ b/libavfilter/allfilters.c
> > > @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;
> > >   extern AVFilter ff_vf_setsar;
> > >   extern AVFilter ff_vf_settb;
> > >   extern AVFilter ff_vf_sharpness_vaapi;
> > > +extern AVFilter ff_vf_rotation_vaapi;
> > >   extern AVFilter ff_vf_showinfo;
> > >   extern AVFilter ff_vf_showpalette;
> > >   extern AVFilter ff_vf_shuffleframes; diff --git
> > > a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
> > > 0bc31018d4..cfe19b689f 100644
> > > --- a/libavfilter/vaapi_vpp.h
> > > +++ b/libavfilter/vaapi_vpp.h
> > > @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
> > >   int output_width;   // computed width
> > >   int output_height;  // computed height
> > >
> > > +int rotation_state;
> > >   VABufferID filter_buffers[VAProcFilterCount];
> > >   intnb_filter_buffers;
> > >
> > > diff --git a/libavfilter/vf_rotate_vaapi.c
> > > b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index
> > > 00..34c270e9c7
> > > --- /dev/null
> > > +++ b/libavfilter/vf_rotate_vaapi.c
> > > @@ -0,0 +1,252 @@
> > > +/*
> > > + * This file is part of FFmpeg.
> > > + *
> > > + * FFmpeg is free software; you can redistribute it and/or
> > > + * modify it under the terms of the GNU Lesser General Public
> > > + * License as published by the Free Software Foundation; either
> > > + * version 2.1 of the License, or (at your option) any later version.
> > > + *
> > > + * FFmpeg is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > GNU
> > > + * Lesser General Public License for more details.
> > > + *
> > > + * You should have received a copy of the GNU Lesser General Public
> > > + * License along with FFmpeg; if not, write to the Free Software
> > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > > +02110-1301 USA  */ #include 
> > > +
> > > +#include "libavutil/avassert.h"
> > > +#include "libavutil/mem.h"
> > > +#include "libavutil/opt.h"
> > > +#include "libavutil/pixdesc.h"
> > > +
> > > +#include "avfilter.h"
> > > +#include "formats.h"
> > > +#include "internal.h"
> > > +#include "vaapi_vp

[FFmpeg-devel] Fw: [PATCH] add the protection for http range get request starting from file size

2018-10-26 Thread 沈启超
I add the comment about the issue "https://trac.ffmpeg.org/ticket/6885";









 Forwarding messages 
From: "shenqichao" 
Date: 2018-10-26 18:40:53
To:  ffmpeg-devel@ffmpeg.org
Cc:  shenqichao 
Subject: [FFmpeg-devel] [PATCH] add the protection for http range get request 
starting from file size
Signed-off-by: shenqichao 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3a35bc7eac..129f683d15 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1669,7 +1669,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t 
off, int whence, int fo
 int old_buf_size, ret;
 AVDictionary *options = NULL;
 
-if (whence == AVSEEK_SIZE)
+if (whence == AVSEEK_SIZE || (whence == SEEK_SET && off == s->filesize))
 return s->filesize;
 else if (!force_reconnect &&
  ((whence == SEEK_CUR && off == 0) ||
-- 
2.19.0


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-26 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Rostislav Pehlivanov
> Sent: Friday, October 26, 2018 9:02 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary  wrote:
> 
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > > Behalf Of sean darcy
> > > Sent: Thursday, October 25, 2018 11:51 PM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
> > > vaapi rotation feature via call Intel iHD driver
> > >
> > > On 10/25/18 2:52 AM, Zachary Zhou wrote:
> > > > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > > > va/va_vpp.h, tested following command line on SKL platform
> > > >
> > > > dir=0 for 0   degree
> > > > dir=1 for 90  degree
> > > > dir=2 for 180 degree
> > > > dir=3 for 270 degree
> > > >
> > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > > > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> > > > -c:v h264_vaapi output.h264
> > > >
> > > > Signed-off-by: Zachary Zhou 
> > > > ---
> > > >   configure |   3 +
> > > >   libavfilter/Makefile  |   1 +
> > > >   libavfilter/allfilters.c  |   1 +
> > > >   libavfilter/vaapi_vpp.h   |   1 +
> > > >   libavfilter/vf_rotate_vaapi.c | 252
> > ++
> > > >   5 files changed, 258 insertions(+)
> > > >   create mode 100644 libavfilter/vf_rotate_vaapi.c
> > > >
> > > > diff --git a/configure b/configure index 85d5dd5962..33aced3d78
> > > > 100755
> > > > --- a/configure
> > > > +++ b/configure
> > > > @@ -6390,6 +6390,9 @@ if enabled vaapi; then
> > > >   fi
> > > >
> > > >   check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0,
> 0)"
> > > > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"
> > rotation_flags;
> > > then
> > > > +disable rotation_vaapi_filter
> > > > +fi
> > > >   fi
> > > >
> > > >   if enabled_all opencl libdrm ; then diff --git
> > > > a/libavfilter/Makefile b/libavfilter/Makefile index
> > > > 108a2f87d7..534650364a 100644
> > > > --- a/libavfilter/Makefile
> > > > +++ b/libavfilter/Makefile
> > > > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> > > vf_setparams.o
> > > >   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> > > >   OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> > > >   OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> > > vaapi_vpp.o
> > > > +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
> > > vaapi_vpp.o
> > > >   OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> > > >   OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> > > >   OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > > > index
> > > > 557590850b..4b90a7f440 100644
> > > > --- a/libavfilter/allfilters.c
> > > > +++ b/libavfilter/allfilters.c
> > > > @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;
> > > >   extern AVFilter ff_vf_setsar;
> > > >   extern AVFilter ff_vf_settb;
> > > >   extern AVFilter ff_vf_sharpness_vaapi;
> > > > +extern AVFilter ff_vf_rotation_vaapi;
> > > >   extern AVFilter ff_vf_showinfo;
> > > >   extern AVFilter ff_vf_showpalette;
> > > >   extern AVFilter ff_vf_shuffleframes; diff --git
> > > > a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
> > > > 0bc31018d4..cfe19b689f 100644
> > > > --- a/libavfilter/vaapi_vpp.h
> > > > +++ b/libavfilter/vaapi_vpp.h
> > > > @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
> > > >   int output_width;   // computed width
> > > >   int output_height;  // computed height
> > > >
> > > > +int rotation_state;
> > > >   VABufferID filter_buffers[VAProcFilterCount];
> > > >   intnb_filter_buffers;
> > > >
> > > > diff --git a/libavfilter/vf_rotate_vaapi.c
> > > > b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index
> > > > 00..34c270e9c7
> > > > --- /dev/null
> > > > +++ b/libavfilter/vf_rotate_vaapi.c
> > > > @@ -0,0 +1,252 @@
> > > > +/*
> > > > + * This file is part of FFmpeg.
> > > > + *
> > > > + * FFmpeg is free software; you can redistribute it and/or
> > > > + * modify it under the terms of the GNU Lesser General Public
> > > > + * License as published by the Free Software Foundation; either
> > > > + * version 2.1 of the License, or (at your option) any later version.
> > > > + *
> > > > + * FFmpeg is distributed in the hope that it will be useful,
> > > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > > GNU
> > > > + * Lesser General

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-26 Thread Paul B Mahol
On 10/26/18, Zhou, Zachary  wrote:
>
>
>> -Original Message-
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
>> Rostislav Pehlivanov
>> Sent: Friday, October 26, 2018 9:02 PM
>> To: FFmpeg development discussions and patches 
>> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
>> rotation feature via call Intel iHD driver
>>
>> On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary 
>> wrote:
>>
>> >
>> >
>> > > -Original Message-
>> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
>> > > Behalf Of sean darcy
>> > > Sent: Thursday, October 25, 2018 11:51 PM
>> > > To: ffmpeg-devel@ffmpeg.org
>> > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
>> > > vaapi rotation feature via call Intel iHD driver
>> > >
>> > > On 10/25/18 2:52 AM, Zachary Zhou wrote:
>> > > > It supports clockwise rotation by 0/90/180/270 degrees defined in
>> > > > va/va_vpp.h, tested following command line on SKL platform
>> > > >
>> > > > dir=0 for 0   degree
>> > > > dir=1 for 90  degree
>> > > > dir=2 for 180 degree
>> > > > dir=3 for 270 degree
>> > > >
>> > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
>> > > > -hwaccel_output_format vaapi -i input.264 -vf
>> > > > "rotation_vaapi=dir=1"
>> > > > -c:v h264_vaapi output.h264
>> > > >
>> > > > Signed-off-by: Zachary Zhou 
>> > > > ---
>> > > >   configure |   3 +
>> > > >   libavfilter/Makefile  |   1 +
>> > > >   libavfilter/allfilters.c  |   1 +
>> > > >   libavfilter/vaapi_vpp.h   |   1 +
>> > > >   libavfilter/vf_rotate_vaapi.c | 252
>> > ++
>> > > >   5 files changed, 258 insertions(+)
>> > > >   create mode 100644 libavfilter/vf_rotate_vaapi.c
>> > > >
>> > > > diff --git a/configure b/configure index 85d5dd5962..33aced3d78
>> > > > 100755
>> > > > --- a/configure
>> > > > +++ b/configure
>> > > > @@ -6390,6 +6390,9 @@ if enabled vaapi; then
>> > > >   fi
>> > > >
>> > > >   check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0,
>> 0)"
>> > > > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"
>> > rotation_flags;
>> > > then
>> > > > +disable rotation_vaapi_filter
>> > > > +fi
>> > > >   fi
>> > > >
>> > > >   if enabled_all opencl libdrm ; then diff --git
>> > > > a/libavfilter/Makefile b/libavfilter/Makefile index
>> > > > 108a2f87d7..534650364a 100644
>> > > > --- a/libavfilter/Makefile
>> > > > +++ b/libavfilter/Makefile
>> > > > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
>> > > vf_setparams.o
>> > > >   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
>> > > >   OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
>> > > >   OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
>> > > vaapi_vpp.o
>> > > > +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
>> > > vaapi_vpp.o
>> > > >   OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
>> > > >   OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
>> > > >   OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  +=
>> > > > vf_shuffleframes.o
>> > > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> > > > index
>> > > > 557590850b..4b90a7f440 100644
>> > > > --- a/libavfilter/allfilters.c
>> > > > +++ b/libavfilter/allfilters.c
>> > > > @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;
>> > > >   extern AVFilter ff_vf_setsar;
>> > > >   extern AVFilter ff_vf_settb;
>> > > >   extern AVFilter ff_vf_sharpness_vaapi;
>> > > > +extern AVFilter ff_vf_rotation_vaapi;
>> > > >   extern AVFilter ff_vf_showinfo;
>> > > >   extern AVFilter ff_vf_showpalette;
>> > > >   extern AVFilter ff_vf_shuffleframes; diff --git
>> > > > a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
>> > > > 0bc31018d4..cfe19b689f 100644
>> > > > --- a/libavfilter/vaapi_vpp.h
>> > > > +++ b/libavfilter/vaapi_vpp.h
>> > > > @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
>> > > >   int output_width;   // computed width
>> > > >   int output_height;  // computed height
>> > > >
>> > > > +int rotation_state;
>> > > >   VABufferID filter_buffers[VAProcFilterCount];
>> > > >   intnb_filter_buffers;
>> > > >
>> > > > diff --git a/libavfilter/vf_rotate_vaapi.c
>> > > > b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index
>> > > > 00..34c270e9c7
>> > > > --- /dev/null
>> > > > +++ b/libavfilter/vf_rotate_vaapi.c
>> > > > @@ -0,0 +1,252 @@
>> > > > +/*
>> > > > + * This file is part of FFmpeg.
>> > > > + *
>> > > > + * FFmpeg is free software; you can redistribute it and/or
>> > > > + * modify it under the terms of the GNU Lesser General Public
>> > > > + * License as published by the Free Software Foundation; either
>> > > > + * version 2.1 of the License, or (at your option) any later
>> > > > version.
>> > > > + *
>> > > > + * FFmpeg is distributed in the hope that it will be useful,
>> >

[FFmpeg-devel] [PATCH 0/1] avcodec/mf: implemented Media Foundation wrapper

2018-10-26 Thread Paweł Wegner
Hello,

this patch contains wrappers for encoders and decoders available in Media 
Foundation.
The patch is derived from: 
https://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209720.html
I fixed MinGW link warnings and made the patch apply to master branch.

As discussed earlier on IRC; this patch makes sense because it provides 
encoders 
similar to MacOS specific ones based on videotoolbox; it also provides 
non-gpl software h264 encoder under Windows.

Best regards,
Paweł Wegner

Paweł Wegner (1):
  avcodec/mf: implemented Media Foundation wrapper

 configure  |   34 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |   28 +
 libavcodec/mf.c| 1967 
 libavcodec/mf_utils.c  |  696 ++
 libavcodec/mf_utils.h  |  199 
 6 files changed, 2925 insertions(+)
 create mode 100644 libavcodec/mf.c
 create mode 100644 libavcodec/mf_utils.c
 create mode 100644 libavcodec/mf_utils.h

-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 0/3] CUDA implementation of yadif filter

2018-10-26 Thread Philip Langdale
This patch series adds a CUDA implementation of yadif so that we have
a deinterlacing option when doing full GPU transcode or playback with
nvdec and/or nvenc. The nvidia deinterlacer cannot be used with the
nvdec decoder because an hwaccel cannot return more than one frame
per input packet. (It does work with the cuviddec decoder which is
a full decoder, but uses nvidia's parsers which tend to be more
limited than the ffmpeg ones).

Philip Langdale (3):
  libavfilter/vf_yadif: Make frame management logic and options
shareable
  avfilter/vf_yadif_cuda: CUDA accelerated deinterlacer
  avcodec/nvdec: Increase frame pool size to help deinterlacing

 Changelog|   1 +
 configure|   1 +
 doc/filters.texi |  58 +
 libavcodec/nvdec.c   |   2 +-
 libavfilter/Makefile |   3 +-
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   2 +-
 libavfilter/vf_yadif.c   | 190 +---
 libavfilter/vf_yadif_cuda.c  | 426 +++
 libavfilter/vf_yadif_cuda.cu | 296 
 libavfilter/yadif.h  |   9 +
 libavfilter/yadif_common.c   | 209 +
 12 files changed, 1008 insertions(+), 190 deletions(-)
 create mode 100644 libavfilter/vf_yadif_cuda.c
 create mode 100644 libavfilter/vf_yadif_cuda.cu
 create mode 100644 libavfilter/yadif_common.c

-- 
2.19.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] libavfilter/vf_yadif: Make frame management logic and options shareable

2018-10-26 Thread Philip Langdale
I'm writing a cuda implementation of yadif, and while this
obviously has a very different implementation of the actual
filtering, all the frame management is unchanged. To avoid
duplicating that logic, let's make it shareable.

From the perspective of the existing filter, the only real change
is introducing a function pointer for the filter() function so it
can be specified for the specific filter.

Signed-off-by: Philip Langdale 
---
 libavfilter/Makefile   |   2 +-
 libavfilter/vf_yadif.c | 190 +
 libavfilter/yadif.h|   9 ++
 libavfilter/yadif_common.c | 209 +
 4 files changed, 222 insertions(+), 188 deletions(-)
 create mode 100644 libavfilter/yadif_common.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index a98c64b7ce..6729b62b44 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -406,7 +406,7 @@ OBJS-$(CONFIG_WAVEFORM_FILTER)   += 
vf_waveform.o
 OBJS-$(CONFIG_WEAVE_FILTER)  += vf_weave.o
 OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o
 OBJS-$(CONFIG_XSTACK_FILTER) += vf_stack.o framesync.o
-OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
+OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o yadif_common.o
 OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
 OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
 OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index f58d8ac2bc..1ff3ef6fb8 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -22,7 +22,6 @@
 #include "libavutil/avassert.h"
 #include "libavutil/cpu.h"
 #include "libavutil/common.h"
-#include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/imgutils.h"
 #include "avfilter.h"
@@ -254,166 +253,6 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic,
 emms_c();
 }
 
-static int return_frame(AVFilterContext *ctx, int is_second)
-{
-YADIFContext *yadif = ctx->priv;
-AVFilterLink *link  = ctx->outputs[0];
-int tff, ret;
-
-if (yadif->parity == -1) {
-tff = yadif->cur->interlaced_frame ?
-  yadif->cur->top_field_first : 1;
-} else {
-tff = yadif->parity ^ 1;
-}
-
-if (is_second) {
-yadif->out = ff_get_video_buffer(link, link->w, link->h);
-if (!yadif->out)
-return AVERROR(ENOMEM);
-
-av_frame_copy_props(yadif->out, yadif->cur);
-yadif->out->interlaced_frame = 0;
-}
-
-filter(ctx, yadif->out, tff ^ !is_second, tff);
-
-if (is_second) {
-int64_t cur_pts  = yadif->cur->pts;
-int64_t next_pts = yadif->next->pts;
-
-if (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) {
-yadif->out->pts = cur_pts + next_pts;
-} else {
-yadif->out->pts = AV_NOPTS_VALUE;
-}
-}
-ret = ff_filter_frame(ctx->outputs[0], yadif->out);
-
-yadif->frame_pending = (yadif->mode&1) && !is_second;
-return ret;
-}
-
-static int checkstride(YADIFContext *yadif, const AVFrame *a, const AVFrame *b)
-{
-int i;
-for (i = 0; i < yadif->csp->nb_components; i++)
-if (a->linesize[i] != b->linesize[i])
-return 1;
-return 0;
-}
-
-static void fixstride(AVFilterLink *link, AVFrame *f)
-{
-AVFrame *dst = ff_default_get_video_buffer(link, f->width, f->height);
-if(!dst)
-return;
-av_frame_copy_props(dst, f);
-av_image_copy(dst->data, dst->linesize,
-  (const uint8_t **)f->data, f->linesize,
-  dst->format, dst->width, dst->height);
-av_frame_unref(f);
-av_frame_move_ref(f, dst);
-av_frame_free(&dst);
-}
-
-static int filter_frame(AVFilterLink *link, AVFrame *frame)
-{
-AVFilterContext *ctx = link->dst;
-YADIFContext *yadif = ctx->priv;
-
-av_assert0(frame);
-
-if (yadif->frame_pending)
-return_frame(ctx, 1);
-
-if (yadif->prev)
-av_frame_free(&yadif->prev);
-yadif->prev = yadif->cur;
-yadif->cur  = yadif->next;
-yadif->next = frame;
-
-if (!yadif->cur &&
-!(yadif->cur = av_frame_clone(yadif->next)))
-return AVERROR(ENOMEM);
-
-if (checkstride(yadif, yadif->next, yadif->cur)) {
-av_log(ctx, AV_LOG_VERBOSE, "Reallocating frame due to differing 
stride\n");
-fixstride(link, yadif->next);
-}
-if (checkstride(yadif, yadif->next, yadif->cur))
-fixstride(link, yadif->cur);
-if (yadif->prev && checkstride(yadif, yadif->next, yadif->prev))
-fixstride(link, yadif->prev);
-if (checkstride(yadif, yadif->next, yadif->cur) || (yadif->prev && 
checkstride(yadif, yadif->next, yadif->prev))) {
-av_log(ctx, AV_LOG_ERROR, "Failed to reallocate frame\n");
-return -1;
-}
-
-if (!yadif->prev)
-return 0;
-
-if ((yadif->deint && !yadif->cur->interlaced_frame) ||
-   

[FFmpeg-devel] [PATCH 3/3] avcodec/nvdec: Increase frame pool size to help deinterlacing

2018-10-26 Thread Philip Langdale
With the cuda yadif filter in use, the number of mapped decoder
frames could increase by two, as the filter holds on to additional
frames.

Signed-off-by: Philip Langdale 
---
 libavcodec/nvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 4dd6b1acf3..8e91c36084 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -601,7 +601,7 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
 frames_ctx->format= AV_PIX_FMT_CUDA;
 frames_ctx->width = (avctx->coded_width + 1) & ~1;
 frames_ctx->height= (avctx->coded_height + 1) & ~1;
-frames_ctx->initial_pool_size = dpb_size;
+frames_ctx->initial_pool_size = dpb_size + 2;
 
 frames_ctx->free = nvdec_free_dummy;
 frames_ctx->pool = av_buffer_pool_init(0, nvdec_alloc_dummy);
-- 
2.19.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] avfilter/vf_yadif_cuda: CUDA accelerated deinterlacer

2018-10-26 Thread Philip Langdale
Signed-off-by: Philip Langdale 
---
 Changelog|   1 +
 configure|   1 +
 doc/filters.texi |  58 +
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   2 +-
 libavfilter/vf_yadif_cuda.c  | 426 +++
 libavfilter/vf_yadif_cuda.cu | 296 
 8 files changed, 785 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_yadif_cuda.c
 create mode 100644 libavfilter/vf_yadif_cuda.cu

diff --git a/Changelog b/Changelog
index de0383047e..5c053503b5 100644
--- a/Changelog
+++ b/Changelog
@@ -41,6 +41,7 @@ version :
 - decoding S12M timecode in h264
 - xstack filter
 - pcm vidc decoder and encoder
+- yadif_cuda filter
 
 
 version 4.0:
diff --git a/configure b/configure
index 01c3a1011d..5a5d0b0868 100755
--- a/configure
+++ b/configure
@@ -3481,6 +3481,7 @@ zscale_filter_deps="libzimg const_nan"
 scale_vaapi_filter_deps="vaapi"
 vpp_qsv_filter_deps="libmfx"
 vpp_qsv_filter_select="qsvvpp"
+yadif_cuda_filter_deps="cuda_sdk"
 
 # examples
 avio_dir_cmd_deps="avformat avutil"
diff --git a/doc/filters.texi b/doc/filters.texi
index 7811c25ddb..41da25081a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17862,6 +17862,64 @@ filter").
 It accepts the following parameters:
 
 
+@table @option
+
+@item mode
+The interlacing mode to adopt. It accepts one of the following values:
+
+@table @option
+@item 0, send_frame
+Output one frame for each frame.
+@item 1, send_field
+Output one frame for each field.
+@item 2, send_frame_nospatial
+Like @code{send_frame}, but it skips the spatial interlacing check.
+@item 3, send_field_nospatial
+Like @code{send_field}, but it skips the spatial interlacing check.
+@end table
+
+The default value is @code{send_frame}.
+
+@item parity
+The picture field parity assumed for the input interlaced video. It accepts one
+of the following values:
+
+@table @option
+@item 0, tff
+Assume the top field is first.
+@item 1, bff
+Assume the bottom field is first.
+@item -1, auto
+Enable automatic detection of field parity.
+@end table
+
+The default value is @code{auto}.
+If the interlacing is unknown or the decoder does not export this information,
+top field first will be assumed.
+
+@item deint
+Specify which frames to deinterlace. Accept one of the following
+values:
+
+@table @option
+@item 0, all
+Deinterlace all frames.
+@item 1, interlaced
+Only deinterlace frames marked as interlaced.
+@end table
+
+The default value is @code{all}.
+@end table
+
+@section yadif_cuda
+
+Deinterlace the input video using the @ref{yadif} algorithm, but implemented
+in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
+and/or nvenc.
+
+It accepts the following parameters:
+
+
 @table @option
 
 @item mode
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6729b62b44..d2957c6403 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -407,6 +407,7 @@ OBJS-$(CONFIG_WEAVE_FILTER)  += vf_weave.o
 OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o
 OBJS-$(CONFIG_XSTACK_FILTER) += vf_stack.o framesync.o
 OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o yadif_common.o
+OBJS-$(CONFIG_YADIF_CUDA_FILTER) += vf_yadif_cuda.o 
vf_yadif_cuda.ptx.o yadif_common.o
 OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
 OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
 OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b2cb58fc38..daabb2aa65 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -388,6 +388,7 @@ extern AVFilter ff_vf_weave;
 extern AVFilter ff_vf_xbr;
 extern AVFilter ff_vf_xstack;
 extern AVFilter ff_vf_yadif;
+extern AVFilter ff_vf_yadif_cuda;
 extern AVFilter ff_vf_zmq;
 extern AVFilter ff_vf_zoompan;
 extern AVFilter ff_vf_zscale;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 77e1a77b50..e2572d623e 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   7
-#define LIBAVFILTER_VERSION_MINOR  38
+#define LIBAVFILTER_VERSION_MINOR  39
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_yadif_cuda.c b/libavfilter/vf_yadif_cuda.c
new file mode 100644
index 00..728b33076b
--- /dev/null
+++ b/libavfilter/vf_yadif_cuda.c
@@ -0,0 +1,426 @@
+/*
+ * Copyright (C) 2018 Philip Langdale 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope th

Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/qsv: make a copy as libmfx alignment requirement for uploading

2018-10-26 Thread Rogozhkin, Dmitry V
On Fri, 2018-10-26 at 09:34 +, Li, Zhong wrote:
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > Behalf
> > Of Rogozhkin, Dmitry V
> > Sent: Friday, October 26, 2018 8:37 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/qsv: make a copy
> > as
> > libmfx alignment requirement for uploading
> > 
> > On Wed, 2018-10-24 at 23:47 +0100, Mark Thompson wrote:
> > > On 24/10/18 21:45, Rogozhkin, Dmitry V wrote:
> > > > On Tue, 2018-10-23 at 23:46 +0100, Mark Thompson wrote:
> > > > > On 23/10/18 08:49, Li, Zhong wrote:
> > > > > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.or
> > > > > > > g]
> > > > > > > On
> > > > > > > Behalf
> > > > > > > Of Mark Thompson
> > > > > > > Sent: Sunday, October 14, 2018 12:36 AM
> > > > > > > To: ffmpeg-devel@ffmpeg.org
> > > > > > > Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/qsv:
> > > > > > > make a
> > > > > > > copy as libmfx alignment requirement for uploading
> > > > > > > 
> > > > > > > On 11/10/18 06:38, Zhong Li wrote:
> > > > > > > > ffmpeg | branch: master | Zhong Li 
> > > > > > > > |
> > > > > > > > Mon Sep 17
> > > > > > > > 19:16:44 2018 +0800|
> > > > > > > > [681aa7d14f97fd98181ca6d61e11be48fe65692d]
> > > > > > > > > 
> > > > > > > > 
> > > > > > > > committer: Zhong Li
> > > > > > > > 
> > > > > > > > lavu/qsv: make a copy as libmfx alignment requirement
> > > > > > > > for
> > > > > > > > uploading
> > > > > > > > 
> > > > > > > > Libmfx requires 16 bytes aligned input/output for
> > > > > > > > uploading.
> > > > > > > > Currently only output is 16 byte aligned and assigning
> > > > > > > > same
> > > > > > > > width/height to input with smaller buffer size
> > > > > > > > actually,
> > > > > > > > thus definitely will
> > > > > > > 
> > > > > > > cause segment fault.
> > > > > > > > 
> > > > > > > > Can reproduce with any 1080p nv12 rawvideo input:
> > > > > > > > ffmpeg -init_hw_device qsv=qsv:hw -hwaccel qsv
> > > > > > > > -filter_hw_device qsv -f rawvideo -pix_fmt nv12 -s:v
> > > > > > > > 1920x1080 -i 1080p_nv12.yuv -vf
> > > > > > > > 
> > 
> > 'format=nv12,hwupload=extra_hw_frames=16,hwdownload,format=
> > > > > > > > nv12
> > > > > > > > '
> > > > > > > 
> > > > > > > -an
> > > > > > > > -y out_nv12.yuv
> > > > > > > > 
> > > > > > > > It can fix #7418
> > > > > > > > 
> > > > > > > > Signed-off-by: Zhong Li 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > 
> > > > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h
> > > > > > > =681
> > > > > > > aa7d
> > > > > > > 14f9
> > > > > > > > > 7fd98181ca6d61e11be48fe65692d
> > > > > > > > 
> > > > > > > > ---
> > > > > > > > 
> > > > > > > >  libavutil/hwcontext_qsv.c | 31
> > > > > > > > +--
> > > > > > > >  1 file changed, 29 insertions(+), 2 deletions(-)
> > > > > > > > 
> > > > > > > > diff --git a/libavutil/hwcontext_qsv.c
> > > > > > > > b/libavutil/hwcontext_qsv.c index
> > > > > > > > 33e121b416..814ce215ce
> > > > > > > > 100644
> > > > > > > > --- a/libavutil/hwcontext_qsv.c
> > > > > > > > +++ b/libavutil/hwcontext_qsv.c
> > > > > > > > @@ -862,6 +862,10 @@ static int
> > > > > > > 
> > > > > > > qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame
> > > > > > > *dst,
> > > > > > > >  mfxSyncPoint sync = NULL;
> > > > > > > >  mfxStatus err;
> > > > > > > >  int ret = 0;
> > > > > > > > +/* make a copy if the input is not padded as
> > > > > > > > libmfx
> > > > > > > > requires */
> > > > > > > > +AVFrame tmp_frame, *src_frame;
> > > > > > > > +int realigned = 0;
> > > > > > > > +
> > > > > > > > 
> > > > > > > >  while (!s->session_upload_init && !s-
> > > > > > > > >session_upload &&
> > > > > > > > !ret) {
> > > > > > > > #if HAVE_PTHREADS @@ -887,16 +891,36 @@ static int
> > > > > > > > qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame
> > > > > > > > *dst,
> > > > > > > >  if (ret < 0)
> > > > > > > >  return ret;
> > > > > > > > 
> > > > > > > > +
> > > > > > > > +if (src->height & 16 || src->linesize[0] & 16) {
> > > > > > > 
> > > > > > > Doesn't this still need to check that the layout is
> > > > > > > compatible
> > > > > > > with other the limitations that libmfx has before trying
> > > > > > > to do
> > > > > > > the upload?  In particular, that the pitches for the
> > > > > > > different
> > > > > > > planes are actually all the same - I certainly wouldn't
> > > > > > > expect
> > > > > > > them to be for YUV420P.
> > > > > > 
> > > > > > Do you mean our previous discussion on https://lists.libav.
> > > > > > org/
> > > > > > pipe rmail/libav-devel/2018-April/086070.html ?
> > > > > > If yes, I will try to reproduce it with hwupload pipeline
> > > > > > instead of transcoding pipeline, and then give an update
> > > > > > patch.
> > > > > 
> > > > > Yes.  You might need to write a small test program to
> > > > > generation
> > > > > an arbitrary allocation pattern, since libavutil only has a
> > > > > fixed
>

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-26 Thread sean darcy

On 10/26/18 11:18 AM, Paul B Mahol wrote:

On 10/26/18, Zhou, Zachary  wrote:




-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
Rostislav Pehlivanov
Sent: Friday, October 26, 2018 9:02 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
rotation feature via call Intel iHD driver

On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary 
wrote:





-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
Behalf Of sean darcy
Sent: Thursday, October 25, 2018 11:51 PM
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
vaapi rotation feature via call Intel iHD driver

On 10/25/18 2:52 AM, Zachary Zhou wrote:

It supports clockwise rotation by 0/90/180/270 degrees defined in
va/va_vpp.h, tested following command line on SKL platform

dir=0 for 0   degree
dir=1 for 90  degree
dir=2 for 180 degree
dir=3 for 270 degree

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
-hwaccel_output_format vaapi -i input.264 -vf
"rotation_vaapi=dir=1"
-c:v h264_vaapi output.h264

Signed-off-by: Zachary Zhou 
---
   configure |   3 +
   libavfilter/Makefile  |   1 +
   libavfilter/allfilters.c  |   1 +
   libavfilter/vaapi_vpp.h   |   1 +
   libavfilter/vf_rotate_vaapi.c | 252

++

   5 files changed, 258 insertions(+)
   create mode 100644 libavfilter/vf_rotate_vaapi.c

diff --git a/configure b/configure index 85d5dd5962..33aced3d78
100755
--- a/configure
+++ b/configure
@@ -6390,6 +6390,9 @@ if enabled vaapi; then
   fi

   check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0,

0)"

+if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"

rotation_flags;

then

+disable rotation_vaapi_filter
+fi
   fi

   if enabled_all opencl libdrm ; then diff --git
a/libavfilter/Makefile b/libavfilter/Makefile index
108a2f87d7..534650364a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=

vf_setparams.o

   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
   OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
   OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o

vaapi_vpp.o

+OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o

vaapi_vpp.o

   OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
   OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
   OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  +=
vf_shuffleframes.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index
557590850b..4b90a7f440 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;
   extern AVFilter ff_vf_setsar;
   extern AVFilter ff_vf_settb;
   extern AVFilter ff_vf_sharpness_vaapi;
+extern AVFilter ff_vf_rotation_vaapi;
   extern AVFilter ff_vf_showinfo;
   extern AVFilter ff_vf_showpalette;
   extern AVFilter ff_vf_shuffleframes; diff --git
a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
0bc31018d4..cfe19b689f 100644
--- a/libavfilter/vaapi_vpp.h
+++ b/libavfilter/vaapi_vpp.h
@@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
   int output_width;   // computed width
   int output_height;  // computed height

+int rotation_state;
   VABufferID filter_buffers[VAProcFilterCount];
   intnb_filter_buffers;

diff --git a/libavfilter/vf_rotate_vaapi.c
b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index
00..34c270e9c7
--- /dev/null
+++ b/libavfilter/vf_rotate_vaapi.c
@@ -0,0 +1,252 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later
version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

GNU

+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA  */ #include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "vaapi_vpp.h"
+
+// Rotation angle values
+enum RotationAngle {
+ROTATION_0   = 0,
+ROTATION_90  = 1,
+ROTATION_180 = 2,
+ROTATION_270 = 3,
+
+ROTATION_MIN = ROTATION_0,
+ROTATION_MAX = ROTATION_270,
+ROT

[FFmpeg-devel] [PATCH 1/2] avcodec/cbs_vp9: fix parsing sRGB samples

2018-10-26 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/cbs_vp9_syntax_template.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/cbs_vp9_syntax_template.c 
b/libavcodec/cbs_vp9_syntax_template.c
index 0db0f52a6d..b4a7f65e85 100644
--- a/libavcodec/cbs_vp9_syntax_template.c
+++ b/libavcodec/cbs_vp9_syntax_template.c
@@ -65,6 +65,7 @@ static int FUNC(color_config)(CodedBitstreamContext *ctx, 
RWContext *rw,
 if (profile == 1 || profile == 3) {
 infer(subsampling_x, 0);
 infer(subsampling_y, 0);
+f(1, color_config_reserved_zero);
 }
 }
 
-- 
2.19.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avcodec/cbs_vp9: keep track of reference frames

2018-10-26 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/cbs_vp9.h | 15 +-
 libavcodec/cbs_vp9_syntax_template.c | 42 
 2 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h
index 5b99c90c2e..47c3052c7d 100644
--- a/libavcodec/cbs_vp9.h
+++ b/libavcodec/cbs_vp9.h
@@ -117,7 +117,7 @@ typedef struct VP9RawFrameHeader {
 uint8_t frame_context_idx;
 
 // Frame/render size.
-uint8_t found_ref[VP9_REFS_PER_FRAME];
+uint8_t found_ref;
 uint16_t frame_width_minus_1;
 uint16_t frame_height_minus_1;
 uint8_t render_and_frame_size_different;
@@ -183,6 +183,13 @@ typedef struct VP9RawSuperframe {
 VP9RawSuperframeIndex index;
 } VP9RawSuperframe;
 
+typedef struct VP9ReferenceFrameState {
+int frame_width;// RefFrameWidth
+int frame_height;   // RefFrameHeight
+int subsampling_x;  // RefSubsamplingX
+int subsampling_y;  // RefSubsamplingY
+int bit_depth;  // RefBitDepth
+} VP9ReferenceFrameState;
 
 typedef struct CodedBitstreamVP9Context {
 // Frame dimensions in 8x8 mode info blocks.
@@ -192,6 +199,12 @@ typedef struct CodedBitstreamVP9Context {
 uint16_t sb64_cols;
 uint16_t sb64_rows;
 
+int bit_depth;
+int frame_width;
+int frame_height;
+
+VP9ReferenceFrameState ref[VP9_NUM_REF_FRAMES];
+
 // Write buffer.
 uint8_t *write_buffer;
 size_t write_buffer_size;
diff --git a/libavcodec/cbs_vp9_syntax_template.c 
b/libavcodec/cbs_vp9_syntax_template.c
index b4a7f65e85..b6209d979b 100644
--- a/libavcodec/cbs_vp9_syntax_template.c
+++ b/libavcodec/cbs_vp9_syntax_template.c
@@ -43,10 +43,14 @@ static int FUNC(frame_sync_code)(CodedBitstreamContext 
*ctx, RWContext *rw,
 static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw,
   VP9RawFrameHeader *current, int profile)
 {
+CodedBitstreamVP9Context *vp9 = ctx->priv_data;
 int err;
 
-if (profile >= 2)
+if (profile >= 2) {
 f(1, ten_or_twelve_bit);
+vp9->bit_depth = current->ten_or_twelve_bit ? 12 : 10;
+} else
+vp9->bit_depth = 8;
 
 f(3, color_space);
 
@@ -81,8 +85,11 @@ static int FUNC(frame_size)(CodedBitstreamContext *ctx, 
RWContext *rw,
 f(16, frame_width_minus_1);
 f(16, frame_height_minus_1);
 
-vp9->mi_cols = (current->frame_width_minus_1  + 8) >> 3;
-vp9->mi_rows = (current->frame_height_minus_1 + 8) >> 3;
+vp9->frame_width  = current->frame_width_minus_1  + 1;
+vp9->frame_height = current->frame_height_minus_1 + 1;
+
+vp9->mi_cols = (vp9->frame_width  + 7) >> 3;
+vp9->mi_rows = (vp9->frame_height + 7) >> 3;
 vp9->sb64_cols = (vp9->mi_cols + 7) >> 3;
 vp9->sb64_rows = (vp9->mi_rows + 7) >> 3;
 
@@ -107,12 +114,24 @@ static int FUNC(render_size)(CodedBitstreamContext *ctx, 
RWContext *rw,
 static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext 
*rw,
   VP9RawFrameHeader *current)
 {
+CodedBitstreamVP9Context *vp9 = ctx->priv_data;
 int err, i;
 
 for (i = 0; i < VP9_REFS_PER_FRAME; i++) {
-fs(1, found_ref[i], 1, i);
-if (current->found_ref[i])
+f(1, found_ref);
+if (current->found_ref) {
+VP9ReferenceFrameState *ref =
+&vp9->ref[current->ref_frame_idx[i]];
+
+vp9->frame_width  = ref->frame_width;
+vp9->frame_height = ref->frame_height;
+
+vp9->mi_cols = (vp9->frame_width  + 7) >> 3;
+vp9->mi_rows = (vp9->frame_height + 7) >> 3;
+vp9->sb64_cols = (vp9->mi_cols + 7) >> 3;
+vp9->sb64_rows = (vp9->mi_rows + 7) >> 3;
 break;
+}
 }
 if (i >= VP9_REFS_PER_FRAME)
 CHECK(FUNC(frame_size)(ctx, rw, current));
@@ -249,6 +268,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, 
RWContext *rw,
 static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
  VP9RawFrameHeader *current)
 {
+CodedBitstreamVP9Context *vp9 = ctx->priv_data;
 int profile, i;
 int err;
 
@@ -339,6 +359,18 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext 
*ctx, RWContext *rw,
 
 f(16, header_size_in_bytes);
 
+for (i = 0; i < VP9_NUM_REF_FRAMES; i++) {
+if (current->refresh_frame_flags & (1 << i)) {
+vp9->ref[i] = (VP9ReferenceFrameState) {
+.frame_width= vp9->frame_width,
+.frame_height   = vp9->frame_height,
+.subsampling_x  = current->subsampling_x,
+.subsampling_y  = current->subsampling_y,
+.bit_depth  = vp9->bit_depth,
+};
+}
+}
+
 return 0;
 }
 
-- 
2.19.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] add the protection for http range get request starting from file size

2018-10-26 Thread Michael Niedermayer
On Fri, Oct 26, 2018 at 06:40:53PM +0800, shenqichao wrote:
> Signed-off-by: shenqichao 
> ---
>  libavformat/http.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 3a35bc7eac..129f683d15 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -1669,7 +1669,7 @@ static int64_t http_seek_internal(URLContext *h, 
> int64_t off, int whence, int fo
>  int old_buf_size, ret;
>  AVDictionary *options = NULL;
>  
> -if (whence == AVSEEK_SIZE)
> +if (whence == AVSEEK_SIZE || (whence == SEEK_SET && off == s->filesize))
>  return s->filesize;
>  else if (!force_reconnect &&
>   ((whence == SEEK_CUR && off == 0) ||

missing ticket number in commit message

also this doesnt feel correct.
a seek request to the previous file end must not lock up the http code
also the file may at the time of the request have a different size than before


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavdevice/libndi_newtek: Added extra_ips option to libndi_newtek allowing use remote network sources

2018-10-26 Thread Marton Balint



On Fri, 26 Oct 2018, Moritz Barsnick wrote:


On Fri, Oct 26, 2018 at 11:16:02 +0300, Anton Platov wrote:

+{ "extra_ips", "Find available sources on extra ip addresses",   
OFFSET(extra_ips), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC },

  ^

This makes it sound like a boolean option (i.e. whether to find). In
reality, you want a comma separated string of IP addresses[1]. You
should say so, e.g.

"Extra IP addresses to find available sources on (comma separated)".


Also please update docs/indev.texi with the new option.

Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Thierry Foucu
On Wed, Oct 24, 2018 at 4:02 AM Rostislav Pehlivanov 
wrote:

> On Sat, 20 Oct 2018 at 00:50, James Almer  wrote:
>
> > Originally written by Ronald S. Bultje, with fixes, optimizations and
> > improvements by James Almer.
> >
> > Signed-off-by: James Almer 
> > ---
> > Updated to work with libdav1d git head.
> >
> >  configure  |   4 +
> >  libavcodec/Makefile|   1 +
> >  libavcodec/allcodecs.c |   1 +
> >  libavcodec/libdav1d.c  | 271 +
> >  4 files changed, 277 insertions(+)
> >  create mode 100644 libavcodec/libdav1d.c
> >
>
> There hasn't even been a 0.1 release yet, and there won't be one that soon.
> As far as I know the promise is for that to be out by the 30th next month.
> Also I'm still against this making it into the next release.
>

Why should we wait for a 0.1 release?
If we want to benchmark it against libaom, this is good to have in ffmpeg.
It does not have to be the default decoder...


> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libaomenc: Add support for tiles

2018-10-26 Thread Thierry Foucu
On Mon, Oct 22, 2018 at 3:45 PM Mark Thompson  wrote:

> Adds an option to specify the number of tile rows and columns, then uses
> a uniform tiling if possible and otherwise a fixed tiling with equal-sized
> tiles to fill the frame.
>
> Also adds -tile-columns and -tile-rows options to make tilings with
> power-of-two numbers of tiles, matching the behaviour of the libvpx/VP9
> encoder.
> ---
> On 03/10/18 00:50, Mark Thompson wrote:
> > ...
>
> Ping.
>
> (Rebased following e265832c378c3f4dc372f1c0f477810f63dd60fd.)
>
> Thanks,
>
> - Mark
>
>
>  libavcodec/libaomenc.c | 188 +
>  1 file changed, 188 insertions(+)
>
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 045c519f72..c5458766cb 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -34,6 +34,7 @@
>  #include "libavutil/opt.h"
>  #include "libavutil/pixdesc.h"
>
> +#include "av1.h"
>  #include "avcodec.h"
>  #include "internal.h"
>  #include "profiles.h"
> @@ -74,6 +75,10 @@ typedef struct AOMEncoderContext {
>  uint64_t sse[4];
>  int have_sse; /**< true if we have pending sse[] */
>  uint64_t frame_number;
> +int tile_cols, tile_rows;
> +int tile_cols_log2, tile_rows_log2;
> +aom_superblock_size_t superblock_size;
> +int uniform_tiles;
>  } AOMContext;
>
>  static const char *const ctlidstr[] = {
> @@ -85,6 +90,9 @@ static const char *const ctlidstr[] = {
>  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
>  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
>  [AV1E_SET_TRANSFER_CHARACTERISTICS] =
> "AV1E_SET_TRANSFER_CHARACTERISTICS",
> +[AV1E_SET_SUPERBLOCK_SIZE]  = "AV1E_SET_SUPERBLOCK_SIZE",
> +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
> +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
>  };
>
>  static av_cold void log_encoder_error(AVCodecContext *avctx, const char
> *desc)
> @@ -149,6 +157,10 @@ static av_cold void dump_enc_cfg(AVCodecContext
> *avctx,
> width, "kf_mode:", cfg->kf_mode,
> width, "kf_min_dist:", cfg->kf_min_dist,
> width, "kf_max_dist:", cfg->kf_max_dist);
> +av_log(avctx, level, "tile settings\n"
> + "  %*s%d\n  %*s%d\n",
> +   width, "tile_width_count:",  cfg->tile_width_count,
> +   width, "tile_height_count:", cfg->tile_height_count);
>  av_log(avctx, level, "\n");
>  }
>
> @@ -290,6 +302,169 @@ static void set_color_range(AVCodecContext *avctx)
>  codecctl_int(avctx, AV1E_SET_COLOR_RANGE, aom_cr);
>  }
>
> +static int count_uniform_tiling(int dim, int sb_size, int tiles_log2)
> +{
> +int sb_dim   = (dim + sb_size - 1) / sb_size;
> +int tile_dim = (sb_dim + (1 << tiles_log2) - 1) >> tiles_log2;
> +av_assert0(tile_dim > 0);
> +return (sb_dim + tile_dim - 1) / tile_dim;
> +}
> +
> +static int choose_tiling(AVCodecContext *avctx,
> + struct aom_codec_enc_cfg *enccfg)
> +{
> +AOMContext *ctx = avctx->priv_data;
> +int sb_128x128_possible, sb_size, sb_width, sb_height;
> +int uniform_rows, uniform_cols;
> +int uniform_64x64_possible, uniform_128x128_possible;
> +int tile_size, rounding, i;
> +
> +if (ctx->tile_cols_log2 >= 0)
> +ctx->tile_cols = 1 << ctx->tile_cols_log2;
> +if (ctx->tile_rows_log2 >= 0)
> +ctx->tile_rows = 1 << ctx->tile_rows_log2;
> +
> +if (ctx->tile_cols == 0) {
> +ctx->tile_cols = (avctx->width + AV1_MAX_TILE_WIDTH - 1) /
> +AV1_MAX_TILE_WIDTH;
> +if (ctx->tile_cols > 1) {
> +av_log(avctx, AV_LOG_DEBUG, "Automatically using %d tile "
> +   "columns to fill width.\n", ctx->tile_cols);
> +}
> +}
> +av_assert0(ctx->tile_cols > 0);
> +if (ctx->tile_rows == 0) {
> +int max_tile_width =
> +FFALIGN((FFALIGN(avctx->width, 128) +
> + ctx->tile_cols - 1) / ctx->tile_cols, 128);
> +ctx->tile_rows =
> +(max_tile_width * FFALIGN(avctx->height, 128) +
> + AV1_MAX_TILE_AREA - 1) / AV1_MAX_TILE_AREA;
> +if (ctx->tile_rows > 1) {
> +av_log(avctx, AV_LOG_DEBUG, "Automatically using %d tile "
> +   "rows to fill area.\n", ctx->tile_rows);
> +}
> +}
> +av_assert0(ctx->tile_rows > 0);
> +
> +if ((avctx->width  + 63) / 64 < ctx->tile_cols ||
> +(avctx->height + 63) / 64 < ctx->tile_rows) {
> +av_log(avctx, AV_LOG_ERROR, "Invalid tile sizing: frame not "
> +   "large enough to fit specified tile arrangement.\n");
> +return AVERROR(EINVAL);
> +}
> +if (ctx->tile_cols > AV1_MAX_TILE_COLS ||
> +ctx->tile_rows > AV1_MAX_TILE_ROWS) {
> +av_log(avctx, AV_LOG_ERROR, "Invalid tile sizing: AV1 does "
> +   "not allow more than %dx%d tiles.\n",
> +   AV1_MAX_TILE_COLS, AV1_MAX_TILE_ROWS);
> +return 

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_vp9: keep track of reference frames

2018-10-26 Thread Michael Niedermayer
On Fri, Oct 26, 2018 at 04:37:07PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/cbs_vp9.h | 15 +-
>  libavcodec/cbs_vp9_syntax_template.c | 42 
>  2 files changed, 51 insertions(+), 6 deletions(-)

this breaks fate

--- ./tests/ref/fate/cbs-vp9-vp90-2-05-resize   2018-10-25 01:58:06.857005980 
+0200
+++ tests/data/fate/cbs-vp9-vp90-2-05-resize2018-10-26 23:02:53.528424915 
+0200
@@ -1 +1 @@
-6838422ebb45df353a2bad62b9aff8e9
+b3f142c27ba8cc205324d626af3a0a60
Test cbs-vp9-vp90-2-05-resize failed. Look at 
tests/data/fate/cbs-vp9-vp90-2-05-resize.err for details.
make: *** [fate-cbs-vp9-vp90-2-05-resize] Error 1

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-26 Thread Michael Niedermayer
On Thu, Oct 25, 2018 at 02:52:01PM +0800, Zachary Zhou wrote:
> It supports clockwise rotation by 0/90/180/270 degrees defined in
> va/va_vpp.h, tested following command line on SKL platform
> 
> dir=0 for 0   degree
> dir=1 for 90  degree
> dir=2 for 180 degree
> dir=3 for 270 degree
> 
> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> -c:v h264_vaapi output.h264
> 
> Signed-off-by: Zachary Zhou 
> ---
>  configure |   3 +
>  libavfilter/Makefile  |   1 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/vaapi_vpp.h   |   1 +
>  libavfilter/vf_rotate_vaapi.c | 252 ++
>  5 files changed, 258 insertions(+)
>  create mode 100644 libavfilter/vf_rotate_vaapi.c

still fails to build on 32bit x86

src/libavfilter/vf_rotate_vaapi.c: In function 
‘rotation_vaapi_build_filter_params’:
src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’ has no 
member named ‘rotation_flags’
 if (!pipeline_caps.rotation_flags) {
   ^
src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’ has no 
member named ‘rotation_flags’
 support_flag = pipeline_caps.rotation_flags &
 ^
src/libavfilter/vf_rotate_vaapi.c: In function ‘rotation_vaapi_filter_frame’:
src/libavfilter/vf_rotate_vaapi.c:152:15: error: 
‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’
 params.rotation_state = vpp_ctx->rotation_state;
   ^
make: *** [libavfilter/vf_rotate_vaapi.o] Error 1
make: *** Waiting for unfinished jobs

grep VAAPI ffbuild/config.mak 
!HAVE_VAAPI_DRM=yes
!HAVE_VAAPI_X11=yes
!HAVE_OPENCL_VAAPI_BEIGNET=yes
!HAVE_OPENCL_VAAPI_INTEL_MEDIA=yes
!CONFIG_VAAPI_ENCODE_EXAMPLE=yes
!CONFIG_VAAPI_TRANSCODE_EXAMPLE=yes
!CONFIG_VAAPI=yes
!CONFIG_VAAPI_1=yes
!CONFIG_VAAPI_ENCODE=yes
!CONFIG_H264_VAAPI_ENCODER=yes
!CONFIG_HEVC_VAAPI_ENCODER=yes
!CONFIG_MJPEG_VAAPI_ENCODER=yes
!CONFIG_MPEG2_VAAPI_ENCODER=yes
!CONFIG_VP8_VAAPI_ENCODER=yes
!CONFIG_VP9_VAAPI_ENCODER=yes
!CONFIG_H263_VAAPI_HWACCEL=yes
!CONFIG_H264_VAAPI_HWACCEL=yes
!CONFIG_HEVC_VAAPI_HWACCEL=yes
!CONFIG_MJPEG_VAAPI_HWACCEL=yes
!CONFIG_MPEG2_VAAPI_HWACCEL=yes
!CONFIG_MPEG4_VAAPI_HWACCEL=yes
!CONFIG_VC1_VAAPI_HWACCEL=yes
!CONFIG_VP8_VAAPI_HWACCEL=yes
!CONFIG_VP9_VAAPI_HWACCEL=yes
!CONFIG_WMV3_VAAPI_HWACCEL=yes
!CONFIG_DEINTERLACE_VAAPI_FILTER=yes
!CONFIG_DENOISE_VAAPI_FILTER=yes
!CONFIG_PROCAMP_VAAPI_FILTER=yes
!CONFIG_SCALE_VAAPI_FILTER=yes
!CONFIG_SHARPNESS_VAAPI_FILTER=yes
CONFIG_ROTATION_VAAPI_FILTER=yes

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Baptiste Coudurier
Hey guys,

On Tue, Oct 23, 2018 at 4:42 PM James Almer  wrote:

> On 10/23/2018 8:15 PM, Dale Curtis wrote:
> > On Fri, Oct 19, 2018 at 4:50 PM James Almer  wrote:
> >
> >> +s.n_tile_threads = dav1d->tile_threads;
> >> +s.n_frame_threads = dav1d->frame_threads;
> >>
> >
> > Did you consider using the AVCodecContext.threads value along
> > AVCodecContext.thread_type flags? That seems to be how this is handled
> > elsewhere.
> >
> > - dale
>
> I did, but with the library offering options for both tiles or frames i
> wasn't sure if choosing one or the other was a good idea.
> I could map avctx->thread_count to n_frame_threads and leave the other
> as a decoder specific option, i guess, but with the current API there's
> no single optimal way for auto threads.


Agree. We should map them. Can we add frame type tiles ?

-- 
Baptiste Coudurier
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/cbs_vp9: fix parsing sRGB samples

2018-10-26 Thread Hendrik Leppkes
On Fri, Oct 26, 2018 at 9:37 PM James Almer  wrote:
>
> Signed-off-by: James Almer 
> ---
>  libavcodec/cbs_vp9_syntax_template.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/cbs_vp9_syntax_template.c 
> b/libavcodec/cbs_vp9_syntax_template.c
> index 0db0f52a6d..b4a7f65e85 100644
> --- a/libavcodec/cbs_vp9_syntax_template.c
> +++ b/libavcodec/cbs_vp9_syntax_template.c
> @@ -65,6 +65,7 @@ static int FUNC(color_config)(CodedBitstreamContext *ctx, 
> RWContext *rw,
>  if (profile == 1 || profile == 3) {
>  infer(subsampling_x, 0);
>  infer(subsampling_y, 0);
> +f(1, color_config_reserved_zero);
>  }
>  }
>

What an odd quirk in the bitstream, the entire RGB branch has no coded
values but that single reserved one?
LGTM.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Hendrik Leppkes
On Fri, Oct 26, 2018 at 10:46 PM Thierry Foucu  wrote:
>
> On Wed, Oct 24, 2018 at 4:02 AM Rostislav Pehlivanov 
> wrote:
>
> > On Sat, 20 Oct 2018 at 00:50, James Almer  wrote:
> >
> > > Originally written by Ronald S. Bultje, with fixes, optimizations and
> > > improvements by James Almer.
> > >
> > > Signed-off-by: James Almer 
> > > ---
> > > Updated to work with libdav1d git head.
> > >
> > >  configure  |   4 +
> > >  libavcodec/Makefile|   1 +
> > >  libavcodec/allcodecs.c |   1 +
> > >  libavcodec/libdav1d.c  | 271 +
> > >  4 files changed, 277 insertions(+)
> > >  create mode 100644 libavcodec/libdav1d.c
> > >
> >
> > There hasn't even been a 0.1 release yet, and there won't be one that soon.
> > As far as I know the promise is for that to be out by the 30th next month.
> > Also I'm still against this making it into the next release.
> >
>
> Why should we wait for a 0.1 release?
> If we want to benchmark it against libaom, this is good to have in ffmpeg.
> It does not have to be the default decoder...
>

If there is no guarantees whatsoever for API/ABI stability yet, adding
a wrapper already seems a bit early.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2 v2] avcodec/cbs_vp9: keep track of reference frames

2018-10-26 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/cbs_vp9.h | 13 +
 libavcodec/cbs_vp9_syntax_template.c | 40 +---
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h
index 5b99c90c2e..7eee6d5e9e 100644
--- a/libavcodec/cbs_vp9.h
+++ b/libavcodec/cbs_vp9.h
@@ -183,6 +183,13 @@ typedef struct VP9RawSuperframe {
 VP9RawSuperframeIndex index;
 } VP9RawSuperframe;
 
+typedef struct VP9ReferenceFrameState {
+int frame_width;// RefFrameWidth
+int frame_height;   // RefFrameHeight
+int subsampling_x;  // RefSubsamplingX
+int subsampling_y;  // RefSubsamplingY
+int bit_depth;  // RefBitDepth
+} VP9ReferenceFrameState;
 
 typedef struct CodedBitstreamVP9Context {
 // Frame dimensions in 8x8 mode info blocks.
@@ -192,6 +199,12 @@ typedef struct CodedBitstreamVP9Context {
 uint16_t sb64_cols;
 uint16_t sb64_rows;
 
+int bit_depth;
+int frame_width;
+int frame_height;
+
+VP9ReferenceFrameState ref[VP9_NUM_REF_FRAMES];
+
 // Write buffer.
 uint8_t *write_buffer;
 size_t write_buffer_size;
diff --git a/libavcodec/cbs_vp9_syntax_template.c 
b/libavcodec/cbs_vp9_syntax_template.c
index b4a7f65e85..cd5b83a4f5 100644
--- a/libavcodec/cbs_vp9_syntax_template.c
+++ b/libavcodec/cbs_vp9_syntax_template.c
@@ -43,10 +43,14 @@ static int FUNC(frame_sync_code)(CodedBitstreamContext 
*ctx, RWContext *rw,
 static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw,
   VP9RawFrameHeader *current, int profile)
 {
+CodedBitstreamVP9Context *vp9 = ctx->priv_data;
 int err;
 
-if (profile >= 2)
+if (profile >= 2) {
 f(1, ten_or_twelve_bit);
+vp9->bit_depth = current->ten_or_twelve_bit ? 12 : 10;
+} else
+vp9->bit_depth = 8;
 
 f(3, color_space);
 
@@ -81,8 +85,11 @@ static int FUNC(frame_size)(CodedBitstreamContext *ctx, 
RWContext *rw,
 f(16, frame_width_minus_1);
 f(16, frame_height_minus_1);
 
-vp9->mi_cols = (current->frame_width_minus_1  + 8) >> 3;
-vp9->mi_rows = (current->frame_height_minus_1 + 8) >> 3;
+vp9->frame_width  = current->frame_width_minus_1  + 1;
+vp9->frame_height = current->frame_height_minus_1 + 1;
+
+vp9->mi_cols = (vp9->frame_width  + 7) >> 3;
+vp9->mi_rows = (vp9->frame_height + 7) >> 3;
 vp9->sb64_cols = (vp9->mi_cols + 7) >> 3;
 vp9->sb64_rows = (vp9->mi_rows + 7) >> 3;
 
@@ -107,12 +114,24 @@ static int FUNC(render_size)(CodedBitstreamContext *ctx, 
RWContext *rw,
 static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext 
*rw,
   VP9RawFrameHeader *current)
 {
+CodedBitstreamVP9Context *vp9 = ctx->priv_data;
 int err, i;
 
 for (i = 0; i < VP9_REFS_PER_FRAME; i++) {
 fs(1, found_ref[i], 1, i);
-if (current->found_ref[i])
+if (current->found_ref[i]) {
+VP9ReferenceFrameState *ref =
+&vp9->ref[current->ref_frame_idx[i]];
+
+vp9->frame_width  = ref->frame_width;
+vp9->frame_height = ref->frame_height;
+
+vp9->mi_cols = (vp9->frame_width  + 7) >> 3;
+vp9->mi_rows = (vp9->frame_height + 7) >> 3;
+vp9->sb64_cols = (vp9->mi_cols + 7) >> 3;
+vp9->sb64_rows = (vp9->mi_rows + 7) >> 3;
 break;
+}
 }
 if (i >= VP9_REFS_PER_FRAME)
 CHECK(FUNC(frame_size)(ctx, rw, current));
@@ -249,6 +268,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, 
RWContext *rw,
 static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
  VP9RawFrameHeader *current)
 {
+CodedBitstreamVP9Context *vp9 = ctx->priv_data;
 int profile, i;
 int err;
 
@@ -339,6 +359,18 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext 
*ctx, RWContext *rw,
 
 f(16, header_size_in_bytes);
 
+for (i = 0; i < VP9_NUM_REF_FRAMES; i++) {
+if (current->refresh_frame_flags & (1 << i)) {
+vp9->ref[i] = (VP9ReferenceFrameState) {
+.frame_width= vp9->frame_width,
+.frame_height   = vp9->frame_height,
+.subsampling_x  = current->subsampling_x,
+.subsampling_y  = current->subsampling_y,
+.bit_depth  = vp9->bit_depth,
+};
+}
+}
+
 return 0;
 }
 
-- 
2.19.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Dale Curtis
The following warnings show up when compiling with clang:
../../third_party/ffmpeg/libavcodec/libdav1d.c:92:24: error: suggest braces
around initialization of subobject [-Werror,-Wmissing-braces]
Dav1dPicture p = { 0 };
   ^
   {}
../../third_party/ffmpeg/libavcodec/libdav1d.c:119:24: error: suggest
braces around initialization of subobject [-Werror,-Wmissing-braces]
Dav1dPicture p = { 0 };
   ^
   {}
../../third_party/ffmpeg/libavcodec/libdav1d.c:194:45: error: implicit
conversion from enumeration type 'enum Dav1dMatrixCoefficients' to
different enumeration type 'enum AVColorSpace' [-Werror,-Wenum-conversion]
frame->colorspace = c->colorspace = p.p.mtrx;
  ~ ^~~~
../../third_party/ffmpeg/libavcodec/libdav1d.c:195:55: error: implicit
conversion from enumeration type 'enum Dav1dColorPrimaries' to different
enumeration type 'enum AVColorPrimaries' [-Werror,-Wenum-conversion]
frame->color_primaries = c->color_primaries = p.p.pri;
~ ^~~
../../third_party/ffmpeg/libavcodec/libdav1d.c:196:43: error: implicit
conversion from enumeration type 'enum Dav1dTransferCharacteristics' to
different enumeration type 'enum AVColorTransferCharacteristic'
[-Werror,-Wenum-conversion]
frame->color_trc = c->color_trc = p.p.trc;
~ ^~~
5 errors generated.



On Fri, Oct 26, 2018 at 2:59 PM Hendrik Leppkes  wrote:

> On Fri, Oct 26, 2018 at 10:46 PM Thierry Foucu  wrote:
> >
> > On Wed, Oct 24, 2018 at 4:02 AM Rostislav Pehlivanov <
> atomnu...@gmail.com>
> > wrote:
> >
> > > On Sat, 20 Oct 2018 at 00:50, James Almer  wrote:
> > >
> > > > Originally written by Ronald S. Bultje, with fixes, optimizations and
> > > > improvements by James Almer.
> > > >
> > > > Signed-off-by: James Almer 
> > > > ---
> > > > Updated to work with libdav1d git head.
> > > >
> > > >  configure  |   4 +
> > > >  libavcodec/Makefile|   1 +
> > > >  libavcodec/allcodecs.c |   1 +
> > > >  libavcodec/libdav1d.c  | 271
> +
> > > >  4 files changed, 277 insertions(+)
> > > >  create mode 100644 libavcodec/libdav1d.c
> > > >
> > >
> > > There hasn't even been a 0.1 release yet, and there won't be one that
> soon.
> > > As far as I know the promise is for that to be out by the 30th next
> month.
> > > Also I'm still against this making it into the next release.
> > >
> >
> > Why should we wait for a 0.1 release?
> > If we want to benchmark it against libaom, this is good to have in
> ffmpeg.
> > It does not have to be the default decoder...
> >
>
> If there is no guarantees whatsoever for API/ABI stability yet, adding
> a wrapper already seems a bit early.
>
> - Hendrik
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Dale Curtis
One more piece of feedback, this is not obeying the
AVCodecContext.get_buffer2 API.

- dale

On Fri, Oct 26, 2018 at 3:31 PM Dale Curtis  wrote:

> The following warnings show up when compiling with clang:
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:92:24: error: suggest
> braces around initialization of subobject [-Werror,-Wmissing-braces]
> Dav1dPicture p = { 0 };
>^
>{}
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:119:24: error: suggest
> braces around initialization of subobject [-Werror,-Wmissing-braces]
> Dav1dPicture p = { 0 };
>^
>{}
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:194:45: error: implicit
> conversion from enumeration type 'enum Dav1dMatrixCoefficients' to
> different enumeration type 'enum AVColorSpace' [-Werror,-Wenum-conversion]
> frame->colorspace = c->colorspace = p.p.mtrx;
>   ~ ^~~~
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:195:55: error: implicit
> conversion from enumeration type 'enum Dav1dColorPrimaries' to different
> enumeration type 'enum AVColorPrimaries' [-Werror,-Wenum-conversion]
> frame->color_primaries = c->color_primaries = p.p.pri;
> ~ ^~~
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:196:43: error: implicit
> conversion from enumeration type 'enum Dav1dTransferCharacteristics' to
> different enumeration type 'enum AVColorTransferCharacteristic'
> [-Werror,-Wenum-conversion]
> frame->color_trc = c->color_trc = p.p.trc;
> ~ ^~~
> 5 errors generated.
>
>
>
> On Fri, Oct 26, 2018 at 2:59 PM Hendrik Leppkes 
> wrote:
>
>> On Fri, Oct 26, 2018 at 10:46 PM Thierry Foucu  wrote:
>> >
>> > On Wed, Oct 24, 2018 at 4:02 AM Rostislav Pehlivanov <
>> atomnu...@gmail.com>
>> > wrote:
>> >
>> > > On Sat, 20 Oct 2018 at 00:50, James Almer  wrote:
>> > >
>> > > > Originally written by Ronald S. Bultje, with fixes, optimizations
>> and
>> > > > improvements by James Almer.
>> > > >
>> > > > Signed-off-by: James Almer 
>> > > > ---
>> > > > Updated to work with libdav1d git head.
>> > > >
>> > > >  configure  |   4 +
>> > > >  libavcodec/Makefile|   1 +
>> > > >  libavcodec/allcodecs.c |   1 +
>> > > >  libavcodec/libdav1d.c  | 271
>> +
>> > > >  4 files changed, 277 insertions(+)
>> > > >  create mode 100644 libavcodec/libdav1d.c
>> > > >
>> > >
>> > > There hasn't even been a 0.1 release yet, and there won't be one that
>> soon.
>> > > As far as I know the promise is for that to be out by the 30th next
>> month.
>> > > Also I'm still against this making it into the next release.
>> > >
>> >
>> > Why should we wait for a 0.1 release?
>> > If we want to benchmark it against libaom, this is good to have in
>> ffmpeg.
>> > It does not have to be the default decoder...
>> >
>>
>> If there is no guarantees whatsoever for API/ABI stability yet, adding
>> a wrapper already seems a bit early.
>>
>> - Hendrik
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread James Almer
On 10/26/2018 7:50 PM, Dale Curtis wrote:
> One more piece of feedback, this is not obeying the
> AVCodecContext.get_buffer2 API.

It's not using it on purpose, wrapping the buffers dav1d allocated
itself instead. Hence the lack of AV_CODEC_CAP_DR1 flag.

> 
> - dale
> 
> On Fri, Oct 26, 2018 at 3:31 PM Dale Curtis  wrote:
> 
>> The following warnings show up when compiling with clang:
>> ../../third_party/ffmpeg/libavcodec/libdav1d.c:92:24: error: suggest
>> braces around initialization of subobject [-Werror,-Wmissing-braces]
>> Dav1dPicture p = { 0 };
>>^
>>{}
>> ../../third_party/ffmpeg/libavcodec/libdav1d.c:119:24: error: suggest
>> braces around initialization of subobject [-Werror,-Wmissing-braces]
>> Dav1dPicture p = { 0 };
>>^
>>{}
>> ../../third_party/ffmpeg/libavcodec/libdav1d.c:194:45: error: implicit
>> conversion from enumeration type 'enum Dav1dMatrixCoefficients' to
>> different enumeration type 'enum AVColorSpace' [-Werror,-Wenum-conversion]
>> frame->colorspace = c->colorspace = p.p.mtrx;
>>   ~ ^~~~
>> ../../third_party/ffmpeg/libavcodec/libdav1d.c:195:55: error: implicit
>> conversion from enumeration type 'enum Dav1dColorPrimaries' to different
>> enumeration type 'enum AVColorPrimaries' [-Werror,-Wenum-conversion]
>> frame->color_primaries = c->color_primaries = p.p.pri;
>> ~ ^~~
>> ../../third_party/ffmpeg/libavcodec/libdav1d.c:196:43: error: implicit
>> conversion from enumeration type 'enum Dav1dTransferCharacteristics' to
>> different enumeration type 'enum AVColorTransferCharacteristic'
>> [-Werror,-Wenum-conversion]
>> frame->color_trc = c->color_trc = p.p.trc;
>> ~ ^~~
>> 5 errors generated.
>>
>>
>>
>> On Fri, Oct 26, 2018 at 2:59 PM Hendrik Leppkes 
>> wrote:
>>
>>> On Fri, Oct 26, 2018 at 10:46 PM Thierry Foucu  wrote:

 On Wed, Oct 24, 2018 at 4:02 AM Rostislav Pehlivanov <
>>> atomnu...@gmail.com>
 wrote:

> On Sat, 20 Oct 2018 at 00:50, James Almer  wrote:
>
>> Originally written by Ronald S. Bultje, with fixes, optimizations
>>> and
>> improvements by James Almer.
>>
>> Signed-off-by: James Almer 
>> ---
>> Updated to work with libdav1d git head.
>>
>>  configure  |   4 +
>>  libavcodec/Makefile|   1 +
>>  libavcodec/allcodecs.c |   1 +
>>  libavcodec/libdav1d.c  | 271
>>> +
>>  4 files changed, 277 insertions(+)
>>  create mode 100644 libavcodec/libdav1d.c
>>
>
> There hasn't even been a 0.1 release yet, and there won't be one that
>>> soon.
> As far as I know the promise is for that to be out by the 30th next
>>> month.
> Also I'm still against this making it into the next release.
>

 Why should we wait for a 0.1 release?
 If we want to benchmark it against libaom, this is good to have in
>>> ffmpeg.
 It does not have to be the default decoder...

>>>
>>> If there is no guarantees whatsoever for API/ABI stability yet, adding
>>> a wrapper already seems a bit early.
>>>
>>> - Hendrik
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread James Almer
On 10/26/2018 7:31 PM, Dale Curtis wrote:
> The following warnings show up when compiling with clang:
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:92:24: error: suggest braces
> around initialization of subobject [-Werror,-Wmissing-braces]
> Dav1dPicture p = { 0 };
>^
>{}

Does "Dav1dPicture p = { .ref = opaque };" silences this one up?

> ../../third_party/ffmpeg/libavcodec/libdav1d.c:119:24: error: suggest
> braces around initialization of subobject [-Werror,-Wmissing-braces]
> Dav1dPicture p = { 0 };
>^
>{}

For this one I'd have to use { { 0 } } or a memset, but maybe the struct
could start with an int or something else instead of the data pointer
arrays.

> ../../third_party/ffmpeg/libavcodec/libdav1d.c:194:45: error: implicit
> conversion from enumeration type 'enum Dav1dMatrixCoefficients' to
> different enumeration type 'enum AVColorSpace' [-Werror,-Wenum-conversion]
> frame->colorspace = c->colorspace = p.p.mtrx;
>   ~ ^~~~
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:195:55: error: implicit
> conversion from enumeration type 'enum Dav1dColorPrimaries' to different
> enumeration type 'enum AVColorPrimaries' [-Werror,-Wenum-conversion]
> frame->color_primaries = c->color_primaries = p.p.pri;
> ~ ^~~
> ../../third_party/ffmpeg/libavcodec/libdav1d.c:196:43: error: implicit
> conversion from enumeration type 'enum Dav1dTransferCharacteristics' to
> different enumeration type 'enum AVColorTransferCharacteristic'
> [-Werror,-Wenum-conversion]
> frame->color_trc = c->color_trc = p.p.trc;
> ~ ^~~

I can cast the enums to silence these errors, sure.

> 5 errors generated.

5 very pedantic "errors" :p
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Dale Curtis
On Fri, Oct 26, 2018 at 4:00 PM James Almer  wrote:

> On 10/26/2018 7:50 PM, Dale Curtis wrote:
> > One more piece of feedback, this is not obeying the
> > AVCodecContext.get_buffer2 API.
>
> It's not using it on purpose, wrapping the buffers dav1d allocated
> itself instead. Hence the lack of AV_CODEC_CAP_DR1 flag.
>

Sorry for being unclear, my comment was a request. This is something
Chromium would require to use this wrapper. If it's not planned, we'd forgo
the wrapper and use dav1d directly. Otherwise we'd need to change our
common ffmpeg based decoder enough for this one case that we'd be better
off writing a pure dav1d based decoder. Thanks for your consideration in
any case.

- dale
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/wmaprodec: improve XMA missing samples

2018-10-26 Thread bananaman255
From: bnnm 

Writes missing (delay) samples after EOF.

Signed-off-by: bnnm 
---
 libavcodec/wmaprodec.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 9439bfa771..d0fa974c80 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -210,6 +210,7 @@ typedef struct WMAProDecodeCtx {
 int  subframe_offset;   ///< subframe offset in 
the bit reservoir
 uint8_t  packet_loss;   ///< set in case of 
bitstream error
 uint8_t  packet_done;   ///< set when a packet is 
fully decoded
+uint8_t  eof_done;  ///< set when EOF reached 
and extra subframe is written (XMA1/2)
 
 /* frame decode state */
 uint32_t frame_num; ///< current frame number 
(not used for decoding)
@@ -1609,7 +1610,34 @@ static int decode_packet(AVCodecContext *avctx, 
WMAProDecodeCtx *s,
 
 *got_frame_ptr = 0;
 
-if (s->packet_done || s->packet_loss) {
+if (!buf_size) {
+AVFrame *frame = data;
+int i;
+
+/** Must output remaining samples after stream end. WMAPRO 5.1 created
+ * by XWMA encoder don't though (maybe only 1/2ch streams need it). */
+s->packet_done = 0;
+if (s->eof_done)
+return 0;
+
+/** clean output buffer and copy last IMDCT samples */
+for (i = 0; i < s->nb_channels; i++) {
+memset(frame->extended_data[i], 0,
+s->samples_per_frame * sizeof(*s->channel[i].out));
+
+memcpy(frame->extended_data[i], s->channel[i].out,
+   s->samples_per_frame * sizeof(*s->channel[i].out) >> 1);
+}
+
+/* TODO: XMA should output 128 samples only (instead of 512) and WMAPRO
+ * maybe 768 (with 2048), XMA needs changes in multi-stream handling 
though. */
+
+s->eof_done = 1;
+s->packet_done = 1;
+*got_frame_ptr = 1;
+return 0;
+}
+else if (s->packet_done || s->packet_loss) {
 s->packet_done = 0;
 
 /** sanity check for the buffer length */
@@ -1922,6 +1950,7 @@ static void flush(WMAProDecodeCtx *s)
sizeof(*s->channel[i].out));
 s->packet_loss = 1;
 s->skip_packets = 0;
+s->eof_done = 0;
 }
 
 
@@ -1976,7 +2005,7 @@ AVCodec ff_xma1_decoder = {
 .init   = xma_decode_init,
 .close  = xma_decode_end,
 .decode = xma_decode_packet,
-.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | 
AV_CODEC_CAP_DELAY,
 .sample_fmts= (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
   AV_SAMPLE_FMT_NONE },
 };
@@ -1991,7 +2020,7 @@ AVCodec ff_xma2_decoder = {
 .close  = xma_decode_end,
 .decode = xma_decode_packet,
 .flush  = xma_flush,
-.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | 
AV_CODEC_CAP_DELAY,
 .sample_fmts= (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
   AV_SAMPLE_FMT_NONE },
 };
-- 
2.11.0.windows.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/wmaprodec: improve WMAPRO/XMA gapless output

2018-10-26 Thread Banana M.
Ignore this patch, I've submitted a new one that hopefully has a better
chance.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec: libdav1d AV1 decoder wrapper.

2018-10-26 Thread Dale Curtis
Yes, all your suggestions silence the errors. Thanks!

- dale

On Fri, Oct 26, 2018 at 4:05 PM James Almer  wrote:

> On 10/26/2018 7:31 PM, Dale Curtis wrote:
> > The following warnings show up when compiling with clang:
> > ../../third_party/ffmpeg/libavcodec/libdav1d.c:92:24: error: suggest
> braces
> > around initialization of subobject [-Werror,-Wmissing-braces]
> > Dav1dPicture p = { 0 };
> >^
> >{}
>
> Does "Dav1dPicture p = { .ref = opaque };" silences this one up?
>
> > ../../third_party/ffmpeg/libavcodec/libdav1d.c:119:24: error: suggest
> > braces around initialization of subobject [-Werror,-Wmissing-braces]
> > Dav1dPicture p = { 0 };
> >^
> >{}
>
> For this one I'd have to use { { 0 } } or a memset, but maybe the struct
> could start with an int or something else instead of the data pointer
> arrays.
>
> > ../../third_party/ffmpeg/libavcodec/libdav1d.c:194:45: error: implicit
> > conversion from enumeration type 'enum Dav1dMatrixCoefficients' to
> > different enumeration type 'enum AVColorSpace'
> [-Werror,-Wenum-conversion]
> > frame->colorspace = c->colorspace = p.p.mtrx;
> >   ~ ^~~~
> > ../../third_party/ffmpeg/libavcodec/libdav1d.c:195:55: error: implicit
> > conversion from enumeration type 'enum Dav1dColorPrimaries' to different
> > enumeration type 'enum AVColorPrimaries' [-Werror,-Wenum-conversion]
> > frame->color_primaries = c->color_primaries = p.p.pri;
> > ~ ^~~
> > ../../third_party/ffmpeg/libavcodec/libdav1d.c:196:43: error: implicit
> > conversion from enumeration type 'enum Dav1dTransferCharacteristics' to
> > different enumeration type 'enum AVColorTransferCharacteristic'
> > [-Werror,-Wenum-conversion]
> > frame->color_trc = c->color_trc = p.p.trc;
> > ~ ^~~
>
> I can cast the enums to silence these errors, sure.
>
> > 5 errors generated.
>
> 5 very pedantic "errors" :p
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/cbs_av1: fix parsing frame_size_with_refs

2018-10-26 Thread James Almer
found_ref is not a single value in the bitstream. Fixes parsing files with
frame size changes.

Based on code from cbs_vp9.

Signed-off-by: James Almer 
---
 libavcodec/cbs_av1.h | 2 +-
 libavcodec/cbs_av1_syntax_template.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
index 0d7fd761f1..b66a09c389 100644
--- a/libavcodec/cbs_av1.h
+++ b/libavcodec/cbs_av1.h
@@ -161,7 +161,7 @@ typedef struct AV1RawFrameHeader {
 uint8_t  render_width_minus_1;
 uint8_t  render_height_minus_1;
 
-uint8_t found_ref;
+uint8_t found_ref[AV1_REFS_PER_FRAME];
 
 uint8_t refresh_frame_flags;
 uint8_t allow_intrabc;
diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index 84ab2973ab..e146bbf8bb 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -417,8 +417,8 @@ static int FUNC(frame_size_with_refs)(CodedBitstreamContext 
*ctx, RWContext *rw,
 int i, err;
 
 for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
-flag(found_ref);
-if (current->found_ref) {
+flags(found_ref[i], 1, i);
+if (current->found_ref[i]) {
 AV1ReferenceFrameState *ref =
 &priv->ref[current->ref_frame_idx[i]];
 
@@ -439,7 +439,7 @@ static int FUNC(frame_size_with_refs)(CodedBitstreamContext 
*ctx, RWContext *rw,
 }
 }
 
-if (current->found_ref == 0) {
+if (i >= AV1_REFS_PER_FRAME) {
 CHECK(FUNC(frame_size)(ctx, rw, current));
 CHECK(FUNC(render_size)(ctx, rw, current));
 } else {
-- 
2.19.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: fix parsing frame_size_with_refs

2018-10-26 Thread James Almer
On 10/26/2018 9:38 PM, James Almer wrote:
> found_ref is not a single value in the bitstream. Fixes parsing files with
> frame size changes.

See https://0x0.st/s64M.ivf, since AOM doesn't seem to offer a
conformance suite with a relevant sample, like Google did for VP9.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH vFINAL] fate: add api-h264-slice test

2018-10-26 Thread James Almer
On 10/24/2018 3:02 PM, jos...@ob-encoder.com wrote:
> From: Josh de Kock 
> 
> This test ensures that you are able to send N number of slice NALUs in slice 
> threaded mode to be decoded simultaneously
> ---
>  Actually send fix.
> 
>  tests/api/Makefile  |   1 +
>  tests/api/api-h264-slice-test.c | 221 +++
>  tests/fate/api.mak  |   4 +
>  tests/ref/fate/api-h264-slice   | 309 
>  4 files changed, 535 insertions(+)
>  create mode 100644 tests/api/api-h264-slice-test.c
>  create mode 100644 tests/ref/fate/api-h264-slice
> 
> diff --git a/tests/api/Makefile b/tests/api/Makefile
> index 759dd9d243..b5c4ccae23 100644
> --- a/tests/api/Makefile
> +++ b/tests/api/Makefile
> @@ -1,5 +1,6 @@
>  APITESTPROGS-$(call ENCDEC, FLAC, FLAC) += api-flac
>  APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264
> +APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264-slice
>  APITESTPROGS-yes += api-seek
>  APITESTPROGS-yes += api-codec-param
>  APITESTPROGS-$(call DEMDEC, H263, H263) += api-band
> diff --git a/tests/api/api-h264-slice-test.c b/tests/api/api-h264-slice-test.c
> new file mode 100644
> index 00..961bdfbaf3
> --- /dev/null
> +++ b/tests/api/api-h264-slice-test.c
> @@ -0,0 +1,221 @@
> +/*
> + * Copyright (c) 2001 Fabrice Bellard
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> + * of this software and associated documentation files (the "Software"), to 
> deal
> + * in the Software without restriction, including without limitation the 
> rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> + * THE SOFTWARE.
> + */
> +
> +#define MAX_SLICES 8
> +
> +// ./fate 2 ./crew_cif out.y4m
> +
> +#include "config.h"
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#if HAVE_UNISTD_H
> +#include 
> +#endif
> +#if HAVE_IO_H
> +#include 
> +#endif
> +#include 
> +#include 
> +#include 
> +
> +#include "libavformat/network.h"
> +#include "libavcodec/avcodec.h"
> +#include "libavutil/pixdesc.h"
> +#include "libavutil/hash.h"
> +
> +static int header = 0;
> +
> +static void decode(AVCodecContext *dec_ctx, AVFrame *frame,
> +   AVPacket *pkt)
> +{
> +static uint64_t frame_cnt = 0;
> +int ret;
> +
> +ret = avcodec_send_packet(dec_ctx, pkt);
> +if (ret < 0) {
> +fprintf(stderr, "Error sending a packet for decoding: %s\n", 
> av_err2str(ret));
> +exit(1);
> +}
> +
> +while (ret >= 0) {
> +const AVPixFmtDescriptor *desc;
> +char *sum;
> +struct AVHashContext *hash;
> +
> +ret = avcodec_receive_frame(dec_ctx, frame);
> +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
> +return;
> +} else if (ret < 0) {
> +fprintf(stderr, "Error during decoding: %s\n", av_err2str(ret));
> +exit(1);
> +}
> +
> +if (!header) {
> +printf(
> +"#format: frame checksums\n"
> +"#version: 2\n"
> +"#hash: MD5\n"
> +"#tb 0: 1/30\n"
> +"#media_type 0: video\n"
> +"#codec_id 0: rawvideo\n"
> +"#dimensions 0: 352x288\n"
> +"#sar 0: 128/117\n"
> +"#stream#, dts,pts, duration, size, hash\n");
> +header = 1;
> +}
> +desc = av_pix_fmt_desc_get(dec_ctx->pix_fmt);
> +av_hash_alloc(&hash, "md5");

Unchecked allocation.

(Also, kinda late for this, but adler32 would have been much faster than
md5).

> +av_hash_init(hash);
> +sum = av_mallocz(av_hash_get_size(hash) * 2 + 1);

Ditto.

You could also instead keep sum in stack, using AV_HASH_MAX_SIZE * 2 + 1
as fixed size. The av_hash_final_*() functions are guaranteed to
0-terminate the strings, so it's safe to print without having to zero
the buffer every iteration.

> +
> +for (int i = 0; i < frame->height; i++)
> +av_hash_update(hash, &frame->data[0][i * frame->linesize[0]], 
> frame->width);
> +for (int i = 0; i < frame->height >> desc->log2_chroma_h; i++)
> +av_hash_update(hash, &frame->data[1][i * frame->linesize[1]],