[FFmpeg-devel] [PATCH] libavutil/hwcontext_amf: add format validation in transfer_data functions

2025-03-19 Thread Dmitrii Ovchinnikov
---
 libavutil/hwcontext_amf.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/hwcontext_amf.c b/libavutil/hwcontext_amf.c
index b751a3c1ad..24731c20ec 100644
--- a/libavutil/hwcontext_amf.c
+++ b/libavutil/hwcontext_amf.c
@@ -277,6 +277,9 @@ static int amf_transfer_data_to(AVHWFramesContext *ctx, 
AVFrame *dst,
 int w = FFMIN(dst->width,  src->width);
 int h = FFMIN(dst->height, src->height);
 
+if (dst->hw_frames_ctx->data != (uint8_t *)ctx || src->format != 
ctx->sw_format)
+return AVERROR(EINVAL);
+
 if (!surface) {
 AVHWDeviceContext   *hwdev_ctx = ctx->device_ctx;
 AVAMFDeviceContext  *amf_device_ctx = (AVAMFDeviceContext 
*)hwdev_ctx->hwctx;
@@ -319,6 +322,9 @@ static int amf_transfer_data_from(AVHWFramesContext *ctx, 
AVFrame *dst,
 int h = FFMIN(dst->height, src->height);
 int ret;
 
+if (src->hw_frames_ctx->data != (uint8_t *)ctx || dst->format != 
ctx->sw_format)
+return AVERROR(EINVAL);
+
 ret = surface->pVtbl->Convert(surface, AMF_MEMORY_HOST);
 AMF_RETURN_IF_FALSE(ctx, ret == AMF_OK, AVERROR_UNKNOWN, 
"Convert(amf::AMF_MEMORY_HOST) failed with error %d\n", AVERROR_UNKNOWN);
 
-- 
2.47.1.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".


[FFmpeg-devel] [PATCH v8 3/4] fftools/ffprobe: Rename writer_print_section_* and WriterContext

2025-03-19 Thread softworkz
From: softworkz 

separated for better clarity of the preceding commit

Signed-off-by: softworkz 
ren
---
 fftools/ffprobe.c | 361 +++---
 1 file changed, 178 insertions(+), 183 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f398057df7..4a90bc4824 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -71,11 +71,6 @@
 
 #include "libavutil/thread.h"
 
-// TEMPORARY DEFINES
-#define writer_print_section_header(w, d, s) avtext_print_section_header(w, d, 
s)
-#define writer_print_section_footer(w) avtext_print_section_footer(w)
-#define WriterContext AVTextFormatContext
-
 // attached as opaque_ref to packets/frames
 typedef struct FrameData {
 int64_t pkt_pos;
@@ -446,25 +441,25 @@ static void log_callback(void *ptr, int level, const char 
*fmt, va_list vl)
 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
 }
 
-static inline int show_tags(WriterContext *w, AVDictionary *tags, int 
section_id)
+static inline int show_tags(AVTextFormatContext *w, AVDictionary *tags, int 
section_id)
 {
 const AVDictionaryEntry *tag = NULL;
 int ret = 0;
 
 if (!tags)
 return 0;
-writer_print_section_header(w, NULL, section_id);
+avtext_print_section_header(w, NULL, section_id);
 
 while ((tag = av_dict_iterate(tags, tag))) {
 if ((ret = print_str_validate(tag->key, tag->value)) < 0)
 break;
 }
-writer_print_section_footer(w);
+avtext_print_section_footer(w);
 
 return ret;
 }
 
-static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
+static void print_dovi_metadata(AVTextFormatContext *w, const AVDOVIMetadata 
*dovi)
 {
 if (!dovi)
 return;
@@ -519,15 +514,15 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 print_int("num_x_partitions",  mapping->num_x_partitions);
 print_int("num_y_partitions",  mapping->num_y_partitions);
 
-writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST);
+avtext_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST);
 
 for (int c = 0; c < 3; c++) {
 const AVDOVIReshapingCurve *curve = &mapping->curves[c];
-writer_print_section_header(w, "Reshaping curve", 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
+avtext_print_section_header(w, "Reshaping curve", 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
 
 print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, 1, 
curve->pivots[idx]);
 
-writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST);
+avtext_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST);
 for (int i = 0; i < curve->num_pivots - 1; i++) {
 AVBPrint piece_buf;
 
@@ -545,7 +540,7 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 }
 av_bprintf(&piece_buf, " mapping");
 
-writer_print_section_header(w, piece_buf.str, 
SECTION_ID_FRAME_SIDE_DATA_PIECE);
+avtext_print_section_header(w, piece_buf.str, 
SECTION_ID_FRAME_SIDE_DATA_PIECE);
 print_int("mapping_idc", curve->mapping_idc[i]);
 switch (curve->mapping_idc[i]) {
 case AV_DOVI_MAPPING_POLYNOMIAL:
@@ -569,11 +564,11 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 }
 
 // SECTION_ID_FRAME_SIDE_DATA_PIECE
-writer_print_section_footer(w);
+avtext_print_section_footer(w);
 }
 
 // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
-writer_print_section_footer(w);
+avtext_print_section_footer(w);
 
 if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
 const AVDOVINLQParams *nlq  = &mapping->nlq[c];
@@ -589,11 +584,11 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 }
 
 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
-writer_print_section_footer(w);
+avtext_print_section_footer(w);
 }
 
 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
-writer_print_section_footer(w);
+avtext_print_section_footer(w);
 
 // color metadata
 print_int("dm_metadata_id", color->dm_metadata_id);
@@ -626,7 +621,7 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 }
 }
 
-static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus 
*metadata)
+static void print_dynamic_hdr10_plus(AVTextFormatContext *w, const 
AVDynamicHDRPlus *metadata)
 {
 if (!metadata)
 return;
@@ -725,7 +720,7 @@ static void print_dynamic_hdr10_plus(WriterContext *w, 
const AVDynamicHDRPlus *m
 }
 }
 
-static void print_dynamic_hdr_vivid(WriterContext *w, 

Re: [FFmpeg-devel] [PATCH v2] configure: improve ar test for response files

2025-03-19 Thread Gyan Doshi



On 2025-03-19 02:54 pm, Martin Storsjö wrote:

On Tue, 18 Mar 2025, Gyan Doshi wrote:


---
configure | 13 +++--
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index d84e32196d..14f7bcde0e 100755
--- a/configure
+++ b/configure
@@ -5230,12 +5230,6 @@ else
    ar_o='$@'
fi

-if $ar 2>&1 | grep -qi  "@.*file"; then
-    ar_objs="true"
-else
-    ar_objs=""
-fi
-
add_cflags $extra_cflags
add_cxxflags $extra_cxxflags
add_objcflags $extra_objcflags
@@ -7759,6 +7753,13 @@ case $ld_type in
    ;;
esac

+{
+ar_out=${FFTMPDIR}/test$LIBSUF
+respfile="@/dev/null"
+out_arg="$(echo $ar_o | sed "s;\$@;$ar_out;g")"
+test_cmd $ar $arflags $out_arg $respfile && ar_objs="true" || 
ar_objs=""

+}
+
enable frame_thread_encoder


LGTM, thanks!


Thanks. Pushed as b75b568b3d290ce827b80568ced1d68c277309e6

Regards,
Gyan

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

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


[FFmpeg-devel] [PATCH 4/4] avcodec/ffv1: RC/RLE/LRU coder for remap table

2025-03-19 Thread Michael Niedermayer
8% overall compression gain for 32bit float data which originates from 16bit 
floats

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1.h|  2 ++
 libavcodec/ffv1dec.c | 22 +-
 libavcodec/ffv1enc.c | 70 ++--
 3 files changed, 84 insertions(+), 10 deletions(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index d19c8e3ed42..64be996322c 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -54,6 +54,8 @@
 #define AC_RANGE_CUSTOM_TAB 2
 #define AC_RANGE_DEFAULT_TAB_FORCE -2
 
+#define NLRU 33
+
 typedef struct VlcState {
 uint32_t error_sum;
 int16_t drift;
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d45aabbbde8..c758040e1a8 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -242,7 +242,7 @@ static int decode_slice_header(const FFV1Context *f,
 }
 if (f->combined_version >= 0x40004) {
 sc->remap = ff_ffv1_get_symbol(c, state, 0);
-if (sc->remap > 2U ||
+if (sc->remap > 3U ||
 sc->remap && !f->flt) {
 av_log(f->avctx, AV_LOG_ERROR, "unsupported remap %d\n", 
sc->remap);
 return AVERROR_INVALIDDATA;
@@ -285,12 +285,30 @@ static int decode_remap(FFV1Context *f, FFV1SliceContext 
*sc)
 int lu = 0;
 uint8_t state[2][32];
 int64_t i;
+int lru[NLRU];
 memset(state, 128, sizeof(state));
+
+for(int i = 0; ic, state[lu], 0);
+if (sc->remap == 3 && !lu) {
+if (run < NLRU) {
+unsigned v = lru[run];
+memmove(lru+1, lru, sizeof(int)*run);
+run = v;
+} else {
+memmove(lru+1, lru, sizeof(int)*(NLRU-1));
+run -= NLRU;
+}
+lru[0] = run;
+}
 if (run > end - i + 1)
 return AVERROR_INVALIDDATA;
 if (lu) {
+if (run > 65536 - j)
+return AVERROR_INVALIDDATA;
 lu ^= !run;
 while (run--) {
 if (end == 0x) {
@@ -305,6 +323,8 @@ static int decode_remap(FFV1Context *f, FFV1SliceContext 
*sc)
 if (end == 0x) {
 sc->fltmap  [p][j++] = i ^ ((i&0x8000) ? 0 : flip);
 } else {
+if (j > 65535)
+return AVERROR_INVALIDDATA;
 sc->fltmap32[p][j++] = i ^ ((i&0x8000) ? 0 : flip);
 }
 }
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 12f3952453b..5b4556e63dd 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -949,7 +949,7 @@ av_cold int ff_ffv1_encode_setup_plane_info(AVCodecContext 
*avctx,
 av_assert0(s->bits_per_raw_sample >= 8);
 
 if (s->remap_mode < 0)
-s->remap_mode = s->flt ? 2 : 0;
+s->remap_mode = s->flt ? (s->bits_per_raw_sample == 32 ? 3 : 2) : 0;
 if (s->remap_mode == 0 && s->bits_per_raw_sample == 32) {
 av_log(avctx, AV_LOG_ERROR, "32bit requires remap\n");
 return AVERROR(EINVAL);
@@ -1179,24 +1179,53 @@ static void encode_histogram_remap(FFV1Context *f, 
FFV1SliceContext *sc)
 int lu = 0;
 uint8_t state[2][32];
 int run = 0;
+
+int lru[NLRU];
+
+for(int i = 0; ifltmap[p][ri];
-sc->fltmap[p][ri] = j;
+int u;
+if (i < 65536) {
+u = sc->fltmap[p][ri];
+sc->fltmap[p][ri] = j;
+} else {
+if (!run)
+break;
+u = !lu;
+}
 j+= u;
 
 if (lu == u) {
 run ++;
 } else {
-put_symbol_inline(&sc->c, state[lu], run, 0, NULL, NULL);
+unsigned v = run;
+if (sc->remap == 3 && !lu) {
+int r;
+for(r = 0; r < NLRU; r++) {
+if (v == lru[r]) {
+memmove(lru+1, lru, sizeof(int)*r);
+lru[0] = v;
+v = r;
+break;
+}
+}
+if (r == NLRU) {
+memmove(lru+1, lru, sizeof(int)*(NLRU-1));
+lru[0] = v;
+v += NLRU;
+}
+//TODO escape handling
+}
+put_symbol_inline(&sc->c, state[lu], v, 0, NULL, NULL);
 if (run == 0)
 lu = u;
 run = 0;
 }
 }
-if (run)
-put_symbol(&sc->c, state[lu], run, 0);
 }
 }
 
@@ -1271,6 +1300,10 @@ static void encode_float32_remap(FFV1Context *

[FFmpeg-devel] [PATCH 1/4] avcodec/ffv1: Fix remap ordering

2025-03-19 Thread Michael Niedermayer
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1dec_template.c |  6 +++---
 libavcodec/ffv1enc.c  |  2 +-
 libavcodec/ffv1enc_template.c | 12 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index f9499931b1d..cc0f6f97691 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -198,9 +198,9 @@ static int RENAME(decode_rgb_frame)(FFV1Context *f, 
FFV1SliceContext *sc,
 r += g;
 }
 if (sc->remap) {
-r = sc->fltmap[0][r & 0x];
-g = sc->fltmap[1][g & 0x];
-b = sc->fltmap[2][b & 0x];
+g = sc->fltmap[0][g & 0x];
+b = sc->fltmap[1][b & 0x];
+r = sc->fltmap[2][r & 0x];
 if (transparency)
 a = sc->fltmap[3][a & 0x];
 }
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 64add25b407..72ce22adfb0 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -432,7 +432,7 @@ static void set_micro_version(FFV1Context *f)
 if (f->version == 3) {
 f->micro_version = 4;
 } else if (f->version == 4) {
-f->micro_version = 5;
+f->micro_version = 6;
 } else
 av_assert0(0);
 
diff --git a/libavcodec/ffv1enc_template.c b/libavcodec/ffv1enc_template.c
index 8b2d938770f..779e83dad66 100644
--- a/libavcodec/ffv1enc_template.c
+++ b/libavcodec/ffv1enc_template.c
@@ -168,9 +168,9 @@ static void RENAME(load_rgb_frame)(FFV1Context *f, 
FFV1SliceContext *sc,
 r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y));
 }
 
-sc->fltmap[0][r] = 1;
-sc->fltmap[1][g] = 1;
-sc->fltmap[2][b] = 1;
+sc->fltmap[0][g] = 1;
+sc->fltmap[1][b] = 1;
+sc->fltmap[2][r] = 1;
 if (transparency)
 sc->fltmap[3][a] = 1;
 }
@@ -230,9 +230,9 @@ static int RENAME(encode_rgb_frame)(FFV1Context *f, 
FFV1SliceContext *sc,
 }
 
 if (sc->remap) {
-r = sc->fltmap[0][r];
-g = sc->fltmap[1][g];
-b = sc->fltmap[2][b];
+g = sc->fltmap[0][g];
+b = sc->fltmap[1][b];
+r = sc->fltmap[2][r];
 if (transparency)
 a = sc->fltmap[3][a];
 }
-- 
2.48.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] avcodec/ffv1enc: remap allows using rice golomb with more bits

2025-03-19 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 4fea6cd31c8..12f3952453b 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -975,7 +975,7 @@ static av_cold int encode_init_internal(AVCodecContext 
*avctx)
 if (ret < 0)
 return ret;
 
-if (s->bits_per_raw_sample > (s->version > 3 ? 16 : 8)) {
+if (s->bits_per_raw_sample > (s->version > 3 ? 16 : 8) && !s->remap_mode) {
 if (s->ac == AC_GOLOMB_RICE) {
 av_log(avctx, AV_LOG_INFO,
 "high bits_per_raw_sample, forcing range coder\n");
-- 
2.48.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] avdevice/sdl2: Suppress macro redefinition warning

2025-03-19 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Patch attached.
> 
> - Andreas
> 
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] avcodec/hevc/hevcdec: Simplify access to luma plane

2025-03-19 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Patch attached.
> 
> - Andreas
> 

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] [FFmpeg-cvslog] ffbuild: use response files only if ar accepts them

2025-03-19 Thread Ramiro Polla
On Tue, Mar 18, 2025 at 11:06 AM Gyan Doshi  wrote:
>
> ffmpeg | branch: master | Gyan Doshi  | Mon Mar 17 20:57:28 
> 2025 +0530| [740d4009656abeb006e2d43001b59d875c1a7a6a] | committer: Gyan Doshi
>
> ffbuild: use response files only if ar accepts them

Sorry to come in late to the discussion...

I'm not a big fan of response files, because they make troubleshooting
more annoying (I like copying the command that failed and running it
again on its own with all arguments). IMO this shouldn't be the
default, but only used on systems where this could be a problem (i.e.:
Windows). Also, only based on host systems, so not while
cross-compiling from Linux.

I was wondering why ld.exe/ar.exe fail with a long argument list, but
echo doesn't. After a bit of investigation, it seems that cygwin/msys2
pass arguments through STARTUPINFO::lpReserved2 and shared memory. But
only programs built for cygwin/msys2 can make use of that, otherwise
the parameters from CreateProcess() are used. So echo is a
cygwin/msys2 program, but ld.exe/ar.exe are not. If, by any chance,
you have a non-cygwin/msys2 echo.exe on your path, this will fail
again.

> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=740d4009656abeb006e2d43001b59d875c1a7a6a
> ---
>
>  configure   | 7 +++
>  ffbuild/library.mak | 8 
>  2 files changed, 15 insertions(+)
>
> diff --git a/configure b/configure
> index f6964c4ee1..d84e32196d 100755
> --- a/configure
> +++ b/configure
> @@ -5230,6 +5230,12 @@ else
>  ar_o='$@'
>  fi
>
> +if $ar 2>&1 | grep -qi  "@.*file"; then
> +ar_objs="true"
> +else
> +ar_objs=""
> +fi
> +

I know this has already had another fixup commit and has moved in the
file, but it's the equivalent chunk in configure that I think should
only be tested under $host_os = .

>  add_cflags $extra_cflags
>  add_cxxflags $extra_cxxflags
>  add_objcflags $extra_objcflags
> @@ -8133,6 +8139,7 @@ DEPX86ASM=$x86asmexe
>  DEPX86ASMFLAGS=\$(X86ASMFLAGS)
>  AR=$ar
>  ARFLAGS=$arflags
> +AR_OBJS=$ar_objs
>  AR_O=$ar_o
>  AR_CMD=$ar
>  NM_CMD=$nm
> diff --git a/ffbuild/library.mak b/ffbuild/library.mak
> index 72e3872157..7e1871b74c 100644
> --- a/ffbuild/library.mak
> +++ b/ffbuild/library.mak
> @@ -35,8 +35,12 @@ OBJS += $(SHLIBOBJS)
>  endif
>  $(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS)
> $(RM) $@
> +ifeq ($(AR_OBJS),true)
> $(Q)echo $^ > $@.objs
> $(AR) $(ARFLAGS) $(AR_O) @$@.objs
> +else
> +   $(AR) $(ARFLAGS) $(AR_O) $^
> +endif
> $(RANLIB) $@
> -$(RM) $@.objs
>
> @@ -68,8 +72,12 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
>
>  $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SLIBOBJS) 
> $(SUBDIR)lib$(NAME).ver
> $(SLIB_CREATE_DEF_CMD)
> +ifeq ($(AR_OBJS),true)
> $(Q)echo $$(filter %.o,$$^) > $$@.objs
> $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) @$$@.objs 
> $(FFEXTRALIBS)
> +else
> +   $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) 
> $(FFEXTRALIBS)
> +endif
> $(SLIB_EXTRA_CMD)
> -$(RM) $$@.objs

Is there any reason why we don't ifeq the removal of the response file as well?

Ramiro
___
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] 24 FPS to 23.975 Conversion with Audio

2025-03-19 Thread Zhao Zhili

> 在 2025年3月20日,上午3:35,Steve Rance  写道:
> 
> Hello developers, my first post, if I have posted to the wrong place please 
> point me in the right direction
> 
> I'm attempting to use ffmpeg to convert 24FPS media to 23.986 - Video is good 
> but the audio slips.

This mailing list is for ffmpeg development, not user support.

There is no such framerate 23.986, it’s 24 * 1000/1001.

> 
> From my research I need a fractional sample rate for the audio. To be precise 
> I need 48000 × (23.976/24) ≈ 47952.047952 Hz. However, since FFmpeg’s 
> asetrate only accepts an integer value, ffmpeg ends up using 47952 exactly. I 
> have tried many if not all of the options available and the result remains 
> the same.
> 
> Here are the slippage rates ...
> Approximately 172.63 samples error per hour
> Approximately 2.88 samples error per minute.
> Approximately 20.85 seconds must elapse for each 1 sample error.
> Approximately 11 hours and 35 minutes before the audio is one full frame off.
> 
> I'm using Windows and need advice on how I could try to acheive perfect audio 
> sync.
> 
> Thank you for reading.
> Steve
> 
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


[FFmpeg-devel] [PATCH 2/4] avcodec/ffv1: 32-bit float sample support

2025-03-19 Thread Michael Niedermayer
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1.h |   6 +-
 libavcodec/ffv1_parse.c   |  10 ++
 libavcodec/ffv1dec.c  |  36 --
 libavcodec/ffv1dec_template.c |  30 +++--
 libavcodec/ffv1enc.c  | 201 +-
 5 files changed, 263 insertions(+), 20 deletions(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index dd8a236efad..d19c8e3ed42 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -109,7 +109,11 @@ typedef struct FFV1SliceContext {
 uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
 };
 };
-uint16_t   fltmap[4][65536];
+union {
+uint16_t   bitmap  [4][65536]; //float encode
+uint16_t   fltmap  [4][65536]; //halffloat encode & decode
+uint32_t   fltmap32[4][65536]; //float decode
+};
 } FFV1SliceContext;
 
 typedef struct FFV1Context {
diff --git a/libavcodec/ffv1_parse.c b/libavcodec/ffv1_parse.c
index 9745f9de694..10f3652ff51 100644
--- a/libavcodec/ffv1_parse.c
+++ b/libavcodec/ffv1_parse.c
@@ -419,6 +419,16 @@ int ff_ffv1_parse_header(FFV1Context *f, RangeCoder *c, 
uint8_t *state)
 } else
 f->pix_fmt = AV_PIX_FMT_GBRAP16;
 f->use32bit = 1;
+} else if (f->avctx->bits_per_raw_sample == 32 && !f->transparency) {
+if (f->flt) {
+f->pix_fmt = AV_PIX_FMT_GBRPF32;
+}
+f->use32bit = 1;
+} else if (f->avctx->bits_per_raw_sample == 32 && f->transparency) {
+if (f->flt) {
+f->pix_fmt = AV_PIX_FMT_GBRAPF32;
+}
+f->use32bit = 1;
 }
 } else {
 av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 75fb5ae2f69..d45aabbbde8 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -250,6 +250,16 @@ static int decode_slice_header(const FFV1Context *f,
 sc->rawlsb = ff_ffv1_get_symbol(c, state, 0);
 }
 }
+if (f->avctx->bits_per_raw_sample == 32) {
+if (!sc->remap) {
+av_log(f->avctx, AV_LOG_ERROR, "unsupported remap\n");
+return AVERROR_INVALIDDATA;
+}
+if (sc->slice_width * sc->slice_height > 65536) {
+av_log(f->avctx, AV_LOG_ERROR, "32bit needs remap\n");
+return AVERROR_INVALIDDATA;
+}
+}
 
 return 0;
 }
@@ -266,28 +276,38 @@ static void slice_set_damaged(FFV1Context *f, 
FFV1SliceContext *sc)
 
 static int decode_remap(FFV1Context *f, FFV1SliceContext *sc)
 {
-int flip = sc->remap == 2 ? 0x7FFF : 0;
+unsigned int end = f->avctx->bits_per_raw_sample == 32 ? 0x : 
0x;
+int flip = sc->remap == 2 ? (end>>1) : 0;
+int sign = (end>>1)+1;
 
 for (int p= 0; p < 1 + 2*f->chroma_planes + f->transparency; p++) {
 int j = 0;
 int lu = 0;
 uint8_t state[2][32];
+int64_t i;
 memset(state, 128, sizeof(state));
-
-for (int i= 0; i<65536; i++) {
-int run = get_symbol_inline(&sc->c, state[lu], 0);
-if (run > 65536U - i)
+for (i=0; i <= end ; i++) {
+unsigned run = get_symbol_inline(&sc->c, state[lu], 0);
+if (run > end - i + 1)
 return AVERROR_INVALIDDATA;
 if (lu) {
 lu ^= !run;
 while (run--) {
-sc->fltmap[p][j++] = i ^ ((i&0x8000) ? 0 : flip);
+if (end == 0x) {
+sc->fltmap  [p][j++] = i ^ ((i&0x8000) ? 0 : flip);
+} else
+sc->fltmap32[p][j++] = i ^ ((i&0x8000) ? 0 : flip);
 i++;
 }
 } else {
 i += run;
-if (i != 65536)
-sc->fltmap[p][j++] = i ^ ((i&0x8000) ? 0 : flip);
+if (i <= end) {
+if (end == 0x) {
+sc->fltmap  [p][j++] = i ^ ((i&0x8000) ? 0 : flip);
+} else {
+sc->fltmap32[p][j++] = i ^ ((i&0x8000) ? 0 : flip);
+}
+}
 lu ^= !run;
 }
 }
diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index cc0f6f97691..727febe8916 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -150,7 +150,7 @@ static int RENAME(decode_rgb_frame)(FFV1Context *f, 
FFV1SliceContext *sc,
 int x, y, p;
 TYPE *sample[4][2];
 int lbd= f->avctx->bits_per_raw_sample <= 8;
-int bits   = f->avctx->bits_per_raw_sample > 0 ? 
f->avctx->bits_per_raw_sample : 8;
+int bits   = f->avctx->bits_per_raw_sample > 0 ? 
FFMIN(f->avctx->bits_per_raw_sample, 16) : 8;
 int offset = 1 << bits;
 int transparency = f->transparency;
 int ac = f->ac;
@@ -198,1

[FFmpeg-devel] [PATCH] avcodec/Makefile: Skip ffv1_vulkan.h in checkheaders

2025-03-19 Thread Andreas Rheinhardt
Patch attached.

- Andreas
From dd549affbb6d691d7057ac27e894eeb6933f5bbb Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt 
Date: Tue, 18 Mar 2025 16:23:39 +0100
Subject: [PATCH] avcodec/Makefile: Skip ffv1_vulkan.h in checkheaders

unless vulkan is actually enabled.

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

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5284c561a6..cc99767049 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1305,7 +1305,7 @@ SKIPHEADERS-$(CONFIG_QSVENC)   += qsvenc.h
 SKIPHEADERS-$(CONFIG_VAAPI)+= vaapi_decode.h vaapi_hevc.h vaapi_encode.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
-SKIPHEADERS-$(CONFIG_VULKAN)   += vulkan_video.h vulkan_encode.h vulkan_decode.h
+SKIPHEADERS-$(CONFIG_VULKAN)   += ffv1_vulkan.h vulkan_video.h vulkan_encode.h vulkan_decode.h
 SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
 SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
 
-- 
2.45.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 v2] configure: improve ar test for response files

2025-03-19 Thread Martin Storsjö

On Tue, 18 Mar 2025, Gyan Doshi wrote:


---
configure | 13 +++--
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index d84e32196d..14f7bcde0e 100755
--- a/configure
+++ b/configure
@@ -5230,12 +5230,6 @@ else
ar_o='$@'
fi

-if $ar 2>&1 | grep -qi  "@.*file"; then
-ar_objs="true"
-else
-ar_objs=""
-fi
-
add_cflags $extra_cflags
add_cxxflags $extra_cxxflags
add_objcflags $extra_objcflags
@@ -7759,6 +7753,13 @@ case $ld_type in
;;
esac

+{
+ar_out=${FFTMPDIR}/test$LIBSUF
+respfile="@/dev/null"
+out_arg="$(echo $ar_o | sed "s;\$@;$ar_out;g")"
+test_cmd $ar $arflags $out_arg $respfile && ar_objs="true" || ar_objs=""
+}
+
enable frame_thread_encoder


LGTM, thanks!

// Martin

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

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


[FFmpeg-devel] [PATCH] avutil/libm: Only include intfloat.h when needed

2025-03-19 Thread Andreas Rheinhardt
Patch attached.

- Andreas
From 64e4ffb226f560eaaf965d98eb9edcaa343deb9c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt 
Date: Wed, 19 Mar 2025 10:15:15 +0100
Subject: [PATCH] avutil/libm: Only include intfloat.h when needed

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/exrenc.c  | 1 +
 libavcodec/fastaudio.c   | 1 +
 libavcodec/jpeg2000.c| 1 +
 libavcodec/mips/h264pred_mmi.c   | 1 +
 libavcodec/mips/hevcdsp_mmi.c| 1 +
 libavcodec/mips/vp8dsp_mmi.c | 1 +
 libavcodec/pnmdec.c  | 1 +
 libavcodec/pnmenc.c  | 1 +
 libavcodec/speexdec.c| 1 +
 libavfilter/vf_tonemap.c | 1 +
 libavfilter/vf_zscale.c  | 1 +
 libavformat/ircamdec.c   | 1 +
 libavformat/lafdec.c | 1 +
 libavformat/pdvdec.c | 1 +
 libavformat/usmdec.c | 1 +
 libavutil/libm.h | 2 ++
 libavutil/tests/rational.c   | 1 +
 libswscale/input.c   | 3 ++-
 libswscale/output.c  | 3 ++-
 libswscale/ppc/swscale_altivec.c | 1 +
 20 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c
index e6424092a5..c9685890ea 100644
--- a/libavcodec/exrenc.c
+++ b/libavcodec/exrenc.c
@@ -27,6 +27,7 @@
 #include 
 
 #include "libavutil/avassert.h"
+#include "libavutil/intfloat.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/imgutils.h"
diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c
index b9d7a30b11..ee31a06f18 100644
--- a/libavcodec/fastaudio.c
+++ b/libavcodec/fastaudio.c
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/intfloat.h"
 #include "libavutil/mem.h"
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 7911500901..6433e13892 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -29,6 +29,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
+#include "libavutil/intfloat.h"
 #include "libavutil/mem.h"
 #include "libavutil/thread.h"
 #include "avcodec.h"
diff --git a/libavcodec/mips/h264pred_mmi.c b/libavcodec/mips/h264pred_mmi.c
index 480411f5b5..09d4ac1693 100644
--- a/libavcodec/mips/h264pred_mmi.c
+++ b/libavcodec/mips/h264pred_mmi.c
@@ -24,6 +24,7 @@
 
 #include "h264pred_mips.h"
 #include "libavcodec/bit_depth_template.c"
+#include "libavutil/intfloat.h"
 #include "libavutil/mips/mmiutils.h"
 #include "constants.h"
 
diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c
index 6ff52187e5..30a3030d00 100644
--- a/libavcodec/mips/hevcdsp_mmi.c
+++ b/libavcodec/mips/hevcdsp_mmi.c
@@ -21,6 +21,7 @@
 #include "libavcodec/hevc/hevcdec.h"
 #include "libavcodec/bit_depth_template.c"
 #include "libavcodec/mips/hevcdsp_mips.h"
+#include "libavutil/intfloat.h"
 #include "libavutil/mips/mmiutils.h"
 
 #define PUT_HEVC_QPEL_H(w, x_step, src_step, dst_step)   \
diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
index bc774aa365..8b518e9c49 100644
--- a/libavcodec/mips/vp8dsp_mmi.c
+++ b/libavcodec/mips/vp8dsp_mmi.c
@@ -24,6 +24,7 @@
 #include "vp8dsp_mips.h"
 #include "constants.h"
 #include "libavutil/attributes.h"
+#include "libavutil/intfloat.h"
 #include "libavutil/mips/mmiutils.h"
 #include "libavutil/mem_internal.h"
 
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 59013ada49..68bb7a41ec 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -22,6 +22,7 @@
 #include "config_components.h"
 
 #include "libavutil/half2float.h"
+#include "libavutil/intfloat.h"
 
 #include "avcodec.h"
 #include "codec_internal.h"
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index 91ed5e2b19..8f67fe0a3b 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -25,6 +25,7 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/float2half.h"
+#include "libavutil/intfloat.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
index b335e2fbe8..90a1b50bd6 100644
--- a/libavcodec/speexdec.c
+++ b/libavcodec/speexdec.c
@@ -54,6 +54,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/float_dsp.h"
+#include "libavutil/intfloat.h"
 #include "libavutil/mem.h"
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c
index e0be8181c9..2f09487d3f 100644
--- a/libavfilter/vf_tonemap.c
+++ b/libavfilter/vf_tonemap.c
@@ -29,6 +29,7 @@
 #include "libavutil/csp.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
+#include "libavutil/intfloat.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 7e66c3d6e2..ba431cc

[FFmpeg-devel] [PATCH] ffmpeg_demux: set default for readrate_catchup to be 5% faster

2025-03-19 Thread Gyan Doshi
The existing default value is the same as the primary readrate.
This maintains the flow rate as best as possible but does not
reduce the lag. This new value allows catchup to gradually happen
without overwhelming the receiver.

Addresses a concern brought up in #11469
---
 fftools/ffmpeg_demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index b8171e336e..23216f6c13 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1892,7 +1892,7 @@ int ifile_open(const OptionsContext *o, const char 
*filename, Scheduler *sch)
d->readrate_initial_burst);
 return AVERROR(EINVAL);
 }
-d->readrate_catchup = o->readrate_catchup ? o->readrate_catchup : 
d->readrate;
+d->readrate_catchup = o->readrate_catchup ? o->readrate_catchup : 
d->readrate * 1.05;
 if (d->readrate_catchup < d->readrate) {
 av_log(d, AV_LOG_ERROR,
"Option -readrate_catchup is %0.3f; it must be at least 
equal to %0.3f.\n",
-- 
2.46.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] avfilter: Proof of Concept: enable out-of-tree filters

2025-03-19 Thread Leandro Santiago
I've applied a few changes from your feedback, the following is how the feature 
looks like.

***Disclaimer***

this is still a proof of concept and for now I am looking for your feedback and 
help. There are lots of rough corners and stuff that does not work. I by no 
means intend to request the changes as they are to be merged. Call it an RFC if 
you will.

Also, I am not sending the patch as an attachment, and leave the e-mail body 
for discussion only. I am not sure whether this is a good approach or goes 
against the mailing list policy. This is the time I wish we could really 
contribute using the Pull Request more on a nice web interface.

If you folks want to experiment, I pushed my changes in this PR: 
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/13

***Finish disclaimer***

I changed the name convention from "extra filters" to "external filters", as it 
sounds more natural. (Another possibility would be "extension filters", so 
please let me know what you think).

The build system will automatically pick up any filters in the subdirectory 
`ext/libavfilter`, and ignore it if it does not exist.

The rationale behind this directory structure is to reserve the possibility of 
extensions of other libraries as well.

An external filter is composed by at least one Makefile, and this Makefile has 
some "metadata" encoded in its comments, used by the `./configure` script to 
generate some code. I'll show how they look like in an example.

Although this way to encode metadata looks very ugly and I am pretty sure can 
be improved, this is the best I could for now, and I hope you folks can point 
me directions on how to improve it, as you have more knowledge of the build 
system than I do.

Here are the metadata types:

- check: this is a command used to check if 3rd party dependencies are 
available and enabling them within the build system. The command here is 
executed by `./configure`. This entry is optional and for now there can be only 
one of them, due to technical limitations of my implementation.

- symbol: this entry can appear multiple times, and indicates the name of the 
FFFilter objects exported by the filter. There must be one entry per exported 
symbol. These entries are used by `./configure` to generate the list of enabled 
filters.

- ldflags: those are extra LDFLAGS to be used to link libavfilter. I am not 
happy this this one at all, as such information ideally should be encoded as 
Makefile variables, but I confess I could not manage to do it. I'd be happy to 
get directions on where in the build system to look for the right "hook", but 
I'll continue looking for it as well.

As an example, here is how one can create an empty filter. Just to exercise the 
build system, the example filter depends on an external library, json-c, which 
is found using pkg-config and will be dynamically linked to libavfilter. In 
case json-c is not found, `./configure` will fail, as expected.

```

mkdir -p ext/libavfilter/example

```

Then create the a file ext/libavfilter/example/Makefile with the content:

```

# check: require_pkg_config json json-c json-c/json.h json_c_version_num
# symbol: ff_vf_example
# ldflags: -ljson-c

OBJS += vf_example.o
CFLAGS += -DFOO=1234

libavfilter/vf_example.o:
    $(CC) $(EXTERNAL_FILTER_FLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ 
$(EXTERNAL_FILTER_EXAMPLE_LOCATION)/vf_example.c

```

Then, create the file ext/libavfilter/example/Makefile/vf_example.c with the 
content:


```

#include "libavutil/internal.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"

#include 

static int process_command(AVFilterContext *ctx, const char *cmd, const char 
*args, char *res, int res_len, int flags) {
  // NOTE: I know this makes no sense, I just wanted to use some symbol from 
json-c
  // in a way the compiler cannot optimize it out
  return json_c_version_num();
}


const FFFilter ff_vf_example = {
    .p.name    = "example",
    .p.description = NULL_IF_CONFIG_SMALL("An external example filter"),
    .p.flags   = AVFILTER_FLAG_METADATA_ONLY,
    FILTER_INPUTS(ff_video_default_filterpad),
    FILTER_OUTPUTS(ff_video_default_filterpad),
    .process_command = process_command,
};

```

(You can skip this manually creating those files by checking out this example 
filter from gitlab: 
https://gitlab.com/leandrosansilva/ffmpeg-extra-filter-example)

Now you can compile ffmpeg as usual, with `./configure && make && make install` 
and use the filter.

In my tests, building ffmpeg libraries either in static and shared mode work, 
with the extra dependencies properly linked.


Explanation:

- The .o files for the external filters will be generated in the same place as 
the built-in filters, in libavfilter/. That means that two external filters 
cannot generate the same .o files.

- A new variable with the format 
EXTERNAL_FILTER_$(FILTER_SYMBOL_IN_UPPERCASE)_LOCATION will be generated for 
each FFFilter exported. More explanation about that below.

- The build system of

[FFmpeg-devel] [PATCH v8 2/4] fftools/ffprobe: Change to use textformat api

2025-03-19 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 fftools/Makefile  |   12 +
 fftools/ffprobe.c | 1849 -
 2 files changed, 142 insertions(+), 1719 deletions(-)

diff --git a/fftools/Makefile b/fftools/Makefile
index 4499799818..664b73b161 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -22,6 +22,18 @@ OBJS-ffmpeg +=  \
 fftools/sync_queue.o\
 fftools/thread_queue.o  \
 
+OBJS-ffprobe +=   \
+fftools/textformat/avtextformat.o \
+fftools/textformat/tf_compact.o   \
+fftools/textformat/tf_default.o   \
+fftools/textformat/tf_flat.o  \
+fftools/textformat/tf_ini.o   \
+fftools/textformat/tf_json.o  \
+fftools/textformat/tf_xml.o   \
+fftools/textformat/tw_avio.o  \
+fftools/textformat/tw_buffer.o\
+fftools/textformat/tw_stdout.o\
+
 OBJS-ffplay += fftools/ffplay_renderer.o
 
 define DOFFTOOL
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 7341731d2f..f398057df7 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -40,7 +40,6 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/display.h"
 #include "libavutil/film_grain_params.h"
-#include "libavutil/hash.h"
 #include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/iamf.h"
 #include "libavutil/mastering_display_metadata.h"
@@ -66,11 +65,17 @@
 #include "libpostproc/postprocess.h"
 #include "libpostproc/version.h"
 #include "libavfilter/version.h"
+#include "textformat/avtextformat.h"
 #include "cmdutils.h"
 #include "opt_common.h"
 
 #include "libavutil/thread.h"
 
+// TEMPORARY DEFINES
+#define writer_print_section_header(w, d, s) avtext_print_section_header(w, d, 
s)
+#define writer_print_section_footer(w) avtext_print_section_footer(w)
+#define WriterContext AVTextFormatContext
+
 // attached as opaque_ref to packets/frames
 typedef struct FrameData {
 int64_t pkt_pos;
@@ -156,10 +161,7 @@ static int find_stream_info  = 1;
 
 /* section structure definition */
 
-#define SECTION_MAX_NB_CHILDREN 11
-
 typedef enum {
-SECTION_ID_NONE = -1,
 SECTION_ID_CHAPTER,
 SECTION_ID_CHAPTER_TAGS,
 SECTION_ID_CHAPTERS,
@@ -228,25 +230,6 @@ typedef enum {
 SECTION_ID_SUBTITLE,
 } SectionID;
 
-struct section {
-int id; ///< unique id identifying a section
-const char *name;
-
-#define SECTION_FLAG_IS_WRAPPER  1 ///< the section only contains other 
sections, but has no data at its own level
-#define SECTION_FLAG_IS_ARRAY2 ///< the section contains an array of 
elements of the same type
-#define SECTION_FLAG_HAS_VARIABLE_FIELDS 4 ///< the section may contain a 
variable number of fields with variable keys.
-   ///  For these sections the 
element_name field is mandatory.
-#define SECTION_FLAG_HAS_TYPE8 ///< the section contains a type to 
distinguish multiple nested elements
-
-int flags;
-const SectionID children_ids[SECTION_MAX_NB_CHILDREN+1]; ///< list of 
children section IDS, terminated by -1
-const char *element_name; ///< name of the contained element, if provided
-const char *unique_name;  ///< unique section name, in case the name is 
ambiguous
-AVDictionary *entries_to_show;
-const char *(* get_type)(const void *data); ///< function returning a type 
if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
-int show_all_entries;
-};
-
 static const char *get_packet_side_data_type(const void *data)
 {
 const AVPacketSideData *sd = (const AVPacketSideData *)data;
@@ -270,75 +253,75 @@ static const char *get_stream_group_type(const void *data)
 return av_x_if_null(avformat_stream_group_name(stg->type), "unknown");
 }
 
-static struct section sections[] = {
-[SECTION_ID_CHAPTERS] =   { SECTION_ID_CHAPTERS, "chapters", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } },
+static struct AVTextFormatSection sections[] = {
+[SECTION_ID_CHAPTERS] =   { SECTION_ID_CHAPTERS, "chapters", 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } },
 [SECTION_ID_CHAPTER] ={ SECTION_ID_CHAPTER, "chapter", 0, { 
SECTION_ID_CHAPTER_TAGS, -1 } },
-[SECTION_ID_CHAPTER_TAGS] =   { SECTION_ID_CHAPTER_TAGS, "tags", 
SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = 
"chapter_tags" },
+[SECTION_ID_CHAPTER_TAGS] =   { SECTION_ID_CHAPTER_TAGS, "tags", 
AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", 
.unique_name = "chapter_tags" },
 [SECTION_ID_ERROR] =  { SECTION_ID_ERROR, "error", 0, { -1 } },
 [SECTION_ID_FORMAT] = { SECTION_ID_FORMAT, "format", 0, { 
SECTION_ID_FORMAT_TAGS, -1 } },
-[SECTION_ID_FORMAT_TAGS] ={ SECTION_ID_FORMAT_TAGS, "tags", 
SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = 
"format_tags" },
-[SECTION_ID_FRAMES] =

Re: [FFmpeg-devel] [PATCH v2 1/6] tests: Add enhanced-flv-hevc-hdr10 for demux and mux HDR color info

2025-03-19 Thread Zhao Zhili


> On Mar 19, 2025, at 23:38, Sean McGovern  wrote:
> 
> Hi Zhao,
> 
> On Mon, Mar 10, 2025 at 10:35 PM Zhao Zhili
>  wrote:
>> 
>> From: Zhao Zhili 
>> 
>> ---
>> tests/fate/flvenc.mak  |   4 +
>> tests/ref/fate/enhanced-flv-hevc-hdr10 | 100 +
>> 2 files changed, 104 insertions(+)
>> create mode 100644 tests/ref/fate/enhanced-flv-hevc-hdr10
> 
> Sorry for not addressing this earlier -- this fails on big-endian
> PowerPC (both 32- and 64-bit). Please have a look at FATE.
> The test should probably explicitly request that the sample is little-endian.

OK. It’s due to ffprobe shows the native endian yuv420p10 as yuv420p10le on 
little endian
arch.

I can filter out the pix_fmt entry, but it’s a general problem in test: there 
is no way to separate
native endian from explicit big/little endian in pixel format.

> 
> Thanks,
> Sean McGovern
> ___
> 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] 24 FPS to 23.975 Conversion with Audio

2025-03-19 Thread Steve Rance
Hello developers, my first post, if I have posted to the wrong place please 
point me in the right direction

I'm attempting to use ffmpeg to convert 24FPS media to 23.986 - Video is good 
but the audio slips.

From my research I need a fractional sample rate for the audio. To be precise I 
need 48000 × (23.976/24) ≈ 47952.047952 Hz. However, since FFmpeg’s asetrate 
only accepts an integer value, ffmpeg ends up using 47952 exactly. I have tried 
many if not all of the options available and the result remains the same.

Here are the slippage rates ...
Approximately 172.63 samples error per hour
Approximately 2.88 samples error per minute.
Approximately 20.85 seconds must elapse for each 1 sample error.
Approximately 11 hours and 35 minutes before the audio is one full frame off.

I'm using Windows and need advice on how I could try to acheive perfect audio 
sync.

Thank you for reading.
Steve



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

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


Re: [FFmpeg-devel] [PATCH v2 1/6] tests: Add enhanced-flv-hevc-hdr10 for demux and mux HDR color info

2025-03-19 Thread Sean McGovern
Hi Zhao,

On Mon, Mar 10, 2025 at 10:35 PM Zhao Zhili
 wrote:
>
> From: Zhao Zhili 
>
> ---
>  tests/fate/flvenc.mak  |   4 +
>  tests/ref/fate/enhanced-flv-hevc-hdr10 | 100 +
>  2 files changed, 104 insertions(+)
>  create mode 100644 tests/ref/fate/enhanced-flv-hevc-hdr10

Sorry for not addressing this earlier -- this fails on big-endian
PowerPC (both 32- and 64-bit). Please have a look at FATE.
The test should probably explicitly request that the sample is little-endian.

Thanks,
Sean McGovern
___
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] libavutil/riscv:update hwprobe for RVV and ZVBB with dl_hwcap

2025-03-19 Thread Rémi Denis-Courmont
Hi,

I shouldn't need to point this out, but please do not resend patches without 
addressing comments from previous versions in any apparent way.

-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 v8 0/4] print_graphs: Complete Filtergraph Printing

2025-03-19 Thread ffmpegagent
Due to the additional work on graph visualization (see
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2025-March/341296.html), I
have removed the two graph printing commits from this patchset rather than
adding to it, as to avoid wasting the effort already spent on reviewing.

So, now it's a graph printing patchset without graph printing :-)

All other commits are unchanged from the previous version. I'm also
resubmitting to give it a final run of the tests on various platforms.

Thanks

softworkz (4):
  fftools/textformat: Extract and generalize textformat api from
ffprobe.c
  fftools/ffprobe: Change to use textformat api
  fftools/ffprobe: Rename writer_print_section_* and WriterContext
  fftools/ffprobe: Rename AVTextFormatContext variables (w => tfc)

 fftools/Makefile   |   12 +
 fftools/ffprobe.c  | 2296 +---
 fftools/textformat/avtextformat.c  |  672 
 fftools/textformat/avtextformat.h  |  171 +++
 fftools/textformat/avtextwriters.h |   68 +
 fftools/textformat/tf_compact.c|  282 
 fftools/textformat/tf_default.c|  145 ++
 fftools/textformat/tf_flat.c   |  174 +++
 fftools/textformat/tf_ini.c|  160 ++
 fftools/textformat/tf_json.c   |  215 +++
 fftools/textformat/tf_xml.c|  221 +++
 fftools/textformat/tw_avio.c   |  129 ++
 fftools/textformat/tw_buffer.c |   92 ++
 fftools/textformat/tw_stdout.c |   82 +
 14 files changed, 2774 insertions(+), 1945 deletions(-)
 create mode 100644 fftools/textformat/avtextformat.c
 create mode 100644 fftools/textformat/avtextformat.h
 create mode 100644 fftools/textformat/avtextwriters.h
 create mode 100644 fftools/textformat/tf_compact.c
 create mode 100644 fftools/textformat/tf_default.c
 create mode 100644 fftools/textformat/tf_flat.c
 create mode 100644 fftools/textformat/tf_ini.c
 create mode 100644 fftools/textformat/tf_json.c
 create mode 100644 fftools/textformat/tf_xml.c
 create mode 100644 fftools/textformat/tw_avio.c
 create mode 100644 fftools/textformat/tw_buffer.c
 create mode 100644 fftools/textformat/tw_stdout.c


base-commit: 0b097ed9f141f57e2b91f0704c721a9eff0204c0
Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-52%2Fsoftworkz%2Fsubmit_print_graphs5-v8
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-52/softworkz/submit_print_graphs5-v8
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/52

Range-diff vs v7:

 1:  f379c77e88 = 1:  f379c77e88 fftools/textformat: Extract and generalize 
textformat api from ffprobe.c
 2:  67bc38ac96 = 2:  67bc38ac96 fftools/ffprobe: Change to use textformat api
 3:  52c41fdcd0 = 3:  52c41fdcd0 fftools/ffprobe: Rename writer_print_section_* 
and WriterContext
 4:  21480a08b1 < -:  -- fftools/ffmpeg_filter: Move some declaration 
to new header file
 5:  70ba7a8bc9 < -:  -- avfilter/avfilter: Add 
avfilter_link_get_hw_frames_ctx()
 6:  a30ded4d62 < -:  -- fftools/ffmpeg_graphprint: Add options for 
filtergraph printing
 7:  fcfcc5f7df = 4:  e85abafb4d fftools/ffprobe: Rename AVTextFormatContext 
variables (w => tfc)

-- 
ffmpeg-codebot
___
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".