From 15b4f494fc6bddb8178fdb5aed18b420efc75e22 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 8 Sep 2016 16:03:46 +0200 Subject: mss*: Change type of array stride parameters to ptrdiff_t ptrdiff_t is the correct type for array strides and similar. --- libavcodec/mss12.c | 15 ++++++++------- libavcodec/mss12.h | 6 +++--- libavcodec/mss2.c | 6 +++--- libavcodec/mss2dsp.c | 28 ++++++++++++++-------------- libavcodec/mss2dsp.h | 22 ++++++++++++---------- libavcodec/mss3.c | 12 ++++++------ libavcodec/mss34dsp.c | 2 +- libavcodec/mss34dsp.h | 3 ++- libavcodec/mss4.c | 2 +- 9 files changed, 50 insertions(+), 46 deletions(-) diff --git a/libavcodec/mss12.c b/libavcodec/mss12.c index b9bda16766..8735b85863 100644 --- a/libavcodec/mss12.c +++ b/libavcodec/mss12.c @@ -197,7 +197,7 @@ static av_always_inline int decode_pixel(ArithCoder *acoder, PixContext *pctx, } static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx, - uint8_t *src, int stride, int x, int y, + uint8_t *src, ptrdiff_t stride, int x, int y, int has_right) { uint8_t neighbours[4]; @@ -290,8 +290,9 @@ static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx, } static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_pic, - int x, int y, int width, int height, int stride, - int rgb_stride, PixContext *pctx, const uint32_t *pal) + int x, int y, int width, int height, ptrdiff_t stride, + ptrdiff_t rgb_stride, PixContext *pctx, + const uint32_t *pal) { int i, j, p; uint8_t *rgb_dst = rgb_pic + x * 3 + y * rgb_stride; @@ -368,8 +369,8 @@ static int motion_compensation(MSS12Context const *c, } static int decode_region_masked(MSS12Context const *c, ArithCoder *acoder, - uint8_t *dst, int stride, uint8_t *mask, - int mask_stride, int x, int y, + uint8_t *dst, ptrdiff_t stride, uint8_t *mask, + ptrdiff_t mask_stride, int x, int y, int width, int height, PixContext *pctx) { @@ -466,8 +467,8 @@ static int decode_region_intra(SliceContext *sc, ArithCoder *acoder, if (!mode) { int i, j, pix, rgb_pix; - int stride = c->pal_stride; - int rgb_stride = c->rgb_stride; + ptrdiff_t stride = c->pal_stride; + ptrdiff_t rgb_stride = c->rgb_stride; uint8_t *dst = c->pal_pic + x + y * stride; uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * rgb_stride; diff --git a/libavcodec/mss12.h b/libavcodec/mss12.h index 5b1fee8913..8cad5dcedc 100644 --- a/libavcodec/mss12.h +++ b/libavcodec/mss12.h @@ -77,12 +77,12 @@ typedef struct MSS12Context { uint32_t pal[256]; uint8_t *pal_pic; uint8_t *last_pal_pic; - int pal_stride; + ptrdiff_t pal_stride; uint8_t *mask; - int mask_stride; + ptrdiff_t mask_stride; uint8_t *rgb_pic; uint8_t *last_rgb_pic; - int rgb_stride; + ptrdiff_t rgb_stride; int free_colours; int keyframe; int mvX, mvY; diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 866ce478dd..355bb32e1b 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -174,7 +174,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size) return 1 + ncol * 3; } -static int decode_555(GetByteContext *gB, uint16_t *dst, int stride, +static int decode_555(GetByteContext *gB, uint16_t *dst, ptrdiff_t stride, int keyframe, int w, int h) { int last_symbol = 0, repeat = 0, prev_avail = 0; @@ -232,8 +232,8 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride, return 0; } -static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride, - uint8_t *rgb_dst, int rgb_stride, uint32_t *pal, +static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride, + uint8_t *rgb_dst, ptrdiff_t rgb_stride, uint32_t *pal, int keyframe, int kf_slipt, int slice, int w, int h) { uint8_t bits[270] = { 0 }; diff --git a/libavcodec/mss2dsp.c b/libavcodec/mss2dsp.c index aa13577d48..4de4dbac99 100644 --- a/libavcodec/mss2dsp.c +++ b/libavcodec/mss2dsp.c @@ -27,17 +27,17 @@ #include "libavutil/common.h" static av_always_inline void mss2_blit_wmv9_template(uint8_t *dst, - int dst_stride, + ptrdiff_t dst_stride, int gray, int use_mask, int maskcolor, const uint8_t *mask, - int mask_stride, + ptrdiff_t mask_stride, const uint8_t *srcy, - int srcy_stride, + ptrdiff_t srcy_stride, const uint8_t *srcu, const uint8_t *srcv, - int srcuv_stride, + ptrdiff_t srcuv_stride, int w, int h) { int i, j, k, r = -1; @@ -64,10 +64,10 @@ static av_always_inline void mss2_blit_wmv9_template(uint8_t *dst, } } -static void mss2_blit_wmv9_c(uint8_t *dst, int dst_stride, - const uint8_t *srcy, int srcy_stride, +static void mss2_blit_wmv9_c(uint8_t *dst, ptrdiff_t dst_stride, + const uint8_t *srcy, ptrdiff_t srcy_stride, const uint8_t *srcu, const uint8_t *srcv, - int srcuv_stride, int w, int h) + ptrdiff_t srcuv_stride, int w, int h) { mss2_blit_wmv9_template(dst, dst_stride, 0, 0, 0, NULL, 0, @@ -76,12 +76,12 @@ static void mss2_blit_wmv9_c(uint8_t *dst, int dst_stride, w, h); } -static void mss2_blit_wmv9_masked_c(uint8_t *dst, int dst_stride, +static void mss2_blit_wmv9_masked_c(uint8_t *dst, ptrdiff_t dst_stride, int maskcolor, const uint8_t *mask, - int mask_stride, - const uint8_t *srcy, int srcy_stride, + ptrdiff_t mask_stride, + const uint8_t *srcy, ptrdiff_t srcy_stride, const uint8_t *srcu, const uint8_t *srcv, - int srcuv_stride, int w, int h) + ptrdiff_t srcuv_stride, int w, int h) { mss2_blit_wmv9_template(dst, dst_stride, 0, 1, maskcolor, mask, mask_stride, @@ -90,9 +90,9 @@ static void mss2_blit_wmv9_masked_c(uint8_t *dst, int dst_stride, w, h); } -static void mss2_gray_fill_masked_c(uint8_t *dst, int dst_stride, +static void mss2_gray_fill_masked_c(uint8_t *dst, ptrdiff_t dst_stride, int maskcolor, const uint8_t *mask, - int mask_stride, int w, int h) + ptrdiff_t mask_stride, int w, int h) { mss2_blit_wmv9_template(dst, dst_stride, 1, 1, maskcolor, mask, mask_stride, @@ -101,7 +101,7 @@ static void mss2_gray_fill_masked_c(uint8_t *dst, int dst_stride, w, h); } -static void upsample_plane_c(uint8_t *plane, int plane_stride, int w, int h) +static void upsample_plane_c(uint8_t *plane, ptrdiff_t plane_stride, int w, int h) { uint8_t *src1, *src2, *dst1, *dst2, *p, a, b; int i, j; diff --git a/libavcodec/mss2dsp.h b/libavcodec/mss2dsp.h index 61c3a04fcd..352b851ca8 100644 --- a/libavcodec/mss2dsp.h +++ b/libavcodec/mss2dsp.h @@ -26,23 +26,25 @@ #ifndef AVCODEC_MSS2DSP_H #define AVCODEC_MSS2DSP_H +#include #include typedef struct MSS2DSPContext { - void (*mss2_blit_wmv9)(uint8_t *dst, int dst_stride, - const uint8_t *srcy, int srcy_stride, + void (*mss2_blit_wmv9)(uint8_t *dst, ptrdiff_t dst_stride, + const uint8_t *srcy, ptrdiff_t srcy_stride, const uint8_t *srcu, const uint8_t *srcv, - int srcuv_stride, int w, int h); - void (*mss2_blit_wmv9_masked)(uint8_t *dst, int dst_stride, + ptrdiff_t srcuv_stride, int w, int h); + void (*mss2_blit_wmv9_masked)(uint8_t *dst, ptrdiff_t dst_stride, int maskcolor, const uint8_t *mask, - int mask_stride, - const uint8_t *srcy, int srcy_stride, + ptrdiff_t mask_stride, + const uint8_t *srcy, ptrdiff_t srcy_stride, const uint8_t *srcu, const uint8_t *srcv, - int srcuv_stride, int w, int h); - void (*mss2_gray_fill_masked)(uint8_t *dst, int dst_stride, + ptrdiff_t srcuv_stride, int w, int h); + void (*mss2_gray_fill_masked)(uint8_t *dst, ptrdiff_t dst_stride, int maskcolor, const uint8_t *mask, - int mask_stride, int w, int h); - void (*upsample_plane)(uint8_t *plane, int plane_stride, int w, int h); + ptrdiff_t mask_stride, int w, int h); + void (*upsample_plane)(uint8_t *plane, ptrdiff_t plane_stride, + int w, int h); } MSS2DSPContext; void ff_mss2dsp_init(MSS2DSPContext *dsp); diff --git a/libavcodec/mss3.c b/libavcodec/mss3.c index c124834036..6a9731b58b 100644 --- a/libavcodec/mss3.c +++ b/libavcodec/mss3.c @@ -91,7 +91,7 @@ typedef struct ImageBlockCoder { typedef struct DCTBlockCoder { int *prev_dc; - int prev_dc_stride; + ptrdiff_t prev_dc_stride; int prev_dc_height; int quality; uint16_t qmat[64]; @@ -450,7 +450,7 @@ static int decode_coeff(RangeCoder *c, Model *m) } static void decode_fill_block(RangeCoder *c, FillBlockCoder *fc, - uint8_t *dst, int stride, int block_size) + uint8_t *dst, ptrdiff_t stride, int block_size) { int i; @@ -461,7 +461,7 @@ static void decode_fill_block(RangeCoder *c, FillBlockCoder *fc, } static void decode_image_block(RangeCoder *c, ImageBlockCoder *ic, - uint8_t *dst, int stride, int block_size) + uint8_t *dst, ptrdiff_t stride, int block_size) { int i, j; int vec_size; @@ -557,7 +557,7 @@ static int decode_dct(RangeCoder *c, DCTBlockCoder *bc, int *block, } static void decode_dct_block(RangeCoder *c, DCTBlockCoder *bc, - uint8_t *dst, int stride, int block_size, + uint8_t *dst, ptrdiff_t stride, int block_size, int *block, int mb_x, int mb_y) { int i, j; @@ -580,8 +580,8 @@ static void decode_dct_block(RangeCoder *c, DCTBlockCoder *bc, } static void decode_haar_block(RangeCoder *c, HaarBlockCoder *hc, - uint8_t *dst, int stride, int block_size, - int *block) + uint8_t *dst, ptrdiff_t stride, + int block_size, int *block) { const int hsize = block_size >> 1; int A, B, C, D, t1, t2, t3, t4; diff --git a/libavcodec/mss34dsp.c b/libavcodec/mss34dsp.c index 11abb2de11..dc79676230 100644 --- a/libavcodec/mss34dsp.c +++ b/libavcodec/mss34dsp.c @@ -87,7 +87,7 @@ void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma) #define SOP_ROW(a) ((a) << 16) + 0x2000 #define SOP_COL(a) ((a + 32) << 16) -void ff_mss34_dct_put(uint8_t *dst, int stride, int *block) +void ff_mss34_dct_put(uint8_t *dst, ptrdiff_t stride, int *block) { int i, j; int *ptr; diff --git a/libavcodec/mss34dsp.h b/libavcodec/mss34dsp.h index b2cc5501ec..cec82474d7 100644 --- a/libavcodec/mss34dsp.h +++ b/libavcodec/mss34dsp.h @@ -22,6 +22,7 @@ #ifndef AVCODEC_MSS34DSP_H #define AVCODEC_MSS34DSP_H +#include #include /** @@ -40,6 +41,6 @@ void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma); * @param stride output plane stride * @param block block to transform and output */ -void ff_mss34_dct_put(uint8_t *dst, int stride, int *block); +void ff_mss34_dct_put(uint8_t *dst, ptrdiff_t stride, int *block); #endif /* AVCODEC_MSS34DSP_H */ diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index a953a5759d..073e0e2da0 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c @@ -136,7 +136,7 @@ typedef struct MSS4Context { uint16_t quant_mat[2][64]; int *prev_dc[3]; - int dc_stride[3]; + ptrdiff_t dc_stride[3]; int dc_cache[4][4]; int prev_vec[3][4]; -- cgit v1.2.1