ptrdiff_t is the correct type for array strides and similar.
Diego Biurrun authored on 2016/09/08 23:03:46... | ... |
@@ -197,7 +197,7 @@ static av_always_inline int decode_pixel(ArithCoder *acoder, PixContext *pctx, |
197 | 197 |
} |
198 | 198 |
|
199 | 199 |
static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx, |
200 |
- uint8_t *src, int stride, int x, int y, |
|
200 |
+ uint8_t *src, ptrdiff_t stride, int x, int y, |
|
201 | 201 |
int has_right) |
202 | 202 |
{ |
203 | 203 |
uint8_t neighbours[4]; |
... | ... |
@@ -290,8 +290,9 @@ static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx, |
290 | 290 |
} |
291 | 291 |
|
292 | 292 |
static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_pic, |
293 |
- int x, int y, int width, int height, int stride, |
|
294 |
- int rgb_stride, PixContext *pctx, const uint32_t *pal) |
|
293 |
+ int x, int y, int width, int height, ptrdiff_t stride, |
|
294 |
+ ptrdiff_t rgb_stride, PixContext *pctx, |
|
295 |
+ const uint32_t *pal) |
|
295 | 296 |
{ |
296 | 297 |
int i, j, p; |
297 | 298 |
uint8_t *rgb_dst = rgb_pic + x * 3 + y * rgb_stride; |
... | ... |
@@ -368,8 +369,8 @@ static int motion_compensation(MSS12Context const *c, |
368 | 368 |
} |
369 | 369 |
|
370 | 370 |
static int decode_region_masked(MSS12Context const *c, ArithCoder *acoder, |
371 |
- uint8_t *dst, int stride, uint8_t *mask, |
|
372 |
- int mask_stride, int x, int y, |
|
371 |
+ uint8_t *dst, ptrdiff_t stride, uint8_t *mask, |
|
372 |
+ ptrdiff_t mask_stride, int x, int y, |
|
373 | 373 |
int width, int height, |
374 | 374 |
PixContext *pctx) |
375 | 375 |
{ |
... | ... |
@@ -466,8 +467,8 @@ static int decode_region_intra(SliceContext *sc, ArithCoder *acoder, |
466 | 466 |
|
467 | 467 |
if (!mode) { |
468 | 468 |
int i, j, pix, rgb_pix; |
469 |
- int stride = c->pal_stride; |
|
470 |
- int rgb_stride = c->rgb_stride; |
|
469 |
+ ptrdiff_t stride = c->pal_stride; |
|
470 |
+ ptrdiff_t rgb_stride = c->rgb_stride; |
|
471 | 471 |
uint8_t *dst = c->pal_pic + x + y * stride; |
472 | 472 |
uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * rgb_stride; |
473 | 473 |
|
... | ... |
@@ -77,12 +77,12 @@ typedef struct MSS12Context { |
77 | 77 |
uint32_t pal[256]; |
78 | 78 |
uint8_t *pal_pic; |
79 | 79 |
uint8_t *last_pal_pic; |
80 |
- int pal_stride; |
|
80 |
+ ptrdiff_t pal_stride; |
|
81 | 81 |
uint8_t *mask; |
82 |
- int mask_stride; |
|
82 |
+ ptrdiff_t mask_stride; |
|
83 | 83 |
uint8_t *rgb_pic; |
84 | 84 |
uint8_t *last_rgb_pic; |
85 |
- int rgb_stride; |
|
85 |
+ ptrdiff_t rgb_stride; |
|
86 | 86 |
int free_colours; |
87 | 87 |
int keyframe; |
88 | 88 |
int mvX, mvY; |
... | ... |
@@ -174,7 +174,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size) |
174 | 174 |
return 1 + ncol * 3; |
175 | 175 |
} |
176 | 176 |
|
177 |
-static int decode_555(GetByteContext *gB, uint16_t *dst, int stride, |
|
177 |
+static int decode_555(GetByteContext *gB, uint16_t *dst, ptrdiff_t stride, |
|
178 | 178 |
int keyframe, int w, int h) |
179 | 179 |
{ |
180 | 180 |
int last_symbol = 0, repeat = 0, prev_avail = 0; |
... | ... |
@@ -232,8 +232,8 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride, |
232 | 232 |
return 0; |
233 | 233 |
} |
234 | 234 |
|
235 |
-static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride, |
|
236 |
- uint8_t *rgb_dst, int rgb_stride, uint32_t *pal, |
|
235 |
+static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride, |
|
236 |
+ uint8_t *rgb_dst, ptrdiff_t rgb_stride, uint32_t *pal, |
|
237 | 237 |
int keyframe, int kf_slipt, int slice, int w, int h) |
238 | 238 |
{ |
239 | 239 |
uint8_t bits[270] = { 0 }; |
... | ... |
@@ -27,17 +27,17 @@ |
27 | 27 |
#include "libavutil/common.h" |
28 | 28 |
|
29 | 29 |
static av_always_inline void mss2_blit_wmv9_template(uint8_t *dst, |
30 |
- int dst_stride, |
|
30 |
+ ptrdiff_t dst_stride, |
|
31 | 31 |
int gray, |
32 | 32 |
int use_mask, |
33 | 33 |
int maskcolor, |
34 | 34 |
const uint8_t *mask, |
35 |
- int mask_stride, |
|
35 |
+ ptrdiff_t mask_stride, |
|
36 | 36 |
const uint8_t *srcy, |
37 |
- int srcy_stride, |
|
37 |
+ ptrdiff_t srcy_stride, |
|
38 | 38 |
const uint8_t *srcu, |
39 | 39 |
const uint8_t *srcv, |
40 |
- int srcuv_stride, |
|
40 |
+ ptrdiff_t srcuv_stride, |
|
41 | 41 |
int w, int h) |
42 | 42 |
{ |
43 | 43 |
int i, j, k, r = -1; |
... | ... |
@@ -64,10 +64,10 @@ static av_always_inline void mss2_blit_wmv9_template(uint8_t *dst, |
64 | 64 |
} |
65 | 65 |
} |
66 | 66 |
|
67 |
-static void mss2_blit_wmv9_c(uint8_t *dst, int dst_stride, |
|
68 |
- const uint8_t *srcy, int srcy_stride, |
|
67 |
+static void mss2_blit_wmv9_c(uint8_t *dst, ptrdiff_t dst_stride, |
|
68 |
+ const uint8_t *srcy, ptrdiff_t srcy_stride, |
|
69 | 69 |
const uint8_t *srcu, const uint8_t *srcv, |
70 |
- int srcuv_stride, int w, int h) |
|
70 |
+ ptrdiff_t srcuv_stride, int w, int h) |
|
71 | 71 |
{ |
72 | 72 |
mss2_blit_wmv9_template(dst, dst_stride, 0, 0, |
73 | 73 |
0, NULL, 0, |
... | ... |
@@ -76,12 +76,12 @@ static void mss2_blit_wmv9_c(uint8_t *dst, int dst_stride, |
76 | 76 |
w, h); |
77 | 77 |
} |
78 | 78 |
|
79 |
-static void mss2_blit_wmv9_masked_c(uint8_t *dst, int dst_stride, |
|
79 |
+static void mss2_blit_wmv9_masked_c(uint8_t *dst, ptrdiff_t dst_stride, |
|
80 | 80 |
int maskcolor, const uint8_t *mask, |
81 |
- int mask_stride, |
|
82 |
- const uint8_t *srcy, int srcy_stride, |
|
81 |
+ ptrdiff_t mask_stride, |
|
82 |
+ const uint8_t *srcy, ptrdiff_t srcy_stride, |
|
83 | 83 |
const uint8_t *srcu, const uint8_t *srcv, |
84 |
- int srcuv_stride, int w, int h) |
|
84 |
+ ptrdiff_t srcuv_stride, int w, int h) |
|
85 | 85 |
{ |
86 | 86 |
mss2_blit_wmv9_template(dst, dst_stride, 0, 1, |
87 | 87 |
maskcolor, mask, mask_stride, |
... | ... |
@@ -90,9 +90,9 @@ static void mss2_blit_wmv9_masked_c(uint8_t *dst, int dst_stride, |
90 | 90 |
w, h); |
91 | 91 |
} |
92 | 92 |
|
93 |
-static void mss2_gray_fill_masked_c(uint8_t *dst, int dst_stride, |
|
93 |
+static void mss2_gray_fill_masked_c(uint8_t *dst, ptrdiff_t dst_stride, |
|
94 | 94 |
int maskcolor, const uint8_t *mask, |
95 |
- int mask_stride, int w, int h) |
|
95 |
+ ptrdiff_t mask_stride, int w, int h) |
|
96 | 96 |
{ |
97 | 97 |
mss2_blit_wmv9_template(dst, dst_stride, 1, 1, |
98 | 98 |
maskcolor, mask, mask_stride, |
... | ... |
@@ -101,7 +101,7 @@ static void mss2_gray_fill_masked_c(uint8_t *dst, int dst_stride, |
101 | 101 |
w, h); |
102 | 102 |
} |
103 | 103 |
|
104 |
-static void upsample_plane_c(uint8_t *plane, int plane_stride, int w, int h) |
|
104 |
+static void upsample_plane_c(uint8_t *plane, ptrdiff_t plane_stride, int w, int h) |
|
105 | 105 |
{ |
106 | 106 |
uint8_t *src1, *src2, *dst1, *dst2, *p, a, b; |
107 | 107 |
int i, j; |
... | ... |
@@ -26,23 +26,25 @@ |
26 | 26 |
#ifndef AVCODEC_MSS2DSP_H |
27 | 27 |
#define AVCODEC_MSS2DSP_H |
28 | 28 |
|
29 |
+#include <stddef.h> |
|
29 | 30 |
#include <stdint.h> |
30 | 31 |
|
31 | 32 |
typedef struct MSS2DSPContext { |
32 |
- void (*mss2_blit_wmv9)(uint8_t *dst, int dst_stride, |
|
33 |
- const uint8_t *srcy, int srcy_stride, |
|
33 |
+ void (*mss2_blit_wmv9)(uint8_t *dst, ptrdiff_t dst_stride, |
|
34 |
+ const uint8_t *srcy, ptrdiff_t srcy_stride, |
|
34 | 35 |
const uint8_t *srcu, const uint8_t *srcv, |
35 |
- int srcuv_stride, int w, int h); |
|
36 |
- void (*mss2_blit_wmv9_masked)(uint8_t *dst, int dst_stride, |
|
36 |
+ ptrdiff_t srcuv_stride, int w, int h); |
|
37 |
+ void (*mss2_blit_wmv9_masked)(uint8_t *dst, ptrdiff_t dst_stride, |
|
37 | 38 |
int maskcolor, const uint8_t *mask, |
38 |
- int mask_stride, |
|
39 |
- const uint8_t *srcy, int srcy_stride, |
|
39 |
+ ptrdiff_t mask_stride, |
|
40 |
+ const uint8_t *srcy, ptrdiff_t srcy_stride, |
|
40 | 41 |
const uint8_t *srcu, const uint8_t *srcv, |
41 |
- int srcuv_stride, int w, int h); |
|
42 |
- void (*mss2_gray_fill_masked)(uint8_t *dst, int dst_stride, |
|
42 |
+ ptrdiff_t srcuv_stride, int w, int h); |
|
43 |
+ void (*mss2_gray_fill_masked)(uint8_t *dst, ptrdiff_t dst_stride, |
|
43 | 44 |
int maskcolor, const uint8_t *mask, |
44 |
- int mask_stride, int w, int h); |
|
45 |
- void (*upsample_plane)(uint8_t *plane, int plane_stride, int w, int h); |
|
45 |
+ ptrdiff_t mask_stride, int w, int h); |
|
46 |
+ void (*upsample_plane)(uint8_t *plane, ptrdiff_t plane_stride, |
|
47 |
+ int w, int h); |
|
46 | 48 |
} MSS2DSPContext; |
47 | 49 |
|
48 | 50 |
void ff_mss2dsp_init(MSS2DSPContext *dsp); |
... | ... |
@@ -91,7 +91,7 @@ typedef struct ImageBlockCoder { |
91 | 91 |
|
92 | 92 |
typedef struct DCTBlockCoder { |
93 | 93 |
int *prev_dc; |
94 |
- int prev_dc_stride; |
|
94 |
+ ptrdiff_t prev_dc_stride; |
|
95 | 95 |
int prev_dc_height; |
96 | 96 |
int quality; |
97 | 97 |
uint16_t qmat[64]; |
... | ... |
@@ -450,7 +450,7 @@ static int decode_coeff(RangeCoder *c, Model *m) |
450 | 450 |
} |
451 | 451 |
|
452 | 452 |
static void decode_fill_block(RangeCoder *c, FillBlockCoder *fc, |
453 |
- uint8_t *dst, int stride, int block_size) |
|
453 |
+ uint8_t *dst, ptrdiff_t stride, int block_size) |
|
454 | 454 |
{ |
455 | 455 |
int i; |
456 | 456 |
|
... | ... |
@@ -461,7 +461,7 @@ static void decode_fill_block(RangeCoder *c, FillBlockCoder *fc, |
461 | 461 |
} |
462 | 462 |
|
463 | 463 |
static void decode_image_block(RangeCoder *c, ImageBlockCoder *ic, |
464 |
- uint8_t *dst, int stride, int block_size) |
|
464 |
+ uint8_t *dst, ptrdiff_t stride, int block_size) |
|
465 | 465 |
{ |
466 | 466 |
int i, j; |
467 | 467 |
int vec_size; |
... | ... |
@@ -557,7 +557,7 @@ static int decode_dct(RangeCoder *c, DCTBlockCoder *bc, int *block, |
557 | 557 |
} |
558 | 558 |
|
559 | 559 |
static void decode_dct_block(RangeCoder *c, DCTBlockCoder *bc, |
560 |
- uint8_t *dst, int stride, int block_size, |
|
560 |
+ uint8_t *dst, ptrdiff_t stride, int block_size, |
|
561 | 561 |
int *block, int mb_x, int mb_y) |
562 | 562 |
{ |
563 | 563 |
int i, j; |
... | ... |
@@ -580,8 +580,8 @@ static void decode_dct_block(RangeCoder *c, DCTBlockCoder *bc, |
580 | 580 |
} |
581 | 581 |
|
582 | 582 |
static void decode_haar_block(RangeCoder *c, HaarBlockCoder *hc, |
583 |
- uint8_t *dst, int stride, int block_size, |
|
584 |
- int *block) |
|
583 |
+ uint8_t *dst, ptrdiff_t stride, |
|
584 |
+ int block_size, int *block) |
|
585 | 585 |
{ |
586 | 586 |
const int hsize = block_size >> 1; |
587 | 587 |
int A, B, C, D, t1, t2, t3, t4; |
... | ... |
@@ -87,7 +87,7 @@ void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma) |
87 | 87 |
#define SOP_ROW(a) ((a) << 16) + 0x2000 |
88 | 88 |
#define SOP_COL(a) ((a + 32) << 16) |
89 | 89 |
|
90 |
-void ff_mss34_dct_put(uint8_t *dst, int stride, int *block) |
|
90 |
+void ff_mss34_dct_put(uint8_t *dst, ptrdiff_t stride, int *block) |
|
91 | 91 |
{ |
92 | 92 |
int i, j; |
93 | 93 |
int *ptr; |
... | ... |
@@ -22,6 +22,7 @@ |
22 | 22 |
#ifndef AVCODEC_MSS34DSP_H |
23 | 23 |
#define AVCODEC_MSS34DSP_H |
24 | 24 |
|
25 |
+#include <stddef.h> |
|
25 | 26 |
#include <stdint.h> |
26 | 27 |
|
27 | 28 |
/** |
... | ... |
@@ -40,6 +41,6 @@ void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma); |
40 | 40 |
* @param stride output plane stride |
41 | 41 |
* @param block block to transform and output |
42 | 42 |
*/ |
43 |
-void ff_mss34_dct_put(uint8_t *dst, int stride, int *block); |
|
43 |
+void ff_mss34_dct_put(uint8_t *dst, ptrdiff_t stride, int *block); |
|
44 | 44 |
|
45 | 45 |
#endif /* AVCODEC_MSS34DSP_H */ |