Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxdec: fix crop handling when multithreaded

2019-09-06 Thread Aman Gupta
On Fri, Sep 6, 2019 at 8:37 PM Rodger Combs  wrote:

> This was partially fixed by 233cd89, but it made changes to AVFrame fields
> from within end_frame, which doesn't work consistently when multithreading
> is enabled. This is what the post_process function is for.


Looks good to me.


> ---
>  libavcodec/videotoolbox.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index c718e82cc5..7948d21bcc 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx,
> AVFrame *frame)
>  return AVERROR_EXTERNAL;
>  }
>
> +frame->crop_right = 0;
> +frame->crop_left = 0;
> +frame->crop_top = 0;
> +frame->crop_bottom = 0;
> +
>  frame->data[3] = (uint8_t*)ref->pixbuf;
>
>  if (ref->hw_frames_ctx) {
> @@ -898,11 +903,6 @@ static int
> videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
>  AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
>  VTContext *vtctx = avctx->internal->hwaccel_priv_data;
>
> -frame->crop_right = 0;
> -frame->crop_left = 0;
> -frame->crop_top = 0;
> -frame->crop_bottom = 0;
> -
>  if (vtctx->reconfig_needed == true) {
>  vtctx->reconfig_needed = false;
>  av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs
> reconfig, restarting..\n");
> --
> 2.21.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] lavc/videotoolboxdec: fix crop handling when multithreaded

2019-09-06 Thread Rodger Combs
This was partially fixed by 233cd89, but it made changes to AVFrame fields
from within end_frame, which doesn't work consistently when multithreading
is enabled. This is what the post_process function is for.
---
 libavcodec/videotoolbox.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index c718e82cc5..7948d21bcc 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx, AVFrame 
*frame)
 return AVERROR_EXTERNAL;
 }
 
+frame->crop_right = 0;
+frame->crop_left = 0;
+frame->crop_top = 0;
+frame->crop_bottom = 0;
+
 frame->data[3] = (uint8_t*)ref->pixbuf;
 
 if (ref->hw_frames_ctx) {
@@ -898,11 +903,6 @@ static int videotoolbox_common_end_frame(AVCodecContext 
*avctx, AVFrame *frame)
 AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
 VTContext *vtctx = avctx->internal->hwaccel_priv_data;
 
-frame->crop_right = 0;
-frame->crop_left = 0;
-frame->crop_top = 0;
-frame->crop_bottom = 0;
-
 if (vtctx->reconfig_needed == true) {
 vtctx->reconfig_needed = false;
 av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, 
restarting..\n");
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs

2019-09-06 Thread Niki Bowe
As it turns out the last patch still lets a lot of jpegs get misidentified.

This new version avoids the problem by checking for jpeg magic at the start.

I also added a FATE test, and attached the jpeg for the test.



On Tue, Aug 27, 2019 at 6:30 PM Niki Bowe  wrote:

>
>
> On Sun, Aug 25, 2019 at 11:39 AM Michael Niedermayer
>  wrote:
>
>> On Fri, Aug 23, 2019 at 04:03:10PM -0700, Niki Bowe wrote:
>> > On Thu, Aug 22, 2019 at 2:30 AM Paul B Mahol  wrote:
>> >
>> > > On Thu, Aug 22, 2019 at 11:19 AM Carl Eugen Hoyos > >
>> > > wrote:
>> > >
>> > > > Am Mi., 21. Aug. 2019 um 23:05 Uhr schrieb Niki Bowe
>> > > > :
>> > > > >
>> > > > > On Mon, Aug 19, 2019 at 7:22 PM Carl Eugen Hoyos <
>> ceffm...@gmail.com>
>> > > > wrote:
>> > > > >
>> > > > > >
>> > > > > > This score would mean that mjpeg can never be detected.
>> > > > > > I suspect you have to reduce one of the demuxers to "- 1".
>> > > > > >
>> > > > > >
>> > > > > Thanks Carl.
>> > > > > Attached patch to reduce mpeg probe by -1, which also fixes the
>> issue.
>> > > >
>> > > > Sorry, I misread the original report, it looked to me as if mJpeg
>> was
>> > > > the culprit.
>> > > >
>> > > > Imo, the mpeg probing should be fixed (return a smaller value) for
>> your
>> > > > sample
>> > > > by detecting that it is not mpeg, not by returning a smaller value
>> for
>> > > > all samples.
>> > > >
>> > >
>> > > 1000% agree.
>> > >
>> > >
>> > It didn't return a smaller value for all samples, only the "invalid VDR
>> > files and short PES streams" case.
>> > Most mpegps files still return 26 immediately, because they have pack
>> > headers.
>> >
>> > However, here is another patch where I try to limit it to only changing
>> > score for these jpegs.
>> > I noticed that these jpegs had a lot of 0x0100 sequences, which
>> matches
>> > mpeg picture header start code. I added another heuristic which matches
>> > these jpegs, but not any mpegps files I could find.
>> >
>> > Alternatively I could make reduce score if it doesn't start with a start
>> > code? At the moment its happy to search until it finds start codes.
>> >
>> >
>> > Is everyone really sure the best approach is to modify mpegps_probe for
>> > this?
>> > The mpegps_probe function returns 25 in many instances where it may not
>> be
>> > mpegps. It does only minimal structural checking, and allows invalid
>> data
>> > to still classify as mpegps.
>> > jpeg probing returns 25 in some cases where it is almost certainly a
>> jpeg
>> > (Has to go through multiple tags to get to SOS, many of which early out
>> if
>> > they find invalid data).
>> > Note that 25 is still treated as "low confidence" for jpeg. It logs
>> "Format
>> > jpeg_pipe detected only with low score of 25, misdetection possible!"
>> for
>> > these jpegs.
>> > So I still think a score of 25 is too low for these jpegs, and that a
>> > better fix would be to return 26 for jpeg_pipe and mjpeg if it makes it
>> > past multiple tags to SOS.
>>
>> jpegs can be in other container formats its not jpeg in that case but the
>> other container format
>>
> about this patch
>> it breaks this:
>>
>> ./ffplay tickets//3327/issue3327-libc-2.17.so
>>
>> https://trac.ffmpeg.org/raw-attachment/ticket/3327/issue3327-libc-2.17.so
>>
>> which is detected as mpeg after the patch.
>> really nothing should be detected as mpeg after this that was not before
>> the idea IIUC is make something that was detected as mpeg to be not
>> anymore
>>
>>
> Thanks Michael. Good find.
> Attached patch which only applies the extra sanity checks to the "Invalid
> VDR files and short PES streams" path.
>
>
>
>> Thanks
>>
>> [...]
>>
>>
>> --
>> 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.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
>
>
> --
>
> Nikolas Bowe |  SWE |  nb...@google.com |  408-565-5137
>


-- 

Nikolas Bowe |  SWE |  nb...@google.com |  408-565-5137


jpeg_with_mpeg_start_codes
Description: Binary data
From 49fdc6549a0b8413f80aa16a14473e956d0ea08b Mon Sep 17 00:00:00 2001
From: Nikolas Bowe 
Date: Wed, 4 Sep 2019 18:23:16 -0700
Subject: [PATCH] Fix JPEGs being misidentified as mpeg.

mpeg probing is very forgiving, willing to skip over arbitrary junk between "start codes". Its not unusual to find things which look like start codes in other formats. Normally that isn't a problem as other formats will get higher probe scores, but jpeg probe scores will only be 25 unless it reaches the End Of Image tag.
For this reason, if it 

[FFmpeg-devel] [PATCH v1] avformat/movenc: split empty text sample when duration overflow

2019-09-06 Thread Jun Li
Fix #7637
One empty/end sample is created and inserted between two caption lines when 
there is a gap.
This patch is to split the sample into multiple ones when its duration is too 
long (>= INT_MAX).
---
 libavformat/movenc.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index edddfeeb00..aeb7de351f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s, AVPacket 
*pkt)
  *
  * 2) For each subtitle track, check if the current packet's
  * dts is past the duration of the last subtitle sample. If
- * so, we now need to write an end sample for that subtitle.
+ * so, we now need to write one or multiple end samples for
+ * that subtitle.
  *
  * This must be done conditionally to allow for subtitles that
  * immediately replace each other, in which case an end sample
@@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 int ret;
 
 if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
-trk->track_duration < pkt->dts &&
-(trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
-ret = mov_write_subtitle_end_packet(s, i, trk->track_duration);
-if (ret < 0) return ret;
-trk->last_sample_is_subtitle_end = 1;
+trk->track_duration < pkt->dts) {
+int max_duration = INT_MAX - 1;
+if (trk->entry == 0 || !trk->last_sample_is_subtitle_end) {
+ret = mov_write_subtitle_end_packet(s, i, 
trk->track_duration);
+if (ret < 0) return ret;
+trk->last_sample_is_subtitle_end = 1;
+}
+if (trk->last_sample_is_subtitle_end &&
+pkt->dts - trk->track_duration > max_duration) {
+int64_t dts = trk->track_duration;
+while(pkt->dts - dts > max_duration) {
+dts += max_duration;
+ret = mov_write_subtitle_end_packet(s, i, dts);
+if (ret < 0) return ret;
+}
+}
 }
 }
 
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 1/2] avfilter/vf_scale: split the scale_frame function from filter_frame for activate function support

2019-09-06 Thread Limin Wang
On Fri, Sep 06, 2019 at 08:08:48PM +0200, Michael Niedermayer wrote:
> On Sat, Jul 27, 2019 at 08:18:16PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_scale.c | 29 +
> >  1 file changed, 25 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index 7aebf56..efb480d 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -400,7 +400,7 @@ static int scale_slice(AVFilterLink *link, AVFrame 
> > *out_buf, AVFrame *cur_pic, s
> >   out,out_stride);
> >  }
> >  
> > -static int filter_frame(AVFilterLink *link, AVFrame *in)
> > +static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame 
> > **frame_out, int *got_frame)
> >  {
> >  ScaleContext *scale = link->dst->priv;
> >  AVFilterLink *outlink = link->dst->outputs[0];
> > @@ -409,6 +409,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
> >  char buf[32];
> >  int in_range;
> >  
> > +*got_frame = 0;
> >  if (in->colorspace == AVCOL_SPC_YCGCO)
> >  av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo 
> > colorspace.\n");
> >  
> > @@ -437,8 +438,11 @@ static int filter_frame(AVFilterLink *link, AVFrame 
> > *in)
> >  return ret;
> >  }
> >  
> > -if (!scale->sws)
> > -return ff_filter_frame(outlink, in);
> > +if (!scale->sws) {
> > +*got_frame = 1;
> > +*frame_out = in;
> > +return 0;
> > +}
> >  
> >  scale->hsub = desc->log2_chroma_w;
> >  scale->vsub = desc->log2_chroma_h;
> > @@ -448,6 +452,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
> >  av_frame_free();
> >  return AVERROR(ENOMEM);
> >  }
> > +*frame_out = out;
> >  
> >  av_frame_copy_props(out, in);
> >  out->width  = outlink->w;
> > @@ -521,7 +526,23 @@ static int filter_frame(AVFilterLink *link, AVFrame 
> > *in)
> >  }
> >  
> >  av_frame_free();
> > -return ff_filter_frame(outlink, out);
> > +*got_frame = 1;
> > +return 0;
> > +}
> > +
> > +static int filter_frame(AVFilterLink *link, AVFrame *in)
> > +{
> > +AVFilterContext *ctx = link->dst;
> > +AVFilterLink *outlink = ctx->outputs[0];
> > +int got_frame = 0;
> > +AVFrame *out;
> > +int ret;
> > +
> > +ret = scale_frame(link, in, , _frame);
> > +if (got_frame)
> > +return ff_filter_frame(outlink, out);
> 
> can this be simplified by using out != NULL instead of got_frame ?
> 
Yes, I'm just following the common video and audio decode style, they're
define got_frame_ptr always, I think it's more readiable and make code
less bugy. If you still prefer to remove got_frame, I can update the patch.


> thx
> 
> [...]
> 
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I know you won't believe me, but the highest form of Human Excellence is
> to question oneself and others. -- Socrates



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Add option to log timing

2019-09-06 Thread Soft Works
> From: ffmpeg-devel  On Behalf Of
> Michael Niedermayer
> Sent: Friday, September 6, 2019 8:56 PM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] Add option to log timing
> 
> On Wed, Sep 04, 2019 at 07:35:11PM +, Soft Works wrote:
> >
> > > Why this restriction? I think all log lines should be start with
> > > time/date if corresponding flag is present. This makes the log to be
> > > easy to parse by scripts.
> >
> > Initially I didn’t have this restriction, but it doesn’t work well together 
> > with
> some multi-line logging.
> > See below for an example.
> >
> > To get this nice, it would require a larger amount of changes, and probably
> result in something that nobody wants to merge in.
> >
> > Anyway, there’s a flag controlling this behavior and if you really want, you
> can set it.
> > Then you’ll see something like this:

[...]

> i just enabled prefixes for all calls, and i get this:
> 
> []   libavutil  56. 35.100 / 56. 35.100
> []   libavcodec 58. 56.101 / 58. 56.101

[...]

> 
> This looks much better than your example, so i have to disagree that theres a
> problem for calls during startup or some requirment of high complexity

I need to apologize. I had been driven by another complication that exists in 
my branch but not in the ffmpeg trunk.


I will submit an updated patch.

What would you prefer - should I:

1. Activate the flag for adding log timing  during startup by default
  (to allow opt-out behavior from the command line) or
2. Remove that flag and add log timing either all or nothing depending 
   On the other two flags?

Thanks,

softworkz

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/qdm2: Check frame size

2019-09-06 Thread Paul B Mahol
Are you sure this is not band aid but actually real fix?

On 8/29/19, Michael Niedermayer  wrote:
> Fixes: index 2304 out of bounds for type 'float [2304]'
> Fixes:
> 16332/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5679142481166336
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/qdm2.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
> index eaffb36dcc..ac8ae8cbbb 100644
> --- a/libavcodec/qdm2.c
> +++ b/libavcodec/qdm2.c
> @@ -1727,6 +1727,11 @@ static av_cold int qdm2_decode_init(AVCodecContext
> *avctx)
>  s->sub_sampling = s->fft_order - 7;
>  s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
>
> +if (s->frame_size * 4 >> s->sub_sampling > MPA_FRAME_SIZE) {
> +avpriv_request_sample(avctx, "large frames");
> +return AVERROR_PATCHWELCOME;
> +}
> +
>  switch ((s->sub_sampling * 2 + s->channels - 1)) {
>  case 0: tmp = 40; break;
>  case 1: tmp = 48; break;
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/qdm2: Check frame size

2019-09-06 Thread Michael Niedermayer
On Thu, Aug 29, 2019 at 09:46:32PM +0200, Michael Niedermayer wrote:
> Fixes: index 2304 out of bounds for type 'float [2304]'
> Fixes: 
> 16332/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5679142481166336
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/qdm2.c | 5 +
>  1 file changed, 5 insertions(+)

will apply

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 5/5] avformat/vividas: check for tiny blocks using alignment

2019-09-06 Thread Michael Niedermayer
On Sun, Sep 01, 2019 at 12:32:40AM +0200, Michael Niedermayer wrote:
> Ask for a sample for these
> Fixes: out of array access
> Fixes: 
> 16624/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5762455661182976
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/vividas.c | 4 
>  1 file changed, 4 insertions(+)

will apply

[...]
-- 
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
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/5] avcodec/vc1_pred: Fix refdist in scaleforopp()

2019-09-06 Thread Michael Niedermayer
On Sun, Sep 01, 2019 at 12:32:37AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 16601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5656105392275456
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vc1_pred.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] tests: Fix bash errors in lavf_container tests.

2019-09-06 Thread Andrey Semashev
Could someone take a look at this small fix, please? I'd like it to make 
it into 4.2.1.


On 2019-09-02 13:54, Andrey Semashev wrote:

Ping?

On 2019-08-28 18:32, Andrey Semashev wrote:

Because lavf_container is sometimes called with only 2 arguments,
fate tests produce bash errors like this:

   tests/fate-run.sh: 299: test: =: unexpected operator

This commit fixes this.
---
  tests/fate-run.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 2f1991da52..aec12c16a3 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -296,7 +296,7 @@ lavf_container(){
  outdir="tests/data/lavf"
  file=${outdir}/lavf.$t
  do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src 
$DEC_OPTS -ar 44100 -f s16le $1 -i $pcm_src "$ENC_OPTS -metadata 
title=lavftest" -b:a 64k -t 1 -qscale:v 10 $2

-    test $3 = "disable_crc" ||
+    test "$3" = "disable_crc" ||
  do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
  }





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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 2/3] avfilter/vf_showinfo: display GOP timecode side data

2019-09-06 Thread Michael Niedermayer
On Sun, Aug 25, 2019 at 12:17:59AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_showinfo.c | 6 ++
>  1 file changed, 6 insertions(+)

will apply

thx

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

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


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] swscale/output: fix some code indentations

2019-09-06 Thread Michael Niedermayer
On Thu, Sep 05, 2019 at 11:01:15AM +0800, Linjie Fu wrote:
> Signed-off-by: Linjie Fu 
> ---
>  libswscale/output.c | 70 
> ++---
>  1 file changed, 35 insertions(+), 35 deletions(-)

will apply

thx

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/vorbisdec: fix FASTDIV usage for vr_type == 2

2019-09-06 Thread Michael Niedermayer
On Fri, Sep 06, 2019 at 12:47:47PM +0200, Michael Niedermayer wrote:
> This reverts a hunk from f1ca40ee00402102046fc7e59606651930436b0e
> 
> Fixes: out of array read
> Fixes: 
> 16924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5157893162139648
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vorbisdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply this, so it will make it in for 4.2.1 

thx

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

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Add option to log timing

2019-09-06 Thread Michael Niedermayer
On Wed, Sep 04, 2019 at 07:35:11PM +, Soft Works wrote:
> 
> > Why this restriction? I think all log lines should be start with
> > time/date if corresponding flag is present. This makes the log to be
> > easy to parse by scripts.
> 
> Initially I didn’t have this restriction, but it doesn’t work well together 
> with some multi-line logging.
> See below for an example.
> 
> To get this nice, it would require a larger amount of changes, and probably 
> result in something that nobody wants to merge in.
> 
> Anyway, there’s a flag controlling this behavior and if you really want, you 
> can set it.
> Then you’ll see something like this:
> 
> 
> 18:59:04.449 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:xxx.mp4':
> 18:59:04.449   Metadata:
> major_brand : isom18:59:04.449
> minor_version   : 51218:59:04.449
> compatible_brands: isomiso2avc1mp4118:59:04.449
> encoder : Lavf58.12.10018:59:04.449
>   Duration: 00:20:52.72, start: 0.00, bitrate: 1386 kb/s18:59:04.449
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 640x360 [SAR 1:1 DAR 16:9], 612 kb/s, Level 30, 25 fps, 25 tbr, 12800 tbn, 50 
> tbc (default)18:59:04.449
> 18:59:04.449 Metadata:
>   handler_name: VideoHandler18:59:04.449
> Stream #0:1(ger): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, 
> fltp, 381 kb/s (default)18:59:04.449
> 18:59:04.449 Metadata:
>   handler_name: SoundHandler18:59:04.449
> Stream #0:2(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, 
> fltp, 382 kb/s18:59:04.449
> 18:59:04.449 Metadata:
>   handler_name: SoundHandler18:59:04.449
> 18:59:04.737 Stream mapping:
>   Stream #0:0 (h264_cuvid) -> scale_cuda (graph 0)18:59:04.737
>   scale_cuda (graph 0)18:59:04.737  -> Stream #0:0 (h264_nvenc)
>   Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))18:59:04.737

i just enabled prefixes for all calls, and i get this:

[]   libavutil  56. 35.100 / 56. 35.100
[]   libavcodec 58. 56.101 / 58. 56.101
[]   libavformat58. 32.104 / 58. 32.104
[]   libavdevice58.  9.100 / 58.  9.100
[]   libavfilter 7. 58.102 /  7. 58.102
[]   libswscale  5.  6.100 /  5.  6.100
[]   libswresample   3.  6.100 /  3.  6.100
[]   libpostproc55.  6.100 / 55.  6.100
[mpeg @ 0x3334f80] start time for stream 0 is not set in 
estimate_timings_from_pts
[] Input #0, mpeg, from 'matrixbench_mpeg2.mpg':
[]   Duration: 00:03:07.66, start: 0.22, bitrate: 5633 kb/s
[] Stream #0:0[0x1bf]: Data: dvd_nav_packet
[] Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, 
bt470bg/bt470m/bt470m, bottom first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 
tbr, 90k tbn, 50 tbc
[] Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
File 'test.avi' already exists. Overwrite ? [y/N] [] y
Stream mapping:
[]   Stream #0:1 -> #0:0 (mpeg2video (native) -> mpeg4 (native))
[]   Stream #0:2 -> #0:1 (mp2 (native) -> mp3 (libmp3lame))
[] Press [q] to stop, [?] for help
[] Output #0, avi, to 'test.avi':
[]   Metadata:
[] ISFT: Lavf58.32.104
[] Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x576 [SAR 
16:15 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
[] Metadata:
[]   encoder : Lavc58.56.101 mpeg4
[] Side data:
[]   cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
[] Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, 
stereo, s16p
[] Metadata:
[]   encoder : Lavc58.56.101 libmp3lame
[] frame= 1069 fps=710 q=24.8 Lsize=2255kB time=00:00:42.76 bitrate= 
432.0kbits/s speed=28.4x
[] video:1511kB audio:667kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: 3.539204%

This looks much better than your example, so i have to disagree that
theres a problem for calls during startup or some requirment of high 
complexity

diff --git a/libavutil/log.c b/libavutil/log.c
index 93a156b8e4..5109c773bd 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -266,7 +266,9 @@ static void format_line(void *avcl, int level, const char 
*fmt, va_list vl,
 av_bprintf(part+1, "[%s @ %p] ",
  avc->item_name(avcl), avcl);
 if(type) type[1] = get_category(avcl);
-}
+} else if (*print_prefix)
+av_bprintf(part+1, "[] ");
+
 
 if (*print_prefix && (level > AV_LOG_QUIET) && (flags & 
AV_LOG_PRINT_LEVEL))
 av_bprintf(part+2, "[%s] ", get_level_str(level));

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 1/2] avfilter/vf_scale: split the scale_frame function from filter_frame for activate function support

2019-09-06 Thread Michael Niedermayer
On Sat, Jul 27, 2019 at 08:18:16PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_scale.c | 29 +
>  1 file changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 7aebf56..efb480d 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -400,7 +400,7 @@ static int scale_slice(AVFilterLink *link, AVFrame 
> *out_buf, AVFrame *cur_pic, s
>   out,out_stride);
>  }
>  
> -static int filter_frame(AVFilterLink *link, AVFrame *in)
> +static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out, 
> int *got_frame)
>  {
>  ScaleContext *scale = link->dst->priv;
>  AVFilterLink *outlink = link->dst->outputs[0];
> @@ -409,6 +409,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  char buf[32];
>  int in_range;
>  
> +*got_frame = 0;
>  if (in->colorspace == AVCOL_SPC_YCGCO)
>  av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo 
> colorspace.\n");
>  
> @@ -437,8 +438,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  return ret;
>  }
>  
> -if (!scale->sws)
> -return ff_filter_frame(outlink, in);
> +if (!scale->sws) {
> +*got_frame = 1;
> +*frame_out = in;
> +return 0;
> +}
>  
>  scale->hsub = desc->log2_chroma_w;
>  scale->vsub = desc->log2_chroma_h;
> @@ -448,6 +452,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  av_frame_free();
>  return AVERROR(ENOMEM);
>  }
> +*frame_out = out;
>  
>  av_frame_copy_props(out, in);
>  out->width  = outlink->w;
> @@ -521,7 +526,23 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  }
>  
>  av_frame_free();
> -return ff_filter_frame(outlink, out);
> +*got_frame = 1;
> +return 0;
> +}
> +
> +static int filter_frame(AVFilterLink *link, AVFrame *in)
> +{
> +AVFilterContext *ctx = link->dst;
> +AVFilterLink *outlink = ctx->outputs[0];
> +int got_frame = 0;
> +AVFrame *out;
> +int ret;
> +
> +ret = scale_frame(link, in, , _frame);
> +if (got_frame)
> +return ff_filter_frame(outlink, out);

can this be simplified by using out != NULL instead of got_frame ?

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/webp: avoid trying to decode trailing junk in bitstreams

2019-09-06 Thread Michael Niedermayer
On Fri, Sep 06, 2019 at 01:11:50PM +0200, Pascal Massimino wrote:
> Michael,
> 
> On Thu, Sep 5, 2019 at 6:20 PM Michael Niedermayer 
> wrote:
> 
> > On Wed, Sep 04, 2019 at 07:43:15AM +0200, Pascal Massimino wrote:
[...]

> >
> > i would guess its not a known chunk but rather hits the default
> > is that just a bunch of 0 or 0xFF bytes ?
> > detecting before we read into the end feels more robust if
> > we can simply detect the "junk"
> >
> 
> As i mentioned in the description, a possibly more robust solution would be
> just stopping the loop as soon as 'chunk_size' bytes have been consumed
> (leading to *got_frame = 1) and no more. This current patch is minimalist,
> though.

well, which solution do you prefer ?

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] x86/vf_v360: use a faster horizontal add in remap4_8bit_line_avx2

2019-09-06 Thread James Almer
On 9/6/2019 12:40 PM, Paul B Mahol wrote:
> LGTM
> 
> On 9/6/19, James Almer  wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavfilter/x86/vf_v360.asm | 11 ---
>>  1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
>> index f49702b603..a0936eb6dc 100644
>> --- a/libavfilter/x86/vf_v360.asm
>> +++ b/libavfilter/x86/vf_v360.asm
>> @@ -130,14 +130,11 @@ cglobal remap4_8bit_line, 7, 9, 11, dst, width, src,
>> in_linesize, u, v, ker, x,
>>  pmulld  m4, m5
>>
>>  paddd   m2, m4
>> -vextracti128   xm1, m2, 1
>> -paddd   m1, m2
>> -phaddd  m1, m1
>> -phaddd  m1, m1
>> -psrld   m1, m1, 0xe
>> -packuswbm1, m1
>> +HADDD   m2, m1
>> +psrld   m2, m2, 0xe
>> +packuswbm2, m2
>>
>> -pextrb   [dstq+xq], xm1, 0
>> +pextrb   [dstq+xq], xm2, 0
>>
>>  add   xq, 1
>>  add   yq, 32

Pushed, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 5/5] avcodec/v210enc: define DEFINE_V210_ENCODE_FUNC to remove duplicate code

2019-09-06 Thread Limin Wang
On Fri, Aug 30, 2019 at 08:11:17PM +0200, Michael Niedermayer wrote:
> On Wed, Aug 28, 2019 at 11:45:16PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavcodec/v210enc.c | 171 
> > +--
> >  1 file changed, 69 insertions(+), 102 deletions(-)
> > 
> > diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
> > index 2400538..b40c7ae 100644
> > --- a/libavcodec/v210enc.c
> > +++ b/libavcodec/v210enc.c
> > @@ -89,15 +89,77 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >  return 0;
> >  }
> >  
> > +#define DEFINE_V210_ENCODE_FUNC(nbits, depth)  
> >\
> > +static void v210_enc_##depth(AVCodecContext *avctx,
> >\
> > +uint8_t *dst, const AVFrame *pic)  
> >\
> 
> puting this in a seperate file which is included twice would avoid
> the rather large mutiline macro
> also that would match how such functions for multiple depths are
> handled in other codecs

Michael, I have updated the patch with template file to replace macro in the 
thread,
please help to review them. I plan to add multithread function if it's OK to 
apply.

> 
> thx
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> The smallest minority on earth is the individual. Those who deny 
> individual rights cannot claim to be defenders of minorities. - Ayn Rand



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] x86/vf_v360: use a faster horizontal add in remap4_8bit_line_avx2

2019-09-06 Thread Paul B Mahol
LGTM

On 9/6/19, James Almer  wrote:
> Signed-off-by: James Almer 
> ---
>  libavfilter/x86/vf_v360.asm | 11 ---
>  1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
> index f49702b603..a0936eb6dc 100644
> --- a/libavfilter/x86/vf_v360.asm
> +++ b/libavfilter/x86/vf_v360.asm
> @@ -130,14 +130,11 @@ cglobal remap4_8bit_line, 7, 9, 11, dst, width, src,
> in_linesize, u, v, ker, x,
>  pmulld  m4, m5
>
>  paddd   m2, m4
> -vextracti128   xm1, m2, 1
> -paddd   m1, m2
> -phaddd  m1, m1
> -phaddd  m1, m1
> -psrld   m1, m1, 0xe
> -packuswbm1, m1
> +HADDD   m2, m1
> +psrld   m2, m2, 0xe
> +packuswbm2, m2
>
> -pextrb   [dstq+xq], xm1, 0
> +pextrb   [dstq+xq], xm2, 0
>
>  add   xq, 1
>  add   yq, 32
> --
> 2.22.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] x86/vf_v360: make remap{1, 2}_8bit_line_avx2 work on x86_32

2019-09-06 Thread Paul B Mahol
OK if tested.

On 9/6/19, James Almer  wrote:
> Signed-off-by: James Almer 
> ---
>  libavfilter/vf_v360.c  |  2 +-
>  libavfilter/x86/vf_v360.asm| 11 +--
>  libavfilter/x86/vf_v360_init.c |  2 +-
>  3 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
> index ed00dd09b4..c90f16bfa7 100644
> --- a/libavfilter/vf_v360.c
> +++ b/libavfilter/vf_v360.c
> @@ -285,7 +285,7 @@ void ff_v360_init(V360Context *s, int depth)
>  break;
>  }
>
> -if (ARCH_X86_64)
> +if (ARCH_X86)
>  ff_v360_init_x86(s, depth);
>  }
>
> diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
> index c8b5aa7e2e..f49702b603 100644
> --- a/libavfilter/x86/vf_v360.asm
> +++ b/libavfilter/x86/vf_v360.asm
> @@ -18,10 +18,11 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> ;**
>
> -%if HAVE_AVX2_EXTERNAL && ARCH_X86_64
>
>  %include "libavutil/x86/x86util.asm"
>
> +%if HAVE_AVX2_EXTERNAL
> +
>  SECTION_RODATA
>
>  pb_mask: db 0,4,8,12,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
> @@ -62,8 +63,11 @@ cglobal remap1_8bit_line, 6, 7, 6, dst, width, src,
> in_linesize, u, v, x
>  INIT_YMM avx2
>  cglobal remap2_8bit_line, 7, 8, 8, dst, width, src, in_linesize, u, v, ker,
> x
>  movsxdifnidn widthq, widthd
> -xor xq, xq
>  movd   xm0, in_linesized
> +%if ARCH_X86_32
> +DEFINE_ARGS dst, width, src, x, u, v, ker
> +%endif
> +xor xq, xq
>  pcmpeqw m7, m7
>  vpbroadcastdm0, xm0
>  vpbroadcastdm6, [pd_255]
> @@ -92,6 +96,8 @@ cglobal remap2_8bit_line, 7, 8, 8, dst, width, src,
> in_linesize, u, v, ker, x
>  jl .loop
>  RET
>
> +%if ARCH_X86_64
> +
>  INIT_YMM avx2
>  cglobal remap4_8bit_line, 7, 9, 11, dst, width, src, in_linesize, u, v,
> ker, x, y
>  movsxdifnidn widthq, widthd
> @@ -140,3 +146,4 @@ cglobal remap4_8bit_line, 7, 9, 11, dst, width, src,
> in_linesize, u, v, ker, x,
>  RET
>
>  %endif
> +%endif
> diff --git a/libavfilter/x86/vf_v360_init.c b/libavfilter/x86/vf_v360_init.c
> index 5dfd0d1a42..8c1a10c705 100644
> --- a/libavfilter/x86/vf_v360_init.c
> +++ b/libavfilter/x86/vf_v360_init.c
> @@ -34,7 +34,6 @@ void ff_remap4_8bit_line_avx2(uint8_t *dst, int width,
> const uint8_t *src, ptrdi
>
>  av_cold void ff_v360_init_x86(V360Context *s, int depth)
>  {
> -#if ARCH_X86_64
>  int cpu_flags = av_get_cpu_flags();
>
>  if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == NEAREST && depth <=
> 8)
> @@ -43,6 +42,7 @@ av_cold void ff_v360_init_x86(V360Context *s, int depth)
>  if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == BILINEAR && depth <=
> 8)
>  s->remap_line = ff_remap2_8bit_line_avx2;
>
> +#if ARCH_X86_64
>  if (EXTERNAL_AVX2_FAST(cpu_flags) && (s->interp == BICUBIC ||
>s->interp == LANCZOS) && depth <=
> 8)
>  s->remap_line = ff_remap4_8bit_line_avx2;
> --
> 2.22.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] x86/vf_v360: use a faster horizontal add in remap4_8bit_line_avx2

2019-09-06 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/x86/vf_v360.asm | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
index f49702b603..a0936eb6dc 100644
--- a/libavfilter/x86/vf_v360.asm
+++ b/libavfilter/x86/vf_v360.asm
@@ -130,14 +130,11 @@ cglobal remap4_8bit_line, 7, 9, 11, dst, width, src, 
in_linesize, u, v, ker, x,
 pmulld  m4, m5
 
 paddd   m2, m4
-vextracti128   xm1, m2, 1
-paddd   m1, m2
-phaddd  m1, m1
-phaddd  m1, m1
-psrld   m1, m1, 0xe
-packuswbm1, m1
+HADDD   m2, m1
+psrld   m2, m2, 0xe
+packuswbm2, m2
 
-pextrb   [dstq+xq], xm1, 0
+pextrb   [dstq+xq], xm2, 0
 
 add   xq, 1
 add   yq, 32
-- 
2.22.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] x86/vf_v360: make remap{1, 2}_8bit_line_avx2 work on x86_32

2019-09-06 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/vf_v360.c  |  2 +-
 libavfilter/x86/vf_v360.asm| 11 +--
 libavfilter/x86/vf_v360_init.c |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index ed00dd09b4..c90f16bfa7 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -285,7 +285,7 @@ void ff_v360_init(V360Context *s, int depth)
 break;
 }
 
-if (ARCH_X86_64)
+if (ARCH_X86)
 ff_v360_init_x86(s, depth);
 }
 
diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
index c8b5aa7e2e..f49702b603 100644
--- a/libavfilter/x86/vf_v360.asm
+++ b/libavfilter/x86/vf_v360.asm
@@ -18,10 +18,11 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**
 
-%if HAVE_AVX2_EXTERNAL && ARCH_X86_64
 
 %include "libavutil/x86/x86util.asm"
 
+%if HAVE_AVX2_EXTERNAL
+
 SECTION_RODATA
 
 pb_mask: db 0,4,8,12,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
@@ -62,8 +63,11 @@ cglobal remap1_8bit_line, 6, 7, 6, dst, width, src, 
in_linesize, u, v, x
 INIT_YMM avx2
 cglobal remap2_8bit_line, 7, 8, 8, dst, width, src, in_linesize, u, v, ker, x
 movsxdifnidn widthq, widthd
-xor xq, xq
 movd   xm0, in_linesized
+%if ARCH_X86_32
+DEFINE_ARGS dst, width, src, x, u, v, ker
+%endif
+xor xq, xq
 pcmpeqw m7, m7
 vpbroadcastdm0, xm0
 vpbroadcastdm6, [pd_255]
@@ -92,6 +96,8 @@ cglobal remap2_8bit_line, 7, 8, 8, dst, width, src, 
in_linesize, u, v, ker, x
 jl .loop
 RET
 
+%if ARCH_X86_64
+
 INIT_YMM avx2
 cglobal remap4_8bit_line, 7, 9, 11, dst, width, src, in_linesize, u, v, ker, 
x, y
 movsxdifnidn widthq, widthd
@@ -140,3 +146,4 @@ cglobal remap4_8bit_line, 7, 9, 11, dst, width, src, 
in_linesize, u, v, ker, x,
 RET
 
 %endif
+%endif
diff --git a/libavfilter/x86/vf_v360_init.c b/libavfilter/x86/vf_v360_init.c
index 5dfd0d1a42..8c1a10c705 100644
--- a/libavfilter/x86/vf_v360_init.c
+++ b/libavfilter/x86/vf_v360_init.c
@@ -34,7 +34,6 @@ void ff_remap4_8bit_line_avx2(uint8_t *dst, int width, const 
uint8_t *src, ptrdi
 
 av_cold void ff_v360_init_x86(V360Context *s, int depth)
 {
-#if ARCH_X86_64
 int cpu_flags = av_get_cpu_flags();
 
 if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == NEAREST && depth <= 8)
@@ -43,6 +42,7 @@ av_cold void ff_v360_init_x86(V360Context *s, int depth)
 if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == BILINEAR && depth <= 8)
 s->remap_line = ff_remap2_8bit_line_avx2;
 
+#if ARCH_X86_64
 if (EXTERNAL_AVX2_FAST(cpu_flags) && (s->interp == BICUBIC ||
   s->interp == LANCZOS) && depth <= 8)
 s->remap_line = ff_remap4_8bit_line_avx2;
-- 
2.22.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 1/2] avcodec/v210dec: removed the duplicated 'if' condition

2019-09-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/v210dec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 5a33d8c..6ce18aa 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -98,8 +98,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 return AVERROR_INVALIDDATA;
 }
 }
-if (   avctx->codec_tag == MKTAG('C', '2', '1', '0')
-&& avpkt->size > 64
+if (avctx->codec_tag == MKTAG('C', '2', '1', '0')
 && AV_RN32(psrc) == AV_RN32("INFO")
 && avpkt->size - 64 >= stride * avctx->height)
 psrc += 64;
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 2/2] avcodec/v210dec: add the frame and slice threading support

2019-09-06 Thread lance . lmwang
From: Limin Wang 

The multithread is avoid one core cpu is full with other filter like scale etc.
About the performance, the gain is very small, below is my testing for
performance.
In order to avoid the disk bottleneck, I'll use stream_loop mode for 10 frame
only.

./ffmpeg -y -i ~/Movies/4k_Rec709_ProResHQ.mov -c:v v210 -f rawvideo -frames 10
~/Movies/1.v210

master:
./ffmpeg -threads 1 -s 4096x3072 -stream_loop 100 -i ~/Movies/1.v210 -benchmark
-f null -
frame= 1010 fps= 42 q=-0.0 Lsize=N/A time=00:00:40.40 bitrate=N/A speed=1.69x
video:529kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: unknown
bench: utime=10.082s stime=13.784s rtime=23.889s
bench: maxrss=147836928kB

patch applied:
./ffmpeg -threads 4 -thread_type frame+slice  -s 4096x3072 -stream_loop 100 -i
~/Movies/1.v210 -benchmark -f null -

frame= 1010 fps= 55 q=-0.0 Lsize=N/A time=00:00:40.40 bitrate=N/A speed=2.22x
video:529kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: unknown
bench: utime=11.407s stime=17.258s rtime=18.279s
bench: maxrss=442884096kB

Signed-off-by: Limin Wang 
---
 libavcodec/v210dec.c | 135 +--
 libavcodec/v210dec.h |   1 +
 2 files changed, 88 insertions(+), 48 deletions(-)

diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 6ce18aa..2cdb99e 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -28,6 +28,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/mem.h"
 #include "libavutil/intreadwrite.h"
+#include "thread.h"
 
 #define READ_PIXELS(a, b, c) \
 do { \
@@ -37,6 +38,13 @@
 *c++ = (val >> 20) & 0x3FF;  \
 } while (0)
 
+#define MAX_SLICES 32
+typedef struct ThreadData {
+AVFrame *frame;
+uint8_t *buf;
+int stride;
+} ThreadData;
+
 static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t 
*u, uint16_t *v, int width)
 {
 uint32_t val;
@@ -67,58 +75,32 @@ static av_cold int decode_init(AVCodecContext *avctx)
 s->aligned_input = 0;
 ff_v210dec_init(s);
 
+s->slice_count = av_clip(avctx->thread_count, 1, MAX_SLICES);
 return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-AVPacket *avpkt)
+static int v210_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int 
nb_jobs)
 {
 V210DecContext *s = avctx->priv_data;
-
-int h, w, ret, stride, aligned_input;
-AVFrame *pic = data;
-const uint8_t *psrc = avpkt->data;
+int h, w;
+ThreadData *td = arg;
+AVFrame *frame = td->frame;
+int stride = td->stride;
+int slice_h = avctx->height / s->slice_count;
+int slice_m = avctx->height % s->slice_count;
+int slice_start = jobnr * slice_h;
+int slice_end = slice_start + slice_h;
+const uint8_t *psrc = td->buf + stride * slice_start;
 uint16_t *y, *u, *v;
 
-if (s->custom_stride )
-stride = s->custom_stride;
-else {
-int aligned_width = ((avctx->width + 47) / 48) * 48;
-stride = aligned_width * 8 / 3;
-}
-
-if (avpkt->size < stride * avctx->height) {
-if avctx->width + 23) / 24) * 24 * 8) / 3 * avctx->height == 
avpkt->size) {
-stride = avpkt->size / avctx->height;
-if (!s->stride_warning_shown)
-av_log(avctx, AV_LOG_WARNING, "Broken v210 with too small 
padding (64 byte) detected\n");
-s->stride_warning_shown = 1;
-} else {
-av_log(avctx, AV_LOG_ERROR, "packet too small\n");
-return AVERROR_INVALIDDATA;
-}
-}
-if (avctx->codec_tag == MKTAG('C', '2', '1', '0')
-&& AV_RN32(psrc) == AV_RN32("INFO")
-&& avpkt->size - 64 >= stride * avctx->height)
-psrc += 64;
-
-aligned_input = !((uintptr_t)psrc & 0x1f) && !(stride & 0x1f);
-if (aligned_input != s->aligned_input) {
-s->aligned_input = aligned_input;
-ff_v210dec_init(s);
-}
-
-if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
-return ret;
-
-y = (uint16_t*)pic->data[0];
-u = (uint16_t*)pic->data[1];
-v = (uint16_t*)pic->data[2];
-pic->pict_type = AV_PICTURE_TYPE_I;
-pic->key_frame = 1;
+/* add the remaining slice for the last job */
+if (jobnr == s->slice_count - 1)
+slice_end += slice_m;
 
-for (h = 0; h < avctx->height; h++) {
+y = (uint16_t*)frame->data[0] + slice_start * frame->linesize[0] / 2;
+u = (uint16_t*)frame->data[1] + slice_start * frame->linesize[1] / 2;
+v = (uint16_t*)frame->data[2] + slice_start * frame->linesize[2] / 2;
+for (h = slice_start; h < slice_end; h++) {
 const uint32_t *src = (const uint32_t*)psrc;
 uint32_t val;
 
@@ -154,10 +136,63 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 }
 
 psrc += stride;
-y += pic->linesize[0] / 2 - avctx->width + (avctx->width & 1);
-   

Re: [FFmpeg-devel] [PATCH v1 1/2] avfilter/vf_scale: split the scale_frame function from filter_frame for activate function support

2019-09-06 Thread Limin Wang
On Wed, Sep 04, 2019 at 12:07:32AM +0200, Michael Niedermayer wrote:
> On Sat, Jul 27, 2019 at 08:18:16PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_scale.c | 29 +
> >  1 file changed, 25 insertions(+), 4 deletions(-)
> 
> LGTM
> 
ping, please help to merge it.


> thx
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> If you fake or manipulate statistics in a paper in physics you will never
> get a job again.
> If you fake or manipulate statistics in a paper in medicin you will get
> a job for life at the pharma industry.



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 2/3] avfilter/vf_showinfo: display GOP timecode side data

2019-09-06 Thread Limin Wang

ping, please review and help to merge it, thanks.


On Sun, Aug 25, 2019 at 12:17:59AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_showinfo.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 3c13f11..31f6b32 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -313,6 +313,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL:
>  dump_content_light_metadata(ctx, sd);
>  break;
> +case AV_FRAME_DATA_GOP_TIMECODE: {
> +char tcbuf[AV_TIMECODE_STR_SIZE];
> +av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
> +av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
> +break;
> +}
>  default:
>  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> bytes)",
> sd->type, sd->size);
> -- 
> 2.9.5
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] avcodec/mediacodecdec_common: do not split input packets into multiple buffers in ff_mediacodec_dec_send()

2019-09-06 Thread Matthieu Bouron
MediaCodec expects exactly one incoming buffer with a given PTS, it is
not valid to split data for a given PTS across multiple input buffers.

See 
https://developer.android.com/reference/android/media/MediaCodec#data-processing

  > Do not submit multiple input buffers with the same timestamp
---
 libavcodec/mediacodecdec_common.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index 6c0a1212c1..74fa29cc7d 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -566,7 +566,6 @@ fail:
 int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
AVPacket *pkt, bool wait)
 {
-int offset = 0;
 int need_draining = pkt->size == 0;
 uint8_t *data;
 ssize_t index = s->current_input_buffer;
@@ -586,12 +585,15 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 return AVERROR_EOF;
 }
 
-while (offset < pkt->size || (need_draining && !s->draining)) {
+if (s->draining) {
+return 0;
+}
+
 if (index < 0) {
 index = ff_AMediaCodec_dequeueInputBuffer(codec, 
input_dequeue_timeout_us);
 if (ff_AMediaCodec_infoTryAgainLater(codec, index)) {
 av_log(avctx, AV_LOG_TRACE, "No input buffer available, try 
again later\n");
-break;
+return AVERROR(EAGAIN);
 }
 
 if (index < 0) {
@@ -630,9 +632,8 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 return 0;
 }
 
-size = FFMIN(pkt->size - offset, size);
-memcpy(data, pkt->data + offset, size);
-offset += size;
+size = FFMIN(pkt->size, size);
+memcpy(data, pkt->data, size);
 
 status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 
0);
 if (status < 0) {
@@ -642,11 +643,8 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 
 av_log(avctx, AV_LOG_TRACE,
"Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, size, 
pts);
-}
 
-if (offset == 0)
-return AVERROR(EAGAIN);
-return offset;
+return size;
 }
 
 int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s,
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] avcodec/mediacodecdec_common: simplify ff_mediacodec_dec_send()

2019-09-06 Thread Matthieu Bouron
---
 libavcodec/mediacodecdec_common.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index 1656cd6664..6c0a1212c1 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -567,7 +567,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
AVPacket *pkt, bool wait)
 {
 int offset = 0;
-int need_draining = 0;
+int need_draining = pkt->size == 0;
 uint8_t *data;
 ssize_t index = s->current_input_buffer;
 size_t size;
@@ -582,10 +582,6 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 return AVERROR_EXTERNAL;
 }
 
-if (pkt->size == 0) {
-need_draining = 1;
-}
-
 if (s->draining && s->eos) {
 return AVERROR_EOF;
 }
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/webp: avoid trying to decode trailing junk in bitstreams

2019-09-06 Thread Pascal Massimino
Michael,

On Thu, Sep 5, 2019 at 6:20 PM Michael Niedermayer 
wrote:

> On Wed, Sep 04, 2019 at 07:43:15AM +0200, Pascal Massimino wrote:
> > Hi,
> >
> > this patch break the decoding loop when invalid webp chunk is
> encountered.
> > We can still have a valid frame ready to be returned (*got_frame = 1).
> >
>
> > fixes trac #8107 (/#7612)
>
> These bug references should be in the commit message
>

done, new patch attached.


>
>
> >
> > skal/
>
> >  webp.c |7 +--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 2d80b062adade6044f64a00838b55f9427cc1f73
> 0001-webp-fix-decoding-for-trailing-junk.patch
> > From 9edff4f9812fad7f605bdc12954f82a8745a25ee Mon Sep 17 00:00:00 2001
> > From: Pascal Massimino 
> > Date: Wed, 28 Aug 2019 09:41:42 +0200
> > Subject: [PATCH] webp: fix decoding for trailing junk
> >
> > some bitstream have trailing junk, despite being valid webp data.
> > In case of apparent error, abort the loop and let *got_frame
> > decide whether this is an error or not.
> > Another possibility would be turning the loop into:
> > while (!*got_frame) {...}
>
> what is that trailing junk ?
>

As mentioned in the trac description, one frequent source of such junk
is padding of encrypted packets (or, just, left-overs).


>
> i would guess its not a known chunk but rather hits the default
> is that just a bunch of 0 or 0xFF bytes ?
> detecting before we read into the end feels more robust if
> we can simply detect the "junk"
>

As i mentioned in the description, a possibly more robust solution would be
just stopping the loop as soon as 'chunk_size' bytes have been consumed
(leading to *got_frame = 1) and no more. This current patch is minimalist,
though.

skal/





>
> thanks
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
From 5c3a8878cce7e2920c39e58a0b57872d8c96b511 Mon Sep 17 00:00:00 2001
From: Pascal Massimino 
Date: Wed, 28 Aug 2019 09:41:42 +0200
Subject: [PATCH] avcodec/webp: fix decoding for trailing junk

some bitstream have trailing junk, despite being valid webp data.
In case of apparent error, abort the loop and let *got_frame
decide whether this is an error or not.

fixes trac #8107 (/#7612)

Another possibility would be turning the loop into:
while (!*got_frame) {...}
---
 libavcodec/webp.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 077bb06f85..c6d0206846 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1412,8 +1412,11 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 return AVERROR_INVALIDDATA;
 chunk_size += chunk_size & 1;
 
-if (bytestream2_get_bytes_left() < chunk_size)
-return AVERROR_INVALIDDATA;
+if (bytestream2_get_bytes_left() < chunk_size) {
+   /* we seem to be running out of data, but it could also be that the
+  bitstream has trailing junk leading to bogus chunk_size. */
+break;
+}
 
 switch (chunk_type) {
 case MKTAG('V', 'P', '8', ' '):
-- 
2.23.0.187.g17f5b7556c-goog

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/filters: correct range for contrast in eq filter

2019-09-06 Thread Sourabh Sharma
Thank you

On Fri, 6 Sep 2019, 2:11 pm Gyan,  wrote:

>
>
> On 06-09-2019 01:23 PM, Gyan wrote:
> >
> >
> > On 06-09-2019 08:28 AM, Sourabh Sharma wrote:
> >> ---
> >>   doc/filters.texi | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/doc/filters.texi b/doc/filters.texi
> >> index 6c81e1da40..70ea16954f 100644
> >> --- a/doc/filters.texi
> >> +++ b/doc/filters.texi
> >> @@ -9538,7 +9538,7 @@ The filter accepts the following options:
> >>   @table @option
> >>   @item contrast
> >>   Set the contrast expression. The value must be a float value in range
> >> -@code{-2.0} to @code{2.0}. The default value is "1".
> >> +@code{-1000.0} to @code{1000.0}. The default value is "1".
> >>
> >>   @item brightness
> >>   Set the brightness expression. The value must be a float value in
> >> --
> >> 2.11.0
> >
> > Should reference the ticket as well. Will make that change and push.
>
> Pushed as 3424600e0b19417ebad6da8b28e57e11290abbe7
>
> Gyan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/4] avcodec/alac: Fix invalid shifts in 20/24 bps

2019-09-06 Thread Michael Niedermayer
Fixes: left shift of negative value -256
Fixes: 
16892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-4880802642395136

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

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index c606f2af0e..fbe427595e 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -397,13 +397,13 @@ static int decode_element(AVCodecContext *avctx, AVFrame 
*frame, int ch_index,
 case 20: {
 for (ch = 0; ch < channels; ch++) {
 for (i = 0; i < alac->nb_samples; i++)
-alac->output_samples_buffer[ch][i] <<= 12;
+alac->output_samples_buffer[ch][i] *= 1 << 12;
 }}
 break;
 case 24: {
 for (ch = 0; ch < channels; ch++) {
 for (i = 0; i < alac->nb_samples; i++)
-alac->output_samples_buffer[ch][i] <<= 8;
+alac->output_samples_buffer[ch][i] *= 1 << 8;
 }}
 break;
 }
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 4/4] avcodec/vorbisdec: fix FASTDIV usage for vr_type == 2

2019-09-06 Thread Michael Niedermayer
This reverts a hunk from f1ca40ee00402102046fc7e59606651930436b0e

Fixes: out of array read
Fixes: 
16924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5157893162139648

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vorbisdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 104dc86a13..be6d1b2d21 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1513,7 +1513,7 @@ static av_always_inline int 
vorbis_residue_decode_internal(vorbis_context *vc,
 }
 
 } else if (vr_type == 2) {
-unsigned voffs_div = FASTDIV(voffset << 1, ch 
<<1);
+unsigned voffs_div = ch == 1 ? voffset : 
FASTDIV(voffset, ch);
 unsigned voffs_mod = voffset - voffs_div * ch;
 
 for (k = 0; k < step; ++k) {
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/4] avcodec/smacker: Fix integer overflow in signed int multiply in SMK_BLK_FILL

2019-09-06 Thread Michael Niedermayer
Fixes: signed integer overflow: 238 * 16843009 cannot be represented in type 
'int'
Fixes: 
16958/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5193905355620352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/smacker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index c45137b7d5..a2950c455b 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -543,7 +543,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 while(run-- && blk < blocks){
 uint32_t col;
 out = smk->pic->data[0] + (blk / bw) * (stride * 4) + (blk % 
bw) * 4;
-col = mode * 0x01010101;
+col = mode * 0x01010101U;
 for(i = 0; i < 4; i++) {
 *((uint32_t*)out) = col;
 out += stride;
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/4] avcodec/alac: fix undefined behavior with INT_MIN in lpc_prediction()

2019-09-06 Thread Michael Niedermayer
Fixes: signed integer overflow: -2147483648 * -1 cannot be represented in type 
'int'
Fixes: 
16786/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5632818851348480

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/alac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 782d461b22..c606f2af0e 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -222,7 +222,7 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t 
*buffer_out,
 /* adapt LPC coefficients */
 error_sign = sign_only(error_val);
 if (error_sign) {
-for (j = 0; j < lpc_order && (int)error_val * error_sign > 0; j++) 
{
+for (j = 0; j < lpc_order && (int)(error_val * error_sign) > 0; 
j++) {
 int sign;
 val  = d - pred[j];
 sign = sign_only(val) * error_sign;
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/mediacodec_surface: define and use FFANativeWindow to mimic NDK interface

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 04:07:20PM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> This will make it easy to switch to ANativeWindow_fromSurface
> and ANativeWindow_release in the future.
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodec_surface.c | 11 ---
>  libavcodec/mediacodec_surface.h |  7 +--
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/mediacodec_surface.c b/libavcodec/mediacodec_surface.c
> index efcc4dc63c..a292386e34 100644
> --- a/libavcodec/mediacodec_surface.c
> +++ b/libavcodec/mediacodec_surface.c
> @@ -25,10 +25,9 @@
>  #include "ffjni.h"
>  #include "mediacodec_surface.h"
>  
> -void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
> +FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
>  {
>  JNIEnv *env = NULL;
> -void *reference = NULL;
>  
>  if (!surface)
>  return NULL;
> @@ -38,12 +37,10 @@ void *ff_mediacodec_surface_ref(void *surface, void 
> *log_ctx)
>  return NULL;
>  }
>  
> -reference = (*env)->NewGlobalRef(env, surface);
> -
> -return reference;
> +return (*env)->NewGlobalRef(env, surface);

This should be done in a separate commit.

[...]

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] swscale: Add swscale input support for Y210

2019-09-06 Thread Linjie Fu
Make it possible to convert Y210 to other pixel format.

Also add query support in fate.

Signed-off-by: Linjie Fu 
---
 libswscale/input.c   | 47 
 libswscale/utils.c   |  2 ++
 tests/ref/fate/sws-pixdesc-query |  7 ++
 3 files changed, 56 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 064f8da..e05ee2c 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -552,6 +552,41 @@ static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const 
uint8_t *unused0, con
 av_assert1(src1 == src2);
 }
 
+static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, 
const uint8_t *src,
+const uint8_t *unused1, int width, uint32_t *unused2)
+{
+int i;
+for (i = 0; i < width; i++) {
+AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6);
+AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6);
+}
+}
+
+static void y210be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, 
const uint8_t *src,
+const uint8_t *unused1, int width, uint32_t *unused2)
+{
+int i;
+for (i = 0; i < width; i++) {
+AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 2) >> 6);
+AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 6) >> 6);
+}
+}
+
+static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0,
+   const uint8_t *unused1, int width, uint32_t *unused2)
+{
+int i;
+for (i = 0; i < width; i++)
+AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6);
+}
+static void y210be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0,
+   const uint8_t *unused1, int width, uint32_t *unused2)
+{
+int i;
+for (i = 0; i < width; i++)
+AV_WN16(dst + i * 2 ,AV_RB16(src + i * 4) >> 6);
+}
+
 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t 
*unused1, const uint8_t *unused2, int width,
uint32_t *unused)
 {
@@ -1154,6 +1189,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_P016BE:
 c->chrToYV12 = p016BEToUV_c;
 break;
+case AV_PIX_FMT_Y210LE:
+c->chrToYV12 = y210le_UV_c;
+break;
+case AV_PIX_FMT_Y210BE:
+c->chrToYV12 = y210be_UV_c;
+break;
 }
 if (c->chrSrcHSubSample) {
 switch (srcFormat) {
@@ -1586,6 +1627,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->lumToYV12 = grayf32ToY16_bswap_c;
 #endif
 break;
+case AV_PIX_FMT_Y210LE:
+c->lumToYV12 = y210le_Y_c;
+break;
+case AV_PIX_FMT_Y210BE:
+c->chrToYV12 = y210be_Y_c;
+break;
 }
 if (c->needAlpha) {
 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 1b1f779..2f81fd3 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -266,6 +266,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
 [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 },
 [AV_PIX_FMT_NV24]= { 1, 1 },
 [AV_PIX_FMT_NV42]= { 1, 1 },
+[AV_PIX_FMT_Y210BE]  = { 1, 0 },
+[AV_PIX_FMT_Y210LE]  = { 1, 0 },
 };
 
 int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index e234922..bc9a0d8 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -59,6 +59,8 @@ isNBPS:
   p010le
   xyz12be
   xyz12le
+  y210be
+  y210le
   yuv420p10be
   yuv420p10le
   yuv420p12be
@@ -140,6 +142,7 @@ isBE:
   rgb565be
   rgba64be
   xyz12be
+  y210be
   ya16be
   yuv420p10be
   yuv420p12be
@@ -188,6 +191,8 @@ isYUV:
   uyyvyy411
   xyz12be
   xyz12le
+  y210be
+  y210le
   ya16be
   ya16le
   ya8
@@ -686,6 +691,8 @@ Packed:
   uyyvyy411
   xyz12be
   xyz12le
+  y210be
+  y210le
   ya16be
   ya16le
   ya8
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] lavu/pixfmt: add 4:2:2 10 bit pixel format Y210

2019-09-06 Thread Linjie Fu
Add support for packed 4:2:2 10 bit pixel format Y210.

It is the format that VAAPI/QSV uses when coping with 4:2:2 10bit
surfaces.

Signed-off-by: Linjie Fu 
---
 libavutil/pixdesc.c | 23 +++
 libavutil/pixfmt.h  |  4 
 libavutil/version.h |  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 05dd4a1..828fdce 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -241,6 +241,29 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_PLANAR,
 },
+[AV_PIX_FMT_Y210LE] = {
+.name = "y210le",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 4, 0, 6, 10, 3, 9, 1 },/* Y */
+{ 0, 8, 2, 6, 10, 7, 9, 3 },/* U */
+{ 0, 8, 6, 6, 10, 7, 9, 7 },/* V */
+},
+},
+[AV_PIX_FMT_Y210BE] = {
+.name = "y210be",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 4, 0, 6, 10, 3, 9, 1 },/* Y */
+{ 0, 8, 2, 6, 10, 7, 9, 3 },/* U */
+{ 0, 8, 6, 6, 10, 7, 9, 7 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_BE,
+},
 [AV_PIX_FMT_YUV444P] = {
 .name = "yuv444p",
 .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index d78e863..9c6363f 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -348,6 +348,9 @@ enum AVPixelFormat {
 AV_PIX_FMT_NV24,  ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 
plane for the UV components, which are interleaved (first byte U and the 
following byte V)
 AV_PIX_FMT_NV42,  ///< as above, but U and V bytes are swapped
 
+AV_PIX_FMT_Y210BE,///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, big-endian
+AV_PIX_FMT_Y210LE,///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, 
little-endian
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
@@ -435,6 +438,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
 #define AV_PIX_FMT_P010   AV_PIX_FMT_NE(P010BE,  P010LE)
 #define AV_PIX_FMT_P016   AV_PIX_FMT_NE(P016BE,  P016LE)
+#define AV_PIX_FMT_Y210   AV_PIX_FMT_NE(Y210BE,  Y210LE)
 
 /**
   * Chromaticity coordinates of the source primaries.
diff --git a/libavutil/version.h b/libavutil/version.h
index 658a508..3395769 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  34
+#define LIBAVUTIL_VERSION_MINOR  35
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/filters: correct range for contrast in eq filter

2019-09-06 Thread Gyan



On 06-09-2019 01:23 PM, Gyan wrote:



On 06-09-2019 08:28 AM, Sourabh Sharma wrote:

---
  doc/filters.texi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6c81e1da40..70ea16954f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9538,7 +9538,7 @@ The filter accepts the following options:
  @table @option
  @item contrast
  Set the contrast expression. The value must be a float value in range
-@code{-2.0} to @code{2.0}. The default value is "1".
+@code{-1000.0} to @code{1000.0}. The default value is "1".

  @item brightness
  Set the brightness expression. The value must be a float value in
--
2.11.0


Should reference the ticket as well. Will make that change and push.


Pushed as 3424600e0b19417ebad6da8b28e57e11290abbe7

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/mediacodecdec_common: log codec name during configure/start failures

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 04:07:19PM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodecdec_common.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/mediacodecdec_common.c 
> b/libavcodec/mediacodecdec_common.c
> index ab8525fb14..d200372dd4 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -525,8 +525,8 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, 
> MediaCodecDecContext *s,
>  if (status < 0) {
>  char *desc = ff_AMediaFormat_toString(format);
>  av_log(avctx, AV_LOG_ERROR,
> -"Failed to configure codec (status = %d) with format %s\n",
> -status, desc);
> +"Failed to configure codec %s (status = %d) with format %s\n",
> +s->codec_name, status, desc);
>  av_freep();
>  
>  ret = AVERROR_EXTERNAL;
> @@ -537,8 +537,8 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, 
> MediaCodecDecContext *s,
>  if (status < 0) {
>  char *desc = ff_AMediaFormat_toString(format);
>  av_log(avctx, AV_LOG_ERROR,
> -"Failed to start codec (status = %d) with format %s\n",
> -status, desc);
> +"Failed to start codec %s (status = %d) with format %s\n",
> +s->codec_name, status, desc);
>  av_freep();
>  ret = AVERROR_EXTERNAL;
>  goto fail;
> -- 
> 2.20.1
> 

LGTM.

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/6] avcodec/mediacodec_surface: guard against NULL surface

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 11:27:30AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodec_surface.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodec_surface.c b/libavcodec/mediacodec_surface.c
> index aada1ecebe..efcc4dc63c 100644
> --- a/libavcodec/mediacodec_surface.c
> +++ b/libavcodec/mediacodec_surface.c
> @@ -28,9 +28,11 @@
>  void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
>  {
>  JNIEnv *env = NULL;
> -
>  void *reference = NULL;
>  
> +if (!surface)
> +return NULL;
> +
>  env = ff_jni_get_env(log_ctx);
>  if (!env) {
>  return NULL;
> -- 
> 2.20.1
> 

This should not be needed unless it fixes a crash.
NewGlobalRef/DeleteGlobalRef (as well as NewLocalRef/DeleteLocalRef)
handles NULL pointers. The JNI MediaCodec wrapper is missleading about
this as it does this kind of unneeded checks everywhere (I did not known
at the time that the ref functions handle NULL). I have a local branch
cleaning this up. I will submit it to the ML in the upcoming days.

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/filters: correct range for contrast in eq filter

2019-09-06 Thread Gyan



On 06-09-2019 08:28 AM, Sourabh Sharma wrote:

---
  doc/filters.texi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6c81e1da40..70ea16954f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9538,7 +9538,7 @@ The filter accepts the following options:
  @table @option
  @item contrast
  Set the contrast expression. The value must be a float value in range
-@code{-2.0} to @code{2.0}. The default value is "1".
+@code{-1000.0} to @code{1000.0}. The default value is "1".

  @item brightness
  Set the brightness expression. The value must be a float value in
--
2.11.0


Should reference the ticket as well. Will make that change and push.

Thanks,
Gyan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/6] avcodec/mediacodecdec_common: warn when PTS is missing

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 11:27:32AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> MediaCodec decoders require PTS for proper operation.
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodecdec_common.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodecdec_common.c 
> b/libavcodec/mediacodecdec_common.c
> index 1656cd6664..eae9c28d42 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -612,7 +612,11 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
> MediaCodecDecContext *s,
>  }
>  
>  pts = pkt->pts;
> -if (pts != AV_NOPTS_VALUE && avctx->pkt_timebase.num && 
> avctx->pkt_timebase.den) {
> +if (pts == AV_NOPTS_VALUE) {
> +av_log(avctx, AV_LOG_WARNING, "Packet is missing PTS!\n");

Maybe reword to "Input packet is missing PTS" ? (without the !)

> +pts = 0;
> +}
> +if (pts && avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
>  pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
>  }
>  
> -- 
> 2.20.1
> 

Except from my comment, LGTM.

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 6/6] avcodec/mediacodecdec_common: propagate EOF immediately when signaled by decoder

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 11:27:35AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodecdec_common.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/mediacodecdec_common.c 
> b/libavcodec/mediacodecdec_common.c
> index b9465244a3..ab8525fb14 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -693,6 +693,7 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, 
> MediaCodecDecContext *s,
>  
>  if (info.flags & ff_AMediaCodec_getBufferFlagEndOfStream(codec)) {
>  s->eos = 1;
> +return AVERROR_EOF;
>  }

I am not sure it will work in all cases / all devices as we probably can
end up with a proper output buffer with the OES flag. Returning
AVERROR_EOF here will discard such buffer (frame).

>  
>  if (info.size) {
> -- 
> 2.20.1
> 

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2] avformat/hlsenc: merge fmp4 and mpegts segment type m3u8 list AVIOConext

2019-09-06 Thread Steven Liu
hlsenc has been merge fmp4 and mpegts workflow before
so it can merge m3u8 list AVIOContext now.

Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index f881bb9d60..e03db5f5b9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1461,7 +1461,7 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 
 set_http_options(s, , hls);
 snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" : 
"%s", vs->m3u8_name);
-if ((ret = hlsenc_io_open(s, (byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? >m3u8_out : >out, temp_filename, )) < 0) {
+if ((ret = hlsenc_io_open(s, byterange_mode ? >m3u8_out : >out, 
temp_filename, )) < 0) {
 if (hls->ignore_io_errors)
 ret = 0;
 goto fail;
@@ -1473,33 +1473,33 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 }
 
 vs->discontinuity_set = 0;
-ff_hls_write_playlist_header((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, hls->version, hls->allowcache,
+ff_hls_write_playlist_header(byterange_mode ? hls->m3u8_out : vs->out, 
hls->version, hls->allowcache,
  target_duration, sequence, hls->pl_type, 
hls->flags & HLS_I_FRAMES_ONLY);
 
 if ((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && 
vs->discontinuity_set==0 ) {
-avio_printf((byterange_mode || hls->segment_type == SEGMENT_TYPE_FMP4) 
? hls->m3u8_out : vs->out, "#EXT-X-DISCONTINUITY\n");
+avio_printf(byterange_mode ? hls->m3u8_out : vs->out, 
"#EXT-X-DISCONTINUITY\n");
 vs->discontinuity_set = 1;
 }
 if (vs->has_video && (hls->flags & HLS_INDEPENDENT_SEGMENTS)) {
-avio_printf((byterange_mode || hls->segment_type == SEGMENT_TYPE_FMP4) 
? hls->m3u8_out : vs->out, "#EXT-X-INDEPENDENT-SEGMENTS\n");
+avio_printf(byterange_mode ? hls->m3u8_out : vs->out, 
"#EXT-X-INDEPENDENT-SEGMENTS\n");
 }
 for (en = vs->segments; en; en = en->next) {
 if ((hls->encrypt || hls->key_info_file) && (!key_uri || 
strcmp(en->key_uri, key_uri) ||
 av_strcasecmp(en->iv_string, iv_string))) {
-avio_printf((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, 
"#EXT-X-KEY:METHOD=AES-128,URI=\"%s\"", en->key_uri);
+avio_printf(byterange_mode ? hls->m3u8_out : vs->out, 
"#EXT-X-KEY:METHOD=AES-128,URI=\"%s\"", en->key_uri);
 if (*en->iv_string)
-avio_printf((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, ",IV=0x%s", en->iv_string);
-avio_printf((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, "\n");
+avio_printf(byterange_mode ? hls->m3u8_out : vs->out, 
",IV=0x%s", en->iv_string);
+avio_printf(byterange_mode ? hls->m3u8_out : vs->out, "\n");
 key_uri = en->key_uri;
 iv_string = en->iv_string;
 }
 
 if ((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == vs->segments)) {
-ff_hls_write_init_file((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, (hls->flags & HLS_SINGLE_FILE) ? 
en->filename : vs->fmp4_init_filename,
+ff_hls_write_init_file(byterange_mode ? hls->m3u8_out : vs->out, 
(hls->flags & HLS_SINGLE_FILE) ? en->filename : vs->fmp4_init_filename,
hls->flags & HLS_SINGLE_FILE, 
vs->init_range_length, 0);
 }
 
-ret = ff_hls_write_file_entry((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, en->discont, byterange_mode,
+ret = ff_hls_write_file_entry(byterange_mode ? hls->m3u8_out : 
vs->out, en->discont, byterange_mode,
   en->duration, hls->flags & 
HLS_ROUND_DURATIONS,
   en->size, en->pos, vs->baseurl,
   en->filename, prog_date_time_p, 
en->keyframe_size, en->keyframe_pos, hls->flags & HLS_I_FRAMES_ONLY);
@@ -1509,7 +1509,7 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 }
 
 if (last && (hls->flags & HLS_OMIT_ENDLIST)==0)
-ff_hls_write_end_list((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out);
+ff_hls_write_end_list(byterange_mode ? hls->m3u8_out : vs->out);
 
 if (vs->vtt_m3u8_name) {
 snprintf(temp_vtt_filename, sizeof(temp_vtt_filename), use_temp_file ? 
"%s.tmp" : "%s", vs->vtt_m3u8_name);
@@ -1536,7 +1536,7 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 
 fail:
 av_dict_free();
-ret = hlsenc_io_close(s, (byterange_mode || hls->segment_type == 

Re: [FFmpeg-devel] [PATCH 2/6] avcodec/mediacodecdec: warn when input buffers are not configured with proper size

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 11:27:31AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> In rare circumstances, if the codec is not configured with the
> proper parameters the input buffers can be allocated with a size
> that's too small to hold an individual packet. Since MediaCodec
> expects exactly one incoming buffer with a given PTS, it is not
> valid to split data for a given PTS across two input buffers.
> 
> See 
> https://developer.android.com/reference/android/media/MediaCodec#data-processing:
> 
>   > Do not submit multiple input buffers with the same timestamp
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodecdec.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
> index e353e34bd5..f5771bffb1 100644
> --- a/libavcodec/mediacodecdec.c
> +++ b/libavcodec/mediacodecdec.c
> @@ -440,8 +440,13 @@ static int mediacodec_receive_frame(AVCodecContext 
> *avctx, AVFrame *frame)
>  if (ret >= 0) {
>  s->buffered_pkt.size -= ret;
>  s->buffered_pkt.data += ret;
> -if (s->buffered_pkt.size <= 0)
> +if (s->buffered_pkt.size <= 0) {
>  av_packet_unref(>buffered_pkt);
> +} else {
> +av_log(avctx, AV_LOG_WARNING,
> +   "could not send entire packet in single input 
> buffer (%d < %d)\n",
> +   ret, s->buffered_pkt.size+ret);
> +}
>  } else if (ret < 0 && ret != AVERROR(EAGAIN)) {
>  return ret;
>  }
> -- 
> 2.20.1
> 

The patch itself looks good to me. We should probably simplifies the
mediacodec_dec_send() function to not try to split the input pkt into
multiple MediaCodec buffers. I will send a patch to do that.

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/6] avcodec/mediacodecdec_common: improve trace logging for end-of-stream

2019-09-06 Thread Matthieu Bouron
On Thu, Sep 05, 2019 at 11:27:33AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/mediacodecdec_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodecdec_common.c 
> b/libavcodec/mediacodecdec_common.c
> index eae9c28d42..c538a00775 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -632,7 +632,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
> MediaCodecDecContext *s,
>  }
>  
>  av_log(avctx, AV_LOG_TRACE,
> -   "Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, 
> size, pts);
> +   "Queued empty EOS input buffer %zd with flags=%d\n", 
> index, flags);
>  
>  s->draining = 1;
>  return 0;
> -- 
> 2.20.1
> 

LGTM.

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".