[FFmpeg-devel] [PATCH 5/5] avcodec/h264dsp, h264idct: Fix lengths of array parameters

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Aug 6 21:39:27 EEST 2021


Fixes many -Warray-parameter warnings from GCC 11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
If someone has a good name for a macro for "5 * 8" in this context,
I'll use it.

 libavcodec/aarch64/h264dsp_init_aarch64.c |  8 ++++----
 libavcodec/arm/h264dsp_init_arm.c         |  8 ++++----
 libavcodec/h264dsp.h                      |  6 +++---
 libavcodec/h264idct.h                     | 10 +++++-----
 libavcodec/h264idct_template.c            | 15 ++++++++++++---
 libavcodec/mips/h264dsp_mips.h            | 12 ++++++------
 libavcodec/mips/h264dsp_mmi.c             |  7 ++++---
 libavcodec/mips/h264idct_msa.c            |  6 +++---
 libavcodec/ppc/h264dsp.c                  |  6 +++---
 libavcodec/x86/h264dsp_init.c             |  4 ++--
 10 files changed, 46 insertions(+), 36 deletions(-)

diff --git a/libavcodec/aarch64/h264dsp_init_aarch64.c b/libavcodec/aarch64/h264dsp_init_aarch64.c
index d5baccf235..cbaf8d31eb 100644
--- a/libavcodec/aarch64/h264dsp_init_aarch64.c
+++ b/libavcodec/aarch64/h264dsp_init_aarch64.c
@@ -69,19 +69,19 @@ void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
                              int16_t *block, int stride,
-                             const uint8_t nnzc[6*8]);
+                             const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
                                   int16_t *block, int stride,
-                                  const uint8_t nnzc[6*8]);
+                                  const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
                             int16_t *block, int stride,
-                            const uint8_t nnzc[6*8]);
+                            const uint8_t nnzc[15 * 8]);
 
 void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
                              int16_t *block, int stride,
-                             const uint8_t nnzc[6*8]);
+                             const uint8_t nnzc[5 * 8]);
 
 av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth,
                                      const int chroma_format_idc)
diff --git a/libavcodec/arm/h264dsp_init_arm.c b/libavcodec/arm/h264dsp_init_arm.c
index 54e1e38c93..13d499fda2 100644
--- a/libavcodec/arm/h264dsp_init_arm.c
+++ b/libavcodec/arm/h264dsp_init_arm.c
@@ -57,19 +57,19 @@ void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
                              int16_t *block, int stride,
-                             const uint8_t nnzc[6*8]);
+                             const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
                                   int16_t *block, int stride,
-                                  const uint8_t nnzc[6*8]);
+                                  const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
                             int16_t *block, int stride,
-                            const uint8_t nnzc[6*8]);
+                            const uint8_t nnzc[15 * 8]);
 
 void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
                              int16_t *block, int stride,
-                             const uint8_t nnzc[6*8]);
+                             const uint8_t nnzc[5 * 8]);
 
 static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth,
                                       const int chroma_format_idc)
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
index cbea3173c6..850d4471fd 100644
--- a/libavcodec/h264dsp.h
+++ b/libavcodec/h264dsp.h
@@ -89,16 +89,16 @@ typedef struct H264DSPContext {
 
     void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset,
                             int16_t *block /*align 16*/, int stride,
-                            const uint8_t nnzc[15 * 8]);
+                            const uint8_t nnzc[5 * 8]);
     void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset,
                             int16_t *block /*align 16*/, int stride,
-                            const uint8_t nnzc[15 * 8]);
+                            const uint8_t nnzc[5 * 8]);
     void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset,
                            int16_t *block /*align 16*/, int stride,
                            const uint8_t nnzc[15 * 8]);
     void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset,
                                  int16_t *block /*align 16*/,
-                                 int stride, const uint8_t nnzc[15 * 8]);
+                                 int stride, const uint8_t nnzc[5 * 8]);
     void (*h264_luma_dc_dequant_idct)(int16_t *output,
                                       int16_t *input /*align 16*/, int qmul);
     void (*h264_chroma_dc_dequant_idct)(int16_t *block, int qmul);
diff --git a/libavcodec/h264idct.h b/libavcodec/h264idct.h
index 17e0051497..6f18df9e5f 100644
--- a/libavcodec/h264idct.h
+++ b/libavcodec/h264idct.h
@@ -26,11 +26,11 @@ void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride)
 void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
 void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
 void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
-void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
-void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
-void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
-void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
-void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
+void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\
+void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\
+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);
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c
index ce66ed3ab8..ec0b428c27 100644
--- a/libavcodec/h264idct_template.c
+++ b/libavcodec/h264idct_template.c
@@ -171,7 +171,10 @@ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int stride){
     }
 }
 
-void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
+void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset,
+                               int16_t *block, int stride,
+                               const uint8_t nnzc[5 * 8])
+{
     int i;
     for(i=0; i<16; i++){
         int nnz = nnzc[ scan8[i] ];
@@ -182,7 +185,10 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, int16_t *b
     }
 }
 
-void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
+void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset,
+                                    int16_t *block, int stride,
+                                    const uint8_t nnzc[5 * 8])
+{
     int i;
     for(i=0; i<16; i++){
         if(nnzc[ scan8[i] ])             FUNCC(ff_h264_idct_add   )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
@@ -190,7 +196,10 @@ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, int16
     }
 }
 
-void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
+void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset,
+                               int16_t *block, int stride,
+                               const uint8_t nnzc[5 * 8])
+{
     int i;
     for(i=0; i<16; i+=4){
         int nnz = nnzc[ scan8[i] ];
diff --git a/libavcodec/mips/h264dsp_mips.h b/libavcodec/mips/h264dsp_mips.h
index 5847ef36fe..93a201c66a 100644
--- a/libavcodec/mips/h264dsp_mips.h
+++ b/libavcodec/mips/h264dsp_mips.h
@@ -50,10 +50,10 @@ void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src,
                                   int32_t de_q_val);
 void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset,
                             int16_t *block, int32_t stride,
-                            const uint8_t nnzc[15 * 8]);
+                            const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset,
                                   int16_t *block, int32_t dst_stride,
-                                  const uint8_t nnzc[15 * 8]);
+                                  const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset,
                            int16_t *block, int32_t dst_stride,
                            const uint8_t nnzc[15 * 8]);
@@ -65,7 +65,7 @@ void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src,
                                  int32_t dst_stride);
 void ff_h264_idct8_add4_msa(uint8_t *dst, const int *blk_offset,
                             int16_t *blk, int dst_stride,
-                            const uint8_t nnzc[15 * 8]);
+                            const uint8_t nnzc[5 * 8]);
 
 void ff_h264_h_lpf_luma_intra_msa(uint8_t *src, ptrdiff_t stride,
                                   int alpha, int beta);
@@ -329,11 +329,11 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
 void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset,
-        int16_t *block, int stride, const uint8_t nnzc[15*8]);
+        int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset,
-        int16_t *block, int stride, const uint8_t nnzc[15*8]);
+        int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
 void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset,
-        int16_t *block, int stride, const uint8_t nnzc[15*8]);
+        int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
 void ff_h264_idct_add8_8_mmi(uint8_t **dest, const int *block_offset,
         int16_t *block, int stride, const uint8_t nnzc[15*8]);
 void ff_h264_idct_add8_422_8_mmi(uint8_t **dest, const int *block_offset,
diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c
index b5ab07c863..dff3d331b1 100644
--- a/libavcodec/mips/h264dsp_mmi.c
+++ b/libavcodec/mips/h264dsp_mmi.c
@@ -766,7 +766,8 @@ void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
 }
 
 void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset,
-        int16_t *block, int stride, const uint8_t nnzc[15*8])
+                              int16_t *block, int stride,
+                              const uint8_t nnzc[5 * 8])
 {
     int i;
     for(i=0; i<16; i++){
@@ -783,7 +784,7 @@ void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset,
 }
 
 void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset,
-        int16_t *block, int stride, const uint8_t nnzc[15*8])
+        int16_t *block, int stride, const uint8_t nnzc[5 * 8])
 {
     int i;
     for(i=0; i<16; i++){
@@ -796,7 +797,7 @@ void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset,
 }
 
 void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset,
-        int16_t *block, int stride, const uint8_t nnzc[15*8])
+        int16_t *block, int stride, const uint8_t nnzc[5 * 8])
 {
     int i;
     for(i=0; i<16; i+=4){
diff --git a/libavcodec/mips/h264idct_msa.c b/libavcodec/mips/h264idct_msa.c
index fbf7795e27..1a20a3e30e 100644
--- a/libavcodec/mips/h264idct_msa.c
+++ b/libavcodec/mips/h264idct_msa.c
@@ -347,7 +347,7 @@ void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src,
 void ff_h264_idct_add16_msa(uint8_t *dst,
                             const int32_t *blk_offset,
                             int16_t *block, int32_t dst_stride,
-                            const uint8_t nzc[15 * 8])
+                            const uint8_t nzc[5 * 8])
 {
     int32_t i;
 
@@ -369,7 +369,7 @@ void ff_h264_idct_add16_msa(uint8_t *dst,
 
 void ff_h264_idct8_add4_msa(uint8_t *dst, const int32_t *blk_offset,
                             int16_t *block, int32_t dst_stride,
-                            const uint8_t nzc[15 * 8])
+                            const uint8_t nzc[5 * 8])
 {
     int32_t cnt;
 
@@ -448,7 +448,7 @@ void ff_h264_idct_add16_intra_msa(uint8_t *dst,
                                   const int32_t *blk_offset,
                                   int16_t *block,
                                   int32_t dst_stride,
-                                  const uint8_t nzc[15 * 8])
+                                  const uint8_t nzc[5 * 8])
 {
     int32_t i;
 
diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c
index 779092fd76..c02733dda2 100644
--- a/libavcodec/ppc/h264dsp.c
+++ b/libavcodec/ppc/h264dsp.c
@@ -328,7 +328,7 @@ static void h264_idct8_dc_add_altivec(uint8_t *dst, int16_t *block, int stride)
 
 static void h264_idct_add16_altivec(uint8_t *dst, const int *block_offset,
                                     int16_t *block, int stride,
-                                    const uint8_t nnzc[15 * 8])
+                                    const uint8_t nnzc[5 * 8])
 {
     int i;
     for(i=0; i<16; i++){
@@ -342,7 +342,7 @@ static void h264_idct_add16_altivec(uint8_t *dst, const int *block_offset,
 
 static void h264_idct_add16intra_altivec(uint8_t *dst, const int *block_offset,
                                          int16_t *block, int stride,
-                                         const uint8_t nnzc[15 * 8])
+                                         const uint8_t nnzc[5 * 8])
 {
     int i;
     for(i=0; i<16; i++){
@@ -353,7 +353,7 @@ static void h264_idct_add16intra_altivec(uint8_t *dst, const int *block_offset,
 
 static void h264_idct8_add4_altivec(uint8_t *dst, const int *block_offset,
                                     int16_t *block, int stride,
-                                    const uint8_t nnzc[15 * 8])
+                                    const uint8_t nnzc[5 * 8])
 {
     int i;
     for(i=0; i<16; i+=4){
diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
index 08eb7ead44..c9a96c7dca 100644
--- a/libavcodec/x86/h264dsp_init.c
+++ b/libavcodec/x86/h264dsp_init.c
@@ -52,7 +52,7 @@ IDCT_ADD_FUNC(8, 10, avx)
 #define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT)                         \
 void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT       \
     (uint8_t *dst, const int *block_offset,                             \
-     int16_t *block, int stride, const uint8_t nnzc[6 * 8]);
+     int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
 
 IDCT_ADD_REP_FUNC(8, 4, 8, mmx)
 IDCT_ADD_REP_FUNC(8, 4, 8, mmxext)
@@ -74,7 +74,7 @@ IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
 #define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT)                      \
 void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT     \
     (uint8_t **dst, const int *block_offset,                          \
-     int16_t *block, int stride, const uint8_t nnzc[6 * 8]);
+     int16_t *block, int stride, const uint8_t nnzc[15 * 8]);
 
 IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
 IDCT_ADD_REP_FUNC2(, 8, 8, mmxext)
-- 
2.30.2



More information about the ffmpeg-devel mailing list