[FFmpeg-cvslog] dsputil: fixup half a dozen bugs with ptrdiff vs int linesize

Michael Niedermayer git at videolan.org
Wed Feb 6 13:22:44 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Feb  6 13:16:31 2013 +0100| [0ddca7d416cc8b80d9943405d6d0bb39bc2dec06] | committer: Michael Niedermayer

dsputil: fixup half a dozen bugs with ptrdiff vs int linesize

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ddca7d416cc8b80d9943405d6d0bb39bc2dec06
---

 libavcodec/dsputil.h          |    2 +-
 libavcodec/dsputil_template.c |    2 +-
 libavcodec/hpel_template.c    |    6 +++---
 libavcodec/snow.c             |    2 +-
 libavcodec/vc1dsp.h           |    6 ++++--
 libavcodec/x86/dsputil_mmx.c  |    4 ++--
 6 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 4fea90f..f0158cd 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -170,7 +170,7 @@ DEF_OLD_QPEL(qpel8_mc13_old_c)
 DEF_OLD_QPEL(qpel8_mc33_old_c)
 
 #define CALL_2X_PIXELS(a, b, n)\
-static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
+static void a(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
     b(block  , pixels  , line_size, h);\
     b(block+n, pixels+n, line_size, h);\
 }
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index ceaebea..201aa55 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -361,7 +361,7 @@ static inline void FUNCC(OPNAME ## _pixels4_xy2)(uint8_t *block, const uint8_t *
         }\
 }\
 \
-static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
+static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\
 {\
     /* FIXME HIGH BIT DEPTH */\
     int j;\
diff --git a/libavcodec/hpel_template.c b/libavcodec/hpel_template.c
index 67a1bcb..3b46999 100644
--- a/libavcodec/hpel_template.c
+++ b/libavcodec/hpel_template.c
@@ -20,7 +20,7 @@
  */
 
 #define DEF_HPEL(OPNAME, OP) \
-static inline void FUNCC(OPNAME ## _pixels2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
+static inline void FUNCC(OPNAME ## _pixels2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
     int i;\
     for(i=0; i<h; i++){\
         OP(*((pixel2*)(block  )), AV_RN2P(pixels  ));\
@@ -28,7 +28,7 @@ static inline void FUNCC(OPNAME ## _pixels2)(uint8_t *block, const uint8_t *pixe
         block +=line_size;\
     }\
 }\
-static inline void FUNCC(OPNAME ## _pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
+static inline void FUNCC(OPNAME ## _pixels4)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
     int i;\
     for(i=0; i<h; i++){\
         OP(*((pixel4*)(block  )), AV_RN4P(pixels  ));\
@@ -36,7 +36,7 @@ static inline void FUNCC(OPNAME ## _pixels4)(uint8_t *block, const uint8_t *pixe
         block +=line_size;\
     }\
 }\
-static inline void FUNCC(OPNAME ## _pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
+static inline void FUNCC(OPNAME ## _pixels8)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
     int i;\
     for(i=0; i<h; i++){\
         OP(*((pixel4*)(block                )), AV_RN4P(pixels                ));\
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 643747d..7a5c1c0 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -378,7 +378,7 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
 }
 
 #define mca(dx,dy,b_w)\
-static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src, int stride, int h){\
+static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int h){\
     av_assert2(h==b_w);\
     mc_block(NULL, dst, src-(HTAPS_MAX/2-1)-(HTAPS_MAX/2-1)*stride, stride, b_w, b_w, dx, dy);\
 }
diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h
index 901e46a..1d4c813 100644
--- a/libavcodec/vc1dsp.h
+++ b/libavcodec/vc1dsp.h
@@ -30,6 +30,8 @@
 
 #include "dsputil.h"
 
+typedef void (*vc1op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
+
 typedef struct VC1DSPContext {
     /* vc1 functions */
     void (*vc1_inv_trans_8x8)(int16_t *b);
@@ -54,8 +56,8 @@ typedef struct VC1DSPContext {
     /* put 8x8 block with bicubic interpolation and quarterpel precision
      * last argument is actually round value instead of height
      */
-    op_pixels_func put_vc1_mspel_pixels_tab[16];
-    op_pixels_func avg_vc1_mspel_pixels_tab[16];
+    vc1op_pixels_func put_vc1_mspel_pixels_tab[16];
+    vc1op_pixels_func avg_vc1_mspel_pixels_tab[16];
 
     /* This is really one func used in VC-1 decoding */
     h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3];
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 271d2b3..0db4143 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -468,7 +468,7 @@ void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels,
 }
 
 static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels,
-                            int line_size, int h)
+                            ptrdiff_t line_size, int h)
 {
     __asm__ volatile (
         "lea   (%3, %3), %%"REG_a"      \n\t"
@@ -495,7 +495,7 @@ static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels,
 }
 
 static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels,
-                             int line_size, int h)
+                             ptrdiff_t line_size, int h)
 {
     __asm__ volatile (
         "lea   (%3, %3), %%"REG_a"      \n\t"



More information about the ffmpeg-cvslog mailing list