[FFmpeg-cvslog] rv34: change most "int stride" into "ptrdiff_t stride".

Ronald S. Bultje git at videolan.org
Wed Feb 22 03:01:48 CET 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Thu Feb 16 22:04:14 2012 -0800| [3ab9a2a5577d445252724af4067d2a7c8a378efa] | committer: Ronald S. Bultje

rv34: change most "int stride" into "ptrdiff_t stride".

This prevents having to sign-extend on 64-bit systems with 32-bit ints,
such as x86-64. Also fixes crashes on systems where we don't do it and
arguments are not in registers, such as Win64 for all weight functions.

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

 libavcodec/arm/rv34dsp_init_neon.c |    4 ++--
 libavcodec/arm/rv40dsp_init_neon.c |   12 ++++++------
 libavcodec/rv34dsp.c               |    4 ++--
 libavcodec/rv34dsp.h               |   12 ++++++------
 libavcodec/rv40dsp.c               |   20 ++++++++++----------
 libavcodec/x86/rv34dsp_init.c      |    4 ++--
 libavcodec/x86/rv40dsp_init.c      |    4 ++--
 7 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/libavcodec/arm/rv34dsp_init_neon.c b/libavcodec/arm/rv34dsp_init_neon.c
index 744818c..b4a2f01 100644
--- a/libavcodec/arm/rv34dsp_init_neon.c
+++ b/libavcodec/arm/rv34dsp_init_neon.c
@@ -27,8 +27,8 @@ void ff_rv34_inv_transform_noround_neon(DCTELEM *block);
 
 void ff_rv34_inv_transform_noround_dc_neon(DCTELEM *block);
 
-void ff_rv34_idct_add_neon(uint8_t *dst, int stride, DCTELEM *block);
-void ff_rv34_idct_dc_add_neon(uint8_t *dst, int stride, int dc);
+void ff_rv34_idct_add_neon(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
+void ff_rv34_idct_dc_add_neon(uint8_t *dst, ptrdiff_t stride, int dc);
 
 void ff_rv34dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
 {
diff --git a/libavcodec/arm/rv40dsp_init_neon.c b/libavcodec/arm/rv40dsp_init_neon.c
index 898b841..650ef61 100644
--- a/libavcodec/arm/rv40dsp_init_neon.c
+++ b/libavcodec/arm/rv40dsp_init_neon.c
@@ -51,20 +51,20 @@ void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
 void ff_avg_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
 void ff_avg_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
 
-void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, int);
-void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, int);
+void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t);
+void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t);
 
-int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, int stride,
+int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride,
                                         int beta, int beta2, int edge,
                                         int *p1, int *q1);
-int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, int stride,
+int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride,
                                         int beta, int beta2, int edge,
                                         int *p1, int *q1);
 
-void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, int stride, int filter_p1,
+void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1,
                                      int filter_q1, int alpha, int beta,
                                      int lim_p0q0, int lim_q1, int lim_p1);
-void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, int stride, int filter_p1,
+void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1,
                                      int filter_q1, int alpha, int beta,
                                      int lim_p0q0, int lim_q1, int lim_p1);
 
diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c
index e225177..ce5be93 100644
--- a/libavcodec/rv34dsp.c
+++ b/libavcodec/rv34dsp.c
@@ -53,7 +53,7 @@ static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
  * Real Video 3.0/4.0 inverse transform + sample reconstruction
  * Code is almost the same as in SVQ3, only scaling is different.
  */
-static void rv34_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){
+static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){
     int      temp[16];
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
     int      i;
@@ -101,7 +101,7 @@ static void rv34_inv_transform_noround_c(DCTELEM *block){
     }
 }
 
-static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc)
+static void rv34_idct_dc_add_c(uint8_t *dst, ptrdiff_t stride, int dc)
 {
     const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
     int i, j;
diff --git a/libavcodec/rv34dsp.h b/libavcodec/rv34dsp.h
index fe8fcaa..c70194c 100644
--- a/libavcodec/rv34dsp.h
+++ b/libavcodec/rv34dsp.h
@@ -32,24 +32,24 @@
 typedef void (*rv40_weight_func)(uint8_t *dst/*align width (8 or 16)*/,
                                  uint8_t *src1/*align width (8 or 16)*/,
                                  uint8_t *src2/*align width (8 or 16)*/,
-                                 int w1, int w2, int stride);
+                                 int w1, int w2, ptrdiff_t stride);
 
 typedef void (*rv34_inv_transform_func)(DCTELEM *block);
 
-typedef void (*rv34_idct_add_func)(uint8_t *dst, int stride, DCTELEM *block);
-typedef void (*rv34_idct_dc_add_func)(uint8_t *dst, int stride,
+typedef void (*rv34_idct_add_func)(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
+typedef void (*rv34_idct_dc_add_func)(uint8_t *dst, ptrdiff_t stride,
                                       int   dc);
 
-typedef void (*rv40_weak_loop_filter_func)(uint8_t *src, int stride,
+typedef void (*rv40_weak_loop_filter_func)(uint8_t *src, ptrdiff_t stride,
                                            int filter_p1, int filter_q1,
                                            int alpha, int beta,
                                            int lims, int lim_q1, int lim_p1);
 
-typedef void (*rv40_strong_loop_filter_func)(uint8_t *src, int stride,
+typedef void (*rv40_strong_loop_filter_func)(uint8_t *src, ptrdiff_t stride,
                                              int alpha, int lims,
                                              int dmode, int chroma);
 
-typedef int (*rv40_loop_filter_strength_func)(uint8_t *src, int stride,
+typedef int (*rv40_loop_filter_strength_func)(uint8_t *src, ptrdiff_t stride,
                                               int beta, int beta2, int edge,
                                               int *p1, int *q1);
 
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 909ccd1..c12958a 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -278,7 +278,7 @@ RV40_CHROMA_MC(put_, op_put)
 RV40_CHROMA_MC(avg_, op_avg)
 
 #define RV40_WEIGHT_FUNC(size) \
-static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, int stride)\
+static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, ptrdiff_t stride)\
 {\
     int i, j;\
 \
@@ -316,7 +316,7 @@ static const uint8_t rv40_dither_r[16] = {
  */
 static av_always_inline void rv40_weak_loop_filter(uint8_t *src,
                                                    const int step,
-                                                   const int stride,
+                                                   const ptrdiff_t stride,
                                                    const int filter_p1,
                                                    const int filter_q1,
                                                    const int alpha,
@@ -362,7 +362,7 @@ static av_always_inline void rv40_weak_loop_filter(uint8_t *src,
     }
 }
 
-static void rv40_h_weak_loop_filter(uint8_t *src, const int stride,
+static void rv40_h_weak_loop_filter(uint8_t *src, const ptrdiff_t stride,
                                     const int filter_p1, const int filter_q1,
                                     const int alpha, const int beta,
                                     const int lim_p0q0, const int lim_q1,
@@ -372,7 +372,7 @@ static void rv40_h_weak_loop_filter(uint8_t *src, const int stride,
                           alpha, beta, lim_p0q0, lim_q1, lim_p1);
 }
 
-static void rv40_v_weak_loop_filter(uint8_t *src, const int stride,
+static void rv40_v_weak_loop_filter(uint8_t *src, const ptrdiff_t stride,
                                     const int filter_p1, const int filter_q1,
                                     const int alpha, const int beta,
                                     const int lim_p0q0, const int lim_q1,
@@ -384,7 +384,7 @@ static void rv40_v_weak_loop_filter(uint8_t *src, const int stride,
 
 static av_always_inline void rv40_strong_loop_filter(uint8_t *src,
                                                      const int step,
-                                                     const int stride,
+                                                     const ptrdiff_t stride,
                                                      const int alpha,
                                                      const int lims,
                                                      const int dmode,
@@ -440,14 +440,14 @@ static av_always_inline void rv40_strong_loop_filter(uint8_t *src,
     }
 }
 
-static void rv40_h_strong_loop_filter(uint8_t *src, const int stride,
+static void rv40_h_strong_loop_filter(uint8_t *src, const ptrdiff_t stride,
                                       const int alpha, const int lims,
                                       const int dmode, const int chroma)
 {
     rv40_strong_loop_filter(src, stride, 1, alpha, lims, dmode, chroma);
 }
 
-static void rv40_v_strong_loop_filter(uint8_t *src, const int stride,
+static void rv40_v_strong_loop_filter(uint8_t *src, const ptrdiff_t stride,
                                       const int alpha, const int lims,
                                       const int dmode, const int chroma)
 {
@@ -455,7 +455,7 @@ static void rv40_v_strong_loop_filter(uint8_t *src, const int stride,
 }
 
 static av_always_inline int rv40_loop_filter_strength(uint8_t *src,
-                                                      int step, int stride,
+                                                      int step, ptrdiff_t stride,
                                                       int beta, int beta2,
                                                       int edge,
                                                       int *p1, int *q1)
@@ -490,14 +490,14 @@ static av_always_inline int rv40_loop_filter_strength(uint8_t *src,
     return strong0 && strong1;
 }
 
-static int rv40_h_loop_filter_strength(uint8_t *src, int stride,
+static int rv40_h_loop_filter_strength(uint8_t *src, ptrdiff_t stride,
                                        int beta, int beta2, int edge,
                                        int *p1, int *q1)
 {
     return rv40_loop_filter_strength(src, stride, 1, beta, beta2, edge, p1, q1);
 }
 
-static int rv40_v_loop_filter_strength(uint8_t *src, int stride,
+static int rv40_v_loop_filter_strength(uint8_t *src, ptrdiff_t stride,
                                        int beta, int beta2, int edge,
                                        int *p1, int *q1)
 {
diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c
index f3d2e17..3883125 100644
--- a/libavcodec/x86/rv34dsp_init.c
+++ b/libavcodec/x86/rv34dsp_init.c
@@ -26,8 +26,8 @@
 
 void ff_rv34_idct_dc_mmx2(DCTELEM *block);
 void ff_rv34_idct_dc_noround_mmx2(DCTELEM *block);
-void ff_rv34_idct_dc_add_mmx(uint8_t *dst, int stride, int dc);
-void ff_rv34_idct_dc_add_sse4(uint8_t *dst, int stride, int dc);
+void ff_rv34_idct_dc_add_mmx(uint8_t *dst, ptrdiff_t stride, int dc);
+void ff_rv34_idct_dc_add_sse4(uint8_t *dst, ptrdiff_t stride, int dc);
 
 av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp)
 {
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index 3d6c6f0..79c70f7 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -42,9 +42,9 @@ void ff_avg_rv40_chroma_mc4_3dnow(uint8_t *dst, uint8_t *src,
 
 #define DECLARE_WEIGHT(opt) \
 void ff_rv40_weight_func_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
-                                  int w1, int w2, int stride); \
+                                  int w1, int w2, ptrdiff_t stride); \
 void ff_rv40_weight_func_8_##opt (uint8_t *dst, uint8_t *src1, uint8_t *src2, \
-                                  int w1, int w2, int stride);
+                                  int w1, int w2, ptrdiff_t stride);
 DECLARE_WEIGHT(mmx)
 DECLARE_WEIGHT(sse2)
 DECLARE_WEIGHT(ssse3)



More information about the ffmpeg-cvslog mailing list