Commit f81be06c authored by Diego Biurrun's avatar Diego Biurrun

cavs: Change type of stride parameters to ptrdiff_t

ptrdiff_t is the correct type for array strides and similar.
parent 802727b5
......@@ -246,7 +246,7 @@ void ff_cavs_load_intra_pred_chroma(AVSContext *h)
}
}
static void intra_pred_vert(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_vert(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int y;
uint64_t a = AV_RN64(&top[1]);
......@@ -254,7 +254,7 @@ static void intra_pred_vert(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
*((uint64_t *)(d + y * stride)) = a;
}
static void intra_pred_horiz(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_horiz(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int y;
uint64_t a;
......@@ -264,7 +264,7 @@ static void intra_pred_horiz(uint8_t *d, uint8_t *top, uint8_t *left, int stride
}
}
static void intra_pred_dc_128(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_dc_128(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int y;
uint64_t a = 0x8080808080808080ULL;
......@@ -272,7 +272,7 @@ static void intra_pred_dc_128(uint8_t *d, uint8_t *top, uint8_t *left, int strid
*((uint64_t *)(d + y * stride)) = a;
}
static void intra_pred_plane(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_plane(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int x, y, ia;
int ih = 0;
......@@ -294,7 +294,7 @@ static void intra_pred_plane(uint8_t *d, uint8_t *top, uint8_t *left, int stride
#define LOWPASS(ARRAY, INDEX) \
((ARRAY[(INDEX) - 1] + 2 * ARRAY[(INDEX)] + ARRAY[(INDEX) + 1] + 2) >> 2)
static void intra_pred_lp(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_lp(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++)
......@@ -302,7 +302,7 @@ static void intra_pred_lp(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
d[y * stride + x] = (LOWPASS(top, x + 1) + LOWPASS(left, y + 1)) >> 1;
}
static void intra_pred_down_left(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_down_left(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++)
......@@ -310,7 +310,7 @@ static void intra_pred_down_left(uint8_t *d, uint8_t *top, uint8_t *left, int st
d[y * stride + x] = (LOWPASS(top, x + y + 2) + LOWPASS(left, x + y + 2)) >> 1;
}
static void intra_pred_down_right(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_down_right(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++)
......@@ -323,7 +323,7 @@ static void intra_pred_down_right(uint8_t *d, uint8_t *top, uint8_t *left, int s
d[y * stride + x] = LOWPASS(left, y - x);
}
static void intra_pred_lp_left(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_lp_left(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++)
......@@ -331,7 +331,7 @@ static void intra_pred_lp_left(uint8_t *d, uint8_t *top, uint8_t *left, int stri
d[y * stride + x] = LOWPASS(left, y + 1);
}
static void intra_pred_lp_top(uint8_t *d, uint8_t *top, uint8_t *left, int stride)
static void intra_pred_lp_top(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++)
......
......@@ -226,8 +226,8 @@ typedef struct AVSContext {
uint8_t intern_border_y[26];
uint8_t topleft_border_y, topleft_border_u, topleft_border_v;
void (*intra_pred_l[8])(uint8_t *d,uint8_t *top,uint8_t *left,int stride);
void (*intra_pred_c[7])(uint8_t *d,uint8_t *top,uint8_t *left,int stride);
void (*intra_pred_l[8])(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride);
void (*intra_pred_c[7])(uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride);
uint8_t *col_type_base;
/* scaling factors for MV prediction */
......
......@@ -547,7 +547,7 @@ static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
*/
static int decode_residual_block(AVSContext *h, GetBitContext *gb,
const struct dec_2dvlc *r, int esc_golomb_order,
int qp, uint8_t *dst, int stride)
int qp, uint8_t *dst, ptrdiff_t stride)
{
int i, level_code, esc_code, level, run, mask, ret;
int16_t level_buf[65];
......
......@@ -42,7 +42,8 @@
#define Q1 p0_p[ 1*stride]
#define Q2 p0_p[ 2*stride]
static inline void loop_filter_l2(uint8_t *p0_p,int stride,int alpha, int beta) {
static inline void loop_filter_l2(uint8_t *p0_p, ptrdiff_t stride, int alpha, int beta)
{
int p0 = P0;
int q0 = Q0;
......@@ -62,7 +63,8 @@ static inline void loop_filter_l2(uint8_t *p0_p,int stride,int alpha, int beta)
}
}
static inline void loop_filter_l1(uint8_t *p0_p, int stride, int alpha, int beta, int tc) {
static inline void loop_filter_l1(uint8_t *p0_p, ptrdiff_t stride, int alpha, int beta, int tc)
{
int p0 = P0;
int q0 = Q0;
......@@ -81,7 +83,8 @@ static inline void loop_filter_l1(uint8_t *p0_p, int stride, int alpha, int beta
}
}
static inline void loop_filter_c2(uint8_t *p0_p,int stride,int alpha, int beta) {
static inline void loop_filter_c2(uint8_t *p0_p, ptrdiff_t stride, int alpha, int beta)
{
int p0 = P0;
int q0 = Q0;
......@@ -99,8 +102,9 @@ static inline void loop_filter_c2(uint8_t *p0_p,int stride,int alpha, int beta)
}
}
static inline void loop_filter_c1(uint8_t *p0_p,int stride,int alpha, int beta,
int tc) {
static inline void loop_filter_c1(uint8_t *p0_p, ptrdiff_t stride, int alpha, int beta,
int tc)
{
if(abs(P0-Q0)<alpha && abs(P1-P0)<beta && abs(Q1-Q0)<beta) {
int delta = av_clip(((Q0-P0)*3+P1-Q1+4)>>3, -tc, tc);
P0 = av_clip_uint8(P0+delta);
......@@ -115,8 +119,9 @@ static inline void loop_filter_c1(uint8_t *p0_p,int stride,int alpha, int beta,
#undef Q1
#undef Q2
static void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
static void cavs_filter_lv_c(uint8_t *d, ptrdiff_t stride, int alpha, int beta, int tc,
int bs1, int bs2)
{
int i;
if(bs1==2)
for(i=0;i<16;i++)
......@@ -131,8 +136,9 @@ static void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc
}
}
static void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
static void cavs_filter_lh_c(uint8_t *d, ptrdiff_t stride, int alpha, int beta, int tc,
int bs1, int bs2)
{
int i;
if(bs1==2)
for(i=0;i<16;i++)
......@@ -147,8 +153,9 @@ static void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc
}
}
static void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
static void cavs_filter_cv_c(uint8_t *d, ptrdiff_t stride, int alpha, int beta, int tc,
int bs1, int bs2)
{
int i;
if(bs1==2)
for(i=0;i<8;i++)
......@@ -163,8 +170,9 @@ static void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc
}
}
static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
static void cavs_filter_ch_c(uint8_t *d, ptrdiff_t stride, int alpha, int beta, int tc,
int bs1, int bs2)
{
int i;
if(bs1==2)
for(i=0;i<8;i++)
......@@ -185,7 +193,8 @@ static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc
*
****************************************************************************/
static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, ptrdiff_t stride)
{
int i;
int16_t (*src)[8] = (int16_t(*)[8])block;
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
......@@ -261,7 +270,8 @@ static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
****************************************************************************/
#define CAVS_SUBPIX(OPNAME, OP, NAME, A, B, C, D, E, F) \
static void OPNAME ## cavs_filt8_h_ ## NAME(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_filt8_h_ ## NAME(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
const int h=8;\
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;\
int i;\
......@@ -280,7 +290,8 @@ static void OPNAME ## cavs_filt8_h_ ## NAME(uint8_t *dst, const uint8_t *src, in
}\
}\
\
static void OPNAME ## cavs_filt8_v_ ## NAME(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_filt8_v_ ## NAME(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
const int w=8;\
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;\
int i;\
......@@ -312,7 +323,8 @@ static void OPNAME ## cavs_filt8_v_ ## NAME(uint8_t *dst, const uint8_t *src, i
}\
}\
\
static void OPNAME ## cavs_filt16_v_ ## NAME(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_filt16_v_ ## NAME(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_filt8_v_ ## NAME(dst , src , dstStride, srcStride);\
OPNAME ## cavs_filt8_v_ ## NAME(dst+8, src+8, dstStride, srcStride);\
src += 8*srcStride;\
......@@ -321,7 +333,8 @@ static void OPNAME ## cavs_filt16_v_ ## NAME(uint8_t *dst, const uint8_t *src, i
OPNAME ## cavs_filt8_v_ ## NAME(dst+8, src+8, dstStride, srcStride);\
}\
\
static void OPNAME ## cavs_filt16_h_ ## NAME(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_filt16_h_ ## NAME(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_filt8_h_ ## NAME(dst , src , dstStride, srcStride);\
OPNAME ## cavs_filt8_h_ ## NAME(dst+8, src+8, dstStride, srcStride);\
src += 8*srcStride;\
......@@ -331,7 +344,8 @@ static void OPNAME ## cavs_filt16_h_ ## NAME(uint8_t *dst, const uint8_t *src, i
}\
#define CAVS_SUBPIX_HV(OPNAME, OP, NAME, AH, BH, CH, DH, EH, FH, AV, BV, CV, DV, EV, FV, FULL) \
static void OPNAME ## cavs_filt8_hv_ ## NAME(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dstStride, int srcStride){\
static void OPNAME ## cavs_filt8_hv_ ## NAME(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
int16_t temp[8*(8+5)];\
int16_t *tmp = temp;\
const int h=8;\
......@@ -412,7 +426,8 @@ static void OPNAME ## cavs_filt8_hv_ ## NAME(uint8_t *dst, const uint8_t *src1,
}\
}\
\
static void OPNAME ## cavs_filt16_hv_ ## NAME(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dstStride, int srcStride){ \
static void OPNAME ## cavs_filt16_hv_ ## NAME(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, src2 , dstStride, srcStride); \
OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \
src1 += 8*srcStride;\
......
......@@ -30,11 +30,11 @@
typedef struct CAVSDSPContext {
qpel_mc_func put_cavs_qpel_pixels_tab[2][16];
qpel_mc_func avg_cavs_qpel_pixels_tab[2][16];
void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_idct8_add)(uint8_t *dst, int16_t *block, int stride);
void (*cavs_filter_lv)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_lh)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_cv)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_ch)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_idct8_add)(uint8_t *dst, int16_t *block, ptrdiff_t stride);
int idct_perm;
} CAVSDSPContext;
......
......@@ -136,7 +136,7 @@ static inline void cavs_idct8_1d(int16_t *block, uint64_t bias)
SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, ptrdiff_t stride)
{
int i;
DECLARE_ALIGNED(8, int16_t, b2)[64];
......@@ -332,7 +332,8 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
}
#define QPEL_CAVS(OPNAME, OP, MMX)\
static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{\
int h=8;\
__asm__ volatile(\
"pxor %%mm7, %%mm7 \n\t"\
......@@ -379,43 +380,53 @@ static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, const uint8_t *src, int
);\
}\
\
static inline void OPNAME ## cavs_qpel8or16_v1_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h){\
static inline void OPNAME ## cavs_qpel8or16_v1_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)\
{ \
QPEL_CAVSVNUM(QPEL_CAVSV1,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
}\
\
static inline void OPNAME ## cavs_qpel8or16_v2_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h){\
static inline void OPNAME ## cavs_qpel8or16_v2_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)\
{ \
QPEL_CAVSVNUM(QPEL_CAVSV2,OP,ff_pw_4,ff_pw_5,ff_pw_5) \
}\
\
static inline void OPNAME ## cavs_qpel8or16_v3_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h){\
static inline void OPNAME ## cavs_qpel8or16_v3_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)\
{ \
QPEL_CAVSVNUM(QPEL_CAVSV3,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
}\
\
static void OPNAME ## cavs_qpel8_v1_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel8_v1_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 8);\
}\
static void OPNAME ## cavs_qpel16_v1_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel16_v1_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 16);\
OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
}\
\
static void OPNAME ## cavs_qpel8_v2_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel8_v2_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 8);\
}\
static void OPNAME ## cavs_qpel16_v2_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel16_v2_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 16);\
OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
}\
\
static void OPNAME ## cavs_qpel8_v3_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel8_v3_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 8);\
}\
static void OPNAME ## cavs_qpel16_v3_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel16_v3_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 16);\
OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
}\
\
static void OPNAME ## cavs_qpel16_h_ ## MMX(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride){\
static void OPNAME ## cavs_qpel16_h_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
{ \
OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
src += 8*srcStride;\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment