[FFmpeg-devel] [PATCH] avcodec/h264: Use ptrdiff_t for (bi)width functions

Michael Niedermayer michael at niedermayer.cc
Wed Sep 21 04:34:51 EEST 2016


Might fix some mysterious asm related issues like Ticket5579

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/h264dsp.h           |  5 +++--
 libavcodec/h264dsp_template.c  |  4 ++--
 libavcodec/mips/h264dsp_mips.h | 26 +++++++++++++-------------
 libavcodec/mips/h264dsp_mmi.c  | 12 ++++++------
 libavcodec/x86/h264dsp_init.c  |  8 ++++----
 5 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
index 7f24376..bcd76ab 100644
--- a/libavcodec/h264dsp.h
+++ b/libavcodec/h264dsp.h
@@ -28,11 +28,12 @@
 #define AVCODEC_H264DSP_H
 
 #include <stdint.h>
+#include <stddef.h>
 
-typedef void (*h264_weight_func)(uint8_t *block, int stride, int height,
+typedef void (*h264_weight_func)(uint8_t *block, ptrdiff_t stride, int height,
                                  int log2_denom, int weight, int offset);
 typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src,
-                                   int stride, int height, int log2_denom,
+                                   ptrdiff_t stride, int height, int log2_denom,
                                    int weightd, int weights, int offset);
 
 /**
diff --git a/libavcodec/h264dsp_template.c b/libavcodec/h264dsp_template.c
index d9dcf6b..0288cc7 100644
--- a/libavcodec/h264dsp_template.c
+++ b/libavcodec/h264dsp_template.c
@@ -30,7 +30,7 @@
 #define op_scale1(x)  block[x] = av_clip_pixel( (block[x]*weight + offset) >> log2_denom )
 #define op_scale2(x)  dst[x] = av_clip_pixel( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
 #define H264_WEIGHT(W) \
-static void FUNCC(weight_h264_pixels ## W)(uint8_t *_block, int stride, int height, \
+static void FUNCC(weight_h264_pixels ## W)(uint8_t *_block, ptrdiff_t stride, int height, \
                                            int log2_denom, int weight, int offset) \
 { \
     int y; \
@@ -60,7 +60,7 @@ static void FUNCC(weight_h264_pixels ## W)(uint8_t *_block, int stride, int heig
         op_scale1(15); \
     } \
 } \
-static void FUNCC(biweight_h264_pixels ## W)(uint8_t *_dst, uint8_t *_src, int stride, int height, \
+static void FUNCC(biweight_h264_pixels ## W)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride, int height, \
                                              int log2_denom, int weightd, int weights, int offset) \
 { \
     int y; \
diff --git a/libavcodec/mips/h264dsp_mips.h b/libavcodec/mips/h264dsp_mips.h
index a578457..21b7de0 100644
--- a/libavcodec/mips/h264dsp_mips.h
+++ b/libavcodec/mips/h264dsp_mips.h
@@ -79,19 +79,19 @@ void ff_h264_h_loop_filter_luma_mbaff_intra_msa(uint8_t *src, int stride,
                                                 int alpha, int beta);
 
 void ff_biweight_h264_pixels16_8_msa(uint8_t *dst, uint8_t *src,
-                                     int stride, int height, int log2_denom,
+                                     ptrdiff_t stride, int height, int log2_denom,
                                      int weightd, int weights, int offset);
 void ff_biweight_h264_pixels8_8_msa(uint8_t *dst, uint8_t *src,
-                                    int stride, int height, int log2_denom,
+                                    ptrdiff_t stride, int height, int log2_denom,
                                     int weightd, int weights, int offset);
 void ff_biweight_h264_pixels4_8_msa(uint8_t *dst, uint8_t *src,
-                                    int stride, int height, int log2_denom,
+                                    ptrdiff_t stride, int height, int log2_denom,
                                     int weightd, int weights, int offset);
-void ff_weight_h264_pixels16_8_msa(uint8_t *src, int stride, int height,
+void ff_weight_h264_pixels16_8_msa(uint8_t *src, ptrdiff_t stride, int height,
                                    int log2_denom, int weight, int offset);
-void ff_weight_h264_pixels8_8_msa(uint8_t *src, int stride, int height,
+void ff_weight_h264_pixels8_8_msa(uint8_t *src, ptrdiff_t stride, int height,
                                   int log2_denom, int weight, int offset);
-void ff_weight_h264_pixels4_8_msa(uint8_t *src, int stride, int height,
+void ff_weight_h264_pixels4_8_msa(uint8_t *src, ptrdiff_t stride, int height,
                                   int log2_denom, int weight, int offset);
 
 void ff_put_h264_qpel16_mc00_msa(uint8_t *dst, const uint8_t *src,
@@ -339,23 +339,23 @@ void ff_h264_luma_dc_dequant_idct_8_mmi(int16_t *output, int16_t *input,
 void ff_h264_chroma_dc_dequant_idct_8_mmi(int16_t *block, int qmul);
 void ff_h264_chroma422_dc_dequant_idct_8_mmi(int16_t *block, int qmul);
 
-void ff_h264_weight_pixels16_8_mmi(uint8_t *block, int stride, int height,
+void ff_h264_weight_pixels16_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset);
 void ff_h264_biweight_pixels16_8_mmi(uint8_t *dst, uint8_t *src,
-        int stride, int height, int log2_denom, int weightd, int weights,
+        ptrdiff_t stride, int height, int log2_denom, int weightd, int weights,
         int offset);
-void ff_h264_weight_pixels8_8_mmi(uint8_t *block, int stride, int height,
+void ff_h264_weight_pixels8_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset);
 void ff_h264_biweight_pixels8_8_mmi(uint8_t *dst, uint8_t *src,
-        int stride, int height, int log2_denom, int weightd, int weights,
+        ptrdiff_t stride, int height, int log2_denom, int weightd, int weights,
         int offset);
-void ff_h264_weight_pixels4_8_mmi(uint8_t *block, int stride, int height,
+void ff_h264_weight_pixels4_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset);
 void ff_h264_biweight_pixels4_8_mmi(uint8_t *dst, uint8_t *src,
-        int stride, int height, int log2_denom, int weightd, int weights,
+        ptrdiff_t stride, int height, int log2_denom, int weightd, int weights,
         int offset);
 
-void ff_deblock_v_chroma_8_mmi(uint8_t *pix, int stride, int alpha, int beta,
+void ff_deblock_v_chroma_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta,
         int8_t *tc0);
 void ff_deblock_v_chroma_intra_8_mmi(uint8_t *pix, int stride, int alpha,
         int beta);
diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c
index a62bbab..a550eee 100644
--- a/libavcodec/mips/h264dsp_mmi.c
+++ b/libavcodec/mips/h264dsp_mmi.c
@@ -1152,7 +1152,7 @@ void ff_h264_chroma_dc_dequant_idct_8_mmi(int16_t *block, int qmul)
     block[48]= ((d-b)*qmul) >> 7;
 }
 
-void ff_h264_weight_pixels16_8_mmi(uint8_t *block, int stride, int height,
+void ff_h264_weight_pixels16_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset)
 {
     int y;
@@ -1205,7 +1205,7 @@ void ff_h264_weight_pixels16_8_mmi(uint8_t *block, int stride, int height,
     }
 }
 
-void ff_h264_biweight_pixels16_8_mmi(uint8_t *dst, uint8_t *src, int stride,
+void ff_h264_biweight_pixels16_8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
         int height, int log2_denom, int weightd, int weights, int offset)
 {
     int y;
@@ -1273,7 +1273,7 @@ void ff_h264_biweight_pixels16_8_mmi(uint8_t *dst, uint8_t *src, int stride,
     }
 }
 
-void ff_h264_weight_pixels8_8_mmi(uint8_t *block, int stride, int height,
+void ff_h264_weight_pixels8_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset)
 {
     int y;
@@ -1313,7 +1313,7 @@ void ff_h264_weight_pixels8_8_mmi(uint8_t *block, int stride, int height,
     }
 }
 
-void ff_h264_biweight_pixels8_8_mmi(uint8_t *dst, uint8_t *src, int stride,
+void ff_h264_biweight_pixels8_8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
         int height, int log2_denom, int weightd, int weights, int offset)
 {
     int y;
@@ -1362,7 +1362,7 @@ void ff_h264_biweight_pixels8_8_mmi(uint8_t *dst, uint8_t *src, int stride,
     }
 }
 
-void ff_h264_weight_pixels4_8_mmi(uint8_t *block, int stride, int height,
+void ff_h264_weight_pixels4_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset)
 {
     int y;
@@ -1402,7 +1402,7 @@ void ff_h264_weight_pixels4_8_mmi(uint8_t *block, int stride, int height,
     }
 }
 
-void ff_h264_biweight_pixels4_8_mmi(uint8_t *dst, uint8_t *src, int stride,
+void ff_h264_biweight_pixels4_8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
         int height, int log2_denom, int weightd, int weights, int offset)
 {
     int y;
diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
index c8cd065..d2452c7 100644
--- a/libavcodec/x86/h264dsp_init.c
+++ b/libavcodec/x86/h264dsp_init.c
@@ -157,13 +157,13 @@ LF_IFUNC(v, luma_intra, 10, mmxext)
 /* weighted prediction */
 
 #define H264_WEIGHT(W, OPT)                                             \
-void ff_h264_weight_ ## W ## _ ## OPT(uint8_t *dst, int stride,         \
+void ff_h264_weight_ ## W ## _ ## OPT(uint8_t *dst, ptrdiff_t stride,   \
                                       int height, int log2_denom,       \
                                       int weight, int offset);
 
 #define H264_BIWEIGHT(W, OPT)                                           \
 void ff_h264_biweight_ ## W ## _ ## OPT(uint8_t *dst, uint8_t *src,     \
-                                        int stride, int height,         \
+                                        ptrdiff_t stride, int height,   \
                                         int log2_denom, int weightd,    \
                                         int weights, int offset);
 
@@ -183,7 +183,7 @@ H264_BIWEIGHT_MMX(4)
 
 #define H264_WEIGHT_10(W, DEPTH, OPT)                                   \
 void ff_h264_weight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst,       \
-                                                    int stride,         \
+                                                    ptrdiff_t stride,   \
                                                     int height,         \
                                                     int log2_denom,     \
                                                     int weight,         \
@@ -192,7 +192,7 @@ void ff_h264_weight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst,       \
 #define H264_BIWEIGHT_10(W, DEPTH, OPT)                                 \
 void ff_h264_biweight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst,     \
                                                       uint8_t *src,     \
-                                                      int stride,       \
+                                                      ptrdiff_t stride, \
                                                       int height,       \
                                                       int log2_denom,   \
                                                       int weightd,      \
-- 
2.9.3



More information about the ffmpeg-devel mailing list