Re: [FFmpeg-devel] [PATCH 1/7] lavc/vp9dsp: R-V mc copy_avg

2024-03-26 Thread flow gg
Hi, here's the github link (https://github.com/hleft/FFmpeg/tree/vp8vp9)

Rémi Denis-Courmont  于2024年3月27日周三 02:30写道:

> Hi,
>
> Le perjantaina 22. maaliskuuta 2024, 8.12.41 EET flow gg a écrit :
> > It might be a bit inconvenient to find the patches related to vp8, vp9
> that
> > were sent earlier. Here, I've placed them in a zip file in this reply
>
> ZIP files are not particularly convenient. The only easy way for me to
> review
> is if patches are sent with git-send-email. (As for merging, the easiest
> is of
> course to pull them from a git repository.)
>
> This would not be a problem if FFmpeg used a web forge, but hell will
> freeze
> before that.
>
> --
> レミ・デニ-クールモン
> http://www.remlab.net/
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/3] lavc/vp8dsp: R-V V put_epel h

2024-03-26 Thread flow gg
Okay, changed to use const, updated at this GitHub link (
https://github.com/hleft/FFmpeg/tree/vp8vp9)

Rémi Denis-Courmont  于2024年3月27日周三 02:38写道:

> Le perjantaina 22. maaliskuuta 2024, 8.01.00 EET flow gg a écrit :
> > (This should be used after applying these 4 patches)
> >
> > ```
> > [FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels
> > [FFmpeg-devel] [PATCH 1/3] lavc/vp8dsp: R-V V put_bilin_h
> > 1-3
> > ```
>
> In general, I am not sure that it is safe to lay constant data out without
> specifying a section.
>
> --
> 雷米‧德尼-库尔蒙
> http://www.remlab.net/
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 6/6] avutil/opt: Avoid av_uninit

2024-03-26 Thread Andreas Rheinhardt
GCC 9-13 do not emit warnings for this at all optimization
levels even when -Wmaybe-uninitialized is not disabled.

Signed-off-by: Andreas Rheinhardt 
---
 libavutil/opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 685206f416..fc54a5386d 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1859,7 +1859,6 @@ int av_opt_set_from_string(void *ctx, const char *opts,
 {
 int ret, count = 0;
 const char *dummy_shorthand = NULL;
-char *av_uninit(parsed_key), *av_uninit(value);
 const char *key;
 
 if (!opts)
@@ -1868,6 +1867,7 @@ int av_opt_set_from_string(void *ctx, const char *opts,
 shorthand = _shorthand;
 
 while (*opts) {
+char *parsed_key, *value;
 ret = av_opt_get_key_value(, key_val_sep, pairs_sep,
*shorthand ? AV_OPT_FLAG_IMPLICIT_KEY : 0,
_key, );
-- 
2.40.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 5/6] avcodec/ratecontrol: Use forward declaration for AVExpr

2024-03-26 Thread Andreas Rheinhardt
Avoids including eval.h everywhere where mpegvideo.h
is included.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ratecontrol.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h
index 4de80fad90..1f44b44341 100644
--- a/libavcodec/ratecontrol.h
+++ b/libavcodec/ratecontrol.h
@@ -28,9 +28,7 @@
  * ratecontrol header.
  */
 
-#include 
 #include 
-#include "libavutil/eval.h"
 
 typedef struct Predictor{
 double coeff;
@@ -80,7 +78,7 @@ typedef struct RateControlContext{
 int frame_count[5];
 int last_non_b_pict_type;
 
-AVExpr * rc_eq_eval;
+struct AVExpr *rc_eq_eval;
 }RateControlContext;
 
 struct MpegEncContext;
-- 
2.40.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 4/6] avcodec/h264_refs: Use smaller scope, don't use av_uninit

2024-03-26 Thread Andreas Rheinhardt
In particular, declare iterators with loop scope.
Also remove av_uninit while at it, because they
are now unnecessary due to the changes of the preceding
commit.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_refs.c | 121 ++---
 1 file changed, 53 insertions(+), 68 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index c2ba4b9b9e..99820142b9 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -38,8 +38,7 @@
 
 static void pic_as_field(H264Ref *pic, const int parity)
 {
-int i;
-for (i = 0; i < FF_ARRAY_ELEMS(pic->data); ++i) {
+for (int i = 0; i < FF_ARRAY_ELEMS(pic->data); ++i) {
 if (parity == PICT_BOTTOM_FIELD)
 pic->data[i]   += pic->linesize[i];
 pic->reference  = parity;
@@ -104,13 +103,12 @@ static int build_def_list(H264Ref *def, int def_len,
 static int add_sorted(H264Picture **sorted, H264Picture * const *src,
   int len, int limit, int dir)
 {
-int i, best_poc;
 int out_i = 0;
 
 for (;;) {
-best_poc = dir ? INT_MIN : INT_MAX;
+int best_poc = dir ? INT_MIN : INT_MAX;
 
-for (i = 0; i < len; i++) {
+for (int i = 0; i < len; i++) {
 const int poc = src[i]->poc;
 if (((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)) {
 best_poc  = poc;
@@ -134,12 +132,11 @@ static int mismatches_ref(const H264Context *h, const 
H264Picture *pic)
 
 static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
 {
-int i, len;
-int j;
+int len;
 
 if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
 H264Picture *sorted[32];
-int cur_poc, list;
+int cur_poc;
 int lens[2];
 
 if (FIELD_PICTURE(h))
@@ -147,7 +144,7 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
 else
 cur_poc = h->cur_pic_ptr->poc;
 
-for (list = 0; list < 2; list++) {
+for (int list = 0; list < 2; list++) {
 len  = add_sorted(sorted,   h->short_ref, h->short_ref_count, 
cur_poc, 1 ^ list);
 len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, 
cur_poc, 0 ^ list);
 av_assert0(len <= 32);
@@ -165,6 +162,7 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
 }
 
 if (lens[0] == lens[1] && lens[1] > 1) {
+int i;
 for (i = 0; i < lens[0] &&
 sl->ref_list[0][i].parent->f->buf[0]->buffer ==
 sl->ref_list[1][i].parent->f->buf[0]->buffer; i++);
@@ -184,14 +182,14 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
 memset(>ref_list[0][len], 0, sizeof(H264Ref) * 
(sl->ref_count[0] - len));
 }
 #ifdef TRACE
-for (i = 0; i < sl->ref_count[0]; i++) {
+for (int i = 0; i < sl->ref_count[0]; i++) {
 ff_tlog(h->avctx, "List0: %s fn:%d 0x%p\n",
 (sl->ref_list[0][i].parent ? 
(sl->ref_list[0][i].parent->long_ref ? "LT" : "ST") : "??"),
 sl->ref_list[0][i].pic_id,
 sl->ref_list[0][i].data[0]);
 }
 if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
-for (i = 0; i < sl->ref_count[1]; i++) {
+for (int i = 0; i < sl->ref_count[1]; i++) {
 ff_tlog(h->avctx, "List1: %s fn:%d 0x%p\n",
 (sl->ref_list[1][i].parent ? 
(sl->ref_list[1][i].parent->long_ref ? "LT" : "ST") : "??"),
 sl->ref_list[1][i].pic_id,
@@ -200,8 +198,8 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
 }
 #endif
 
-for (j = 0; j<1+(sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) {
-for (i = 0; i < sl->ref_count[j]; i++) {
+for (int j = 0; j < 1 + (sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) {
+for (int i = 0; i < sl->ref_count[j]; i++) {
 if (sl->ref_list[j][i].parent) {
 if (mismatches_ref(h, sl->ref_list[j][i].parent)) {
 av_log(h->avctx, AV_LOG_ERROR, "Discarding mismatching 
reference\n");
@@ -210,7 +208,7 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
 }
 }
 }
-for (i = 0; i < sl->list_count; i++)
+for (int i = 0; i < sl->list_count; i++)
 h->default_ref[i] = sl->ref_list[i][0];
 }
 
@@ -219,10 +217,9 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
  */
 static void print_short_term(const H264Context *h)
 {
-uint32_t i;
 if (h->avctx->debug & FF_DEBUG_MMCO) {
 av_log(h->avctx, AV_LOG_DEBUG, "short term list:\n");
-for (i = 0; i < h->short_ref_count; i++) {
+for (uint32_t i = 0; i < h->short_ref_count; i++) {
 H264Picture *pic = h->short_ref[i];
 av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n",
i, 

[FFmpeg-devel] [PATCH 3/6] avcodec/h264_refs: Rewrite code to make control flow clearer

2024-03-26 Thread Andreas Rheinhardt
While this change IMO makes the control flow clearer
for the human reader, it is especially important for
GCC: It erroneously believes that it is possible to
enter the SHORT2(UNUSED|LONG) cases without having
entered the preceding block that initializes pic,
frame_num, structure and j; it would emit -Wmaybe-uninitialized
warnings for these variables if they were not pseudo-
initialized with av_uninit(). This patch allows to remove
the latter.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_refs.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 9bc7b20988..c2ba4b9b9e 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -646,8 +646,9 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
 av_log(h->avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", 
h->mmco[i].opcode,
h->mmco[i].short_pic_num, h->mmco[i].long_arg);
 
-if (mmco[i].opcode == MMCO_SHORT2UNUSED ||
-mmco[i].opcode == MMCO_SHORT2LONG) {
+switch (mmco[i].opcode) {
+case MMCO_SHORT2UNUSED:
+case MMCO_SHORT2LONG:
 frame_num = pic_num_extract(h, mmco[i].short_pic_num, );
 pic   = find_short(h, frame_num, );
 if (!pic) {
@@ -659,16 +660,12 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
 }
 continue;
 }
-}
-
-switch (mmco[i].opcode) {
-case MMCO_SHORT2UNUSED:
-if (h->avctx->debug & FF_DEBUG_MMCO)
-av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref short %d count 
%d\n",
-   h->mmco[i].short_pic_num, h->short_ref_count);
-remove_short(h, frame_num, structure ^ PICT_FRAME);
-break;
-case MMCO_SHORT2LONG:
+if (mmco[i].opcode == MMCO_SHORT2UNUSED) {
+if (h->avctx->debug & FF_DEBUG_MMCO)
+av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref short %d count 
%d\n",
+   h->mmco[i].short_pic_num, h->short_ref_count);
+remove_short(h, frame_num, structure ^ PICT_FRAME);
+} else {
 if (h->long_ref[mmco[i].long_arg] != pic)
 remove_long(h, mmco[i].long_arg, 0);
 
@@ -678,6 +675,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
 h->long_ref[mmco[i].long_arg]->long_ref = 1;
 h->long_ref_count++;
 }
+}
 break;
 case MMCO_LONG2UNUSED:
 j   = pic_num_extract(h, mmco[i].long_arg, );
-- 
2.40.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 2/6] avcodec/libvpxenc: Remove obsolete av_unused

2024-03-26 Thread Andreas Rheinhardt
Forgotten in 753074721bd414874d18c372c491bdc6323fa3bf.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libvpxenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 42f73a92f6..f7bfdc1461 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -786,7 +786,7 @@ static int set_pix_fmt(AVCodecContext *avctx, 
vpx_codec_caps_t codec_caps,
struct vpx_codec_enc_cfg *enccfg, vpx_codec_flags_t 
*flags,
vpx_img_fmt_t *img_fmt)
 {
-VPxContext av_unused *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
 enccfg->g_bit_depth = enccfg->g_input_bit_depth = desc->comp[0].depth;
 switch (avctx->pix_fmt) {
-- 
2.40.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 1/6] avcodec/libvpxenc: Only search for side data when intending to use it

2024-03-26 Thread Andreas Rheinhardt
Also rewrite the code so that a variable that is only used
depending upon CONFIG_LIBVPX_VP9_ENCODER is not declared
outside of the #if block.
(The variable was declared with av_uninit, but it should have been
av_unused, as the former does not work for all compilers.)

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libvpxenc.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 4b89e47e83..ee903a4e5c 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -357,19 +357,20 @@ static int frame_data_submit(AVCodecContext *avctx, 
AVFifo *fifo,
 const struct vpx_codec_enc_cfg *enccfg = ctx->encoder.config.enc;
 
 FrameData fd = { .pts = frame->pts };
-
-AVFrameSideData *av_uninit(sd);
 int ret;
 
 #if CONFIG_LIBVPX_VP9_ENCODER
-// Keep HDR10+ if it has bit depth higher than 8 and
-// it has PQ trc (SMPTE2084).
-sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
-if (avctx->codec_id == AV_CODEC_ID_VP9 && sd &&
+if (avctx->codec_id == AV_CODEC_ID_VP9 &&
+// Keep HDR10+ if it has bit depth higher than 8 and
+// it has PQ trc (SMPTE2084).
 enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) {
-fd.hdr10_plus = av_buffer_ref(sd->buf);
-if (!fd.hdr10_plus)
-return AVERROR(ENOMEM);
+const AVFrameSideData *sd = av_frame_get_side_data(frame, 
AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
+
+if (sd) {
+fd.hdr10_plus = av_buffer_ref(sd->buf);
+if (!fd.hdr10_plus)
+return AVERROR(ENOMEM);
+}
 }
 #endif
 
-- 
2.40.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] all: Don't use ATOMIC_VAR_INIT

2024-03-26 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> C11 required to use ATOMIC_VAR_INIT to statically initialize
> atomic objects with static storage duration. Yet this macro
> was unsuitable for initializing structures [1] and was actually
> unneeded for all known implementations (this includes our
> compatibility fallback implementations which simply wrap the value
> in parentheses: #define ATOMIC_VAR_INIT(value) (value)).
> Therefore C17 deprecated the macro and C23 actually removed it [2].
> 
> Since commit 5ff0eb34d2b1089d3dd9f27fdb51520001709138 we default
> to C17 if the compiler supports it; Clang warns about ATOMIC_VAR_INIT
> in this mode. Given that no implementation ever needed this macro,
> this commit stops using it to avoid this warning.
> 
> [1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_485
> [2]: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  configure| 4 ++--
>  fftools/ffmpeg.c | 2 +-
>  libavformat/allformats.c | 4 ++--
>  libavutil/cpu.c  | 6 +++---
>  libavutil/mem.c  | 2 +-
>  5 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/configure b/configure
> index b9fa8652c4..e577dcc677 100755
> --- a/configure
> +++ b/configure
> @@ -6610,8 +6610,8 @@ check_headers asm/types.h
>  # some configurations also require linking to libatomic, so try
>  # both with -latomic and without
>  for LATOMIC in "-latomic" ""; do
> -check_builtin stdatomic stdatomic.h  
>\
> -"atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(, 0); 
> foo += bar"  \
> +check_builtin stdatomic stdatomic.h\
> +"atomic_int foo, bar = -1; atomic_store(, 0); foo += bar"  \
>  $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
>  done
>  
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index d4e5f978f1..5e00d5b645 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -157,7 +157,7 @@ void term_exit(void)
>  
>  static volatile int received_sigterm = 0;
>  static volatile int received_nb_signals = 0;
> -static atomic_int transcode_init_done = ATOMIC_VAR_INIT(0);
> +static atomic_int transcode_init_done = 0;
>  static volatile int ffmpeg_exited = 0;
>  static int64_t copy_ts_first_pts = AV_NOPTS_VALUE;
>  
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index e15d0fa6d7..9df42bb87a 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -576,8 +576,8 @@ extern const FFInputFormat  ff_vapoursynth_demuxer;
>  #include "libavformat/muxer_list.c"
>  #include "libavformat/demuxer_list.c"
>  
> -static atomic_uintptr_t indev_list_intptr  = ATOMIC_VAR_INIT(0);
> -static atomic_uintptr_t outdev_list_intptr = ATOMIC_VAR_INIT(0);
> +static atomic_uintptr_t indev_list_intptr  = 0;
> +static atomic_uintptr_t outdev_list_intptr = 0;
>  
>  const AVOutputFormat *av_muxer_iterate(void **opaque)
>  {
> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
> index 48d195168c..d4f947360a 100644
> --- a/libavutil/cpu.c
> +++ b/libavutil/cpu.c
> @@ -49,8 +49,8 @@
>  #include 
>  #endif
>  
> -static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
> -static atomic_int cpu_count = ATOMIC_VAR_INIT(-1);
> +static atomic_int cpu_flags = -1;
> +static atomic_int cpu_count = -1;
>  
>  static int get_cpu_flags(void)
>  {
> @@ -208,7 +208,7 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
>  
>  int av_cpu_count(void)
>  {
> -static atomic_int printed = ATOMIC_VAR_INIT(0);
> +static atomic_int printed = 0;
>  
>  int nb_cpus = 1;
>  int count   = 0;
> diff --git a/libavutil/mem.c b/libavutil/mem.c
> index 62163b4cb3..02d4cb791f 100644
> --- a/libavutil/mem.c
> +++ b/libavutil/mem.c
> @@ -69,7 +69,7 @@ void  free(void *ptr);
>   * dynamic libraries and remove -Wl,-Bsymbolic from the linker flags.
>   * Note that this will cost performance. */
>  
> -static atomic_size_t max_alloc_size = ATOMIC_VAR_INIT(INT_MAX);
> +static atomic_size_t max_alloc_size = INT_MAX;
>  
>  void av_max_alloc(size_t max){
>  atomic_store_explicit(_alloc_size, max, memory_order_relaxed);

Will apply this patch tomorrow unless there are objections.

- Andreas

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

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


Re: [FFmpeg-devel] [PATCH v1] avcodec/cbs_vp8: Use little endian in fixed()

2024-03-26 Thread Dai, Jianhui J


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Ronald
> S. Bultje
> Sent: Tuesday, March 26, 2024 9:14 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avcodec/cbs_vp8: Use little endian in
> fixed()
> 
> Hi,
> 
> On Wed, Jan 24, 2024 at 7:54 PM Dai, Jianhui J < jianhui.j.dai-at-
> intel@ffmpeg.org> wrote:
> 
> > This commit adds value range checks to cbs_vp8_read_unsigned_le,
> > migrates fixed() to use it, and enforces little-endian consistency for
> > all read methods.
> >
> > Signed-off-by: Jianhui Dai 
> > ---
> >  libavcodec/cbs_vp8.c | 23 +--
> >  1 file changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c index
> > 065156c248..7a0752019b 100644
> > --- a/libavcodec/cbs_vp8.c
> > +++ b/libavcodec/cbs_vp8.c
> > @@ -181,9 +181,11 @@ static int cbs_vp8_bool_decoder_read_signed(
> >  return 0;
> >  }
> >
> > -static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx,
> > GetBitContext *gbc,
> > - int width, const char *name,
> > - const int *subscripts, uint32_t
> > *write_to)
> > +static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx,
> > +GetBitContext *gbc, int width,
> > +const char *name, const int
> > *subscripts,
> > +uint32_t *write_to, uint32_t
> > range_min,
> > +uint32_t range_max)
> >  {
> >  int32_t value;
> >
> > @@ -200,6 +202,14 @@ static int
> > cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
> >
> >  CBS_TRACE_READ_END();
> >
> > +if (value < range_min || value > range_max) {
> > +av_log(ctx->log_ctx, AV_LOG_ERROR,
> > +   "%s out of range: "
> > +   "%" PRIu32 ", but must be in [%" PRIu32 ",%" PRIu32 "].\n",
> > +   name, value, range_min, range_max);
> > +return AVERROR_INVALIDDATA;
> > +}
> > +
> >  *write_to = value;
> >  return 0;
> >  }
> > @@ -246,15 +256,16 @@ static int
> > cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
> >  do { \
> >  uint32_t value; \
> >  CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, \
> > -SUBSCRIPTS(subs, __VA_ARGS__),
> > )); \
> > +   SUBSCRIPTS(subs, __VA_ARGS__),
> > , \
> > +   0, MAX_UINT_BITS(width))); \
> >  current->name = value; \
> >  } while (0)
> >
> >  #define fixed(width, name, value) \
> >  do { \
> >  uint32_t fixed_value; \
> > -CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, 0,
> > _value, \
> > -   value, value)); \
> > +CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, 0,
> > _value, \
> > +   value, value)); \
> >  } while (0)
> >
> >  #define bc_unsigned_subs(width, prob, enable_trace, name, subs, ...)
> > \
> > --
> > 2.25.1
> >
> 
> Merged.

Ronald, Thank you!

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

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


Re: [FFmpeg-devel] [PATCH 1/4] Bump prior release/7.0 branch

2024-03-26 Thread Michael Niedermayer
On Tue, Mar 26, 2024 at 11:57:12PM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/version.h| 2 +-
>  libavdevice/version.h   | 2 +-
>  libavfilter/version.h   | 2 +-
>  libavformat/version.h   | 2 +-
>  libavutil/version.h | 2 +-
>  libpostproc/version.h   | 2 +-
>  libswresample/version.h | 2 +-
>  libswscale/version.h| 2 +-
>  8 files changed, 8 insertions(+), 8 deletions(-)

reviewed by james on IRC
will apply patchset


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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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

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


Re: [FFmpeg-devel] [PATCH] avformat/mov: don't abort on duplicate Mastering Display Metadata boxes

2024-03-26 Thread James Almer

On 3/26/2024 9:13 PM, Andreas Rheinhardt wrote:

James Almer:

The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec 
defines a
mdvc one. If both are present, just ignore one of them.
This is in line with clli and CoLL boxes.

Fixes ticket #10711.

Signed-off-by: James Almer 
---
  libavformat/mov.c | 13 ++---
  1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e7aa8d1833..5463f36770 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6140,8 +6140,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
  av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box 
version %d\n", version);
  return 0;
  }
-if (sc->mastering)
-return AVERROR_INVALIDDATA;
+if (sc->mastering) {
+av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display 
Metadata\n");


If this is expected (and maybe even encouraged/required by some spec),
then why is this a warning?


I don't know if it's expected. I'd expect VP9 streams would not come 
with mdvc and CoLL boxes at all, but apparently Youtube ones now do 
(Guess they are phasing out webm-dash and so now VP9 is served on mp4). 
I just copied the existing behavior from clli and CoLL.





+return 0;
+}
  
  avio_skip(pb, 3); /* flags */
  
@@ -6178,11 +6180,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
  
  sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
  
-if (atom.size < 24 || sc->mastering) {

+if (atom.size < 24) {
  av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume 
box\n");
  return AVERROR_INVALIDDATA;
  }
  
+if (sc->mastering) {

+av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color 
Volume\n");
+return 0;
+}
+
  sc->mastering = av_mastering_display_metadata_alloc();
  if (!sc->mastering)
  return AVERROR(ENOMEM);


___
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] avformat/mov: don't abort on duplicate Mastering Display Metadata boxes

2024-03-26 Thread Andreas Rheinhardt
James Almer:
> The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec 
> defines a
> mdvc one. If both are present, just ignore one of them.
> This is in line with clli and CoLL boxes.
> 
> Fixes ticket #10711.
> 
> Signed-off-by: James Almer 
> ---
>  libavformat/mov.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index e7aa8d1833..5463f36770 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -6140,8 +6140,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display 
> Metadata box version %d\n", version);
>  return 0;
>  }
> -if (sc->mastering)
> -return AVERROR_INVALIDDATA;
> +if (sc->mastering) {
> +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display 
> Metadata\n");

If this is expected (and maybe even encouraged/required by some spec),
then why is this a warning?

> +return 0;
> +}
>  
>  avio_skip(pb, 3); /* flags */
>  
> @@ -6178,11 +6180,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  
>  sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
>  
> -if (atom.size < 24 || sc->mastering) {
> +if (atom.size < 24) {
>  av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume 
> box\n");
>  return AVERROR_INVALIDDATA;
>  }
>  
> +if (sc->mastering) {
> +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display 
> Color Volume\n");
> +return 0;
> +}
> +
>  sc->mastering = av_mastering_display_metadata_alloc();
>  if (!sc->mastering)
>  return AVERROR(ENOMEM);

___
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] avformat/mov: don't abort on duplicate Mastering Display Metadata boxes

2024-03-26 Thread James Almer
The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec 
defines a
mdvc one. If both are present, just ignore one of them.
This is in line with clli and CoLL boxes.

Fixes ticket #10711.

Signed-off-by: James Almer 
---
 libavformat/mov.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e7aa8d1833..5463f36770 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6140,8 +6140,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata 
box version %d\n", version);
 return 0;
 }
-if (sc->mastering)
-return AVERROR_INVALIDDATA;
+if (sc->mastering) {
+av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display 
Metadata\n");
+return 0;
+}
 
 avio_skip(pb, 3); /* flags */
 
@@ -6178,11 +6180,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
 
-if (atom.size < 24 || sc->mastering) {
+if (atom.size < 24) {
 av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume 
box\n");
 return AVERROR_INVALIDDATA;
 }
 
+if (sc->mastering) {
+av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display 
Color Volume\n");
+return 0;
+}
+
 sc->mastering = av_mastering_display_metadata_alloc();
 if (!sc->mastering)
 return AVERROR(ENOMEM);
-- 
2.44.0

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

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


Re: [FFmpeg-devel] Fw: A static compilation duplicate reference error. Request a fix.

2024-03-26 Thread Timo Rothenpieler

There is a bug here, please update it when you request an update.

https://github.com/FFmpeg/FFmpeg/blob/61afe4d98ce62d9dfc6f0548e18730ba2f621cc2/libavformat/file.c#L531

The correct result should be #include "libavcodec/ffjni.h"



Pretty sure this is intentional, to get the private symbol into both 
libraries and not a bug.
The linker will hide the symbol in shared libraries, and be smart enough 
to realize it's identical in case of static linking.

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

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> ---
>  libavcodec/Makefile |   2 +
>  libavcodec/allcodecs.c  |   2 +
>  libavcodec/codec_desc.c |   7 ++
>  libavcodec/codec_id.h   |   1 +
>  libavcodec/liblc3dec.c  | 138 +
>  libavcodec/liblc3enc.c  | 192 
>  6 files changed, 342 insertions(+)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 9ce6d445c1..e70811dbd6 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1123,6 +1123,8 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
>  OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
>  OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
>  OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
> +OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
> +OBJS-$(CONFIG_LIBLC3_DECODER) += liblc3dec.o
>  OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
>  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
>  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 2386b450a6..f4705651fb 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -776,6 +776,8 @@ extern const FFCodec ff_libilbc_encoder;
>  extern const FFCodec ff_libilbc_decoder;
>  extern const FFCodec ff_libjxl_decoder;
>  extern const FFCodec ff_libjxl_encoder;
> +extern const FFCodec ff_liblc3_encoder;
> +extern const FFCodec ff_liblc3_decoder;
>  extern const FFCodec ff_libmp3lame_encoder;
>  extern const FFCodec ff_libopencore_amrnb_encoder;
>  extern const FFCodec ff_libopencore_amrnb_decoder;
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 3bab86db62..7dba61dc8b 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -3425,6 +3425,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
>  .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
>  .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
>  },
> +{
> +.id= AV_CODEC_ID_LC3,
> +.type  = AVMEDIA_TYPE_AUDIO,
> +.name  = "lc3",
> +.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity Communication 
> Codec)"),
> +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> +},
>  
>  /* subtitle codecs */
>  {
> diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> index c8dc21da74..0ab1e34a61 100644
> --- a/libavcodec/codec_id.h
> +++ b/libavcodec/codec_id.h
> @@ -543,6 +543,7 @@ enum AVCodecID {
>  AV_CODEC_ID_AC4,
>  AV_CODEC_ID_OSQ,
>  AV_CODEC_ID_QOA,
> +AV_CODEC_ID_LC3,
>  
>  /* subtitle codecs */
>  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing 
> at the start of subtitle codecs.
> diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
> new file mode 100644
> index 00..bed014652e
> --- /dev/null
> +++ b/libavcodec/liblc3dec.c
> @@ -0,0 +1,138 @@
> +/*
> + * LC3 decoder wrapper
> + * Copyright (C) 2024  Antoine Soulier 
> + *
> + * This file is part of FFmpeg.
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include 
> +
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avcodec.h"
> +#include "codec.h"
> +#include "codec_internal.h"
> +#include "decode.h"
> +#include "internal.h"
> +
> +#define DECODER_MAX_CHANNELS  2
> +
> +typedef struct LibLC3DecContext {
> +int frame_us, srate_hz;
> +bool hr_mode;
> +void *decoder_mem;
> +lc3_decoder_t decoder[DECODER_MAX_CHANNELS];
> +} LibLC3DecContext;
> +
> +static av_cold int liblc3_decode_init(AVCodecContext *avctx)
> +{
> +LibLC3DecContext *liblc3 = avctx->priv_data;
> +int channels = avctx->ch_layout.nb_channels;
> +unsigned decoder_size;
> +
> +if (avctx->extradata_size < 2)
> +return AVERROR_INVALIDDATA;
> +
> +liblc3->frame_us = AV_RL16(avctx->extradata + 

Re: [FFmpeg-devel] [PATCH] Changelog: add Android content URIs protocol entry

2024-03-26 Thread Matthieu Bouron
On Tue, Mar 26, 2024 at 04:30:53PM +0100, Stefano Sabatini wrote:
> On date Monday 2024-03-25 09:14:15 +0100, Matthieu Bouron wrote:
> > ---
> >  Changelog | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Changelog b/Changelog
> > index 934241a965..e4373ff991 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -37,6 +37,7 @@ version :
> >  - Support PacketTypeMetadata of PacketType in enhanced flv format
> >  - ffplay with hwaccel decoding support (depends on vulkan renderer via 
> > libplacebo)
> >  - dnn filter libtorch backend
> > +- Android content URIs protocol
> 
> Obviously LGTM.

Patch applied. Thanks.

> 
> BTW it would be good to document it in doc/protocols.texi.

Will send a patch in the upcoming days.

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

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


[FFmpeg-devel] [PATCH 5/5] Changelog: Add LC3/LC3plus decoding/encoding support

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Signed-off-by: Antoine Soulier 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 934241a965..2282f8ca76 100644
--- a/Changelog
+++ b/Changelog
@@ -37,6 +37,7 @@ version :
 - Support PacketTypeMetadata of PacketType in enhanced flv format
 - ffplay with hwaccel decoding support (depends on vulkan renderer via 
libplacebo)
 - dnn filter libtorch backend
+- LC3/LC3plus decoding/encoding using external library liblc3
 
 
 version 6.1:
-- 
2.44.0.396.g6e790dbe36-goog

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

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


[FFmpeg-devel] [PATCH 4/5] doc: Add LC3/LC3plus muxer and encoder parameters documentation

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Signed-off-by: Antoine Soulier 
---
 doc/encoders.texi | 57 +++
 doc/general_contents.texi | 11 +++-
 doc/muxers.texi   |  6 +
 3 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..0719ba13cc 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
 @end example
 @end itemize
 
+@anchor{liblc3-enc}
+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize @minus
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at lower sampling rates and
+activates it at 96 KHz.
+
+This mode should be preferred at high bitrates. In this mode, the audio
+bandwidth is always up to the Nyquist frequency, compared to LC3 at 48 KHz,
+which limits the bandwidth to 20 KHz.
+@end table
+
 @anchor{libmp3lame}
 @section libmp3lame
 
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index f269cbd1a9..e7cf4f8239 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -237,6 +237,14 @@ Go to @url{http://sourceforge.net/projects/opencore-amr/} 
and follow the
 instructions for installing the library.
 Then pass @code{--enable-libfdk-aac} to configure to enable it.
 
+@subsection LC3 library
+
+FFmpeg can make use of the Google LC3 library for LC3 decoding & encoding.
+
+Go to @url{https://github.com/google/liblc3/} and follow the instructions for
+installing the library.
+Then pass @code{--enable-liblc3} to configure to enable it.
+
 @section OpenH264
 
 FFmpeg can make use of the OpenH264 library for H.264 decoding and encoding.
@@ -1300,7 +1308,8 @@ following image formats are supported:
 @tab encoding and decoding supported through external library libilbc
 @item IMC (Intel Music Coder)  @tab @tab  X
 @item Interplay ACM@tab @tab  X
-@item MACE (Macintosh Audio Compression/Expansion) 3:1  @tab @tab  X
+@item LC3@tab E  @tab  E
+@tab supported through external library liblc3
 @item MACE (Macintosh Audio Compression/Expansion) 6:1  @tab @tab  X
 @item Marian's A-pac audio @tab @tab  X
 @item MI-SC4 (Micronas SC-4 Audio)  @tab @tab  X
diff --git a/doc/muxers.texi b/doc/muxers.texi
index a10a8e216f..9687746c30 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2612,6 +2612,12 @@ WebDAV server every second:
 ffmpeg -f x11grab -framerate 1 -i :0.0 -q:v 6 -update 1 -protocol_opts 
method=PUT http://example.com/desktop.jpg
 @end example
 
+@section lc3
+Bluetooth SIG Low Complexity Communication Codec audio (LC3), or
+ETSI TS 103 634 Low Complexity Communication Codec plus (LC3plus).
+
+This muxer accepts a single @code{lc3} audio stream.
+
 @section matroska
 
 Matroska container muxer.
-- 
2.44.0.396.g6e790dbe36-goog

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

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


[FFmpeg-devel] [PATCH 3/5] avformat/lc3: Add file format for LC3/LC3plus transport

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
A file format is described in Bluetooth SIG LC3 and ETSI TS 103 634, for
test purpose. This is the format implemented here.

Signed-off-by: Antoine Soulier 
---
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   2 +
 libavformat/lc3dec.c | 137 +++
 libavformat/lc3enc.c | 100 
 4 files changed, 241 insertions(+)
 create mode 100644 libavformat/lc3dec.c
 create mode 100644 libavformat/lc3enc.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 44aa485029..4961c42852 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -332,6 +332,8 @@ OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
 OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
 OBJS-$(CONFIG_LAF_DEMUXER)   += lafdec.o
 OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
+OBJS-$(CONFIG_LC3_DEMUXER)   += lc3dec.o
+OBJS-$(CONFIG_LC3_MUXER) += lc3enc.o
 OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
 OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
 OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..e225354faf 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -252,6 +252,8 @@ extern const FFInputFormat  ff_kvag_demuxer;
 extern const FFOutputFormat ff_kvag_muxer;
 extern const FFInputFormat  ff_laf_demuxer;
 extern const FFOutputFormat ff_latm_muxer;
+extern const FFInputFormat  ff_lc3_demuxer;
+extern const FFOutputFormat ff_lc3_muxer;
 extern const FFInputFormat  ff_lmlm4_demuxer;
 extern const FFInputFormat  ff_loas_demuxer;
 extern const FFInputFormat  ff_luodat_demuxer;
diff --git a/libavformat/lc3dec.c b/libavformat/lc3dec.c
new file mode 100644
index 00..164917d946
--- /dev/null
+++ b/libavformat/lc3dec.c
@@ -0,0 +1,137 @@
+/*
+ * LC3 demuxer
+ * Copyright (C) 2024  Antoine Soulier 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Based on the file format specified by :
+ *
+ * - Bluetooth SIG - Low Complexity Communication Codec Test Suite
+ *   https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=502301
+ *   3.2.8.2 Reference LC3 Codec Bitstream Format
+ *
+ * - ETSI TI 103 634 V1.4.1 - Low Complexity Communication Codec plus
+ *   
https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p.pdf
+ *   LC3plus conformance script package
+ */
+
+#include "libavcodec/packet.h"
+#include "libavutil/intreadwrite.h"
+
+#include "avformat.h"
+#include "avio.h"
+#include "demux.h"
+#include "internal.h"
+
+typedef struct LC3DemuxContext {
+int frame_samples;
+int64_t position;
+int64_t length;
+} LC3DemuxContext;
+
+static int lc3_read_header(AVFormatContext *s)
+{
+LC3DemuxContext *lc3 = s->priv_data;
+AVStream *st = NULL;
+uint16_t tag, hdr_size;
+uint16_t frame_us;
+uint32_t length;
+int ep_mode, hr_mode;
+int srate_hz, channels, bit_rate;
+int num_extra_params, ret;
+
+tag = avio_rb16(s->pb);
+hdr_size = avio_rl16(s->pb);
+
+if (tag != 0x1ccc || hdr_size < 9 * sizeof(uint16_t))
+return AVERROR_INVALIDDATA;
+
+num_extra_params = hdr_size / sizeof(uint16_t) - 9;
+
+srate_hz = avio_rl16(s->pb) * 100;
+bit_rate = avio_rl16(s->pb) * 100;
+channels = avio_rl16(s->pb);
+frame_us = avio_rl16(s->pb) * 10;
+ep_mode  = avio_rl16(s->pb) != 0;
+length   = avio_rl32(s->pb);
+hr_mode  = num_extra_params >= 1 && avio_rl16(s->pb);
+
+st = avformat_new_stream(s, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+avpriv_set_pts_info(st, 32, 1, srate_hz);
+st->duration = length;
+
+st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+st->codecpar->codec_id = AV_CODEC_ID_LC3;
+st->codecpar->sample_rate = srate_hz;
+st->codecpar->bit_rate = bit_rate;
+st->codecpar->ch_layout.nb_channels = channels;
+
+if ((ret = ff_alloc_extradata(st->codecpar, 6)) < 0) {
+av_log(s, AV_LOG_ERROR, "Could not allocate extradata\n");
+return ret;
+}
+
+AV_WL16(st->codecpar->extradata + 0, frame_us);
+AV_WL16(st->codecpar->extradata + 2, ep_mode);
+

[FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
---
 libavcodec/Makefile |   2 +
 libavcodec/allcodecs.c  |   2 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/codec_id.h   |   1 +
 libavcodec/liblc3dec.c  | 138 +
 libavcodec/liblc3enc.c  | 192 
 6 files changed, 342 insertions(+)
 create mode 100644 libavcodec/liblc3dec.c
 create mode 100644 libavcodec/liblc3enc.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9ce6d445c1..e70811dbd6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1123,6 +1123,8 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
 OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
 OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
 OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
+OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
+OBJS-$(CONFIG_LIBLC3_DECODER) += liblc3dec.o
 OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
 OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
 OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2386b450a6..f4705651fb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -776,6 +776,8 @@ extern const FFCodec ff_libilbc_encoder;
 extern const FFCodec ff_libilbc_decoder;
 extern const FFCodec ff_libjxl_decoder;
 extern const FFCodec ff_libjxl_encoder;
+extern const FFCodec ff_liblc3_encoder;
+extern const FFCodec ff_liblc3_decoder;
 extern const FFCodec ff_libmp3lame_encoder;
 extern const FFCodec ff_libopencore_amrnb_encoder;
 extern const FFCodec ff_libopencore_amrnb_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 3bab86db62..7dba61dc8b 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -3425,6 +3425,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_LC3,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "lc3",
+.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity Communication 
Codec)"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index c8dc21da74..0ab1e34a61 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -543,6 +543,7 @@ enum AVCodecID {
 AV_CODEC_ID_AC4,
 AV_CODEC_ID_OSQ,
 AV_CODEC_ID_QOA,
+AV_CODEC_ID_LC3,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
new file mode 100644
index 00..bed014652e
--- /dev/null
+++ b/libavcodec/liblc3dec.c
@@ -0,0 +1,138 @@
+/*
+ * LC3 decoder wrapper
+ * Copyright (C) 2024  Antoine Soulier 
+ *
+ * This file is part of FFmpeg.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+
+#include "libavutil/intreadwrite.h"
+
+#include "avcodec.h"
+#include "codec.h"
+#include "codec_internal.h"
+#include "decode.h"
+#include "internal.h"
+
+#define DECODER_MAX_CHANNELS  2
+
+typedef struct LibLC3DecContext {
+int frame_us, srate_hz;
+bool hr_mode;
+void *decoder_mem;
+lc3_decoder_t decoder[DECODER_MAX_CHANNELS];
+} LibLC3DecContext;
+
+static av_cold int liblc3_decode_init(AVCodecContext *avctx)
+{
+LibLC3DecContext *liblc3 = avctx->priv_data;
+int channels = avctx->ch_layout.nb_channels;
+unsigned decoder_size;
+
+if (avctx->extradata_size < 2)
+return AVERROR_INVALIDDATA;
+
+liblc3->frame_us = AV_RL16(avctx->extradata + 0);
+liblc3->srate_hz = avctx->sample_rate;
+liblc3->hr_mode  = avctx->extradata_size >= 6 &&
+   AV_RL16(avctx->extradata + 4);
+
+av_log(avctx, AV_LOG_INFO,
+"Decoding %.1f ms frames\n", liblc3->frame_us * 1e-3f);
+if (liblc3->hr_mode)
+

[FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Signed-off-by: Antoine Soulier 
---
 configure | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/configure b/configure
index 2a1d22310b..4262b96117 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
   --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
   --enable-liblensfun  enable lensfun lens correction [no]
   --enable-libmodplug  enable ModPlug via libmodplug [no]
   --enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
 libjxl
 libklvanc
 libkvazaar
+liblc3
 libmodplug
 libmp3lame
 libmysofa
@@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
 libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
+liblc3_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
  require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
 
 if enabled libmfx && enabled libvpl; then
-- 
2.44.0.396.g6e790dbe36-goog

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

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


[FFmpeg-devel] [PATCH 4/4] Bump after 7.0 branch point

2024-03-26 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/version.h| 2 +-
 libavdevice/version.h   | 2 +-
 libavfilter/version.h   | 2 +-
 libavformat/version.h   | 2 +-
 libavutil/version.h | 2 +-
 libpostproc/version.h   | 2 +-
 libswresample/version.h | 2 +-
 libswscale/version.h| 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 43794ea5885..06631ffa8c4 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR   3
+#define LIBAVCODEC_VERSION_MINOR   4
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavdevice/version.h b/libavdevice/version.h
index ec6c3378743..5cd01a1672c 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVDEVICE_VERSION_MINOR   1
+#define LIBAVDEVICE_VERSION_MINOR   2
 #define LIBAVDEVICE_VERSION_MICRO 100
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 1e884d9b44c..bece922c7f0 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFILTER_VERSION_MINOR   1
+#define LIBAVFILTER_VERSION_MINOR   2
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
diff --git a/libavformat/version.h b/libavformat/version.h
index a7c80dc5647..904e7f06aa6 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFORMAT_VERSION_MINOR   1
+#define LIBAVFORMAT_VERSION_MINOR   2
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/libavutil/version.h b/libavutil/version.h
index 0a3f5dd0c92..7b6114062e1 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  59
-#define LIBAVUTIL_VERSION_MINOR   8
+#define LIBAVUTIL_VERSION_MINOR   9
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libpostproc/version.h b/libpostproc/version.h
index 8294f007bd5..0703ac1d7c7 100644
--- a/libpostproc/version.h
+++ b/libpostproc/version.h
@@ -30,7 +30,7 @@
 
 #include "version_major.h"
 
-#define LIBPOSTPROC_VERSION_MINOR   1
+#define LIBPOSTPROC_VERSION_MINOR   2
 #define LIBPOSTPROC_VERSION_MICRO 100
 
 #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
diff --git a/libswresample/version.h b/libswresample/version.h
index 9c223e1426f..057ac4b19e8 100644
--- a/libswresample/version.h
+++ b/libswresample/version.h
@@ -30,7 +30,7 @@
 
 #include "version_major.h"
 
-#define LIBSWRESAMPLE_VERSION_MINOR   1
+#define LIBSWRESAMPLE_VERSION_MINOR   2
 #define LIBSWRESAMPLE_VERSION_MICRO 100
 
 #define LIBSWRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, 
\
diff --git a/libswscale/version.h b/libswscale/version.h
index 4e54701aba8..79f5c69f1c5 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -28,7 +28,7 @@
 
 #include "version_major.h"
 
-#define LIBSWSCALE_VERSION_MINOR   1
+#define LIBSWSCALE_VERSION_MINOR   2
 #define LIBSWSCALE_VERSION_MICRO 100
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH 3/4] doc/APIchanges: Add 7.0 cut point

2024-03-26 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/APIchanges | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 680d3672e75..44858b283ea 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,8 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+ 8< - FFmpeg 7.0 was cut here  8< -
+
 2024-03-25 - 5df901ffa56 - lavu 59.7.100 - timestamp.h
   Add av_ts_make_time_string2() for better timestamp precision, the new
   function accepts AVRational as time base instead of *AVRational, and is not
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH 2/4] Changelog: Add 7.0 point

2024-03-26 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 Changelog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 934241a965e..a7cad9848c5 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,7 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
-version :
+version 7.0:
 - DXV DXT1 encoder
 - LEAD MCMP decoder
 - EVC decoding using external library libxevd
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH 1/4] Bump prior release/7.0 branch

2024-03-26 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/version.h| 2 +-
 libavdevice/version.h   | 2 +-
 libavfilter/version.h   | 2 +-
 libavformat/version.h   | 2 +-
 libavutil/version.h | 2 +-
 libpostproc/version.h   | 2 +-
 libswresample/version.h | 2 +-
 libswscale/version.h| 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0550d7b0d87..43794ea5885 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR   2
+#define LIBAVCODEC_VERSION_MINOR   3
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 25befdead12..ec6c3378743 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVDEVICE_VERSION_MINOR   0
+#define LIBAVDEVICE_VERSION_MINOR   1
 #define LIBAVDEVICE_VERSION_MICRO 100
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
diff --git a/libavfilter/version.h b/libavfilter/version.h
index d5a6bc143a9..1e884d9b44c 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFILTER_VERSION_MINOR   0
+#define LIBAVFILTER_VERSION_MINOR   1
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 752aac16f7b..a7c80dc5647 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFORMAT_VERSION_MINOR   0
+#define LIBAVFORMAT_VERSION_MINOR   1
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/libavutil/version.h b/libavutil/version.h
index 80e6aacd0fa..0a3f5dd0c92 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  59
-#define LIBAVUTIL_VERSION_MINOR   7
+#define LIBAVUTIL_VERSION_MINOR   8
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libpostproc/version.h b/libpostproc/version.h
index bcbdd210c4f..8294f007bd5 100644
--- a/libpostproc/version.h
+++ b/libpostproc/version.h
@@ -30,7 +30,7 @@
 
 #include "version_major.h"
 
-#define LIBPOSTPROC_VERSION_MINOR   0
+#define LIBPOSTPROC_VERSION_MINOR   1
 #define LIBPOSTPROC_VERSION_MICRO 100
 
 #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
diff --git a/libswresample/version.h b/libswresample/version.h
index 703023094e0..9c223e1426f 100644
--- a/libswresample/version.h
+++ b/libswresample/version.h
@@ -30,7 +30,7 @@
 
 #include "version_major.h"
 
-#define LIBSWRESAMPLE_VERSION_MINOR   0
+#define LIBSWRESAMPLE_VERSION_MINOR   1
 #define LIBSWRESAMPLE_VERSION_MICRO 100
 
 #define LIBSWRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, 
\
diff --git a/libswscale/version.h b/libswscale/version.h
index 148efd83eb5..4e54701aba8 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -28,7 +28,7 @@
 
 #include "version_major.h"
 
-#define LIBSWSCALE_VERSION_MINOR   0
+#define LIBSWSCALE_VERSION_MINOR   1
 #define LIBSWSCALE_VERSION_MICRO 100
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
-- 
2.17.1

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

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


[FFmpeg-devel] Fw: A static compilation duplicate reference error. Request a fix.

2024-03-26 Thread 联盟少侠







There is a bug here, please update it when you request an update.

https://github.com/FFmpeg/FFmpeg/blob/61afe4d98ce62d9dfc6f0548e18730ba2f621cc2/libavformat/file.c#L531

The correct result should be #include "libavcodec/ffjni.h"





>From Android AliMail
___
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] [RFC] clarifying the TC conflict of interest rule

2024-03-26 Thread Michael Niedermayer
On Tue, Mar 26, 2024 at 09:20:46AM +0100, Anton Khirnov wrote:
> The vote has been started, with the voter list generated by
> general_assembly.pl:
> # GA for 2021-01-01T00:00:00/2024-01-01T00:00:00; 50 people; 
> SHA256:e63c3589d48557b90767f581eb1372c6c883ab87395dade38c61d0db0771fabd; 
> HEAD:f872b1971401817356708b8863dff4ee6bd02600
> 
> If you are in the GA and have not received an email by the end of the
> day, please let me know.

Id like to use this mail here to ask everyone to vote :)
(if you dont care about the outcome and find this dumb, you can vote all 
options equal too)

(and yes i got exactly 1 mail)

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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

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


Re: [FFmpeg-devel] [PATCH] V2 tests/fate/filter-audio.mak: add test for ATEMPO audio filter

2024-03-26 Thread Rajiv Harlalka
On Thu, 21 Mar 2024 at 3:43 PM, Rajiv Harlalka 
wrote:

> Please find an updated patch for tests on the atempo audio filter
>
Bumping this patch up for visibility.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> 1. Thanks, I will add the caps.
> 2. Yes, the `lc3_hr_setup_decoder()` returns the given memory address (And
> do not write anything when 'NULL').
> But bad parameters also return `NULL`, even if parameters are already
> validated elsewhere, I will change this call to be more clean.
>> "What makes you believe that this is the only error that can happen?"
> The "lc3_hr_encoder_size()" validates the other parameters.
> 3. Yes, I will.
> 
> For the change of the codec ID, I did not know how to implement it.
> There are 2 codecs covered:
> - LC3, standardized by the Bluetooth SIG, free to use over Bluetooth, and
> should only be used over Bluetooth.
> - LC3plus, a sibling of LC3, defined by another standard, (ETSI TS 103
> 634), that can be used anywhere. The chosen parameters conform to one or
> other.
> Should I declare a second FFCodec and add an option "lc3plus" ?
> 

1. Stop top-posting.
2. I would rather use only one codec id. There is no point in
distinguishing them on the AVCodecID level.

- 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 1/4] lavu/frame: add side data descriptors

2024-03-26 Thread James Almer

On 3/23/2024 10:04 AM, Anton Khirnov wrote:

They allow exporting extended information about side data types.
---
  doc/APIchanges  |  4 +++
  libavutil/frame.c   | 70 ++---
  libavutil/frame.h   | 27 +
  libavutil/version.h |  2 +-
  4 files changed, 72 insertions(+), 31 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a025f1df14..8794380e11 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2024-03-07
  
  API changes, most recent first:
  
+2024-03-xx - xx - lavu 59.4.100 - frame.h

+  Add AVSideDataDescriptor, enum AVSideDataProps, and
+  av_frame_side_data_desc().
+
  2024-03-xx - xx - lavc 61.2.100 - avcodec.h
Add AVCodecContext.[nb_]decoded_side_data.
  
diff --git a/libavutil/frame.c b/libavutil/frame.c

index 89db687d9c..cb9af6326d 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -28,6 +28,36 @@
  #include "samplefmt.h"
  #include "hwcontext.h"
  
+static const AVSideDataDescriptor sd_props[] = {

+[AV_FRAME_DATA_PANSCAN] = { "AVPanScan" },
+[AV_FRAME_DATA_A53_CC]  = { "ATSC A53 Part 4 Closed 
Captions" },
+[AV_FRAME_DATA_MATRIXENCODING]  = { "AVMatrixEncoding" },
+[AV_FRAME_DATA_DOWNMIX_INFO]= { "Metadata relevant to a downmix 
procedure" },
+[AV_FRAME_DATA_AFD] = { "Active format 
description" },
+[AV_FRAME_DATA_MOTION_VECTORS]  = { "Motion vectors" },
+[AV_FRAME_DATA_SKIP_SAMPLES]= { "Skip samples" },
+[AV_FRAME_DATA_GOP_TIMECODE]= { "GOP timecode" },
+[AV_FRAME_DATA_S12M_TIMECODE]   = { "SMPTE 12-1 timecode" },
+[AV_FRAME_DATA_DYNAMIC_HDR_PLUS]= { "HDR Dynamic Metadata 
SMPTE2094-40 (HDR10+)" },
+[AV_FRAME_DATA_DYNAMIC_HDR_VIVID]   = { "HDR Dynamic Metadata CUVA 
005.1 2021 (Vivid)" },
+[AV_FRAME_DATA_REGIONS_OF_INTEREST] = { "Regions Of Interest" },
+[AV_FRAME_DATA_VIDEO_ENC_PARAMS]= { "Video encoding 
parameters" },
+[AV_FRAME_DATA_FILM_GRAIN_PARAMS]   = { "Film grain parameters" },
+[AV_FRAME_DATA_DETECTION_BBOXES]= { "Bounding boxes for object 
detection and classification" },
+[AV_FRAME_DATA_DOVI_RPU_BUFFER] = { "Dolby Vision RPU Data" },
+[AV_FRAME_DATA_DOVI_METADATA]   = { "Dolby Vision Metadata" },
+[AV_FRAME_DATA_STEREO3D]= { "Stereo 3D",   
 AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_REPLAYGAIN]  = { "AVReplayGain",
 AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_DISPLAYMATRIX]   = { "3x3 displaymatrix",   
 AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_AUDIO_SERVICE_TYPE]  = { "Audio service type",  
 AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_MASTERING_DISPLAY_METADATA]  = { "Mastering display 
metadata",   AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_CONTENT_LIGHT_LEVEL] = { "Content light level 
metadata", AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT] = { "Ambient viewing 
environment",  AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_SPHERICAL]   = { "Spherical Mapping",   
 AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_ICC_PROFILE] = { "ICC profile", 
 AV_SIDE_DATA_PROP_GLOBAL },
+[AV_FRAME_DATA_SEI_UNREGISTERED]= { "H.26[45] User Data 
Unregistered SEI message",  AV_SIDE_DATA_PROP_MULTI },
+};
+
  static void get_frame_defaults(AVFrame *frame)
  {
  memset(frame, 0, sizeof(*frame));
@@ -895,38 +925,18 @@ void av_frame_remove_side_data(AVFrame *frame, enum 
AVFrameSideDataType type)
  remove_side_data(>side_data, >nb_side_data, type);
  }
  
+const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type)

+{
+unsigned t = type;
+if (t < FF_ARRAY_ELEMS(sd_props) && sd_props[t].name)
+return _props[t];
+return NULL;
+}
+
  const char *av_frame_side_data_name(enum AVFrameSideDataType type)
  {
-switch(type) {
-case AV_FRAME_DATA_PANSCAN: return "AVPanScan";
-case AV_FRAME_DATA_A53_CC:  return "ATSC A53 Part 4 Closed 
Captions";
-case AV_FRAME_DATA_STEREO3D:return "Stereo 3D";
-case AV_FRAME_DATA_MATRIXENCODING:  return "AVMatrixEncoding";
-case AV_FRAME_DATA_DOWNMIX_INFO:return "Metadata relevant to a downmix 
procedure";
-case AV_FRAME_DATA_REPLAYGAIN:  return "AVReplayGain";
-case AV_FRAME_DATA_DISPLAYMATRIX:   return "3x3 displaymatrix";
-case AV_FRAME_DATA_AFD: return "Active format description";
-case 

Re: [FFmpeg-devel] [PATCH] avcodec/mfenc: expose more properties of the media foundation encoder

2024-03-26 Thread Mark Thompson

On 26/03/2024 19:25, Mark Samuelson wrote:

---
  libavcodec/mf_utils.h |  5 +
  libavcodec/mfenc.c| 19 +++
  2 files changed, 24 insertions(+)


This seems like a good idea.


diff --git a/libavcodec/mf_utils.h b/libavcodec/mf_utils.h
index aebfb9ad21..387c005f38 100644
--- a/libavcodec/mf_utils.h
+++ b/libavcodec/mf_utils.h
@@ -97,6 +97,11 @@ DEFINE_GUID(ff_CODECAPI_AVEncH264CABACEnable,0xee6cad62, 
0xd305, 0x4248, 0xa
  DEFINE_GUID(ff_CODECAPI_AVEncVideoForceKeyFrame, 0x398c1b98, 0x8353, 0x475a, 
0x9e, 0xf2, 0x8f, 0x26, 0x5d, 0x26, 0x3, 0x45);
  DEFINE_GUID(ff_CODECAPI_AVEncMPVDefaultBPictureCount, 0x8d390aac, 0xdc5c, 
0x4200, 0xb5, 0x7f, 0x81, 0x4d, 0x04, 0xba, 0xba, 0xb2);
  DEFINE_GUID(ff_CODECAPI_AVScenarioInfo, 
0xb28a6e64,0x3ff9,0x446a,0x8a,0x4b,0x0d,0x7a,0x53,0x41,0x32,0x36);
+DEFINE_GUID(ff_CODECAPI_AVEncCommonBufferSize, 0x0db96574, 0xb6a4, 0x4c8b, 
0x81, 0x06, 0x37, 0x73, 0xde, 0x03, 0x10, 0xcd);
+DEFINE_GUID(ff_CODECAPI_AVEncCommonMaxBitRate, 0x9651eae4, 0x39b9, 0x4ebf, 
0x85, 0xef, 0xd7, 0xf4, 0x44, 0xec, 0x74, 0x65);
+DEFINE_GUID(ff_CODECAPI_AVEncCommonQualityVsSpeed, 0x98332df8, 0x03cd, 0x476b, 
0x89, 0xfa, 0x3f, 0x9e, 0x44, 0x2d, 0xec, 0x9f);
+DEFINE_GUID(ff_CODECAPI_AVEncMPVGOPSize, 0x95f31b26, 0x95a4, 0x41aa, 0x93, 
0x03, 0x24, 0x6a, 0x7f, 0xc6, 0xee, 0xf1);
+DEFINE_GUID(ff_CODECAPI_AVEncVideoEncodeQP, 0x2cb5696b, 0x23fb, 0x4ce1, 0xa0, 
0xf9, 0xef, 0x5b, 0x90, 0xfd, 0x55, 0xca);
  
  DEFINE_GUID(ff_MF_SA_D3D11_BINDFLAGS, 0xeacf97ad, 0x065c, 0x4408, 0xbe, 0xe3, 0xfd, 0xcb, 0xfd, 0x12, 0x8b, 0xe2);

  DEFINE_GUID(ff_MF_SA_D3D11_USAGE, 0xe85fe442, 0x2ca3, 0x486e, 0xa9, 0xc7, 
0x10, 0x9d, 0xda, 0x60, 0x98, 0x80);
diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
index 9225692c51..36f64a93b8 100644
--- a/libavcodec/mfenc.c
+++ b/libavcodec/mfenc.c
@@ -54,6 +54,8 @@ typedef struct MFContext {
  int opt_enc_quality;
  int opt_enc_scenario;
  int opt_enc_hw;
+int opt_enc_bufferSize;
+int opt_enc_encodeQP;
  } MFContext;
  
  static int mf_choose_output_type(AVCodecContext *avctx);

@@ -695,6 +697,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
  if (c->opt_enc_quality >= 0)
  ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncCommonQuality, 
FF_VAL_VT_UI4(c->opt_enc_quality));
  
+if (avctx->rc_max_rate > 0)

+ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncCommonMaxBitRate, 
FF_VAL_VT_UI4(avctx->rc_max_rate));
+
+if (avctx->gop_size > 0)
+ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncMPVGOPSize, 
FF_VAL_VT_UI4(avctx->gop_size));


AVCodecContext.gop_size has a surprise default value of 12, which trips this 
up.  Suggest adding an FFCodecDefault section so that your new option works as 
a user might expect.


+
+if(c->opt_enc_bufferSize > 0)
+ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncCommonBufferSize, 
FF_VAL_VT_UI4(c->opt_enc_bufferSize));


For VBV/HRD buffer size use AVCodecContext.rc_buffer_size (but be careful with 
the units!).


+
+if(avctx->compression_level >= 0)
+ICodecAPI_SetValue(c->codec_api, 
_CODECAPI_AVEncCommonQualityVsSpeed, FF_VAL_VT_UI4(avctx->compression_level));
+
+if(c->opt_enc_encodeQP > 15)
+ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncVideoEncodeQP, 
FF_VAL_VT_UI4(c->opt_enc_encodeQP));


Where has 15 come from?  Ideally don't constrain the range unless there is some 
specific reason to do so.

Can you use AVCodecContext.global_quality to avoid adding an ad-hoc option?


+
  // Always set the number of b-frames. Qualcomm's HEVC encoder on SD835
  // defaults this to 1, and that setting is buggy with many of the
  // rate control modes. (0 or 2 b-frames works fine with most rate
@@ -1280,6 +1297,8 @@ static const AVOption venc_opts[] = {
  
  {"quality",   "Quality", OFFSET(opt_enc_quality), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100, VE},

  {"hw_encoding",   "Force hardware encoding", OFFSET(opt_enc_hw), 
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE},
+{"buffer_size", "BufferSize", OFFSET(opt_enc_bufferSize), AV_OPT_TYPE_INT, 
{.i64 = 0}, 0, INT_MAX, VE},
+{"encodeQP", "QualityQP", OFFSET(opt_enc_encodeQP), AV_OPT_TYPE_INT, {.i64 
= 15}, 15, 51, VE},
  {NULL}
  };
  


Thanks,

- Mark
___
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] avformat/dvdvideodec: remove `if ((ret = ...) < 0)` pattern

2024-03-26 Thread Marth64
Recent advice plus my own experience agree that this pattern
is error-prone. Instead, set `ret` in its own line and do
the error validation after. Also, explicitly return 0 on success
in dvdvideo_chapters_setup_preindex()

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 132 +-
 1 file changed, 86 insertions(+), 46 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index c94e7f7fe6..000f9c5c9b 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -900,7 +900,7 @@ static int dvdvideo_chapters_setup_preindex(AVFormatContext 
*s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0, interrupt = 0;
+int ret, interrupt = 0;
 int nb_chapters = 0, last_ptt = c->opt_chapter_start;
 uint64_t cur_chapter_offset = 0, cur_chapter_duration = 0;
 DVDVideoPlaybackState state = {0};
@@ -909,9 +909,10 @@ static int 
dvdvideo_chapters_setup_preindex(AVFormatContext *s)
 int nav_event;
 
 if (c->opt_chapter_start == c->opt_chapter_end)
-return ret;
+return 0;
 
-if ((ret = dvdvideo_play_open(s, )) < 0)
+ret = dvdvideo_play_open(s, );
+if (ret < 0)
 return ret;
 
 if (state.pgc->nr_of_programs == 1)
@@ -1058,7 +1059,7 @@ static int dvdvideo_video_stream_setup(AVFormatContext *s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0;
+int ret;
 DVDVideoVTSVideoStreamEntry entry = {0};
 video_attr_t video_attr;
 
@@ -1068,14 +1069,11 @@ static int dvdvideo_video_stream_setup(AVFormatContext 
*s)
 else
 video_attr = c->vts_ifo->vtsi_mat->vts_video_attr;
 
-if ((ret = dvdvideo_video_stream_analyze(s, video_attr, )) < 0 ||
-(ret = dvdvideo_video_stream_add(s, , AVSTREAM_PARSE_HEADERS)) < 
0) {
-
-av_log(s, AV_LOG_ERROR, "Unable to add video stream\n");
+ret = dvdvideo_video_stream_analyze(s, video_attr, );
+if (ret < 0)
 return ret;
-}
 
-return 0;
+return dvdvideo_video_stream_add(s, , AVSTREAM_PARSE_HEADERS);
 }
 
 static int dvdvideo_audio_stream_analyze(AVFormatContext *s, audio_attr_t 
audio_attr,
@@ -1219,7 +1217,7 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0;
+int ret;
 int nb_streams;
 
 if (c->opt_menu)
@@ -1241,8 +1239,9 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 if (!(c->play_state.pgc->audio_control[i] & 0x8000))
 continue;
 
-if ((ret = dvdvideo_audio_stream_analyze(s, audio_attr, 
c->play_state.pgc->audio_control[i],
- )) < 0)
+ret = dvdvideo_audio_stream_analyze(s, audio_attr, 
c->play_state.pgc->audio_control[i],
+);
+if (ret < 0)
 goto break_error;
 
 /* IFO structures can declare duplicate entries for the same startcode 
*/
@@ -1250,7 +1249,8 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 if (s->streams[j]->id == entry.startcode)
 continue;
 
-if ((ret = dvdvideo_audio_stream_add(s, , 
AVSTREAM_PARSE_HEADERS)) < 0)
+ret = dvdvideo_audio_stream_add(s, , AVSTREAM_PARSE_HEADERS);
+if (ret < 0)
 goto break_error;
 
 continue;
@@ -1302,7 +1302,8 @@ static int dvdvideo_subp_stream_add(AVFormatContext *s, 
DVDVideoPGCSubtitleStrea
 st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
 st->codecpar->codec_id = AV_CODEC_ID_DVD_SUBTITLE;
 
-if ((ret = ff_dvdclut_palette_extradata_cat(entry->clut, 
FF_DVDCLUT_CLUT_SIZE, st->codecpar)) < 0)
+ret = ff_dvdclut_palette_extradata_cat(entry->clut, FF_DVDCLUT_CLUT_SIZE, 
st->codecpar);
+if (ret < 0)
 return ret;
 
 if (entry->lang_iso)
@@ -1326,12 +1327,13 @@ static int 
dvdvideo_subp_stream_add_internal(AVFormatContext *s, uint32_t offset
  subp_attr_t subp_attr,
  enum DVDVideoSubpictureViewport 
viewport)
 {
-int ret = 0;
+int ret;
 DVDVideoPGCSubtitleStreamEntry entry = {0};
 
 entry.viewport = viewport;
 
-if ((ret = dvdvideo_subp_stream_analyze(s, offset, subp_attr, )) < 0)
+ret = dvdvideo_subp_stream_analyze(s, offset, subp_attr, );
+if (ret < 0)
 goto end_error;
 
 /* IFO structures can declare duplicate entries for the same startcode */
@@ -1339,7 +1341,8 @@ static int 
dvdvideo_subp_stream_add_internal(AVFormatContext *s, uint32_t offset
 if (s->streams[i]->id == entry.startcode)
 return 0;
 
-if ((ret = dvdvideo_subp_stream_add(s, , AVSTREAM_PARSE_HEADERS)) < 
0)
+ret = dvdvideo_subp_stream_add(s, , AVSTREAM_PARSE_HEADERS);
+if (ret < 0)
 goto end_error;
 
 return 0;
@@ -1363,7 +1366,7 @@ static int dvdvideo_subp_stream_add_all(AVFormatContext 
*s)
 
 
 

Re: [FFmpeg-devel] Add optimization in swscale for LA.

2024-03-26 Thread Michael Niedermayer
On Tue, Mar 26, 2024 at 11:11:00AM +0800, Shiyou Yin wrote:
> 
> > 2024年3月16日 11:03,Shiyou Yin  写道:
> > 
> > [PATCH 1/3] swscale: [LA] Optimize range convert for yuvj420p.
> > [PATCH 2/3] swscale: [LA] Optimize yuv2plane1_8_c.
> > [PATCH 3/3] swscale: [LA] Optimize swscale funcs in input.c
> > 
> > ___
> > 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”.
> 
> Hi, Michale
> Could you please help to review this patch set, thanks.

I can apply it if it has been reviewed but i cannot review it currently

thx

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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

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


Re: [FFmpeg-devel] [PATCH 2/3] avformat/mov: Do not deallocate heif_item in a input dependant way

2024-03-26 Thread Michael Niedermayer
On Mon, Mar 25, 2024 at 10:22:19PM -0300, James Almer wrote:
> On 3/22/2024 8:08 PM, Michael Niedermayer wrote:
> > Fixes: out of array access
> > Fixes: 
> > 67070/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5685384082161664
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   libavformat/mov.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index f954b924a0..a87ce5cefe 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -8077,7 +8077,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >   }
> >   item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
> > -heif_item = av_realloc_array(c->heif_item, item_count, 
> > sizeof(*c->heif_item));
> > +heif_item = av_realloc_array(c->heif_item, FFMAX(item_count, 
> > c->nb_heif_item), sizeof(*c->heif_item));
> >   if (!heif_item)
> >   return AVERROR(ENOMEM);
> >   c->heif_item = heif_item;
> > @@ -8202,7 +8202,7 @@ static int mov_read_iinf(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >   avio_rb24(pb);  // flags.
> >   entry_count = version ? avio_rb32(pb) : avio_rb16(pb);
> > -heif_item = av_realloc_array(c->heif_item, entry_count, 
> > sizeof(*c->heif_item));
> > +heif_item = av_realloc_array(c->heif_item, FFMAX(entry_count, 
> > c->nb_heif_item), sizeof(*c->heif_item));
> >   if (!heif_item)
> >   return AVERROR(ENOMEM);
> >   c->heif_item = heif_item;
> 
> LGTM.

will apply

thx

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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

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


[FFmpeg-devel] [PATCH] avcodec/mfenc: expose more properties of the media foundation encoder

2024-03-26 Thread Mark Samuelson
---
 libavcodec/mf_utils.h |  5 +
 libavcodec/mfenc.c| 19 +++
 2 files changed, 24 insertions(+)

diff --git a/libavcodec/mf_utils.h b/libavcodec/mf_utils.h
index aebfb9ad21..387c005f38 100644
--- a/libavcodec/mf_utils.h
+++ b/libavcodec/mf_utils.h
@@ -97,6 +97,11 @@ DEFINE_GUID(ff_CODECAPI_AVEncH264CABACEnable,0xee6cad62, 
0xd305, 0x4248, 0xa
 DEFINE_GUID(ff_CODECAPI_AVEncVideoForceKeyFrame, 0x398c1b98, 0x8353, 0x475a, 
0x9e, 0xf2, 0x8f, 0x26, 0x5d, 0x26, 0x3, 0x45);
 DEFINE_GUID(ff_CODECAPI_AVEncMPVDefaultBPictureCount, 0x8d390aac, 0xdc5c, 
0x4200, 0xb5, 0x7f, 0x81, 0x4d, 0x04, 0xba, 0xba, 0xb2);
 DEFINE_GUID(ff_CODECAPI_AVScenarioInfo, 
0xb28a6e64,0x3ff9,0x446a,0x8a,0x4b,0x0d,0x7a,0x53,0x41,0x32,0x36);
+DEFINE_GUID(ff_CODECAPI_AVEncCommonBufferSize, 0x0db96574, 0xb6a4, 0x4c8b, 
0x81, 0x06, 0x37, 0x73, 0xde, 0x03, 0x10, 0xcd);
+DEFINE_GUID(ff_CODECAPI_AVEncCommonMaxBitRate, 0x9651eae4, 0x39b9, 0x4ebf, 
0x85, 0xef, 0xd7, 0xf4, 0x44, 0xec, 0x74, 0x65);
+DEFINE_GUID(ff_CODECAPI_AVEncCommonQualityVsSpeed, 0x98332df8, 0x03cd, 0x476b, 
0x89, 0xfa, 0x3f, 0x9e, 0x44, 0x2d, 0xec, 0x9f);
+DEFINE_GUID(ff_CODECAPI_AVEncMPVGOPSize, 0x95f31b26, 0x95a4, 0x41aa, 0x93, 
0x03, 0x24, 0x6a, 0x7f, 0xc6, 0xee, 0xf1);
+DEFINE_GUID(ff_CODECAPI_AVEncVideoEncodeQP, 0x2cb5696b, 0x23fb, 0x4ce1, 0xa0, 
0xf9, 0xef, 0x5b, 0x90, 0xfd, 0x55, 0xca);
 
 DEFINE_GUID(ff_MF_SA_D3D11_BINDFLAGS, 0xeacf97ad, 0x065c, 0x4408, 0xbe, 0xe3, 
0xfd, 0xcb, 0xfd, 0x12, 0x8b, 0xe2);
 DEFINE_GUID(ff_MF_SA_D3D11_USAGE, 0xe85fe442, 0x2ca3, 0x486e, 0xa9, 0xc7, 
0x10, 0x9d, 0xda, 0x60, 0x98, 0x80);
diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
index 9225692c51..36f64a93b8 100644
--- a/libavcodec/mfenc.c
+++ b/libavcodec/mfenc.c
@@ -54,6 +54,8 @@ typedef struct MFContext {
 int opt_enc_quality;
 int opt_enc_scenario;
 int opt_enc_hw;
+int opt_enc_bufferSize;
+int opt_enc_encodeQP;
 } MFContext;
 
 static int mf_choose_output_type(AVCodecContext *avctx);
@@ -695,6 +697,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (c->opt_enc_quality >= 0)
 ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncCommonQuality, 
FF_VAL_VT_UI4(c->opt_enc_quality));
 
+if (avctx->rc_max_rate > 0)
+ICodecAPI_SetValue(c->codec_api, 
_CODECAPI_AVEncCommonMaxBitRate, FF_VAL_VT_UI4(avctx->rc_max_rate));
+
+if (avctx->gop_size > 0)
+ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncMPVGOPSize, 
FF_VAL_VT_UI4(avctx->gop_size));
+
+if(c->opt_enc_bufferSize > 0)
+ICodecAPI_SetValue(c->codec_api, 
_CODECAPI_AVEncCommonBufferSize, FF_VAL_VT_UI4(c->opt_enc_bufferSize));
+
+if(avctx->compression_level >= 0)
+ICodecAPI_SetValue(c->codec_api, 
_CODECAPI_AVEncCommonQualityVsSpeed, 
FF_VAL_VT_UI4(avctx->compression_level));
+
+if(c->opt_enc_encodeQP > 15)
+ICodecAPI_SetValue(c->codec_api, _CODECAPI_AVEncVideoEncodeQP, 
FF_VAL_VT_UI4(c->opt_enc_encodeQP));
+
 // Always set the number of b-frames. Qualcomm's HEVC encoder on SD835
 // defaults this to 1, and that setting is buggy with many of the
 // rate control modes. (0 or 2 b-frames works fine with most rate
@@ -1280,6 +1297,8 @@ static const AVOption venc_opts[] = {
 
 {"quality",   "Quality", OFFSET(opt_enc_quality), AV_OPT_TYPE_INT, 
{.i64 = -1}, -1, 100, VE},
 {"hw_encoding",   "Force hardware encoding", OFFSET(opt_enc_hw), 
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE},
+{"buffer_size", "BufferSize", OFFSET(opt_enc_bufferSize), AV_OPT_TYPE_INT, 
{.i64 = 0}, 0, INT_MAX, VE},
+{"encodeQP", "QualityQP", OFFSET(opt_enc_encodeQP), AV_OPT_TYPE_INT, {.i64 
= 15}, 15, 51, VE},
 {NULL}
 };
 
-- 
2.43.0.windows.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 1/7] avcodec/hcadec: do not set hfr_group_count to invalid values

2024-03-26 Thread Michael Niedermayer
On Tue, Mar 26, 2024 at 03:30:50AM +0100, Michael Niedermayer wrote:
> Fixes: 
> 62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-6247136417087488
> Fixes: out of array write
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hcadec.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

if there are no objections i will apply this patchset before making the 7.0 
branch

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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

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


Re: [FFmpeg-devel] [PATCH 01/10] avformat/concatdec: Check user_duration sum

2024-03-26 Thread Michael Niedermayer
On Tue, Mar 26, 2024 at 01:11:42AM +0100, Michael Niedermayer wrote:
> Fixes: 
> 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6434245599690752
> Fixes: signed integer overflow: 922337202677300 + 2233700 cannot be 
> represented in type 'long'
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/concatdec.c | 2 ++
>  1 file changed, 2 insertions(+)

if there are no objections i will apply this patchset before making the 7.0 
branch

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
1. Thanks, I will add the caps.
2. Yes, the `lc3_hr_setup_decoder()` returns the given memory address (And
do not write anything when 'NULL').
But bad parameters also return `NULL`, even if parameters are already
validated elsewhere, I will change this call to be more clean.
> "What makes you believe that this is the only error that can happen?"
The "lc3_hr_encoder_size()" validates the other parameters.
3. Yes, I will.

For the change of the codec ID, I did not know how to implement it.
There are 2 codecs covered:
- LC3, standardized by the Bluetooth SIG, free to use over Bluetooth, and
should only be used over Bluetooth.
- LC3plus, a sibling of LC3, defined by another standard, (ETSI TS 103
634), that can be used anywhere. The chosen parameters conform to one or
other.
Should I declare a second FFCodec and add an option "lc3plus" ?

Thanks.

On Tue, Mar 26, 2024 at 11:28 AM Andreas Rheinhardt <
andreas.rheinha...@outlook.com> wrote:

> Antoine Soulier via ffmpeg-devel:
> > The LC3 audio codec is the default codec of Bluetooth LE audio.
> > This is a wrapper over the liblc3 library (
> https://github.com/google/liblc3).
> >
> > Signed-off-by: Antoine Soulier 
> > Signed-off-by: Antoine SOULIER 
> > ---
> >  libavcodec/Makefile |   3 +
> >  libavcodec/allcodecs.c  |   3 +
> >  libavcodec/codec_desc.c |  14 +++
> >  libavcodec/codec_id.h   |   2 +
> >  libavcodec/liblc3dec.c  | 146 ++
> >  libavcodec/liblc3enc.c  | 191 
> >  6 files changed, 359 insertions(+)
> >  create mode 100644 libavcodec/liblc3dec.c
> >  create mode 100644 libavcodec/liblc3enc.c
> >
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index 708434ac76..7d2cf3076d 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -1123,6 +1123,9 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+=
> libilbc.o
> >  OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
> >  OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
> >  OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
> > +OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
> > +OBJS-$(CONFIG_LIBLC3_LC3_DECODER) += liblc3dec.o
> > +OBJS-$(CONFIG_LIBLC3_LC3PLUS_DECODER) += liblc3dec.o
> >  OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
> >  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
> >  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index 2386b450a6..29aedaeac6 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -776,6 +776,9 @@ extern const FFCodec ff_libilbc_encoder;
> >  extern const FFCodec ff_libilbc_decoder;
> >  extern const FFCodec ff_libjxl_decoder;
> >  extern const FFCodec ff_libjxl_encoder;
> > +extern const FFCodec ff_liblc3_encoder;
> > +extern const FFCodec ff_liblc3_lc3_decoder;
> > +extern const FFCodec ff_liblc3_lc3plus_decoder;
> >  extern const FFCodec ff_libmp3lame_encoder;
> >  extern const FFCodec ff_libopencore_amrnb_encoder;
> >  extern const FFCodec ff_libopencore_amrnb_decoder;
> > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> > index 3bab86db62..230bba2a09 100644
> > --- a/libavcodec/codec_desc.c
> > +++ b/libavcodec/codec_desc.c
> > @@ -3425,6 +3425,20 @@ static const AVCodecDescriptor
> codec_descriptors[] = {
> >  .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
> >  .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> >  },
> > +{
> > +.id= AV_CODEC_ID_LC3,
> > +.type  = AVMEDIA_TYPE_AUDIO,
> > +.name  = "lc3",
> > +.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity
> Communication Codec)"),
> > +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> > +},
> > +{
> > +.id= AV_CODEC_ID_LC3_PLUS,
> > +.type  = AVMEDIA_TYPE_AUDIO,
> > +.name  = "lc3_plus",
> > +.long_name = NULL_IF_CONFIG_SMALL("LC3plus (Low Complexity
> Communication Codec plus)"),
> > +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> > +},
> >
> >  /* subtitle codecs */
> >  {
> > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> > index c8dc21da74..7e4cb39049 100644
> > --- a/libavcodec/codec_id.h
> > +++ b/libavcodec/codec_id.h
> > @@ -543,6 +543,8 @@ enum AVCodecID {
> >  AV_CODEC_ID_AC4,
> >  AV_CODEC_ID_OSQ,
> >  AV_CODEC_ID_QOA,
> > +AV_CODEC_ID_LC3,
> > +AV_CODEC_ID_LC3_PLUS,
> >
> >  /* subtitle codecs */
> >  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID
> pointing at the start of subtitle codecs.
> > diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
> > new file mode 100644
> > index 00..e97cecc68f
> > --- /dev/null
> > +++ b/libavcodec/liblc3dec.c
> > @@ -0,0 +1,146 @@
> > +/*
> > + * LC3 decoder wrapper

Re: [FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Thanks for your review.
I am not sure to understand "1e3f might be replaced by a symbolic
constant/macro".
It's for a conversion from microseconds to milliseconds (standard unit used
for the frame duration).
It's not a magical constant, I do some greps and it looks like such
constant "1000.f" are already defined elsewhere.


On Tue, Mar 26, 2024 at 10:49 AM Stefano Sabatini 
wrote:

> On date Tuesday 2024-03-26 16:47:36 +, ffmpeg-devel Mailing List wrote:
> > The LC3 audio codec is the default codec of Bluetooth LE audio.
> > This is a wrapper over the liblc3 library (
> https://github.com/google/liblc3).
> >
> > Signed-off-by: Antoine Soulier 
> > Signed-off-by: Antoine SOULIER 
> > ---
> >  libavcodec/Makefile |   3 +
> >  libavcodec/allcodecs.c  |   3 +
> >  libavcodec/codec_desc.c |  14 +++
> >  libavcodec/codec_id.h   |   2 +
> >  libavcodec/liblc3dec.c  | 146 ++
> >  libavcodec/liblc3enc.c  | 191 
> >  6 files changed, 359 insertions(+)
> >  create mode 100644 libavcodec/liblc3dec.c
> >  create mode 100644 libavcodec/liblc3enc.c
> >
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index 708434ac76..7d2cf3076d 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -1123,6 +1123,9 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+=
> libilbc.o
> >  OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
> >  OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
> >  OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
> > +OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
> > +OBJS-$(CONFIG_LIBLC3_LC3_DECODER) += liblc3dec.o
> > +OBJS-$(CONFIG_LIBLC3_LC3PLUS_DECODER) += liblc3dec.o
> >  OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
> >  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
> >  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index 2386b450a6..29aedaeac6 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -776,6 +776,9 @@ extern const FFCodec ff_libilbc_encoder;
> >  extern const FFCodec ff_libilbc_decoder;
> >  extern const FFCodec ff_libjxl_decoder;
> >  extern const FFCodec ff_libjxl_encoder;
> > +extern const FFCodec ff_liblc3_encoder;
> > +extern const FFCodec ff_liblc3_lc3_decoder;
> > +extern const FFCodec ff_liblc3_lc3plus_decoder;
> >  extern const FFCodec ff_libmp3lame_encoder;
> >  extern const FFCodec ff_libopencore_amrnb_encoder;
> >  extern const FFCodec ff_libopencore_amrnb_decoder;
> > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> > index 3bab86db62..230bba2a09 100644
> > --- a/libavcodec/codec_desc.c
> > +++ b/libavcodec/codec_desc.c
> > @@ -3425,6 +3425,20 @@ static const AVCodecDescriptor
> codec_descriptors[] = {
> >  .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
> >  .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> >  },
> > +{
> > +.id= AV_CODEC_ID_LC3,
> > +.type  = AVMEDIA_TYPE_AUDIO,
> > +.name  = "lc3",
> > +.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity
> Communication Codec)"),
> > +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> > +},
> > +{
> > +.id= AV_CODEC_ID_LC3_PLUS,
> > +.type  = AVMEDIA_TYPE_AUDIO,
> > +.name  = "lc3_plus",
> > +.long_name = NULL_IF_CONFIG_SMALL("LC3plus (Low Complexity
> Communication Codec plus)"),
> > +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> > +},
> >
> >  /* subtitle codecs */
> >  {
> > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> > index c8dc21da74..7e4cb39049 100644
> > --- a/libavcodec/codec_id.h
> > +++ b/libavcodec/codec_id.h
> > @@ -543,6 +543,8 @@ enum AVCodecID {
> >  AV_CODEC_ID_AC4,
> >  AV_CODEC_ID_OSQ,
> >  AV_CODEC_ID_QOA,
> > +AV_CODEC_ID_LC3,
> > +AV_CODEC_ID_LC3_PLUS,
> >
> >  /* subtitle codecs */
> >  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID
> pointing at the start of subtitle codecs.
> > diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
> > new file mode 100644
> > index 00..e97cecc68f
> > --- /dev/null
> > +++ b/libavcodec/liblc3dec.c
> > @@ -0,0 +1,146 @@
> > +/*
> > + * LC3 decoder wrapper
> > + * Copyright (C) 2024  Antoine Soulier 
> > + *
> > + * This file is part of FFmpeg.
> > + *
> > + * Permission to use, copy, modify, and/or distribute this software for
> any
> > + * purpose with or without fee is hereby granted, provided that the
> above
> > + * copyright notice and this permission notice appear in all copies.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
> WARRANTIES
> > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> > + * 

Re: [FFmpeg-devel] [PATCH 1/3] lavc/vp8dsp: R-V V put_epel h

2024-03-26 Thread Rémi Denis-Courmont
Le perjantaina 22. maaliskuuta 2024, 8.01.00 EET flow gg a écrit :
> (This should be used after applying these 4 patches)
> 
> ```
> [FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels
> [FFmpeg-devel] [PATCH 1/3] lavc/vp8dsp: R-V V put_bilin_h
> 1-3
> ```

In general, I am not sure that it is safe to lay constant data out without 
specifying a section.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/



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

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


Re: [FFmpeg-devel] [PATCH 3/5] avformat/lc3: Add file format for LC3/LC3plus transport

2024-03-26 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> A file format is described in Bluetooth SIG LC3 and ETSI TS 103 634, for
> test purpose. This is the format implemented here.
> 
> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 
> ---
>  libavformat/Makefile |   3 +
>  libavformat/allformats.c |   3 +
>  libavformat/lc3dec.c | 140 +++
>  libavformat/lc3enc.c | 118 +
>  4 files changed, 264 insertions(+)
>  create mode 100644 libavformat/lc3dec.c
>  create mode 100644 libavformat/lc3enc.c
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 94a949f555..29a38c1d94 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -332,6 +332,9 @@ OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
>  OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
>  OBJS-$(CONFIG_LAF_DEMUXER)   += lafdec.o
>  OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
> +OBJS-$(CONFIG_LC3_DEMUXER)   += lc3dec.o
> +OBJS-$(CONFIG_LC3_MUXER) += lc3enc.o
> +OBJS-$(CONFIG_LC3_PLUS_MUXER)+= lc3enc.o
>  OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
>  OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
>  OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index e15d0fa6d7..551b0f0d7b 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -252,6 +252,9 @@ extern const FFInputFormat  ff_kvag_demuxer;
>  extern const FFOutputFormat ff_kvag_muxer;
>  extern const FFInputFormat  ff_laf_demuxer;
>  extern const FFOutputFormat ff_latm_muxer;
> +extern const FFInputFormat  ff_lc3_demuxer;
> +extern const FFOutputFormat ff_lc3_muxer;
> +extern const FFOutputFormat ff_lc3_plus_muxer;
>  extern const FFInputFormat  ff_lmlm4_demuxer;
>  extern const FFInputFormat  ff_loas_demuxer;
>  extern const FFInputFormat  ff_luodat_demuxer;
> diff --git a/libavformat/lc3dec.c b/libavformat/lc3dec.c
> new file mode 100644
> index 00..563384f786
> --- /dev/null
> +++ b/libavformat/lc3dec.c
> @@ -0,0 +1,140 @@
> +/*
> + * LC3 demuxer
> + * Copyright (C) 2024  Antoine Soulier 
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * Based on the file format specified by :
> + *
> + * - Bluetooth SIG - Low Complexity Communication Codec Test Suite
> + *   https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=502301
> + *   3.2.8.2 Reference LC3 Codec Bitstream Format
> + *
> + * - ETSI TI 103 634 V1.4.1 - Low Complexity Communication Codec plus
> + *   
> https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p.pdf
> + *   LC3plus conformance script package
> + */
> +
> +#include 
> +
> +#include "libavcodec/avcodec.h"

What is that needed for? (De)muxers have almost no reason to ever need this.

> +#include "libavcodec/packet.h"
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avformat.h"
> +#include "avio.h"
> +#include "demux.h"
> +#include "internal.h"
> +
> +typedef struct LC3DemuxContext {
> +int frame_samples;
> +int64_t position;
> +int64_t length;
> +} LC3DemuxContext;
> +
> +static int lc3_read_header(AVFormatContext *s)
> +{
> +LC3DemuxContext *lc3 = s->priv_data;
> +AVStream *st = NULL;
> +uint16_t tag, hdr_size;
> +uint16_t frame_us;
> +uint32_t length;
> +bool ep_mode, hr_mode;
> +int srate_hz, channels, bit_rate;
> +int num_extra_params, ret;
> +
> +tag = avio_rb16(s->pb);
> +hdr_size = avio_rl16(s->pb);
> +
> +if (tag != 0x1ccc || hdr_size < 9 * sizeof(uint16_t))
> +return AVERROR_INVALIDDATA;
> +
> +num_extra_params = hdr_size / sizeof(uint16_t) - 9;
> +
> +srate_hz = avio_rl16(s->pb) * 100;
> +bit_rate = avio_rl16(s->pb) * 100;
> +channels = avio_rl16(s->pb);
> +frame_us = avio_rl16(s->pb) * 10;
> +ep_mode  = avio_rl16(s->pb) != 0;
> +length   = avio_rl32(s->pb);
> +hr_mode  = num_extra_params >= 1 && avio_rl16(s->pb);
> +
> +st = avformat_new_stream(s, NULL);
> +if (!st)
> +return AVERROR(ENOMEM);
> +
> +

Re: [FFmpeg-devel] [PATCH 1/7] lavc/vp9dsp: R-V mc copy_avg

2024-03-26 Thread Rémi Denis-Courmont
Hi,

Le perjantaina 22. maaliskuuta 2024, 8.12.41 EET flow gg a écrit :
> It might be a bit inconvenient to find the patches related to vp8, vp9 that
> were sent earlier. Here, I've placed them in a zip file in this reply

ZIP files are not particularly convenient. The only easy way for me to review 
is if patches are sent with git-send-email. (As for merging, the easiest is of 
course to pull them from a git repository.)

This would not be a problem if FFmpeg used a web forge, but hell will freeze 
before that.

-- 
レミ・デニ-クールモン
http://www.remlab.net/



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

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 
> ---
>  libavcodec/Makefile |   3 +
>  libavcodec/allcodecs.c  |   3 +
>  libavcodec/codec_desc.c |  14 +++
>  libavcodec/codec_id.h   |   2 +
>  libavcodec/liblc3dec.c  | 146 ++
>  libavcodec/liblc3enc.c  | 191 
>  6 files changed, 359 insertions(+)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 708434ac76..7d2cf3076d 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1123,6 +1123,9 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
>  OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
>  OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
>  OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
> +OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
> +OBJS-$(CONFIG_LIBLC3_LC3_DECODER) += liblc3dec.o
> +OBJS-$(CONFIG_LIBLC3_LC3PLUS_DECODER) += liblc3dec.o
>  OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
>  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
>  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 2386b450a6..29aedaeac6 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -776,6 +776,9 @@ extern const FFCodec ff_libilbc_encoder;
>  extern const FFCodec ff_libilbc_decoder;
>  extern const FFCodec ff_libjxl_decoder;
>  extern const FFCodec ff_libjxl_encoder;
> +extern const FFCodec ff_liblc3_encoder;
> +extern const FFCodec ff_liblc3_lc3_decoder;
> +extern const FFCodec ff_liblc3_lc3plus_decoder;
>  extern const FFCodec ff_libmp3lame_encoder;
>  extern const FFCodec ff_libopencore_amrnb_encoder;
>  extern const FFCodec ff_libopencore_amrnb_decoder;
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 3bab86db62..230bba2a09 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -3425,6 +3425,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
>  .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
>  .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
>  },
> +{
> +.id= AV_CODEC_ID_LC3,
> +.type  = AVMEDIA_TYPE_AUDIO,
> +.name  = "lc3",
> +.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity Communication 
> Codec)"),
> +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> +},
> +{
> +.id= AV_CODEC_ID_LC3_PLUS,
> +.type  = AVMEDIA_TYPE_AUDIO,
> +.name  = "lc3_plus",
> +.long_name = NULL_IF_CONFIG_SMALL("LC3plus (Low Complexity 
> Communication Codec plus)"),
> +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> +},
>  
>  /* subtitle codecs */
>  {
> diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> index c8dc21da74..7e4cb39049 100644
> --- a/libavcodec/codec_id.h
> +++ b/libavcodec/codec_id.h
> @@ -543,6 +543,8 @@ enum AVCodecID {
>  AV_CODEC_ID_AC4,
>  AV_CODEC_ID_OSQ,
>  AV_CODEC_ID_QOA,
> +AV_CODEC_ID_LC3,
> +AV_CODEC_ID_LC3_PLUS,
>  
>  /* subtitle codecs */
>  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing 
> at the start of subtitle codecs.
> diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
> new file mode 100644
> index 00..e97cecc68f
> --- /dev/null
> +++ b/libavcodec/liblc3dec.c
> @@ -0,0 +1,146 @@
> +/*
> + * LC3 decoder wrapper
> + * Copyright (C) 2024  Antoine Soulier 
> + *
> + * This file is part of FFmpeg.
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include 
> +
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avcodec.h"
> +#include "codec.h"
> +#include "codec_internal.h"
> +#include "decode.h"
> +#include "internal.h"
> +
> +#define DECODER_MAX_CHANNELS  2
> +
> +typedef struct LibLC3DecContext {
> 

Re: [FFmpeg-devel] [PATCH v3] avformat: enable UDP IPv6 multicast interface selection using localaddr

2024-03-26 Thread Rémi Denis-Courmont
Both patches -1 for same reasons as before and that's unnecessary, 
functionally incorrect and potentially racy, enumeration of local interfaces.

-- 
レミ・デニ-クールモン
http://www.remlab.net/
___
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] avformat: enable UDP IPv6 multicast interface selection

2024-03-26 Thread Rémi Denis-Courmont
Le perjantaina 22. maaliskuuta 2024, 12.16.30 EET Ignjatović, Lazar (RS) a 
écrit :
> This message has been marked as Public on 03/22/2024 10:16Z.
> 
> On Friday, March 22, 2024 10:55 AM Rémi Denis-Courmont wrote:
> > So why are you arguing now?
> 
> Because I still belive that using localaddr is the better approach.

You're entitled to your opinion. That won't change the fact that:

1) The rest of the industry disagrees with you. And by that, I mean the IETF 
(see the advanced IPv6 socket API specifications), the OS and IP stacks and as 
well as existing software other than FFmpeg.

2) It is obvjectively far simpler and more user-friendly to request an 
interface name than a link-local address. Back when link-local addresses were 
derived from the MAC address, you would have had to remember the MAC, which 
nobody in its right mind did. But nowadays, link-local addresses are actually 
random, so that's moot.

In other words, this is ridiculous.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



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

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


Re: [FFmpeg-devel] [PATCH 4/5] doc: Add LC3/LC3plus muxer and encoder parameters documentation

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 16:47:38 +, ffmpeg-devel Mailing List wrote:
> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 
> ---
>  doc/encoders.texi | 57 +++
>  doc/general_contents.texi | 12 -
>  doc/muxers.texi   |  4 +++
>  3 files changed, 72 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 7c223ed74c..0719ba13cc 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he 
> -b:a 64k output.m4a
>  @end example
>  @end itemize
>  
> +@anchor{liblc3-enc}
> +@section liblc3
> +
> +liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
> +
> +Requires the presence of the liblc3 headers and library during configuration.
> +You need to explicitly configure the build with @code{--enable-liblc3}.
> +
> +This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
> +protocol, and the following features of LC3plus:
> +@itemize @minus
> +@item
> +Frame duration of 2.5 and 5ms.
> +@item
> +High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
> +@end itemize
> +
> +For more information see the liblc3 project at
> +@url{https://github.com/google/liblc3}.
> +
> +@subsection Options
> +
> +The following options are mapped on the shared FFmpeg codec options.
> +
> +@table @option
> +@item b
> +Set the bit rate in bits/s. This will determine the fixed size of the encoded
> +frames, for a selected frame duration.
> +
> +@item ar
> +Set the audio sampling rate (in Hz).
> +
> +@item channels
> +Set the number of audio channels.
> +
> +@item frame_duration
> +Set the audio frame duration in milliseconds. Default value is 10ms.
> +Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
> +LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
> +and 10ms.
> +
> +The 10ms frame duration is available in LC3 and LC3 plus standard.
> +In this mode, the produced bitstream can be referenced either as LC3 or 
> LC3plus.
> +
> +@item high_resolution
> +Enable the high-resolution mode if set to 1. The high-resolution mode is
> +available with all LC3plus frame durations and for a sampling rate 48 KHz,
> +and 96 KHz.
> +
> +The encoder automatically turns off this mode at lower sampling rates and
> +activates it at 96 KHz.
> +
> +This mode should be preferred at high bitrates. In this mode, the audio
> +bandwidth is always up to the Nyquist frequency, compared to LC3 at 48 KHz,
> +which limits the bandwidth to 20 KHz.
> +@end table
> +
>  @anchor{libmp3lame}
>  @section libmp3lame
>  
> diff --git a/doc/general_contents.texi b/doc/general_contents.texi
> index f269cbd1a9..9e340fce7b 100644
> --- a/doc/general_contents.texi
> +++ b/doc/general_contents.texi
> @@ -237,6 +237,14 @@ Go to 
> @url{http://sourceforge.net/projects/opencore-amr/} and follow the
>  instructions for installing the library.
>  Then pass @code{--enable-libfdk-aac} to configure to enable it.
>  
> +@subsection LC3 library
> +
> +FFmpeg can make use of the Google LC3 library for LC3 decoding & encoding.
> +
> +Go to @url{https://github.com/google/liblc3/} and follow the instructions for
> +installing the library.
> +Then pass @code{--enable-liblc3} to configure to enable it.
> +
>  @section OpenH264
>  
>  FFmpeg can make use of the OpenH264 library for H.264 decoding and encoding.
> @@ -1300,7 +1308,9 @@ following image formats are supported:
>  @tab encoding and decoding supported through external library libilbc
>  @item IMC (Intel Music Coder)  @tab @tab  X
>  @item Interplay ACM@tab @tab  X
> -@item MACE (Macintosh Audio Compression/Expansion) 3:1  @tab @tab  X
> +@item LC3@tab E  @tab  E
> +@tab supported through external library liblc3
> +@item LC3plus@tab  E  @tab  E
>  @item MACE (Macintosh Audio Compression/Expansion) 6:1  @tab @tab  X
>  @item Marian's A-pac audio @tab @tab  X
>  @item MI-SC4 (Micronas SC-4 Audio)  @tab @tab  X
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index d9dd72e613..43dabe4499 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -132,6 +132,10 @@ to Annex B syntax if it's in length-prefixed mode.
>  ITU-T H.265 / MPEG-H Part 2 HEVC video. Bitstream shall be converted
>  to Annex B syntax if it's in length-prefixed mode.
>  

> +@item lc3 @emph{audio} (lc3)
> +Bluetooth SIG Low Complexity Communication Codec audio.
> +ETSI TS 103 634 Low Complexity Communication Codec plus (LC3plus).

technically this is not a raw muxer, so it should stand in a dedicated section

[...]

Should be good othetwise.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 5/5] Changelog: Add LC3/LC3plus decoding/encoding support

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 16:47:39 +, ffmpeg-devel Mailing List wrote:
> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 
> ---
>  Changelog | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Changelog b/Changelog
> index c6e8f6bcaf..fb08ee2f81 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
> within each release,
>  releases are sorted from youngest to oldest.
>  
>  version :
> +- LC3/LC3plus decoding/encoding using external library liblc3
>  - DXV DXT1 encoder
>  - LEAD MCMP decoder
>  - EVC decoding using external library libxevd

new entries to the bottom, also this is not rebased on top of mainline
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 3/5] avformat/lc3: Add file format for LC3/LC3plus transport

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 16:47:37 +, ffmpeg-devel Mailing List wrote:
> A file format is described in Bluetooth SIG LC3 and ETSI TS 103 634, for
> test purpose. This is the format implemented here.
> 
> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 
> ---
>  libavformat/Makefile |   3 +
>  libavformat/allformats.c |   3 +
>  libavformat/lc3dec.c | 140 +++
>  libavformat/lc3enc.c | 118 +
>  4 files changed, 264 insertions(+)
>  create mode 100644 libavformat/lc3dec.c
>  create mode 100644 libavformat/lc3enc.c
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 94a949f555..29a38c1d94 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -332,6 +332,9 @@ OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
>  OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
>  OBJS-$(CONFIG_LAF_DEMUXER)   += lafdec.o
>  OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
> +OBJS-$(CONFIG_LC3_DEMUXER)   += lc3dec.o
> +OBJS-$(CONFIG_LC3_MUXER) += lc3enc.o
> +OBJS-$(CONFIG_LC3_PLUS_MUXER)+= lc3enc.o
>  OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
>  OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
>  OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index e15d0fa6d7..551b0f0d7b 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -252,6 +252,9 @@ extern const FFInputFormat  ff_kvag_demuxer;
>  extern const FFOutputFormat ff_kvag_muxer;
>  extern const FFInputFormat  ff_laf_demuxer;
>  extern const FFOutputFormat ff_latm_muxer;
> +extern const FFInputFormat  ff_lc3_demuxer;
> +extern const FFOutputFormat ff_lc3_muxer;
> +extern const FFOutputFormat ff_lc3_plus_muxer;
>  extern const FFInputFormat  ff_lmlm4_demuxer;
>  extern const FFInputFormat  ff_loas_demuxer;
>  extern const FFInputFormat  ff_luodat_demuxer;
> diff --git a/libavformat/lc3dec.c b/libavformat/lc3dec.c
> new file mode 100644
> index 00..563384f786
> --- /dev/null
> +++ b/libavformat/lc3dec.c
> @@ -0,0 +1,140 @@
> +/*
> + * LC3 demuxer
> + * Copyright (C) 2024  Antoine Soulier 
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * Based on the file format specified by :
> + *
> + * - Bluetooth SIG - Low Complexity Communication Codec Test Suite
> + *   https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=502301
> + *   3.2.8.2 Reference LC3 Codec Bitstream Format
> + *
> + * - ETSI TI 103 634 V1.4.1 - Low Complexity Communication Codec plus
> + *   
> https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p.pdf
> + *   LC3plus conformance script package
> + */
> +
> +#include 
> +
> +#include "libavcodec/avcodec.h"
> +#include "libavcodec/packet.h"
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avformat.h"
> +#include "avio.h"
> +#include "demux.h"
> +#include "internal.h"
> +
> +typedef struct LC3DemuxContext {
> +int frame_samples;
> +int64_t position;
> +int64_t length;
> +} LC3DemuxContext;
> +
> +static int lc3_read_header(AVFormatContext *s)
> +{
> +LC3DemuxContext *lc3 = s->priv_data;
> +AVStream *st = NULL;
> +uint16_t tag, hdr_size;
> +uint16_t frame_us;
> +uint32_t length;

> +bool ep_mode, hr_mode;

I don't think we use bool anywhere

> +int srate_hz, channels, bit_rate;
> +int num_extra_params, ret;
> +
> +tag = avio_rb16(s->pb);
> +hdr_size = avio_rl16(s->pb);
> +
> +if (tag != 0x1ccc || hdr_size < 9 * sizeof(uint16_t))
> +return AVERROR_INVALIDDATA;
> +
> +num_extra_params = hdr_size / sizeof(uint16_t) - 9;
> +
> +srate_hz = avio_rl16(s->pb) * 100;
> +bit_rate = avio_rl16(s->pb) * 100;
> +channels = avio_rl16(s->pb);
> +frame_us = avio_rl16(s->pb) * 10;
> +ep_mode  = avio_rl16(s->pb) != 0;
> +length   = avio_rl32(s->pb);
> +hr_mode  = num_extra_params >= 1 && avio_rl16(s->pb);
> +
> +st = avformat_new_stream(s, NULL);
> +if (!st)
> +return AVERROR(ENOMEM);
> +
> +

Re: [FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Compared with the C implementation of KissFFT (it's the only one I tested
on ARM M4).
Yes, there is no SIMD on x86. This was not the main target.
Was mainly made for ARM M4 (for BLE devices Nordic Semi / Zephyr), and ARM
Neon (Android).
By the way, this does not change a lot, the FFT/MDCT on powerful CPU's is
marginal compared to the read/write of the bitstream arithmetically coded.
We can perhaps connect the FFMpeg implementation, but it will probably miss
2 things:
- Some transformations are not a multiple of 15, but only 5 * 2^n. I guess
FFmpeg only has a base 15 implementation.
- It uses asymmetric windowing, to reduce algorithmic delay. Some
coefficients are zeroed. Not important, but will need a larger coefficients
table, and a bunch of multiplication by 0, without a specific
implementation.
So I think it will need some work.

On Tue, Mar 26, 2024 at 10:45 AM Paul B Mahol  wrote:

>
>
> On Tue, Mar 26, 2024 at 6:07 PM Antoine Soulier 
> wrote:
>
>> What do you mean by sub-optimal?
>> It's stacked by prime factors, and unrolled for FFT3 and FF5.
>> The butterfly implementations of FFT3 and FF5, gives me slightly slower
>> computation. FFT5 is done first, so it takes advantage of sin()/cos()
>> values of 0 or 1.
>> There are also no reordering steps (this stage is completely removed),
>> but cannot run in-place.
>> Benchmarks I made show that it runs slightly faster.
>>
>
> Compared with what?
> Where is at least x86 SIMD for that MDCT?
>
>
>>
>> On Tue, Mar 26, 2024 at 9:59 AM Paul B Mahol  wrote:
>>
>>>
>>> Isn't this using sub-optimal MDCT implementation?
>>>
>>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 16:47:36 +, ffmpeg-devel Mailing List wrote:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 
> ---
>  libavcodec/Makefile |   3 +
>  libavcodec/allcodecs.c  |   3 +
>  libavcodec/codec_desc.c |  14 +++
>  libavcodec/codec_id.h   |   2 +
>  libavcodec/liblc3dec.c  | 146 ++
>  libavcodec/liblc3enc.c  | 191 
>  6 files changed, 359 insertions(+)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 708434ac76..7d2cf3076d 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1123,6 +1123,9 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
>  OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
>  OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
>  OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
> +OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
> +OBJS-$(CONFIG_LIBLC3_LC3_DECODER) += liblc3dec.o
> +OBJS-$(CONFIG_LIBLC3_LC3PLUS_DECODER) += liblc3dec.o
>  OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
>  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
>  OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 2386b450a6..29aedaeac6 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -776,6 +776,9 @@ extern const FFCodec ff_libilbc_encoder;
>  extern const FFCodec ff_libilbc_decoder;
>  extern const FFCodec ff_libjxl_decoder;
>  extern const FFCodec ff_libjxl_encoder;
> +extern const FFCodec ff_liblc3_encoder;
> +extern const FFCodec ff_liblc3_lc3_decoder;
> +extern const FFCodec ff_liblc3_lc3plus_decoder;
>  extern const FFCodec ff_libmp3lame_encoder;
>  extern const FFCodec ff_libopencore_amrnb_encoder;
>  extern const FFCodec ff_libopencore_amrnb_decoder;
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 3bab86db62..230bba2a09 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -3425,6 +3425,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
>  .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
>  .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
>  },
> +{
> +.id= AV_CODEC_ID_LC3,
> +.type  = AVMEDIA_TYPE_AUDIO,
> +.name  = "lc3",
> +.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity Communication 
> Codec)"),
> +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> +},
> +{
> +.id= AV_CODEC_ID_LC3_PLUS,
> +.type  = AVMEDIA_TYPE_AUDIO,
> +.name  = "lc3_plus",
> +.long_name = NULL_IF_CONFIG_SMALL("LC3plus (Low Complexity 
> Communication Codec plus)"),
> +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
> +},
>  
>  /* subtitle codecs */
>  {
> diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> index c8dc21da74..7e4cb39049 100644
> --- a/libavcodec/codec_id.h
> +++ b/libavcodec/codec_id.h
> @@ -543,6 +543,8 @@ enum AVCodecID {
>  AV_CODEC_ID_AC4,
>  AV_CODEC_ID_OSQ,
>  AV_CODEC_ID_QOA,
> +AV_CODEC_ID_LC3,
> +AV_CODEC_ID_LC3_PLUS,
>  
>  /* subtitle codecs */
>  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing 
> at the start of subtitle codecs.
> diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
> new file mode 100644
> index 00..e97cecc68f
> --- /dev/null
> +++ b/libavcodec/liblc3dec.c
> @@ -0,0 +1,146 @@
> +/*
> + * LC3 decoder wrapper
> + * Copyright (C) 2024  Antoine Soulier 
> + *
> + * This file is part of FFmpeg.
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include 
> +
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avcodec.h"
> +#include "codec.h"
> +#include "codec_internal.h"
> +#include "decode.h"
> +#include "internal.h"
> +
> +#define DECODER_MAX_CHANNELS  2

Re: [FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Paul B Mahol
On Tue, Mar 26, 2024 at 6:07 PM Antoine Soulier  wrote:

> What do you mean by sub-optimal?
> It's stacked by prime factors, and unrolled for FFT3 and FF5.
> The butterfly implementations of FFT3 and FF5, gives me slightly slower
> computation. FFT5 is done first, so it takes advantage of sin()/cos()
> values of 0 or 1.
> There are also no reordering steps (this stage is completely removed), but
> cannot run in-place.
> Benchmarks I made show that it runs slightly faster.
>

Compared with what?
Where is at least x86 SIMD for that MDCT?


>
> On Tue, Mar 26, 2024 at 9:59 AM Paul B Mahol  wrote:
>
>>
>> Isn't this using sub-optimal MDCT implementation?
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Arf, sorry for that. I used `git send-email -s`, perhaps it's the source of
the double signed-off.

On Tue, Mar 26, 2024 at 10:32 AM Stefano Sabatini 
wrote:

> On date Tuesday 2024-03-26 16:47:35 +, ffmpeg-devel Mailing List wrote:
>
> > Signed-off-by: Antoine Soulier 
> > Signed-off-by: Antoine SOULIER 
>
> why the double sign-off?
>
> [...]
>
> 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] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 16:47:35 +, ffmpeg-devel Mailing List wrote:

> Signed-off-by: Antoine Soulier 
> Signed-off-by: Antoine SOULIER 

why the double sign-off?

[...]

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] [PATCH] avformat/httpauth: add SHA-256 Digest Authorization

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 05:52:59 +, �� | Eugene wrote:
> - add SHA-256 Digest Authorization for RFC7616 using avutil/hash.h
> 
> Signed-off-by: Eugene-bitsensing 
> ---
>  libavformat/httpauth.c | 116 -
>  libavformat/httpauth.h |   8 +++
>  2 files changed, 123 insertions(+), 1 deletion(-)

missing entry to Changelog

> 
> diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
> index 9780928357..8391b6f32f 100644
> --- a/libavformat/httpauth.c
> +++ b/libavformat/httpauth.c
> @@ -25,6 +25,7 @@
>  #include "internal.h"
>  #include "libavutil/random_seed.h"
>  #include "libavutil/md5.h"
> +#include "libavutil/hash.h"
>  #include "urldecode.h"
>  
>  static void handle_basic_params(HTTPAuthState *state, const char *key,
> @@ -236,6 +237,114 @@ static char *make_digest_auth(HTTPAuthState *state, 
> const char *username,
>  return authstr;
>  }
>  
> +/**
> + * Generate a digest reply SHA-256, according to RFC 7616.

> + * TODO : support other RFIC 7616 Algorithm 

typo: RFC ... algorithms

> + */
> +static char *make_digest_auth_sha(HTTPAuthState *state, const char *username,

> +  const char *password, const char *uri,
> +  const char *method, const char *algorithm)

nit: weird indent, align to HTTPAuthState

> +{
> +DigestParams *digest = >digest_params;
> +int len;
> +uint32_t cnonce_buf[2];
> +char cnonce[17];
> +char nc[9];
> +int i;

> +char A1hash[65], A2hash[65], response[65];

style: use snake_case (a1_hash etc.)

> +struct AVHashContext *hashctx;
> +uint8_t hash[64];
> +char *authstr;
> +
> +digest->nc++;
> +snprintf(nc, sizeof(nc), "%08x", digest->nc);
> +
> +/* Generate a client nonce. */
> +for (i = 0; i < 2; i++)
> +cnonce_buf[i] = av_get_random_seed();

> +ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 
> 1);

nit++: (const uint8_t *)cnonce_buf

> +
> +/* Allocate a hash context based on the provided algorithm */

> +int ret = av_hash_alloc(, algorithm);
> +if (ret < 0) {
> +return NULL;
> +}

unrelated, but it might be good to propagate the error code (it might
fail for several reasons - not blocking since this also impacts the
other function and can be done in a later change)

> +
> +/* Initialize the hash context */
> +av_hash_init(hashctx);
> +
> +/* Update the hash context with A1 data */
> +av_hash_update(hashctx, (const uint8_t *)username, strlen(username));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)state->realm, 
> strlen(state->realm));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)password, strlen(password));
> +av_hash_final(hashctx, hash);
> +ff_data_to_hex(A1hash, hash, av_hash_get_size(hashctx), 1);
> +
> +/* Initialize the hash context for A2 */
> +av_hash_init(hashctx);
> +av_hash_update(hashctx, (const uint8_t *)method, strlen(method));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)uri, strlen(uri));
> +av_hash_final(hashctx, hash);
> +ff_data_to_hex(A2hash, hash, av_hash_get_size(hashctx), 1);
> +
> +/* Initialize the hash context for response */
> +av_hash_init(hashctx);
> +av_hash_update(hashctx, (const uint8_t *)A1hash, strlen(A1hash));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)digest->nonce, 
> strlen(digest->nonce));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)nc, strlen(nc));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)cnonce, strlen(cnonce));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)digest->qop, 
> strlen(digest->qop));
> +av_hash_update(hashctx, (const uint8_t *)":", 1);
> +av_hash_update(hashctx, (const uint8_t *)A2hash, strlen(A2hash));
> +av_hash_final(hashctx, hash);
> +ff_data_to_hex(response, hash, av_hash_get_size(hashctx), 1);
> +
> +/* Free the hash context */
> +av_hash_freep();
> +
> +len = strlen(username) + strlen(state->realm) + strlen(digest->nonce) +
> +  strlen(uri) + strlen(response) + strlen(digest->algorithm) +
> +  strlen(digest->opaque) + strlen(digest->qop) + strlen(cnonce) +
> +  strlen(nc) + 150;
> +
> +authstr = av_malloc(len);
> +if (!authstr) {
> +return NULL;
> +}
> +
> +/* Generate Header same way as *make_digest_auth */
> +snprintf(authstr, len, "Authorization: Digest ");
> +
> +av_strlcatf(authstr, len, "username=\"%s\"",   username);
> +av_strlcatf(authstr, len, ", realm=\"%s\"", state->realm);
> +av_strlcatf(authstr, len, 

Re: [FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
What do you mean by sub-optimal?
It's stacked by prime factors, and unrolled for FFT3 and FF5.
The butterfly implementations of FFT3 and FF5, gives me slightly slower
computation. FFT5 is done first, so it takes advantage of sin()/cos()
values of 0 or 1.
There are also no reordering steps (this stage is completely removed), but
cannot run in-place.
Benchmarks I made show that it runs slightly faster.

On Tue, Mar 26, 2024 at 9:59 AM Paul B Mahol  wrote:

>
> Isn't this using sub-optimal MDCT implementation?
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Paul B Mahol
Isn't this using sub-optimal MDCT implementation?
___
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 5/5] Changelog: Add LC3/LC3plus decoding/encoding support

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Signed-off-by: Antoine Soulier 
Signed-off-by: Antoine SOULIER 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index c6e8f6bcaf..fb08ee2f81 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version :
+- LC3/LC3plus decoding/encoding using external library liblc3
 - DXV DXT1 encoder
 - LEAD MCMP decoder
 - EVC decoding using external library libxevd
-- 
2.44.0.396.g6e790dbe36-goog

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

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


[FFmpeg-devel] [PATCH 4/5] doc: Add LC3/LC3plus muxer and encoder parameters documentation

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Signed-off-by: Antoine Soulier 
Signed-off-by: Antoine SOULIER 
---
 doc/encoders.texi | 57 +++
 doc/general_contents.texi | 12 -
 doc/muxers.texi   |  4 +++
 3 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..0719ba13cc 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
 @end example
 @end itemize
 
+@anchor{liblc3-enc}
+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize @minus
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at lower sampling rates and
+activates it at 96 KHz.
+
+This mode should be preferred at high bitrates. In this mode, the audio
+bandwidth is always up to the Nyquist frequency, compared to LC3 at 48 KHz,
+which limits the bandwidth to 20 KHz.
+@end table
+
 @anchor{libmp3lame}
 @section libmp3lame
 
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index f269cbd1a9..9e340fce7b 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -237,6 +237,14 @@ Go to @url{http://sourceforge.net/projects/opencore-amr/} 
and follow the
 instructions for installing the library.
 Then pass @code{--enable-libfdk-aac} to configure to enable it.
 
+@subsection LC3 library
+
+FFmpeg can make use of the Google LC3 library for LC3 decoding & encoding.
+
+Go to @url{https://github.com/google/liblc3/} and follow the instructions for
+installing the library.
+Then pass @code{--enable-liblc3} to configure to enable it.
+
 @section OpenH264
 
 FFmpeg can make use of the OpenH264 library for H.264 decoding and encoding.
@@ -1300,7 +1308,9 @@ following image formats are supported:
 @tab encoding and decoding supported through external library libilbc
 @item IMC (Intel Music Coder)  @tab @tab  X
 @item Interplay ACM@tab @tab  X
-@item MACE (Macintosh Audio Compression/Expansion) 3:1  @tab @tab  X
+@item LC3@tab E  @tab  E
+@tab supported through external library liblc3
+@item LC3plus@tab  E  @tab  E
 @item MACE (Macintosh Audio Compression/Expansion) 6:1  @tab @tab  X
 @item Marian's A-pac audio @tab @tab  X
 @item MI-SC4 (Micronas SC-4 Audio)  @tab @tab  X
diff --git a/doc/muxers.texi b/doc/muxers.texi
index d9dd72e613..43dabe4499 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -132,6 +132,10 @@ to Annex B syntax if it's in length-prefixed mode.
 ITU-T H.265 / MPEG-H Part 2 HEVC video. Bitstream shall be converted
 to Annex B syntax if it's in length-prefixed mode.
 
+@item lc3 @emph{audio} (lc3)
+Bluetooth SIG Low Complexity Communication Codec audio.
+ETSI TS 103 634 Low Complexity Communication Codec plus (LC3plus).
+
 @item m4v @emph{video}
 MPEG-4 Part 2 video
 
-- 
2.44.0.396.g6e790dbe36-goog

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

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


[FFmpeg-devel] [PATCH 3/5] avformat/lc3: Add file format for LC3/LC3plus transport

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
A file format is described in Bluetooth SIG LC3 and ETSI TS 103 634, for
test purpose. This is the format implemented here.

Signed-off-by: Antoine Soulier 
Signed-off-by: Antoine SOULIER 
---
 libavformat/Makefile |   3 +
 libavformat/allformats.c |   3 +
 libavformat/lc3dec.c | 140 +++
 libavformat/lc3enc.c | 118 +
 4 files changed, 264 insertions(+)
 create mode 100644 libavformat/lc3dec.c
 create mode 100644 libavformat/lc3enc.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..29a38c1d94 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -332,6 +332,9 @@ OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
 OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
 OBJS-$(CONFIG_LAF_DEMUXER)   += lafdec.o
 OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
+OBJS-$(CONFIG_LC3_DEMUXER)   += lc3dec.o
+OBJS-$(CONFIG_LC3_MUXER) += lc3enc.o
+OBJS-$(CONFIG_LC3_PLUS_MUXER)+= lc3enc.o
 OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
 OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
 OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..551b0f0d7b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -252,6 +252,9 @@ extern const FFInputFormat  ff_kvag_demuxer;
 extern const FFOutputFormat ff_kvag_muxer;
 extern const FFInputFormat  ff_laf_demuxer;
 extern const FFOutputFormat ff_latm_muxer;
+extern const FFInputFormat  ff_lc3_demuxer;
+extern const FFOutputFormat ff_lc3_muxer;
+extern const FFOutputFormat ff_lc3_plus_muxer;
 extern const FFInputFormat  ff_lmlm4_demuxer;
 extern const FFInputFormat  ff_loas_demuxer;
 extern const FFInputFormat  ff_luodat_demuxer;
diff --git a/libavformat/lc3dec.c b/libavformat/lc3dec.c
new file mode 100644
index 00..563384f786
--- /dev/null
+++ b/libavformat/lc3dec.c
@@ -0,0 +1,140 @@
+/*
+ * LC3 demuxer
+ * Copyright (C) 2024  Antoine Soulier 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Based on the file format specified by :
+ *
+ * - Bluetooth SIG - Low Complexity Communication Codec Test Suite
+ *   https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=502301
+ *   3.2.8.2 Reference LC3 Codec Bitstream Format
+ *
+ * - ETSI TI 103 634 V1.4.1 - Low Complexity Communication Codec plus
+ *   
https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p.pdf
+ *   LC3plus conformance script package
+ */
+
+#include 
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/packet.h"
+#include "libavutil/intreadwrite.h"
+
+#include "avformat.h"
+#include "avio.h"
+#include "demux.h"
+#include "internal.h"
+
+typedef struct LC3DemuxContext {
+int frame_samples;
+int64_t position;
+int64_t length;
+} LC3DemuxContext;
+
+static int lc3_read_header(AVFormatContext *s)
+{
+LC3DemuxContext *lc3 = s->priv_data;
+AVStream *st = NULL;
+uint16_t tag, hdr_size;
+uint16_t frame_us;
+uint32_t length;
+bool ep_mode, hr_mode;
+int srate_hz, channels, bit_rate;
+int num_extra_params, ret;
+
+tag = avio_rb16(s->pb);
+hdr_size = avio_rl16(s->pb);
+
+if (tag != 0x1ccc || hdr_size < 9 * sizeof(uint16_t))
+return AVERROR_INVALIDDATA;
+
+num_extra_params = hdr_size / sizeof(uint16_t) - 9;
+
+srate_hz = avio_rl16(s->pb) * 100;
+bit_rate = avio_rl16(s->pb) * 100;
+channels = avio_rl16(s->pb);
+frame_us = avio_rl16(s->pb) * 10;
+ep_mode  = avio_rl16(s->pb) != 0;
+length   = avio_rl32(s->pb);
+hr_mode  = num_extra_params >= 1 && avio_rl16(s->pb);
+
+st = avformat_new_stream(s, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+avpriv_set_pts_info(st, 32, 1, srate_hz);
+st->duration = length;
+
+st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+st->codecpar->codec_id = frame_us <= 5000 || ep_mode || hr_mode ?
+ AV_CODEC_ID_LC3_PLUS : AV_CODEC_ID_LC3;
+st->codecpar->sample_rate = srate_hz;
+st->codecpar->bit_rate = bit_rate;
+st->codecpar->ch_layout.nb_channels = 

[FFmpeg-devel] [PATCH 2/5] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
Signed-off-by: Antoine SOULIER 
---
 libavcodec/Makefile |   3 +
 libavcodec/allcodecs.c  |   3 +
 libavcodec/codec_desc.c |  14 +++
 libavcodec/codec_id.h   |   2 +
 libavcodec/liblc3dec.c  | 146 ++
 libavcodec/liblc3enc.c  | 191 
 6 files changed, 359 insertions(+)
 create mode 100644 libavcodec/liblc3dec.c
 create mode 100644 libavcodec/liblc3enc.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 708434ac76..7d2cf3076d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1123,6 +1123,9 @@ OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
 OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
 OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
 OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
+OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
+OBJS-$(CONFIG_LIBLC3_LC3_DECODER) += liblc3dec.o
+OBJS-$(CONFIG_LIBLC3_LC3PLUS_DECODER) += liblc3dec.o
 OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
 OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
 OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2386b450a6..29aedaeac6 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -776,6 +776,9 @@ extern const FFCodec ff_libilbc_encoder;
 extern const FFCodec ff_libilbc_decoder;
 extern const FFCodec ff_libjxl_decoder;
 extern const FFCodec ff_libjxl_encoder;
+extern const FFCodec ff_liblc3_encoder;
+extern const FFCodec ff_liblc3_lc3_decoder;
+extern const FFCodec ff_liblc3_lc3plus_decoder;
 extern const FFCodec ff_libmp3lame_encoder;
 extern const FFCodec ff_libopencore_amrnb_encoder;
 extern const FFCodec ff_libopencore_amrnb_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 3bab86db62..230bba2a09 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -3425,6 +3425,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_LC3,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "lc3",
+.long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity Communication 
Codec)"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
+{
+.id= AV_CODEC_ID_LC3_PLUS,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "lc3_plus",
+.long_name = NULL_IF_CONFIG_SMALL("LC3plus (Low Complexity 
Communication Codec plus)"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index c8dc21da74..7e4cb39049 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -543,6 +543,8 @@ enum AVCodecID {
 AV_CODEC_ID_AC4,
 AV_CODEC_ID_OSQ,
 AV_CODEC_ID_QOA,
+AV_CODEC_ID_LC3,
+AV_CODEC_ID_LC3_PLUS,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c
new file mode 100644
index 00..e97cecc68f
--- /dev/null
+++ b/libavcodec/liblc3dec.c
@@ -0,0 +1,146 @@
+/*
+ * LC3 decoder wrapper
+ * Copyright (C) 2024  Antoine Soulier 
+ *
+ * This file is part of FFmpeg.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+
+#include "libavutil/intreadwrite.h"
+
+#include "avcodec.h"
+#include "codec.h"
+#include "codec_internal.h"
+#include "decode.h"
+#include "internal.h"
+
+#define DECODER_MAX_CHANNELS  2
+
+typedef struct LibLC3DecContext {
+int frame_us, srate_hz;
+bool hr_mode;
+lc3_decoder_t decoder[DECODER_MAX_CHANNELS];
+} LibLC3DecContext;
+
+static av_cold int liblc3_decode_init(AVCodecContext *avctx)
+{
+LibLC3DecContext *liblc3 = avctx->priv_data;
+int channels = 

[FFmpeg-devel] [PATCH 1/5] configure: Add option for enabling LC3/LC3plus wrapper

2024-03-26 Thread Antoine Soulier via ffmpeg-devel
Signed-off-by: Antoine Soulier 
Signed-off-by: Antoine SOULIER 
---
 configure | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/configure b/configure
index 343edb38ab..eb8ff81a11 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
   --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
   --enable-liblensfun  enable lensfun lens correction [no]
   --enable-libmodplug  enable ModPlug via libmodplug [no]
   --enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
 libjxl
 libklvanc
 libkvazaar
+liblc3
 libmodplug
 libmp3lame
 libmysofa
@@ -3501,6 +3503,10 @@ libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
 libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
+liblc3_lc3_decoder_deps="liblc3"
+liblc3_lc3plus_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6858,6 +6864,7 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
  require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
 
 if enabled libmfx && enabled libvpl; then
-- 
2.44.0.396.g6e790dbe36-goog

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

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


Re: [FFmpeg-devel] [PATCH 02/10] avutil/fifo, file: Remove unused headers

2024-03-26 Thread Stefano Sabatini
On date Monday 2024-03-25 02:53:16 +0100, Andreas Rheinhardt wrote:
> Forgotten in 4105899245d79976b4a1a230455066417f3f194d,
> 4c92fc02f850f4f813e8cef8f8f8ed37d498e090.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavutil/fifo.h | 4 
>  libavutil/file.h | 1 -
>  2 files changed, 5 deletions(-)

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

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


Re: [FFmpeg-devel] [PATCH 01/10] doc/examples: Always use <> includes

2024-03-26 Thread Stefano Sabatini
On date Monday 2024-03-25 02:51:16 +0100, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  doc/examples/filter_audio.c  | 18 +-
>  doc/examples/qsv_decode.c| 16 
>  doc/examples/transcode_aac.c | 20 ++--
>  3 files changed, 27 insertions(+), 27 deletions(-)

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

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


Re: [FFmpeg-devel] [PATCH v4 1/1] avformat/mpegts: Add duration_probesize AVOption

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 14:18:31 +0100, Nicolas Gaullier wrote:
> Yet another probesize option aimed at users interested
> in better durations probing for itself, or because using
> avformat_find_stream_info indirectly and requiring exact values: for
> concatdec for example, especially if streamcopying above it.
> The current code is a performance trade-off that can fail to get video
> stream durations in a scenario with high bitrates and buffering for
> files ending cleanly (as opposed to live captures): the physical gap
> between the last video packet and the last audio packet is very high in
> such a case.
> 
> Default behaviour is unchanged: 250k up to 250k << 6 (step by step).
> Setting this new option has two effects:
> - override the maximum probesize (currently 250k << 6)
> - reduce the number of steps to 1 instead of 6, this is to avoid
> detecting the audio "too early" and failing to reach a video packet.
> Even if a single audio stream duration is found but not the other
> audio/video stream durations, there will be a retry, so at the end the
> full user-overriden probesize will be used as expected by the user.
> 
> Signed-off-by: Nicolas Gaullier 
> ---
>  doc/demuxers.texi |  13 +
>  doc/formats.texi  |   2 +-
>  libavformat/demux.c   |  23 ++---
>  libavformat/mpegts.c  | 104 +---
>  libavformat/mpegts.h  | 108 +-
>  libavformat/version.h |   2 +-
>  6 files changed, 140 insertions(+), 112 deletions(-)
> 
> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> index b70f3a38d7..f88ae18a6e 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -992,6 +992,19 @@ streams move to different PIDs. Default value is 0.
>  @item max_packet_size
>  Set maximum size, in bytes, of packet emitted by the demuxer. Payloads above 
> this size
>  are split across multiple packets. Range is 1 to INT_MAX/2. Default is 
> 204800 bytes.
> +
> +@item duration_probesize
> +Set probing size, in bytes, for input duration estimation which requires a 
> specific probing
> +for PTS at end of file.
> +It is aimed at users interested in better durations probing for itself, or 
> indirectly
> +for specific use cases like using the concat demuxer.
> +Files with high bitrates and ending cleanly (as opposed to live captures), 
> can lead
> +to a large physical gap between the last video packet and the last audio 
> packet,
> +so many bytes have to be read in order to get a video stream duration.
> +Setting this value has a performance impact even for small files because the 
> probing size is fixed.
> +Default behaviour is a trade-off, largely adaptive: the probing size may 
> range from
> +25 up to 16M, but it is not extended to get streams durations at all 
> costs.
> +Must be an integer not lesser than 1, or 0 for default behaviour.
>  @end table
>  
>  @section mpjpeg
> diff --git a/doc/formats.texi b/doc/formats.texi
> index 69fc1457a4..e16cd88b2c 100644
> --- a/doc/formats.texi
> +++ b/doc/formats.texi
> @@ -225,7 +225,7 @@ Specifies the maximum number of streams. This can be used 
> to reject files that
>  would require too many resources due to a large number of streams.
>  
>  @item skip_estimate_duration_from_pts @var{bool} (@emph{input})
> -Skip estimation of input duration when calculated using PTS.

> +Skip estimation of input duration if it requires an additional probing for 
> pts at end of file.

nit++: PTS

>  At present, applicable for MPEG-PS and MPEG-TS.
>  
>  @item strict, f_strict @var{integer} (@emph{input/output})
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index 147f3b93ac..bc23786410 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -47,6 +47,7 @@
>  #include "id3v2.h"
>  #include "internal.h"
>  #include "url.h"

> +#include "mpegts.h"

this is entangling generic and specific code, and it is something
which should be avoided (ideally the generic code should know nothing
about the specific demuxer)

Rather than this, I think the previous approach is more valid: even if
we have an option that it is only useful for a specific demuxer, its
implementation was still abstract and avoiding any reference to
internals of the mpegts demuxer - and maybe it might turn useful for
other formats - who knows.

What we need in that case is only clarify the use case for which it
was conceived (which might well only apply to a specific demuxer) at
the documentation level. To clarify, I was mostly fine with the
previous patch, but for the nits and for the documentation issue - but
if this turns out that the only use case is about the MPEGTS, probably
we should just mention that (as you was already doing).

[...]

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

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


Re: [FFmpeg-devel] [PATCH 1/1] avcodec/dolby_e: Add error recovery when parse_mantissas run out of bits

2024-03-26 Thread Nicolas Gaullier
>De : Nicolas Gaullier  
>Envoyé : lundi 11 mars 2024 15:01
>
>Mantissas are the last data in the channel subsegment and it appears it is 
>sometimes missing a very few bits for the parsing to complete.
>This must not be confused with data corruption.
>In standard conditions with certified products, it has been observed that the 
>occurence of this issue is pretty steady and about once every 2 hours. The 
>truncation is at about 950 out of the 1024 values (923 is the minimum I have 
>seen so far).
>The current code raises a severe 'Read past end' error and all data is lost 
>resulting in 20ms(@25fps) of silence for the affected channel.
>This patch introduces a tolerance: if 800 out of the 1024 mantissas have been 
>parsed, a simple warning is raised and the data is preserved.

Ping ?
still applies
last posted here: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=11090
Samples (source/before patch/after patch) here: https://0x0.st/oOvv.zip

Nicolas
___
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 v9 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-03-26 Thread Andreas Rheinhardt
Marth64:
> If ff_subtitles_queue_insert() were given a NULL buffer
> with 0 length, it would still attempt to grow the packet
> or memcpy depending on if merge option is enabled.
> 
> In this commit, allow passing a NULL buffer with 0 length
> without attempting to do such operations. This way, if a
> subtitle demuxer happens to pass an empty cue or wants to
> use av_get_packet() to read bytes, there are no unnecessary
> operations on the packet after it is allocated.
> 
> Signed-off-by: Marth64 
> ---
>  libavformat/subtitles.c | 24 
>  libavformat/subtitles.h |  2 +-
>  2 files changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
> index 3413763c7b..4742ca0667 100644
> --- a/libavformat/subtitles.c
> +++ b/libavformat/subtitles.c
> @@ -21,6 +21,7 @@
>  #include "avformat.h"
>  #include "subtitles.h"
>  #include "avio_internal.h"
> +#include "libavutil/avassert.h"
>  #include "libavutil/avstring.h"
>  
>  void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
> @@ -111,15 +112,20 @@ AVPacket 
> *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
>  {
>  AVPacket **subs, *sub;
>  
> +if (!event)
> +av_assert1(len == 0);

av_assert1(event || len == 0) will make the assert message more
meaningful and saves a line.

> +
>  if (merge && q->nb_subs > 0) {
>  /* merge with previous event */
>  
>  int old_len;
>  sub = q->subs[q->nb_subs - 1];
>  old_len = sub->size;
> -if (av_grow_packet(sub, len) < 0)
> -return NULL;
> -memcpy(sub->data + old_len, event, len);
> +if (event) {
> +if (av_grow_packet(sub, len) < 0)
> +return NULL;
> +memcpy(sub->data + old_len, event, len);
> +}
>  } else {
>  /* new event */
>  
> @@ -133,14 +139,16 @@ AVPacket 
> *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
>  sub = av_packet_alloc();
>  if (!sub)
>  return NULL;
> -if (av_new_packet(sub, len) < 0) {
> -av_packet_free();
> -return NULL;
> +if (event) {
> +if (av_new_packet(sub, len) < 0) {
> +av_packet_free();
> +return NULL;
> +}
> +memcpy(sub->data, event, len);
>  }
> -subs[q->nb_subs++] = sub;
>  sub->flags |= AV_PKT_FLAG_KEY;
>  sub->pts = sub->dts = 0;
> -memcpy(sub->data, event, len);
> +subs[q->nb_subs++] = sub;
>  }
>  return sub;
>  }
> diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
> index 88665663c5..ad6b96ca6a 100644
> --- a/libavformat/subtitles.h
> +++ b/libavformat/subtitles.h
> @@ -112,7 +112,7 @@ typedef struct {
>  /**
>   * Insert a new subtitle event.
>   *
> - * @param event the subtitle line, may not be zero terminated
> + * @param event the subtitle line (not zero terminated) or NULL on not yet 
> available event
>   * @param len   the length of the event (in strlen() sense, so without '\0')
>   * @param merge set to 1 if the current event should be concatenated with the
>   *  previous one instead of adding a new entry, 0 otherwise

___
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 v9 0/5] RCWT Closed Captions demuxer (v9)

2024-03-26 Thread Stefano Sabatini
On date Tuesday 2024-03-26 10:29:18 -0500, Marth64 wrote:
> Ping if possible. The patches still apply. 3 of the 5 patches are
> documentation only and the demuxer itself is much smaller now. The muxer
> already made it in, so was hoping the demuxer could go too :fingers_crossed:

I sent a few comments but in general looks good to me, will wait a few
days to see if there are more comments and will push otherwise.
___
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 v9 3/5] avformat/rcwtenc: remove repeated documentation

2024-03-26 Thread Stefano Sabatini
On date Saturday 2024-03-23 21:25:02 -0500, Marth64 wrote:
> The high level summary of RCWT can be delegated doc/muxers, which
> makes it easier to maintain and more consistent with the documentation
> of the demuxer.
> 
> Signed-off-by: Marth64 
> ---
>  libavformat/rcwtenc.c | 5 -
>  1 file changed, 5 deletions(-)
> 
> diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
> index f2459ef1d3..e06bc4b734 100644
> --- a/libavformat/rcwtenc.c
> +++ b/libavformat/rcwtenc.c
> @@ -21,11 +21,6 @@
>  /*
>   * RCWT (Raw Captions With Time) is a format native to ccextractor, a 
> commonly
>   * used open source tool for processing 608/708 Closed Captions (CC) sources.
> - * It can be used to archive the original, raw CC bitstream and to produce
> - * a source file for later CC processing or conversion. As a result,
> - * it also allows for interopability with ccextractor for processing CC data
> - * extracted via ffmpeg. The format is simple to parse and can be used
> - * to retain all lines and variants of CC.
>   *
>   * This muxer implements the specification as of March 2024, which has
>   * been stable and unchanged since April 2014.
> -- 
> 2.34.1

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

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


Re: [FFmpeg-devel] [PATCH v9 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-26 Thread Stefano Sabatini
On date Saturday 2024-03-23 21:25:01 -0500, Marth64 wrote:
> RCWT (Raw Captions With Time) is a format native to ccextractor,
> a commonly used OSS tool for processing 608/708 Closed Captions (CC).
> RCWT can be used to archive the original extracted CC bitstream.
> The muxer was added in January 2024. In this commit, add the demuxer.
> 
> One can now demux RCWT files for rendering in ccaption_dec or interop
> with ccextractor (which produces RCWT). Using the muxer/demuxer combo,
> the CC bits can be kept for processing or rendering with either tool.
> This can be an effective way to backup an original CC stream, including
> format extensions like EIA-708 and overall original presentation.
> 
> Signed-off-by: Marth64 
> ---
>  Changelog|   2 +-
>  doc/demuxers.texi|  30 ++
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/rcwtdec.c| 123 +++
>  5 files changed, 156 insertions(+), 1 deletion(-)
>  create mode 100644 libavformat/rcwtdec.c
> 
> diff --git a/Changelog b/Changelog
> index 934241a965..4587d0d511 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -19,7 +19,7 @@ version :
>  - lavu/eval: introduce randomi() function in expressions
>  - VVC decoder
>  - fsync filter
> -- Raw Captions with Time (RCWT) closed caption muxer
> +- RCWT (Raw Captions with Time) Closed Captions muxer and demuxer
>  - ffmpeg CLI -bsf option may now be used for input as well as output
>  - ffmpeg CLI options may now be used as -/opt , which is equivalent
>to -opt >
> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> index b70f3a38d7..04293c4813 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -1038,6 +1038,36 @@ the command:
>  ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
> input.raw
>  @end example
>  
> +@anchor{rcwtdec}
> +@section rcwt
> +
> +RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
> +used open source tool for processing 608/708 Closed Captions (CC) sources.
> +For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
> +
> +This demuxer implements the specification as of March 2024, which has
> +been stable and unchanged since April 2014.
> +
> +@subsection Examples
> +
> +@itemize
> +@item
> +Render CC to ASS using the built-in decoder:
> +@example
> +ffmpeg -i CC.rcwt.bin CC.ass
> +@end example
> +Note that if your output appears to be empty, you may have to manually
> +set the decoder's @option{data_field} option to pick the desired CC 
> substream.

this options is for the cc_dec decoder, while this is assuming EIA_608,
am I confused?

> +
> +@item
> +Convert an RCWT backup to Scenarist (SCC) format:
> +@example
> +ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
> +@end example
> +Note that the SCC format does not support all of the possible CC extensions
> +that can be stored in RCWT (such as EIA-708).
> +@end itemize
> +
>  @section sbg
>  
[...]

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

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


Re: [FFmpeg-devel] [PATCH v2] doc: Add libtoch backend option to dnn_processing

2024-03-26 Thread Leo Izen

On 3/25/24 07:16, Guo, Yejun wrote:




-Original Message-
From: ffmpeg-devel  On Behalf Of
wenbin.chen-at-intel@ffmpeg.org
Sent: Monday, March 25, 2024 10:15 AM
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v2] doc: Add libtoch backend option to
dnn_processing


Typo in commit message, you want libtorch, not libtoch.

- Leo Izen (Traneptora)

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

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


Re: [FFmpeg-devel] [PATCH v4 0/4] Fix some active sequences in subtitles

2024-03-26 Thread Marth64
Ping on this set authored by Oneric as well.
___
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] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-26 Thread Marth64
Was already applied. Thanks Stefano and Leo!
___
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] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-26 Thread Stefano Sabatini
On date Monday 2024-03-25 16:21:02 -0500, Marth64 wrote:
> Since log statements printing int64 were made portable in
> 4464b7eeb194e98ac115f18d2b6be67361407c8a, let us include
> inttypes.h explicitly (as it is unclear where PRId64 and
> such are coming from now).
> 
> Reported-by: Traneptora
> Signed-off-by: Marth64 
> ---
>  libavformat/dvdvideodec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
> index 761ac97ec6..4959edab5c 100644
> --- a/libavformat/dvdvideodec.c
> +++ b/libavformat/dvdvideodec.c
> @@ -30,6 +30,8 @@
>   * 7) Close the dvdnav VM, and free dvdread's IFO structures
>   */
>  
> +#include 
> +
>  #include 
>  #include 
>  #include 
> -- 
> 2.34.1

LGTM, will apply.
___
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 v9 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-03-26 Thread Marth64
> is the move needed? (but not blocking)
It is not needed, but the code flows better I think in terms of
readability. I think it feels cleaner to say, "set up `sub` then add it to
the array" vs. "set up sub's data, add it to the array, then set up its
other fields". But, I am good either way and on stand by if you request me
to change it.

Thank you for the review.
___
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 v9 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-03-26 Thread Stefano Sabatini
On date Saturday 2024-03-23 21:25:00 -0500, Marth64 wrote:
> If ff_subtitles_queue_insert() were given a NULL buffer
> with 0 length, it would still attempt to grow the packet
> or memcpy depending on if merge option is enabled.
> 
> In this commit, allow passing a NULL buffer with 0 length
> without attempting to do such operations. This way, if a
> subtitle demuxer happens to pass an empty cue or wants to
> use av_get_packet() to read bytes, there are no unnecessary
> operations on the packet after it is allocated.
> 
> Signed-off-by: Marth64 
> ---
>  libavformat/subtitles.c | 24 
>  libavformat/subtitles.h |  2 +-
>  2 files changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
> index 3413763c7b..4742ca0667 100644
> --- a/libavformat/subtitles.c
> +++ b/libavformat/subtitles.c
> @@ -21,6 +21,7 @@
>  #include "avformat.h"
>  #include "subtitles.h"
>  #include "avio_internal.h"
> +#include "libavutil/avassert.h"
>  #include "libavutil/avstring.h"
>  
>  void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
> @@ -111,15 +112,20 @@ AVPacket 
> *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
>  {
>  AVPacket **subs, *sub;
>  
> +if (!event)
> +av_assert1(len == 0);
> +
>  if (merge && q->nb_subs > 0) {
>  /* merge with previous event */
>  
>  int old_len;
>  sub = q->subs[q->nb_subs - 1];
>  old_len = sub->size;
> -if (av_grow_packet(sub, len) < 0)
> -return NULL;
> -memcpy(sub->data + old_len, event, len);
> +if (event) {
> +if (av_grow_packet(sub, len) < 0)
> +return NULL;
> +memcpy(sub->data + old_len, event, len);
> +}
>  } else {
>  /* new event */
>  
> @@ -133,14 +139,16 @@ AVPacket 
> *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
>  sub = av_packet_alloc();
>  if (!sub)
>  return NULL;
> -if (av_new_packet(sub, len) < 0) {
> -av_packet_free();
> -return NULL;
> +if (event) {
> +if (av_new_packet(sub, len) < 0) {
> +av_packet_free();
> +return NULL;
> +}
> +memcpy(sub->data, event, len);
>  }

> -subs[q->nb_subs++] = sub;
>  sub->flags |= AV_PKT_FLAG_KEY;
>  sub->pts = sub->dts = 0;
> -memcpy(sub->data, event, len);

> +subs[q->nb_subs++] = sub;

is the move needed? (but not blocking)

LGTM otherwise.
___
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] Changelog: add Android content URIs protocol entry

2024-03-26 Thread Stefano Sabatini
On date Monday 2024-03-25 09:14:15 +0100, Matthieu Bouron wrote:
> ---
>  Changelog | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Changelog b/Changelog
> index 934241a965..e4373ff991 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -37,6 +37,7 @@ version :
>  - Support PacketTypeMetadata of PacketType in enhanced flv format
>  - ffplay with hwaccel decoding support (depends on vulkan renderer via 
> libplacebo)
>  - dnn filter libtorch backend
> +- Android content URIs protocol

Obviously LGTM.

BTW it would be good to document it in doc/protocols.texi.
___
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 v9 0/5] RCWT Closed Captions demuxer (v9)

2024-03-26 Thread Marth64
Ping if possible. The patches still apply. 3 of the 5 patches are
documentation only and the demuxer itself is much smaller now. The muxer
already made it in, so was hoping the demuxer could go too :fingers_crossed:
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 1/1] avcodec/h264_parser: fix start of packet for some broken streams

2024-03-26 Thread Nicolas Gaullier
---
 libavcodec/h264_parser.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 94cfbc481e..6b721ec253 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -124,7 +124,16 @@ static int h264_find_frame_end(H264ParseContext *p, const 
uint8_t *buf,
 if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS ||
 nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) {
 if (pc->frame_start_found) {
-i++;
+/* Some streams in the wild are missing the zero_byte at 
the NAL_AUD:
+ * it is following just afterwards.
+ * To avoid any accidental borrowing of a byte in the 
previous frame
+ * (which would return a negative index and indicate that 
fetch_timestamps
+ * has to get the pts from the previous frame),
+ * better have the start of packet strictly aligned.
+ * To make it a more general rule, just test the following 
three bytes are null.
+ */
+i += 1 + (!p->is_avc && state == 5 && i == 3 && nalu_type 
== H264_NAL_AUD &&
+buf_size >= 9 && !AV_RB24(buf + 5));
 goto found;
 }
 } else if (nalu_type == H264_NAL_SLICE || nalu_type == 
H264_NAL_DPA ||
-- 
2.30.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".


[FFmpeg-devel] [PATCH 0/1] avcodec/h264_parser: fix start of packet for some broken

2024-03-26 Thread Nicolas Gaullier
This is a patch from my patch serie 
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10999
Maybe it is easier to review it this way, independantly.
This patch shows some benefits by itself, but most importantly, it is required 
for my patch serie to avoid any regression with some invalid streams.

This patch is active in mpegts/h264 when the NAL Access Unit Delimiter is 
missing the zero_byte (= a invalid stream case).
In such a case, if it happens that the last data byte from the previous frame 
is a null byte, this byte is "kidnaped" to form the full NAL_AUD...
This is not good, but even worser, with my patch serie above applied, it means 
that the start of the editunit is in the previous frame,
which means the pts has to be taken in it, which is not the expected behaviour 
in such a missleading scenario.

Michael sent me a sample from the wild but it can't be shared, so here it is:
I have another sample of my own with NAL_AUD missing zero_byte similarly, but 
it is missing the ending null byte,
so I have patched/inserted the null byte (I shrinked the adaptation field) to 
show how the code behave.

Sample original (invalid NAL_AUDs):
https://0x0.st/Xs9Q.ts
Same sample modified to exhibit the issue (invalid NAL_AUDs + an available null 
ending byte at 0x291F):
https://0x0.st/Xs9j.ts

I use this simple command line and then compare the xml, it seems quite clear:
ffprobe xxx.ts -show_packets -show_data -print_format xml

Nicolas Gaullier (1):
  avcodec/h264_parser: fix start of packet for some broken streams

 libavcodec/h264_parser.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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


[FFmpeg-devel] [PATCH] avcodec: Allow enabling DTX in libopusenc

2024-03-26 Thread Paul Adenot
From: Paul Adenot 

---
 doc/encoders.texi   | 4 
 libavcodec/libopusenc.c | 9 +
 2 files changed, 13 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..d459b2865f 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1000,6 +1000,10 @@ Other values include 0 for mono and stereo, 1 for 
surround sound with masking
 and LFE bandwidth optimizations, and 255 for independent streams with an
 unspecified channel layout.
 
+@item dtx (N.A.)
+Allow discontinuous transmission when set to 1. The default value is 0
+(disabled).
+
 @item apply_phase_inv (N.A.) (requires libopus >= 1.2)
 If set to 0, disables the use of phase inversion for intensity stereo,
 improving the quality of mono downmixes, but slightly reducing normal stereo
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index af25f27f74..e727448cdd 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -42,6 +42,7 @@ typedef struct LibopusEncOpts {
 int packet_size;
 int max_bandwidth;
 int mapping_family;
+int dtx;
 #ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
 int apply_phase_inv;
 #endif
@@ -159,6 +160,13 @@ static int libopus_configure_encoder(AVCodecContext 
*avctx, OpusMSEncoder *enc,
"Unable to set inband FEC: %s\n",
opus_strerror(ret));
 
+ret = opus_multistream_encoder_ctl(enc,
+   OPUS_SET_DTX(opts->dtx));
+if (ret != OPUS_OK)
+av_log(avctx, AV_LOG_WARNING,
+   "Unable to set DTX: %s\n",
+   opus_strerror(ret));
+
 if (avctx->cutoff) {
 ret = opus_multistream_encoder_ctl(enc,

OPUS_SET_MAX_BANDWIDTH(opts->max_bandwidth));
@@ -556,6 +564,7 @@ static const AVOption libopus_options[] = {
 { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { 
.i64 = 1 }, 0, 0, FLAGS, .unit = "vbr" },
 { "constrained","Use constrained VBR",   0, AV_OPT_TYPE_CONST, { 
.i64 = 2 }, 0, 0, FLAGS, .unit = "vbr" },
 { "mapping_family", "Channel Mapping Family",  
OFFSET(mapping_family), AV_OPT_TYPE_INT,   { .i64 = -1 },   -1,  255,  FLAGS, 
.unit = "mapping_family" },
+{ "dtx", "Enable DTX (Discontinuous transmission)", OFFSET(dtx), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 #ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
 { "apply_phase_inv", "Apply intensity stereo phase inversion", 
OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
 #endif
-- 
2.40.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 v4 1/1] avformat/mpegts: Add duration_probesize AVOption

2024-03-26 Thread Nicolas Gaullier
Yet another probesize option aimed at users interested
in better durations probing for itself, or because using
avformat_find_stream_info indirectly and requiring exact values: for
concatdec for example, especially if streamcopying above it.
The current code is a performance trade-off that can fail to get video
stream durations in a scenario with high bitrates and buffering for
files ending cleanly (as opposed to live captures): the physical gap
between the last video packet and the last audio packet is very high in
such a case.

Default behaviour is unchanged: 250k up to 250k << 6 (step by step).
Setting this new option has two effects:
- override the maximum probesize (currently 250k << 6)
- reduce the number of steps to 1 instead of 6, this is to avoid
detecting the audio "too early" and failing to reach a video packet.
Even if a single audio stream duration is found but not the other
audio/video stream durations, there will be a retry, so at the end the
full user-overriden probesize will be used as expected by the user.

Signed-off-by: Nicolas Gaullier 
---
 doc/demuxers.texi |  13 +
 doc/formats.texi  |   2 +-
 libavformat/demux.c   |  23 ++---
 libavformat/mpegts.c  | 104 +---
 libavformat/mpegts.h  | 108 +-
 libavformat/version.h |   2 +-
 6 files changed, 140 insertions(+), 112 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..f88ae18a6e 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -992,6 +992,19 @@ streams move to different PIDs. Default value is 0.
 @item max_packet_size
 Set maximum size, in bytes, of packet emitted by the demuxer. Payloads above 
this size
 are split across multiple packets. Range is 1 to INT_MAX/2. Default is 204800 
bytes.
+
+@item duration_probesize
+Set probing size, in bytes, for input duration estimation which requires a 
specific probing
+for PTS at end of file.
+It is aimed at users interested in better durations probing for itself, or 
indirectly
+for specific use cases like using the concat demuxer.
+Files with high bitrates and ending cleanly (as opposed to live captures), can 
lead
+to a large physical gap between the last video packet and the last audio 
packet,
+so many bytes have to be read in order to get a video stream duration.
+Setting this value has a performance impact even for small files because the 
probing size is fixed.
+Default behaviour is a trade-off, largely adaptive: the probing size may range 
from
+25 up to 16M, but it is not extended to get streams durations at all costs.
+Must be an integer not lesser than 1, or 0 for default behaviour.
 @end table
 
 @section mpjpeg
diff --git a/doc/formats.texi b/doc/formats.texi
index 69fc1457a4..e16cd88b2c 100644
--- a/doc/formats.texi
+++ b/doc/formats.texi
@@ -225,7 +225,7 @@ Specifies the maximum number of streams. This can be used 
to reject files that
 would require too many resources due to a large number of streams.
 
 @item skip_estimate_duration_from_pts @var{bool} (@emph{input})
-Skip estimation of input duration when calculated using PTS.
+Skip estimation of input duration if it requires an additional probing for pts 
at end of file.
 At present, applicable for MPEG-PS and MPEG-TS.
 
 @item strict, f_strict @var{integer} (@emph{input/output})
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 147f3b93ac..bc23786410 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -47,6 +47,7 @@
 #include "id3v2.h"
 #include "internal.h"
 #include "url.h"
+#include "mpegts.h"
 
 static int64_t wrap_timestamp(const AVStream *st, int64_t timestamp)
 {
@@ -1803,20 +1804,30 @@ static void 
estimate_timings_from_bit_rate(AVFormatContext *ic)
"Estimating duration from bitrate, this may be inaccurate\n");
 }
 
-#define DURATION_MAX_READ_SIZE 25LL
-#define DURATION_MAX_RETRY 6
+#define DURATION_DEFAULT_MAX_READ_SIZE 25LL
+#define DURATION_DEFAULT_MAX_RETRY 6
 
-/* only usable for MPEG-PS streams */
+/* only usable for MPEG-PS/TS streams */
 static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
 {
 FFFormatContext *const si = ffformatcontext(ic);
 AVPacket *const pkt = si->pkt;
 int num, den, read_size, ret;
+int64_t duration_max_read_size = DURATION_DEFAULT_MAX_READ_SIZE;
+int duration_max_retry = DURATION_DEFAULT_MAX_RETRY;
 int found_duration = 0;
 int is_end;
 int64_t filesize, offset, duration;
 int retry = 0;
 
+if (!strcmp(ic->iformat->name, "mpegts")) {
+MpegTSContext *ts = ic->priv_data;
+if (ts->duration_probesize) {
+duration_max_retry = 1;
+duration_max_read_size = ts->duration_probesize >> 
duration_max_retry;
+}
+}
+
 /* flush packet queue */
 ff_flush_packet_queue(ic);
 
@@ -1847,7 +1858,7 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 filesize = ic->pb ? 

[FFmpeg-devel] [PATCH v4 0/1] avformat/mpegts: Add duration_probesize AVOption

2024-03-26 Thread Nicolas Gaullier
Thanks to Stefano for the precise inspection, I addressed all the points.

The question about what is specific to mpeg remains, so I will try to elaborate 
on this.
I don't see how duration_probesize could be needed in any way beyond 
estimate_timings_from_pts().
And it seems there is no other headerless format like mpeg's, byte seekable but 
especially dts-muxed, cbr-stuffinged with, potentially, a high I/O physical 
audio/video delay - or not.
It seems the probing of mpeg streams is very specific currently and I don't 
think this situation will change in the future.
Take mp4 kind formats: strictly index-based, and even for a truncated file 
(with moov at the head), no I/O is required to get the actual truncated stream 
durations.
Take mxf kind formats that can be streamed, or simply truncated/broken: the 
editunits are quite consistent, carrying both audio, so recovering the 
duration would not be very tricky.

This v4 is "an experimental try" to lift the AVOption in the demuxer (which 
mean no API change). The problem is that it makes the AVOption belong to 
mpegts.c (I will focus on mpegts, I think it is the only real use case) but 
unused by it, so I don't feel it is acceptable?
Any input welcome.

Nicolas Gaullier (1):
  avformat/mpegts: Add duration_probesize AVOption

 doc/demuxers.texi |  13 +
 doc/formats.texi  |   2 +-
 libavformat/demux.c   |  23 ++---
 libavformat/mpegts.c  | 104 +---
 libavformat/mpegts.h  | 108 +-
 libavformat/version.h |   2 +-
 6 files changed, 140 insertions(+), 112 deletions(-)

-- 
2.30.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 v1] avcodec/cbs_vp8: Use little endian in fixed()

2024-03-26 Thread Ronald S. Bultje
Hi,

On Wed, Jan 24, 2024 at 7:54 PM Dai, Jianhui J <
jianhui.j.dai-at-intel@ffmpeg.org> wrote:

> This commit adds value range checks to cbs_vp8_read_unsigned_le,
> migrates fixed() to use it, and enforces little-endian consistency for
> all read methods.
>
> Signed-off-by: Jianhui Dai 
> ---
>  libavcodec/cbs_vp8.c | 23 +--
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c
> index 065156c248..7a0752019b 100644
> --- a/libavcodec/cbs_vp8.c
> +++ b/libavcodec/cbs_vp8.c
> @@ -181,9 +181,11 @@ static int cbs_vp8_bool_decoder_read_signed(
>  return 0;
>  }
>
> -static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx,
> GetBitContext *gbc,
> - int width, const char *name,
> - const int *subscripts, uint32_t
> *write_to)
> +static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx,
> +GetBitContext *gbc, int width,
> +const char *name, const int
> *subscripts,
> +uint32_t *write_to, uint32_t
> range_min,
> +uint32_t range_max)
>  {
>  int32_t value;
>
> @@ -200,6 +202,14 @@ static int
> cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
>
>  CBS_TRACE_READ_END();
>
> +if (value < range_min || value > range_max) {
> +av_log(ctx->log_ctx, AV_LOG_ERROR,
> +   "%s out of range: "
> +   "%" PRIu32 ", but must be in [%" PRIu32 ",%" PRIu32 "].\n",
> +   name, value, range_min, range_max);
> +return AVERROR_INVALIDDATA;
> +}
> +
>  *write_to = value;
>  return 0;
>  }
> @@ -246,15 +256,16 @@ static int
> cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
>  do { \
>  uint32_t value; \
>  CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, \
> -SUBSCRIPTS(subs, __VA_ARGS__),
> )); \
> +   SUBSCRIPTS(subs, __VA_ARGS__),
> , \
> +   0, MAX_UINT_BITS(width))); \
>  current->name = value; \
>  } while (0)
>
>  #define fixed(width, name, value) \
>  do { \
>  uint32_t fixed_value; \
> -CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, 0,
> _value, \
> -   value, value)); \
> +CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, 0,
> _value, \
> +   value, value)); \
>  } while (0)
>
>  #define bc_unsigned_subs(width, prob, enable_trace, name, subs, ...) \
> --
> 2.25.1
>

Merged.

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/cbs_vp8: Improve the bitstream position check

2024-03-26 Thread Ronald S. Bultje
Hi,

On Tue, Mar 19, 2024 at 2:05 AM Dai, Jianhui J <
jianhui.j.dai-at-intel@ffmpeg.org> wrote:

> The VP8 compressed header may not be byte-aligned due to boolean
> coding. Round up byte count for accurate data positioning.
>
> Signed-off-by: Jianhui Dai 
> ---
>  libavcodec/cbs_vp8.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c
> index 1f7e81cfe6..bb441b7187 100644
> --- a/libavcodec/cbs_vp8.c
> +++ b/libavcodec/cbs_vp8.c
> @@ -328,7 +328,9 @@ static int cbs_vp8_read_unit(CodedBitstreamContext
> *ctx,
>  return err;
>
>  pos = get_bits_count();
> -pos /= 8;
> +// Position may not be byte-aligned after compressed header; Round up
> byte
> +// count for accurate data positioning.
> +pos = (pos + 7) / 8;
>  av_assert0(pos <= unit->data_size);
>
>  frame->data_ref = av_buffer_ref(unit->data_ref);
> --
> 2.34.1
>

Merged.

Ronald
___
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] avformat: enable UDP IPv6 multicast interface selection using zone index

2024-03-26 Thread RS
avformat: enable UDP IPv6 multicast interface selection using zone index

Enabled IPv6 interface selection using zone index. Properly resolved
interface index in places where default 0 interface index is used
(marked with TODO: within udp.c). Adjusted binding for multicast sockets
that are used for reading from the network.

For mcast addresses, bind to mcast address is attempted as before.
In case that this fails, which will happen on Windows, socket is bound
to INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual
interface selection is performed using udp_set_multicast_interface to
point to the desired interface for sending.

IPv6 interfaces are resolved based on sin6_scope_id field, while IPv4
interface resolution is performed based on address.

Closes: #368

Signed-off-by: Lazar Ignjatovic 
---
NOTE: Due to comments, this patch is proposed as one of two alternatives
The other alternative uses `localaddr` for defining interfaces.

 configure |  3 ++
 doc/protocols.texi|  2 +-
 libavformat/ip.c  | 48 
 libavformat/ip.h  |  6 +++
 libavformat/network.h |  6 +++
 libavformat/udp.c | 87 ++-
 6 files changed, 142 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 2a1d22310b..35d6a0b78c 100755
--- a/configure
+++ b/configure
@@ -2307,6 +2307,7 @@ HEADERS_LIST="
 valgrind_valgrind_h
 windows_h
 winsock2_h
+iphlpapi_h
 "

 INTRINSICS_LIST="
@@ -6475,6 +6476,8 @@ if ! disabled network; then
 check_struct winsock2.h "struct sockaddr" sa_len
 check_type ws2tcpip.h "struct sockaddr_in6"
 check_type ws2tcpip.h "struct sockaddr_storage"
+check_headers iphlpapi.h -liphlpapi && 
network_extralibs="$network_extralibs -liphlpapi" || disable iphlpapi_h
+check_func_headers iphlpapi.h GetBestInterfaceEx $network_extralibs
 else
 disable network
 fi
diff --git a/doc/protocols.texi b/doc/protocols.texi
index f54600b846..a8892845d3 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -2027,7 +2027,7 @@ packet bursts.
 Override the local UDP port to bind with.

 @item localaddr=@var{addr}
-Local IP address of a network interface used for sending packets or joining
+Local IPv4 address of a network interface used for sending packets or joining
 multicast groups.

 @item pkt_size=@var{size}
diff --git a/libavformat/ip.c b/libavformat/ip.c
index b2c7ef07e5..dc488b12c2 100644
--- a/libavformat/ip.c
+++ b/libavformat/ip.c
@@ -18,6 +18,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

+#define _DEFAULT_SOURCE
+#define _SVID_SOURCE
+
 #include 
 #include "ip.h"
 #include "libavutil/avstring.h"
@@ -159,3 +162,48 @@ void ff_ip_reset_filters(IPSourceFilters *filters)
 filters->nb_include_addrs = 0;
 filters->nb_exclude_addrs = 0;
 }
+
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage *local_addr)
+{
+#if HAVE_WINSOCK2_H
+#if HAVE_IPHLPAPI_H
+DWORD retval;
+unsigned long iface;
+
+if (local_addr == NULL)
+return 0;
+
+retval = GetBestInterfaceEx((struct sockaddr*)local_addr, );
+if (retval == NO_ERROR)
+return iface;
+#endif /* HAVE_IPHLPAPI_H */
+return 0;
+#else /* HAVE_WINSOCK2_H */
+struct ifaddrs *ifaddr, *ifa;
+unsigned int iface;
+
+if (local_addr == NULL)
+return 0;
+
+#if HAVE_STRUCT_SOCKADDR_IN6
+if (local_addr->ss_family == AF_INET6) {
+iface = ((struct sockaddr_in6*)local_addr)->sin6_scope_id;
+if (iface)
+return iface;
+}
+#endif /* HAVE_STRUCT_SOCKADDR_IN6 */
+if (getifaddrs() == -1)
+return 0;
+
+iface = 0;
+for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+if (ifa->ifa_addr != NULL && compare_addr((struct 
sockaddr_storage*)ifa->ifa_addr, local_addr) == 0) {
+iface = if_nametoindex(ifa->ifa_name);
+break;
+}
+}
+
+freeifaddrs(ifaddr);
+return iface;
+#endif /* HAVE_WINSOCK2_H */
+}
\ No newline at end of file
diff --git a/libavformat/ip.h b/libavformat/ip.h
index b76cdab91c..4085e96f08 100644
--- a/libavformat/ip.h
+++ b/libavformat/ip.h
@@ -69,4 +69,10 @@ int ff_ip_parse_blocks(void *log_ctx, const char *buf, 
IPSourceFilters *filters)
  */
 void ff_ip_reset_filters(IPSourceFilters *filters);

+/**
+ * Resolves IP address to an associated interface index
+ * @return interface index, 0 as default interface value on error
+ */
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage 
*local_addr);
+
 #endif /* AVFORMAT_IP_H */
diff --git a/libavformat/network.h b/libavformat/network.h
index ca214087fc..2461b651d4 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -38,6 +38,10 @@
 #include 
 #include 

+#if HAVE_IPHLPAPI_H
+#include 
+#endif
+
 #ifndef EPROTONOSUPPORT
 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
 #endif
@@ -64,6 +68,8 @@ int ff_neterrno(void);
 #include 
 #include 

[FFmpeg-devel] [PATCH v3] avformat: enable UDP IPv6 multicast interface selection using localaddr

2024-03-26 Thread RS
avformat: enable UDP IPv6 multicast interface selection using localaddr

localaddr option now properly works with IPv6 addresses. Properly
resolved interface index in places where default 0 interface index is
used (marked with TODO: within udp.c). Adjusted binding for multicast
sockets that are used for reading from the network. Need for this
arises from the fact that link-local multicast addresses need to have a
defined interface for binding to avoid ambiguity between multiple
link-local networks on the same host. Failing to set this option causes
errors on Linux systems for interface and link-local scopes.

For mcast addresses, bind to mcast address is attempted as before.
In case that this fails, which will happen on Windows, socket is bound
to INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual
interface selection is performed using udp_set_multicast_interface to
point to the desired interface for sending.

Utilization of sin6_scope_id field enables usage and adequate resolving
of IPv6 addresses that utilize zone index (e.g. fe80::1%eth2)

Closes: #368

Signed-off-by: Lazar Ignjatovic 
---
V1 -> V2: SO_BINDTODEVICE -> sin6_scope_id, addressed comments
V2 -> V3: mcast check sin6_scope_id for iface specification
NOTE: Due to comments, this patch is proposed as one of two alternatives
The other alternative uses exclusively %scope format for defining
interfaces. This patch can handle scoped IPv6 link-local addresses


 configure |  3 ++
 libavformat/ip.c  | 48 
 libavformat/ip.h  |  6 +++
 libavformat/network.h |  6 +++
 libavformat/udp.c | 85 +++
 5 files changed, 140 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index e019d1b996..08f35bbd25 100755
--- a/configure
+++ b/configure
@@ -2258,6 +2258,7 @@ HEADERS_LIST="
 valgrind_valgrind_h
 windows_h
 winsock2_h
+iphlpapi_h
 "

 INTRINSICS_LIST="
@@ -6406,6 +6407,8 @@ if ! disabled network; then
 check_struct winsock2.h "struct sockaddr" sa_len
 check_type ws2tcpip.h "struct sockaddr_in6"
 check_type ws2tcpip.h "struct sockaddr_storage"
+check_headers iphlpapi.h -liphlpapi && 
network_extralibs="$network_extralibs -liphlpapi" || disable iphlpapi_h
+check_func_headers iphlpapi.h GetBestInterfaceEx $network_extralibs
 else
 disable network
 fi
diff --git a/libavformat/ip.c b/libavformat/ip.c
index b2c7ef07e5..821595edc5 100644
--- a/libavformat/ip.c
+++ b/libavformat/ip.c
@@ -18,6 +18,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

+#define _DEFAULT_SOURCE
+#define _SVID_SOURCE
+
 #include 
 #include "ip.h"
 #include "libavutil/avstring.h"
@@ -159,3 +162,48 @@ void ff_ip_reset_filters(IPSourceFilters *filters)
 filters->nb_include_addrs = 0;
 filters->nb_exclude_addrs = 0;
 }
+
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage *local_addr)
+{
+#if HAVE_WINSOCK2_H
+#if HAVE_IPHLPAPI_H
+DWORD retval;
+unsigned long iface;
+
+if (local_addr == NULL)
+return 0;
+
+retval = GetBestInterfaceEx((struct sockaddr*)local_addr, );
+if (retval == NO_ERROR)
+return iface;
+#endif /* HAVE_IPHLPAPI_H */
+return 0;
+#else /* HAVE_WINSOCK2_H */
+struct ifaddrs *ifaddr, *ifa;
+unsigned int iface;
+
+if (local_addr == NULL)
+return 0;
+
+#if HAVE_STRUCT_SOCKADDR_IN6
+if (local_addr->ss_family == AF_INET6) {
+iface = ((struct sockaddr_in6*)local_addr)->sin6_scope_id;
+if (iface)
+return iface;
+}
+#endif /* HAVE_STRUCT_SOCKADDR_IN6 */
+if (getifaddrs() == -1)
+return 0;
+
+iface = 0;
+for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+if (ifa->ifa_addr != NULL && compare_addr((struct 
sockaddr_storage*)ifa->ifa_addr, local_addr) == 0) {
+iface = if_nametoindex(ifa->ifa_name);
+break;
+}
+}
+
+freeifaddrs(ifaddr);
+return iface;
+#endif /* HAVE_WINSOCK2_H */
+}
diff --git a/libavformat/ip.h b/libavformat/ip.h
index b76cdab91c..4085e96f08 100644
--- a/libavformat/ip.h
+++ b/libavformat/ip.h
@@ -69,4 +69,10 @@ int ff_ip_parse_blocks(void *log_ctx, const char *buf, 
IPSourceFilters *filters)
  */
 void ff_ip_reset_filters(IPSourceFilters *filters);

+/**
+ * Resolves IP address to an associated interface index
+ * @return interface index, 0 as default interface value on error
+ */
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage 
*local_addr);
+
 #endif /* AVFORMAT_IP_H */
diff --git a/libavformat/network.h b/libavformat/network.h
index ca214087fc..2461b651d4 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -38,6 +38,10 @@
 #include 
 #include 

+#if HAVE_IPHLPAPI_H
+#include 
+#endif
+
 #ifndef EPROTONOSUPPORT
 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
 #endif
@@ -64,6 +68,8 @@ int ff_neterrno(void);
 #include 
 #include 
 #include 

Re: [FFmpeg-devel] [PATCH] tests/audiogen: Fix total RIFF chunk size

2024-03-26 Thread Tobias Rapp

On 15/03/2024 09:53, Tobias Rapp wrote:


The "RIFF" identifier and chunk size fields should not be included
within the size value.
---
  tests/audiogen.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/audiogen.c b/tests/audiogen.c
index c43bb70..df1dea6 100644
--- a/tests/audiogen.c
+++ b/tests/audiogen.c
@@ -109,7 +109,7 @@ static void put32(uint32_t v)
  fputc((v >> 24) & 0xff, outfile);
  }
  
-#define HEADER_SIZE  46

+#define HEADER_SIZE  38
  #define FMT_SIZE 18
  #define SAMPLE_SIZE   2
  #define WFORMAT_PCM  0x0001


Will apply in two days if there are no objections.

Regards, Tobias
___
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] Remove struct named initializer from aac profile option.

2024-03-26 Thread Hendrik Leppkes
On Tue, Mar 26, 2024 at 9:42 AM Muiz Yusuff  wrote:
>
> From: Muiz 
>
> All fields of the stuct use unnamed struct initialization.
> Also omit the field name for `AVOption::unit` to maintain consistency.

"unit" intentionally uses designated initializers, so that adding new
fields before it is more robust and less prone to errors.

See 1e7d2007c3aca1cc1cd3b1ca409f4ded6c885f86

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

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


[FFmpeg-devel] [PATCH] Remove struct named initializer from aac profile option.

2024-03-26 Thread Muiz Yusuff
From: Muiz 

All fields of the stuct use unnamed struct initialization.
Also omit the field name for `AVOption::unit` to maintain consistency.
---
 libavcodec/profiles.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index ffc8710ef2..270430a48b 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -23,7 +23,7 @@
 #include "libavutil/opt.h"
 
 #define FF_AVCTX_PROFILE_OPTION(name, description, type, value) \
-{name, description, 0, AV_OPT_TYPE_CONST, {.i64 = value }, INT_MIN, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_## type ##_PARAM, .unit = 
"avctx.profile"},
+{name, description, 0, AV_OPT_TYPE_CONST, {.i64 = value }, INT_MIN, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_## type ##_PARAM, 
"avctx.profile"},
 
 #define FF_AAC_PROFILE_OPTS \
 FF_AVCTX_PROFILE_OPTION("aac_main",  NULL, AUDIO, AV_PROFILE_AAC_MAIN)\
-- 
2.34.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] [RFC] clarifying the TC conflict of interest rule

2024-03-26 Thread Anton Khirnov
The vote has been started, with the voter list generated by
general_assembly.pl:
# GA for 2021-01-01T00:00:00/2024-01-01T00:00:00; 50 people; 
SHA256:e63c3589d48557b90767f581eb1372c6c883ab87395dade38c61d0db0771fabd; 
HEAD:f872b1971401817356708b8863dff4ee6bd02600

If you are in the GA and have not received an email by the end of the
day, please let me know.

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


Re: [FFmpeg-devel] [PATCH] tests: Remove fate-libx265-hdr10

2024-03-26 Thread Anton Khirnov
Quoting Zhao Zhili (2024-03-26 03:30:21)
> Ping. Is it OK to apply the patch as it is?

Fine with me.

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


Re: [FFmpeg-devel] [PATCH 00/21] aarch64: hevc: Add missing hevc_pel NEON functions

2024-03-26 Thread Martin Storsjö

On Tue, 26 Mar 2024, Jean-Baptiste Kempf wrote:


On Mon, 25 Mar 2024, at 22:56, J. Dekker wrote:

On Mon, 25 Mar 2024, Martin Storsjö wrote:


Since some time, we have pretty complete AArch64 NEON coverage
for the hevc decoder.

However, some of these functions require the I8MM instruction set
extension, and many of them (but not all) lack a plain NEON
version.

This patchset fills in a regular NEON version of all functions
where we have an I8MM function.

For context; the I8MM instruction set extension is a mandatory
part of armv8.6-a. E.g. Apple M2, AWS Graviton 3 have it,
but Apple M1 and Ampere Altra don't.

This patchset takes decoding of a 1080p HEVC clip from 402
fps to 649 fps on an Apple M1.

Patch #2 also fixes a subtle bug in the existing implementation;
two functions relied on the contents on the stack, below the
stack pointer, being untouched within a function. If a signal
gets delivered, those parts of the stack could be clobbered.


I know this is a bit short notice for a patchset of this size - but, would 
people be OK with merging this patchset before the impending 7.0 branch (which 
is made within the next 24h)?

The patches pass all my tricky build configurations, they give a very 
non-negligible speedup on many common CPUs, and patch #2 fixes a real bug in 
the existing impleemntations. (A bug fix patch can of course be backported 
after the branch too, but performance optimizations aren't generally relevant 
for backporting.)

// Martin


Yes, please. I will tomorrow morning if you didn’t already push.


+1


Thanks, I pushed this set now.

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

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


Re: [FFmpeg-devel] [PATCH 00/21] aarch64: hevc: Add missing hevc_pel NEON functions

2024-03-26 Thread Jean-Baptiste Kempf
On Mon, 25 Mar 2024, at 22:56, J. Dekker wrote:
>> On Mon, 25 Mar 2024, Martin Storsjö wrote:
>> 
>>> Since some time, we have pretty complete AArch64 NEON coverage
>>> for the hevc decoder.
>>> 
>>> However, some of these functions require the I8MM instruction set
>>> extension, and many of them (but not all) lack a plain NEON
>>> version.
>>> 
>>> This patchset fills in a regular NEON version of all functions
>>> where we have an I8MM function.
>>> 
>>> For context; the I8MM instruction set extension is a mandatory
>>> part of armv8.6-a. E.g. Apple M2, AWS Graviton 3 have it,
>>> but Apple M1 and Ampere Altra don't.
>>> 
>>> This patchset takes decoding of a 1080p HEVC clip from 402
>>> fps to 649 fps on an Apple M1.
>>> 
>>> Patch #2 also fixes a subtle bug in the existing implementation;
>>> two functions relied on the contents on the stack, below the
>>> stack pointer, being untouched within a function. If a signal
>>> gets delivered, those parts of the stack could be clobbered.
>> 
>> I know this is a bit short notice for a patchset of this size - but, would 
>> people be OK with merging this patchset before the impending 7.0 branch 
>> (which is made within the next 24h)?
>> 
>> The patches pass all my tricky build configurations, they give a very 
>> non-negligible speedup on many common CPUs, and patch #2 fixes a real bug in 
>> the existing impleemntations. (A bug fix patch can of course be backported 
>> after the branch too, but performance optimizations aren't generally 
>> relevant for backporting.)
>> 
>> // Martin
>
> Yes, please. I will tomorrow morning if you didn’t already push.

+1

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
https://jbkempf.com/
___
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".