Re: [FFmpeg-devel] [PATCH V4] avfilter: Add tonemap vaapi filter for H2S

2019-12-23 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Marton
> Balint
> Sent: Monday, December 23, 2019 5:15 AM
> To: FFmpeg development discussions and patches 
> Cc: Sun, Xinpeng 
> Subject: Re: [FFmpeg-devel] [PATCH V4] avfilter: Add tonemap vaapi filter for
> H2S
> 
> 
> 
> On Thu, 12 Dec 2019, Ruiling Song wrote:
> 
> > From: Xinpeng Sun 
> >
> > It performs HDR(High Dynamic Range) to SDR(Standard Dynamic Range)
> > conversion with tone-mapping. It only supports HDR10 as input temporarily.
> >
> > An example command to use this filter with vaapi codecs:
> > FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > -hwaccel_output_format vaapi \ -i INPUT -vf
> > 'tonemap_vaapi=format=p010' -c:v hevc_vaapi -profile 2 OUTPUT
> >
> > Signed-off-by: Xinpeng Sun 
> > Signed-off-by: Zachary Zhou 
> > Signed-off-by: Ruiling Song 
> > ---
> > When I re-think about the document part. I find it is not necessary to
> > repeat how to set up vaapi device in this filter part. There is
> > already good explanation of it(https://trac.ffmpeg.org/wiki/Hardware/VAAPI),
> so I add a link to it.
> > I only make code changes requested by Vittoria and me. So if no
> > further comment, I am going to apply the patch next week. Thanks!
> >
> > Ruiling
> >
> > configure  |   2 +
> > doc/filters.texi   |  59 +
> > libavfilter/Makefile   |   1 +
> > libavfilter/allfilters.c   |   1 +
> > libavfilter/vf_tonemap_vaapi.c | 419 +
> > 5 files changed, 482 insertions(+)
> > create mode 100644 libavfilter/vf_tonemap_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 42e7df3941..74f2d38317 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3576,6 +3576,7 @@ tinterlace_filter_deps="gpl"
> > tinterlace_merge_test_deps="tinterlace_filter"
> > tinterlace_pad_test_deps="tinterlace_filter"
> > tonemap_filter_deps="const_nan"
> > +tonemap_vaapi_filter_deps="vaapi
> VAProcPipelineParameterBuffer_output_hdr_metadata"
> > tonemap_opencl_filter_deps="opencl const_nan"
> > transpose_opencl_filter_deps="opencl"
> > transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> > @@ -6577,6 +6578,7 @@ if enabled vaapi; then
> >
> > check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
> > check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
> > +check_struct "va/va.h va/va_vpp.h"
> > + "VAProcPipelineParameterBuffer" output_hdr_metadata
> 
> This check does not seem to be enough, I am getting errors like this for libva
> 2.3.0:

Yes. I have reproduced this problem and sent a patch to fix it.

Thanks,
Xinpeng

> 
> libavfilter/vf_tonemap_vaapi.c: In function
> ‘tonemap_vaapi_set_filter_params’:
> libavfilter/vf_tonemap_vaapi.c:156:5: error: unknown type name
> ‘VAProcFilterParameterBufferHDRToneMapping’; did you mean
> ‘VAProcFilterParameterBufferDeinterlacing’?
>   VAProcFilterParameterBufferHDRToneMapping *hdrtm_param;
>   ^
>   VAProcFilterParameterBufferDeinterlacing
> 
> 
> Regards,
> Marton
> ___
> 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] configure: Change the configure check for tonemap_vaapi

2019-12-23 Thread Xinpeng Sun
"VAProcFilterParameterBufferHDRToneMapping" was defined in libva 2.4.1, which 
will lead to
build failure for the filter tonemap_vaapi for libva 2.3.0 with current check. 
This patch
is to fix this build error.

Signed-off-by: Xinpeng Sun 
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index eec43c3b06..157dc30132 100755
--- a/configure
+++ b/configure
@@ -3580,7 +3580,7 @@ tinterlace_filter_deps="gpl"
 tinterlace_merge_test_deps="tinterlace_filter"
 tinterlace_pad_test_deps="tinterlace_filter"
 tonemap_filter_deps="const_nan"
-tonemap_vaapi_filter_deps="vaapi 
VAProcPipelineParameterBuffer_output_hdr_metadata"
+tonemap_vaapi_filter_deps="vaapi 
VAProcFilterParameterBufferHDRToneMapping_type"
 tonemap_opencl_filter_deps="opencl const_nan"
 transpose_opencl_filter_deps="opencl"
 transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
@@ -6585,7 +6585,7 @@ if enabled vaapi; then
 
 check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
-check_struct "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer" 
output_hdr_metadata
+check_struct "va/va.h va/va_vpp.h" 
"VAProcFilterParameterBufferHDRToneMapping" type
 check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
 check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
 check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
-- 
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 3/5] avfilter/scale: separate exprs parse and eval

2019-12-23 Thread Gyan



On 24-12-2019 04:50 am, Michael Niedermayer wrote:

On Tue, Dec 17, 2019 at 02:55:06PM +0530, Gyan wrote:
[...]

@@ -127,6 +204,22 @@ static av_cold int init_dict(AVFilterContext *ctx, 
AVDictionary **opts)
  if (!scale->h_expr)
  av_opt_set(scale, "h", "ih", 0);
  
+ret = av_expr_parse(>w_pexpr, scale->w_expr,

+names,
+NULL, NULL, NULL, NULL, 0, ctx);
+if (ret < 0) {
+av_log(ctx, AV_LOG_ERROR, "Cannot parse width expression: '%s'\n", 
scale->w_expr);
+return ret;
+}
+
+ret = av_expr_parse(>h_pexpr, scale->h_expr,
+names,
+NULL, NULL, NULL, NULL, 0, ctx);
+if (ret < 0) {
+av_log(ctx, AV_LOG_ERROR, "Cannot parse height expression: '%s'\n", 
scale->h_expr);
+return ret;
+}
+
+if (w) {
+ret = av_expr_parse(>w_pexpr, scale->w_expr,
+names,
+NULL, NULL, NULL, NULL, 0, ctx);
+if (ret < 0) {
+av_log(ctx, AV_LOG_ERROR, "Cannot parse width expression: 
'%s'\n", scale->w_expr);
+goto revert;
+}
+}
+
+if (h) {
+ret = av_expr_parse(>h_pexpr, scale->h_expr,
+names,
+NULL, NULL, NULL, NULL, 0, ctx);
+if (ret < 0) {
+av_log(ctx, AV_LOG_ERROR, "Cannot parse height expression: 
'%s'\n", scale->h_expr);
+goto revert;
+}
+}

Duplicate code


init_dict() is not called during command processing since we don't reset 
any other parameter except for one of width or height. Do you want me to 
reinit all parameters after a command?



@@ -421,6 +589,18 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
  av_opt_set(scale, "w", buf, 0);
  snprintf(buf, sizeof(buf)-1, "%d", outlink->h);
  av_opt_set(scale, "h", buf, 0);
+
+av_expr_free(scale->w_pexpr);
+av_expr_free(scale->h_pexpr);
+scale->w_pexpr = scale->h_pexpr = NULL;
+
+av_expr_parse(>w_pexpr, scale->w_expr,
+  var_names,
+  NULL, NULL, NULL, NULL, 0, ctx);
+
+av_expr_parse(>h_pexpr, scale->h_expr,
+  var_names,
+  NULL, NULL, NULL, NULL, 0, ctx);

Missing error handling


Will do.

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] avfilter/drawtext: log why input pad failed to be configured

2019-12-23 Thread Gyan



On 24-12-2019 04:52 am, Michael Niedermayer wrote:

On Mon, Dec 23, 2019 at 09:46:39PM +0530, Gyan Doshi wrote:

---
  libavfilter/vf_drawtext.c | 12 +++-
  1 file changed, 7 insertions(+), 5 deletions(-)

LGTM


Pushed as 287620f59c5e5b3d65855f71048a8fe7db142451

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 v2] avfilter/formats: optimize ff_all_formats

2019-12-23 Thread zhilizhao


> On Dec 24, 2019, at 4:32 AM, Michael Niedermayer  
> wrote:
> 
> On Mon, Dec 23, 2019 at 04:11:53PM +0100, Nicolas George wrote:
>> Tomas Härdin (12019-12-09):
>>> As far as I can tell this is OK, and it passes FATE. But it just looks
>>> very very wrong. Why does this function even exist if all it
>>> effectively does is return the integers from 0..count-1?
>> 
>> For some time, there were gaps in the list of pixel formats, the task of
>> this function was precisely there to avoid the gaps and keep only the
>> actual pixel formats.
>> 
>> I am not sure about this change. It is technically valid, but it may
>> cause problems later.
>> 
>> There is an intermediate solution: keep the loop, but allocate only
>> once (simplified):
>> 
>>while ((desc = ...))
>>count++;
>>ret->formats = av_malloc_array(count, sizeof(*ret->formats));
>>count = 0;
>>while ((desc = ...))
>>ret->formats[count] = ...;
>> 
>> What do other developers think about it, with these explanations?

I tried this solution at first. The following reasons make me thought 
AV_PIX_FMT cannot have gaps.
Of course, can libavfilter depends on that is another question. I can switch to 
the robust solution
if you prefer.

1. AV_PIX_FMT_NB depends on !gaps, unless we calculate and set it manually

2. The reason to deprecated VAAPI in this way (ABI incompatible) is AV_PIX_FMT 
cannot have gaps

#if FF_API_VAAPI
/** @name Deprecated pixel formats */
/**@{*/
AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion 
compensation entry-point, Picture.data[3] contains a vaapi_render_state struct 
which contains macroblocks as well as various fields extracted from headers
AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT 
entry-point, Picture.data[3] contains a vaapi_render_state struct which 
contains fields extracted from headers
AV_PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] 
contains a VASurfaceID
/**@}*/
AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
#else
/**
 *  Hardware acceleration through VA-API, data[3] contains a
 *  VASurfaceID.
 */
AV_PIX_FMT_VAAPI,
#endif


> 
> The count once then allocate feels more robust than assuming on !gaps
> 
> Thanks
> 
> 
> [...]
> 
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> When you are offended at any man's fault, turn to yourself and study your
> own failings. Then you will forget your anger. -- Epictetus
> ___
> 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] lavf/movenc: Replace dts by pts to calculate duration

2019-12-23 Thread manuelyuan
thank you,I learned

At 2019-12-16 06:17:33, "Martin Storsjö"  wrote:
>On Tue, 10 Dec 2019, manuelyuan wrote:
>
>> I opened a ticket in https://trac.ffmpeg.org/ticket/8420
>> my patch may be not absolutely right, but this problem should get your 
>> attention, thank you
>
>I sent a patch that doesn't mess up all the details in the fragmentation, 
>but only changes the calculation of duration for the relevant boxes.
>
>// Martin
>
>___
>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] avutil/frame: Use av_realloc_array()

2019-12-23 Thread Limin Wang
On Tue, Dec 24, 2019 at 01:46:00AM +, Andreas Rheinhardt wrote:
> Limin Wang:
> > On Mon, Dec 23, 2019 at 10:20:37PM -0300, James Almer wrote:
> >> On 12/23/2019 8:32 PM, Michael Niedermayer wrote:
> >>> On Mon, Dec 23, 2019 at 10:48:13PM +0800, lance.lmw...@gmail.com wrote:
>  From: Limin Wang 
> 
>  Signed-off-by: Limin Wang 
>  ---
>   libavutil/frame.c | 7 ++-
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
>  diff --git a/libavutil/frame.c b/libavutil/frame.c
>  index 1d0faec687..0a1ba877cc 100644
>  --- a/libavutil/frame.c
>  +++ b/libavutil/frame.c
>  @@ -696,11 +696,8 @@ AVFrameSideData 
>  *av_frame_new_side_data_from_buf(AVFrame *frame,
>   if (!buf)
>   return NULL;
>   
>  -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
>  -return NULL;
>  -
>  -tmp = av_realloc(frame->side_data,
>  - (frame->nb_side_data + 1) * 
>  sizeof(*frame->side_data));
>  +tmp = av_realloc_array(frame->side_data,
>  + (frame->nb_side_data + 1), 
>  sizeof(*frame->side_data));
> >>>
> >>> does something prevent "frame->nb_side_data + 1" from overflowing ?
> >>
> >> av_realloc_array() is called with x + 1 as nmemb argument in several
> >> places. It checks for "nmemb >= INT_MAX / size", so it will never
> >> overflow with a buffer that increases by one element at a time (It would
> >> if the check was > alone).
> > 
> > I think about it, in case nb_side_data is INT_MAX, then frame->nb_side_data 
> > + 1 will overflow already
> > before enter av_realloc_array, so I add check for this overflow only.
> > 
> When frame->nb_side_data is INT_MAX - 1, you request to realloc the
> array to INT_MAX members. And because of the check James mentioned
> this allocation will already fail, hence frame->nb_side_data can never
> become INT_MAX (unless it is also set somewhere else in the code). So
> no overflow check is necessary in the caller as long as the size of
> the array is only increased in steps of 1.

Yes, please ignore my second patch.

> 
> But this relies on undocumented behaviour of av_realloc_array. Maybe
> it should be documented?
> 
> - Andreas
> ___
> 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] avutil/frame: Use av_realloc_array()

2019-12-23 Thread Andreas Rheinhardt
Limin Wang:
> On Mon, Dec 23, 2019 at 10:20:37PM -0300, James Almer wrote:
>> On 12/23/2019 8:32 PM, Michael Niedermayer wrote:
>>> On Mon, Dec 23, 2019 at 10:48:13PM +0800, lance.lmw...@gmail.com wrote:
 From: Limin Wang 

 Signed-off-by: Limin Wang 
 ---
  libavutil/frame.c | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)

 diff --git a/libavutil/frame.c b/libavutil/frame.c
 index 1d0faec687..0a1ba877cc 100644
 --- a/libavutil/frame.c
 +++ b/libavutil/frame.c
 @@ -696,11 +696,8 @@ AVFrameSideData 
 *av_frame_new_side_data_from_buf(AVFrame *frame,
  if (!buf)
  return NULL;
  
 -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
 -return NULL;
 -
 -tmp = av_realloc(frame->side_data,
 - (frame->nb_side_data + 1) * 
 sizeof(*frame->side_data));
 +tmp = av_realloc_array(frame->side_data,
 + (frame->nb_side_data + 1), 
 sizeof(*frame->side_data));
>>>
>>> does something prevent "frame->nb_side_data + 1" from overflowing ?
>>
>> av_realloc_array() is called with x + 1 as nmemb argument in several
>> places. It checks for "nmemb >= INT_MAX / size", so it will never
>> overflow with a buffer that increases by one element at a time (It would
>> if the check was > alone).
> 
> I think about it, in case nb_side_data is INT_MAX, then frame->nb_side_data + 
> 1 will overflow already
> before enter av_realloc_array, so I add check for this overflow only.
> 
When frame->nb_side_data is INT_MAX - 1, you request to realloc the
array to INT_MAX members. And because of the check James mentioned
this allocation will already fail, hence frame->nb_side_data can never
become INT_MAX (unless it is also set somewhere else in the code). So
no overflow check is necessary in the caller as long as the size of
the array is only increased in steps of 1.

But this relies on undocumented behaviour of av_realloc_array. Maybe
it should be documented?

- Andreas
___
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] avutil/frame: Use av_realloc_array()

2019-12-23 Thread Limin Wang
On Mon, Dec 23, 2019 at 10:20:37PM -0300, James Almer wrote:
> On 12/23/2019 8:32 PM, Michael Niedermayer wrote:
> > On Mon, Dec 23, 2019 at 10:48:13PM +0800, lance.lmw...@gmail.com wrote:
> >> From: Limin Wang 
> >>
> >> Signed-off-by: Limin Wang 
> >> ---
> >>  libavutil/frame.c | 7 ++-
> >>  1 file changed, 2 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/libavutil/frame.c b/libavutil/frame.c
> >> index 1d0faec687..0a1ba877cc 100644
> >> --- a/libavutil/frame.c
> >> +++ b/libavutil/frame.c
> >> @@ -696,11 +696,8 @@ AVFrameSideData 
> >> *av_frame_new_side_data_from_buf(AVFrame *frame,
> >>  if (!buf)
> >>  return NULL;
> >>  
> >> -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
> >> -return NULL;
> >> -
> >> -tmp = av_realloc(frame->side_data,
> >> - (frame->nb_side_data + 1) * 
> >> sizeof(*frame->side_data));
> >> +tmp = av_realloc_array(frame->side_data,
> >> + (frame->nb_side_data + 1), 
> >> sizeof(*frame->side_data));
> > 
> > does something prevent "frame->nb_side_data + 1" from overflowing ?
> 
> av_realloc_array() is called with x + 1 as nmemb argument in several
> places. It checks for "nmemb >= INT_MAX / size", so it will never
> overflow with a buffer that increases by one element at a time (It would
> if the check was > alone).

I think about it, in case nb_side_data is INT_MAX, then frame->nb_side_data + 1 
will overflow already
before enter av_realloc_array, so I add check for this overflow only.

> 
> The version 2 of this patch is pointless since it adds an extra check to
> the process, so if this one isn't applied then IMO none should.
> 
> > 
> > thx
> > 
> > [...]
> > 
> > 
> > ___
> > 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 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] avutil/frame: Use av_realloc_array()

2019-12-23 Thread James Almer
On 12/23/2019 8:32 PM, Michael Niedermayer wrote:
> On Mon, Dec 23, 2019 at 10:48:13PM +0800, lance.lmw...@gmail.com wrote:
>> From: Limin Wang 
>>
>> Signed-off-by: Limin Wang 
>> ---
>>  libavutil/frame.c | 7 ++-
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavutil/frame.c b/libavutil/frame.c
>> index 1d0faec687..0a1ba877cc 100644
>> --- a/libavutil/frame.c
>> +++ b/libavutil/frame.c
>> @@ -696,11 +696,8 @@ AVFrameSideData 
>> *av_frame_new_side_data_from_buf(AVFrame *frame,
>>  if (!buf)
>>  return NULL;
>>  
>> -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
>> -return NULL;
>> -
>> -tmp = av_realloc(frame->side_data,
>> - (frame->nb_side_data + 1) * sizeof(*frame->side_data));
>> +tmp = av_realloc_array(frame->side_data,
>> + (frame->nb_side_data + 1), sizeof(*frame->side_data));
> 
> does something prevent "frame->nb_side_data + 1" from overflowing ?

av_realloc_array() is called with x + 1 as nmemb argument in several
places. It checks for "nmemb >= INT_MAX / size", so it will never
overflow with a buffer that increases by one element at a time (It would
if the check was > alone).

The version 2 of this patch is pointless since it adds an extra check to
the process, so if this one isn't applied then IMO none should.

> 
> thx
> 
> [...]
> 
> 
> ___
> 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 1/2] avfilter/vf_colormatrix: av_frame_free() in case of error

2019-12-23 Thread Limin Wang
On Wed, Nov 27, 2019 at 06:46:50PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_colormatrix.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c
> index 3a02e2b86e..3a0c3f01da 100644
> --- a/libavfilter/vf_colormatrix.c
> +++ b/libavfilter/vf_colormatrix.c
> @@ -448,6 +448,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  case AVCOL_SPC_BT2020_CL : source = COLOR_MODE_BT2020; break;
>  default :
>  av_log(ctx, AV_LOG_ERROR, "Input frame does not specify a 
> supported colorspace, and none has been specified as source either\n");
> +av_frame_free();
>  av_frame_free();
>  return AVERROR(EINVAL);

ping

>  }
> -- 
> 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 v1 3/3] avfilter/vf_yadif: remove duplicate code with macro-based function

2019-12-23 Thread Limin Wang
On Thu, Nov 28, 2019 at 09:34:18AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_yadif.c | 147 +++--
>  1 file changed, 54 insertions(+), 93 deletions(-)
> 
> diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
> index f53bb77008..15d8c47b0b 100644
> --- a/libavfilter/vf_yadif.c
> +++ b/libavfilter/vf_yadif.c
> @@ -91,101 +91,62 @@ typedef struct ThreadData {
>  next2++; \
>  }
>  
> -static void filter_line_c(void *dst1,
> -  void *prev1, void *cur1, void *next1,
> -  int w, int prefs, int mrefs, int parity, int mode)
> -{
> -uint8_t *dst  = dst1;
> -uint8_t *prev = prev1;
> -uint8_t *cur  = cur1;
> -uint8_t *next = next1;
> -int x;
> -uint8_t *prev2 = parity ? prev : cur ;
> -uint8_t *next2 = parity ? cur  : next;
> -
> -/* The function is called with the pointers already pointing to data[3] 
> and
> - * with 6 subtracted from the width.  This allows the FILTER macro to be
> - * called so that it processes all the pixels normally.  A constant 
> value of
> - * true for is_not_edge lets the compiler ignore the if statement. */
> -FILTER(0, w, 1)
> +#define FILTER_LINE_FUNC(type, depth, bps)   
>   \
> +static void filter_line_c_##depth##bit(void *dst1,   
>   \
> +  void *prev1, void *cur1, void *next1,  
>   \
> +  int w, int prefs, int mrefs, int parity, int mode) 
>   \
> +{
>   \
> +type *dst  = dst1;   
>   \
> +type *prev = prev1;  
>   \
> +type *cur  = cur1;   
>   \
> +type *next = next1;  
>   \
> +int x;   
>   \
> +type *prev2 = parity ? prev : cur ;  
>   \
> +type *next2 = parity ? cur  : next;  
>   \
> +mrefs /= bps;
>   \
> +prefs /= bps;
>   \
> + 
>   \
> +/* The function is called with the pointers already pointing to data[3] 
> and */ \
> +/* with 6 subtracted from the width.  This allows the FILTER macro to be 
> */\
> +/* called so that it processes all the pixels normally. A constant value 
> of */ \
> +/* true for is_not_edge lets the compiler ignore the if statement. */
>   \
> +FILTER(0, w, 1)  
>   \
>  }
> +FILTER_LINE_FUNC(uint16_t, 16, 2);
> +FILTER_LINE_FUNC(uint8_t, 8, 1);
>  
>  #define MAX_ALIGN 8
> -static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1,
> - int w, int prefs, int mrefs, int parity, int mode)
> -{
> -uint8_t *dst  = dst1;
> -uint8_t *prev = prev1;
> -uint8_t *cur  = cur1;
> -uint8_t *next = next1;
> -int x;
> -uint8_t *prev2 = parity ? prev : cur ;
> -uint8_t *next2 = parity ? cur  : next;
> -
> -const int edge = MAX_ALIGN - 1;
> -
> -/* Only edge pixels need to be processed here.  A constant value of false
> - * for is_not_edge should let the compiler ignore the whole branch. */
> -FILTER(0, 3, 0)
> -
> -dst  = (uint8_t*)dst1  + w - edge;
> -prev = (uint8_t*)prev1 + w - edge;
> -cur  = (uint8_t*)cur1  + w - edge;
> -next = (uint8_t*)next1 + w - edge;
> -prev2 = (uint8_t*)(parity ? prev : cur);
> -next2 = (uint8_t*)(parity ? cur  : next);
> -
> -FILTER(w - edge, w - 3, 1)
> -FILTER(w - 3, w, 0)
> -}
> -
> -
> -static void filter_line_c_16bit(void *dst1,
> -void *prev1, void *cur1, void *next1,
> -int w, int prefs, int mrefs, int parity,
> -int mode)
> -{
> -uint16_t *dst  = dst1;
> -uint16_t *prev = prev1;
> -uint16_t *cur  = cur1;
> -uint16_t *next = next1;
> -int x;
> -uint16_t *prev2 = parity ? prev : cur ;
> -uint16_t *next2 = parity ? cur  : next;
> -mrefs /= 2;
> -prefs /= 2;
> -
> -FILTER(0, w, 1)
> -}
> -
> -static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void 
> *next1,
> -   int w, int prefs, int mrefs, int parity, int 
> mode)
> -{
> -uint16_t *dst  = dst1;
> -uint16_t *prev = prev1;
> -uint16_t *cur  = cur1;
> -

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_h264: add support for the Content light level information SEI message

2019-12-23 Thread Limin Wang
On Thu, Nov 28, 2019 at 11:06:52PM -0300, James Almer wrote:

> Defined in ITU-T H.264 (06/2019)

LGTM

> 
> Signed-off-by: James Almer 
> ---
> This is basically a copy paste of the H.265 implementation, both here and in
> the spec.
> 
>  libavcodec/cbs_h264.h |  6 ++
>  libavcodec/cbs_h2645.c|  1 +
>  libavcodec/cbs_h264_syntax_template.c | 17 +
>  libavcodec/h264_sei.h |  1 +
>  4 files changed, 25 insertions(+)
> 
> diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
> index 9f7c2a0d30..f8e5b743be 100644
> --- a/libavcodec/cbs_h264.h
> +++ b/libavcodec/cbs_h264.h
> @@ -314,6 +314,11 @@ typedef struct H264RawSEIMasteringDisplayColourVolume {
>  uint32_t min_display_mastering_luminance;
>  } H264RawSEIMasteringDisplayColourVolume;
>  
> +typedef struct H264RawSEIContentLightLevelInfo {
> +uint16_t max_content_light_level;
> +uint16_t max_pic_average_light_level;
> +} H264RawSEIContentLightLevelInfo;
> +
>  typedef struct H264RawSEIAlternativeTransferCharacteristics {
>  uint8_t preferred_transfer_characteristics;
>  } H264RawSEIAlternativeTransferCharacteristics;
> @@ -331,6 +336,7 @@ typedef struct H264RawSEIPayload {
>  H264RawSEIRecoveryPoint recovery_point;
>  H264RawSEIDisplayOrientation display_orientation;
>  H264RawSEIMasteringDisplayColourVolume 
> mastering_display_colour_volume;
> +H264RawSEIContentLightLevelInfo content_light_level;
>  H264RawSEIAlternativeTransferCharacteristics
>  alternative_transfer_characteristics;
>  struct {
> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
> index 88fa0029cd..0944585fa8 100644
> --- a/libavcodec/cbs_h2645.c
> +++ b/libavcodec/cbs_h2645.c
> @@ -458,6 +458,7 @@ static void cbs_h264_free_sei_payload(H264RawSEIPayload 
> *payload)
>  case H264_SEI_TYPE_PAN_SCAN_RECT:
>  case H264_SEI_TYPE_RECOVERY_POINT:
>  case H264_SEI_TYPE_DISPLAY_ORIENTATION:
> +case H264_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
>  case H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
>  case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
>  break;
> diff --git a/libavcodec/cbs_h264_syntax_template.c 
> b/libavcodec/cbs_h264_syntax_template.c
> index 1671a15d33..62b40dfb42 100644
> --- a/libavcodec/cbs_h264_syntax_template.c
> +++ b/libavcodec/cbs_h264_syntax_template.c
> @@ -819,6 +819,19 @@ static int 
> FUNC(sei_mastering_display_colour_volume)(CodedBitstreamContext *ctx,
>  return 0;
>  }
>  
> +static int FUNC(sei_content_light_level)(CodedBitstreamContext *ctx, 
> RWContext *rw,
> + H264RawSEIContentLightLevelInfo 
> *current)
> +{
> +int err;
> +
> +HEADER("Content Light Level");
> +
> +ub(16, max_content_light_level);
> +ub(16, max_pic_average_light_level);
> +
> +return 0;
> +}
> +
>  static int 
> FUNC(sei_alternative_transfer_characteristics)(CodedBitstreamContext *ctx,
>RWContext *rw,
>
> H264RawSEIAlternativeTransferCharacteristics *current)
> @@ -883,6 +896,10 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, 
> RWContext *rw,
>  CHECK(FUNC(sei_mastering_display_colour_volume)
>(ctx, rw, >payload.mastering_display_colour_volume));
>  break;
> +case H264_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
> +CHECK(FUNC(sei_content_light_level)
> +  (ctx, rw, >payload.content_light_level));
> +break;
>  case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
>  CHECK(FUNC(sei_alternative_transfer_characteristics)
>(ctx, rw, 
> >payload.alternative_transfer_characteristics));
> diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
> index a75c3aa175..ffd3948c5b 100644
> --- a/libavcodec/h264_sei.h
> +++ b/libavcodec/h264_sei.h
> @@ -36,6 +36,7 @@ typedef enum {
>  H264_SEI_TYPE_DISPLAY_ORIENTATION= 47,  ///< display orientation
>  H264_SEI_TYPE_GREEN_METADATA = 56,  ///< GreenMPEG information
>  H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME = 137,  ///< mastering 
> display properties
> +H264_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144,  ///< content light level 
> information
>  H264_SEI_TYPE_ALTERNATIVE_TRANSFER   = 147, ///< alternative transfer
>  } H264_SEI_Type;
>  
> -- 
> 2.24.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 v1] avcodec/decode: increase nb_bsfs after av_bsf_alloc in case alloc failed

2019-12-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/decode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index cd275bacc4..1ebbca4724 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -227,13 +227,13 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
 goto fail;
 }
 s->bsfs = tmp;
-s->nb_bsfs++;
 
-ret = av_bsf_alloc(filter, >bsfs[s->nb_bsfs - 1]);
+ret = av_bsf_alloc(filter, >bsfs[s->nb_bsfs]);
 if (ret < 0) {
 av_freep();
 goto fail;
 }
+s->nb_bsfs++;
 
 if (s->nb_bsfs == 1) {
 /* We do not currently have an API for passing the input timebase 
into decoders,
-- 
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 2/4] avformat/mpeg: Remove secondary packet for reading VobSub

2019-12-23 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Andreas Rheinhardt:
>> Andreas Rheinhardt:
>>> Andreas Rheinhardt:
 When vobsub_read_packet() reads a packet, it uses a dedicated AVPacket
 to get the subtitle timing and position from an FFDemuxSubtitlesQueue
 (which has been filled with this data during reading the idx file in
 vobsub_read_header); afterwards the actual subtitle data is read into
 the packet destined for output and the timing and position are copied
 to this packet. Afterwards, the local packet is unreferenced.

 This can be simplified: Simply use the output packet to get the timing
 and position from the FFDemuxSubtitlesQueue. The packet's size will be
 zero afterwards, so that it can be directly used to read the actual
 subtitle data. This makes copying the packet fields as well as
 unreferencing the local packet unecessary and also removes an instance
 of usage of sizeof(AVPacket) in libavformat.

 The only difference is that the returned packet will already be flagged
 as a keyframe. This currently only happens in compute_pkt_fields().

 Signed-off-by: Andreas Rheinhardt 
 ---
  libavformat/mpeg.c | 23 +++
  1 file changed, 7 insertions(+), 16 deletions(-)

 diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
 index bd182e4429..7daa72f7ce 100644
 --- a/libavformat/mpeg.c
 +++ b/libavformat/mpeg.c
 @@ -912,7 +912,6 @@ static int vobsub_read_packet(AVFormatContext *s, 
 AVPacket *pkt)
  FFDemuxSubtitlesQueue *q;
  AVIOContext *pb = vobsub->sub_ctx->pb;
  int ret, psize, total_read = 0, i;
 -AVPacket idx_pkt = { 0 };
  
  int64_t min_ts = INT64_MAX;
  int sid = 0;
 @@ -927,24 +926,22 @@ static int vobsub_read_packet(AVFormatContext *s, 
 AVPacket *pkt)
  }
  }
  q = >q[sid];
 -ret = ff_subtitles_queue_read_packet(q, _pkt);
 +/* The returned packet will have size zero,
 + * so that it can be directly used with av_grow_packet. */
 +ret = ff_subtitles_queue_read_packet(q, pkt);
  if (ret < 0)
  return ret;
  
  /* compute maximum packet size using the next packet position. This is
   * useful when the len in the header is non-sense */
  if (q->current_sub_idx < q->nb_subs) {
 -psize = q->subs[q->current_sub_idx].pos - idx_pkt.pos;
 +psize = q->subs[q->current_sub_idx].pos - pkt->pos;
  } else {
  int64_t fsize = avio_size(pb);
 -psize = fsize < 0 ? 0x : fsize - idx_pkt.pos;
 +psize = fsize < 0 ? 0x : fsize - pkt->pos;
  }
  
 -avio_seek(pb, idx_pkt.pos, SEEK_SET);
 -
 -av_init_packet(pkt);
 -pkt->size = 0;
 -pkt->data = NULL;
 +avio_seek(pb, pkt->pos, SEEK_SET);
  
  do {
  int n, to_read, startcode;
 @@ -968,7 +965,7 @@ static int vobsub_read_packet(AVFormatContext *s, 
 AVPacket *pkt)
  total_read += pkt_size;
  
  /* the current chunk doesn't match the stream index (unlikely) */
 -if ((startcode & 0x1f) != s->streams[idx_pkt.stream_index]->id)
 +if ((startcode & 0x1f) != s->streams[pkt->stream_index]->id)
  break;
  
  ret = av_grow_packet(pkt, to_read);
 @@ -980,16 +977,10 @@ static int vobsub_read_packet(AVFormatContext *s, 
 AVPacket *pkt)
  pkt->size -= to_read - n;
  } while (total_read < psize);
  
 -pkt->pts = pkt->dts = idx_pkt.pts;
 -pkt->pos = idx_pkt.pos;
 -pkt->stream_index = idx_pkt.stream_index;
 -
 -av_packet_unref(_pkt);
  return 0;
  
  fail:
  av_packet_unref(pkt);
 -av_packet_unref(_pkt);
  return ret;
  }
  

>>> Ping.
>>>
>>> - Andreas
>>>
>> Another ping for the three unmerged patches of this patchset.
>>
>> - Andreas
>>
> Another ping for the two unmerged patches of this patchset; and also
> for the other patch fixing uninitialized reads in the vobsub demuxer:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/251961.html
> 
> - Andreas
> 
Ping.

- Andreas
___
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] avutil/frame: Use av_realloc_array()

2019-12-23 Thread Limin Wang
On Tue, Dec 24, 2019 at 12:32:07AM +0100, Michael Niedermayer wrote:
> On Mon, Dec 23, 2019 at 10:48:13PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavutil/frame.c | 7 ++-
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/libavutil/frame.c b/libavutil/frame.c
> > index 1d0faec687..0a1ba877cc 100644
> > --- a/libavutil/frame.c
> > +++ b/libavutil/frame.c
> > @@ -696,11 +696,8 @@ AVFrameSideData 
> > *av_frame_new_side_data_from_buf(AVFrame *frame,
> >  if (!buf)
> >  return NULL;
> >  
> > -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
> > -return NULL;
> > -
> > -tmp = av_realloc(frame->side_data,
> > - (frame->nb_side_data + 1) * 
> > sizeof(*frame->side_data));
> > +tmp = av_realloc_array(frame->side_data,
> > + (frame->nb_side_data + 1), sizeof(*frame->side_data));
> 
> does something prevent "frame->nb_side_data + 1" from overflowing ?

no, I have add the check for the overflow and update the patch.

> 
> thx
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.



> ___
> 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 v2] avutil/frame: Use av_realloc_array()

2019-12-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavutil/frame.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index e4038096c2..1a67eda91d 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -693,14 +693,11 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame 
*frame,
 {
 AVFrameSideData *ret, **tmp;
 
-if (!buf)
+if (!buf || frame->nb_side_data > INT_MAX - 1)
 return NULL;
 
-if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
-return NULL;
-
-tmp = av_realloc(frame->side_data,
- (frame->nb_side_data + 1) * sizeof(*frame->side_data));
+tmp = av_realloc_array(frame->side_data,
+ (frame->nb_side_data + 1), sizeof(*frame->side_data));
 if (!tmp)
 return NULL;
 frame->side_data = tmp;
-- 
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] Fix spelling in ID3v1 genres and extend the list of Winamp extensions.

2019-12-23 Thread Michael Niedermayer
On Mon, Dec 23, 2019 at 11:43:10AM +0100, Ulrich Spörlein wrote:
> On Sun, 2019-12-22 at 18:44:01 +0100, Michael Niedermayer wrote:
> > a reference to a VCS should include the version
> > similarly for wikipedia some revission of the page should be mentioned in
> > the commit message
> 
> Heh, this is already a defunct standard, I doubt it will ever change
> again. I've updated the commit message to provide more direct links to
> fixed versions in time, hth, please see attached.
> 
> 

>  id3v1.c |   58 +++---
>  id3v1.h |2 +-
>  2 files changed, 52 insertions(+), 8 deletions(-)
> 18bb5fc86701a138c90c9bc95737d5a18299c6ea  
> 0001-libavformat-fix-spelling-in-ID3v1-genres-and-extend-.patch
> From 55601483bdc8c002f3b8c19f830ab6ebbf4586cd Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ulrich=20Sp=C3=B6rlein?= 
> Date: Thu, 19 Dec 2019 16:12:46 +0100
> Subject: [PATCH] libavformat: fix spelling in ID3v1 genres and extend the list
>  of Winamp extensions.
> 
> Sources include various lists on the Internet, as well as the current
> Wikipedia page at
> https://en.wikipedia.org/w/index.php?title=List_of_ID3v1_Genres=896774343
> but most importantly the list as used by taglib at
> https://github.com/taglib/taglib/commit/3e60e339a4bc46e2a1a7aea782502480561a8acf#diff-f86455366624350770f41b4940925dde
> 
> Further patches to harmonize the spelling have been sent to taglib and
> libid3tag. See also https://github.com/taglib/taglib/pull/942/
> ---
>  libavformat/id3v1.c | 58 +++--
>  libavformat/id3v1.h |  2 +-
>  2 files changed, 52 insertions(+), 8 deletions(-)

patch may be ok, but spelling is not my strong side ;)

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.


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] avutil/frame: Use av_realloc_array()

2019-12-23 Thread Michael Niedermayer
On Mon, Dec 23, 2019 at 10:48:13PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavutil/frame.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 1d0faec687..0a1ba877cc 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -696,11 +696,8 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame 
> *frame,
>  if (!buf)
>  return NULL;
>  
> -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
> -return NULL;
> -
> -tmp = av_realloc(frame->side_data,
> - (frame->nb_side_data + 1) * sizeof(*frame->side_data));
> +tmp = av_realloc_array(frame->side_data,
> + (frame->nb_side_data + 1), sizeof(*frame->side_data));

does something prevent "frame->nb_side_data + 1" from overflowing ?

thx

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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] avfilter/drawtext: log why input pad failed to be configured

2019-12-23 Thread Michael Niedermayer
On Mon, Dec 23, 2019 at 09:46:39PM +0530, Gyan Doshi wrote:
> ---
>  libavfilter/vf_drawtext.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)

LGTM

thx

[...]
-- 
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 3/5] avfilter/scale: separate exprs parse and eval

2019-12-23 Thread Michael Niedermayer
On Tue, Dec 17, 2019 at 02:55:06PM +0530, Gyan wrote:
> 
[...]
> @@ -127,6 +204,22 @@ static av_cold int init_dict(AVFilterContext *ctx, 
> AVDictionary **opts)
>  if (!scale->h_expr)
>  av_opt_set(scale, "h", "ih", 0);
>  
> +ret = av_expr_parse(>w_pexpr, scale->w_expr,
> +names,
> +NULL, NULL, NULL, NULL, 0, ctx);
> +if (ret < 0) {
> +av_log(ctx, AV_LOG_ERROR, "Cannot parse width expression: '%s'\n", 
> scale->w_expr);
> +return ret;
> +}
> +
> +ret = av_expr_parse(>h_pexpr, scale->h_expr,
> +names,
> +NULL, NULL, NULL, NULL, 0, ctx);
> +if (ret < 0) {
> +av_log(ctx, AV_LOG_ERROR, "Cannot parse height expression: '%s'\n", 
> scale->h_expr);
> +return ret;
> +}
> +

> +if (w) {
> +ret = av_expr_parse(>w_pexpr, scale->w_expr,
> +names,
> +NULL, NULL, NULL, NULL, 0, ctx);
> +if (ret < 0) {
> +av_log(ctx, AV_LOG_ERROR, "Cannot parse width expression: 
> '%s'\n", scale->w_expr);
> +goto revert;
> +}
> +}
> +
> +if (h) {
> +ret = av_expr_parse(>h_pexpr, scale->h_expr,
> +names,
> +NULL, NULL, NULL, NULL, 0, ctx);
> +if (ret < 0) {
> +av_log(ctx, AV_LOG_ERROR, "Cannot parse height expression: 
> '%s'\n", scale->h_expr);
> +goto revert;
> +}
> +}

Duplicate code



> @@ -421,6 +589,18 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
> AVFrame **frame_out)
>  av_opt_set(scale, "w", buf, 0);
>  snprintf(buf, sizeof(buf)-1, "%d", outlink->h);
>  av_opt_set(scale, "h", buf, 0);
> +
> +av_expr_free(scale->w_pexpr);
> +av_expr_free(scale->h_pexpr);
> +scale->w_pexpr = scale->h_pexpr = NULL;
> +
> +av_expr_parse(>w_pexpr, scale->w_expr,
> +  var_names,
> +  NULL, NULL, NULL, NULL, 0, ctx);
> +
> +av_expr_parse(>h_pexpr, scale->h_expr,
> +  var_names,
> +  NULL, NULL, NULL, NULL, 0, ctx);

Missing error handling


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


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".

[FFmpeg-devel] avcodec/aacenc: Compatibility with Bluetooth A2DP headsets

2019-12-23 Thread Andrey Semashev

Hi,

I'm trying to add support for AAC to PulseAudio with regard to Bluetooth 
A2DP. I'm using libavcodec to encode AAC content and then packetize it 
into RTP MP4-LATM packets, as required by A2DP spec. My current 
implementation allows to switch between libfdk-aac and built-in AAC 
encoder backends.


With libfdk-aac, everything's working well, the encoded audio is 
correctly played by the BT headset (EOZ Air). But with the built-in 
encoder I can hear occasional audio drop outs and artefacts like clicks 
and weird stereo effects. I'm assuming this is because some decoding 
errors on the headset, but obviously I don't have any kind of debug info 
from it. When the same content is played (e.g. the same song) on 
different runs, the artefacts appear at roughly the same places, so I'm 
assuming that the problem is input content-related.


Given that libfdk-aac output is played without artefacts by the device, 
I'm assuming my packetization code is correct. I also tried to debug and 
analyze its output and didn't find anything out of order. This makes me 
believe the problem is in the built-in encoder.


How should I proceed about this problem? What kind of information would 
be useful to the aacenc developer(s) to debug this? Is there any 
information as to how conforming aacenc is to the AAC spec and other, 
especially hardware implementations?


For a start, here is my code:

https://gitlab.freedesktop.org/andrey.semashev/pulseaudio/blob/a2dp-codecs-aac/src/modules/bluetooth/a2dp-codec-aac.c

libavcodec encoder context initialization is at:

https://gitlab.freedesktop.org/andrey.semashev/pulseaudio/blob/a2dp-codecs-aac/src/modules/bluetooth/a2dp-codec-aac.c#L685

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 v2] avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device

2019-12-23 Thread Andriy Gelman
On Mon, 23. Dec 21:42, Michael Niedermayer wrote:
> On Mon, Dec 23, 2019 at 11:05:04AM -0500, Andriy Gelman wrote:
> > On Sat, 23. Nov 06:18, Andriy Gelman wrote:
> > > On Tue, 12. Nov 22:46, Andriy Gelman wrote:
> > > > From: Andriy Gelman 
> > > > 
> > > > Fixes #8079
> > > > 
> > > > During initialization of a v4l2m2m device, the configured pix_fmt can be
> > > > different to the pix_fmt of the encoder (i.e. avctx->pix_fmt).
> > > > 
> > > > For example on the Odroid XU4:
> > > > ./ffmpeg -f lavfi -i yuvtestsrc -codec:v h264_v4l2m2m out.h264
> > > > 
> > > > will configure the v4l2 encoder to pix_fmt nv21, whereas the input
> > > > frames will be yuv444p.
> > > > 
> > > > This commit checks that the configured v4l2 pix_fmt on device is the
> > > > same as avctx->pix_fmt. If they are different the initialization fails
> > > > and an error is returned. Tested on RPI4 and Odroid XU4.
> > > > 
> > > > Signed-off-by: Andriy Gelman 
> > > > ---
> > > >  libavcodec/v4l2_m2m_enc.c | 15 +++
> > > >  1 file changed, 15 insertions(+)
> > > > 
> > > > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> > > > index 474e6bef897..c0e82afe354 100644
> > > > --- a/libavcodec/v4l2_m2m_enc.c
> > > > +++ b/libavcodec/v4l2_m2m_enc.c
> > > > @@ -30,6 +30,7 @@
> > > >  #include "libavutil/opt.h"
> > > >  #include "v4l2_context.h"
> > > >  #include "v4l2_m2m.h"
> > > > +#include "v4l2_fmt.h"
> > > >  
> > > >  #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x
> > > >  #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x
> > > > @@ -288,6 +289,8 @@ static av_cold int v4l2_encode_init(AVCodecContext 
> > > > *avctx)
> > > >  V4L2Context *capture, *output;
> > > >  V4L2m2mContext *s;
> > > >  V4L2m2mPriv *priv = avctx->priv_data;
> > > > +enum AVPixelFormat pix_fmt_output;
> > > > +uint32_t v4l2_fmt_output;
> > > >  int ret;
> > > >  
> > > >  ret = ff_v4l2_m2m_create_context(priv, );
> > > > @@ -316,6 +319,18 @@ static av_cold int v4l2_encode_init(AVCodecContext 
> > > > *avctx)
> > > >  }
> > > >  s->avctx = avctx;
> > > >  
> > > > +if (V4L2_TYPE_IS_MULTIPLANAR(output->type))
> > > > +v4l2_fmt_output = output->format.fmt.pix_mp.pixelformat;
> > > > +else
> > > > +v4l2_fmt_output = output->format.fmt.pix.pixelformat;
> > > > +
> > > > +pix_fmt_output = ff_v4l2_format_v4l2_to_avfmt(v4l2_fmt_output, 
> > > > AV_CODEC_ID_RAWVIDEO);
> > > > +if (pix_fmt_output != avctx->pix_fmt) {
> > > > +const AVPixFmtDescriptor *desc = 
> > > > av_pix_fmt_desc_get(pix_fmt_output);
> > > > +av_log(priv, AV_LOG_ERROR, "Encoder requires %s pixel 
> > > > format.\n", desc->name);
> > > > +return AVERROR(EINVAL);
> > > > +}
> > > > +
> > > >  return v4l2_prepare_encoder(s);
> > > >  }
> > > >  
> > > > -- 
> > > > 2.23.0
> > > > 
> > > 
> > > ping 
> > > 
> > 
> > ping

> 
> try to mail the people listed in MAINTAINERs or the last person working on the
> file you need a review for
> 

I emailed Jorge Ramirez-Ortiz, he replied:

> On 09/12/19 21:26:19, Jorge Ramirez-Ortiz, Gmail wrote:
> > On 09/12/19 09:22:45, Andriy Gelman wrote:
> > > Hello Jorge, 
> > > 
> > > Do you have time to look at this patch, please?
> > > 
> > > Thank you, 
> > > Andriy
> > 
> 
> I apologoize to everyone - I cant find the time to work on this (due to a 
> number of very different reasons I have been struggling for a while with my 
> workload so it is time for me to be realistic).
>  
> I think it would be best if someone else picks up maintainership of this 
> interface and provides it with the technical direction it needs.
> 
> thanks
> Jorge

On irc, Aman told me he'll try to look at the patch. 

-- 
Andriy
___
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] Add a commandline option to control loop restoration for libaom

2019-12-23 Thread Wang Cao
Signed-off-by: Wang Cao 
---
 doc/encoders.texi  | 3 +++
 libavcodec/libaomenc.c | 6 ++
 2 files changed, 9 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 4ee518a124..56b36c156b 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1587,6 +1587,9 @@ Enable row based multi-threading. Disabled by default.
 Enable Constrained Directional Enhancement Filter. The libaom-av1
 encoder enables CDEF by default.
 
+@item enable-restoration (@emph{boolean})
+Enable Loop Restoration Filter. Default is true for libaom-av1.
+
 @item enable-global-motion (@emph{boolean})
 Enable the use of global motion for block prediction. Default is true.
 
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index e06697c1bf..41a250302d 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -92,6 +92,7 @@ typedef struct AOMEncoderContext {
 int enable_cdef;
 int enable_global_motion;
 int enable_intrabc;
+int enable_restoration;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -110,6 +111,7 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_SUPERBLOCK_SIZE]  = "AV1E_SET_SUPERBLOCK_SIZE",
 [AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
 [AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
+[AV1E_SET_ENABLE_RESTORATION] = "AV1E_SET_ENABLE_RESTORATION",
 #ifdef AOM_CTRL_AV1E_SET_ROW_MT
 [AV1E_SET_ROW_MT]   = "AV1E_SET_ROW_MT",
 #endif
@@ -688,6 +690,9 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AOME_SET_ARNR_STRENGTH,ctx->arnr_strength);
 if (ctx->enable_cdef >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef);
+if (ctx->enable_restoration >= 0)
+  codecctl_int(avctx, AV1E_SET_ENABLE_RESTORATION, 
ctx->enable_restoration);
+
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
 if (ctx->crf >= 0)
 codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
@@ -1084,6 +1089,7 @@ static const AVOption options[] = {
 { "enable-cdef",  "Enable CDEF filtering", 
OFFSET(enable_cdef),AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { "enable-global-motion",  "Enable global motion", 
OFFSET(enable_global_motion), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { "enable-intrabc",  "Enable intra block copy prediction mode", 
OFFSET(enable_intrabc), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+{ "enable-restoration",  "Enable Loop Restoration filtering",  
   OFFSET(enable_restoration),AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { NULL },
 };
 
-- 
2.24.1.735.g03f4e72817-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 v2] avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device

2019-12-23 Thread Michael Niedermayer
On Mon, Dec 23, 2019 at 11:05:04AM -0500, Andriy Gelman wrote:
> On Sat, 23. Nov 06:18, Andriy Gelman wrote:
> > On Tue, 12. Nov 22:46, Andriy Gelman wrote:
> > > From: Andriy Gelman 
> > > 
> > > Fixes #8079
> > > 
> > > During initialization of a v4l2m2m device, the configured pix_fmt can be
> > > different to the pix_fmt of the encoder (i.e. avctx->pix_fmt).
> > > 
> > > For example on the Odroid XU4:
> > > ./ffmpeg -f lavfi -i yuvtestsrc -codec:v h264_v4l2m2m out.h264
> > > 
> > > will configure the v4l2 encoder to pix_fmt nv21, whereas the input
> > > frames will be yuv444p.
> > > 
> > > This commit checks that the configured v4l2 pix_fmt on device is the
> > > same as avctx->pix_fmt. If they are different the initialization fails
> > > and an error is returned. Tested on RPI4 and Odroid XU4.
> > > 
> > > Signed-off-by: Andriy Gelman 
> > > ---
> > >  libavcodec/v4l2_m2m_enc.c | 15 +++
> > >  1 file changed, 15 insertions(+)
> > > 
> > > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> > > index 474e6bef897..c0e82afe354 100644
> > > --- a/libavcodec/v4l2_m2m_enc.c
> > > +++ b/libavcodec/v4l2_m2m_enc.c
> > > @@ -30,6 +30,7 @@
> > >  #include "libavutil/opt.h"
> > >  #include "v4l2_context.h"
> > >  #include "v4l2_m2m.h"
> > > +#include "v4l2_fmt.h"
> > >  
> > >  #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x
> > >  #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x
> > > @@ -288,6 +289,8 @@ static av_cold int v4l2_encode_init(AVCodecContext 
> > > *avctx)
> > >  V4L2Context *capture, *output;
> > >  V4L2m2mContext *s;
> > >  V4L2m2mPriv *priv = avctx->priv_data;
> > > +enum AVPixelFormat pix_fmt_output;
> > > +uint32_t v4l2_fmt_output;
> > >  int ret;
> > >  
> > >  ret = ff_v4l2_m2m_create_context(priv, );
> > > @@ -316,6 +319,18 @@ static av_cold int v4l2_encode_init(AVCodecContext 
> > > *avctx)
> > >  }
> > >  s->avctx = avctx;
> > >  
> > > +if (V4L2_TYPE_IS_MULTIPLANAR(output->type))
> > > +v4l2_fmt_output = output->format.fmt.pix_mp.pixelformat;
> > > +else
> > > +v4l2_fmt_output = output->format.fmt.pix.pixelformat;
> > > +
> > > +pix_fmt_output = ff_v4l2_format_v4l2_to_avfmt(v4l2_fmt_output, 
> > > AV_CODEC_ID_RAWVIDEO);
> > > +if (pix_fmt_output != avctx->pix_fmt) {
> > > +const AVPixFmtDescriptor *desc = 
> > > av_pix_fmt_desc_get(pix_fmt_output);
> > > +av_log(priv, AV_LOG_ERROR, "Encoder requires %s pixel 
> > > format.\n", desc->name);
> > > +return AVERROR(EINVAL);
> > > +}
> > > +
> > >  return v4l2_prepare_encoder(s);
> > >  }
> > >  
> > > -- 
> > > 2.23.0
> > > 
> > 
> > ping 
> > 
> 
> ping

try to mail the people listed in MAINTAINERs or the last person working on the
file you need a review for

Thanks

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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 v2] avfilter/formats: optimize ff_all_formats

2019-12-23 Thread Michael Niedermayer
On Mon, Dec 23, 2019 at 04:11:53PM +0100, Nicolas George wrote:
> Tomas Härdin (12019-12-09):
> > As far as I can tell this is OK, and it passes FATE. But it just looks
> > very very wrong. Why does this function even exist if all it
> > effectively does is return the integers from 0..count-1?
> 
> For some time, there were gaps in the list of pixel formats, the task of
> this function was precisely there to avoid the gaps and keep only the
> actual pixel formats.
> 
> I am not sure about this change. It is technically valid, but it may
> cause problems later.
> 
> There is an intermediate solution: keep the loop, but allocate only
> once (simplified):
> 
> while ((desc = ...))
> count++;
> ret->formats = av_malloc_array(count, sizeof(*ret->formats));
> count = 0;
> while ((desc = ...))
> ret->formats[count] = ...;
> 
> What do other developers think about it, with these explanations?

The count once then allocate feels more robust than assuming on !gaps

Thanks


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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] lavc/qsv: adding DX11 support

2019-12-23 Thread Hendrik Leppkes
On Mon, Dec 23, 2019 at 7:40 PM Artem Galin  wrote:
>
> This enables DX11 support for QSV with higher priority than DX9.
> In case of multiple GPUs configuration, DX9 API does not allow to get
> access to QSV device in some cases - headless.
> Implementation based on DX11 resolves that restriction by enumerating list of 
> available GPUs and finding device with QSV support.
>
> Signed-off-by: Artem Galin 

Did you test this in combination of D3D11VA decoding and QSV encoding?
Historically, QSV failed at accepting the array-textures that are used
by a D3D11 decoder, which is why this was not included.

- Hendrik
___
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/qsv: adding DX11 support

2019-12-23 Thread Artem Galin
This enables DX11 support for QSV with higher priority than DX9.
In case of multiple GPUs configuration, DX9 API does not allow to get
access to QSV device in some cases - headless.
Implementation based on DX11 resolves that restriction by enumerating list of 
available GPUs and finding device with QSV support.

Signed-off-by: Artem Galin 
---
 libavcodec/qsv.c  | 13 +++--
 libavcodec/qsv_internal.h |  1 +
 libavutil/hwcontext_d3d11va.c | 57 +-
 libavutil/hwcontext_qsv.c | 89 +++
 libavutil/hwcontext_qsv.h |  1 +
 5 files changed, 147 insertions(+), 14 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index b00e427435..33ac7a3373 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -414,7 +414,7 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, 
QSVSession *qs)
 int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
  const char *load_plugins, int gpu_copy)
 {
-mfxIMPL  impl = MFX_IMPL_AUTO_ANY;
+mfxIMPL  impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;
 mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
 mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };
 
@@ -504,6 +504,7 @@ static AVBufferRef *qsv_create_mids(AVBufferRef 
*hw_frames_ref)
 for (i = 0; i < nb_surfaces; i++) {
 QSVMid *mid = [i];
 mid->handle= frames_hwctx->surfaces[i].Data.MemId;
+mid->texture   = frames_hwctx->texture;
 mid->hw_frames_ref = hw_frames_ref1;
 }
 
@@ -713,7 +714,13 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId 
mid, mfxFrameData *ptr)
 static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
 {
 QSVMid *qsv_mid = (QSVMid*)mid;
-*hdl = qsv_mid->handle;
+if (qsv_mid->texture) {
+mfxHDLPair *pair  =  (mfxHDLPair*)hdl;
+pair->first  = qsv_mid->texture;
+pair->second = qsv_mid->handle;
+} else {
+*hdl = qsv_mid->handle;
+}
 return MFX_ERR_NONE;
 }
 
@@ -723,8 +730,8 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 {
 static const mfxHandleType handle_types[] = {
 MFX_HANDLE_VA_DISPLAY,
-MFX_HANDLE_D3D9_DEVICE_MANAGER,
 MFX_HANDLE_D3D11_DEVICE,
+MFX_HANDLE_D3D9_DEVICE_MANAGER,
 };
 AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data;
 AVQSVDeviceContext *device_hwctx = device_ctx->hwctx;
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 37559270e5..09425fb431 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -60,6 +60,7 @@
 
 typedef struct QSVMid {
 AVBufferRef *hw_frames_ref;
+void *texture;
 mfxHDL handle;
 
 AVFrame *locked_frame;
diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 6670c47579..a08479fd96 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -244,7 +244,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
 return AVERROR(EINVAL);
 }
 
-texDesc = (D3D11_TEXTURE2D_DESC){
+texDesc = (D3D11_TEXTURE2D_DESC) {
 .Width  = ctx->width,
 .Height = ctx->height,
 .MipLevels  = 1,
@@ -510,6 +510,46 @@ static void d3d11va_device_uninit(AVHWDeviceContext *hwdev)
 }
 }
 
+static int d3d11va_device_find_qsv_adapter(AVHWDeviceContext *ctx, UINT 
creationFlags)
+{
+HRESULT hr;
+IDXGIAdapter *adapter = NULL;
+int adapter_id = 0;
+int vendor_id = 0x8086;
+IDXGIFactory2 *factory;
+hr = mCreateDXGIFactory(_IDXGIFactory2, (void **));
+while (IDXGIFactory2_EnumAdapters(factory, adapter_id++, ) != 
DXGI_ERROR_NOT_FOUND)
+{
+ID3D11Device* device = NULL;
+DXGI_ADAPTER_DESC adapter_desc;
+
+hr = mD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, 
creationFlags, NULL, 0, D3D11_SDK_VERSION, , NULL, NULL);
+if (FAILED(hr)) {
+av_log(ctx, AV_LOG_ERROR, "D3D11CreateDevice returned error\n");
+continue;
+}
+
+hr = IDXGIAdapter2_GetDesc(adapter, _desc);
+if (FAILED(hr)) {
+av_log(ctx, AV_LOG_ERROR, "IDXGIAdapter2_GetDesc returned 
error\n");
+continue;
+}
+
+if(device)
+ID3D11Device_Release(device);
+
+if (adapter)
+IDXGIAdapter_Release(adapter);
+
+if (adapter_desc.VendorId == vendor_id) {
+IDXGIFactory2_Release(factory);
+return adapter_id - 1;
+}
+}
+IDXGIFactory2_Release(factory);
+return -1;
+}
+
 static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device,
  AVDictionary *opts, int flags)
 {
@@ -519,7 +559,9 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, 
const char *device,
 IDXGIAdapter   *pAdapter = NULL;
 

Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: remove redundant flag

2019-12-23 Thread Nicolas George
quinkbl...@foxmail.com (12019-12-04):
> From: Zhao Zhili 
> 
> !(c->pix_fmt != AV_PIX_FMT_NONE || c->got_format_from_params)
> 
> equals
> 
> (c->pix_fmt == AV_PIX_FMT_NONE) && !c->got_format_from_params
> 
> 1. When (c->pix_fmt == AV_PIX_FMT_NONE) is true, got_format_from_params is
> always false, the flag doesn't contribute to the result.
> 
> 2. When the first part is false, the second part doesn't matter, the flag
> doesn't contribute to the result.
> 
> The result only depends on c->pix_fmt.
> ---
>  libavfilter/buffersrc.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)

Well spotted. Pushed. Thanks.

Regards,

-- 
  Nicolas George


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 v2 4/4] avfilter/avfilter: update documentation of avfilter_graph_create_filter

2019-12-23 Thread Nicolas George
zhilizhao (12019-12-06):
> > + * with the parameters args. opaque is ignored currently.
> 
> It should be 'parameter args’. I will wait for more comments first.

I fixed it myself, swapped "currently ignored", added a precision in the
commit message of the first patch and pushed.

Thanks.

Regards,

-- 
  Nicolas George


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".

[FFmpeg-devel] [PATCH] avfilter/drawtext: log why input pad failed to be configured

2019-12-23 Thread Gyan Doshi
---
 libavfilter/vf_drawtext.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 8f4badbdb5..aea17b6793 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -829,6 +829,7 @@ static int config_input(AVFilterLink *inlink)
 {
 AVFilterContext *ctx = inlink->dst;
 DrawTextContext *s = ctx->priv;
+char *expr;
 int ret;
 
 ff_draw_init(>dc, inlink->format, FF_DRAW_PROCESS_ALPHA);
@@ -854,14 +855,15 @@ static int config_input(AVFilterLink *inlink)
 av_expr_free(s->a_pexpr);
 s->x_pexpr = s->y_pexpr = s->a_pexpr = NULL;
 
-if ((ret = av_expr_parse(>x_pexpr, s->x_expr, var_names,
+if ((ret = av_expr_parse(>x_pexpr, expr = s->x_expr, var_names,
  NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
-(ret = av_expr_parse(>y_pexpr, s->y_expr, var_names,
+(ret = av_expr_parse(>y_pexpr, expr = s->y_expr, var_names,
  NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
-(ret = av_expr_parse(>a_pexpr, s->a_expr, var_names,
- NULL, NULL, fun2_names, fun2, 0, ctx)) < 0)
-
+(ret = av_expr_parse(>a_pexpr, expr = s->a_expr, var_names,
+ NULL, NULL, fun2_names, fun2, 0, ctx)) < 0) {
+av_log(ctx, AV_LOG_ERROR, "Failed to parse expression: %s \n", expr);
 return AVERROR(EINVAL);
+}
 
 return 0;
 }
-- 
2.24.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 v2] avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device

2019-12-23 Thread Andriy Gelman
On Sat, 23. Nov 06:18, Andriy Gelman wrote:
> On Tue, 12. Nov 22:46, Andriy Gelman wrote:
> > From: Andriy Gelman 
> > 
> > Fixes #8079
> > 
> > During initialization of a v4l2m2m device, the configured pix_fmt can be
> > different to the pix_fmt of the encoder (i.e. avctx->pix_fmt).
> > 
> > For example on the Odroid XU4:
> > ./ffmpeg -f lavfi -i yuvtestsrc -codec:v h264_v4l2m2m out.h264
> > 
> > will configure the v4l2 encoder to pix_fmt nv21, whereas the input
> > frames will be yuv444p.
> > 
> > This commit checks that the configured v4l2 pix_fmt on device is the
> > same as avctx->pix_fmt. If they are different the initialization fails
> > and an error is returned. Tested on RPI4 and Odroid XU4.
> > 
> > Signed-off-by: Andriy Gelman 
> > ---
> >  libavcodec/v4l2_m2m_enc.c | 15 +++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> > index 474e6bef897..c0e82afe354 100644
> > --- a/libavcodec/v4l2_m2m_enc.c
> > +++ b/libavcodec/v4l2_m2m_enc.c
> > @@ -30,6 +30,7 @@
> >  #include "libavutil/opt.h"
> >  #include "v4l2_context.h"
> >  #include "v4l2_m2m.h"
> > +#include "v4l2_fmt.h"
> >  
> >  #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x
> >  #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x
> > @@ -288,6 +289,8 @@ static av_cold int v4l2_encode_init(AVCodecContext 
> > *avctx)
> >  V4L2Context *capture, *output;
> >  V4L2m2mContext *s;
> >  V4L2m2mPriv *priv = avctx->priv_data;
> > +enum AVPixelFormat pix_fmt_output;
> > +uint32_t v4l2_fmt_output;
> >  int ret;
> >  
> >  ret = ff_v4l2_m2m_create_context(priv, );
> > @@ -316,6 +319,18 @@ static av_cold int v4l2_encode_init(AVCodecContext 
> > *avctx)
> >  }
> >  s->avctx = avctx;
> >  
> > +if (V4L2_TYPE_IS_MULTIPLANAR(output->type))
> > +v4l2_fmt_output = output->format.fmt.pix_mp.pixelformat;
> > +else
> > +v4l2_fmt_output = output->format.fmt.pix.pixelformat;
> > +
> > +pix_fmt_output = ff_v4l2_format_v4l2_to_avfmt(v4l2_fmt_output, 
> > AV_CODEC_ID_RAWVIDEO);
> > +if (pix_fmt_output != avctx->pix_fmt) {
> > +const AVPixFmtDescriptor *desc = 
> > av_pix_fmt_desc_get(pix_fmt_output);
> > +av_log(priv, AV_LOG_ERROR, "Encoder requires %s pixel format.\n", 
> > desc->name);
> > +return AVERROR(EINVAL);
> > +}
> > +
> >  return v4l2_prepare_encoder(s);
> >  }
> >  
> > -- 
> > 2.23.0
> > 
> 
> ping 
> 

ping

-- 
Andriy
___
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/mpegtsenc: warn users if codec isn't supported

2019-12-23 Thread Gyan



On 23-12-2019 08:45 pm, Limin Wang wrote:

On Fri, Dec 20, 2019 at 04:55:12PM +0530, Gyan wrote:

Regards,
Gyan
 From fbbd221b089f3b272cfd712c3d4824dd86b4eac0 Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Fri, 20 Dec 2019 16:39:32 +0530
Subject: [PATCH] avformat/mpegtsenc: warn users if codec isn't supported

The MPEG-TS muxer will mux streams with unsupported codec id
as a private data stream; this usually makes the stream
not recognizable by ffmpeg and likely other tools.
---
  libavformat/mpegtsenc.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 5b4694bfd1..f24112465a 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -382,6 +382,7 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
  stream_type = STREAM_TYPE_METADATA;
  break;
  default:
+av_log(s, AV_LOG_WARNING, "Stream %d, codec %s, is muxed as a private data 
stream and may not be recognized upon reading.\n", i, 
avcodec_get_name(st->codecpar->codec_id));

I suggest that you can split long code into two lines.


Done. And pushed as f0b3b55002b7ad024ef94f005cd718a14d85e485

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] avformat/mpegtsenc: warn users if codec isn't supported

2019-12-23 Thread Limin Wang
On Fri, Dec 20, 2019 at 04:55:12PM +0530, Gyan wrote:
> 
> Regards,
> Gyan

> From fbbd221b089f3b272cfd712c3d4824dd86b4eac0 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi 
> Date: Fri, 20 Dec 2019 16:39:32 +0530
> Subject: [PATCH] avformat/mpegtsenc: warn users if codec isn't supported
> 
> The MPEG-TS muxer will mux streams with unsupported codec id
> as a private data stream; this usually makes the stream
> not recognizable by ffmpeg and likely other tools.
> ---
>  libavformat/mpegtsenc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 5b4694bfd1..f24112465a 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -382,6 +382,7 @@ static int mpegts_write_pmt(AVFormatContext *s, 
> MpegTSService *service)
>  stream_type = STREAM_TYPE_METADATA;
>  break;
>  default:
> +av_log(s, AV_LOG_WARNING, "Stream %d, codec %s, is muxed as a 
> private data stream and may not be recognized upon reading.\n", i, 
> avcodec_get_name(st->codecpar->codec_id));

I suggest that you can split long code into two lines.

>  stream_type = STREAM_TYPE_PRIVATE_DATA;
>  break;
>  }
> -- 
> 2.24.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".

___
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 v1] avutil/frame: Use av_realloc_array()

2019-12-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavutil/frame.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 1d0faec687..0a1ba877cc 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -696,11 +696,8 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame 
*frame,
 if (!buf)
 return NULL;
 
-if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
-return NULL;
-
-tmp = av_realloc(frame->side_data,
- (frame->nb_side_data + 1) * sizeof(*frame->side_data));
+tmp = av_realloc_array(frame->side_data,
+ (frame->nb_side_data + 1), sizeof(*frame->side_data));
 if (!tmp)
 return NULL;
 frame->side_data = tmp;
-- 
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 v2] avfilter/formats: optimize ff_all_formats

2019-12-23 Thread Nicolas George
Tomas Härdin (12019-12-09):
> As far as I can tell this is OK, and it passes FATE. But it just looks
> very very wrong. Why does this function even exist if all it
> effectively does is return the integers from 0..count-1?

For some time, there were gaps in the list of pixel formats, the task of
this function was precisely there to avoid the gaps and keep only the
actual pixel formats.

I am not sure about this change. It is technically valid, but it may
cause problems later.

There is an intermediate solution: keep the loop, but allocate only
once (simplified):

while ((desc = ...))
count++;
ret->formats = av_malloc_array(count, sizeof(*ret->formats));
count = 0;
while ((desc = ...))
ret->formats[count] = ...;

What do other developers think about it, with these explanations?

Regards,

-- 
  Nicolas George


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".

[FFmpeg-devel] [PATCH] lavc/midivid: check return value of init_get_bits8()

2019-12-23 Thread Zhong Li
Fix CID 1456088

Signed-off-by: Zhong Li 
---
 libavcodec/midivid.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
index 38465c5..bb5105b 100644
--- a/libavcodec/midivid.c
+++ b/libavcodec/midivid.c
@@ -63,7 +63,7 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext 
*avctx, AVFrame *frame)
 if (intra_flag) {
 nb_blocks = (avctx->width / 2) * (avctx->height / 2);
 } else {
-int skip_linesize;
+int ret, skip_linesize;
 
 nb_blocks = bytestream2_get_le32(gb);
 skip_linesize = avctx->width >> 1;
@@ -73,7 +73,9 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext 
*avctx, AVFrame *frame)
 if (bytestream2_get_bytes_left(gb) < mask_size)
 return AVERROR_INVALIDDATA;
 
-init_get_bits8(, mask_start, mask_size);
+ret = init_get_bits8(, mask_start, mask_size);
+if (ret < 0)
+return ret;
 bytestream2_skip(gb, mask_size);
 skip = s->skip;
 
-- 
1.8.3.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] lavfi: add mbfequalizer filter.

2019-12-23 Thread James Almer
On 12/23/2019 10:25 AM, Nicolas George wrote:
> Thanks for the comment.
> 
> James Almer (12019-12-23):
>>> +frame_out = ff_get_audio_buffer(ctx->outputs[0], 
>>> frame->nb_samples);
> 
>> Can't you use av_frame_make_writable() instead to simplify this?
> 
> No, because it does not use ff_get_audio_buffer(), and therefore does
> not allow direct rendering. Also, it unnecessarily copies the data. I
> have already noted that this is a frequent pattern in filters that
> should be factored soon.
> 
> Regards,

I see, thanks for the clarification.

> 
> 
> ___
> 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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread Zhong Li
James Almer  于2019年12月23日周一 下午9:09写道:
>
> On 12/23/2019 9:31 AM, Zhong Li wrote:
> > James Almer  于2019年12月22日周日 下午11:29写道:
> >>
> >> On 12/22/2019 12:26 PM, Zhong Li wrote:
> >>> Signed-off-by: Zhong Li 
> >>> ---
> >>>  libavcodec/midivid.c | 9 ++---
> >>>  1 file changed, 6 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
> >>> index 38465c5..3dac3f1 100644
> >>> --- a/libavcodec/midivid.c
> >>> +++ b/libavcodec/midivid.c
> >>> @@ -63,17 +63,20 @@ static int decode_mvdv(MidiVidContext *s, 
> >>> AVCodecContext *avctx, AVFrame *frame)
> >>>  if (intra_flag) {
> >>>  nb_blocks = (avctx->width / 2) * (avctx->height / 2);
> >>>  } else {
> >>> -int skip_linesize;
> >>> +int ret, skip_linesize;
> >>>
> >>>  nb_blocks = bytestream2_get_le32(gb);
> >>>  skip_linesize = avctx->width >> 1;
> >>>  mask_start = gb->buffer_start + bytestream2_tell(gb);
> >>>  mask_size = (avctx->width >> 5) * (avctx->height >> 2);
> >>>
> >>> -if (bytestream2_get_bytes_left(gb) < mask_size)
> >>> +ret = bytestream2_get_bytes_left(gb);
> >>> +if (ret < mask_size)
> >>
> >> What is this fixing?
> >
> > Not fix. Just want to use same coding stytle as following.
>
> Unless you need it to return a value, then no point in making this change.
>
> Add the init_get_bits8() check only, and make it return ret as others
> suggested. Also, the commit subject should be something like
> "lavc/midivid: check return value of init_get_bits8()", and the CID
> 1456088 comment added further down in the commit message.

Yeah, thanks for comments. Will update.
___
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] lavfi: add mbfequalizer filter.

2019-12-23 Thread Nicolas George
Thanks for the comment.

James Almer (12019-12-23):
> > +frame_out = ff_get_audio_buffer(ctx->outputs[0], 
> > frame->nb_samples);

> Can't you use av_frame_make_writable() instead to simplify this?

No, because it does not use ff_get_audio_buffer(), and therefore does
not allow direct rendering. Also, it unnecessarily copies the data. I
have already noted that this is a frequent pattern in filters that
should be factored soon.

Regards,

-- 
  Nicolas George


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] lavfi: add mbfequalizer filter.

2019-12-23 Thread James Almer
On 12/23/2019 8:17 AM, Nicolas George wrote:
> TODO changelog and version bump
> 
> Signed-off-by: Nicolas George 
> ---
>  doc/filters.texi  |  48 +++
>  libavfilter/Makefile  |   1 +
>  libavfilter/af_mbfequalizer.c | 567 ++
>  libavfilter/allfilters.c  |   1 +
>  4 files changed, 617 insertions(+)
>  create mode 100644 libavfilter/af_mbfequalizer.c
> 
> 
> I think I'll rewrite the bands parser to allow per-channel options and make
> the structure of the code clearer. But I can already send the whole patch
> for your consideration.

[...]

> +static int filter_frame(AVFilterLink *link, AVFrame *frame)
> +{
> +AVFilterContext *ctx = link->dst;
> +EqContext *s = ctx->priv;
> +AVFrame *frame_out;
> +
> +if (av_frame_is_writable(frame)) {
> +frame_out = frame;
> +} else {
> +frame_out = ff_get_audio_buffer(ctx->outputs[0], frame->nb_samples);
> +if (!frame_out) {
> +av_frame_free();
> +return AVERROR(ENOMEM);
> +}
> +}

Can't you use av_frame_make_writable() instead to simplify this?
___
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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread James Almer
On 12/23/2019 9:31 AM, Zhong Li wrote:
> James Almer  于2019年12月22日周日 下午11:29写道:
>>
>> On 12/22/2019 12:26 PM, Zhong Li wrote:
>>> Signed-off-by: Zhong Li 
>>> ---
>>>  libavcodec/midivid.c | 9 ++---
>>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
>>> index 38465c5..3dac3f1 100644
>>> --- a/libavcodec/midivid.c
>>> +++ b/libavcodec/midivid.c
>>> @@ -63,17 +63,20 @@ static int decode_mvdv(MidiVidContext *s, 
>>> AVCodecContext *avctx, AVFrame *frame)
>>>  if (intra_flag) {
>>>  nb_blocks = (avctx->width / 2) * (avctx->height / 2);
>>>  } else {
>>> -int skip_linesize;
>>> +int ret, skip_linesize;
>>>
>>>  nb_blocks = bytestream2_get_le32(gb);
>>>  skip_linesize = avctx->width >> 1;
>>>  mask_start = gb->buffer_start + bytestream2_tell(gb);
>>>  mask_size = (avctx->width >> 5) * (avctx->height >> 2);
>>>
>>> -if (bytestream2_get_bytes_left(gb) < mask_size)
>>> +ret = bytestream2_get_bytes_left(gb);
>>> +if (ret < mask_size)
>>
>> What is this fixing?
> 
> Not fix. Just want to use same coding stytle as following.

Unless you need it to return a value, then no point in making this change.

Add the init_get_bits8() check only, and make it return ret as others
suggested. Also, the commit subject should be something like
"lavc/midivid: check return value of init_get_bits8()", and the CID
1456088 comment added further down in the commit message.
___
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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread Paul B Mahol
On 12/22/19, Zhong Li  wrote:
> Signed-off-by: Zhong Li 
> ---
>  libavcodec/midivid.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
> index 38465c5..3dac3f1 100644
> --- a/libavcodec/midivid.c
> +++ b/libavcodec/midivid.c
> @@ -63,17 +63,20 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext
> *avctx, AVFrame *frame)
>  if (intra_flag) {
>  nb_blocks = (avctx->width / 2) * (avctx->height / 2);
>  } else {
> -int skip_linesize;
> +int ret, skip_linesize;
>
>  nb_blocks = bytestream2_get_le32(gb);
>  skip_linesize = avctx->width >> 1;
>  mask_start = gb->buffer_start + bytestream2_tell(gb);
>  mask_size = (avctx->width >> 5) * (avctx->height >> 2);
>
> -if (bytestream2_get_bytes_left(gb) < mask_size)
> +ret = bytestream2_get_bytes_left(gb);
> +if (ret < mask_size)
>  return AVERROR_INVALIDDATA;

Pointless

>
> -init_get_bits8(, mask_start, mask_size);
> +ret = init_get_bits8(, mask_start, mask_size);
> +if (ret < 0)
> +return AVERROR_INVALIDDATA;

ret should be returned here

>  bytestream2_skip(gb, mask_size);
>  skip = s->skip;
>
> --
> 1.8.3.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".
___
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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread Zhong Li
James Almer  于2019年12月22日周日 下午11:29写道:
>
> On 12/22/2019 12:26 PM, Zhong Li wrote:
> > Signed-off-by: Zhong Li 
> > ---
> >  libavcodec/midivid.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
> > index 38465c5..3dac3f1 100644
> > --- a/libavcodec/midivid.c
> > +++ b/libavcodec/midivid.c
> > @@ -63,17 +63,20 @@ static int decode_mvdv(MidiVidContext *s, 
> > AVCodecContext *avctx, AVFrame *frame)
> >  if (intra_flag) {
> >  nb_blocks = (avctx->width / 2) * (avctx->height / 2);
> >  } else {
> > -int skip_linesize;
> > +int ret, skip_linesize;
> >
> >  nb_blocks = bytestream2_get_le32(gb);
> >  skip_linesize = avctx->width >> 1;
> >  mask_start = gb->buffer_start + bytestream2_tell(gb);
> >  mask_size = (avctx->width >> 5) * (avctx->height >> 2);
> >
> > -if (bytestream2_get_bytes_left(gb) < mask_size)
> > +ret = bytestream2_get_bytes_left(gb);
> > +if (ret < mask_size)
>
> What is this fixing?

Not fix. Just want to use same coding stytle as following.
___
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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread Nicolas George
Zhong Li (12019-12-23):
> > Then review that ret needs to be returned ;-) It needs more change, not
 
> > less.
> 
> Could specify what "more change" is needed?

See above, I underlined it.

Regards,

-- 
  Nicolas George


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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread Zhong Li
Nicolas George  于2019年12月23日周一 下午5:00写道:
>
> Limin Wang (12019-12-23):
> > But It's not my code, I'm a code reviewer.
>
> Then review that ret needs to be returned ;-) It needs more change, not
> less.

Could specify what "more change" is needed?
___
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 v4] avfilter/buffersrc: deprecate sws_param option

2019-12-23 Thread Nicolas George
myp...@gmail.com (12019-12-12):
> LGTM, but  need to wait next release cycle?

What do you mean? There is all the necessary code to let the option
disappear automatically at the next release.

I shall push soon, unless you point something I have missed.

Regards,

-- 
  Nicolas George


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 1/5] lavfi/buffersrc: remove fifo.

2019-12-23 Thread Nicolas George
Nicolas George (12019-12-17):
> I will push these five patches soon unless somebody object.

Pushed.

Regards,

-- 
  Nicolas George


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 3/5] avfilter/scale: separate exprs parse and eval

2019-12-23 Thread Gyan

Ping x2

On 20-12-2019 11:24 am, Gyan wrote:

Ping for this and remaining patches in set.

On 17-12-2019 02:55 pm, Gyan wrote:



On 17-12-2019 01:44 am, Michael Niedermayer wrote:

On Sun, Dec 15, 2019 at 10:36:58PM +0530, Gyan wrote:

3rd of 5 factorized patches; supersedes
https://patchwork.ffmpeg.org/patch/16272/
  scale_eval.c |   69 --
  vf_scale.c   |  286 
+++

  2 files changed, 271 insertions(+), 84 deletions(-)
2a3ae4ce4e91893fddb020485e6936c82894eb81 
0003-avfilter-scale-separate-exprs-parse-and-eval.patch
 From 00b54948b88ae60aa3ab7c158b98e55cb8b967d3 Mon Sep 17 00:00:00 
2001

From: Gyan Doshi 
Date: Thu, 12 Dec 2019 22:54:31 +0530
Subject: [PATCH 3/5] avfilter/scale: separate exprs parse and eval

Will allow adding animation support.

[...]
@@ -566,19 +746,87 @@ static int process_command(AVFilterContext 
*ctx, const char *cmd, const char *ar

 char *res, int res_len, int flags)
  {
  ScaleContext *scale = ctx->priv;
-    int ret;
+    AVFilterLink *outlink = ctx->outputs[0];
+    char *old_w_str, *old_h_str;
+    AVExpr *old_w_pexpr, *old_h_pexpr;
+    int ret, w = 0, h = 0;
+    const char scale2ref = ctx->filter == _vf_scale2ref;
+    const char *const *names = scale2ref ? var_names_scale2ref : 
var_names;

+
+    w = !strcmp(cmd, "width")  || !strcmp(cmd, "w");
+    h = !strcmp(cmd, "height")  || !strcmp(cmd, "h");
+
+    if (w || h) {
  -    if (   !strcmp(cmd, "width")  || !strcmp(cmd, "w")
-    || !strcmp(cmd, "height") || !strcmp(cmd, "h")) {
+    if (w) {
+    old_w_str = av_strdup(scale->w_expr);
+    if (!old_w_str)
+    return AVERROR(ENOMEM);
+    old_w_pexpr = scale->w_pexpr;
+    scale->w_pexpr = NULL;
+    }
  -    int old_w = scale->w;
-    int old_h = scale->h;
-    AVFilterLink *outlink = ctx->outputs[0];
+    if (h) {
+    old_h_str = av_strdup(scale->h_expr);
+    if (!old_h_str)
+    return AVERROR(ENOMEM);
+    old_h_pexpr = scale->h_pexpr;
+    scale->h_pexpr = NULL;
+    }
    av_opt_set(scale, cmd, args, 0);
+
+    if (w) {
+    ret = av_expr_parse(>w_pexpr, scale->w_expr,
+    names,
+    NULL, NULL, NULL, NULL, 0, ctx);
+    if (ret < 0) {
+    av_log(ctx, AV_LOG_ERROR, "Cannot parse width 
expression: '%s'\n", scale->w_expr);

+    av_opt_set(scale, "w", old_w_str, 0);
+    av_free(old_w_str);
+    scale->w_pexpr = old_w_pexpr;
+    return ret;
+    }
+    }
+
+    if (h) {
+    ret = av_expr_parse(>h_pexpr, scale->h_expr,
+    names,
+    NULL, NULL, NULL, NULL, 0, ctx);
+    if (ret < 0) {
+    av_log(ctx, AV_LOG_ERROR, "Cannot parse height 
expression: '%s'\n", scale->h_expr);

+    av_opt_set(scale, "h", old_h_str, 0);
+    av_free(old_h_str);
+    scale->h_pexpr = old_h_pexpr;
+    return ret;
+    }
+    }
+
  if ((ret = config_props(outlink)) < 0) {
-    scale->w = old_w;
-    scale->h = old_h;
+
+    if (w) {
+    av_opt_set(scale, "w", old_w_str, 0);
+    av_free(old_w_str);
+    av_expr_free(scale->w_pexpr);
+    scale->w_pexpr = old_w_pexpr;
+    }
+    if (h) {
+    av_opt_set(scale, "h", old_h_str, 0);
+    av_free(old_h_str);
+    av_expr_free(scale->h_pexpr);
+    scale->h_pexpr = old_h_pexpr;
+    }
+    av_log(ctx, AV_LOG_ERROR, "Command failed. Continuing 
with existing parameters.\n");

+    return ret;
+    }

the cleanup code is duplicated

also if you can make the overall change this patch is making
cleaner/clearer that would be welcome too. Its just a feeling
but this seems more messy than what i would expect from spliting
parse out


More compact v2 patch attached.

Which changes do you find messy? Once parse and eval are separated, 
the AVExpr and expr strings are backed up for restoration should the 
command fail.


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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To 

[FFmpeg-devel] [PATCH] lavfi: add mbfequalizer filter.

2019-12-23 Thread Nicolas George
TODO changelog and version bump

Signed-off-by: Nicolas George 
---
 doc/filters.texi  |  48 +++
 libavfilter/Makefile  |   1 +
 libavfilter/af_mbfequalizer.c | 567 ++
 libavfilter/allfilters.c  |   1 +
 4 files changed, 617 insertions(+)
 create mode 100644 libavfilter/af_mbfequalizer.c


I think I'll rewrite the bands parser to allow per-channel options and make
the structure of the code clearer. But I can already send the whole patch
for your consideration.


diff --git a/doc/filters.texi b/doc/filters.texi
index 8c5d3a5760..c6917fad38 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4383,6 +4383,54 @@ 
lv2=p=http://www.openavproductions.com/artyfx#bitta:c=crush=0.3
 @end example
 @end itemize
 
+@section mbfequalizer
+Multiband fast equalizer.
+
+As an equalizer, it allows to selectively alter the volume of the different
+frequencies in the audio signal. This particular equalizer does not allow a
+very sharp separation of the frequencies, but that gives it other
+advantages. It is rather fast. It does not add latency. It supports all
+sample formats, and for integer formats it uses bit-exact integer
+arithmetic.
+
+It accepts the following parameters:
+
+@table @option
+@item defs
+Definition of bands and gain. The syntax is:
+"gain/freq/gain[/freq/gain...][|gain/freq/gain...]"
+where @var{freq} is the cut frequency between bands and @var{gain} the
+associated gain.
+Gain and bands for several channels can be defined by separating them with
+the pipe "|" character; if only one definition is given, it is used for all
+channels; otherwise, the number of definitions must match the number of
+input channels.
+Frequencies should be in ascending order. Gain greater than 1 or negative
+may result in overflows and ugly noise or other strange results.
+
+@item global_gain
+Gain applied to all channels and all bands. Can be greater than 1 without
+risk; in case of overflow, soft clipping is applied.
+
+@item keep_all_bands
+By default, bands beyond @var{sample_rate}/4 are discarded. If this option
+is enabled, they are kept; it can result in strange effects.
+@end table
+
+A Gnuplot formula mapping the frequency to the gain is printed at verbose
+log level. It can be used to check the result, proably with
+"set logscale x; db(x) = 20*log(x)/log(10); plot [20:2000] db(...)".
+
+@subsection Examples
+
+Assuming 3.1 input, reduce high frequencies on left and right, keep a narrow
+band on center and dampen bass on LFE. All gains were lowered by 5dB, then
+raised again using global gain, and the -2.8dB for the middle band was found
+by looking at the graph.
+@example
+mbfequalizer=-5dB/7040/-15dB|-5dB/7040/-15dB|0/220/-2.8dB/880/0|-10dB/110/-5dB:global_gain=+5dB
+@end example
+
 @section mcompand
 Multiband Compress or expand the audio's dynamic range.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 37d4eee858..f5690a50db 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -124,6 +124,7 @@ OBJS-$(CONFIG_LOWPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_LOWSHELF_FILTER)   += af_biquads.o
 OBJS-$(CONFIG_LV2_FILTER)+= af_lv2.o
 OBJS-$(CONFIG_MCOMPAND_FILTER)   += af_mcompand.o
+OBJS-$(CONFIG_MBFEQUALIZER_FILTER)   += af_mbfequalizer.o
 OBJS-$(CONFIG_PAN_FILTER)+= af_pan.o
 OBJS-$(CONFIG_REPLAYGAIN_FILTER) += af_replaygain.o
 OBJS-$(CONFIG_RESAMPLE_FILTER)   += af_resample.o
diff --git a/libavfilter/af_mbfequalizer.c b/libavfilter/af_mbfequalizer.c
new file mode 100644
index 00..aadd3cb3da
--- /dev/null
+++ b/libavfilter/af_mbfequalizer.c
@@ -0,0 +1,567 @@
+/*
+ * Copyright (c) 2019 Nicolas George 
+ *
+ * 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
+ */
+
+/*
+ * Low-pass-high-pass equalizer using a simple sliding weighed average.
+ *
+ * Input signal: u(t)
+ * Low freqs:a(t)
+ * High freqs:   b(t)
+ *
+ * a(t) = (1-k) a(t-1) + k u(t)
+ * b(t) = u(t) - a(t)
+ *
+ * F = sample frequency; f = input frequency; ω = 2πf/F
+ * For u(t) = exp(iωt),
+ * a(t) = k/(1-exp(-iω)(1-k)) exp(iwt)
+ * b(t) = (1-k)(1-exp(-iω))/(1-exp(-iω)(1-k)) exp(iwt)
+ * hi/low = (1-k)(1-exp(-iω)) / k
+ * R(k,w) 

Re: [FFmpeg-devel] [PATCH] Fix spelling in ID3v1 genres and extend the list of Winamp extensions.

2019-12-23 Thread Ulrich Spörlein
On Sun, 2019-12-22 at 18:44:01 +0100, Michael Niedermayer wrote:
> a reference to a VCS should include the version
> similarly for wikipedia some revission of the page should be mentioned in
> the commit message

Heh, this is already a defunct standard, I doubt it will ever change
again. I've updated the commit message to provide more direct links to
fixed versions in time, hth, please see attached.


>From 55601483bdc8c002f3b8c19f830ab6ebbf4586cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20Sp=C3=B6rlein?= 
Date: Thu, 19 Dec 2019 16:12:46 +0100
Subject: [PATCH] libavformat: fix spelling in ID3v1 genres and extend the list
 of Winamp extensions.

Sources include various lists on the Internet, as well as the current
Wikipedia page at
https://en.wikipedia.org/w/index.php?title=List_of_ID3v1_Genres=896774343
but most importantly the list as used by taglib at
https://github.com/taglib/taglib/commit/3e60e339a4bc46e2a1a7aea782502480561a8acf#diff-f86455366624350770f41b4940925dde

Further patches to harmonize the spelling have been sent to taglib and
libid3tag. See also https://github.com/taglib/taglib/pull/942/
---
 libavformat/id3v1.c | 58 +++--
 libavformat/id3v1.h |  2 +-
 2 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c
index 19be42121d..eb66098f51 100644
--- a/libavformat/id3v1.c
+++ b/libavformat/id3v1.c
@@ -92,7 +92,7 @@ const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
  [64] = "Native American",
  [65] = "Cabaret",
  [66] = "New Wave",
- [67] = "Psychadelic", /* sic, the misspelling is used in the specification */
+ [67] = "Psychedelic",
  [68] = "Rave",
  [69] = "Showtunes",
  [70] = "Trailer",
@@ -110,7 +110,7 @@ const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
  [82] = "National Folk",
  [83] = "Swing",
  [84] = "Fast Fusion",
- [85] = "Bebob",
+ [85] = "Bebop",
  [86] = "Latin",
  [87] = "Revival",
  [88] = "Celtic",
@@ -148,20 +148,20 @@ const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
 [120] = "Duet",
 [121] = "Punk Rock",
 [122] = "Drum Solo",
-[123] = "A capella",
+[123] = "A Cappella",
 [124] = "Euro-House",
 [125] = "Dance Hall",
 [126] = "Goa",
 [127] = "Drum & Bass",
 [128] = "Club-House",
-[129] = "Hardcore",
+[129] = "Hardcore Techno",
 [130] = "Terror",
 [131] = "Indie",
 [132] = "BritPop",
 [133] = "Negerpunk",
 [134] = "Polsk Punk",
 [135] = "Beat",
-[136] = "Christian Gangsta",
+[136] = "Christian Gangsta Rap",
 [137] = "Heavy Metal",
 [138] = "Black Metal",
 [139] = "Crossover",
@@ -171,8 +171,52 @@ const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
 [143] = "Salsa",
 [144] = "Thrash Metal",
 [145] = "Anime",
-[146] = "JPop",
-[147] = "SynthPop",
+[146] = "Jpop",
+[147] = "Synthpop",
+[148] = "Abstract",
+[149] = "Art Rock",
+[150] = "Baroque",
+[151] = "Bhangra",
+[152] = "Big Beat",
+[153] = "Breakbeat",
+[154] = "Chillout",
+[155] = "Downtempo",
+[156] = "Dub",
+[157] = "EBM",
+[158] = "Eclectic",
+[159] = "Electro",
+[160] = "Electroclash",
+[161] = "Emo",
+[162] = "Experimental",
+[163] = "Garage",
+[164] = "Global",
+[165] = "IDM",
+[166] = "Illbient",
+[167] = "Industro-Goth",
+[168] = "Jam Band",
+[169] = "Krautrock",
+[170] = "Leftfield",
+[171] = "Lounge",
+[172] = "Math Rock",
+[173] = "New Romantic",
+[174] = "Nu-Breakz",
+[175] = "Post-Punk",
+[176] = "Post-Rock",
+[177] = "Psytrance",
+[178] = "Shoegaze",
+[179] = "Space Rock",
+[180] = "Trop Rock",
+[181] = "World Music",
+[182] = "Neoclassical",
+[183] = "Audiobook",
+[184] = "Audio Theatre",
+[185] = "Neue Deutsche Welle",
+[186] = "Podcast",
+[187] = "Indie Rock",
+[188] = "G-Funk",
+[189] = "Dubstep",
+[190] = "Garage Rock",
+[191] = "Psybient"
 };
 
 static void get_string(AVFormatContext *s, const char *key,
diff --git a/libavformat/id3v1.h b/libavformat/id3v1.h
index d5dca35873..b3ad16df6c 100644
--- a/libavformat/id3v1.h
+++ b/libavformat/id3v1.h
@@ -26,7 +26,7 @@
 
 #define ID3v1_TAG_SIZE 128
 
-#define ID3v1_GENRE_MAX 147
+#define ID3v1_GENRE_MAX 191
 
 /**
  * ID3v1 genres
-- 
2.24.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] avfilter/image2: Add source file path and basename to each packet side data.

2019-12-23 Thread Michael Niedermayer
On Mon, Dec 23, 2019 at 12:19:21AM +, alexandre.schm...@gmail.com wrote:
> >
> > not sure why i just now realize it but
> >
> > Storing the source path is problematic privacy and security wise
> >
> > Thanks
> >
> 
> What does this means? That it won't be applied?
> 
> Can you give an example on why this would be a security issue, considering
> you already have it anywhere, only not available to filters until now?
> 
> Besides, isn't metadata way more sensitive than a simple file path?

About security
The file path can reveal a wide range of information like
The platform used, 
The username, 
A potentially writable location
And a lot more depending on how the directories are layed out

About privacy
The username is commonly related to the users real name, thats
sensitive information
And a lot more depending on how the directories are layed out
consider a doctors office might have directories which use the
patients social security numbers in the path

The problem here is this is new metadata, the input never contained
this sensitive data but depending on what is done downstream with
it the output might contain this sensitive metadata

converting inputfile to outputfile shouldnt result in outputfile
containing sensitive information that wasnt in the input and that
the user did not explicitly ask for to be addded

To show why for example thers a privacy concern here, a slightly
unfunny hypothetical example:
A girl gets stalked by some guy online, she takes a screenshoot of
the message the guy sent her on facebook. And uploads that picture
sadly the picture contains her name, phone number and GPS coordinates
without her knowing. 

About "That it won't be applied?" 
I think the feature makes sense but it must be ensured that sensitive
data isnt added or leaking somewhere without the users knowledge and
concent

Thanks

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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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] avfilter/image2: Add source file path and basename to each packet side data.

2019-12-23 Thread Marton Balint



On Mon, 23 Dec 2019, alexandre.schm...@gmail.com wrote:


not sure why i just now realize it but


Storing the source path is problematic privacy and security wise

Thanks



What does this means? That it won't be applied?


It only means that you may have to only activate this (or at least the 
full path metadata) feature if the user explicitly requests it. Probably 
the best way to do that is to introduce a new option of the image2 
demuxer, probably with an AV_OPT_TYPE_FLAGS type.




Can you give an example on why this would be a security issue, considering
you already have it anywhere, only not available to filters until now?

Besides, isn't metadata way more sensitive than a simple file path?


The problem is possible leaking of information about the system which 
processed the file, because it is typically not disclosed in an output 
file where the system stores media files it processes.


Regards,
Marton
___
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 V2] lavc/midivid: FIX CID 1456088

2019-12-23 Thread Nicolas George
Limin Wang (12019-12-23):
> But It's not my code, I'm a code reviewer.

Then review that ret needs to be returned ;-) It needs more change, not
less.

And the commit message needs to be explicit. CID may not be available
everywhere or everywhen.

Regards,

-- 
  Nicolas George


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".