The branch, master has been updated
       via  843920d5d6bdcecbfd4eeac66cd175348bf99496 (commit)
       via  4c067d0778c932ab85f35cc4c07ace9d612e1905 (commit)
       via  00e05bcd681a21637b1eed4cd13ff3797d9df97a (commit)
       via  326abf359f72c0daf74c332bc05c65d7b3a5da0b (commit)
       via  60dbcc5321feace40d80550fde1465788b416df2 (commit)
       via  56bb187ca915642358b8527029139628771837cb (commit)
       via  2b67137daa488b2de4c86fd025ab9db576a1fb9a (commit)
       via  5830743363490d39d9f9b4acd4c4aceb73c14d0c (commit)
       via  367febc491bceaf9aa95ba5fb9c2ca9b38f9208d (commit)
      from  e02e6d54b04aaed3a500e55fd53da6dd411074d8 (commit)


- Log -----------------------------------------------------------------
commit 843920d5d6bdcecbfd4eeac66cd175348bf99496
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Sep 15 17:47:39 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/x86/vf_idetdsp: add AVX2 and AVX512 implementations
    
    The only thing that changes slightly is the horizontal sum at the end.

diff --git a/libavfilter/x86/vf_idetdsp.asm b/libavfilter/x86/vf_idetdsp.asm
index 63d9f4533d..12d65000ab 100644
--- a/libavfilter/x86/vf_idetdsp.asm
+++ b/libavfilter/x86/vf_idetdsp.asm
@@ -39,7 +39,7 @@ SECTION .text
   paddd     %1, %2
 %endmacro
 
-%macro IDET_FILTER_LINE_16BIT 1   ; %1=increment (4 or 8 words)
+%macro IDET_FILTER_LINE_16BIT 0
 cglobal idet_filter_line_16bit, 4, 5, 8, a, b, c, width, index
     xor       indexq, indexq
 %define m_zero m1
@@ -54,7 +54,7 @@ cglobal idet_filter_line_16bit, 4, 5, 8, a, b, c, width, index
     psubusw   m5, m2, m3             ; ba
 
     movu      m4, [cq + indexq * 2]  ; C
-    add       indexq, %1
+    add       indexq, mmsize >> 1
     psubusw   m3, m2                 ; ab
     CMP       indexd, widthd
 
@@ -67,13 +67,23 @@ cglobal idet_filter_line_16bit, 4, 5, 8, a, b, c, width, 
index
     paddd          m_sum, m5
     jl        .loop_16bit
 
+%if mmsize > 32
+    vextracti64x4 ym1, m0, 1
+    paddq     ym0, ym1
+%endif
     HADDD     m_sum, m2
     movd      eax, m_sum
     RET
 %endmacro
 
 INIT_XMM sse2
-IDET_FILTER_LINE_16BIT 8
+IDET_FILTER_LINE_16BIT
+
+INIT_XMM avx2
+IDET_FILTER_LINE_16BIT
+
+INIT_XMM avx512icl
+IDET_FILTER_LINE_16BIT
 
 ;******************************************************************************
 ; SSE2 8-bit implementation that does 16-bytes at a time:
@@ -106,11 +116,25 @@ cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, 
total
     jl       .sse2_loop
 
     paddq     m0, m1
-    movhlps   m1, m0
-    paddq     m0, m1
-    movd      eax, m0
+%if mmsize > 32
+    vextracti64x4 ym1, m0, 1
+    paddq     ym0, ym1
+%endif
+%if mmsize > 16
+    vextracti128 xm1, ym0, 1
+    paddq     xm0, xm1
+%endif
+    movhlps   xm1, xm0
+    paddq     xm0, xm1
+    movd      eax, xm0
     RET
 %endmacro
 
 INIT_XMM sse2
 IDET_FILTER_LINE
+
+INIT_YMM avx2
+IDET_FILTER_LINE
+
+INIT_ZMM avx512icl
+IDET_FILTER_LINE
diff --git a/libavfilter/x86/vf_idetdsp_init.c 
b/libavfilter/x86/vf_idetdsp_init.c
index e49b01a68c..1f4c2e2bc3 100644
--- a/libavfilter/x86/vf_idetdsp_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -62,6 +62,12 @@ static int idet_filter_line_16bit_##KIND(const uint8_t *a, 
const uint8_t *b,   \
 FUNC_MAIN_DECL(sse2, 16)
 FUNC_MAIN_DECL_16bit(sse2, 8)
 
+FUNC_MAIN_DECL(avx2, 32)
+FUNC_MAIN_DECL_16bit(avx2, 16)
+
+FUNC_MAIN_DECL(avx512icl, 64)
+FUNC_MAIN_DECL_16bit(avx512icl, 32)
+
 #endif
 av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
 {
@@ -71,5 +77,11 @@ av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int 
depth)
     if (EXTERNAL_SSE2(cpu_flags)) {
         dsp->filter_line = depth > 8 ? idet_filter_line_16bit_sse2 : 
idet_filter_line_sse2;
     }
+    if (EXTERNAL_AVX2(cpu_flags)) {
+        dsp->filter_line = depth > 8 ? idet_filter_line_16bit_avx2 : 
idet_filter_line_avx2;
+    }
+    if (EXTERNAL_AVX512ICL(cpu_flags)) {
+        dsp->filter_line = depth > 8 ? idet_filter_line_16bit_avx512icl : 
idet_filter_line_avx512icl;
+    }
 #endif // HAVE_X86ASM
 }

commit 4c067d0778c932ab85f35cc4c07ace9d612e1905
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Sep 15 17:20:17 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/x86/vf_idetdsp: generalize 8-bit macro
    
    This is mostly compatible with AVX as well, so turn it into a macro.

diff --git a/libavfilter/x86/vf_idetdsp.asm b/libavfilter/x86/vf_idetdsp.asm
index 7bc8e7d2c4..63d9f4533d 100644
--- a/libavfilter/x86/vf_idetdsp.asm
+++ b/libavfilter/x86/vf_idetdsp.asm
@@ -78,7 +78,7 @@ IDET_FILTER_LINE_16BIT 8
 ;******************************************************************************
 ; SSE2 8-bit implementation that does 16-bytes at a time:
 
-INIT_XMM sse2
+%macro IDET_FILTER_LINE 0
 cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, total
     xor       indexq, indexq
     pxor      m0, m0
@@ -92,7 +92,7 @@ cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, 
total
     psubusb   m5, m2, m3           ; ba
 
     movu      m3, [cq + indexq*1]  ; C
-    add       indexq, 0x10
+    add       indexq, mmsize
     psubusb   m4, m2               ; ab
     CMP       indexd, widthd
 
@@ -110,3 +110,7 @@ cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, 
total
     paddq     m0, m1
     movd      eax, m0
     RET
+%endmacro
+
+INIT_XMM sse2
+IDET_FILTER_LINE

commit 00e05bcd681a21637b1eed4cd13ff3797d9df97a
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Sep 15 18:10:43 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    tests/checkasm: add vf_idet checkasm

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 9f1dd57fa6..0a54adc96a 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -62,6 +62,7 @@ AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
 AVFILTEROBJS-$(CONFIG_EQ_FILTER)         += vf_eq.o
 AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)      += vf_gblur.o
 AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)      += vf_hflip.o
+AVFILTEROBJS-$(CONFIG_IDET_FILTER)       += vf_idet.o
 AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o
 AVFILTEROBJS-$(CONFIG_NLMEANS_FILTER)    += vf_nlmeans.o
 AVFILTEROBJS-$(CONFIG_SOBEL_FILTER)      += vf_convolution.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 5312d02909..ad4d9b53b6 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -290,6 +290,9 @@ static const struct {
     #if CONFIG_HFLIP_FILTER
         { "vf_hflip", checkasm_check_vf_hflip },
     #endif
+    #if CONFIG_IDET_FILTER
+        { "vf_idet", checkasm_check_idet },
+    #endif
     #if CONFIG_NLMEANS_FILTER
         { "vf_nlmeans", checkasm_check_nlmeans },
     #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index bb6b413aba..1684c427d6 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -112,6 +112,7 @@ void checkasm_check_hevc_pel(void);
 void checkasm_check_hevc_sao(void);
 void checkasm_check_huffyuvdsp(void);
 void checkasm_check_idctdsp(void);
+void checkasm_check_idet(void);
 void checkasm_check_jpeg2000dsp(void);
 void checkasm_check_llauddsp(void);
 void checkasm_check_lls(void);
diff --git a/tests/checkasm/vf_idet.c b/tests/checkasm/vf_idet.c
new file mode 100644
index 0000000000..4bc0f5c846
--- /dev/null
+++ b/tests/checkasm/vf_idet.c
@@ -0,0 +1,65 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "checkasm.h"
+
+#include "libavfilter/vf_idetdsp.h"
+#include "libavutil/mem_internal.h"
+
+#define WIDTH 512
+
+static void check_idet(int depth)
+{
+    IDETDSPContext dsp;
+
+    LOCAL_ALIGNED_32(uint8_t, in0, [WIDTH]);
+    LOCAL_ALIGNED_32(uint8_t, in1, [WIDTH]);
+    LOCAL_ALIGNED_32(uint8_t, in2, [WIDTH]);
+
+    declare_func(int, const uint8_t *a, const uint8_t *b,
+                 const uint8_t *c, int w);
+
+    ff_idet_dsp_init(&dsp, depth > 8);
+
+    for (int x = 0; x < WIDTH; x++) {
+        in0[x] = rnd() & 0xFF;
+        in1[x] = rnd() & 0xFF;
+        in2[x] = rnd() & 0xFF;
+    }
+
+    if (check_func(dsp.filter_line, "idet%d", depth)) {
+        /* Ensure odd tail is handled correctly */
+        int res_ref = call_ref(in0, in1, in2, WIDTH - 8);
+        int res_new = call_new(in0, in1, in2, WIDTH - 8);
+        if (res_ref != res_new) {
+            fprintf(stderr, "idet%d: result mismatch: %u != %u\n",
+                    depth, res_ref, res_new);
+            fail();
+        }
+        bench_new(in0, in1, in2, WIDTH);
+    }
+}
+
+void checkasm_check_idet(void)
+{
+    check_idet(8);
+    report("idet8");
+
+    check_idet(16);
+    report("idet16");
+}

commit 326abf359f72c0daf74c332bc05c65d7b3a5da0b
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Sep 16 14:23:31 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/vf_idetdsp: use consistent uint8_t pointer type
    
    Even for 16-bit DSP functions. Instead, cast the pointer inside the
    function.

diff --git a/libavfilter/vf_idetdsp.c b/libavfilter/vf_idetdsp.c
index b6a095bcd8..68a2a267d4 100644
--- a/libavfilter/vf_idetdsp.c
+++ b/libavfilter/vf_idetdsp.c
@@ -36,13 +36,17 @@ int ff_idet_filter_line_c(const uint8_t *a, const uint8_t 
*b, const uint8_t *c,
     return ret;
 }
 
-int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const 
uint16_t *c, int w)
+int ff_idet_filter_line_c_16bit(const uint8_t *a, const uint8_t *b, const 
uint8_t *c, int w)
 {
     int x;
     int ret=0;
 
+    const uint16_t *a16 = (const uint16_t *) a;
+    const uint16_t *b16 = (const uint16_t *) b;
+    const uint16_t *c16 = (const uint16_t *) c;
+
     for(x=0; x<w; x++){
-        int v = (*a++ + *c++) - 2 * *b++;
+        int v = (*a16++ + *c16++) - 2 * *b16++;
         ret += FFABS(v);
     }
 
@@ -51,7 +55,7 @@ int ff_idet_filter_line_c_16bit(const uint16_t *a, const 
uint16_t *b, const uint
 
 void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int depth)
 {
-    dsp->filter_line = depth > 8 ? 
(ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+    dsp->filter_line = depth > 8 ? ff_idet_filter_line_c_16bit : 
ff_idet_filter_line_c;
 #if ARCH_X86
     ff_idet_dsp_init_x86(dsp, depth);
 #endif
diff --git a/libavfilter/vf_idetdsp.h b/libavfilter/vf_idetdsp.h
index d31caa7aa8..174d77c171 100644
--- a/libavfilter/vf_idetdsp.h
+++ b/libavfilter/vf_idetdsp.h
@@ -33,6 +33,6 @@ void ff_idet_dsp_init_x86(IDETDSPContext *idet, int depth);
 
 /* main fall-back for left-over */
 int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t 
*c, int w);
-int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const 
uint16_t *c, int w);
+int ff_idet_filter_line_c_16bit(const uint8_t *a, const uint8_t *b, const 
uint8_t *c, int w);
 
 #endif /* AVFILTER_IDETDSP_H */
diff --git a/libavfilter/x86/vf_idetdsp_init.c 
b/libavfilter/x86/vf_idetdsp_init.c
index 710d97a6b4..e49b01a68c 100644
--- a/libavfilter/x86/vf_idetdsp_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -42,17 +42,20 @@ static int idet_filter_line_##KIND(const uint8_t *a, const 
uint8_t *b,    \
 
 
 #define FUNC_MAIN_DECL_16bit(KIND, SPAN)                                       
\
-int ff_idet_filter_line_16bit_##KIND(const uint16_t *a, const uint16_t *b,     
\
-                                     const uint16_t *c, int w);                
\
-static int idet_filter_line_16bit_##KIND(const uint16_t *a, const uint16_t *b, 
\
-                                         const uint16_t *c, int w) {           
\
+int ff_idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b,       
\
+                                     const uint8_t *c, int w);                 
\
+static int idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b,   
\
+                                         const uint8_t *c, int w) {            
\
     int sum = 0;                                                               
\
     const int left_over = w & (SPAN - 1);                                      
\
-    w -= left_over;                                                            
\
-    if (w > 0)                                                                 
\
-        sum += ff_idet_filter_line_16bit_##KIND(a, b, c, w);                   
\
-    if (left_over > 0)                                                         
\
-        sum += ff_idet_filter_line_c_16bit(a + w, b + w, c + w, left_over);    
\
+    const int w_main = w - left_over;                                          
\
+    const int offset = w_main << 1;                                            
\
+    if (w_main > 0)                                                            
\
+        sum += ff_idet_filter_line_16bit_##KIND(a, b, c, w_main);              
\
+    if (left_over > 0) {                                                       
\
+        sum += ff_idet_filter_line_c_16bit(a + offset, b + offset, c + offset, 
\
+                                           left_over);                         
\
+    }                                                                          
\
     return sum;                                                                
\
 }
 
@@ -66,7 +69,7 @@ av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int 
depth)
     const int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
-        dsp->filter_line = depth > 8 ? 
(ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
+        dsp->filter_line = depth > 8 ? idet_filter_line_16bit_sse2 : 
idet_filter_line_sse2;
     }
 #endif // HAVE_X86ASM
 }

commit 60dbcc5321feace40d80550fde1465788b416df2
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Sep 16 14:17:14 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/vf_idetdsp: pass actual bit depth
    
    More informative and IMO cleaner; some implementations may want to
    differentiate by exact bit depth or support 32 bit down the line.

diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 0667001252..c217021ae9 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -299,7 +299,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
 
     if (!idet->csp) {
         idet->csp = av_pix_fmt_desc_get(link->format);
-        ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth > 8);
+        ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth);
     }
 
     if (idet->analyze_interlaced_flag) {
@@ -429,7 +429,7 @@ static av_cold int init(AVFilterContext *ctx)
     else
         idet->decay_coefficient = PRECISION;
 
-    ff_idet_dsp_init(&idet->dsp, 0);
+    ff_idet_dsp_init(&idet->dsp, 8);
 
     return 0;
 }
diff --git a/libavfilter/vf_idetdsp.c b/libavfilter/vf_idetdsp.c
index 60771677cc..b6a095bcd8 100644
--- a/libavfilter/vf_idetdsp.c
+++ b/libavfilter/vf_idetdsp.c
@@ -49,10 +49,10 @@ int ff_idet_filter_line_c_16bit(const uint16_t *a, const 
uint16_t *b, const uint
     return ret;
 }
 
-void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int for_16b)
+void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int depth)
 {
-    dsp->filter_line = for_16b ? 
(ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+    dsp->filter_line = depth > 8 ? 
(ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
 #if ARCH_X86
-    ff_idet_dsp_init_x86(dsp, for_16b);
+    ff_idet_dsp_init_x86(dsp, depth);
 #endif
 }
diff --git a/libavfilter/vf_idetdsp.h b/libavfilter/vf_idetdsp.h
index 9953d25ef2..d31caa7aa8 100644
--- a/libavfilter/vf_idetdsp.h
+++ b/libavfilter/vf_idetdsp.h
@@ -27,9 +27,9 @@ typedef struct IDETDSPContext {
     ff_idet_filter_func filter_line;
 } IDETDSPContext;
 
-void ff_idet_dsp_init(IDETDSPContext *idet, int for_16b);
+void ff_idet_dsp_init(IDETDSPContext *idet, int depth);
 
-void ff_idet_dsp_init_x86(IDETDSPContext *idet, int for_16b);
+void ff_idet_dsp_init_x86(IDETDSPContext *idet, int depth);
 
 /* main fall-back for left-over */
 int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t 
*c, int w);
diff --git a/libavfilter/x86/vf_idetdsp_init.c 
b/libavfilter/x86/vf_idetdsp_init.c
index b51985004d..710d97a6b4 100644
--- a/libavfilter/x86/vf_idetdsp_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -60,13 +60,13 @@ FUNC_MAIN_DECL(sse2, 16)
 FUNC_MAIN_DECL_16bit(sse2, 8)
 
 #endif
-av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int for_16b)
+av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
 {
 #if HAVE_X86ASM
     const int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
-        dsp->filter_line = for_16b ? 
(ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
+        dsp->filter_line = depth > 8 ? 
(ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
     }
 #endif // HAVE_X86ASM
 }

commit 56bb187ca915642358b8527029139628771837cb
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Sep 15 18:02:56 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/vf_idet: correctly update dsp function on format change
    
    Currently, this never updates on change from high bit depth to low bit 
depth.

diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 7ec8b088be..0667001252 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -297,10 +297,10 @@ static int filter_frame(AVFilterLink *link, AVFrame 
*picref)
     if (!idet->prev)
         return 0;
 
-    if (!idet->csp)
+    if (!idet->csp) {
         idet->csp = av_pix_fmt_desc_get(link->format);
-    if (idet->csp->comp[0].depth > 8)
-        ff_idet_dsp_init(&idet->dsp, 1);
+        ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth > 8);
+    }
 
     if (idet->analyze_interlaced_flag) {
         if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {

commit 2b67137daa488b2de4c86fd025ab9db576a1fb9a
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Sep 15 18:02:16 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/vf_idet: correctly reset pixdesc on format change

diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 74baa20227..7ec8b088be 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -283,6 +283,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
 
         av_frame_free(&idet->cur );
         av_frame_free(&idet->next);
+        idet->csp = NULL;
     }
 
     idet->prev = idet->cur;

commit 5830743363490d39d9f9b4acd4c4aceb73c14d0c
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Sep 16 14:11:21 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/vf_idet: separate DSP parts
    
    To avoid pulling in the entire libavfilter when using the DSP functions
    from checkasm.
    
    The rest of the struct is not needed outside vf_idet.c and was moved there.

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 70b100aff1..1f5de29ba2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -358,7 +358,7 @@ OBJS-$(CONFIG_HYSTERESIS_FILTER)             += 
vf_hysteresis.o framesync.o
 OBJS-$(CONFIG_ICCDETECT_FILTER)              += vf_iccdetect.o fflcms2.o
 OBJS-$(CONFIG_ICCGEN_FILTER)                 += vf_iccgen.o fflcms2.o
 OBJS-$(CONFIG_IDENTITY_FILTER)               += vf_identity.o framesync.o
-OBJS-$(CONFIG_IDET_FILTER)                   += vf_idet.o
+OBJS-$(CONFIG_IDET_FILTER)                   += vf_idet.o vf_idetdsp.o
 OBJS-$(CONFIG_IL_FILTER)                     += vf_il.o
 OBJS-$(CONFIG_INFLATE_FILTER)                += vf_neighbor.o
 OBJS-$(CONFIG_INTERLACE_FILTER)              += vf_tinterlace.o
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 141911e636..74baa20227 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -22,8 +22,57 @@
 
 #include "libavutil/common.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+
 #include "filters.h"
-#include "vf_idet.h"
+#include "vf_idetdsp.h"
+
+typedef enum {
+    TFF,
+    BFF,
+    PROGRESSIVE,
+    UNDETERMINED,
+} Type;
+
+typedef enum {
+    REPEAT_NONE,
+    REPEAT_TOP,
+    REPEAT_BOTTOM,
+} RepeatedField;
+
+typedef struct IDETContext {
+    const AVClass *class;
+    IDETDSPContext dsp;
+
+    float interlace_threshold;
+    float progressive_threshold;
+    float repeat_threshold;
+    float half_life;
+    uint64_t decay_coefficient;
+
+    Type last_type;
+
+    uint64_t repeats[3];
+    uint64_t prestat[4];
+    uint64_t poststat[4];
+    uint64_t total_repeats[3];
+    uint64_t total_prestat[4];
+    uint64_t total_poststat[4];
+
+    #define HIST_SIZE 4
+    uint8_t history[HIST_SIZE];
+
+    AVFrame *cur;
+    AVFrame *next;
+    AVFrame *prev;
+
+    int interlaced_flag_accuracy;
+    int analyze_interlaced_flag;
+    int analyze_interlaced_flag_done;
+
+    const AVPixFmtDescriptor *csp;
+    int eof;
+} IDETContext;
 
 #define OFFSET(x) offsetof(IDETContext, x)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
@@ -83,32 +132,6 @@ static const char *rep2str(RepeatedField repeated_field)
     return NULL;
 }
 
-int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t 
*c, int w)
-{
-    int x;
-    int ret=0;
-
-    for(x=0; x<w; x++){
-        int v = (*a++ + *c++) - 2 * *b++;
-        ret += FFABS(v);
-    }
-
-    return ret;
-}
-
-int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const 
uint16_t *c, int w)
-{
-    int x;
-    int ret=0;
-
-    for(x=0; x<w; x++){
-        int v = (*a++ + *c++) - 2 * *b++;
-        ret += FFABS(v);
-    }
-
-    return ret;
-}
-
 static void filter(AVFilterContext *ctx)
 {
     IDETContext *idet = ctx->priv;
@@ -120,6 +143,7 @@ static void filter(AVFilterContext *ctx)
     RepeatedField repeat;
     int match = 0;
     AVDictionary **metadata = &idet->cur->metadata;
+    ff_idet_filter_func filter_line = idet->dsp.filter_line;
 
     for (i = 0; i < idet->csp->nb_components; i++) {
         int w = idet->cur->width;
@@ -135,10 +159,10 @@ static void filter(AVFilterContext *ctx)
             uint8_t *prev = &idet->prev->data[i][y*refs];
             uint8_t *cur  = &idet->cur ->data[i][y*refs];
             uint8_t *next = &idet->next->data[i][y*refs];
-            alpha[ y   &1] += idet->filter_line(cur-refs, prev, cur+refs, w);
-            alpha[(y^1)&1] += idet->filter_line(cur-refs, next, cur+refs, w);
-            delta          += idet->filter_line(cur-refs,  cur, cur+refs, w);
-            gamma[(y^1)&1] += idet->filter_line(cur     , prev, cur     , w);
+            alpha[ y   &1] += filter_line(cur-refs, prev, cur+refs, w);
+            alpha[(y^1)&1] += filter_line(cur-refs, next, cur+refs, w);
+            delta          += filter_line(cur-refs,  cur, cur+refs, w);
+            gamma[(y^1)&1] += filter_line(cur     , prev, cur     , w);
         }
     }
 
@@ -275,7 +299,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
     if (!idet->csp)
         idet->csp = av_pix_fmt_desc_get(link->format);
     if (idet->csp->comp[0].depth > 8)
-        ff_idet_dsp_init(idet, 1);
+        ff_idet_dsp_init(&idet->dsp, 1);
 
     if (idet->analyze_interlaced_flag) {
         if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
@@ -391,14 +415,6 @@ static const enum AVPixelFormat pix_fmts[] = {
     AV_PIX_FMT_NONE
 };
 
-void ff_idet_dsp_init(IDETContext *idet, int for_16b)
-{
-    idet->filter_line = for_16b ? 
(ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
-#if ARCH_X86
-    ff_idet_init_x86(idet, for_16b);
-#endif
-}
-
 static av_cold int init(AVFilterContext *ctx)
 {
     IDETContext *idet = ctx->priv;
@@ -412,7 +428,7 @@ static av_cold int init(AVFilterContext *ctx)
     else
         idet->decay_coefficient = PRECISION;
 
-    ff_idet_dsp_init(idet, 0);
+    ff_idet_dsp_init(&idet->dsp, 0);
 
     return 0;
 }
diff --git a/libavfilter/vf_idetdsp.c b/libavfilter/vf_idetdsp.c
new file mode 100644
index 0000000000..60771677cc
--- /dev/null
+++ b/libavfilter/vf_idetdsp.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Michael Niedermayer <[email protected]>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <libavutil/attributes.h>
+#include <libavutil/common.h>
+
+#include "vf_idetdsp.h"
+
+int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t 
*c, int w)
+{
+    int x;
+    int ret=0;
+
+    for(x=0; x<w; x++){
+        int v = (*a++ + *c++) - 2 * *b++;
+        ret += FFABS(v);
+    }
+
+    return ret;
+}
+
+int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const 
uint16_t *c, int w)
+{
+    int x;
+    int ret=0;
+
+    for(x=0; x<w; x++){
+        int v = (*a++ + *c++) - 2 * *b++;
+        ret += FFABS(v);
+    }
+
+    return ret;
+}
+
+void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int for_16b)
+{
+    dsp->filter_line = for_16b ? 
(ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+#if ARCH_X86
+    ff_idet_dsp_init_x86(dsp, for_16b);
+#endif
+}
diff --git a/libavfilter/vf_idet.h b/libavfilter/vf_idetdsp.h
similarity index 51%
rename from libavfilter/vf_idet.h
rename to libavfilter/vf_idetdsp.h
index 9351c70cf9..9953d25ef2 100644
--- a/libavfilter/vf_idet.h
+++ b/libavfilter/vf_idetdsp.h
@@ -16,67 +16,23 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVFILTER_IDET_H
-#define AVFILTER_IDET_H
+#ifndef AVFILTER_IDETDSP_H
+#define AVFILTER_IDETDSP_H
 
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-
-#define HIST_SIZE 4
+#include <stdint.h>
 
 typedef int (*ff_idet_filter_func)(const uint8_t *a, const uint8_t *b, const 
uint8_t *c, int w);
 
-typedef enum {
-    TFF,
-    BFF,
-    PROGRESSIVE,
-    UNDETERMINED,
-} Type;
-
-typedef enum {
-    REPEAT_NONE,
-    REPEAT_TOP,
-    REPEAT_BOTTOM,
-} RepeatedField;
-
-typedef struct IDETContext {
-    const AVClass *class;
-    float interlace_threshold;
-    float progressive_threshold;
-    float repeat_threshold;
-    float half_life;
-    uint64_t decay_coefficient;
-
-    Type last_type;
-
-    uint64_t repeats[3];
-    uint64_t prestat[4];
-    uint64_t poststat[4];
-    uint64_t total_repeats[3];
-    uint64_t total_prestat[4];
-    uint64_t total_poststat[4];
-
-    uint8_t history[HIST_SIZE];
-
-    AVFrame *cur;
-    AVFrame *next;
-    AVFrame *prev;
+typedef struct IDETDSPContext {
     ff_idet_filter_func filter_line;
+} IDETDSPContext;
 
-    int interlaced_flag_accuracy;
-    int analyze_interlaced_flag;
-    int analyze_interlaced_flag_done;
-
-    const AVPixFmtDescriptor *csp;
-    int eof;
-} IDETContext;
-
-void ff_idet_dsp_init(IDETContext *idet, int for_16b);
+void ff_idet_dsp_init(IDETDSPContext *idet, int for_16b);
 
-void ff_idet_init_x86(IDETContext *idet, int for_16b);
+void ff_idet_dsp_init_x86(IDETDSPContext *idet, int for_16b);
 
 /* main fall-back for left-over */
 int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t 
*c, int w);
 int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const 
uint16_t *c, int w);
 
-#endif
+#endif /* AVFILTER_IDETDSP_H */
diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
index 0e531a9b41..b485c10fbe 100644
--- a/libavfilter/x86/Makefile
+++ b/libavfilter/x86/Makefile
@@ -18,7 +18,7 @@ OBJS-$(CONFIG_FRAMERATE_FILTER)              += 
x86/vf_framerate_init.o
 OBJS-$(CONFIG_HALDCLUT_FILTER)               += x86/vf_lut3d_init.o
 OBJS-$(CONFIG_HFLIP_FILTER)                  += x86/vf_hflip_init.o
 OBJS-$(CONFIG_HQDN3D_FILTER)                 += x86/vf_hqdn3d_init.o
-OBJS-$(CONFIG_IDET_FILTER)                   += x86/vf_idet_init.o
+OBJS-$(CONFIG_IDET_FILTER)                   += x86/vf_idetdsp_init.o
 OBJS-$(CONFIG_INTERLACE_FILTER)              += x86/vf_tinterlace_init.o
 OBJS-$(CONFIG_LIMITER_FILTER)                += x86/vf_limiter_init.o
 OBJS-$(CONFIG_LUT3D_FILTER)                  += x86/vf_lut3d_init.o
@@ -66,7 +66,7 @@ X86ASM-OBJS-$(CONFIG_GRADFUN_FILTER)         += 
x86/vf_gradfun.o
 X86ASM-OBJS-$(CONFIG_HALDCLUT_FILTER)        += x86/vf_lut3d.o
 X86ASM-OBJS-$(CONFIG_HFLIP_FILTER)           += x86/vf_hflip.o
 X86ASM-OBJS-$(CONFIG_HQDN3D_FILTER)          += x86/vf_hqdn3d.o
-X86ASM-OBJS-$(CONFIG_IDET_FILTER)            += x86/vf_idet.o
+X86ASM-OBJS-$(CONFIG_IDET_FILTER)            += x86/vf_idetdsp.o
 X86ASM-OBJS-$(CONFIG_INTERLACE_FILTER)       += x86/vf_interlace.o
 X86ASM-OBJS-$(CONFIG_LIMITER_FILTER)         += x86/vf_limiter.o
 X86ASM-OBJS-$(CONFIG_LUT3D_FILTER)           += x86/vf_lut3d.o
diff --git a/libavfilter/x86/vf_idet.asm b/libavfilter/x86/vf_idetdsp.asm
similarity index 100%
rename from libavfilter/x86/vf_idet.asm
rename to libavfilter/x86/vf_idetdsp.asm
diff --git a/libavfilter/x86/vf_idet_init.c b/libavfilter/x86/vf_idetdsp_init.c
similarity index 93%
rename from libavfilter/x86/vf_idet_init.c
rename to libavfilter/x86/vf_idetdsp_init.c
index acb4e2a778..b51985004d 100644
--- a/libavfilter/x86/vf_idet_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -20,7 +20,7 @@
 #include "libavutil/cpu.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
-#include "libavfilter/vf_idet.h"
+#include "libavfilter/vf_idetdsp.h"
 
 #if HAVE_X86ASM
 
@@ -60,13 +60,13 @@ FUNC_MAIN_DECL(sse2, 16)
 FUNC_MAIN_DECL_16bit(sse2, 8)
 
 #endif
-av_cold void ff_idet_init_x86(IDETContext *idet, int for_16b)
+av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int for_16b)
 {
 #if HAVE_X86ASM
     const int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
-        idet->filter_line = for_16b ? 
(ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
+        dsp->filter_line = for_16b ? 
(ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
     }
 #endif // HAVE_X86ASM
 }

commit 367febc491bceaf9aa95ba5fb9c2ca9b38f9208d
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Sep 15 17:56:51 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Sep 21 11:02:41 2025 +0000

    avfilter/vf_idet: expose DSP init function internally
    
    For checkasm.

diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 445ecc203a..141911e636 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -274,12 +274,8 @@ static int filter_frame(AVFilterLink *link, AVFrame 
*picref)
 
     if (!idet->csp)
         idet->csp = av_pix_fmt_desc_get(link->format);
-    if (idet->csp->comp[0].depth > 8){
-        idet->filter_line = (ff_idet_filter_func)ff_idet_filter_line_c_16bit;
-#if ARCH_X86
-        ff_idet_init_x86(idet, 1);
-#endif
-    }
+    if (idet->csp->comp[0].depth > 8)
+        ff_idet_dsp_init(idet, 1);
 
     if (idet->analyze_interlaced_flag) {
         if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
@@ -395,6 +391,14 @@ static const enum AVPixelFormat pix_fmts[] = {
     AV_PIX_FMT_NONE
 };
 
+void ff_idet_dsp_init(IDETContext *idet, int for_16b)
+{
+    idet->filter_line = for_16b ? 
(ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+#if ARCH_X86
+    ff_idet_init_x86(idet, for_16b);
+#endif
+}
+
 static av_cold int init(AVFilterContext *ctx)
 {
     IDETContext *idet = ctx->priv;
@@ -408,11 +412,7 @@ static av_cold int init(AVFilterContext *ctx)
     else
         idet->decay_coefficient = PRECISION;
 
-    idet->filter_line = ff_idet_filter_line_c;
-
-#if ARCH_X86
-    ff_idet_init_x86(idet, 0);
-#endif
+    ff_idet_dsp_init(idet, 0);
 
     return 0;
 }
diff --git a/libavfilter/vf_idet.h b/libavfilter/vf_idet.h
index afd8947055..9351c70cf9 100644
--- a/libavfilter/vf_idet.h
+++ b/libavfilter/vf_idet.h
@@ -71,6 +71,8 @@ typedef struct IDETContext {
     int eof;
 } IDETContext;
 
+void ff_idet_dsp_init(IDETContext *idet, int for_16b);
+
 void ff_idet_init_x86(IDETContext *idet, int for_16b);
 
 /* main fall-back for left-over */

-----------------------------------------------------------------------

Summary of changes:
 libavfilter/Makefile                               |   2 +-
 libavfilter/vf_idet.c                              | 101 ++++++++++++---------
 libavfilter/vf_idet.h                              |  80 ----------------
 libavfilter/vf_idetdsp.c                           |  62 +++++++++++++
 .../float_dsp_arm.h => libavfilter/vf_idetdsp.h    |  25 +++--
 libavfilter/x86/Makefile                           |   4 +-
 libavfilter/x86/{vf_idet.asm => vf_idetdsp.asm}    |  44 +++++++--
 .../x86/{vf_idet_init.c => vf_idetdsp_init.c}      |  39 +++++---
 tests/checkasm/Makefile                            |   1 +
 tests/checkasm/checkasm.c                          |   3 +
 tests/checkasm/checkasm.h                          |   1 +
 tests/checkasm/vf_idet.c                           |  65 +++++++++++++
 12 files changed, 274 insertions(+), 153 deletions(-)
 delete mode 100644 libavfilter/vf_idet.h
 create mode 100644 libavfilter/vf_idetdsp.c
 copy libavutil/arm/float_dsp_arm.h => libavfilter/vf_idetdsp.h (57%)
 rename libavfilter/x86/{vf_idet.asm => vf_idetdsp.asm} (83%)
 rename libavfilter/x86/{vf_idet_init.c => vf_idetdsp_init.c} (63%)
 create mode 100644 tests/checkasm/vf_idet.c


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to