Re: [FFmpeg-devel] [RFC] Event loop

2021-01-03 Thread Peter Ross
On Thu, Dec 31, 2020 at 02:37:21PM +0100, Nicolas George wrote:
> This mail is about a project I have to make FFmpeg's API and
> infrastructure more convenient. For a common introduction, see this thread:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/274167.html
> 
> The API to access our protocols, in particular network protocols, is copied
> from the Unix file descriptor API, basically read() and write(). While this
> API is very simple and convenient when it works, it works mostly only with
> simple applications that do with only one input or output at a time. Extra
> features like timeouts or handling several streams simultaneously are
> complex to add.
> 
> Furthermore, timeouts and non-blocking mode are currently done with a
> periodic polling, which makes the application always active and can prevent
> embedded devices from going into deep sleep, draining the battery.
> 
> I want to replace it with an event loop. That means that instead of reading
> on a protocol context, we would register a callback for when data is
> available, and then let the loop run.
> 
> Of course, a compatibility layer will still allow to read directly.

Majority of our demuxers and muxers assume a blocking model. Will they need to 
be
rewritten (eventually) to use event-based i/o?

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Andreas Rheinhardt
Jonathan Baudanza:
> On Sun, Jan 3, 2021, at 3:34 PM, Andreas Rheinhardt wrote:
>> Lynne:
>>>
>>> Apart from that LGTM.
>>
>> +1 if the case of more than two channels has been properly tested.
>>
> 
> I tested this by creating an (invalid) SDP file with channels set to 3. In 
> this case, the rtp demuxer fails with the following message:
> 
>[sdp @ 0x7fe40280b800] Error creating opus extradata: Invalid data found 
> when processing input
> 
> It might be more descriptive if we added a log warning about the channel 
> count. WDYT?

It's ok as-is.

- 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 V2 1/3] dnn: fix redefining typedefs and also refine naming with correct prefix

2021-01-03 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Anton
> Khirnov
> Sent: 2021年1月4日 1:31
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2 1/3] dnn: fix redefining typedefs and
> also refine naming with correct prefix
> 
> Quoting Guo, Yejun (2020-12-30 16:35:06)
> > The prefix for symbols not exported from the library and not local to
> > one translation unit is ff_ (or FF for types).
> >
> > Signed-off-by: Guo, Yejun 
> > ---
> >  libavfilter/dnn/dnn_backend_openvino.c | 32 ++---
> >  libavfilter/dnn/queue.c| 66 +-
> >  libavfilter/dnn/queue.h| 20 
> >  libavfilter/dnn/safe_queue.c   | 34 ++---
> >  libavfilter/dnn/safe_queue.h   | 14 +++---
> >  5 files changed, 83 insertions(+), 83 deletions(-)
> >
> > diff --git a/libavfilter/dnn/dnn_backend_openvino.c
> > b/libavfilter/dnn/dnn_backend_openvino.c
> > index a35d72a38c..331f13b263 100644
> > --- a/libavfilter/dnn/dnn_backend_openvino.c
> > +++ b/libavfilter/dnn/dnn_backend_openvino.c
> > @@ -53,8 +53,8 @@ typedef struct OVModel{
> >  ie_infer_request_t *infer_request;
> >
> >  /* for async execution */
> > -safe_queue *request_queue;  // holds RequestItem
> > -queue *task_queue;  // holds TaskItem
> > +FFSafeQueue *request_queue;   // holds RequestItem
> > +FFQueue *task_queue;  // holds TaskItem
> 
> Note that the ff prefix is only required for functions, to avoid conflicts 
> with
> static linking. Struct names are not a part of the ABI, so no namespacing is
> needed for private structs.

thanks, will change to SaftQueue and Queue if no other comments.

> 
> --
> Anton Khirnov
> ___
> 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 to libavc/opus to create extradata if missing

2021-01-03 Thread Jonathan Baudanza
On Sun, Jan 3, 2021, at 3:34 PM, Andreas Rheinhardt wrote:
> Lynne:
> >
> > Apart from that LGTM.
> 
> +1 if the case of more than two channels has been properly tested.
> 

I tested this by creating an (invalid) SDP file with channels set to 3. In this 
case, the rtp demuxer fails with the following message:

   [sdp @ 0x7fe40280b800] Error creating opus extradata: Invalid data found 
when processing input

It might be more descriptive if we added a log warning about the channel count. 
WDYT?
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Andreas Rheinhardt
Lynne:
> Jan 3, 2021, 23:48 by j...@jonb.org:
> 
>>
>>
>> On Sun, Jan 3, 2021, at 2:25 PM, Lynne wrote:
>>
 +/* Input sample rate (0 = unspecified) */> +bytestream_put_le32  
 (, 0);
>>> Put in 48000 here. Stream copy will preserve extradata, and we don't want to
>>> generate weird streams, even if our decoder ignores this.
>>>
 +/* Channel count */> +bytestream_put_byte  (, 
 codecpar->channels);> +/* Mapping family */> +bytestream_put_byte  
 (, 0x0);
>>> This will only work for mono and stereo. The decoder will error out if more 
>>> than
>>> 2 channels are present. For now maybe error out if the number of channels 
>>> is greater than 2?
>>>
>>
>> Ok! Sample rate changed to 48000. If codecpar->channels is greater than 2, 
>> AVERROR_INVALIDDATA will be returned. Please advise if there is a better 
>> error code.
>>
>> Thanks Lynne!
>>
> 
>> +static int opus_write_extradata(AVCodecParameters *codecpar) {
> Function opening brackets must be put by themselves on a new line.
> 
>> +    if (codecpar->channels > 2) { 
>> +    return AVERROR_INVALIDDATA;
>> +    }
>> +
>> +    ret = ff_alloc_extradata(codecpar, 19);
>> +    if (ret < 0) {
>> +    return ret;
>> +    }
> We don't wrap 1-line conditions in brackets, so just remove them.
> 
>> +    av_log(s1, AV_LOG_ERROR, 
>> +    "Error creating opus extradata: %s\n",
>> +    av_err2str(ret));
> Weird indentation. There's an extra space in the 2 lines.
> 
> Apart from that LGTM.

+1 if the case of more than two channels has been properly tested.

- 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] [PATCH 16/16] avfilter/vsrc_testsrc: Deduplicate options

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vsrc_testsrc.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index cf9fa4b2b2..7001f9ba16 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -99,6 +99,9 @@ typedef struct TestSourceContext {
 
 #define COMMON_OPTIONS SIZE_OPTIONS COMMON_OPTIONS_NOSIZE
 
+#define NOSIZE_OPTIONS_OFFSET 2
+/* Filters using COMMON_OPTIONS_NOSIZE also use the following options
+ * via [NOSIZE_OPTIONS_OFFSET]. So don't break it. */
 static const AVOption options[] = {
 COMMON_OPTIONS
 { NULL }
@@ -1653,11 +1656,7 @@ AVFilter ff_vsrc_smptehdbars = {
 
 #if CONFIG_ALLYUV_FILTER
 
-static const AVOption allyuv_options[] = {
-COMMON_OPTIONS_NOSIZE
-{ NULL }
-};
-
+#define allyuv_options [NOSIZE_OPTIONS_OFFSET]
 AVFILTER_DEFINE_CLASS(allyuv);
 
 static void allyuv_fill_picture(AVFilterContext *ctx, AVFrame *frame)
@@ -1734,11 +1733,7 @@ AVFilter ff_vsrc_allyuv = {
 
 #if CONFIG_ALLRGB_FILTER
 
-static const AVOption allrgb_options[] = {
-COMMON_OPTIONS_NOSIZE
-{ NULL }
-};
-
+#define allrgb_options [NOSIZE_OPTIONS_OFFSET]
 AVFILTER_DEFINE_CLASS(allrgb);
 
 static void allrgb_fill_picture(AVFilterContext *ctx, AVFrame *frame)
-- 
2.25.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] [PATCH 15/16] avfilter/af_biquads: Don't redundantly set AVClass

2021-01-03 Thread Andreas Rheinhardt
It is already set generically in ff_filter_alloc().

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/af_biquads.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 4774dfc5b6..4a09f8204a 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -873,7 +873,6 @@ AVFILTER_DEFINE_CLASS(name_);   
\
 static av_cold int name_##_init(AVFilterContext *ctx)   \
 {   \
 BiquadsContext *s = ctx->priv;  \
-s->class = _##_class;  \
 s->filter_type = name_; \
 return 0;   \
 }   \
-- 
2.25.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] [PATCH 14/16] avfilter/af_biquads: Deduplicate options

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/af_biquads.c | 106 ---
 1 file changed, 20 insertions(+), 86 deletions(-)

diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 92e711bc4f..4774dfc5b6 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -931,8 +931,8 @@ static const AVOption equalizer_options[] = {
 
 DEFINE_BIQUAD_FILTER(equalizer, "Apply two-pole peaking equalization (EQ) 
filter.");
 #endif  /* CONFIG_EQUALIZER_FILTER */
-#if CONFIG_BASS_FILTER
-static const AVOption bass_options[] = {
+#if CONFIG_BASS_FILTER || CONFIG_LOWSHELF_FILTER
+static const AVOption bass_lowshelf_options[] = {
 {"frequency", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 99, FLAGS},
 {"f", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 99, FLAGS},
 {"width_type", "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
@@ -970,10 +970,18 @@ static const AVOption bass_options[] = {
 {NULL}
 };
 
+#if CONFIG_BASS_FILTER
+#define bass_options bass_lowshelf_options
 DEFINE_BIQUAD_FILTER(bass, "Boost or cut lower frequencies.");
 #endif  /* CONFIG_BASS_FILTER */
-#if CONFIG_TREBLE_FILTER
-static const AVOption treble_options[] = {
+
+#if CONFIG_LOWSHELF_FILTER
+#define lowshelf_options bass_lowshelf_options
+DEFINE_BIQUAD_FILTER(lowshelf, "Apply a low shelf filter.");
+#endif  /* CONFIG_LOWSHELF_FILTER */
+#endif  /* CONFIG_BASS_FILTER || CONFIG LOWSHELF_FILTER */
+#if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER
+static const AVOption treble_highshelf_options[] = {
 {"frequency", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 99, FLAGS},
 {"f", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 99, FLAGS},
 {"width_type", "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
@@ -1011,8 +1019,16 @@ static const AVOption treble_options[] = {
 {NULL}
 };
 
+#if CONFIG_TREBLE_FILTER
+#define treble_options treble_highshelf_options
 DEFINE_BIQUAD_FILTER(treble, "Boost or cut upper frequencies.");
 #endif  /* CONFIG_TREBLE_FILTER */
+
+#if CONFIG_HIGHSHELF_FILTER
+#define highshelf_options treble_highshelf_options
+DEFINE_BIQUAD_FILTER(highshelf, "Apply a high shelf filter.");
+#endif  /* CONFIG_HIGHSHELF_FILTER */
+#endif  /* CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER */
 #if CONFIG_BANDPASS_FILTER
 static const AVOption bandpass_options[] = {
 {"frequency", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 99, FLAGS},
@@ -1205,88 +1221,6 @@ static const AVOption allpass_options[] = {
 
 DEFINE_BIQUAD_FILTER(allpass, "Apply a two-pole all-pass filter.");
 #endif  /* CONFIG_ALLPASS_FILTER */
-#if CONFIG_LOWSHELF_FILTER
-static const AVOption lowshelf_options[] = {
-{"frequency", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 99, FLAGS},
-{"f", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 99, FLAGS},
-{"width_type", "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
-{"t",  "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
-{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
-{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, 
"width_type"},
-{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, 
"width_type"},
-{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, 
"width_type"},
-{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, 
"width_type"},
-{"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, 
{.dbl=0.5}, 0, 9, FLAGS},
-{"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, 
{.dbl=0.5}, 0, 9, FLAGS},
-{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 
900, FLAGS},
-{"g","set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 
900, FLAGS},
-{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 
1, 2, AF},
-{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 
1, 2, AF},
-{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
-{"m",   "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
-{"channels", "set channels to filter", OFFSET(channels), 
AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
-{"c","set channels to filter", OFFSET(channels), 
AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
-

[FFmpeg-devel] [PATCH 13/16] avfilter/vf_blend: Deduplicate options

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_blend.c | 109 +++--
 1 file changed, 51 insertions(+), 58 deletions(-)

diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index d59bed823f..ffcc0e9997 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -60,63 +60,60 @@ typedef struct ThreadData {
 FilterParams *param;
 } ThreadData;
 
-#define COMMON_OPTIONS \
-{ "c0_mode", "set component #0 blend mode", OFFSET(params[0].mode), 
AV_OPT_TYPE_INT, {.i64=0}, 0, BLEND_NB-1, FLAGS, "mode"},\
-{ "c1_mode", "set component #1 blend mode", OFFSET(params[1].mode), 
AV_OPT_TYPE_INT, {.i64=0}, 0, BLEND_NB-1, FLAGS, "mode"},\
-{ "c2_mode", "set component #2 blend mode", OFFSET(params[2].mode), 
AV_OPT_TYPE_INT, {.i64=0}, 0, BLEND_NB-1, FLAGS, "mode"},\
-{ "c3_mode", "set component #3 blend mode", OFFSET(params[3].mode), 
AV_OPT_TYPE_INT, {.i64=0}, 0, BLEND_NB-1, FLAGS, "mode"},\
-{ "all_mode", "set blend mode for all components", OFFSET(all_mode), 
AV_OPT_TYPE_INT, {.i64=-1},-1, BLEND_NB-1, FLAGS, "mode"},\
-{ "addition",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_ADDITION},   0, 0, 
FLAGS, "mode" },\
-{ "addition128","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINMERGE}, 0, 0, 
FLAGS, "mode" },\
-{ "grainmerge", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINMERGE}, 0, 0, 
FLAGS, "mode" },\
-{ "and","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_AND},0, 0, 
FLAGS, "mode" },\
-{ "average","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_AVERAGE},0, 0, 
FLAGS, "mode" },\
-{ "burn",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_BURN},   0, 0, 
FLAGS, "mode" },\
-{ "darken", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DARKEN}, 0, 0, 
FLAGS, "mode" },\
-{ "difference", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE}, 0, 0, 
FLAGS, "mode" },\
-{ "difference128", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINEXTRACT}, 0, 
0, FLAGS, "mode" },\
-{ "grainextract", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINEXTRACT}, 0, 
0, FLAGS, "mode" },\
-{ "divide", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE}, 0, 0, 
FLAGS, "mode" },\
-{ "dodge",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE},  0, 0, 
FLAGS, "mode" },\
-{ "exclusion",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION},  0, 0, 
FLAGS, "mode" },\
-{ "extremity",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXTREMITY},  0, 0, 
FLAGS, "mode" },\
-{ "freeze", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_FREEZE}, 0, 0, 
FLAGS, "mode" },\
-{ "glow",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GLOW},   0, 0, 
FLAGS, "mode" },\
-{ "hardlight",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDLIGHT},  0, 0, 
FLAGS, "mode" },\
-{ "hardmix","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDMIX},0, 0, 
FLAGS, "mode" },\
-{ "heat",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HEAT},   0, 0, 
FLAGS, "mode" },\
-{ "lighten","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LIGHTEN},0, 0, 
FLAGS, "mode" },\
-{ "linearlight","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LINEARLIGHT},0, 0, 
FLAGS, "mode" },\
-{ "multiply",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_MULTIPLY},   0, 0, 
FLAGS, "mode" },\
-{ "multiply128","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_MULTIPLY128},0, 0, 
FLAGS, "mode" },\
-{ "negation",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_NEGATION},   0, 0, 
FLAGS, "mode" },\
-{ "normal", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_NORMAL}, 0, 0, 
FLAGS, "mode" },\
-{ "or", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_OR}, 0, 0, 
FLAGS, "mode" },\
-{ "overlay","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_OVERLAY},0, 0, 
FLAGS, "mode" },\
-{ "phoenix","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_PHOENIX},0, 0, 
FLAGS, "mode" },\
-{ "pinlight",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_PINLIGHT},   0, 0, 
FLAGS, "mode" },\
-{ "reflect","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_REFLECT},0, 0, 
FLAGS, "mode" },\
-{ "screen", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SCREEN}, 0, 0, 
FLAGS, "mode" },\
-{ "softlight",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SOFTLIGHT},  0, 0, 
FLAGS, "mode" },\
-{ "subtract",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SUBTRACT},   0, 0, 
FLAGS, "mode" },\
-{ "vividlight", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_VIVIDLIGHT}, 0, 0, 
FLAGS, "mode" },\
-{ "xor","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_XOR},0, 0, 
FLAGS, "mode" },\
-{ "c0_expr",  "set color component #0 expression", 
OFFSET(params[0].expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },\
-{ "c1_expr",  "set color component #1 expression", 
OFFSET(params[1].expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },\
-{ "c2_expr",  "set color component #2 expression", 
OFFSET(params[2].expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },\
-{ "c3_expr",  "set color component #3 expression", 
OFFSET(params[3].expr_str), 

[FFmpeg-devel] [PATCH 12/16] avfilter/af_asupercut: Deduplicate options

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/af_asupercut.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/libavfilter/af_asupercut.c b/libavfilter/af_asupercut.c
index 89f4cf0ed0..d5c9a75d5d 100644
--- a/libavfilter/af_asupercut.c
+++ b/libavfilter/af_asupercut.c
@@ -405,7 +405,7 @@ AVFilter ff_af_asubcut = {
AVFILTER_FLAG_SLICE_THREADS,
 };
 
-static const AVOption asuperpass_options[] = {
+static const AVOption asuperpass_asuperstop_options[] = {
 { "centerf","set center frequency", OFFSET(cutoff), AV_OPT_TYPE_DOUBLE, 
{.dbl=1000}, 2, 99, FLAGS },
 { "order",  "set filter order", OFFSET(order),  AV_OPT_TYPE_INT,
{.i64=4},4, 20, FLAGS },
 { "qfactor","set Q-factor", OFFSET(qfactor),AV_OPT_TYPE_DOUBLE, 
{.dbl=1.},0.01,   100., FLAGS },
@@ -413,6 +413,7 @@ static const AVOption asuperpass_options[] = {
 { NULL }
 };
 
+#define asuperpass_options asuperpass_asuperstop_options
 AVFILTER_DEFINE_CLASS(asuperpass);
 
 AVFilter ff_af_asuperpass = {
@@ -429,14 +430,7 @@ AVFilter ff_af_asuperpass = {
AVFILTER_FLAG_SLICE_THREADS,
 };
 
-static const AVOption asuperstop_options[] = {
-{ "centerf","set center frequency", OFFSET(cutoff), AV_OPT_TYPE_DOUBLE, 
{.dbl=1000}, 2, 99, FLAGS },
-{ "order",  "set filter order", OFFSET(order),  AV_OPT_TYPE_INT,
{.i64=4},4, 20, FLAGS },
-{ "qfactor","set Q-factor", OFFSET(qfactor),AV_OPT_TYPE_DOUBLE, 
{.dbl=1.},0.01,   100., FLAGS },
-{ "level",  "set input level",  OFFSET(level),  AV_OPT_TYPE_DOUBLE, 
{.dbl=1.},   0.,2., FLAGS },
-{ NULL }
-};
-
+#define asuperstop_options asuperpass_asuperstop_options
 AVFILTER_DEFINE_CLASS(asuperstop);
 
 AVFilter ff_af_asuperstop = {
-- 
2.25.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] [PATCH 11/16] avfilter/vf_neighbor: Deduplicate options

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_neighbor.c | 42 ---
 1 file changed, 13 insertions(+), 29 deletions(-)

diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c
index 17a9b88265..9cd9001320 100644
--- a/libavfilter/vf_neighbor.c
+++ b/libavfilter/vf_neighbor.c
@@ -371,60 +371,44 @@ AVFilter ff_vf_##name_ = {
   \
 .process_command = ff_filter_process_command,\
 }
 
-#if CONFIG_EROSION_FILTER
-
-static const AVOption erosion_options[] = {
+/* The following options are shared between all filters here;
+ * the de/inflate filters only use the threshold* options. */
+#define DEINFLATE_OPTIONS_OFFSET (CONFIG_EROSION_FILTER || 
CONFIG_DILATION_FILTER)
+static const AVOption options[] = {
+#if CONFIG_EROSION_FILTER || CONFIG_DILATION_FILTER
+{ "coordinates", "set coordinates",   OFFSET(coordinates),
AV_OPT_TYPE_INT, {.i64=255},   0, 255,   FLAGS },
+#endif
 { "threshold0",  "set threshold for 1st plane",   OFFSET(threshold[0]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
 { "threshold1",  "set threshold for 2nd plane",   OFFSET(threshold[1]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
 { "threshold2",  "set threshold for 3rd plane",   OFFSET(threshold[2]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
 { "threshold3",  "set threshold for 4th plane",   OFFSET(threshold[3]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "coordinates", "set coordinates",   OFFSET(coordinates),
AV_OPT_TYPE_INT, {.i64=255},   0, 255,   FLAGS },
 { NULL }
 };
 
+#if CONFIG_EROSION_FILTER
+
+#define erosion_options options
 DEFINE_NEIGHBOR_FILTER(erosion, "Apply erosion effect.");
 
 #endif /* CONFIG_EROSION_FILTER */
 
 #if CONFIG_DILATION_FILTER
 
-static const AVOption dilation_options[] = {
-{ "threshold0",  "set threshold for 1st plane",   OFFSET(threshold[0]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold1",  "set threshold for 2nd plane",   OFFSET(threshold[1]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold2",  "set threshold for 3rd plane",   OFFSET(threshold[2]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold3",  "set threshold for 4th plane",   OFFSET(threshold[3]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "coordinates", "set coordinates",   OFFSET(coordinates),
AV_OPT_TYPE_INT, {.i64=255},   0, 255,   FLAGS },
-{ NULL }
-};
-
+#define dilation_options options
 DEFINE_NEIGHBOR_FILTER(dilation, "Apply dilation effect.");
 
 #endif /* CONFIG_DILATION_FILTER */
 
 #if CONFIG_DEFLATE_FILTER
 
-static const AVOption deflate_options[] = {
-{ "threshold0", "set threshold for 1st plane",   OFFSET(threshold[0]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold1", "set threshold for 2nd plane",   OFFSET(threshold[1]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold2", "set threshold for 3rd plane",   OFFSET(threshold[2]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold3", "set threshold for 4th plane",   OFFSET(threshold[3]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ NULL }
-};
-
+#define deflate_options [DEINFLATE_OPTIONS_OFFSET]
 DEFINE_NEIGHBOR_FILTER(deflate, "Apply deflate effect.");
 
 #endif /* CONFIG_DEFLATE_FILTER */
 
 #if CONFIG_INFLATE_FILTER
 
-static const AVOption inflate_options[] = {
-{ "threshold0", "set threshold for 1st plane",   OFFSET(threshold[0]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold1", "set threshold for 2nd plane",   OFFSET(threshold[1]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold2", "set threshold for 3rd plane",   OFFSET(threshold[2]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ "threshold3", "set threshold for 4th plane",   OFFSET(threshold[3]),   
AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
-{ NULL }
-};
-
+#define inflate_options [DEINFLATE_OPTIONS_OFFSET]
 DEFINE_NEIGHBOR_FILTER(inflate, "Apply inflate effect.");
 
 #endif /* CONFIG_INFLATE_FILTER */
-- 
2.25.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] [PATCH 10/16] avfilter/vf_convolution: Deduplicate filter options

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
I wonder whether one should add an AVFILTER_DEFINE_CLASS2 macro that
allows a custom options name.

 libavfilter/vf_convolution.c | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 3674f5b590..0514c235a9 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -796,15 +796,18 @@ AVFilter ff_vf_convolution = {
 
 #endif /* CONFIG_CONVOLUTION_FILTER */
 
-#if CONFIG_PREWITT_FILTER
+#if CONFIG_PREWITT_FILTER || CONFIG_ROBERTS_FILTER || CONFIG_SOBEL_FILTER
 
-static const AVOption prewitt_options[] = {
+static const AVOption prewitt_roberts_sobel_options[] = {
 { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,  
{.i64=15}, 0, 15, FLAGS},
 { "scale",  "set scale",OFFSET(scale), AV_OPT_TYPE_FLOAT, 
{.dbl=1.0}, 0.0,  65535, FLAGS},
 { "delta",  "set delta",OFFSET(delta), AV_OPT_TYPE_FLOAT, 
{.dbl=0}, -65535, 65535, FLAGS},
 { NULL }
 };
 
+#if CONFIG_PREWITT_FILTER
+
+#define prewitt_options prewitt_roberts_sobel_options
 AVFILTER_DEFINE_CLASS(prewitt);
 
 AVFilter ff_vf_prewitt = {
@@ -824,13 +827,7 @@ AVFilter ff_vf_prewitt = {
 
 #if CONFIG_SOBEL_FILTER
 
-static const AVOption sobel_options[] = {
-{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,  
{.i64=15}, 0, 15, FLAGS},
-{ "scale",  "set scale",OFFSET(scale), AV_OPT_TYPE_FLOAT, 
{.dbl=1.0}, 0.0,  65535, FLAGS},
-{ "delta",  "set delta",OFFSET(delta), AV_OPT_TYPE_FLOAT, 
{.dbl=0}, -65535, 65535, FLAGS},
-{ NULL }
-};
-
+#define sobel_options prewitt_roberts_sobel_options
 AVFILTER_DEFINE_CLASS(sobel);
 
 AVFilter ff_vf_sobel = {
@@ -850,13 +847,7 @@ AVFilter ff_vf_sobel = {
 
 #if CONFIG_ROBERTS_FILTER
 
-static const AVOption roberts_options[] = {
-{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,  
{.i64=15}, 0, 15, FLAGS},
-{ "scale",  "set scale",OFFSET(scale), AV_OPT_TYPE_FLOAT, 
{.dbl=1.0}, 0.0,  65535, FLAGS},
-{ "delta",  "set delta",OFFSET(delta), AV_OPT_TYPE_FLOAT, 
{.dbl=0}, -65535, 65535, FLAGS},
-{ NULL }
-};
-
+#define roberts_options prewitt_roberts_sobel_options
 AVFILTER_DEFINE_CLASS(roberts);
 
 AVFilter ff_vf_roberts = {
@@ -873,3 +864,4 @@ AVFilter ff_vf_roberts = {
 };
 
 #endif /* CONFIG_ROBERTS_FILTER */
+#endif /* CONFIG_PREWITT_FILTER || CONFIG_ROBERTS_FILTER || 
CONFIG_SOBEL_FILTER */
-- 
2.25.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] [PATCH 03/16] avcodec/metasound: Deduplicate data

2021-01-03 Thread Andreas Rheinhardt
Saves about 13KB; also reduces the amount of relocations.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/metasound.c  |  12 +-
 libavcodec/metasound_data.c | 448 +---
 libavcodec/metasound_data.h |   3 -
 3 files changed, 9 insertions(+), 454 deletions(-)

diff --git a/libavcodec/metasound.c b/libavcodec/metasound.c
index 396310ba1e..27cf1dd83f 100644
--- a/libavcodec/metasound.c
+++ b/libavcodec/metasound.c
@@ -341,22 +341,16 @@ static av_cold int metasound_decode_init(AVCodecContext 
*avctx)
 tctx->mtab = _metasound_mode2224s;
 break;
 case (1 << 16) + (44 << 8) + 32:
-tctx->mtab = _metasound_mode4432;
-break;
 case (2 << 16) + (44 << 8) + 32:
-tctx->mtab = _metasound_mode4432s;
+tctx->mtab = _metasound_mode4432;
 break;
 case (1 << 16) + (44 << 8) + 40:
-tctx->mtab = _metasound_mode4440;
-break;
 case (2 << 16) + (44 << 8) + 40:
-tctx->mtab = _metasound_mode4440s;
+tctx->mtab = _metasound_mode4440;
 break;
 case (1 << 16) + (44 << 8) + 48:
-tctx->mtab = _metasound_mode4448;
-break;
 case (2 << 16) + (44 << 8) + 48:
-tctx->mtab = _metasound_mode4448s;
+tctx->mtab = _metasound_mode4448;
 break;
 default:
 av_log(avctx, AV_LOG_ERROR,
diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
index da2548af9d..d027690e3d 100644
--- a/libavcodec/metasound_data.c
+++ b/libavcodec/metasound_data.c
@@ -12168,72 +12168,6 @@ static const float lsp8[] = {
  0.2217,  0.2632,  0.2706,  0.2624,  0.2162,  0.2453,  0.2460,  0.2531,
 };
 
-static const float lsp8s[] = {
- 0.2702,  0.5096,  0.6437,  0.7672,  0.9639,  1.0696,  1.2625,  1.5789,
- 1.9285,  2.2383,  2.5129,  2.8470,  0.1740,  0.3677,  0.6082,  0.8387,
- 1.1084,  1.3721,  1.6362,  1.8733,  2.0640,  2.3442,  2.6087,  2.8548,
- 0.1536,  0.3279,  0.5143,  0.6859,  0.9763,  1.2744,  1.5605,  1.8566,
- 2.1007,  2.3450,  2.6075,  2.8850,  0.2075,  0.4533,  0.7709,  1.0377,
- 1.2953,  1.5132,  1.7826,  2.0351,  2.2590,  2.4996,  2.6795,  2.8748,
- 0.1393,  0.2453,  0.3754,  0.5453,  0.8148,  1.1289,  1.4389,  1.7592,
- 2.0353,  2.3215,  2.5934,  2.8588,  0.1250,  0.3627,  0.7613,  1.1380,
- 1.4163,  1.5565,  1.6920,  1.8130,  1.8678,  2.0427,  2.4318,  2.8544,
- 0.2256,  0.4223,  0.6452,  0.8599,  1.0673,  1.3118,  1.5486,  1.8366,
- 2.0759,  2.3026,  2.5284,  2.8030,  0.2304,  0.4404,  0.6891,  0.8964,
- 1.1510,  1.4202,  1.6483,  1.8580,  2.1181,  2.3686,  2.6078,  2.9128,
- 0.2230,  0.3816,  0.5520,  0.6062,  0.7909,  1.0988,  1.4330,  1.7846,
- 2.0713,  2.3457,  2.6048,  2.8708,  0.2447,  0.5800,  0.8249,  0.9905,
- 1.1721,  1.3990,  1.6694,  1.9064,  2.1307,  2.4255,  2.6815,  2.9117,
- 0.1974,  0.3812,  0.5802,  0.7759,  0.9280,  1.1547,  1.4170,  1.6369,
- 1.8890,  2.2587,  2.5626,  2.8239,  0.1209,  0.2510,  0.4841,  0.8048,
- 1.1197,  1.3563,  1.6073,  1.8926,  2.1350,  2.3669,  2.6291,  2.8985,
- 0.2352,  0.4347,  0.6582,  0.8178,  0.9548,  1.1654,  1.4942,  1.8812,
- 2.1703,  2.3779,  2.6412,  2.8871,  0.2091,  0.4084,  0.6730,  0.9151,
- 1.1259,  1.3262,  1.5937,  1.8129,  2.0237,  2.3317,  2.5778,  2.8620,
- 0.1167,  0.2406,  0.4520,  0.7298,  0.9848,  1.2448,  1.5137,  1.7874,
- 2.0280,  2.3020,  2.5914,  2.8794,  0.3003,  0.4966,  0.6520,  0.8505,
- 1.1600,  1.3981,  1.5805,  1.8346,  2.0757,  2.3102,  2.5760,  2.8499,
- 0.2451,  0.4163,  0.5960,  0.7805,  0.9507,  1.2438,  1.5587,  1.8581,
- 2.0735,  2.3198,  2.5704,  2.8220,  0.3112,  0.5517,  0.7032,  0.8528,
- 1.1489,  1.4257,  1.6848,  1.9388,  2.1577,  2.4265,  2.6678,  2.9051,
- 0.2249,  0.3897,  0.5559,  0.7473,  1.0158,  1.3581,  1.6914,  1.9930,
- 2.1843,  2.3534,  2.5512,  2.8065,  0.2600,  0.4574,  0.7349,  0.9691,
- 1.1696,  1.3848,  1.6335,  1.9021,  2.1174,  2.3481,  2.5902,  2.8390,
- 0.2246,  0.3372,  0.4560,  0.5249,  0.7056,  1.0273,  1.3810,  1.7132,
- 1.9819,  2.2574,  2.5410,  2.8491,  0.1419,  0.4834,  0.8835,  1.1453,
- 1.2839,  1.4224,  1.5593,  1.7877,  2.1285,  2.4070,  2.6043,  2.8511,
- 0.1886,  0.3677,  0.5617,  0.8099,  1.1277,  1.3841,  1.5804,  1.8136,
- 2.0307,  2.2805,  2.5399,  2.8322,  0.2351,  0.4151,  0.6675,  0.8713,
- 1.0464,  1.3292,  1.6586,  1.9281,  2.1355,  2.3495,  2.6222,  2.8782,
- 0.2700,  0.4489,  0.6206,  0.7121,  0.7737,  0.9848,  1.3658,  1.7433,
- 2.0139,  2.2243,  2.4806,  2.8175,  0.2479,  0.4425,  0.6490,  0.8745,
- 1.1161,  1.3849,  1.6773,  1.9566,  2.1491,  2.3624,  2.5685,  2.8114,
- 0.2035,  0.3701,  0.5567,  0.7953,  1.0082,  1.2758,  1.5373,  1.7822,
- 2.0175,  2.2601,  2.4759,  2.7771,  0.1856,  0.3461,  0.5998,  0.9041,
- 1.2383,  1.4612,  1.6667,  1.9305,  2.1617,  2.4107,  2.6477,  2.8656,
- 0.2107,  0.3715,  0.5289,  0.6651,  0.8420,  

[FFmpeg-devel] [PATCH 09/16] avformat/hashenc: Deduplicate (stream)hash options

2021-01-03 Thread Andreas Rheinhardt
Also saves relocations.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/hashenc.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 5523dfd1cd..1e9faf372a 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -42,8 +42,8 @@ struct HashContext {
 #define FORMAT_VERSION_OPT \
 { "format_version", "file format version", OFFSET(format_version), 
AV_OPT_TYPE_INT, {.i64 = 2}, 1, 2, ENC }
 
-#if CONFIG_HASH_MUXER
-static const AVOption hash_options[] = {
+#if CONFIG_HASH_MUXER || CONFIG_STREAMHASH_MUXER
+static const AVOption hash_streamhash_options[] = {
 HASH_OPT("sha256"),
 { NULL },
 };
@@ -57,13 +57,6 @@ static const AVOption framehash_options[] = {
 };
 #endif
 
-#if CONFIG_STREAMHASH_MUXER
-static const AVOption streamhash_options[] = {
-HASH_OPT("sha256"),
-{ NULL },
-};
-#endif
-
 #if CONFIG_MD5_MUXER
 static const AVOption md5_options[] = {
 HASH_OPT("md5"),
@@ -174,7 +167,7 @@ static void hash_free(struct AVFormatContext *s)
 static const AVClass hashenc_class = {
 .class_name = "hash muxer",
 .item_name  = av_default_item_name,
-.option = hash_options,
+.option = hash_streamhash_options,
 .version= LIBAVUTIL_VERSION_INT,
 };
 
@@ -222,7 +215,7 @@ AVOutputFormat ff_md5_muxer = {
 static const AVClass streamhashenc_class = {
 .class_name = "stream hash muxer",
 .item_name  = av_default_item_name,
-.option = streamhash_options,
+.option = hash_streamhash_options,
 .version= LIBAVUTIL_VERSION_INT,
 };
 
-- 
2.25.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] [PATCH 08/16] avcodec/wavpack: Deduplicate exp and log tables

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile  |  4 +--
 libavcodec/wavpack.h | 45 --
 libavcodec/wavpackdata.c | 60 
 libavcodec/wavpackenc.c  |  4 +--
 4 files changed, 69 insertions(+), 44 deletions(-)
 create mode 100644 libavcodec/wavpackdata.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 143be8afec..35318f4f4d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -723,8 +723,8 @@ OBJS-$(CONFIG_VP9_QSV_ENCODER) += qsvenc_vp9.o
 OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
 OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += v4l2_m2m_dec.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
-OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o dsd.o
-OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackenc.o
+OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o wavpackdata.o dsd.o
+OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackdata.o wavpackenc.o
 OBJS-$(CONFIG_WCMV_DECODER)+= wcmv.o
 OBJS-$(CONFIG_WEBP_DECODER)+= webp.o
 OBJS-$(CONFIG_WEBVTT_DECODER)  += webvttdec.o ass.o
diff --git a/libavcodec/wavpack.h b/libavcodec/wavpack.h
index 43aaac815f..7e7dfce2b7 100644
--- a/libavcodec/wavpack.h
+++ b/libavcodec/wavpack.h
@@ -124,43 +124,8 @@ static const int wv_rates[16] = {
 };
 
 // exponent table copied from WavPack source
-static const uint8_t wp_exp2_table[256] = {
-0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 
0x08, 0x09, 0x0a, 0x0b,
-0x0b, 0x0c, 0x0d, 0x0e, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x12, 0x13, 0x13, 
0x14, 0x15, 0x16, 0x16,
-0x17, 0x18, 0x19, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1d, 0x1e, 0x1f, 0x20, 
0x20, 0x21, 0x22, 0x23,
-0x24, 0x24, 0x25, 0x26, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2c, 
0x2d, 0x2e, 0x2f, 0x30,
-0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 
0x3a, 0x3b, 0x3c, 0x3d,
-0x3e, 0x3f, 0x40, 0x41, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 
0x48, 0x49, 0x4a, 0x4b,
-0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 
0x57, 0x58, 0x59, 0x5a,
-0x5b, 0x5c, 0x5d, 0x5e, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 
0x66, 0x67, 0x68, 0x69,
-0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 
0x76, 0x77, 0x78, 0x79,
-0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 
0x87, 0x88, 0x89, 0x8a,
-0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x95, 0x96, 0x97, 
0x98, 0x99, 0x9a, 0x9b,
-0x9c, 0x9d, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa8, 0xa9, 
0xaa, 0xab, 0xac, 0xad,
-0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbc, 
0xbd, 0xbe, 0xbf, 0xc0,
-0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf, 
0xd0, 0xd2, 0xd3, 0xd4,
-0xd6, 0xd7, 0xd8, 0xd9, 0xdb, 0xdc, 0xdd, 0xde, 0xe0, 0xe1, 0xe2, 0xe4, 
0xe5, 0xe6, 0xe8, 0xe9,
-0xea, 0xec, 0xed, 0xee, 0xf0, 0xf1, 0xf2, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 
0xfa, 0xfc, 0xfd, 0xff
-};
-
-static const uint8_t wp_log2_table [] = {
-0x00, 0x01, 0x03, 0x04, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x10, 
0x11, 0x12, 0x14, 0x15,
-0x16, 0x18, 0x19, 0x1a, 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x22, 0x24, 0x25, 
0x26, 0x28, 0x29, 0x2a,
-0x2c, 0x2d, 0x2e, 0x2f, 0x31, 0x32, 0x33, 0x34, 0x36, 0x37, 0x38, 0x39, 
0x3b, 0x3c, 0x3d, 0x3e,
-0x3f, 0x41, 0x42, 0x43, 0x44, 0x45, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4d, 
0x4e, 0x4f, 0x50, 0x51,
-0x52, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5c, 0x5d, 0x5e, 0x5f, 
0x60, 0x61, 0x62, 0x63,
-0x64, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 
0x71, 0x72, 0x74, 0x75,
-0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 
0x82, 0x83, 0x84, 0x85,
-0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 
0x92, 0x93, 0x94, 0x95,
-0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 
0xa1, 0xa2, 0xa3, 0xa4,
-0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 
0xb0, 0xb1, 0xb2, 0xb2,
-0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 
0xbe, 0xbf, 0xc0, 0xc0,
-0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 
0xcb, 0xcc, 0xcd, 0xce,
-0xcf, 0xd0, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 
0xd8, 0xd9, 0xda, 0xdb,
-0xdc, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe4, 
0xe5, 0xe6, 0xe7, 0xe7,
-0xe8, 0xe9, 0xea, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xee, 0xef, 0xf0, 0xf1, 
0xf1, 0xf2, 0xf3, 0xf4,
-0xf4, 0xf5, 0xf6, 0xf7, 0xf7, 0xf8, 0xf9, 0xf9, 0xfa, 0xfb, 0xfc, 0xfc, 
0xfd, 0xfe, 0xff, 0xff
-};
+extern const uint8_t ff_wp_exp2_table[256];
+extern const uint8_t ff_wp_log2_table[256];
 
 static av_always_inline int wp_exp2(int16_t val)
 {
@@ -171,7 +136,7 @@ static av_always_inline int wp_exp2(int16_t val)
 neg = 1;

[FFmpeg-devel] [PATCH 02/16] avcodec/g723_1: Move tables to their only user

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/g723_1.h| 120 -
 libavcodec/g723_1dec.c |  72 +
 libavcodec/g723_1enc.c |  48 +
 3 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/libavcodec/g723_1.h b/libavcodec/g723_1.h
index 7cd57b76b4..521f220b2a 100644
--- a/libavcodec/g723_1.h
+++ b/libavcodec/g723_1.h
@@ -221,11 +221,6 @@ void ff_g723_1_inverse_quant(int16_t *cur_lsp, int16_t 
*prev_lsp,
 
 static const uint8_t frame_size[4] = { 24, 20, 4, 1 };
 
-/**
- * Postfilter gain weighting factors scaled by 2^15
- */
-static const int16_t ppf_gain_weight[2] = {0x1800, 0x2000};
-
 /**
  * LSP DC component
  */
@@ -259,129 +254,14 @@ extern const int16_t ff_g723_1_lsp_band2[LSP_CB_SIZE][4];
  */
 extern const int32_t 
ff_g723_1_combinatorial_table[PULSE_MAX][SUBFRAME_LEN/GRID_SIZE];
 
-static const int16_t pitch_contrib[340] = {
-60, 0,  0,  2489, 60, 0,  0,  5217,
- 1,  6171,  0,  3953,  0, 10364,  1,  9357,
--1,  8843,  1,  9396,  0,  5794, -1, 10816,
- 2, 11606, -2, 12072,  0,  8616,  1, 12170,
- 0, 14440,  0,  7787, -1, 13721,  0, 18205,
- 0, 14471,  0, 15807,  1, 15275,  0, 13480,
--1, 18375, -1, 0,  1, 11194, -1, 13010,
- 1, 18836, -2, 20354,  1, 16233, -1, 0,
-60, 0,  0, 12130,  0, 13385,  1, 17834,
- 1, 20875,  0, 21996,  1, 0,  1, 18277,
--1, 21321,  1, 13738, -1, 19094, -1, 20387,
--1, 0,  0, 21008, 60, 0, -2, 22807,
- 0, 15900,  1, 0,  0, 17989, -1, 22259,
- 1, 24395,  1, 23138,  0, 23948,  1, 22997,
- 2, 22604, -1, 25942,  0, 26246,  1, 25321,
- 0, 26423,  0, 24061,  0, 27247, 60, 0,
--1, 25572,  1, 23918,  1, 25930,  2, 26408,
--1, 19049,  1, 27357, -1, 24538, 60, 0,
--1, 25093,  0, 28549,  1, 0,  0, 22793,
--1, 25659,  0, 29377,  0, 30276,  0, 26198,
- 1, 22521, -1, 28919,  0, 27384,  1, 30162,
--1, 0,  0, 24237, -1, 30062,  0, 21763,
- 1, 30917, 60, 0,  0, 31284,  0, 29433,
- 1, 26821,  1, 28655,  0, 31327,  2, 30799,
- 1, 31389,  0, 32322,  1, 31760, -2, 31830,
- 0, 26936, -1, 31180,  1, 30875,  0, 27873,
--1, 30429,  1, 31050,  0, 0,  0, 31912,
- 1, 31611,  0, 31565,  0, 25557,  0, 31357,
-60, 0,  1, 29536,  1, 28985, -1, 26984,
--1, 31587,  2, 30836, -2, 31133,  0, 30243,
--1, 30742, -1, 32090, 60, 0,  2, 30902,
-60, 0,  0, 30027,  0, 29042, 60, 0,
- 0, 31756,  0, 24553,  0, 25636, -2, 30501,
-60, 0, -1, 29617,  0, 30649, 60, 0,
- 0, 29274,  2, 30415,  0, 27480,  0, 31213,
--1, 28147,  0, 30600,  1, 31652,  2, 29068,
-60, 0,  1, 28571,  1, 28730,  1, 31422,
- 0, 28257,  0, 24797, 60, 0,  0, 0,
-60, 0,  0, 22105,  0, 27852, 60, 0,
-60, 0, -1, 24214,  0, 24642,  0, 23305,
-60, 0, 60, 0,  1, 22883,  0, 21601,
-60, 0,  2, 25650, 60, 0, -2, 31253,
--2, 25144,  0, 17998
-};
-
 /**
  * Number of non-zero pulses in the MP-MLQ excitation
  */
 static const int8_t pulses[4] = {6, 5, 6, 5};
 
-/**
- * Size of the MP-MLQ fixed excitation codebooks
- */
-static const int32_t max_pos[4] = {593775, 142506, 593775, 142506};
-
 extern const int16_t ff_g723_1_fixed_cb_gain[GAIN_LEVELS];
 
 extern const int16_t ff_g723_1_adaptive_cb_gain85 [ 85 * 20];
 extern const int16_t ff_g723_1_adaptive_cb_gain170[170 * 20];
 
-/**
- * 0.65^i (Zero part) and 0.75^i (Pole part) scaled by 2^15
- */
-static const int16_t postfilter_tbl[2][LPC_ORDER] = {
-/* Zero */
-{21299, 13844,  8999,  5849, 3802, 2471, 1606, 1044,  679,  441},
-/* Pole */
-{24576, 18432, 13824, 10368, 7776, 5832, 4374, 3281, 2460, 1845}
-};
-
-/**
- * Hamming window coefficients scaled by 2^15
- */
-static const int16_t hamming_window[LPC_FRAME] = {
- 2621,  2631,  2659,  2705,  2770,  2853,  2955,  3074,  3212,  3367,
- 3541,  3731,  3939,  4164,  4405,  4663,  4937,  5226,  5531,  5851,
- 6186,  6534,  6897,  7273,  7661,  8062,  8475,  8899,  9334,  9780,
-10235, 10699, 11172, 11653, 12141, 12636, 13138, 13645, 14157, 14673,
-15193, 15716, 16242, 16769, 17298, 17827, 18356, 18884, 19411, 19935,
-20457, 20975, 21489, 21999, 22503, 23002, 23494, 23978, 24455, 24924,
-25384, 25834, 26274, 26704, 27122, 27529, 27924, 28306, 28675, 29031,
-29373, 29700, 30012, 30310, 30592, 30857, 31107, 31340, 31557, 31756,
-31938, 32102, 32249, 32377, 32488, 32580, 32654, 32710, 32747, 32766,
-32766, 32747, 32710, 32654, 32580, 32488, 32377, 32249, 32102, 31938,
-31756, 31557, 31340, 31107, 30857, 30592, 30310, 30012, 29700, 29373,
-29031, 28675, 28306, 27924, 27529, 27122, 26704, 26274, 25834, 25384,
-24924, 24455, 23978, 23494, 23002, 22503, 21999, 21489, 20975, 20457,
-19935, 19411, 18884, 18356, 17827, 17298, 16769, 16242, 15716, 15193,
-14673, 14157, 13645, 13138, 12636, 12141, 11653, 11172, 10699, 

[FFmpeg-devel] [PATCH 07/16] avformat/mxf: Deduplicate random_index_pack_key

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
There is also another key that is duplicated: header_open_partition_key
and mxf_jp2k_rsiz. But they seem to mean something different which makes
me wonder if one of these keys is incorrect; I have therefore refrained
from deduplicating them.

 libavformat/mxf.c| 2 ++
 libavformat/mxf.h| 1 +
 libavformat/mxfdec.c | 3 +--
 libavformat/mxfenc.c | 3 +--
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index 88f69ebcfb..1901b24c68 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -24,6 +24,8 @@
 
 const uint8_t ff_mxf_mastering_display_prefix[13]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x04,0x20,0x04,0x01,0x01 };
 
+const uint8_t ff_mxf_random_index_pack_key[16] = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 
};
+
 /* be careful to update references to this array if reordering */
 /* local tags are dynamic and must not clash with others in mxfenc.c */
 const MXFLocalTagPair ff_mxf_mastering_display_local_tags[4] = {
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index 7fa10bcca1..5219abc767 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -84,6 +84,7 @@ typedef struct MXFLocalTagPair {
 } MXFLocalTagPair;
 
 extern const uint8_t ff_mxf_mastering_display_prefix[13];
+extern const uint8_t ff_mxf_random_index_pack_key[16];
 extern const MXFLocalTagPair ff_mxf_mastering_display_local_tags[4];
 
 #define FF_MXF_MASTERING_CHROMA_DEN 5
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index b563f2abe1..784f43d6d1 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -328,7 +328,6 @@ static const uint8_t mxf_apple_coll_prefix[]   
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
 static const uint8_t mxf_encrypted_essence_container[] = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 
};
-static const uint8_t mxf_random_index_pack_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 
};
 static const uint8_t mxf_sony_mpeg4_extradata[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 
};
 static const uint8_t mxf_avid_project_name[]   = { 
0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf 
};
 static const uint8_t mxf_jp2k_rsiz[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x01,0x00 
};
@@ -3264,7 +3263,7 @@ static void mxf_read_random_index_pack(AVFormatContext *s)
 goto end;
 avio_seek(s->pb, file_size - length, SEEK_SET);
 if (klv_read_packet(, s->pb) < 0 ||
-!IS_KLV_KEY(klv.key, mxf_random_index_pack_key))
+!IS_KLV_KEY(klv.key, ff_mxf_random_index_pack_key))
 goto end;
 if (klv.next_klv != file_size || klv.length <= 4 || (klv.length - 4) % 12) 
{
 av_log(s, AV_LOG_WARNING, "Invalid RIP KLV length\n");
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index d8678c9d25..6c5331ad62 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -271,7 +271,6 @@ static const uint8_t opatom_ul[]   = { 
0x06,0x0E,0x2B,0x34,0x04,
 static const uint8_t footer_partition_key[]= { 
0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x04,0x04,0x00 
}; // ClosedComplete
 static const uint8_t primer_pack_key[] = { 
0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x05,0x01,0x00 
};
 static const uint8_t index_table_segment_key[] = { 
0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 
};
-static const uint8_t random_index_pack_key[]   = { 
0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x11,0x01,0x00 
};
 static const uint8_t header_open_partition_key[]   = { 
0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x02,0x01,0x00 
}; // OpenIncomplete
 static const uint8_t header_closed_partition_key[] = { 
0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x02,0x04,0x00 
}; // ClosedComplete
 static const uint8_t klv_fill_key[]= { 
0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x01,0x02,0x10,0x01,0x00,0x00,0x00 
};
@@ -2956,7 +2955,7 @@ static void mxf_write_random_index_pack(AVFormatContext 
*s)
 uint64_t pos = avio_tell(pb);
 int i;
 
-avio_write(pb, random_index_pack_key, 16);
+avio_write(pb, ff_mxf_random_index_pack_key, 16);
 klv_encode_ber_length(pb, 28 + 12LL*mxf->body_partitions_count);
 
 if (mxf->edit_unit_byte_count && s->oformat != _mxf_opatom_muxer)
-- 
2.25.1


[FFmpeg-devel] [PATCH 04/16] avcodec/twinvq, metasound_data: Deduplicate lsp tables

2021-01-03 Thread Andreas Rheinhardt
Saves about 24KB.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile |   2 +-
 libavcodec/metasound_data.c |  41 +-
 libavcodec/metasound_data.h |   6 +
 libavcodec/twinvq_data.h| 790 
 libavcodec/twinvqdec.c  |  17 +-
 5 files changed, 39 insertions(+), 817 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fea37ef3c9..143be8afec 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -666,7 +666,7 @@ OBJS-$(CONFIG_TSCC_DECODER)+= tscc.o msrledec.o
 OBJS-$(CONFIG_TSCC2_DECODER)   += tscc2.o
 OBJS-$(CONFIG_TTA_DECODER) += tta.o ttadata.o ttadsp.o
 OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttaencdsp.o ttadata.o
-OBJS-$(CONFIG_TWINVQ_DECODER)  += twinvqdec.o twinvq.o
+OBJS-$(CONFIG_TWINVQ_DECODER)  += twinvqdec.o twinvq.o metasound_data.o
 OBJS-$(CONFIG_TXD_DECODER) += txd.o
 OBJS-$(CONFIG_ULTI_DECODER)+= ulti.o
 OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideodsp.o
diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
index d027690e3d..22b2730dda 100644
--- a/libavcodec/metasound_data.c
+++ b/libavcodec/metasound_data.c
@@ -19,8 +19,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
 #include "metasound_data.h"
 
+#if CONFIG_METASOUND_DECODER
 static const int16_t cb0806sl0[] = {
   -417,   -225,-84, 16,   -106,-34,   -246,   -164,
112, 48,-47, 36,-65,-68,   -172,  -1655,
@@ -12101,8 +12103,9 @@ static const int16_t fcb44sm[] = {
   -623,   -588, 38,-58,975,   1529,   -986,   -891,
  -1121,   -619,   1967,   -463, -7,632,768,953,
 };
+#endif /* CONFIG_METASOUND_DECODER */
 
-static const float lsp8[] = {
+const float ff_metasound_lsp8[] = {
  0.2702,  0.5096,  0.6437,  0.7672,  0.9639,  1.0696,  1.2625,  1.5789,
  1.9285,  2.2383,  2.5129,  2.8470,  0.1740,  0.3677,  0.6082,  0.8387,
  1.1084,  1.3721,  1.6362,  1.8733,  2.0640,  2.3442,  2.6087,  2.8548,
@@ -12168,7 +12171,7 @@ static const float lsp8[] = {
  0.2217,  0.2632,  0.2706,  0.2624,  0.2162,  0.2453,  0.2460,  0.2531,
 };
 
-static const float lsp11[] = {
+const float ff_metasound_lsp11[] = {
  0.1103,  0.3862,  0.6863,  0.8447,  0.9231,  1.0261,  1.1248,  1.4057,
  1.6621,  1.8010,  1.8692,  2.0704,  2.3490,  2.6060,  2.7539,  2.8977,
  0.1273,  0.2407,  0.3812,  0.6004,  0.7767,  0.9383,  1.1344,  1.3351,
@@ -12335,7 +12338,7 @@ static const float lsp11[] = {
  0.1486,  0.1342,  0.1215,  0.1423,  0.1634,  0.1588,  0.1539,  0.1857,
 };
 
-static const float lsp16[] = {
+const float ff_metasound_lsp16[] = {
  0.1813,  0.3911,  0.6301,  0.8012,  1.0057,  1.2041,  1.4271,  1.6943,
  1.9402,  2.1733,  2.3521,  2.4989,  2.5839,  2.6846,  2.7634,  2.8950,
  0.1311,  0.3183,  0.4659,  0.5601,  0.6658,  0.7828,  1.0065,  1.2717,
@@ -12514,7 +12517,7 @@ static const float lsp16[] = {
 -0.0429, -0.0615, -0.0893, -0.0618, -0.0384, -0.0134, -0.0232, -0.0238,
 };
 
-static const float lsp22[] = {
+const float ff_metasound_lsp22[] = {
  0.0664,  0.1875,  0.4300,  0.6730,  0.8793,  1.0640,  1.2563,  1.4433,
  1.6394,  1.8176,  2.0029,  2.1921,  2.3796,  2.5671,  2.7595,  2.9536,
  0.2128,  0.4052,  0.5311,  0.6404,  0.7875,  0.8775,  1.0974,  1.3261,
@@ -12681,7 +12684,7 @@ static const float lsp22[] = {
  0.4239,  0.4331,  0.4522,  0.4423,  0.4475,  0.4387,  0.4525,  0.4446,
 };
 
-static const float lsp44s[] = {
+const float ff_metasound_lsp44[] = {
  0.0927,  0.2291,  0.4059,  0.5779,  0.7288,  0.8821,  1.0377,  1.1915,
  1.3433,  1.4931,  1.6475,  1.7989,  1.9381,  2.0858,  2.2321,  2.3765,
  2.5187,  2.6530,  2.7895,  2.9354,  0.0944,  0.1974,  0.3046,  0.4714,
@@ -12889,6 +12892,7 @@ static const float lsp44s[] = {
  0.1897,  0.1772,  0.1651,  0.1247,  0.1041,  0.1231,  0.1809,  0.2234,
 };
 
+#if CONFIG_METASOUND_DECODER
 static const int16_t shape8[] = {
   2765,   1262,   6624,867,688,   1884,   3245,   1248,
  -2160,593,182,  -1004,  -1067,687,   1021,   -920,
@@ -14612,7 +14616,7 @@ const TwinVQModeTab ff_metasound_mode0806 = {
 {  2, bark_tab_m8_256, 20, fcb8m, 2, 5, cb0806sm0, cb0806sm1, 22 },
 {  1, bark_tab_l8_512, 30, fcb8l, 3, 6, cb0806sl0, cb0806sl1, 24 }
 },
-512, 12, lsp8, 1, 5, 3, 3, shape8, 8, 28, 20, 6, 200
+512, 12, ff_metasound_lsp8, 1, 5, 3, 3, shape8, 8, 28, 20, 6, 200
 };
 
 const TwinVQModeTab ff_metasound_mode0806s = {
@@ -14621,7 +14625,7 @@ const TwinVQModeTab ff_metasound_mode0806s = {
 {  2, bark_tab_m8s_256, 20, fcb8sm, 2, 5, cb0806sm0, cb0806sm1, 22 },
 {  1, bark_tab_l8s_512, 30, fcb8sl, 3, 6, cb0806sl0, cb0806sl1, 24 }
 },
-512, 12, lsp8, 1, 5, 3, 3, shape8s, 8, 28, 20, 6, 200
+512, 12, ff_metasound_lsp8, 1, 5, 3, 3, 

[FFmpeg-devel] [PATCH 06/16] avfilter/vf_qp: Deduplicate variable names arrays

2021-01-03 Thread Andreas Rheinhardt
This also avoids relocations.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_qp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_qp.c b/libavfilter/vf_qp.c
index af46fe0ece..e2d60fdbb5 100644
--- a/libavfilter/vf_qp.c
+++ b/libavfilter/vf_qp.c
@@ -38,6 +38,8 @@ typedef struct QPContext {
 int evaluate_per_mb;
 } QPContext;
 
+static const char *const var_names[] = { "known", "qp", "x", "y", "w", "h", 
NULL };
+
 #define OFFSET(x) offsetof(QPContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
@@ -55,7 +57,6 @@ static int config_input(AVFilterLink *inlink)
 int i;
 int ret;
 AVExpr *e = NULL;
-static const char *const var_names[] = { "known", "qp", "x", "y", "w", 
"h", NULL };
 
 if (!s->qp_expr_str)
 return 0;
@@ -144,7 +145,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 AVVideoBlockParams *b = av_video_enc_params_block(par_out, 
block_idx);
 int qp = sd_in ? in_qp_global + BLOCK_QP_DELTA(block_idx) : 
NAN;
 double var_values[] = { !!sd_in, qp, x, y, s->qstride, s->h, 
0};
-static const char *const var_names[] = { "known", "qp", "x", 
"y", "w", "h", NULL };
 double temp_val;
 
 ret = av_expr_parse_and_eval(_val, s->qp_expr_str,
-- 
2.25.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] [PATCH 05/16] avcodec/vp3data: Deduplicate coeff_tables

2021-01-03 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/vp3data.h | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vp3data.h b/libavcodec/vp3data.h
index 1fbeac731b..272af4e3a0 100644
--- a/libavcodec/vp3data.h
+++ b/libavcodec/vp3data.h
@@ -179,8 +179,7 @@ static const int16_t coeff_table_token_15[2] = { 5, -5 };
 static const int16_t coeff_table_token_16[2] = { 6, -6 };
 
 static const int16_t coeff_table_token_23_24_25_26_27_28_29[2] = { 1, -1 };
-static const int16_t coeff_table_token_30[4] = { 2, 3, -2, -3 };
-static const int16_t coeff_table_token_31[4] = { 2, 3, -2, -3 };
+static const int16_t coeff_table_token_30_31[4] = { 2, 3, -2, -3 };
 
 static const int16_t coeff_table_token_17[4] = {
 7, 8, -7, -8
@@ -377,8 +376,8 @@ static const int16_t *const coeff_tables[32] = {
 coeff_table_token_23_24_25_26_27_28_29,
 coeff_table_token_23_24_25_26_27_28_29,
 coeff_table_token_23_24_25_26_27_28_29,
-coeff_table_token_30,
-coeff_table_token_31
+coeff_table_token_30_31,
+coeff_table_token_30_31
 };
 
 static const uint8_t vp3_bias[5 * 16][32][2] = {
-- 
2.25.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 to libavc/opus to create extradata if missing

2021-01-03 Thread Jonathan Baudanza
On Sun, Jan 3, 2021, at 3:33 PM, James Almer wrote:
> 
> Made those changes and pushed it.

Thanks for your help everyone! Looking forward to deploying 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 to libavc/opus to create extradata if missing

2021-01-03 Thread James Almer

On 1/3/2021 8:05 PM, Lynne wrote:

Jan 3, 2021, 23:48 by j...@jonb.org:




On Sun, Jan 3, 2021, at 2:25 PM, Lynne wrote:


+/* Input sample rate (0 = unspecified) */> +bytestream_put_le32  (, 
0);

Put in 48000 here. Stream copy will preserve extradata, and we don't want to
generate weird streams, even if our decoder ignores this.


+/* Channel count */> +bytestream_put_byte  (, codecpar->channels);> +
/* Mapping family */> +bytestream_put_byte  (, 0x0);

This will only work for mono and stereo. The decoder will error out if more than
2 channels are present. For now maybe error out if the number of channels is 
greater than 2?



Ok! Sample rate changed to 48000. If codecpar->channels is greater than 2, 
AVERROR_INVALIDDATA will be returned. Please advise if there is a better error 
code.

Thanks Lynne!




+static int opus_write_extradata(AVCodecParameters *codecpar) {

Function opening brackets must be put by themselves on a new line.


+    if (codecpar->channels > 2) {
+    return AVERROR_INVALIDDATA;
+    }
+
+    ret = ff_alloc_extradata(codecpar, 19);
+    if (ret < 0) {
+    return ret;
+    }

We don't wrap 1-line conditions in brackets, so just remove them.


+    av_log(s1, AV_LOG_ERROR,
+    "Error creating opus extradata: %s\n",
+    av_err2str(ret));

Weird indentation. There's an extra space in the 2 lines.

Apart from that LGTM.


Made those changes and pushed it.
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Lynne
Jan 3, 2021, 23:48 by j...@jonb.org:

>
>
> On Sun, Jan 3, 2021, at 2:25 PM, Lynne wrote:
>
>> > +/* Input sample rate (0 = unspecified) */> +bytestream_put_le32  
>> > (, 0);
>> Put in 48000 here. Stream copy will preserve extradata, and we don't want to
>> generate weird streams, even if our decoder ignores this.
>>
>> > +/* Channel count */> +bytestream_put_byte  (, 
>> > codecpar->channels);> +/* Mapping family */> +bytestream_put_byte  
>> > (, 0x0);
>> This will only work for mono and stereo. The decoder will error out if more 
>> than
>> 2 channels are present. For now maybe error out if the number of channels is 
>> greater than 2?
>>
>
> Ok! Sample rate changed to 48000. If codecpar->channels is greater than 2, 
> AVERROR_INVALIDDATA will be returned. Please advise if there is a better 
> error code.
>
> Thanks Lynne!
>

> +static int opus_write_extradata(AVCodecParameters *codecpar) {
Function opening brackets must be put by themselves on a new line.

> +    if (codecpar->channels > 2) { 
> +    return AVERROR_INVALIDDATA;
> +    }
> +
> +    ret = ff_alloc_extradata(codecpar, 19);
> +    if (ret < 0) {
> +    return ret;
> +    }
We don't wrap 1-line conditions in brackets, so just remove them.

> +    av_log(s1, AV_LOG_ERROR, 
> +    "Error creating opus extradata: %s\n",
> +    av_err2str(ret));
Weird indentation. There's an extra space in the 2 lines.

Apart from that LGTM.
___
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] Problem with "-f concat" and mixed path types on Windows.

2021-01-03 Thread Steinar Apalnes
> >
> > I used the devel list because I considered, and still consider this as
> > a bug, and not a user "how-to" question.
> >
>
> My general rule of thumb I use whenever someone asks if they should post in
> #ffmpeg or #ffmpeg-devel (irc) etc is to only ask on devel if you are
> specifically hacking on ffmpeg and might need help on some things. Else,
> everything else goes either on trac (for bugs) or the ffmpeg-user or
> #ffmpeg for general or probing questions, such as
> > does the concat work as intended when it's adding the prefix with a
> letter: before the share
> path?

Thanks for clarifying :-)

-steinar
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Jonathan Baudanza


On Sun, Jan 3, 2021, at 2:25 PM, Lynne wrote:
> > +/* Input sample rate (0 = unspecified) */> +bytestream_put_le32  
> > (, 0);
> Put in 48000 here. Stream copy will preserve extradata, and we don't want to
> generate weird streams, even if our decoder ignores this.
> 
> > +/* Channel count */> +bytestream_put_byte  (, 
> > codecpar->channels);> +/* Mapping family */> +bytestream_put_byte  
> > (, 0x0);
> This will only work for mono and stereo. The decoder will error out if more 
> than
> 2 channels are present. For now maybe error out if the number of channels is 
> greater than 2?

Ok! Sample rate changed to 48000. If codecpar->channels is greater than 2, 
AVERROR_INVALIDDATA will be returned. Please advise if there is a better error 
code.

Thanks Lynne! 

0001-ff_rtp_parse_open-builds-Opus-head-in-extradata.patch
Description: Binary data
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Lynne
Jan 3, 2021, 23:06 by j...@jonb.org:

> On Sun, Jan 3, 2021, at 12:50 PM, Andreas Rheinhardt wrote:
>
>>
>> It would be better if you used ff_alloc_extradata(): It also already
>> frees the extradata that might be present. And it does only set the
>> extradata_size after the allocation succeeded. But it is of course even
>> better if you actually errored out in case of allocation failure.
>>
>> Furthermore, your patch will lead to "declaration after statement" (or
>> something like that) warnings, because FFmpeg only allows variable
>> declarations at the beginning of each block (this is a remnant from C90).
>>
>
> Thanks Andreas!
>
> The patch now uses ff_alloc_extradata, and I moved the bitstream writer into 
> its own function so it can create the bs variable on the stack.
>
> I wasn't sure of the best way to error out, since ff_rtp_parse_open doesn't 
> return an error value. So I log the error and return NULL. Please advise if 
> there is a better way.
>

> +/* Input sample rate (0 = unspecified) */> +bytestream_put_le32  
> (, 0);
Put in 48000 here. Stream copy will preserve extradata, and we don't want to
generate weird streams, even if our decoder ignores this.

> +/* Channel count */> +bytestream_put_byte  (, 
> codecpar->channels);> +/* Mapping family */> +bytestream_put_byte  
> (, 0x0);
This will only work for mono and stereo. The decoder will error out if more than
2 channels are present. For now maybe error out if the number of channels is 
greater than 2?
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Jonathan Baudanza
On Sun, Jan 3, 2021, at 12:50 PM, Andreas Rheinhardt wrote:
> 
> It would be better if you used ff_alloc_extradata(): It also already
> frees the extradata that might be present. And it does only set the
> extradata_size after the allocation succeeded. But it is of course even
> better if you actually errored out in case of allocation failure.
> 
> Furthermore, your patch will lead to "declaration after statement" (or
> something like that) warnings, because FFmpeg only allows variable
> declarations at the beginning of each block (this is a remnant from C90).
> 

Thanks Andreas!

The patch now uses ff_alloc_extradata, and I moved the bitstream writer into 
its own function so it can create the bs variable on the stack.

I wasn't sure of the best way to error out, since ff_rtp_parse_open doesn't 
return an error value. So I log the error and return NULL. Please advise if 
there is a better way.

0001-ff_rtp_parse_open-builds-Opus-head-in-extradata.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 1/6] avformat/utils: do not overwrite already existing program with defaults in av_new_program

2021-01-03 Thread Marton Balint



On Mon, 28 Dec 2020, Marton Balint wrote:


av_new_program returns the existing program if that already exists, in that
case it makes no sense to overwrite existing attributes.

Signed-off-by: Marton Balint 
---
libavformat/utils.c | 12 +---
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1a87d9422a..270ed8d4f2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4568,14 +4568,12 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
dynarray_add(>programs, >nb_programs, program);
program->discard = AVDISCARD_NONE;
program->pmt_version = -1;
+program->id = id;
+program->pts_wrap_reference = AV_NOPTS_VALUE;
+program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
+program->start_time =
+program->end_time   = AV_NOPTS_VALUE;
}
-program->id = id;
-program->pts_wrap_reference = AV_NOPTS_VALUE;
-program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
-
-program->start_time =
-program->end_time   = AV_NOPTS_VALUE;
-
return program;
}


Ping for the series, will apply soon.

Thanks,
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Andreas Rheinhardt
Jonathan Baudanza:
> On Wed, Dec 30, 2020, at 10:34 AM, James Almer wrote:
> 
>> Nothing should have done it at that point. The demuxer allocates the 
>> AVStream after all. But to be sure you can do 
>> av_freep(>codecpar->extradata) to ensure it's NULL before anything 
>> else is done.
> 
> Thanks James.
> 
> I've updated the patch to include av_freep. If there's no other feedback, I 
> think this is ready to go.
> 

It would be better if you used ff_alloc_extradata(): It also already
frees the extradata that might be present. And it does only set the
extradata_size after the allocation succeeded. But it is of course even
better if you actually errored out in case of allocation failure.

Furthermore, your patch will lead to "declaration after statement" (or
something like that) warnings, because FFmpeg only allows variable
declarations at the beginning of each block (this is a remnant from C90).

- 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] FFmpeg buying an Apple M1 Mac Mini

2021-01-03 Thread Josh Dekker

On 2021/01/03 20:18, Michael Niedermayer wrote:

On Sun, Jan 03, 2021 at 06:32:11PM +0100, Kieran Kunhya wrote:

Hello,

As it's 2021 I would like to propose FFmpeg purchase one or more (e.g
FATE + development) Apple M1 Mac Minis and provide access to developers.
This is something I have done a few years ago when AVX2 was a new
instruction set.

I can host these in the UK 24/7 and provide access and label them as
belonging to the project and not me.

< To clarify these will be hosted in a proper datacentre, with proper
< connectivity, cooling etc.


I would propose buying and getting reimbursed one or more of:

- Apple M1 chip with 8‑core CPU, 8‑core GPU and 16‑core Neural Engine
- 16GB unified memory
- 1TB SSD storage
- Gigabit Ethernet

This is £1,299.00 in the UK right now on the Apple Site.


assuming noone has objections or better suggestions
LGTM

thx



Ok from me too. I would suggest getting 2x, one for only FATE and the
other for general access & development for FFmpeg developers.

--
Josh
___
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 to libavc/opus to create extradata if missing

2021-01-03 Thread Jonathan Baudanza
On Wed, Dec 30, 2020, at 10:34 AM, James Almer wrote:

> Nothing should have done it at that point. The demuxer allocates the 
> AVStream after all. But to be sure you can do 
> av_freep(>codecpar->extradata) to ensure it's NULL before anything 
> else is done.

Thanks James.

I've updated the patch to include av_freep. If there's no other feedback, I 
think this is ready to go.

0001-ff_rtp_parse_open-builds-Opus-head-in-extradata.patch
Description: Binary data
___
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] Problem with "-f concat" and mixed path types on Windows.

2021-01-03 Thread Christopher Degawa
>
> I used the devel list because I considered, and still consider this as
> a bug, and not a user "how-to" question.
>

My general rule of thumb I use whenever someone asks if they should post in
#ffmpeg or #ffmpeg-devel (irc) etc is to only ask on devel if you are
specifically hacking on ffmpeg and might need help on some things. Else,
everything else goes either on trac (for bugs) or the ffmpeg-user or
#ffmpeg for general or probing questions, such as
> does the concat work as intended when it's adding the prefix with a
letter: before the share
path?
___
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] FFmpeg buying an Apple M1 Mac Mini

2021-01-03 Thread Michael Niedermayer
On Sun, Jan 03, 2021 at 06:32:11PM +0100, Kieran Kunhya wrote:
> Hello,
> 
> As it's 2021 I would like to propose FFmpeg purchase one or more (e.g
> FATE + development) Apple M1 Mac Minis and provide access to developers.
> This is something I have done a few years ago when AVX2 was a new
> instruction set.
> 
> I can host these in the UK 24/7 and provide access and label them as
> belonging to the project and not me.
< To clarify these will be hosted in a proper datacentre, with proper
< connectivity, cooling etc.
> 
> I would propose buying and getting reimbursed one or more of:
> 
>- Apple M1 chip with 8‑core CPU, 8‑core GPU and 16‑core Neural Engine
>- 16GB unified memory
>- 1TB SSD storage
>- Gigabit Ethernet
> 
> This is £1,299.00 in the UK right now on the Apple Site.

assuming noone has objections or better suggestions
LGTM

thx

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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

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

Re: [FFmpeg-devel] FFmpeg buying an Apple M1 Mac Mini

2021-01-03 Thread Kieran Kunhya
>
> I can host these in the UK 24/7 and provide access and label them as
> belonging to the project and not me.
>

To clarify these will be hosted in a proper datacentre, with proper
connectivity, cooling etc.

Kieran
___
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/7] api-band-test: use non-obsolete decoding API

2021-01-03 Thread James Almer

On 12/12/2020 12:45 PM, Anton Khirnov wrote:

---
  tests/api/api-band-test.c | 90 +++
  1 file changed, 53 insertions(+), 37 deletions(-)

diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c
index 257e741694..34bed1d6be 100644
--- a/tests/api/api-band-test.c
+++ b/tests/api/api-band-test.c
@@ -71,14 +71,12 @@ static int video_decode(const char *input_filename)
  AVCodecParameters *origin_par = NULL;
  uint8_t *byte_buffer = NULL;
  AVFrame *fr = NULL;
-AVPacket pkt;
+AVPacket *pkt;
  AVFormatContext *fmt_ctx = NULL;
  int number_of_written_bytes;
  int video_stream;
-int got_frame = 0;
  int byte_buffer_size;
  int result;
-int end_of_stream = 0;
  
  draw_horiz_band_called = 0;
  
@@ -135,6 +133,12 @@ static int video_decode(const char *input_filename)

  return AVERROR(ENOMEM);
  }
  
+pkt = av_packet_alloc();

+if (!pkt) {
+av_log(NULL, AV_LOG_ERROR, "Cannot allocate packet\n");
+return AVERROR(ENOMEM);
+}
+
  if (strcmp(codec->name, "flv") && strcmp(codec->name, "mpeg4") && 
strcmp(codec->name, "huffyuv")) {
  av_log(NULL, AV_LOG_ERROR, "Wrong codec\n");
  return -1;
@@ -155,48 +159,60 @@ static int video_decode(const char *input_filename)
  memset(slice_byte_buffer, 0, byte_buffer_size);
  slice_byte_buffer_size = byte_buffer_size;
  
-av_init_packet();

-do {
-if (!end_of_stream) {
-if (av_read_frame(fmt_ctx, ) < 0) {
-end_of_stream = 1;
-}
+result = 0;
+while (result >= 0) {
+result = av_read_frame(fmt_ctx, pkt);
+if (result >= 0 && pkt->stream_index != video_stream) {
+av_packet_unref(pkt);
+continue;
  }
-if (end_of_stream) {
-pkt.data = NULL;
-pkt.size = 0;
+
+if (result < 0)
+result = avcodec_send_packet(ctx, NULL);
+else
+result = avcodec_send_packet(ctx, pkt);


avcodec_send_packet() accepts both NULL and a blank AVPacket to signal 
EOF, so no need for this check. av_read_frame() ensures pkt is blank on 
error, but it's not clear from the doxy if that also happens on EOF.



+
+av_packet_unref(pkt);
+
+if (result < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error submitting a packet for 
decoding\n");
+return result;
  }
-if (pkt.stream_index == video_stream || end_of_stream) {
-got_frame = 0;
-result = avcodec_decode_video2(ctx, fr, _frame, );
-if (result < 0) {
+
+while (result >= 0) {
+result = avcodec_receive_frame(ctx, fr);
+if (result == AVERROR_EOF)
+goto finish;
+else if (result == AVERROR(EAGAIN)) {
+result = 0;
+break;
+} else if (result < 0) {
  av_log(NULL, AV_LOG_ERROR, "Error decoding frame\n");
  return result;
  }
-if (got_frame) {
-number_of_written_bytes = av_image_copy_to_buffer(byte_buffer, 
byte_buffer_size,
-(const uint8_t* const *)fr->data, (const 
int*) fr->linesize,
-ctx->pix_fmt, ctx->width, ctx->height, 
1);
-if (number_of_written_bytes < 0) {
-av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n");
-return number_of_written_bytes;
-}
-if (draw_horiz_band_called == 0) {
-av_log(NULL, AV_LOG_ERROR, "draw_horiz_band haven't been 
called!\n");
-return -1;
-}
-if (av_adler32_update(0, (const uint8_t*)byte_buffer, 
number_of_written_bytes) !=
-av_adler32_update(0, (const uint8_t*)slice_byte_buffer, 
number_of_written_bytes)) {
-av_log(NULL, AV_LOG_ERROR, "Decoded frames with and without 
draw_horiz_band are not the same!\n");
-return -1;
-}
+
+number_of_written_bytes = av_image_copy_to_buffer(byte_buffer, 
byte_buffer_size,
+(const uint8_t* const *)fr->data, (const 
int*) fr->linesize,
+ctx->pix_fmt, ctx->width, ctx->height, 1);
+if (number_of_written_bytes < 0) {
+av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n");
+return number_of_written_bytes;
+}
+if (draw_horiz_band_called == 0) {
+av_log(NULL, AV_LOG_ERROR, "draw_horiz_band haven't been 
called!\n");
+return -1;
+}
+if (av_adler32_update(0, (const uint8_t*)byte_buffer, 
number_of_written_bytes) !=
+av_adler32_update(0, (const uint8_t*)slice_byte_buffer, 

[FFmpeg-devel] FFmpeg buying an Apple M1 Mac Mini

2021-01-03 Thread Kieran Kunhya
Hello,

As it's 2021 I would like to propose FFmpeg purchase one or more (e.g
FATE + development) Apple M1 Mac Minis and provide access to developers.
This is something I have done a few years ago when AVX2 was a new
instruction set.

I can host these in the UK 24/7 and provide access and label them as
belonging to the project and not me.

I would propose buying and getting reimbursed one or more of:

   - Apple M1 chip with 8‑core CPU, 8‑core GPU and 16‑core Neural Engine
   - 16GB unified memory
   - 1TB SSD storage
   - Gigabit Ethernet

This is £1,299.00 in the UK right now on the Apple Site.

Regards,
Kieran Kunhya
___
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 1/3] dnn: fix redefining typedefs and also refine naming with correct prefix

2021-01-03 Thread Anton Khirnov
Quoting Guo, Yejun (2020-12-30 16:35:06)
> The prefix for symbols not exported from the library and not
> local to one translation unit is ff_ (or FF for types).
> 
> Signed-off-by: Guo, Yejun 
> ---
>  libavfilter/dnn/dnn_backend_openvino.c | 32 ++---
>  libavfilter/dnn/queue.c| 66 +-
>  libavfilter/dnn/queue.h| 20 
>  libavfilter/dnn/safe_queue.c   | 34 ++---
>  libavfilter/dnn/safe_queue.h   | 14 +++---
>  5 files changed, 83 insertions(+), 83 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
> b/libavfilter/dnn/dnn_backend_openvino.c
> index a35d72a38c..331f13b263 100644
> --- a/libavfilter/dnn/dnn_backend_openvino.c
> +++ b/libavfilter/dnn/dnn_backend_openvino.c
> @@ -53,8 +53,8 @@ typedef struct OVModel{
>  ie_infer_request_t *infer_request;
>  
>  /* for async execution */
> -safe_queue *request_queue;  // holds RequestItem
> -queue *task_queue;  // holds TaskItem
> +FFSafeQueue *request_queue;   // holds RequestItem
> +FFQueue *task_queue;  // holds TaskItem

Note that the ff prefix is only required for functions, to avoid
conflicts with static linking. Struct names are not a part of the ABI,
so no namespacing is needed for private structs.

-- 
Anton Khirnov
___
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: add xdif video filter

2021-01-03 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi|  54 +++
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_xdif.c   | 261 
 libavfilter/xdif.h  |  47 ++
 libavfilter/xdif_template.c | 289 
 6 files changed, 653 insertions(+)
 create mode 100644 libavfilter/vf_xdif.c
 create mode 100644 libavfilter/xdif.h
 create mode 100644 libavfilter/xdif_template.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 01ae540c5c..92f9c53066 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21152,6 +21152,60 @@ Set the scaling dimension: @code{2} for @code{2xBR}, 
@code{3} for
 Default is @code{3}.
 @end table
 
+@section xdif
+
+Deinterlace the input video using X Deinterlacing Filter.
+
+Spatial only filter that operates in 8x8 blocks with edge-oriented 
interpolation.
+It accepts the following options:
+
+@table @option
+@item mode
+The interlacing mode to adopt. It accepts one of the following values:
+
+@table @option
+@item frame
+Output one frame for each frame.
+@item field
+Output one frame for each field.
+@end table
+
+The default value is @code{field}.
+
+@item parity
+The picture field parity assumed for the input interlaced video. It accepts one
+of the following values:
+
+@table @option
+@item ff
+Assume the top field is first.
+@item bff
+Assume the bottom field is first.
+@item auto
+Enable automatic detection of field parity.
+@end table
+
+The default value is @code{auto}.
+If the interlacing is unknown or the decoder does not export this information,
+top field first will be assumed.
+
+@item deint
+Specify which frames to deinterlace. Accepts one of the following
+values:
+
+@table @option
+@item all
+Deinterlace all frames.
+@item interlaced
+Only deinterlace frames marked as interlaced.
+@end table
+
+The default value is @code{all}.
+@end table
+
+@subsection Commands
+This filter supports same @ref{commands} as options.
+
 @section xfade
 
 Apply cross fade from one input video stream to another input video stream.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ad1046d526..d14023c13d 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -467,6 +467,7 @@ OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o
 OBJS-$(CONFIG_WAVEFORM_FILTER)   += vf_waveform.o
 OBJS-$(CONFIG_WEAVE_FILTER)  += vf_weave.o
 OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o
+OBJS-$(CONFIG_XDIF_FILTER)   += vf_xdif.o
 OBJS-$(CONFIG_XFADE_FILTER)  += vf_xfade.o
 OBJS-$(CONFIG_XFADE_OPENCL_FILTER)   += vf_xfade_opencl.o opencl.o 
opencl/xfade.o
 OBJS-$(CONFIG_XMEDIAN_FILTER)+= vf_xmedian.o framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index ce317dfa1c..215dfef5c5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -445,6 +445,7 @@ extern AVFilter ff_vf_w3fdif;
 extern AVFilter ff_vf_waveform;
 extern AVFilter ff_vf_weave;
 extern AVFilter ff_vf_xbr;
+extern AVFilter ff_vf_xdif;
 extern AVFilter ff_vf_xfade;
 extern AVFilter ff_vf_xfade_opencl;
 extern AVFilter ff_vf_xmedian;
diff --git a/libavfilter/vf_xdif.c b/libavfilter/vf_xdif.c
new file mode 100644
index 00..5476527f54
--- /dev/null
+++ b/libavfilter/vf_xdif.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2000-2011 VLC authors and VideoLAN
+ * Copyright (c) Laurent Aimar 
+ * Copyright (c) 2021 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+#include "xdif.h"
+
+#define OFFSET(x) offsetof(XDIFContext, x)
+#define FLAGS 
AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
+#define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, 
{.i64=val}, 0, 0, FLAGS, unit }
+
+static const AVOption xdif_options[] = {
+{ "mode", "specify the mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=1}, 0, 
1, FLAGS, "mode" },
+CONST("frame", NULL, 0, "mode"),
+CONST("field",