The branch, master has been updated
       via  2452b81769b921ad4221bd24efbcfdbac22215ad (commit)
       via  1fafb13cd4229d544c0e3e0bb66b8d0c5d176fbf (commit)
      from  f39884b3fd0aaa57b8d5359a57304566b6a5587c (commit)


- Log -----------------------------------------------------------------
commit 2452b81769b921ad4221bd24efbcfdbac22215ad
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sun Nov 9 14:41:16 2025 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Wed Nov 12 14:50:46 2025 +0100

    avcodec/h264idct_template: Deduplicate h264_{luma,chroma}_dc_dequant_idct
    
    All the high bit depth functions of these types are identical.
    
    Reviewed-by: Kacper Michajłow <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>

diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
index 1ba936be1c..8a6a3f5325 100644
--- a/libavcodec/h264dsp.c
+++ b/libavcodec/h264dsp.c
@@ -69,14 +69,19 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int 
bit_depth,
 #undef FUNC
 #define FUNC(a, depth) a ## _ ## depth ## _c
 
-#define ADDPX_DSP(depth) \
+#define SET_PIXSIZE_FUNCS(depth) \
+    c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\
+    if (chroma_format_idc <= 1)\
+        c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, 
depth);\
+    else\
+        c->h264_chroma_dc_dequant_idct= 
FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\
     c->h264_add_pixels4_clear = FUNC(ff_h264_add_pixels4, depth);\
     c->h264_add_pixels8_clear = FUNC(ff_h264_add_pixels8, depth)
 
     if (bit_depth > 8 && bit_depth <= 16) {
-        ADDPX_DSP(16);
+        SET_PIXSIZE_FUNCS(16);
     } else {
-        ADDPX_DSP(8);
+        SET_PIXSIZE_FUNCS(8);
     }
 
 #define H264_DSP(depth) \
@@ -91,11 +96,6 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int 
bit_depth,
     else\
         c->h264_idct_add8  = FUNC(ff_h264_idct_add8_422, depth);\
     c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\
-    c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\
-    if (chroma_format_idc <= 1)\
-        c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, 
depth);\
-    else\
-        c->h264_chroma_dc_dequant_idct= 
FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\
 \
     c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\
     c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\
diff --git a/libavcodec/h264idct.h b/libavcodec/h264idct.h
index 6f18df9e5f..42e93ed17a 100644
--- a/libavcodec/h264idct.h
+++ b/libavcodec/h264idct.h
@@ -31,9 +31,6 @@ void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, 
const int *blockoffse
 void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, 
int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\
 void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int 
*blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\
 void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, 
int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\
-void ff_h264_luma_dc_dequant_idct_ ## depth ## _c(int16_t *output, int16_t 
*input, int qmul);\
-void ff_h264_chroma422_dc_dequant_idct_ ## depth ## _c(int16_t *block, int 
qmul);\
-void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul);
 
 H264_IDCT( 8)
 H264_IDCT( 9)
@@ -41,4 +38,12 @@ H264_IDCT(10)
 H264_IDCT(12)
 H264_IDCT(14)
 
+#define H264_IDCT2(pixsize) \
+void ff_h264_luma_dc_dequant_idct_ ## pixsize ## _c(int16_t *output, int16_t 
*input, int qmul);\
+void ff_h264_chroma422_dc_dequant_idct_ ## pixsize ## _c(int16_t *block, int 
qmul);\
+void ff_h264_chroma_dc_dequant_idct_ ## pixsize ## _c(int16_t *block, int 
qmul);
+
+H264_IDCT2( 8)
+H264_IDCT2(16)
+
 #endif /* AVCODEC_H264IDCT_H */
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c
index db19b5f9fb..64f5faddca 100644
--- a/libavcodec/h264idct_template.c
+++ b/libavcodec/h264idct_template.c
@@ -244,11 +244,13 @@ void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const 
int *block_offset, int16
     }
 }
 
+#if BIT_DEPTH == 8 || BIT_DEPTH == 9
 /**
  * IDCT transforms the 16 dc values and dequantizes them.
  * @param qmul quantization parameter
  */
-void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, 
int qmul){
+void FUNCC2(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, 
int qmul)
+{
 #define stride 16
     int i;
     int temp[16];
@@ -283,7 +285,8 @@ void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, 
int16_t *_input, int
 #undef stride
 }
 
-void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){
+void FUNCC2(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul)
+{
     const int stride= 16*2;
     const int xStride= 16;
     int i;
@@ -310,7 +313,8 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t 
*_block, int qmul){
     }
 }
 
-void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){
+void FUNCC2(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul)
+{
     const int stride= 16*2;
     const int xStride= 16;
     SUINT a,b,c,d,e;
@@ -331,3 +335,4 @@ void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, 
int qmul){
     block[stride*1 + xStride*0]= (int)((a-c)*qmul) >> 7;
     block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7;
 }
+#endif

commit 1fafb13cd4229d544c0e3e0bb66b8d0c5d176fbf
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sun Nov 9 14:30:00 2025 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Wed Nov 12 14:50:21 2025 +0100

    avcodec/bit_depth_template: Add PIXELSIZE
    
    Sometimes functions for bit depth 9..16 are the same (because they
    actually only depend on the underlying pixel type). The macros added
    here allow to support this usecase.
    
    Reviewed-by: Kacper Michajłow <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>

diff --git a/libavcodec/bit_depth_template.c b/libavcodec/bit_depth_template.c
index ca5037148a..6a80cdaf32 100644
--- a/libavcodec/bit_depth_template.c
+++ b/libavcodec/bit_depth_template.c
@@ -43,11 +43,13 @@
 #   undef FUNCC
 #   undef av_clip_pixel
 #   undef PIXEL_SPLAT_X4
+#   undef PIXELSIZE
 #else
 #   define AVCODEC_BIT_DEPTH_TEMPLATE_C
 #endif
 
 #if BIT_DEPTH > 8
+#   define PIXELSIZE 16
 #   define pixel  uint16_t
 #   define pixel2 uint32_t
 #   define pixel4 uint64_t
@@ -76,6 +78,7 @@
 #   define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH)
 #   define CLIP(a)          av_clip_uintp2(a, BIT_DEPTH)
 #else
+#   define PIXELSIZE 8
 #   define pixel  uint8_t
 #   define pixel2 uint16_t
 #   define pixel4 uint32_t
@@ -100,6 +103,7 @@
 #define FUNC2(a, b, c)  FUNC3(a, b, c)
 #define FUNC(a)  FUNC2(a, BIT_DEPTH,)
 #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
+#define FUNCC2(a) FUNC2(a, PIXELSIZE, _c)
 #define FUNC4(a, b, c)  a ## _int ## b ## _ ## c ## bit
 #define FUNC5(a, b, c)  FUNC4(a, b, c)
 #define FUNC6(a)  FUNC5(a, IN_IDCT_DEPTH, BIT_DEPTH)

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

Summary of changes:
 libavcodec/bit_depth_template.c |  4 ++++
 libavcodec/h264dsp.c            | 16 ++++++++--------
 libavcodec/h264idct.h           | 11 ++++++++---
 libavcodec/h264idct_template.c  | 11 ++++++++---
 4 files changed, 28 insertions(+), 14 deletions(-)


hooks/post-receive
-- 

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

Reply via email to