From 3ab9a2a5577d445252724af4067d2a7c8a378efa Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 16 Feb 2012 22:04:14 -0800 Subject: 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. --- 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(-) (limited to 'libavcodec') diff --git a/libavcodec/arm/rv34dsp_init_neon.c b/libavcodec/arm/rv34dsp_init_neon.c index 744818cee3..b4a2f01f95 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 898b841344..650ef61878 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 e2251773af..ce5be93894 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 fe8fcaa8dd..c70194cc20 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 909ccd1732..c12958a89c 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 f3d2e172e7..38831255c9 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 3d6c6f0fa0..79c70f78c3 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) -- cgit v1.2.1