Browse code

error_resilience: Change type of array stride parameters to ptrdiff_t

ptrdiff_t is the correct type for array strides and similar.

Diego Biurrun authored on 2016/09/02 03:45:41
Showing 2 changed files
... ...
@@ -41,7 +41,7 @@
41 41
  * @param stride the number of MVs to get to the next row
42 42
  * @param mv_step the number of MVs per row or column in a macroblock
43 43
  */
44
-static void set_mv_strides(ERContext *s, int *mv_step, int *stride)
44
+static void set_mv_strides(ERContext *s, ptrdiff_t *mv_step, ptrdiff_t *stride)
45 45
 {
46 46
     if (s->avctx->codec_id == AV_CODEC_ID_H264) {
47 47
         assert(s->quarter_sample);
... ...
@@ -92,7 +92,7 @@ static void put_dc(ERContext *s, uint8_t *dest_y, uint8_t *dest_cb,
92 92
     }
93 93
 }
94 94
 
95
-static void filter181(int16_t *data, int width, int height, int stride)
95
+static void filter181(int16_t *data, int width, int height, ptrdiff_t stride)
96 96
 {
97 97
     int x, y;
98 98
 
... ...
@@ -134,7 +134,7 @@ static void filter181(int16_t *data, int width, int height, int stride)
134 134
  * @param h     height in 8 pixel blocks
135 135
  */
136 136
 static void guess_dc(ERContext *s, int16_t *dc, int w,
137
-                     int h, int stride, int is_luma)
137
+                     int h, ptrdiff_t stride, int is_luma)
138 138
 {
139 139
     int b_x, b_y;
140 140
 
... ...
@@ -220,9 +220,10 @@ static void guess_dc(ERContext *s, int16_t *dc, int w,
220 220
  * @param h     height in 8 pixel blocks
221 221
  */
222 222
 static void h_block_filter(ERContext *s, uint8_t *dst, int w,
223
-                           int h, int stride, int is_luma)
223
+                           int h, ptrdiff_t stride, int is_luma)
224 224
 {
225
-    int b_x, b_y, mvx_stride, mvy_stride;
225
+    int b_x, b_y;
226
+    ptrdiff_t mvx_stride, mvy_stride;
226 227
     const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
227 228
     set_mv_strides(s, &mvx_stride, &mvy_stride);
228 229
     mvx_stride >>= is_luma;
... ...
@@ -288,9 +289,10 @@ static void h_block_filter(ERContext *s, uint8_t *dst, int w,
288 288
  * @param h     height in 8 pixel blocks
289 289
  */
290 290
 static void v_block_filter(ERContext *s, uint8_t *dst, int w, int h,
291
-                           int stride, int is_luma)
291
+                           ptrdiff_t stride, int is_luma)
292 292
 {
293
-    int b_x, b_y, mvx_stride, mvy_stride;
293
+    int b_x, b_y;
294
+    ptrdiff_t mvx_stride, mvy_stride;
294 295
     const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
295 296
     set_mv_strides(s, &mvx_stride, &mvy_stride);
296 297
     mvx_stride >>= is_luma;
... ...
@@ -359,11 +361,12 @@ static void guess_mv(ERContext *s)
359 359
 #define MV_FROZEN    3
360 360
 #define MV_CHANGED   2
361 361
 #define MV_UNCHANGED 1
362
-    const int mb_stride = s->mb_stride;
362
+    const ptrdiff_t mb_stride = s->mb_stride;
363 363
     const int mb_width  = s->mb_width;
364 364
     const int mb_height = s->mb_height;
365 365
     int i, depth, num_avail;
366
-    int mb_x, mb_y, mot_step, mot_stride;
366
+    int mb_x, mb_y;
367
+    ptrdiff_t mot_step, mot_stride;
367 368
 
368 369
     set_mv_strides(s, &mot_step, &mot_stride);
369 370
 
... ...
@@ -57,8 +57,8 @@ typedef struct ERContext {
57 57
     int *mb_index2xy;
58 58
     int mb_num;
59 59
     int mb_width, mb_height;
60
-    int mb_stride;
61
-    int b8_stride;
60
+    ptrdiff_t mb_stride;
61
+    ptrdiff_t b8_stride;
62 62
 
63 63
     int error_count, error_occurred;
64 64
     uint8_t *error_status_table;