[FFmpeg-cvslog] avutil/iamf: fix offsets for mix_gain options

2024-05-04 Thread James Almer
ffmpeg | branch: release/7.0 | James Almer  | Sat May  4 
21:20:35 2024 -0300| [a51c06b42c7b3f609b774983ee686ebe94186343] | committer: 
James Almer

avutil/iamf: fix offsets for mix_gain options

Signed-off-by: James Almer 
(cherry picked from commit d6e877bbcde2a0d1422d7b5c7339bb03891d19fc)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a51c06b42c7b3f609b774983ee686ebe94186343
---

 libavutil/iamf.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/iamf.c b/libavutil/iamf.c
index c96100e7a0..14f49cba93 100644
--- a/libavutil/iamf.c
+++ b/libavutil/iamf.c
@@ -66,10 +66,10 @@ child_type *av_iamf_ ## parent_name ## _add_ ## 
child_name(parent_type *parent_n
 static const AVOption mix_gain_options[] = {
 { "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_INT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
 { "animation_type", "set animation_type", OFFSET(animation_type), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, FLAGS },
-{ "start_point_value", "set start_point_value", OFFSET(animation_type), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
-{ "end_point_value", "set end_point_value", OFFSET(animation_type), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
-{ "control_point_value", "set control_point_value", 
OFFSET(animation_type), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS 
},
-{ "control_point_relative_time", "set control_point_relative_time", 
OFFSET(animation_type), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0.0, 1.0, FLAGS },
+{ "start_point_value", "set start_point_value", OFFSET(start_point_value), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
+{ "end_point_value", "set end_point_value", OFFSET(end_point_value), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
+{ "control_point_value", "set control_point_value", 
OFFSET(control_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, 
FLAGS },
+{ "control_point_relative_time", "set control_point_relative_time", 
OFFSET(control_point_relative_time), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0.0, 
1.0, FLAGS },
 { NULL },
 };
 

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

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


[FFmpeg-cvslog] avutil/iamf: use AV_OPT_TYPE_UINT

2024-05-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat May  4 21:31:26 
2024 -0300| [088bf6e8c1ca99c7db2d250ca9b04bb2568f6ecb] | committer: James Almer

avutil/iamf: use AV_OPT_TYPE_UINT

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=088bf6e8c1ca99c7db2d250ca9b04bb2568f6ecb
---

 libavutil/iamf.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavutil/iamf.c b/libavutil/iamf.c
index 14f49cba93..791954d951 100644
--- a/libavutil/iamf.c
+++ b/libavutil/iamf.c
@@ -64,8 +64,8 @@ child_type *av_iamf_ ## parent_name ## _add_ ## 
child_name(parent_type *parent_n
 //
 #define OFFSET(x) offsetof(AVIAMFMixGain, x)
 static const AVOption mix_gain_options[] = {
-{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_INT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
-{ "animation_type", "set animation_type", OFFSET(animation_type), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, FLAGS },
+{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
+{ "animation_type", "set animation_type", OFFSET(animation_type), 
AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 2, FLAGS },
 { "start_point_value", "set start_point_value", OFFSET(start_point_value), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
 { "end_point_value", "set end_point_value", OFFSET(end_point_value), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
 { "control_point_value", "set control_point_value", 
OFFSET(control_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, 
FLAGS },
@@ -83,8 +83,8 @@ static const AVClass mix_gain_class = {
 #undef OFFSET
 #define OFFSET(x) offsetof(AVIAMFDemixingInfo, x)
 static const AVOption demixing_info_options[] = {
-{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_INT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
-{ "dmixp_mode", "set dmixp_mode", OFFSET(dmixp_mode), AV_OPT_TYPE_INT, 
{.i64 = 0 }, 0, 6, FLAGS },
+{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
+{ "dmixp_mode", "set dmixp_mode", OFFSET(dmixp_mode), AV_OPT_TYPE_UINT, 
{.i64 = 0 }, 0, 6, FLAGS },
 { NULL },
 };
 
@@ -98,7 +98,7 @@ static const AVClass demixing_info_class = {
 #undef OFFSET
 #define OFFSET(x) offsetof(AVIAMFReconGain, x)
 static const AVOption recon_gain_options[] = {
-{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_INT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
+{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
 { NULL },
 };
 
@@ -112,10 +112,10 @@ static const AVClass recon_gain_class = {
 #undef OFFSET
 #define OFFSET(x) offsetof(AVIAMFParamDefinition, x)
 static const AVOption param_definition_options[] = {
-{ "parameter_id", "set parameter_id", OFFSET(parameter_id), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
-{ "parameter_rate", "set parameter_rate", OFFSET(parameter_rate), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
-{ "duration", "set duration", OFFSET(duration), AV_OPT_TYPE_INT, {.i64 = 0 
}, 0, UINT_MAX, FLAGS },
-{ "constant_subblock_duration", "set constant_subblock_duration", 
OFFSET(constant_subblock_duration), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, UINT_MAX, 
FLAGS },
+{ "parameter_id", "set parameter_id", OFFSET(parameter_id), 
AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
+{ "parameter_rate", "set parameter_rate", OFFSET(parameter_rate), 
AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
+{ "duration", "set duration", OFFSET(duration), AV_OPT_TYPE_UINT, {.i64 = 
0 }, 0, UINT_MAX, FLAGS },
+{ "constant_subblock_duration", "set constant_subblock_duration", 
OFFSET(constant_subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, 
FLAGS },
 { NULL },
 };
 
@@ -289,7 +289,7 @@ static const AVOption audio_element_options[] = {
{ .i64 = AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL }, .unit = 
"audio_element_type" },
 { "scene",   NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE },   .unit = 
"audio_element_type" },
-{ "default_w", "set default_w", OFFSET(default_w), AV_OPT_TYPE_INT, {.i64 
= 0 }, 0, 10, FLAGS },
+{ "default_w", "set default_w", OFFSET(default_w), AV_OPT_TYPE_UINT, {.i64 
= 0 }, 0, 10, FLAGS },
 { NULL },
 };
 

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

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


[FFmpeg-cvslog] avutil/opt: add an unsigned option type

2024-05-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Feb 27 17:30:40 
2024 -0300| [d053290d8dd4dfddebc7285628360b67e185d63d] | committer: James Almer

avutil/opt: add an unsigned option type

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d053290d8dd4dfddebc7285628360b67e185d63d
---

 doc/APIchanges|  3 +++
 libavutil/opt.c   | 17 +
 libavutil/opt.h   |  2 ++
 libavutil/tests/opt.c |  9 +
 libavutil/version.h   |  4 ++--
 tests/ref/fate/opt| 32 ++--
 6 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 0566fcdcc5..824beec9d3 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-05-04 - xx - lavu 59.17.100 - opt.h
+  Add AV_OPT_TYPE_UINT and av_opt_eval_uint().
+
 2024-04-24 - 8616cfe0890 - lavu 59.16.100 - opt.h
   Add AV_OPT_SERIALIZE_SEARCH_CHILDREN.
 
diff --git a/libavutil/opt.c b/libavutil/opt.c
index ecbf7efe5f..a892e056cb 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -62,6 +62,7 @@ static const size_t opt_elem_size[] = {
 [AV_OPT_TYPE_FLAGS] = sizeof(unsigned),
 [AV_OPT_TYPE_INT]   = sizeof(int),
 [AV_OPT_TYPE_INT64] = sizeof(int64_t),
+[AV_OPT_TYPE_UINT]  = sizeof(unsigned),
 [AV_OPT_TYPE_UINT64]= sizeof(uint64_t),
 [AV_OPT_TYPE_DOUBLE]= sizeof(double),
 [AV_OPT_TYPE_FLOAT] = sizeof(float),
@@ -166,6 +167,9 @@ static int read_number(const AVOption *o, const void *dst, 
double *num, int *den
 case AV_OPT_TYPE_INT:
 *intnum = *(int *)dst;
 return 0;
+case AV_OPT_TYPE_UINT:
+*intnum = *(unsigned int *)dst;
+return 0;
 case AV_OPT_TYPE_DURATION:
 case AV_OPT_TYPE_INT64:
 case AV_OPT_TYPE_UINT64:
@@ -219,6 +223,7 @@ static int write_number(void *obj, const AVOption *o, void 
*dst, double num, int
 case AV_OPT_TYPE_BOOL:
 case AV_OPT_TYPE_FLAGS:
 case AV_OPT_TYPE_INT:
+case AV_OPT_TYPE_UINT:
 *(int *)dst = llrint(num / den) * intnum;
 break;
 case AV_OPT_TYPE_DURATION:
@@ -319,6 +324,7 @@ static int set_string(void *obj, const AVOption *o, const 
char *val, uint8_t **d
   opt->type == AV_OPT_TYPE_UINT64 || \
   opt->type == AV_OPT_TYPE_CONST || \
   opt->type == AV_OPT_TYPE_FLAGS || \
+  opt->type == AV_OPT_TYPE_UINT  || \
   opt->type == AV_OPT_TYPE_INT) \
  ? opt->default_val.i64 \
  : opt->default_val.dbl)
@@ -605,6 +611,7 @@ static int opt_set_elem(void *obj, void *target_obj, const 
AVOption *o,
 return set_string_binary(obj, o, val, dst);
 case AV_OPT_TYPE_FLAGS:
 case AV_OPT_TYPE_INT:
+case AV_OPT_TYPE_UINT:
 case AV_OPT_TYPE_INT64:
 case AV_OPT_TYPE_UINT64:
 case AV_OPT_TYPE_FLOAT:
@@ -767,6 +774,7 @@ int av_opt_eval_ ## name(void *obj, const AVOption *o,  
\
 
 OPT_EVAL_NUMBER(flags,  AV_OPT_TYPE_FLAGS,int)
 OPT_EVAL_NUMBER(int,AV_OPT_TYPE_INT,  int)
+OPT_EVAL_NUMBER(uint,   AV_OPT_TYPE_UINT, unsigned)
 OPT_EVAL_NUMBER(int64,  AV_OPT_TYPE_INT64,int64_t)
 OPT_EVAL_NUMBER(float,  AV_OPT_TYPE_FLOAT,float)
 OPT_EVAL_NUMBER(double, AV_OPT_TYPE_DOUBLE,   double)
@@ -997,6 +1005,9 @@ static int opt_get_elem(const AVOption *o, uint8_t **pbuf, 
size_t buf_len,
 case AV_OPT_TYPE_INT:
 ret = snprintf(*pbuf, buf_len, "%d", *(int *)dst);
 break;
+case AV_OPT_TYPE_UINT:
+ret = snprintf(*pbuf, buf_len, "%u", *(unsigned *)dst);
+break;
 case AV_OPT_TYPE_INT64:
 ret = snprintf(*pbuf, buf_len, "%"PRId64, *(int64_t *)dst);
 break;
@@ -1444,6 +1455,7 @@ static void log_type(void *av_log_obj, const AVOption *o,
 [AV_OPT_TYPE_FLAGS] = "",
 [AV_OPT_TYPE_INT]   = "",
 [AV_OPT_TYPE_INT64] = "",
+[AV_OPT_TYPE_UINT]  = "",
 [AV_OPT_TYPE_UINT64]= "",
 [AV_OPT_TYPE_DOUBLE]= "",
 [AV_OPT_TYPE_FLOAT] = "",
@@ -1515,6 +1527,7 @@ static void log_default(void *obj, void *av_log_obj, 
const AVOption *opt)
 av_log(av_log_obj, AV_LOG_INFO, "%s", buf);
 break;
 }
+case AV_OPT_TYPE_UINT:
 case AV_OPT_TYPE_INT:
 case AV_OPT_TYPE_UINT64:
 case AV_OPT_TYPE_INT64: {
@@ -1600,6 +1613,7 @@ static void opt_list(void *obj, void *av_log_obj, const 
char *unit,
 if (av_opt_query_ranges(, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 
0) {
 switch (opt->type) {
 case AV_OPT_TYPE_INT:
+case AV_OPT_TYPE_UINT:
 case AV_OPT_TYPE_INT64:
 case 

[FFmpeg-cvslog] avutil/tests/opt: test values > INT_MAX for INT64 type

2024-05-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Feb 27 17:30:39 
2024 -0300| [9902fc550aec7215723e441edbe02f4dc40e6089] | committer: James Almer

avutil/tests/opt: test values > INT_MAX for INT64 type

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9902fc550aec7215723e441edbe02f4dc40e6089
---

 libavutil/tests/opt.c |  5 +++--
 tests/ref/fate/opt| 25 ++---
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index 58d5970cc4..7842b0567d 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -105,7 +105,7 @@ static const AVOption test_options[]= {
 {"bin","set binary value",   OFFSET(binary), 
AV_OPT_TYPE_BINARY, { .str="62696e00" },   0, 0, 1 
},
 {"bin1",   "set binary value",   OFFSET(binary1),
AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 
},
 {"bin2",   "set binary value",   OFFSET(binary2),
AV_OPT_TYPE_BINARY, { .str="" },   0, 0, 1 
},
-{"num64",  "set num 64bit",  OFFSET(num64),  
AV_OPT_TYPE_INT64,  { .i64 = 1 }, -1,   100, 1 
},
+{"num64",  "set num 64bit",  OFFSET(num64),  
AV_OPT_TYPE_INT64,  { .i64 = 1LL << 32 }, -1, 1LL << 32, 1 
},
 {"flt","set float",  OFFSET(flt),
AV_OPT_TYPE_FLOAT,  { .dbl = 1.0 / 3 },0,   100, 1 
},
 {"dbl","set double", OFFSET(dbl),
AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 },0,   100, 1 
},
 {"bool1",  "set boolean value",  OFFSET(bool1),  
AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1, 1 
},
@@ -391,7 +391,8 @@ int main(void)
 "num64=44.4",
 "num64=-1",
 "num64=-2",
-"num64=101",
+"num64=4294967296",
+"num64=4294967297",
 "flt=bogus",
 "flt=2",
 "flt=2.2",
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index e90ec73e62..4e6112c8c5 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -14,7 +14,7 @@ color=255 192 203 255
 channel_layout=311=311
 binary=62 69 6e 0
 binary_size=4
-num64=1
+num64=4294967296
 flt=0.33
 dbl=0.33
 array_str[0]=str0
@@ -43,7 +43,7 @@ TestContext AVOptions:
   -binE.. set binary value
   -bin1   E.. set binary value
   -bin2   E.. set binary value
-  -num64   E.. set num 64bit (from -1 to 100) 
(default 1)
+  -num64   E.. set num 64bit (from -1 to 
4.29497e+09) (default 4294967296)
   -flt E.. set float (from 0 to 100) 
(default 0.33)
   -dblE.. set double (from 0 to 100) 
(default 0.33)
   -bool1 E.. set boolean value (default auto)
@@ -134,7 +134,7 @@ name: cl  get: hexagonalset: OK 
  get: hexagonal
 name: bin get: 62696E00 set: OK   get: 62696E00
 OK
 name: bin1get:  set: OK   get: 
 OK
 name: bin2get:  set: OK   get: 
 OK
-name: num64   get: 1set: OK   get: 1   
 OK
+name: num64   get: 4294967296   set: OK   get: 4294967296  
 OK
 name: flt get: 0.33 set: OK   get: 0.33
 OK
 name: dbl get: 0.33 set: OK   get: 0.33
 OK
 name: bool1   get: auto set: OK   get: auto
 OK
@@ -150,7 +150,7 @@ array_dict=NULL; nb_array_dict=0
 av_opt_get("array_dict") -> NULL
 
 Test av_opt_serialize()
-num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x0001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=1,flt=0.33,dbl=0.33,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str2,array_dict=k00\=v00:k01\=v\\\,01\,k10\=v\=1:0
+num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x0001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.33,dbl=0.33,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str2,array_dict=k00\=v00:k01\=v\\\,01\,k10\=v\=1:0
 Setting entry with key 'num' to value '0'
 Setting entry with key 'toggle' to value '1'
 Setting entry with key 'rational' to value '1/1'
@@ -167,7 

[FFmpeg-cvslog] avutil/tests/opt: test negative values for INT and INT64 types

2024-05-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Feb 27 10:59:46 
2024 -0300| [72ac4959606048343589efd282dd36b5dc9793e8] | committer: James Almer

avutil/tests/opt: test negative values for INT and INT64 types

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72ac4959606048343589efd282dd36b5dc9793e8
---

 libavutil/tests/opt.c | 11 +--
 tests/ref/fate/opt| 35 ++-
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index abe1b0dee4..58d5970cc4 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -86,7 +86,7 @@ static const AVOptionArrayDef array_dict = {
 };
 
 static const AVOption test_options[]= {
-{"num","set num",OFFSET(num),
AV_OPT_TYPE_INT,{ .i64 = 0 },  0,   100, 1 
},
+{"num","set num",OFFSET(num),
AV_OPT_TYPE_INT,{ .i64 = 0 }, -1,   100, 1 
},
 {"toggle", "set toggle", OFFSET(toggle), 
AV_OPT_TYPE_INT,{ .i64 = 1 },  0, 1, 1 
},
 {"rational",   "set rational",   OFFSET(rational),   
AV_OPT_TYPE_RATIONAL,   { .dbl = 1 },  0,10, 1 
},
 {"string", "set string", OFFSET(string), 
AV_OPT_TYPE_STRING, { .str = "default" },   CHAR_MIN,  CHAR_MAX, 1 
},
@@ -105,7 +105,7 @@ static const AVOption test_options[]= {
 {"bin","set binary value",   OFFSET(binary), 
AV_OPT_TYPE_BINARY, { .str="62696e00" },   0, 0, 1 
},
 {"bin1",   "set binary value",   OFFSET(binary1),
AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 
},
 {"bin2",   "set binary value",   OFFSET(binary2),
AV_OPT_TYPE_BINARY, { .str="" },   0, 0, 1 
},
-{"num64",  "set num 64bit",  OFFSET(num64),  
AV_OPT_TYPE_INT64,  { .i64 = 1 },  0,   100, 1 
},
+{"num64",  "set num 64bit",  OFFSET(num64),  
AV_OPT_TYPE_INT64,  { .i64 = 1 }, -1,   100, 1 
},
 {"flt","set float",  OFFSET(flt),
AV_OPT_TYPE_FLOAT,  { .dbl = 1.0 / 3 },0,   100, 1 
},
 {"dbl","set double", OFFSET(dbl),
AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 },0,   100, 1 
},
 {"bool1",  "set boolean value",  OFFSET(bool1),  
AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1, 1 
},
@@ -380,10 +380,17 @@ int main(void)
 "bin=boguss",
 "bin=111",
 "bin=",
+"num=bogus",
+"num=44",
+"num=44.4",
+"num=-1",
+"num=-2",
+"num=101",
 "num64=bogus",
 "num64=44",
 "num64=44.4",
 "num64=-1",
+"num64=-2",
 "num64=101",
 "flt=bogus",
 "flt=2",
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index 0a3362e8fa..e90ec73e62 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -24,7 +24,7 @@ array_dict[0]: k00v\00
 array_dict[0]: k01 v,01
 array_dict[1]: k10 v=1:0
 TestContext AVOptions:
-  -num   E.. set num (from 0 to 100) (default 
0)
+  -num   E.. set num (from -1 to 100) 
(default 0)
   -toggleE.. set toggle (from 0 to 1) 
(default 1)
   -rational E.. set rational (from 0 to 10) 
(default 1/1)
   -string E.. set string (default "default")
@@ -43,7 +43,7 @@ TestContext AVOptions:
   -binE.. set binary value
   -bin1   E.. set binary value
   -bin2   E.. set binary value
-  -num64   E.. set num 64bit (from 0 to 100) 
(default 1)
+  -num64   E.. set num 64bit (from -1 to 100) 
(default 1)
   -flt E.. set float (from 0 to 100) 
(default 0.33)
   -dblE.. set double (from 0 to 100) 
(default 0.33)
   -bool1 E.. set boolean value (default auto)
@@ -337,6 +337,28 @@ Error 'bin=111'
 Setting options string 'bin='
 Setting entry with key 'bin' to value ''
 OK'bin='
+Setting options string 'num=bogus'
+Setting entry with key 'num' to value 'bogus'
+Undefined constant or missing '(' in 'bogus'
+Unable to parse option value "bogus"
+Error 'num=bogus'
+Setting options string 'num=44'
+Setting entry with key 'num' to value '44'
+OK'num=44'
+Setting options string 'num=44.4'
+Setting entry with key 'num' to value 

[FFmpeg-cvslog] avutil/iamf: fix offsets for mix_gain options

2024-05-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat May  4 21:20:35 
2024 -0300| [d6e877bbcde2a0d1422d7b5c7339bb03891d19fc] | committer: James Almer

avutil/iamf: fix offsets for mix_gain options

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6e877bbcde2a0d1422d7b5c7339bb03891d19fc
---

 libavutil/iamf.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/iamf.c b/libavutil/iamf.c
index c96100e7a0..14f49cba93 100644
--- a/libavutil/iamf.c
+++ b/libavutil/iamf.c
@@ -66,10 +66,10 @@ child_type *av_iamf_ ## parent_name ## _add_ ## 
child_name(parent_type *parent_n
 static const AVOption mix_gain_options[] = {
 { "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), 
AV_OPT_TYPE_INT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
 { "animation_type", "set animation_type", OFFSET(animation_type), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, FLAGS },
-{ "start_point_value", "set start_point_value", OFFSET(animation_type), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
-{ "end_point_value", "set end_point_value", OFFSET(animation_type), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
-{ "control_point_value", "set control_point_value", 
OFFSET(animation_type), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS 
},
-{ "control_point_relative_time", "set control_point_relative_time", 
OFFSET(animation_type), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0.0, 1.0, FLAGS },
+{ "start_point_value", "set start_point_value", OFFSET(start_point_value), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
+{ "end_point_value", "set end_point_value", OFFSET(end_point_value), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
+{ "control_point_value", "set control_point_value", 
OFFSET(control_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, 
FLAGS },
+{ "control_point_relative_time", "set control_point_relative_time", 
OFFSET(control_point_relative_time), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0.0, 
1.0, FLAGS },
 { NULL },
 };
 

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

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


[FFmpeg-cvslog] avformat/movenc: Avoid loop for writing array

2024-05-04 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  2 23:28:17 2024 +0200| [2c77dc5aad2d3dde5fbe35e233e7a903584ff473] | 
committer: Andreas Rheinhardt

avformat/movenc: Avoid loop for writing array

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c77dc5aad2d3dde5fbe35e233e7a903584ff473
---

 libavformat/movenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b4c1db2774..f907f67752 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1244,8 +1244,7 @@ static int mov_write_chnl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 if (config) {
 avio_wb64(pb, 0);
 } else {
-for (int i = 0; i < layout->nb_channels; i++)
-avio_w8(pb, speaker_pos[i]);
+avio_write(pb, speaker_pos, layout->nb_channels);
 av_freep(_pos);
 }
 

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

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


[FFmpeg-cvslog] avformat/movenc: Check av_malloc()

2024-05-04 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  2 23:23:17 2024 +0200| [601873263e618e2dc2b615ae95e605575171ee30] | 
committer: Andreas Rheinhardt

avformat/movenc: Check av_malloc()

Fixes Coverity issue #1596735.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=601873263e618e2dc2b615ae95e605575171ee30
---

 libavformat/movenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e9bbfd67cf..b4c1db2774 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1221,6 +1221,8 @@ static int mov_write_chnl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 if (ret || !config) {
 config = 0;
 speaker_pos = av_malloc(layout->nb_channels);
+if (!speaker_pos)
+return AVERROR(ENOMEM);
 ret = ff_mov_get_channel_positions_from_layout(layout,
 speaker_pos, layout->nb_channels);
 if (ret) {

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

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


[FFmpeg-cvslog] avfilter/vf_scale: fix input declaration

2024-05-04 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Fri May  3 22:07:30 
2024 +0200| [6a5b021e353655ddeb1a29f50e519f562dcae5a7] | committer: Niklas Haas

avfilter/vf_scale: fix input declaration

This filter needs to be marked as having only one input by default, with
AVFILTER_FLAG_DYNAMIC_INPUTS allowing the extra input to be added at
init() time.

Fixes: bb8044581366fe286e16b14515d873979133dbda

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a5b021e353655ddeb1a29f50e519f562dcae5a7
---

 libavfilter/vf_scale.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index bc53571c1c..60d301dcd8 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -442,8 +442,15 @@ static av_cold int init(AVFilterContext *ctx)
 if (!threads)
 av_opt_set_int(scale->sws_opts, "threads", 
ff_filter_get_nb_threads(ctx), 0);
 
-if (ctx->filter != _vf_scale2ref)
-ctx->nb_inputs = scale->uses_ref ? 2 : 1;
+if (ctx->filter != _vf_scale2ref && scale->uses_ref) {
+AVFilterPad pad = {
+.name = "ref",
+.type = AVMEDIA_TYPE_VIDEO,
+};
+ret = ff_append_inpad(ctx, );
+if (ret < 0)
+return ret;
+}
 
 return 0;
 }
@@ -1234,9 +1241,6 @@ static const AVFilterPad avfilter_vf_scale_inputs[] = {
 {
 .name = "default",
 .type = AVMEDIA_TYPE_VIDEO,
-}, {
-.name = "ref",
-.type = AVMEDIA_TYPE_VIDEO,
 },
 };
 
@@ -1261,6 +1265,7 @@ const AVFilter ff_vf_scale = {
 FILTER_QUERY_FUNC(query_formats),
 .activate= activate,
 .process_command = process_command,
+.flags   = AVFILTER_FLAG_DYNAMIC_INPUTS,
 };
 
 static const AVFilterPad avfilter_vf_scale2ref_inputs[] = {

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

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


[FFmpeg-cvslog] doc/filters: mention scale2ref in replacement example

2024-05-04 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Sat May  4 13:15:15 
2024 +0200| [df868bae239b263f7b71bfd3b5a5f4b0e5179ea1] | committer: Niklas Haas

doc/filters: mention scale2ref in replacement example

So ctrl+f "scale2ref" finds it.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df868bae239b263f7b71bfd3b5a5f4b0e5179ea1
---

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

diff --git a/doc/filters.texi b/doc/filters.texi
index c4efae01c6..595dc5044f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21342,7 +21342,7 @@ scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
 
 @item
 Scale a subtitle stream (sub) to match the main video (main) in size before
-overlaying.
+overlaying. ("scale2ref")
 @example
 '[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
 @end example

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

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


[FFmpeg-cvslog] doc/filters: move scale=ref_* to correct sectton

2024-05-04 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Sat May  4 13:10:41 
2024 +0200| [8bf0a9c2ca1ab46387f01687d7b9bb081a73b722] | committer: Niklas Haas

doc/filters: move scale=ref_* to correct sectton

This was accidentally filed under scale_npp, instead of scale. (Why is
this entire section basically duplicated anyway?)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8bf0a9c2ca1ab46387f01687d7b9bb081a73b722
---

 doc/filters.texi | 50 --
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 5198f14f28..c4efae01c6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21228,6 +21228,16 @@ The position (byte offset) of the frame in the input 
stream, or NaN if
 this information is unavailable and/or meaningless (for example in case of 
synthetic video).
 Only available with @code{eval=frame}.
 Deprecated, do not use.
+
+@item ref_w, rw
+@item ref_h, rh
+@item ref_a
+@item ref_dar, rdar
+@item ref_n
+@item ref_t
+@item ref_pos
+Eqvuialent to the above, but for a second reference input. If any of these
+variables are present, this filter accepts two inputs.
 @end table
 
 @subsection Examples
@@ -21329,6 +21339,20 @@ making sure the resulting resolution is even (required 
by some codecs):
 @example
 scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
 @end example
+
+@item
+Scale a subtitle stream (sub) to match the main video (main) in size before
+overlaying.
+@example
+'[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
+@end example
+
+@item
+Scale a logo to 1/10th the height of a video, while preserving its display
+aspect ratio.
+@example
+[logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
+@end example
 @end itemize
 
 @subsection Commands
@@ -21562,34 +21586,8 @@ The position (byte offset) of the frame in the input 
stream, or NaN if
 this information is unavailable and/or meaningless (for example in case of 
synthetic video).
 Only available with @code{eval=frame}.
 Deprecated, do not use.
-
-@item ref_w, rw
-@item ref_h, rh
-@item ref_a
-@item ref_dar, rdar
-@item ref_n
-@item ref_t
-@item ref_pos
-Eqvuialent to the above, but for a second reference input. If any of these
-variables are present, this filter accepts two inputs.
 @end table
 
-@subsection Examples
-
-@itemize
-@item
-Scale a subtitle stream (sub) to match the main video (main) in size before 
overlaying
-@example
-'[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
-@end example
-
-@item
-Scale a logo to 1/10th the height of a video, while preserving its display 
aspect ratio.
-@example
-[logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
-@end example
-@end itemize
-
 @section scale2ref_npp
 
 Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input

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

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


[FFmpeg-cvslog] lavc/ac3dsp: R-V V min_exponents

2024-05-04 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Wed May  1 
09:19:46 2024 +0300| [38f67a32b3831c8dd0b34db888c16d4a7af9091c] | committer: 
Rémi Denis-Courmont

lavc/ac3dsp: R-V V min_exponents

T-Head C908:
ac3_exponent_min_reuse0_c: 7.5
ac3_exponent_min_reuse0_rvv_i32:   7.5
ac3_exponent_min_reuse1_c:  1820.7
ac3_exponent_min_reuse1_rvv_i32: 102.5
ac3_exponent_min_reuse2_c:  3088.5
ac3_exponent_min_reuse2_rvv_i32: 138.7
ac3_exponent_min_reuse3_c:  5073.7
ac3_exponent_min_reuse3_rvv_i32: 174.7
ac3_exponent_min_reuse4_c:  4624.2
ac3_exponent_min_reuse4_rvv_i32: 204.2
ac3_exponent_min_reuse5_c:  5138.7
ac3_exponent_min_reuse5_rvv_i32: 238.0

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38f67a32b3831c8dd0b34db888c16d4a7af9091c
---

 libavcodec/riscv/ac3dsp_init.c |  4 
 libavcodec/riscv/ac3dsp_rvv.S  | 22 ++
 2 files changed, 26 insertions(+)

diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index e120aa2dce..c7c375273d 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
 #include "libavutil/cpu.h"
 #include "libavcodec/ac3dsp.h"
 
+void ff_ac3_exponent_min_rvv(uint8_t *exp, int, int);
 void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
 void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, size_t len);
 void ff_sum_square_butterfly_int32_rvv(int64_t *, const int32_t *,
@@ -38,6 +39,9 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 #if HAVE_RV
 int flags = av_get_cpu_flags();
 
+if (flags & AV_CPU_FLAG_RVV_I32)
+c->ac3_exponent_min = ff_ac3_exponent_min_rvv;
+
 if (flags & AV_CPU_FLAG_RVB_ADDR) {
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 c->extract_exponents = ff_extract_exponents_rvb;
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
index 397e000ab0..1b5f67a9ec 100644
--- a/libavcodec/riscv/ac3dsp_rvv.S
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -21,6 +21,28 @@
 #include "config.h"
 #include "libavutil/riscv/asm.S"
 
+func ff_ac3_exponent_min_rvv, zve32x
+beqz a1, 3f
+1:
+vsetvli  t2, a2, e8, m8, ta, ma
+vle8.v   v8, (a0)
+addi t0, a0, 256
+sub  a2, a2, t2
+mv   t1, a1
+2:
+vle8.v   v16, (t0)
+addi t1, t1, -1
+vminu.vv v8, v8, v16
+addi t0, t0, 256
+bnez t1, 2b
+
+vse8.v   v8, (a0)
+add  a0, a0, t2
+bnez a2, 1b
+3:
+ret
+endfunc
+
 func ff_float_to_fixed24_rvv, zve32f
 lit1, 1 << 24
 fcvt.s.w  f0, t1

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

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