[14/15] dv: Change type of array stride parameters to ptrdiff_t

Message ID 1473178294-16959-14-git-send-email-diego@biurrun.de
State New
Headers show

Commit Message

Diego Biurrun Sept. 6, 2016, 4:11 p.m.
ptrdiff_t is the correct type for array strides and similar.
---
 libavcodec/dv.h         | 4 ++--
 libavcodec/dv_profile.h | 4 ++--
 libavcodec/dvdec.c      | 4 ++--
 libavcodec/dvenc.c      | 9 +++++----
 4 files changed, 11 insertions(+), 10 deletions(-)

Comments

Luca Barbato Sept. 6, 2016, 10:18 p.m. | #1
On 06/09/16 18:11, Diego Biurrun wrote:
> ptrdiff_t is the correct type for array strides and similar.
> ---
>  libavcodec/dv.h         | 4 ++--
>  libavcodec/dv_profile.h | 4 ++--
>  libavcodec/dvdec.c      | 4 ++--
>  libavcodec/dvenc.c      | 9 +++++----
>  4 files changed, 11 insertions(+), 10 deletions(-)

Sounds good.

lu

Patch

diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index 1d1650c..437e093 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -45,9 +45,9 @@  typedef struct DVVideoContext {
 
     uint8_t dv_zigzag[2][64];
 
-    void (*get_pixels)(int16_t *block, const uint8_t *pixels, int line_size);
+    void (*get_pixels)(int16_t *block, const uint8_t *pixels, ptrdiff_t stride);
     void (*fdct[2])(int16_t *block);
-    void (*idct_put[2])(uint8_t *dest, int line_size, int16_t *block);
+    void (*idct_put[2])(uint8_t *dest, ptrdiff_t stride, int16_t *block);
     me_cmp_func ildct_cmp;
     DVwork_chunk work_chunks[4 * 12 * 27];
     uint32_t idct_factor[2 * 4 * 16 * 64];
diff --git a/libavcodec/dv_profile.h b/libavcodec/dv_profile.h
index 5ad7b4f..93f74af 100644
--- a/libavcodec/dv_profile.h
+++ b/libavcodec/dv_profile.h
@@ -19,11 +19,11 @@ 
 #ifndef AVCODEC_DV_PROFILE_H
 #define AVCODEC_DV_PROFILE_H
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include "libavutil/pixfmt.h"
 #include "libavutil/rational.h"
-#include "avcodec.h"
 
 /*
  * AVDVProfile is used to express the differences between various
@@ -45,7 +45,7 @@  typedef struct AVDVProfile {
     enum AVPixelFormat pix_fmt;             /* picture pixel format */
     int              bpm;                   /* blocks per macroblock */
     const uint8_t   *block_sizes;           /* AC block sizes, in bits */
-    int              audio_stride;          /* size of audio_shuffle table */
+    ptrdiff_t        audio_stride;          /* size of audio_shuffle table */
     int              audio_min_samples[3];  /* min amount of audio samples */
                                             /* for 48kHz, 44.1kHz and 32kHz */
     int              audio_samples_dist[5]; /* how many samples are supposed to be */
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 463d108..fa3d3ed 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -52,7 +52,7 @@  typedef struct BlockInfo {
     const uint32_t *factor_table;
     const uint8_t *scan_table;
     uint8_t pos; /* position in block */
-    void (*idct_put)(uint8_t *dest, int line_size, int16_t *block);
+    void (*idct_put)(uint8_t *dest, ptrdiff_t stride, int16_t *block);
     uint8_t partial_bit_count;
     uint32_t partial_bit_buffer;
     int shift_offset;
@@ -158,7 +158,7 @@  static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
     DVwork_chunk *work_chunk = arg;
     int quant, dc, dct_mode, class1, j;
     int mb_index, mb_x, mb_y, last_index;
-    int y_stride, linesize;
+    ptrdiff_t y_stride, linesize;
     int16_t *block, *block1;
     int c_offset;
     uint8_t *y_ptr;
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index e02f349..399c434 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -197,7 +197,7 @@  static av_always_inline PutBitContext *dv_encode_ac(EncBlockInfo *bi,
 }
 
 static av_always_inline int dv_guess_dct_mode(DVVideoContext *s, uint8_t *data,
-                                              int linesize)
+                                              ptrdiff_t linesize)
 {
     if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
         int ps = s->ildct_cmp(NULL, data, NULL, linesize, 8) - 400;
@@ -234,8 +234,8 @@  static const int dv_weight_248[64] = {
 };
 
 static av_always_inline int dv_init_enc_block(EncBlockInfo *bi, uint8_t *data,
-                                              int linesize, DVVideoContext *s,
-                                              int bias)
+                                              ptrdiff_t linesize,
+                                              DVVideoContext *s, int bias)
 {
     const int *weight;
     const uint8_t *zigzag_scan;
@@ -413,7 +413,8 @@  static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
     DVVideoContext *s = avctx->priv_data;
     DVwork_chunk *work_chunk = arg;
     int mb_index, i, j;
-    int mb_x, mb_y, c_offset, linesize, y_stride;
+    int mb_x, mb_y, c_offset;
+    ptrdiff_t linesize, y_stride;
     uint8_t *y_ptr;
     uint8_t *dif;
     LOCAL_ALIGNED_8(uint8_t, scratch, [128]);