Re: [FFmpeg-devel] [PATCH] nvenc : Support Video Codec SDK 8.0

2017-05-09 Thread Yogender Gupta
Thanks Timo. We have more patches for SDK 8.0, that we will be pushing out 
shortly. Also working on automating the build for Scale CUDA that I will share 
shortly.

>>CUVIDPROCPARAMS gained documentation for some raw YUV parameters.
>>Does this mean we could create a cuvid_vpp filter, which uses the cuvid 
>>scaler and deinterlacer without needing to decode something to use it?
>>I can't find anything about this in the SDK documentation pdfs included with 
>>it.

This is possible (was possible earlier too). We can create a raw decoder that 
will get input as raw YUV and apply postprocessing and get raw YUV 
postprocessed output.

Regards,
Yogender

-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Timo 
Rothenpieler
Sent: Tuesday, May 09, 2017 10:35 PM
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] nvenc : Support Video Codec SDK 8.0

Am 09.05.2017 um 08:18 schrieb Yogender Gupta:
> Video Codec SDK 8.0 has been released today. Please find the patch that  
> updates the interface. Also, attached the latest SDK 8.0 interface file for 
> nvenc.

ffmpeg master is now updated to SDK 8.0.14 for both nvenc and cuvid, thanks!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] img2dec: jpeg_probe logic

2017-05-09 Thread wm4
On Mon, 8 May 2017 16:25:43 -0400
Vadim Kalinsky  wrote:

> Hey,
> 
> Trying to fix a bug #6113, I stumbled upon some strange logic in 
> libavformat/img2dec.c:jpeg_probe. It accepts first 2048 bytes of jpeg stream, 
> and tries to read it with some state machine. If it doesn't look like jpeg 
> stream, it returns 0 ("it's definitely not a jpeg").
> 
> After it read through the buffer, it does this:
> 
> if (state == EOI)
> return AVPROBE_SCORE_EXTENSION + 1;
> if (state == SOS)
> return AVPROBE_SCORE_EXTENSION / 2;
> 
> return AVPROBE_SCORE_EXTENSION / 8;
> 
> 
> That doesn't make sense to me. All we read so far made sense for jpeg reader, 
> it definitely looks like a jpeg image, but for some reason our confidence is 
> AVPROBE_SCORE_EXTENSION _DIVIDED_ by 2 or 8 (in other words, "it would look 
> more jpeg if it had .jpg extension).

These are all heuristics mostly a certain developer tuned and who
decided it'd make sense.

The problem with probing is that it uses a score system, which means
ambiguous formats get distinguished by the rather arbitrary score
across all the other probers, which makes this messy.

I'd say just send a patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] h264dec: be more explicit in handling container cropping

2017-05-09 Thread Michael Niedermayer
On Mon, May 08, 2017 at 03:46:23PM -0300, James Almer wrote:
> From: Anton Khirnov 
> 
> The current condition can trigger in cases where it shouldn't, with
> unexpected results.
> Make sure that:
> - container cropping is really based on the original dimensions from the
>   caller
> - those dimenions are discarded on size change
> 
> The code is still quite hacky and eventually should be deprecated and
> removed, with the decision about which cropping is used delegated to the
> caller.
> ---
> This merges commit 4fded0480f20f4d7ca5e776a85574de34dfead14 from libav
> 
>  libavcodec/h264_slice.c | 20 +---
>  libavcodec/h264dec.c|  3 +++
>  libavcodec/h264dec.h|  5 +
>  3 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index acf6a73f60..a7916e09ce 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -378,6 +378,8 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
>  h->avctx->coded_width   = h1->avctx->coded_width;
>  h->avctx->width = h1->avctx->width;
>  h->avctx->height= h1->avctx->height;
> +h->width_from_caller= h1->width_from_caller;
> +h->height_from_caller   = h1->height_from_caller;
>  h->coded_picture_number = h1->coded_picture_number;
>  h->first_field  = h1->first_field;
>  h->picture_structure= h1->picture_structure;

> @@ -874,13 +876,17 @@ static int init_dimensions(H264Context *h)
>  av_assert0(sps->crop_top + sps->crop_bottom < (unsigned)h->height);
>  
>  /* handle container cropping */
> -if (FFALIGN(h->avctx->width,  16) == FFALIGN(width,  16) &&
> -FFALIGN(h->avctx->height, 16) == FFALIGN(height, 16) &&
> -h->avctx->width  <= width &&
> -h->avctx->height <= height
> -) {
> -width  = h->avctx->width;
> -height = h->avctx->height;
> +if (h->width_from_caller > 0 && h->height_from_caller > 0 &&
> +!sps->crop_top && !sps->crop_left &&
> +FFALIGN(h->width_from_caller,  16) == FFALIGN(width,  16) &&
> +FFALIGN(h->height_from_caller, 16) == FFALIGN(height, 16) &&
> +h->width_from_caller  <= width &&
> +h->height_from_caller <= height) {
> +width  = h->width_from_caller;
> +height = h->height_from_caller;
> +} else {
> +h->width_from_caller  = 0;
> +h->height_from_caller = 0;
>  }

With this, seeking in a file could affect if croping is used
would something break if croping was unaffected by what was priorly
decoded ?

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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


[FFmpeg-devel] [PATCH] avformat/hlsenc: move old_filename free operation earlier

2017-05-09 Thread Steven Liu
Suggested-by: Aaron Levinson 
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 221089c..7ed121a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1549,14 +1549,13 @@ static int hls_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 sls_flag_file_rename(hls, old_filename);
 ret = hls_start(s);
 }
+av_free(old_filename);
 
 if (ret < 0) {
-av_free(old_filename);
 return ret;
 }
 
 if ((ret = hls_window(s, 0)) < 0) {
-av_free(old_filename);
 return ret;
 }
 }
-- 
1.7.1



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


Re: [FFmpeg-devel] [PATCH 2/3] lavc: add a framework to fix alignment problems.

2017-05-09 Thread Michael Niedermayer
On Wed, May 10, 2017 at 04:16:25AM +0200, Michael Niedermayer wrote:
> On Tue, May 09, 2017 at 03:19:43PM +0200, Nicolas George wrote:
> > A lot of codecs require aligned frame data, but do not document it.
> > It can result in crashes with perfectly valid uses of the API.
> > 
> > Design rationale:
> > 
> > - requiring frame data to be always aligned would be wasteful;
> > 
> > - alignment requirements will evolve
> >   (the 16->32 bump is still recent);
> > 
> > - requiring applications to worry about alignment is not convenient.
> > 
> > For now, the default alignment is fixed at 5.
> > 
> > Fix: trac ticket #6349
> > Signed-off-by: Nicolas George 
> > ---
> >  libavcodec/avcodec.h | 10 +
> >  libavcodec/encode.c  | 57 
> > +---
> >  libavcodec/utils.c   |  2 ++
> >  3 files changed, 66 insertions(+), 3 deletions(-)
> 
> breaks (green stuff on edges)
>  ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -an -vframes 5  -vf uspp=4:8 
> -qscale 1 -y file.avi

note ive also seen s segfault on the side with this patchset when
bisecting but i failed to reproduce, so might be unrelated
if i see it again and succeed to get a backtace ill post it

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


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


Re: [FFmpeg-devel] [PATCH 2/3] lavc: add a framework to fix alignment problems.

2017-05-09 Thread Michael Niedermayer
On Tue, May 09, 2017 at 03:19:43PM +0200, Nicolas George wrote:
> A lot of codecs require aligned frame data, but do not document it.
> It can result in crashes with perfectly valid uses of the API.
> 
> Design rationale:
> 
> - requiring frame data to be always aligned would be wasteful;
> 
> - alignment requirements will evolve
>   (the 16->32 bump is still recent);
> 
> - requiring applications to worry about alignment is not convenient.
> 
> For now, the default alignment is fixed at 5.
> 
> Fix: trac ticket #6349
> Signed-off-by: Nicolas George 
> ---
>  libavcodec/avcodec.h | 10 +
>  libavcodec/encode.c  | 57 
> +---
>  libavcodec/utils.c   |  2 ++
>  3 files changed, 66 insertions(+), 3 deletions(-)

breaks (green stuff on edges)
 ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -an -vframes 5  -vf uspp=4:8 
-qscale 1 -y file.avi

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

Those who are best at talking, realize last or never when they are wrong.


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


Re: [FFmpeg-devel] [PATCH] doc/codecs: Add missing documentation for apply_cropping

2017-05-09 Thread Lou Logan
On Tue,  9 May 2017 17:23:35 +0200
Michael Niedermayer  wrote:

> Signed-off-by: Michael Niedermayer 
> ---
>  doc/codecs.texi | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index 1f74c83554..1d8a4e38a4 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -1279,6 +1279,16 @@ ffprobe -dump_separator "
>  Maximum number of pixels per image. This value can be used to avoid out of
>  memory failures due to large images.
>  
> +@item apply_cropping @var{integer} (@emph{decoding,video})
> +Enable cropping if cropping parameters are a multiply of the required

s/a multiply/multiples

> +alignment for the left and top parameters. If the alignment is not met the
> +cropping will be partially applied to maintain alignment.
> +1(Enabled) by default.

Default is 1 (enabled).

> +Note: The required alignment depends on if CODEC_FLAG_UNALIGNED is set and 
> the

@code{CODEC_FLAG_UNALIGNED}

> +CPU. CODEC_FLAG_UNALIGNED cannot be chanaged from the command line. Also hw
> +decoders will not apply left/top croping.

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


Re: [FFmpeg-devel] [PATCH] avcodec/webp: Reinitilaize VP8 decoder on pixel format mismatch

2017-05-09 Thread Ronald S. Bultje
Hi,

On Tue, May 9, 2017 at 9:24 PM, Michael Niedermayer 
wrote:

> On Tue, May 09, 2017 at 09:08:08PM -0400, Ronald S. Bultje wrote:
> > Hi,
> >
> > On Tue, May 9, 2017 at 8:37 PM, Michael Niedermayer
> 
> > wrote:
> >
> > > Fixes: out of array access
> > > Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632
> > > Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760
> > >
> > > Found-by: continuous fuzzing process https://github.com/google/oss-
> > > fuzz/tree/master/targets/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/webp.c | 9 +++--
> > >  1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> > > index 16c3ae2662..23ed4bc26f 100644
> > > --- a/libavcodec/webp.c
> > > +++ b/libavcodec/webp.c
> > > @@ -1330,12 +1330,17 @@ static int vp8_lossy_decode_frame(
> AVCodecContext
> > > *avctx, AVFrame *p,
> > >  WebPContext *s = avctx->priv_data;
> > >  AVPacket pkt;
> > >  int ret;
> > > +enum AVPixelFormat wanted_pix_fmt = s->has_alpha ?
> > > AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
> > > +
> > > +if (s->initialized && wanted_pix_fmt != avctx->pix_fmt) {
> > > +ff_vp8_decode_free(avctx);
> > > +s->initialized = 0;
> > > +}
> > >
> > >  if (!s->initialized) {
> > >  ff_vp8_decode_init(avctx);
> > >  s->initialized = 1;
> > > -if (s->has_alpha)
> > > -avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
> > > +avctx->pix_fmt = wanted_pix_fmt;
> > >  }
> > >  s->lossless = 0;
> >
> >
> > What is the out of array access? webp is intra only and the only thing
> that
> > is initialized with memory in that call is reference frames. What's going
> > on here?
>
> webp uses the same context as VP8, and it changes the pixel format
> as it needs. Vp8 doesnt work if its format is changed under its feet
>
> the reinit seemed reasonable cleanish to handle it. There are a few
> other ways the same can be achived


What is the out of array access?

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


Re: [FFmpeg-devel] [PATCH] doc/codecs: Change common boolean parameters listed to "bool"

2017-05-09 Thread Michael Niedermayer
On Tue, May 09, 2017 at 10:13:20PM -0300, James Almer wrote:
> On 5/9/2017 10:08 PM, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  doc/codecs.texi | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/doc/codecs.texi b/doc/codecs.texi
> > index 1a838e57c3..ec49b82227 100644
> > --- a/doc/codecs.texi
> > +++ b/doc/codecs.texi
> > @@ -1258,7 +1258,7 @@ Interlaced video, top coded first, bottom displayed 
> > first
> >  Interlaced video, bottom coded first, top displayed first
> >  @end table
> >  
> > -@item skip_alpha @var{integer} (@emph{decoding,video})
> > +@item skip_alpha @var{bool} (@emph{decoding,video})
> >  Set to 1 to disable processing alpha (transparency). This works like the
> >  @samp{gray} flag in the @option{flags} option which skips chroma 
> > information
> >  instead of alpha. Default is 0.
> > @@ -1279,7 +1279,7 @@ ffprobe -dump_separator "
> >  Maximum number of pixels per image. This value can be used to avoid out of
> >  memory failures due to large images.
> >  
> > -@item apply_cropping @var{integer} (@emph{decoding,video})
> > +@item apply_cropping @var{bool} (@emph{decoding,video})
> >  Enable cropping if cropping parameters are a multiply of the required
> >  alignment for the left and top parameters. If the alignment is not met the
> >  cropping will be partially applied to maintain alignment.
> > 
> 
> LGTM.

applied

thx

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] avcodec/webp: Reinitilaize VP8 decoder on pixel format mismatch

2017-05-09 Thread Michael Niedermayer
On Tue, May 09, 2017 at 09:08:08PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Tue, May 9, 2017 at 8:37 PM, Michael Niedermayer 
> wrote:
> 
> > Fixes: out of array access
> > Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632
> > Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760
> >
> > Found-by: continuous fuzzing process https://github.com/google/oss-
> > fuzz/tree/master/targets/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/webp.c | 9 +++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> > index 16c3ae2662..23ed4bc26f 100644
> > --- a/libavcodec/webp.c
> > +++ b/libavcodec/webp.c
> > @@ -1330,12 +1330,17 @@ static int vp8_lossy_decode_frame(AVCodecContext
> > *avctx, AVFrame *p,
> >  WebPContext *s = avctx->priv_data;
> >  AVPacket pkt;
> >  int ret;
> > +enum AVPixelFormat wanted_pix_fmt = s->has_alpha ?
> > AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
> > +
> > +if (s->initialized && wanted_pix_fmt != avctx->pix_fmt) {
> > +ff_vp8_decode_free(avctx);
> > +s->initialized = 0;
> > +}
> >
> >  if (!s->initialized) {
> >  ff_vp8_decode_init(avctx);
> >  s->initialized = 1;
> > -if (s->has_alpha)
> > -avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
> > +avctx->pix_fmt = wanted_pix_fmt;
> >  }
> >  s->lossless = 0;
> 
> 
> What is the out of array access? webp is intra only and the only thing that
> is initialized with memory in that call is reference frames. What's going
> on here?

webp uses the same context as VP8, and it changes the pixel format
as it needs. Vp8 doesnt work if its format is changed under its feet

the reinit seemed reasonable cleanish to handle it. There are a few
other ways the same can be achived

Do you have a better idea or see something missing ?

thx

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [PATCH] doc/codecs: Change common boolean parameters listed to "bool"

2017-05-09 Thread James Almer
On 5/9/2017 10:08 PM, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  doc/codecs.texi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index 1a838e57c3..ec49b82227 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -1258,7 +1258,7 @@ Interlaced video, top coded first, bottom displayed 
> first
>  Interlaced video, bottom coded first, top displayed first
>  @end table
>  
> -@item skip_alpha @var{integer} (@emph{decoding,video})
> +@item skip_alpha @var{bool} (@emph{decoding,video})
>  Set to 1 to disable processing alpha (transparency). This works like the
>  @samp{gray} flag in the @option{flags} option which skips chroma information
>  instead of alpha. Default is 0.
> @@ -1279,7 +1279,7 @@ ffprobe -dump_separator "
>  Maximum number of pixels per image. This value can be used to avoid out of
>  memory failures due to large images.
>  
> -@item apply_cropping @var{integer} (@emph{decoding,video})
> +@item apply_cropping @var{bool} (@emph{decoding,video})
>  Enable cropping if cropping parameters are a multiply of the required
>  alignment for the left and top parameters. If the alignment is not met the
>  cropping will be partially applied to maintain alignment.
> 

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


[FFmpeg-devel] [PATCH] doc/codecs: Change common boolean parameters listed to "bool"

2017-05-09 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/codecs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 1a838e57c3..ec49b82227 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -1258,7 +1258,7 @@ Interlaced video, top coded first, bottom displayed first
 Interlaced video, bottom coded first, top displayed first
 @end table
 
-@item skip_alpha @var{integer} (@emph{decoding,video})
+@item skip_alpha @var{bool} (@emph{decoding,video})
 Set to 1 to disable processing alpha (transparency). This works like the
 @samp{gray} flag in the @option{flags} option which skips chroma information
 instead of alpha. Default is 0.
@@ -1279,7 +1279,7 @@ ffprobe -dump_separator "
 Maximum number of pixels per image. This value can be used to avoid out of
 memory failures due to large images.
 
-@item apply_cropping @var{integer} (@emph{decoding,video})
+@item apply_cropping @var{bool} (@emph{decoding,video})
 Enable cropping if cropping parameters are a multiply of the required
 alignment for the left and top parameters. If the alignment is not met the
 cropping will be partially applied to maintain alignment.
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH] avcodec/webp: Reinitilaize VP8 decoder on pixel format mismatch

2017-05-09 Thread Ronald S. Bultje
Hi,

On Tue, May 9, 2017 at 8:37 PM, Michael Niedermayer 
wrote:

> Fixes: out of array access
> Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632
> Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760
>
> Found-by: continuous fuzzing process https://github.com/google/oss-
> fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/webp.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> index 16c3ae2662..23ed4bc26f 100644
> --- a/libavcodec/webp.c
> +++ b/libavcodec/webp.c
> @@ -1330,12 +1330,17 @@ static int vp8_lossy_decode_frame(AVCodecContext
> *avctx, AVFrame *p,
>  WebPContext *s = avctx->priv_data;
>  AVPacket pkt;
>  int ret;
> +enum AVPixelFormat wanted_pix_fmt = s->has_alpha ?
> AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
> +
> +if (s->initialized && wanted_pix_fmt != avctx->pix_fmt) {
> +ff_vp8_decode_free(avctx);
> +s->initialized = 0;
> +}
>
>  if (!s->initialized) {
>  ff_vp8_decode_init(avctx);
>  s->initialized = 1;
> -if (s->has_alpha)
> -avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
> +avctx->pix_fmt = wanted_pix_fmt;
>  }
>  s->lossless = 0;


What is the out of array access? webp is intra only and the only thing that
is initialized with memory in that call is reference frames. What's going
on here?

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


Re: [FFmpeg-devel] [PATCH] doc/codecs: Add missing documentation for apply_cropping

2017-05-09 Thread Michael Niedermayer
On Tue, May 09, 2017 at 04:54:52PM -0300, James Almer wrote:
> On 5/9/2017 12:23 PM, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  doc/codecs.texi | 10 ++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/doc/codecs.texi b/doc/codecs.texi
> > index 1f74c83554..1d8a4e38a4 100644
> > --- a/doc/codecs.texi
> > +++ b/doc/codecs.texi
> > @@ -1279,6 +1279,16 @@ ffprobe -dump_separator "
> >  Maximum number of pixels per image. This value can be used to avoid out of
> >  memory failures due to large images.
> >  
> > +@item apply_cropping @var{integer} (@emph{decoding,video})
> 
> This option (as well as others like skip_alpha, or refcounted_frames
> which is also missing in this file) are boolean, not int.
> In practice it makes no difference i guess, since the actual
> AVCodecContext fields are all int anyway, but maybe it could be
> reflected here. I'm not sure if the difference between AV_OPT_TYPE_BOOL
> and AV_OPT_TYPE_INT has any implications for API users, though.

will send a seperate patch for bool


> 
> > +Enable cropping if cropping parameters are a multiply of the required
> > +alignment for the left and top parameters. If the alignment is not met the
> > +cropping will be partially applied to maintain alignment.
> > +1(Enabled) by default.
> > +Note: The required alignment depends on if CODEC_FLAG_UNALIGNED is set and 
> > the
> > +CPU. CODEC_FLAG_UNALIGNED cannot be chanaged from the command line. Also hw
> 
> AV_CODEC_FLAG_UNALIGNED, and "changed".
> 
> > +decoders will not apply left/top croping.
> 
> Cropping.

changed applied

thx


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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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


[FFmpeg-devel] [PATCH] avcodec/webp: Reinitilaize VP8 decoder on pixel format mismatch

2017-05-09 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632
Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/webp.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 16c3ae2662..23ed4bc26f 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1330,12 +1330,17 @@ static int vp8_lossy_decode_frame(AVCodecContext 
*avctx, AVFrame *p,
 WebPContext *s = avctx->priv_data;
 AVPacket pkt;
 int ret;
+enum AVPixelFormat wanted_pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : 
AV_PIX_FMT_YUV420P;
+
+if (s->initialized && wanted_pix_fmt != avctx->pix_fmt) {
+ff_vp8_decode_free(avctx);
+s->initialized = 0;
+}
 
 if (!s->initialized) {
 ff_vp8_decode_init(avctx);
 s->initialized = 1;
-if (s->has_alpha)
-avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
+avctx->pix_fmt = wanted_pix_fmt;
 }
 s->lossless = 0;
 
-- 
2.11.0

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


[FFmpeg-devel] [PATCH] avfilter: add acopy filter

2017-05-09 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi |  7 +-
 libavfilter/Makefile |  1 +
 libavfilter/af_acopy.c   | 60 
 libavfilter/allfilters.c |  1 +
 4 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/af_acopy.c

diff --git a/doc/filters.texi b/doc/filters.texi
index c54f5f2..e1208d0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -395,6 +395,11 @@ How much to use compressed signal in output. Default is 1.
 Range is between 0 and 1.
 @end table
 
+@section acopy
+
+Copy the input audio source unchanged to the output. This is mainly useful for
+testing purposes.
+
 @section acrossfade
 
 Apply cross fade from one input audio stream to another input audio stream.
@@ -5665,7 +5670,7 @@ convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 
-1 0 -1 1 1 0 1 2:-2 -
 
 @section copy
 
-Copy the input source unchanged to the output. This is mainly useful for
+Copy the input video source unchanged to the output. This is mainly useful for
 testing purposes.
 
 @anchor{coreimage}
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index de5f992..f7dfe8a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -29,6 +29,7 @@ OBJS-$(HAVE_THREADS) += pthread.o
 # audio filters
 OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o
 OBJS-$(CONFIG_ACOMPRESSOR_FILTER)+= af_sidechaincompress.o
+OBJS-$(CONFIG_ACOPY_FILTER)  += af_acopy.o
 OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
 OBJS-$(CONFIG_ACRUSHER_FILTER)   += af_acrusher.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
diff --git a/libavfilter/af_acopy.c b/libavfilter/af_acopy.c
new file mode 100644
index 000..d849060
--- /dev/null
+++ b/libavfilter/af_acopy.c
@@ -0,0 +1,60 @@
+/*
+ * 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 "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterLink *outlink = inlink->dst->outputs[0];
+AVFrame *out = ff_get_audio_buffer(outlink, in->nb_samples);
+
+if (!out) {
+av_frame_free();
+return AVERROR(ENOMEM);
+}
+av_frame_copy_props(out, in);
+av_frame_copy(out, in);
+av_frame_free();
+return ff_filter_frame(outlink, out);
+}
+
+static const AVFilterPad acopy_inputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+.filter_frame = filter_frame,
+},
+{ NULL }
+};
+
+static const AVFilterPad acopy_outputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+},
+{ NULL }
+};
+
+AVFilter ff_af_acopy = {
+.name  = "acopy",
+.description   = NULL_IF_CONFIG_SMALL("Copy the input audio unchanged to 
the output."),
+.inputs= acopy_inputs,
+.outputs   = acopy_outputs,
+};
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 555c442..cd35ae4 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -42,6 +42,7 @@ static void register_all(void)
 {
 REGISTER_FILTER(ABENCH, abench, af);
 REGISTER_FILTER(ACOMPRESSOR,acompressor,af);
+REGISTER_FILTER(ACOPY,  acopy,  af);
 REGISTER_FILTER(ACROSSFADE, acrossfade, af);
 REGISTER_FILTER(ACRUSHER,   acrusher,   af);
 REGISTER_FILTER(ADELAY, adelay, af);
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH] lavc/aarch64/simple_idct: separate macro arguments with commas

2017-05-09 Thread Matthieu Bouron
On Sun, May 7, 2017 at 11:05 AM, Matthieu Bouron 
wrote:

>
>
> Le 2 mai 2017 12:01 PM, "Benoit Fouet"  a écrit :
>
> Hi,
>
>
> On 28/04/2017 21:58, Matthieu Bouron wrote:
> > Untested: fixes ticket #6324.
> > ---
> >  libavcodec/aarch64/simple_idct_neon.S | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/libavcodec/aarch64/simple_idct_neon.S
> b/libavcodec/aarch64/simple_idct_neon.S
> > index 52273420f9..d31f72a609 100644
> > --- a/libavcodec/aarch64/simple_idct_neon.S
> > +++ b/libavcodec/aarch64/simple_idct_neon.S
> > @@ -61,19 +61,19 @@ endconst
> >  br  x10
> >  .endm
> >
> > -.macro smull1 a b c
> > +.macro smull1 a, b, c
> >  smull   \a, \b, \c
> >  .endm
> >
> > -.macro smlal1 a b c
> > +.macro smlal1 a, b, c
> >  smlal   \a, \b, \c
> >  .endm
> >
> > -.macro smlsl1 a b c
> > +.macro smlsl1 a, b, c
> >  smlsl   \a, \b, \c
> >  .endm
> >
> > -.macro idct_col4_top y1 y2 y3 y4 i l
> > +.macro idct_col4_top y1, y2, y3, y4, i, l
> >  smull\i v7.4S,  \y3\().\l, z2
> >  smull\i v16.4S, \y3\().\l, z6
> >  smull\i v17.4S, \y2\().\l, z1
> > @@ -91,7 +91,7 @@ endconst
> >  smlsl\i v6.4S,  \y4\().\l, z5
> >  .endm
> >
> > -.macro idct_row4_neon y1 y2 y3 y4 pass
> > +.macro idct_row4_neon y1, y2, y3, y4, pass
> >  ld1 {\y1\().2D-\y2\().2D}, [x2], #32
> >  moviv23.4S, #1<<2, lsl #8
> >  orr v5.16B, \y1\().16B, \y2\().16B
> > @@ -153,7 +153,7 @@ endconst
> >  trn2\y4\().4S, v17.4S, v19.4S
> >  .endm
> >
> > -.macro declare_idct_col4_neon i l
> > +.macro declare_idct_col4_neon i, l
> >  function idct_col4_neon\i
> >  dup v23.4H, z4c
> >  .if \i == 1
>
> Sounds sane, but shouldn't we be doing this for all instances of
> multiple arguments macros without commas?
>
>
> Sure, I may have missed some. I will work again on this patch on Tuesday
> as I will have access to an apple machine (and hopefully fix the build
> without gas-preprocessor).
>
> Sorry for the delay,
> Matthieu
>
>
Updated patch attached:
  * add missing commas to separate macro arguments
  * passes .4H/.8H as macro arguments instead of .4H/.8H (the later form
being interpreted as an hexadecimal value, ie: 4/8).
From e27ac0f3a8b6436a7530ee5c5c514bfdfac4a558 Mon Sep 17 00:00:00 2001
From: Matthieu Bouron 
Date: Fri, 28 Apr 2017 21:58:55 +0200
Subject: [PATCH] lavc/aarch64/simple_idct: fix iOS build without
 gas-preprocessor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Separates macro arguments with commas and passes .4H/.8H as macro
arguments instead of 4H/8H (the later form being interpreted as an
hexadecimal value).

Fixes ticket #6324.

Suggested-by: Martin Storsjö 
---
 libavcodec/aarch64/simple_idct_neon.S | 74 +--
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S
index 52273420f9..92987985d2 100644
--- a/libavcodec/aarch64/simple_idct_neon.S
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -61,37 +61,37 @@ endconst
 br  x10
 .endm
 
-.macro smull1 a b c
+.macro smull1 a, b, c
 smull   \a, \b, \c
 .endm
 
-.macro smlal1 a b c
+.macro smlal1 a, b, c
 smlal   \a, \b, \c
 .endm
 
-.macro smlsl1 a b c
+.macro smlsl1 a, b, c
 smlsl   \a, \b, \c
 .endm
 
-.macro idct_col4_top y1 y2 y3 y4 i l
-smull\i v7.4S,  \y3\().\l, z2
-smull\i v16.4S, \y3\().\l, z6
-smull\i v17.4S, \y2\().\l, z1
+.macro idct_col4_top y1, y2, y3, y4, i, l
+smull\i v7.4S,  \y3\l, z1
+smull\i v16.4S, \y3\l, z6
+smull\i v17.4S, \y2\l, z1
 add v19.4S, v23.4S, v7.4S
-smull\i v18.4S, \y2\().\l, z3
+smull\i v18.4S, \y2\l, z3
 add v20.4S, v23.4S, v16.4S
-smull\i v5.4S,  \y2\().\l, z5
+smull\i v5.4S,  \y2\l, z5
 sub v21.4S, v23.4S, v16.4S
-smull\i v6.4S,  \y2\().\l, z7
+smull\i v6.4S,  \y2\l, z7
 sub v22.4S, v23.4S, v7.4S
 
-smlal\i v17.4S, \y4\().\l, z3
-smlsl\i v18.4S, \y4\().\l, z7
-smlsl\i v5.4S,  \y4\().\l, z1
-smlsl\i v6.4S,  \y4\().\l, z5
+smlal\i v17.4S, \y4\l, z3
+smlsl\i v18.4S, \y4\l, z7
+smlsl\i v5.4S,  \y4\l, z1
+smlsl\i v6.4S,  \y4\l, z5
 .endm
 
-.macro idct_row4_neon y1 y2 y3 y4 pass
+.macro idct_row4_neon y1, y2, y3, y4, pass
 ld1 {\y1\().2D-\y2\().2D}, [x2], #32

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: fix memleak

2017-05-09 Thread Aaron Levinson

On 5/8/2017 3:35 AM, Steven Liu wrote:

fix memleak bug, when all the process is normal,
just free old_filename

Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 221089c..d62d5b8 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1559,6 +1559,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 av_free(old_filename);
 return ret;
 }
+
+av_free(old_filename);


This looks fine, but, if possible, it would be preferable to free the 
memory earlier if it is no longer needed.  I didn't study the code 
sufficiently to determine this with certainty, but it is possible that 
old_filename is no longer needed after line 1551.  In that case, free it 
earlier and eliminate any subsequent calls to av_free(old_filename).



 }

 ret = ff_write_chained(oc, stream_index, pkt, s, 0);



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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: support TAG span multiple lines when parse playlist

2017-05-09 Thread Aaron Levinson
Based on a conversation that I had on IRC with Martin Storsjö, I 
misinterpreted the Apple documentation, and the only reason why '\' 
shows up in these documents is so that lines won't appear too long, 
particularly in the RFC.  According to Martin, Apple's tools can't 
handle .m3u8 files that use '\' for multi-line TAG spans, and in 
addition, there is no mention of '\' anywhere in the actual grammar 
documented in the specification.  So, it seems that that this patch 
isn't needed.


Aaron Levinson

On 5/9/2017 1:01 PM, Aaron Levinson wrote:

I would rewrite the commit message as:  "avformat/hlsenc:  support
multi-line TAG spans when parsing a playlist".  Also, I thought you were
going to have a common implementation for both hlsenc and hls?  There
are a duplicate implementations of read_chomp_line() in hls.c, hlsenc.c,
and hlsproto.c.  This probably ought to be done in another patch, and I
suggest making this functionality generic by moving to
internal.h/aviobuf.c.  The function could be called
ff_get_multi_line_span().

On 5/5/2017 9:50 AM, Steven Liu wrote:

refer to:
https://developer.apple.com/library/content/technotes/tn2288/_index.html


Note, the actual specification can be found at
https://tools.ietf.org/html/draft-pantos-http-live-streaming-19 .  This
makes it clear how a '\' character is used to extend a tag declaration
to the next line.  I recommend referring to the draft spec instead of
the link that I previously posted.



support to parse the EXT-X-KEY span multiple lines:
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:10
 #EXT-X-MEDIA-SEQUENCE:0
 #EXT-X-KEY:METHOD=AES-128,URI="/file.key", \
 IV=0x498c8325965f907960e3d94d20c4d138
 #EXTINF:10.00,
 out0.ts
 #EXTINF:8.64,
 out1.ts
 #EXTINF:9.16,
 out2.ts

Reported-by: Aaron Levinson 
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 221089c..c167624 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -500,10 +500,27 @@ static int hls_encryption_start(AVFormatContext *s)

 static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
 {
-int len = ff_get_line(s, buf, maxlen);
+int len = 0;


Should probably move the setting of len to 0 below the label (or within
the while loop as I suggest later) to make it clear that the last value
isn't relevant for further iterations of the loop.  It is fine to
declare len outside of the loop, although I think it would be cleaner if
you declared it within the loop and adjusted the code accordingly to
only increment total_len within the loop.  Obviously, the declaration
within the loop is only possible if you convert to a while loop.


+int total_len = 0;
+
+re_get_line:


This can easily be done with a while loop instead of using goto.  In
fact, what you are doing is basically a while loop, so I think it would
be appropriate to do this as a while loop.


+if (maxlen > total_len) {


This is not quite right.  According to the documentation for
ff_get_line(), the length returned is "the length of the string written
in the buffer, not including the final \\0".  If, say, with the first
call to ff_get_line(), it fills up the entire buffer, the length
returned will be maxlen - 1.  If this is a multi-line span, you'll
iterate through the loop, see maxlen > total_len, and try again.  Should
likely be "if ((maxlen - 1) > total_len) {".


+len = ff_get_line(s, buf, maxlen - total_len);


This line is correct, since you do want to use the total buffer space
for the call to ff_get_line().


+} else {
+av_log(s, AV_LOG_WARNING, "The tag is too long, context only
can get %s\n", buf);


For this log message to work properly for multi-line spans, need to do
char *buf2 = buf and work with buf2.  With your current patch, if there
is a multi-line span, buf will not point to the original, and the log
message will incomplete in that case.


+return maxlen;
+}
 while (len > 0 && av_isspace(buf[len - 1]))
 buf[--len] = '\0';


This whitespace removal while loop won't do much in the case of a
multi-line span.  According to the spec, it is important to remove any
trailing whitespace before the '\\':  "A '\' is used to indicate that
the tag continues on the following line with whitespace removed."  While
in the examples in the spec it might not be needed, a multi-line span
could look something like the following:

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", DEF \
  AULT=NO,AUTOSELECT=NO,LANGUAGE="en", \
  URI="commentary/audio-only.m3u8"

As implemented in your patch, the whitespace removal code won't be
triggered in the case that the last character in the line is a '\\',
because in that case, it will immediately fail the check and move on to
the "if (buf[len - 1] == '\\') {" line.  And with the above example, you
won't get the 

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: support TAG span multiple lines when parse playlist

2017-05-09 Thread Aaron Levinson
I would rewrite the commit message as:  "avformat/hlsenc:  support 
multi-line TAG spans when parsing a playlist".  Also, I thought you were 
going to have a common implementation for both hlsenc and hls?  There 
are a duplicate implementations of read_chomp_line() in hls.c, hlsenc.c, 
and hlsproto.c.  This probably ought to be done in another patch, and I 
suggest making this functionality generic by moving to 
internal.h/aviobuf.c.  The function could be called 
ff_get_multi_line_span().


On 5/5/2017 9:50 AM, Steven Liu wrote:

refer to: 
https://developer.apple.com/library/content/technotes/tn2288/_index.html


Note, the actual specification can be found at 
https://tools.ietf.org/html/draft-pantos-http-live-streaming-19 .  This 
makes it clear how a '\' character is used to extend a tag declaration 
to the next line.  I recommend referring to the draft spec instead of 
the link that I previously posted.




support to parse the EXT-X-KEY span multiple lines:
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:10
 #EXT-X-MEDIA-SEQUENCE:0
 #EXT-X-KEY:METHOD=AES-128,URI="/file.key", \
 IV=0x498c8325965f907960e3d94d20c4d138
 #EXTINF:10.00,
 out0.ts
 #EXTINF:8.64,
 out1.ts
 #EXTINF:9.16,
 out2.ts

Reported-by: Aaron Levinson 
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 221089c..c167624 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -500,10 +500,27 @@ static int hls_encryption_start(AVFormatContext *s)

 static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
 {
-int len = ff_get_line(s, buf, maxlen);
+int len = 0;


Should probably move the setting of len to 0 below the label (or within 
the while loop as I suggest later) to make it clear that the last value 
isn't relevant for further iterations of the loop.  It is fine to 
declare len outside of the loop, although I think it would be cleaner if 
you declared it within the loop and adjusted the code accordingly to 
only increment total_len within the loop.  Obviously, the declaration 
within the loop is only possible if you convert to a while loop.



+int total_len = 0;
+
+re_get_line:


This can easily be done with a while loop instead of using goto.  In 
fact, what you are doing is basically a while loop, so I think it would 
be appropriate to do this as a while loop.



+if (maxlen > total_len) {


This is not quite right.  According to the documentation for 
ff_get_line(), the length returned is "the length of the string written 
in the buffer, not including the final \\0".  If, say, with the first 
call to ff_get_line(), it fills up the entire buffer, the length 
returned will be maxlen - 1.  If this is a multi-line span, you'll 
iterate through the loop, see maxlen > total_len, and try again.  Should 
likely be "if ((maxlen - 1) > total_len) {".



+len = ff_get_line(s, buf, maxlen - total_len);


This line is correct, since you do want to use the total buffer space 
for the call to ff_get_line().



+} else {
+av_log(s, AV_LOG_WARNING, "The tag is too long, context only can get 
%s\n", buf);


For this log message to work properly for multi-line spans, need to do 
char *buf2 = buf and work with buf2.  With your current patch, if there 
is a multi-line span, buf will not point to the original, and the log 
message will incomplete in that case.



+return maxlen;
+}
 while (len > 0 && av_isspace(buf[len - 1]))
 buf[--len] = '\0';


This whitespace removal while loop won't do much in the case of a 
multi-line span.  According to the spec, it is important to remove any 
trailing whitespace before the '\\':  "A '\' is used to indicate that 
the tag continues on the following line with whitespace removed."  While 
in the examples in the spec it might not be needed, a multi-line span 
could look something like the following:


#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", DEF \
  AULT=NO,AUTOSELECT=NO,LANGUAGE="en", \
  URI="commentary/audio-only.m3u8"

As implemented in your patch, the whitespace removal code won't be 
triggered in the case that the last character in the line is a '\\', 
because in that case, it will immediately fail the check and move on to 
the "if (buf[len - 1] == '\\') {" line.  And with the above example, you 
won't get the desired result.


But, you could in theory have whitespace both before _and_ after the 
'\', and to handle that correctly, you'll want the whitespace removal 
loop both before and after the '\\' detection code.



-return len;
+
+if (buf[len - 1] == '\\') {
+buf += len - 1;


I suggest using a temporary variable for increment purposes.  This will 
make it easier to examine the entire string while debugging, for 
example.  That is, don't alter buf and set char *buf2 = buf, or 
something 

Re: [FFmpeg-devel] [PATCH] doc/codecs: Add missing documentation for apply_cropping

2017-05-09 Thread James Almer
On 5/9/2017 12:23 PM, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  doc/codecs.texi | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index 1f74c83554..1d8a4e38a4 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -1279,6 +1279,16 @@ ffprobe -dump_separator "
>  Maximum number of pixels per image. This value can be used to avoid out of
>  memory failures due to large images.
>  
> +@item apply_cropping @var{integer} (@emph{decoding,video})

This option (as well as others like skip_alpha, or refcounted_frames
which is also missing in this file) are boolean, not int.
In practice it makes no difference i guess, since the actual
AVCodecContext fields are all int anyway, but maybe it could be
reflected here. I'm not sure if the difference between AV_OPT_TYPE_BOOL
and AV_OPT_TYPE_INT has any implications for API users, though.

> +Enable cropping if cropping parameters are a multiply of the required
> +alignment for the left and top parameters. If the alignment is not met the
> +cropping will be partially applied to maintain alignment.
> +1(Enabled) by default.
> +Note: The required alignment depends on if CODEC_FLAG_UNALIGNED is set and 
> the
> +CPU. CODEC_FLAG_UNALIGNED cannot be chanaged from the command line. Also hw

AV_CODEC_FLAG_UNALIGNED, and "changed".

> +decoders will not apply left/top croping.

Cropping.

> +
> +
>  @end table
>  
>  @c man end CODEC OPTIONS
> 

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


Re: [FFmpeg-devel] Null pointer dereference?

2017-05-09 Thread Ronald S. Bultje
Hi,

On Mon, May 8, 2017 at 3:08 PM, Zubin Mevawalla 
wrote:

> If `bufptr` is NULL, and `len` >= 12, then `buf` is initialized to NULL
> and dereferenced on line 796.
>
> diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
> --- a/libavformat/rtpdec.c
> +++ b/libavformat/rtpdec.c
> @@ -793,8 +793,10 @@ static int rtp_parse_one_packet(RTPDemuxContext
> *s, AVPacket *pkt,
>  if (len < 12)
>  return -1;
>
> -if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
>

In callers, we're assuming that (rtsp.c line 2158/2160) if len > 0, bufptr
!= NULL and thus buf != NULL. Likewise, len == 0 implies that bufptr ==
NULL and thus buf == NULL.

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


Re: [FFmpeg-devel] [PATCH] Fixed bug encountered when decoding interlaced video

2017-05-09 Thread Michael Niedermayer
On Thu, May 04, 2017 at 11:46:30PM -0700, Aaron Levinson wrote:
> On 4/12/2017 6:08 PM, Aaron Levinson wrote:
> > On 3/26/2017 10:34 AM, Aaron Levinson wrote:
> >> On 3/26/2017 4:41 AM, Matthias Hunstock wrote:
> >>> Am 26.03.2017 um 11:50 schrieb Aaron Levinson:
>  When using the following command to play back either file:
>   ffmpeg -i  -f decklink -pix_fmt uyvy422 "DeckLink SDI
>   4K", I noticed that with the mpegts file with the AAC audio stream,
>   it would correctly select an interlaced video mode for the video
>   output stream, but with the mpegts file with the Opus audio stream,
>   it would use a progressive video mode (1080p29.97) for the video
>   output stream.
> >>>
> >>> Which FFmpeg version did you test this with?
> >>>
> >>> There was a change related to this just short time ago.
> >>>
> >>> Does it happen with current git HEAD?
> >>>
> >>> Matthias
> >>
> >> This issue occurs with the current git HEAD.  I'm aware of the
> >> Blackmagic improvement that was added in February to add support for
> >> interlaced video modes on output, and actually that's one of the reasons
> >> why I'm using the latest git sources, as opposed to, say, 3.2.4.  This
> >> particular issue has nothing to do with Blackmagic, and I only used
> >> Blackmagic in the example that reproduces the bug because it is
> >> something that can be reproduced on both Windows and Linux (and
> >> presumably also on OS/X).  The issue also occurs if I do something like
> >> -f rawvideo out.avi on Windows, and I'm sure that there are plenty of
> >> other examples.
> >>
> >> Aaron Levinson
> > 
> > Has anyone had a chance to review this patch yet, which I submitted on 
> > March 26th?  To demonstrate the impact of this patch, here's some output of 
> > before and after for an .h264 file with interlaced 1080i59.94 video content:
> > 
> > Command-line:  ffmpeg -i test8_1080i.h264 -c:v mpeg2video test8_1080i_mp2.ts
> > 
> > Before patch:
> > 
> > --
> > 
> > Input #0, h264, from 'test8_1080i.h264':
> >   Duration: N/A, bitrate: N/A
> > Stream #0:0: Video: h264 (High), yuv420p(top first), 1920x1080 [SAR 1:1 
> > DAR 16:9], 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
> > Stream mapping:
> >   Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
> > Press [q] to stop, [?] for help
> > Output #0, mpegts, to 'test8_1080i_mp2_2.ts':
> >   Metadata:
> > encoder : Lavf57.72.100
> > Stream #0:0: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR 1:1 DAR 
> > 16:9], q=2-31, 200 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
> > Metadata:
> >   encoder : Lavc57.92.100 mpeg2video
> > Side data:
> >   cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1
> > 
> > --
> > 
> > After patch:
> > 
> > --
> > 
> > Input #0, h264, from 'test8_1080i.h264':
> >   Duration: N/A, bitrate: N/A
> > Stream #0:0: Video: h264 (High), yuv420p(top first), 1920x1080 [SAR 1:1 
> > DAR 16:9], 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
> > Stream mapping:
> >   Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
> > Press [q] to stop, [?] for help
> > Output #0, mpegts, to 'test8_1080i_mp2_2.ts':
> >   Metadata:
> > encoder : Lavf57.72.100
> > Stream #0:0: Video: mpeg2video (Main), yuv420p(top coded first 
> > (swapped)), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 90k 
> > tbn, 29.97 tbc
> > Metadata:
> >   encoder : Lavc57.92.100 mpeg2video
> > Side data:
> >   cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1
> > 
> > --
> > 
> > As can be seen, before the patch, after decoding the .h264 file and then 
> > re-encoding it as mpeg2video in an mpegts container, the interlaced aspect 
> > of the video has been lost in the output, and it is now effectively 
> > 1080p29.97, although the video hasn't actually been converted to 
> > progressive.  ffmpeg simply thinks that the video is progressive when it is 
> > not.  With the patch, the interlaced aspect is not lost and propagates to 
> > the output.  So, this conclusively demonstrates that the issue has nothing 
> > to do with Blackmagic and is a more general issue with interlaced video and 
> > decoding.
> > 
> > I can make the input file available if that would be helpful.
> > 
> > Anyway, it would be great if this bug fix could make it into ffmpeg.
> > 
> > Thanks,
> > Aaron Levinson
> 
> I've provided a new version of the patch.  When I created the first version 
> of the patch on March 26th, this was the first patch that I submitted to 
> ffmpeg, and some aspects were rough.  I had indicated that the patch passed 
> regression tests, but all I did was run "make fate", instead of "make fate 
> SAMPLES=fate-suite/", and once I understood that I should use fate-suite, I 
> discovered that some of the FATE tests failed 

[FFmpeg-devel] img2dec: jpeg_probe logic

2017-05-09 Thread Vadim Kalinsky
Hey,

Trying to fix a bug #6113, I stumbled upon some strange logic in 
libavformat/img2dec.c:jpeg_probe. It accepts first 2048 bytes of jpeg stream, 
and tries to read it with some state machine. If it doesn't look like jpeg 
stream, it returns 0 ("it's definitely not a jpeg").

After it read through the buffer, it does this:

if (state == EOI)
return AVPROBE_SCORE_EXTENSION + 1;
if (state == SOS)
return AVPROBE_SCORE_EXTENSION / 2;

return AVPROBE_SCORE_EXTENSION / 8;


That doesn't make sense to me. All we read so far made sense for jpeg reader, 
it definitely looks like a jpeg image, but for some reason our confidence is 
AVPROBE_SCORE_EXTENSION _DIVIDED_ by 2 or 8 (in other words, "it would look 
more jpeg if it had .jpg extension).

Compare it with png, for example:

static int png_probe(AVProbeData *p)
{
const uint8_t *b = p->buf;

if (AV_RB64(b) == 0x89504e470d0a1a0a)
return AVPROBE_SCORE_MAX - 1;
return 0;
}

"Return max confidence, if it has proper signature, 0 otherwise"

Shouldn't it be something like this?

if (state == EOI)
return AVPROBE_SCORE_EXTENSION + 3;
if (state == SOS)
return AVPROBE_SCORE_EXTENSION + 2;

return AVPROBE_SCORE_EXTENSION + 1;


I'll send a patch if there're no objections.

Thanks!
V. Kalinsky












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


Re: [FFmpeg-devel] [PATCH] avfilter: add arbitrary audio FIR filter

2017-05-09 Thread James Almer
On 5/8/2017 7:00 PM, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  configure  |   2 +
>  doc/filters.texi   |  23 ++
>  libavfilter/Makefile   |   1 +
>  libavfilter/af_afir.c  | 535 
> +
>  libavfilter/af_afir.h  |  82 +++
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/x86/Makefile   |   2 +
>  libavfilter/x86/af_afir.asm|  53 
>  libavfilter/x86/af_afir_init.c |  35 +++
>  9 files changed, 734 insertions(+)
>  create mode 100644 libavfilter/af_afir.c
>  create mode 100644 libavfilter/af_afir.h
>  create mode 100644 libavfilter/x86/af_afir.asm
>  create mode 100644 libavfilter/x86/af_afir_init.c
> 
> diff --git a/configure b/configure
> index 2e1786a..a46c375 100755
> --- a/configure
> +++ b/configure
> @@ -3081,6 +3081,8 @@ unix_protocol_select="network"
>  # filters
>  afftfilt_filter_deps="avcodec"
>  afftfilt_filter_select="fft"
> +afir_filter_deps="avcodec"
> +afir_filter_select="fft"

You also need to add avcodec to avfilter_deps in the corresponding
section (Near the end of configure) when this filter is enabled.

>  amovie_filter_deps="avcodec avformat"
>  aresample_filter_deps="swresample"
>  ass_filter_deps="libass"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index f431274..0efce9a 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -878,6 +878,29 @@ afftfilt="1-clip((b/nb)*b,0,1)"
>  @end example
>  @end itemize
>  
> +@section afir
> +
> +Apply an Arbitary Frequency Impulse Response filter.
> +
> +This filter uses second stream as FIR coefficients.
> +If second stream holds single channel, it will be used
> +for all input channels in first stream, otherwise
> +number of channels in second stream must be same as
> +number of channels in first stream.
> +
> +It accepts the following parameters:
> +
> +@table @option
> +@item dry
> +Set dry gain. This sets input gain.
> +
> +@item wet
> +Set wet gain. This sets final output gain.
> +
> +@item length
> +Set Impulse Response filter length. Default is 1, which means whole IR is 
> processed.
> +@end table
> +
>  @anchor{aformat}
>  @section aformat
>  
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 0f99086..de5f992 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -37,6 +37,7 @@ OBJS-$(CONFIG_AEMPHASIS_FILTER)  += 
> af_aemphasis.o
>  OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
>  OBJS-$(CONFIG_AFADE_FILTER)  += af_afade.o
>  OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o window_func.o
> +OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
>  OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
>  OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
>  OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
> diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
> new file mode 100644
> index 000..eb59d53
> --- /dev/null
> +++ b/libavfilter/af_afir.c
> @@ -0,0 +1,535 @@
> +/*
> + * Copyright (c) 2017 Paul B Mahol
> + *
> + * 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
> + */
> +
> +/**
> + * @file
> + * An arbitrary audio FIR filter
> + */
> +
> +#include "libavutil/audio_fifo.h"
> +#include "libavutil/common.h"
> +#include "libavutil/float_dsp.h"
> +#include "libavutil/opt.h"
> +#include "libavcodec/avfft.h"
> +
> +#include "audio.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "af_afir.h"
> +
> +static void fcmul_add_c(float *sum, const float *t, const float *c, int len)

ptrdiff_t for len.

> +{
> +int n;
> +
> +for (n = 0; n < len; n++) {
> +const float cre = c[2 * n];
> +const float cim = c[2 * n + 1];
> +const float tre = t[2 * n];
> +const float tim = t[2 * n + 1];
> +
> +sum[2 * n] += tre * cre - tim * cim;
> +sum[2 * n + 1] += tre * cim + tim * cre;
> +}
> +
> +sum[2 * n] += t[2 * n] * c[2 * n];
> +}

[...]
> +static int convert_coeffs(AVFilterContext *ctx)
> +{
> +AudioFIRContext *s = ctx->priv;
> +int i, ch, n, N;
> +float power = 0;
> +
> +s->nb_taps = 

Re: [FFmpeg-devel] [PATCH] nvenc : Support Video Codec SDK 8.0

2017-05-09 Thread Timo Rothenpieler

Am 09.05.2017 um 08:18 schrieb Yogender Gupta:

Video Codec SDK 8.0 has been released today. Please find the patch that  
updates the interface. Also, attached the latest SDK 8.0 interface file for 
nvenc.


ffmpeg master is now updated to SDK 8.0.14 for both nvenc and cuvid, thanks!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/webp: Update canvas size in vp8_lossy_decode_frame() as in vp8_lossless_decode_frame()

2017-05-09 Thread Michael Niedermayer
On Mon, May 08, 2017 at 02:43:03PM +0200, Michael Niedermayer wrote:
> Fixes: 1407/clusterfuzz-testcase-minimized-6044604124102656

This also fixes 1420

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


[FFmpeg-devel] [PATCH] avcodec/hevc_sei: fix amount of bits skipped when reading picture timing SEI message

2017-05-09 Thread James Almer
The code was skipping the entire reported SEI message size regardless of 
the amount of bits read.
While in theory safe for NALU where the picture timing SEI message is alone
or at the end as we're using the checked bitstream reader, it isn't in any
other situation, where every SEI message in the NALU after the picture
timing one would potentially fail to parse.

Change the function name to one more in line with the rest of file, and
remove the bogus "Skipped SEI" debug message while at it.

Signed-off-by: James Almer 
---
No test case, all the files i checked plus those in the FATE suite seem to
have one SEI message per NALU, or the Picture Timing SEI as the last one.

 libavcodec/hevc_sei.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index c5054bfaab..0ecf00c14c 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -124,8 +124,8 @@ static int 
decode_nal_sei_display_orientation(HEVCSEIDisplayOrientation *s, GetB
 return 0;
 }
 
-static int decode_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const 
HEVCParamSets *ps,
- void *logctx)
+static int decode_nal_sei_pic_timing(HEVCSEIContext *s, GetBitContext *gb, 
const HEVCParamSets *ps,
+ void *logctx, int size)
 {
 HEVCSEIPictureTiming *h = >picture_timing;
 HEVCSPS *sps;
@@ -146,7 +146,11 @@ static int decode_pic_timing(HEVCSEIContext *s, 
GetBitContext *gb, const HEVCPar
 }
 get_bits(gb, 2);   // source_scan_type
 get_bits(gb, 1);   // duplicate_flag
+skip_bits1(gb);
+size--;
 }
+skip_bits_long(gb, 8 * size);
+
 return 1;
 }
 
@@ -272,12 +276,7 @@ static int decode_nal_sei_prefix(GetBitContext *gb, 
HEVCSEIContext *s, const HEV
 case HEVC_SEI_TYPE_DISPLAY_ORIENTATION:
 return decode_nal_sei_display_orientation(>display_orientation, gb);
 case HEVC_SEI_TYPE_PICTURE_TIMING:
-{
-int ret = decode_pic_timing(s, gb, ps, logctx);
-av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
-skip_bits(gb, 8 * size);
-return ret;
-}
+return decode_nal_sei_pic_timing(s, gb, ps, logctx, size);
 case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO:
 return decode_nal_sei_mastering_display_info(>mastering_display, 
gb);
 case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
-- 
2.12.1

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/webp: Update canvas size in vp8_lossy_decode_frame() as in vp8_lossless_decode_frame()

2017-05-09 Thread Michael Niedermayer
On Mon, May 08, 2017 at 02:43:03PM +0200, Michael Niedermayer wrote:
> Fixes: 1407/clusterfuzz-testcase-minimized-6044604124102656
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/webp.c | 3 +++
>  1 file changed, 3 insertions(+)

patchset applied

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


[FFmpeg-devel] [PATCH] doc/codecs: Add missing documentation for apply_cropping

2017-05-09 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/codecs.texi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 1f74c83554..1d8a4e38a4 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -1279,6 +1279,16 @@ ffprobe -dump_separator "
 Maximum number of pixels per image. This value can be used to avoid out of
 memory failures due to large images.
 
+@item apply_cropping @var{integer} (@emph{decoding,video})
+Enable cropping if cropping parameters are a multiply of the required
+alignment for the left and top parameters. If the alignment is not met the
+cropping will be partially applied to maintain alignment.
+1(Enabled) by default.
+Note: The required alignment depends on if CODEC_FLAG_UNALIGNED is set and the
+CPU. CODEC_FLAG_UNALIGNED cannot be chanaged from the command line. Also hw
+decoders will not apply left/top croping.
+
+
 @end table
 
 @c man end CODEC OPTIONS
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH]lavf/mlv: Fix an snprintf() truncation

2017-05-09 Thread Clément Bœsch
On Tue, May 09, 2017 at 03:32:36PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes a warning when compiling with gcc 7:
> libavformat/mlvdec.c: In function ‘read_header’:
> libavformat/mlvdec.c:353:58: warning: ‘snprintf’ output may be truncated 
> before the last format character [-Wformat-truncation=]
>  snprintf(filename + strlen(filename) - 2, 3, "%02d", i);
> 
> Please comment, Carl Eugen

> From f56bf75b2b8b99cbbe99da8d2e33e46bf50be92d Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Tue, 9 May 2017 15:27:44 +0200
> Subject: [PATCH] lavf/mlvdec: Avoid snprintf() output truncation.
> 
> Fixes a gcc warning:
> 'snprintf' output may be truncated before the last format character
> ---
>  libavformat/mlvdec.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
> index 319cd26..372acbe 100644
> --- a/libavformat/mlvdec.c
> +++ b/libavformat/mlvdec.c
> @@ -349,7 +349,7 @@ static int read_header(AVFormatContext *avctx)
>  if (!filename)
>  return AVERROR(ENOMEM);
>  
> -for (i = 0; i < 100; i++) {
> +for (i = 0; i < 99; i++) {
>  snprintf(filename + strlen(filename) - 2, 3, "%02d", i);
>  if (avctx->io_open(avctx, >pb[i], filename, AVIO_FLAG_READ, 
> NULL) < 0)
>  break;

can you explain? The current loop is not supposed to ever reach 100.

-- 
Clément B.


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


Re: [FFmpeg-devel] fate/exr : add test for Y, B44A negative, datawindow != display window

2017-05-09 Thread Martin Vignali
2017-05-05 4:22 GMT+02:00 Michael Niedermayer :

> On Mon, May 01, 2017 at 02:31:28PM +0200, Martin Vignali wrote:
> > Hello,
> >
> > In attach a patch to add fate tests for exr
> >
> > samples can be found here
> > https://we.tl/ItuIX0BMfk
>
> uploaded
>
> Ping for patch apply

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


[FFmpeg-devel] [PATCH]lavf/mlv: Fix an snprintf() truncation

2017-05-09 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes a warning when compiling with gcc 7:
libavformat/mlvdec.c: In function ‘read_header’:
libavformat/mlvdec.c:353:58: warning: ‘snprintf’ output may be truncated 
before the last format character [-Wformat-truncation=]
 snprintf(filename + strlen(filename) - 2, 3, "%02d", i);

Please comment, Carl Eugen
From f56bf75b2b8b99cbbe99da8d2e33e46bf50be92d Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Tue, 9 May 2017 15:27:44 +0200
Subject: [PATCH] lavf/mlvdec: Avoid snprintf() output truncation.

Fixes a gcc warning:
'snprintf' output may be truncated before the last format character
---
 libavformat/mlvdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 319cd26..372acbe 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -349,7 +349,7 @@ static int read_header(AVFormatContext *avctx)
 if (!filename)
 return AVERROR(ENOMEM);
 
-for (i = 0; i < 100; i++) {
+for (i = 0; i < 99; i++) {
 snprintf(filename + strlen(filename) - 2, 3, "%02d", i);
 if (avctx->io_open(avctx, >pb[i], filename, AVIO_FLAG_READ, 
NULL) < 0)
 break;
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 1/4] hevcdec: export cropping information instead of handling it internally

2017-05-09 Thread James Almer
On 5/9/2017 2:46 AM, wm4 wrote:
> On Mon,  8 May 2017 15:46:22 -0300
> James Almer  wrote:
> 
>> From: Anton Khirnov 
>>
>> ---
>> This merges commit a02ae1c6837a54ed9e7735da2b1f789b2f4b6e13 from libav
>>
> 
> Any specific reason you're posting them to the list?

I was asked to, since they didn't merge cleanly and could introduce
regressions in sensible code (h264 mainly).

If none are found i'll push them as usual.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] lavfi: add a framework to fix alignment problems.

2017-05-09 Thread Nicolas George
A lot of filters require aligned frame data, but do not document it.
It can result in crashes with perfectly valid uses of the API.
For now, the default alignment is not set.

Signed-off-by: Nicolas George 
---
 libavfilter/avfilter.c | 50 ++
 libavfilter/avfilter.h |  9 +
 2 files changed, 59 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 08b86b010d..2918687e81 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1515,15 +1515,60 @@ static void consume_update(AVFilterLink *link, const 
AVFrame *frame)
 link->frame_count_out++;
 }
 
+static int frame_realign(AVFilterLink *link, AVFrame *frame)
+{
+AVFrame *tmp;
+int ret;
+
+if (!frame || av_frame_check_align(frame, link->alignment))
+return 0;
+
+switch (link->type) {
+case AVMEDIA_TYPE_VIDEO:
+tmp = ff_get_video_buffer(link, link->w, link->h);
+break;
+case AVMEDIA_TYPE_AUDIO:
+tmp = ff_get_audio_buffer(link, frame->nb_samples);
+break;
+default:
+av_assert0(!"reached");
+}
+if (!tmp)
+return AVERROR(ENOMEM);
+
+if (ret < 0)
+goto fail;
+ret = av_frame_copy(tmp, frame);
+if (ret < 0)
+return ret;
+ret = av_frame_copy_props(tmp, frame);
+if (ret < 0)
+return ret;
+av_frame_unref(frame);
+av_frame_move_ref(frame, tmp);
+av_frame_free();
+return 0;
+
+fail:
+av_frame_free();
+return ret;
+}
+
 int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
 {
 AVFrame *frame;
+int ret;
 
 *rframe = NULL;
 if (!ff_inlink_check_available_frame(link))
 return 0;
 frame = ff_framequeue_take(>fifo);
 consume_update(link, frame);
+ret = frame_realign(link, frame);
+if (ret < 0) {
+av_frame_free();
+return ret;
+}
 *rframe = frame;
 return 1;
 }
@@ -1544,6 +1589,11 @@ int ff_inlink_consume_samples(AVFilterLink *link, 
unsigned min, unsigned max,
 if (ret < 0)
 return ret;
 consume_update(link, frame);
+ret = frame_realign(link, frame);
+if (ret < 0) {
+av_frame_free();
+return ret;
+}
 *rframe = frame;
 return 1;
 }
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 60662c19ac..db9c02b8c0 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -569,6 +569,15 @@ struct AVFilterLink {
  */
 AVBufferRef *hw_frames_ctx;
 
+/**
+ * Minimum alignment of frame data required by the destination filter.
+ * All frame data pointers must have the alignment lower bits cleared,
+ * i.e. be a multiple of 1

[FFmpeg-devel] [PATCH 2/3] lavc: add a framework to fix alignment problems.

2017-05-09 Thread Nicolas George
A lot of codecs require aligned frame data, but do not document it.
It can result in crashes with perfectly valid uses of the API.

Design rationale:

- requiring frame data to be always aligned would be wasteful;

- alignment requirements will evolve
  (the 16->32 bump is still recent);

- requiring applications to worry about alignment is not convenient.

For now, the default alignment is fixed at 5.

Fix: trac ticket #6349
Signed-off-by: Nicolas George 
---
 libavcodec/avcodec.h | 10 +
 libavcodec/encode.c  | 57 +---
 libavcodec/utils.c   |  2 ++
 3 files changed, 66 insertions(+), 3 deletions(-)


A little less simple than I hoped due to the const issue, but still
reasonable.

For backporting to branch, I suggest: copy-paste av_frame_check_align() and
make it static, replace avctx->alignment by hardcoded 5.


diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index df6d2bc748..7dbed3c82c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3671,6 +3671,16 @@ typedef struct AVCodecContext {
  * (with the display dimensions being determined by the crop_* fields).
  */
 int apply_cropping;
+
+/**
+ * Minimum alignment of frame data required by the codec.
+ * All frame data pointers must have the alignment lower bits cleared,
+ * i.e. be a multiple of 1format = (*frame)->format;
+tmp->width  = (*frame)->width;
+tmp->height = (*frame)->height;
+tmp->channels   = (*frame)->channels;
+tmp->channel_layout = (*frame)->channel_layout;
+tmp->nb_samples = (*frame)->nb_samples;
+ret = av_frame_get_buffer(tmp, 1 << avctx->alignment);
+if (ret < 0)
+goto fail;
+ret = av_frame_copy(tmp, *frame);
+if (ret < 0)
+return ret;
+ret = av_frame_copy_props(tmp, *frame);
+if (ret < 0)
+return ret;
+*frame = *realigned = tmp;
+return 0;
+
+fail:
+av_frame_free();
+return ret;
+}
+
 int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
   AVPacket *avpkt,
   const AVFrame *frame,
@@ -122,6 +156,7 @@ int attribute_align_arg 
avcodec_encode_audio2(AVCodecContext *avctx,
 {
 AVFrame *extended_frame = NULL;
 AVFrame *padded_frame = NULL;
+AVFrame *realigned_frame = NULL;
 int ret;
 AVPacket user_pkt = *avpkt;
 int needs_realloc = !user_pkt.data;
@@ -195,6 +230,9 @@ int attribute_align_arg 
avcodec_encode_audio2(AVCodecContext *avctx,
 
 av_assert0(avctx->codec->encode2);
 
+ret = frame_realign(avctx, , _frame);
+if (ret < 0)
+goto end;
 ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
 if (!ret) {
 if (*got_packet_ptr) {
@@ -252,6 +290,7 @@ int attribute_align_arg 
avcodec_encode_audio2(AVCodecContext *avctx,
 
 end:
 av_frame_free(_frame);
+av_frame_free(_frame);
 av_free(extended_frame);
 
 #if FF_API_AUDIOENC_DELAY
@@ -269,6 +308,7 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
 int ret;
 AVPacket user_pkt = *avpkt;
 int needs_realloc = !user_pkt.data;
+AVFrame *realigned_frame = NULL;
 
 *got_packet_ptr = 0;
 
@@ -301,7 +341,9 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
 
 av_assert0(avctx->codec->encode2);
 
-ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
+ret = frame_realign(avctx, , _frame);
+if (!ret)
+ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
 av_assert0(ret <= 0);
 
 emms_c();
@@ -340,6 +382,7 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
 avctx->frame_number++;
 }
 
+av_frame_free(_frame);
 if (ret < 0 || !*got_packet_ptr)
 av_packet_unref(avpkt);
 
@@ -406,8 +449,16 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext 
*avctx, const AVFrame
 return 0;
 }
 
-if (avctx->codec->send_frame)
-return avctx->codec->send_frame(avctx, frame);
+if (avctx->codec->send_frame) {
+AVFrame *realigned_frame = NULL;
+int ret;
+ret = frame_realign(avctx, , _frame);
+if (ret < 0)
+return ret;
+ret = avctx->codec->send_frame(avctx, frame);
+av_frame_free(_frame);
+return ret;
+}
 
 // Emulation via old API. Do it here instead of avcodec_receive_packet, 
because:
 // 1. if the AVFrame is not refcounted, the copying will be much more
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1336e921c9..3681d71487 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1003,6 +1003,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 avctx->sw_pix_fmt = 

Re: [FFmpeg-devel] [PATCH 5/7] lavf/flacenc: support writing attached pictures

2017-05-09 Thread Michael Niedermayer
On Sun, May 07, 2017 at 11:36:22PM -0500, Rodger Combs wrote:
> ---
>  libavformat/flacenc.c | 271 
> +++---
>  1 file changed, 236 insertions(+), 35 deletions(-)

Didnt review but i can confirm that it seems to work

thx

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] avfilter: add arbitrary audio FIR filter

2017-05-09 Thread Paul B Mahol
On 5/9/17, Muhammad Faiz  wrote:
> On Tue, May 9, 2017 at 5:03 AM, Paul B Mahol  wrote:
>> On 5/8/17, Muhammad Faiz  wrote:
>>> On Mon, May 8, 2017 at 11:06 PM, Paul B Mahol  wrote:
 On 5/8/17, Muhammad Faiz  wrote:
> On Mon, May 8, 2017 at 6:59 PM, Paul B Mahol  wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  configure|   2 +
>>  doc/filters.texi |  23 ++
>>  libavfilter/Makefile |   1 +
>>  libavfilter/af_afir.c| 544
>> +++
>>  libavfilter/allfilters.c |   1 +
>>  5 files changed, 571 insertions(+)
>>  create mode 100644 libavfilter/af_afir.c
>>
>> diff --git a/configure b/configure
>> index 2e1786a..a46c375 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3081,6 +3081,8 @@ unix_protocol_select="network"
>>  # filters
>>  afftfilt_filter_deps="avcodec"
>>  afftfilt_filter_select="fft"
>> +afir_filter_deps="avcodec"
>> +afir_filter_select="fft"
>>  amovie_filter_deps="avcodec avformat"
>>  aresample_filter_deps="swresample"
>>  ass_filter_deps="libass"
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index f431274..0efce9a 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -878,6 +878,29 @@ afftfilt="1-clip((b/nb)*b,0,1)"
>>  @end example
>>  @end itemize
>>
>> +@section afir
>> +
>> +Apply an Arbitary Frequency Impulse Response filter.
>> +
>> +This filter uses second stream as FIR coefficients.
>> +If second stream holds single channel, it will be used
>> +for all input channels in first stream, otherwise
>> +number of channels in second stream must be same as
>> +number of channels in first stream.
>> +
>> +It accepts the following parameters:
>> +
>> +@table @option
>> +@item dry
>> +Set dry gain. This sets input gain.
>> +
>> +@item wet
>> +Set wet gain. This sets final output gain.
>> +
>> +@item length
>> +Set Impulse Response filter length. Default is 1, which means whole
>> IR
>> is
>> processed.
>> +@end table
>> +
>>  @anchor{aformat}
>>  @section aformat
>>
>> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> index 0f99086..de5f992 100644
>> --- a/libavfilter/Makefile
>> +++ b/libavfilter/Makefile
>> @@ -37,6 +37,7 @@ OBJS-$(CONFIG_AEMPHASIS_FILTER)  +=
>> af_aemphasis.o
>>  OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
>>  OBJS-$(CONFIG_AFADE_FILTER)  += af_afade.o
>>  OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o
>> window_func.o
>> +OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
>>  OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
>>  OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
>>  OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
>> diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
>> new file mode 100644
>> index 000..bc1b6a4
>> --- /dev/null
>> +++ b/libavfilter/af_afir.c
>> @@ -0,0 +1,544 @@
>> +/*
>> + * Copyright (c) 2017 Paul B Mahol
>> + *
>> + * 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
>> + */
>> +
>> +/**
>> + * @file
>> + * An arbitrary audio FIR filter
>> + */
>> +
>> +#include "libavutil/audio_fifo.h"
>> +#include "libavutil/common.h"
>> +#include "libavutil/opt.h"
>> +#include "libavcodec/avfft.h"
>> +
>> +#include "audio.h"
>> +#include "avfilter.h"
>> +#include "formats.h"
>> +#include "internal.h"
>> +
>> +#define MAX_IR_DURATION 30
>> +
>> +typedef struct AudioFIRContext {
>> +const AVClass *class;
>> +
>> +float wet_gain;
>> +float dry_gain;
>> +float length;
>> +
>> +float gain;
>> +
>> +int eof_coeffs;
>> +int 

Re: [FFmpeg-devel] [PATCH 6/7] lavf/flacenc: avoid buffer overread with unexpected extradata sizes

2017-05-09 Thread Michael Niedermayer
On Sun, May 07, 2017 at 11:36:23PM -0500, Rodger Combs wrote:
> ---
>  libavformat/flacenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
> index 9bb4947..b8800cc 100644
> --- a/libavformat/flacenc.c
> +++ b/libavformat/flacenc.c
> @@ -315,7 +315,7 @@ static int flac_write_trailer(struct AVFormatContext *s)
>  if (!c->write_header || !streaminfo)
>  return 0;
>  
> -if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
> +if (pb->seekable & AVIO_SEEKABLE_NORMAL && (c->streaminfo || 
> s->streams[0]->codecpar->extradata_size == FLAC_STREAMINFO_SIZE)) {

storing extradata in one of 2 different places is bad
i know its not added by your patch but instead of adding more code
on top of that. Please store a pointer to the streaminfo/extradata in
one place first instead of duplicating the A vs B check.

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

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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


[FFmpeg-devel] [PATCH v10] - Added Turing codec interface for ffmpeg

2017-05-09 Thread Saverio Blasi
- This patch contains the changes to interface the Turing codec 
(http://turingcodec.org/) with ffmpeg. The patch was modified to address the 
comments in the review as follows:
  - Added a pkg-config file to list all dependencies required by libturing. 
This should address the issue pointed out by Hendrik Leppkes on Fri 18/11/2016
  - As per suggestions of wm4, two functions (add_option and finalise_options) 
have been created. The former appends new options while the latter sets up the 
argv array of pointers to char* accordingly. add_option re-allocates the buffer 
for options using av_realloc
  - Additionally, both these functions handle the errors in case the memory 
wasn't allocated correctly
  - malloc|free|realloc have been substituted with their corresponding 
av_{malloc|free|realloc} version
  - Check on bit-depth has been removed since the ffmpeg already casts the 
right pix_fmt and bit depth
  - pix_fmts is now set in ff_libturing_encoder as in h264dec.c.
  - Changed usage of av_free with av_freep and fixed calls to free arrays
  - Added brackets to all if and for statements
  - Avoid repetition of code to free arrays in case of failure to initialise 
the libturing encoder
  - Some fixes to address the review from wm4 and Mark Thompson received on Wed 
08/02/2017
  - Fixed indentation
---
 LICENSE.md |   1 +
 configure  |   6 +
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libturing.c | 313 +
 5 files changed, 322 insertions(+)
 create mode 100755 libavcodec/libturing.c

diff --git a/LICENSE.md b/LICENSE.md
index ba65b05..03787c0 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -84,6 +84,7 @@ The following libraries are under GPL:
 - frei0r
 - libcdio
 - librubberband
+- libturing
 - libvidstab
 - libx264
 - libx265
diff --git a/configure b/configure
index 2e1786a..0adc4da 100755
--- a/configure
+++ b/configure
@@ -256,6 +256,7 @@ External library support:
   --enable-libssh  enable SFTP protocol via libssh [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
+  --enable-libturing   enable H.265/HEVC encoding via libturing [no]
   --enable-libtwolame  enable MP2 encoding via libtwolame [no]
   --enable-libv4l2 enable libv4l2/v4l-utils [no]
   --enable-libvidstab  enable video stabilization using vid.stab [no]
@@ -1497,6 +1498,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 frei0r
 libcdio
 librubberband
+libturing
 libvidstab
 libx264
 libx265
@@ -2875,6 +2877,7 @@ libspeex_decoder_deps="libspeex"
 libspeex_encoder_deps="libspeex"
 libspeex_encoder_select="audio_frame_queue"
 libtheora_encoder_deps="libtheora"
+libturing_encoder_deps="libturing"
 libtwolame_encoder_deps="libtwolame"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
 libvorbis_decoder_deps="libvorbis"
@@ -5831,6 +5834,9 @@ enabled libssh&& require_pkg_config libssh 
libssh/sftp.h sftp_init
 enabled libspeex  && require_pkg_config speex speex/speex.h 
speex_decoder_init -lspeex
 enabled libtesseract  && require_pkg_config tesseract tesseract/capi.h 
TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
+enabled libturing && require_pkg_config libturing turing.h 
turing_version &&
+ { check_cpp_condition turing.h 
"TURING_API_VERSION > 1" ||
+ die "ERROR: libturing requires turing api version 
2 or greater."; }
 enabled libtwolame&& require libtwolame twolame.h twolame_init 
-ltwolame &&
  { check_lib libtwolame twolame.h 
twolame_encode_buffer_float32_interleaved -ltwolame ||
die "ERROR: libtwolame must be installed and 
version must be >= 0.3.10"; }
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 44acc95..0a11a6b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -909,6 +909,7 @@ OBJS-$(CONFIG_LIBSHINE_ENCODER)   += libshine.o
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBSPEEX_ENCODER)   += libspeexenc.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
+OBJS-$(CONFIG_LIBTURING_ENCODER)  += libturing.o
 OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
 OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
 OBJS-$(CONFIG_LIBVORBIS_DECODER)  += libvorbisdec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7fcc26f..c729b8d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -620,6 +620,7 @@ static void register_all(void)
 REGISTER_ENCODER(LIBSHINE,  libshine);
 REGISTER_ENCDEC (LIBSPEEX,  libspeex);
 REGISTER_ENCODER(LIBTHEORA, libtheora);
+REGISTER_ENCODER(LIBTURING, libturing);
  

Re: [FFmpeg-devel] [PATCH] nvenc : Support Video Codec SDK 8.0

2017-05-09 Thread Timo Rothenpieler
Am 09.05.2017 um 08:18 schrieb Yogender Gupta:
> Video Codec SDK 8.0 has been released today. Please find the patch that  
> updates the interface. Also, attached the latest SDK 8.0 interface file for 
> nvenc.
> 
> Thanks,
> Yogender

I had already started incorporating the changes of the new SDK.
You can see my progress so far on my Github fork:
https://github.com/BtbN/FFmpeg/commits/master

One thing I'm wondering:
https://github.com/BtbN/FFmpeg/commit/97b30d418f770c9797a264a1ec8bd8c1519cf492#diff-0823f17b4e015a61e2f7e962c15abe23R725

CUVIDPROCPARAMS gained documentation for some raw YUV parameters.
Does this mean we could create a cuvid_vpp filter, which uses the cuvid
scaler and deinterlacer without needing to decode something to use it?
I can't find anything about this in the SDK documentation pdfs included
with it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffprobe: discard non-selected streams

2017-05-09 Thread Clément Bœsch
From: Clément Bœsch 

---
 ffprobe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ffprobe.c b/ffprobe.c
index 8129bcedf0..f2a3cc7a73 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2886,6 +2886,8 @@ static int probe_file(WriterContext *wctx, const char 
*filename)
 } else {
 selected_streams[i] = 1;
 }
+if (!selected_streams[i])
+ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL;
 }
 
 if (do_read_frames || do_read_packets) {
-- 
2.12.2

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