[FFmpeg-cvslog] avfilter: use ptrdiff_t instead of int for linesize

Paul B Mahol git at videolan.org
Sat Sep 23 00:00:07 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Sep 22 09:15:13 2023 +0200| [1242d172e2fbcce85b5ee264a09879eb55b59cca] | committer: Paul B Mahol

avfilter: use ptrdiff_t instead of int for linesize

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1242d172e2fbcce85b5ee264a09879eb55b59cca
---

 libavfilter/vf_codecview.c        | 12 ++++++------
 libavfilter/vf_colorcontrast.c    | 16 ++++++++--------
 libavfilter/vf_colorcorrect.c     | 36 +++++++++++++++++------------------
 libavfilter/vf_colorize.c         | 12 ++++++------
 libavfilter/vf_colortemperature.c | 16 ++++++++--------
 libavfilter/vf_fillborders.c      | 28 +++++++++++++--------------
 libavfilter/vf_huesaturation.c    |  2 +-
 libavfilter/vf_lut3d.c            | 14 +++++++-------
 libavfilter/vf_monochrome.c       | 20 ++++++++++----------
 libavfilter/vf_paletteuse.c       |  2 +-
 libavfilter/vf_vibrance.c         | 40 +++++++++++++++++++--------------------
 libavfilter/vsrc_gradients.c      | 12 ++++++------
 libavfilter/vsrc_testsrc.c        | 38 ++++++++++++++++++-------------------
 13 files changed, 124 insertions(+), 124 deletions(-)

diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c
index 0c1ef21e28..55d9c8c04f 100644
--- a/libavfilter/vf_codecview.c
+++ b/libavfilter/vf_codecview.c
@@ -111,7 +111,7 @@ static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx)
  * @param color color of the arrow
  */
 static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
-                      int w, int h, int stride, int color)
+                      int w, int h, ptrdiff_t stride, int color)
 {
     int x, y, fr, f;
 
@@ -169,7 +169,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
  * @param color color of the arrow
  */
 static void draw_arrow(uint8_t *buf, int sx, int sy, int ex,
-                       int ey, int w, int h, int stride, int color, int tail, int direction)
+                       int ey, int w, int h, ptrdiff_t stride, int color, int tail, int direction)
 {
     int dx,dy;
 
@@ -206,7 +206,7 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex,
     draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
 }
 
-static void draw_block_rectangle(uint8_t *buf, int sx, int sy, int w, int h, int stride, int color)
+static void draw_block_rectangle(uint8_t *buf, int sx, int sy, int w, int h, ptrdiff_t stride, int color)
 {
     for (int x = sx; x < sx + w; x++)
         buf[x] = color;
@@ -244,8 +244,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
             const int h = AV_CEIL_RSHIFT(frame->height, s->vsub);
             uint8_t *pu = frame->data[1];
             uint8_t *pv = frame->data[2];
-            const int lzu = frame->linesize[1];
-            const int lzv = frame->linesize[2];
+            const ptrdiff_t lzu = frame->linesize[1];
+            const ptrdiff_t lzv = frame->linesize[2];
 
             for (y = 0; y < h; y++) {
                 for (x = 0; x < w; x++) {
@@ -263,7 +263,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
         AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
         if (sd) {
             AVVideoEncParams *par = (AVVideoEncParams*)sd->data;
-            const int stride = frame->linesize[0];
+            const ptrdiff_t stride = frame->linesize[0];
 
             if (par->nb_blocks) {
                 for (int block_idx = 0; block_idx < par->nb_blocks; block_idx++) {
diff --git a/libavfilter/vf_colorcontrast.c b/libavfilter/vf_colorcontrast.c
index f05701c1a5..b086de71e5 100644
--- a/libavfilter/vf_colorcontrast.c
+++ b/libavfilter/vf_colorcontrast.c
@@ -96,9 +96,9 @@ static int colorcontrast_slice8(AVFilterContext *ctx, void *arg, int jobnr, int
     const int height = frame->height;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int glinesize = frame->linesize[0];
-    const int blinesize = frame->linesize[1];
-    const int rlinesize = frame->linesize[2];
+    const ptrdiff_t glinesize = frame->linesize[0];
+    const ptrdiff_t blinesize = frame->linesize[1];
+    const ptrdiff_t rlinesize = frame->linesize[2];
     uint8_t *gptr = frame->data[0] + slice_start * glinesize;
     uint8_t *bptr = frame->data[1] + slice_start * blinesize;
     uint8_t *rptr = frame->data[2] + slice_start * rlinesize;
@@ -150,9 +150,9 @@ static int colorcontrast_slice16(AVFilterContext *ctx, void *arg, int jobnr, int
     const int height = frame->height;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int glinesize = frame->linesize[0] / 2;
-    const int blinesize = frame->linesize[1] / 2;
-    const int rlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t glinesize = frame->linesize[0] / 2;
+    const ptrdiff_t blinesize = frame->linesize[1] / 2;
+    const ptrdiff_t rlinesize = frame->linesize[2] / 2;
     uint16_t *gptr = (uint16_t *)frame->data[0] + slice_start * glinesize;
     uint16_t *bptr = (uint16_t *)frame->data[1] + slice_start * blinesize;
     uint16_t *rptr = (uint16_t *)frame->data[2] + slice_start * rlinesize;
@@ -203,7 +203,7 @@ static int colorcontrast_slice8p(AVFilterContext *ctx, void *arg, int jobnr, int
     const int height = frame->height;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int linesize = frame->linesize[0];
+    const ptrdiff_t linesize = frame->linesize[0];
     const uint8_t roffset = s->rgba_map[R];
     const uint8_t goffset = s->rgba_map[G];
     const uint8_t boffset = s->rgba_map[B];
@@ -255,7 +255,7 @@ static int colorcontrast_slice16p(AVFilterContext *ctx, void *arg, int jobnr, in
     const int height = frame->height;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int linesize = frame->linesize[0] / 2;
+    const ptrdiff_t linesize = frame->linesize[0] / 2;
     const uint8_t roffset = s->rgba_map[R];
     const uint8_t goffset = s->rgba_map[G];
     const uint8_t boffset = s->rgba_map[B];
diff --git a/libavfilter/vf_colorcorrect.c b/libavfilter/vf_colorcorrect.c
index 0f2fe33c0f..1c4dea531b 100644
--- a/libavfilter/vf_colorcorrect.c
+++ b/libavfilter/vf_colorcorrect.c
@@ -69,8 +69,8 @@ static int average_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
     const uint8_t *uptr = (const uint8_t *)frame->data[1] + slice_start * ulinesize;
     const uint8_t *vptr = (const uint8_t *)frame->data[2] + slice_start * vlinesize;
     int sum_u = 0, sum_v = 0;
@@ -100,8 +100,8 @@ static int average_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
     const uint16_t *uptr = (const uint16_t *)frame->data[1] + slice_start * ulinesize;
     const uint16_t *vptr = (const uint16_t *)frame->data[2] + slice_start * vlinesize;
     int64_t sum_u = 0, sum_v = 0;
@@ -131,8 +131,8 @@ static int minmax_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
     const uint8_t *uptr = (const uint8_t *)frame->data[1] + slice_start * ulinesize;
     const uint8_t *vptr = (const uint8_t *)frame->data[2] + slice_start * vlinesize;
     int min_u = 255, min_v = 255;
@@ -167,8 +167,8 @@ static int minmax_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
     const uint16_t *uptr = (const uint16_t *)frame->data[1] + slice_start * ulinesize;
     const uint16_t *vptr = (const uint16_t *)frame->data[2] + slice_start * vlinesize;
     int min_u = INT_MAX, min_v = INT_MAX;
@@ -201,8 +201,8 @@ static int median_8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
     const float imax = s->imax;
     const int width = s->planewidth[1];
     const int height = s->planeheight[1];
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
     const uint8_t *uptr = (const uint8_t *)frame->data[1];
     const uint8_t *vptr = (const uint8_t *)frame->data[2];
     unsigned *uhistogram = s->uhistogram;
@@ -255,8 +255,8 @@ static int median_16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
     const float imax = s->imax;
     const int width = s->planewidth[1];
     const int height = s->planeheight[1];
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
     const uint16_t *uptr = (const uint16_t *)frame->data[1];
     const uint16_t *vptr = (const uint16_t *)frame->data[2];
     unsigned *uhistogram = s->uhistogram;
@@ -323,9 +323,9 @@ static int colorcorrect_slice8(AVFilterContext *ctx, void *arg, int jobnr, int n
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ylinesize = frame->linesize[0];
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ylinesize = frame->linesize[0];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
     uint8_t *yptr = frame->data[0] + slice_start * chroma_h * ylinesize;
     uint8_t *uptr = frame->data[1] + slice_start * ulinesize;
     uint8_t *vptr = frame->data[2] + slice_start * vlinesize;
@@ -364,9 +364,9 @@ static int colorcorrect_slice16(AVFilterContext *ctx, void *arg, int jobnr, int
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ylinesize = frame->linesize[0] / 2;
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ylinesize = frame->linesize[0] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
     uint16_t *yptr = (uint16_t *)frame->data[0] + slice_start * chroma_h * ylinesize;
     uint16_t *uptr = (uint16_t *)frame->data[1] + slice_start * ulinesize;
     uint16_t *vptr = (uint16_t *)frame->data[2] + slice_start * vlinesize;
diff --git a/libavfilter/vf_colorize.c b/libavfilter/vf_colorize.c
index ed14be9459..e6c563e3e2 100644
--- a/libavfilter/vf_colorize.c
+++ b/libavfilter/vf_colorize.c
@@ -52,7 +52,7 @@ static int colorizey_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
     const int height = s->planeheight[0];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ylinesize = frame->linesize[0];
+    const ptrdiff_t ylinesize = frame->linesize[0];
     uint8_t *yptr = frame->data[0] + slice_start * ylinesize;
     const int yv = s->c[0];
     const float mix = s->mix;
@@ -75,7 +75,7 @@ static int colorizey_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_
     const int height = s->planeheight[0];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ylinesize = frame->linesize[0] / 2;
+    const ptrdiff_t ylinesize = frame->linesize[0] / 2;
     uint16_t *yptr = (uint16_t *)frame->data[0] + slice_start * ylinesize;
     const int yv = s->c[0];
     const float mix = s->mix;
@@ -98,8 +98,8 @@ static int colorize_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
     uint8_t *uptr = frame->data[1] + slice_start * ulinesize;
     uint8_t *vptr = frame->data[2] + slice_start * vlinesize;
     const int u = s->c[1];
@@ -126,8 +126,8 @@ static int colorize_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
     const int height = s->planeheight[1];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
     uint16_t *uptr = (uint16_t *)frame->data[1] + slice_start * ulinesize;
     uint16_t *vptr = (uint16_t *)frame->data[2] + slice_start * vlinesize;
     const int u = s->c[1];
diff --git a/libavfilter/vf_colortemperature.c b/libavfilter/vf_colortemperature.c
index bac6743a34..a44dd08004 100644
--- a/libavfilter/vf_colortemperature.c
+++ b/libavfilter/vf_colortemperature.c
@@ -111,9 +111,9 @@ static int temperature_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb
     const float *color = s->color;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int glinesize = frame->linesize[0];
-    const int blinesize = frame->linesize[1];
-    const int rlinesize = frame->linesize[2];
+    const ptrdiff_t glinesize = frame->linesize[0];
+    const ptrdiff_t blinesize = frame->linesize[1];
+    const ptrdiff_t rlinesize = frame->linesize[2];
     uint8_t *gptr = frame->data[0] + slice_start * glinesize;
     uint8_t *bptr = frame->data[1] + slice_start * blinesize;
     uint8_t *rptr = frame->data[2] + slice_start * rlinesize;
@@ -153,9 +153,9 @@ static int temperature_slice16(AVFilterContext *ctx, void *arg, int jobnr, int n
     const float *color = s->color;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int glinesize = frame->linesize[0] / sizeof(uint16_t);
-    const int blinesize = frame->linesize[1] / sizeof(uint16_t);
-    const int rlinesize = frame->linesize[2] / sizeof(uint16_t);
+    const ptrdiff_t glinesize = frame->linesize[0] / sizeof(uint16_t);
+    const ptrdiff_t blinesize = frame->linesize[1] / sizeof(uint16_t);
+    const ptrdiff_t rlinesize = frame->linesize[2] / sizeof(uint16_t);
     uint16_t *gptr = (uint16_t *)frame->data[0] + slice_start * glinesize;
     uint16_t *bptr = (uint16_t *)frame->data[1] + slice_start * blinesize;
     uint16_t *rptr = (uint16_t *)frame->data[2] + slice_start * rlinesize;
@@ -198,7 +198,7 @@ static int temperature_slice8p(AVFilterContext *ctx, void *arg, int jobnr, int n
     const uint8_t boffset = s->rgba_map[B];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int linesize = frame->linesize[0];
+    const ptrdiff_t linesize = frame->linesize[0];
     uint8_t *ptr = frame->data[0] + slice_start * linesize;
 
     for (int y = slice_start; y < slice_end; y++) {
@@ -238,7 +238,7 @@ static int temperature_slice16p(AVFilterContext *ctx, void *arg, int jobnr, int
     const uint8_t boffset = s->rgba_map[B];
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int linesize = frame->linesize[0] / sizeof(uint16_t);
+    const ptrdiff_t linesize = frame->linesize[0] / sizeof(uint16_t);
     uint16_t *ptr = (uint16_t *)frame->data[0] + slice_start * linesize;
 
     for (int y = slice_start; y < slice_end; y++) {
diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c
index 32ca7219bb..34e7b5f637 100644
--- a/libavfilter/vf_fillborders.c
+++ b/libavfilter/vf_fillborders.c
@@ -82,7 +82,7 @@ static void smear_borders8(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = frame->data[p];
-        int linesize = frame->linesize[p];
+        ptrdiff_t linesize = frame->linesize[p];
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             memset(ptr + y * linesize,
@@ -112,7 +112,7 @@ static void smear_borders16(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
-        int linesize = frame->linesize[p] / 2;
+        ptrdiff_t linesize = frame->linesize[p] / 2;
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -144,7 +144,7 @@ static void mirror_borders8(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = frame->data[p];
-        int linesize = frame->linesize[p];
+        ptrdiff_t linesize = frame->linesize[p];
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -177,7 +177,7 @@ static void mirror_borders16(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
-        int linesize = frame->linesize[p] / 2;
+        ptrdiff_t linesize = frame->linesize[p] / 2;
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -211,7 +211,7 @@ static void fixed_borders8(FillBordersContext *s, AVFrame *frame)
     for (p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = frame->data[p];
         uint8_t fill = s->fill[p];
-        int linesize = frame->linesize[p];
+        ptrdiff_t linesize = frame->linesize[p];
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             memset(ptr + y * linesize, fill, s->borders[p].left);
@@ -236,7 +236,7 @@ static void fixed_borders16(FillBordersContext *s, AVFrame *frame)
     for (p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
         uint16_t fill = s->fill[p] << (s->depth - 8);
-        int linesize = frame->linesize[p] / 2;
+        ptrdiff_t linesize = frame->linesize[p] / 2;
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -268,7 +268,7 @@ static void reflect_borders8(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = frame->data[p];
-        int linesize = frame->linesize[p];
+        ptrdiff_t linesize = frame->linesize[p];
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -301,7 +301,7 @@ static void reflect_borders16(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
-        int linesize = frame->linesize[p] / 2;
+        ptrdiff_t linesize = frame->linesize[p] / 2;
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -334,7 +334,7 @@ static void wrap_borders8(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = frame->data[p];
-        int linesize = frame->linesize[p];
+        ptrdiff_t linesize = frame->linesize[p];
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -367,7 +367,7 @@ static void wrap_borders16(FillBordersContext *s, AVFrame *frame)
 
     for (p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
-        int linesize = frame->linesize[p] / 2;
+        ptrdiff_t linesize = frame->linesize[p] / 2;
 
         for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
             for (x = 0; x < s->borders[p].left; x++) {
@@ -411,7 +411,7 @@ static void fade_borders8(FillBordersContext *s, AVFrame *frame)
     for (p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = frame->data[p];
         const uint8_t fill = s->fill[p];
-        const int linesize = frame->linesize[p];
+        const ptrdiff_t linesize = frame->linesize[p];
         const int start_left = s->borders[p].left;
         const int start_right = s->planewidth[p] - s->borders[p].right;
         const int start_top = s->borders[p].top;
@@ -453,7 +453,7 @@ static void fade_borders16(FillBordersContext *s, AVFrame *frame)
     for (p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
         const uint16_t fill = s->fill[p] << (depth - 8);
-        const int linesize = frame->linesize[p] / 2;
+        const ptrdiff_t linesize = frame->linesize[p] / 2;
         const int start_left = s->borders[p].left;
         const int start_right = s->planewidth[p] - s->borders[p].right;
         const int start_top = s->borders[p].top;
@@ -491,7 +491,7 @@ static void margins_borders8(FillBordersContext *s, AVFrame *frame)
 {
     for (int p = 0; p < s->nb_planes; p++) {
         uint8_t *ptr = (uint8_t *)frame->data[p];
-        const int linesize = frame->linesize[p];
+        const ptrdiff_t linesize = frame->linesize[p];
         const int left = s->borders[p].left;
         const int right = s->borders[p].right;
         const int top = s->borders[p].top;
@@ -536,7 +536,7 @@ static void margins_borders16(FillBordersContext *s, AVFrame *frame)
 {
     for (int p = 0; p < s->nb_planes; p++) {
         uint16_t *ptr = (uint16_t *)frame->data[p];
-        const int linesize = frame->linesize[p] / 2;
+        const ptrdiff_t linesize = frame->linesize[p] / 2;
         const int left = s->borders[p].left;
         const int right = s->borders[p].right;
         const int top = s->borders[p].top;
diff --git a/libavfilter/vf_huesaturation.c b/libavfilter/vf_huesaturation.c
index 8dd81ad1a4..bdee961daa 100644
--- a/libavfilter/vf_huesaturation.c
+++ b/libavfilter/vf_huesaturation.c
@@ -105,7 +105,7 @@ static int do_slice_##name##_##xall(AVFilterContext *ctx,            \
     const int process_h = frame->height;                             \
     const int slice_start = (process_h *  jobnr   ) / nb_jobs;       \
     const int slice_end   = (process_h * (jobnr+1)) / nb_jobs;       \
-    const int linesize = frame->linesize[0] / sizeof(type);          \
+    const ptrdiff_t linesize = frame->linesize[0] / sizeof(type);    \
     type *row = (type *)frame->data[0] + linesize * slice_start;     \
     const uint8_t offset_r = s->rgba_map[R];                         \
     const uint8_t offset_g = s->rgba_map[G];                         \
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index db38d41932..4edcc2c7a7 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -1321,7 +1321,7 @@ const AVFilter ff_vf_lut3d = {
 static void update_clut_packed(LUT3DContext *lut3d, const AVFrame *frame)
 {
     const uint8_t *data = frame->data[0];
-    const int linesize  = frame->linesize[0];
+    const ptrdiff_t linesize  = frame->linesize[0];
     const int w = lut3d->clut_width;
     const int step = lut3d->clut_step;
     const uint8_t *rgba_map = lut3d->clut_rgba_map;
@@ -1360,9 +1360,9 @@ static void update_clut_planar(LUT3DContext *lut3d, const AVFrame *frame)
     const uint8_t *datag = frame->data[0];
     const uint8_t *datab = frame->data[1];
     const uint8_t *datar = frame->data[2];
-    const int glinesize  = frame->linesize[0];
-    const int blinesize  = frame->linesize[1];
-    const int rlinesize  = frame->linesize[2];
+    const ptrdiff_t glinesize  = frame->linesize[0];
+    const ptrdiff_t blinesize  = frame->linesize[1];
+    const ptrdiff_t rlinesize  = frame->linesize[2];
     const int w = lut3d->clut_width;
     const int level = lut3d->lutsize;
     const int level2 = lut3d->lutsize2;
@@ -1407,9 +1407,9 @@ static void update_clut_float(LUT3DContext *lut3d, const AVFrame *frame)
     const uint8_t *datag = frame->data[0];
     const uint8_t *datab = frame->data[1];
     const uint8_t *datar = frame->data[2];
-    const int glinesize  = frame->linesize[0];
-    const int blinesize  = frame->linesize[1];
-    const int rlinesize  = frame->linesize[2];
+    const ptrdiff_t glinesize  = frame->linesize[0];
+    const ptrdiff_t blinesize  = frame->linesize[1];
+    const ptrdiff_t rlinesize  = frame->linesize[2];
     const int w = lut3d->clut_width;
     const int level = lut3d->lutsize;
     const int level2 = lut3d->lutsize2;
diff --git a/libavfilter/vf_monochrome.c b/libavfilter/vf_monochrome.c
index 0e184e08b3..05c001707a 100644
--- a/libavfilter/vf_monochrome.c
+++ b/libavfilter/vf_monochrome.c
@@ -89,9 +89,9 @@ static int monochrome_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_
     const int height = frame->height;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ylinesize = frame->linesize[0];
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ylinesize = frame->linesize[0];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
     uint8_t *yptr = frame->data[0] + slice_start * ylinesize;
     const float ihigh = 1.f - s->high;
     const float size = 1.f / s->size;
@@ -128,9 +128,9 @@ static int monochrome_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb
     const int height = frame->height;
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ylinesize = frame->linesize[0] / 2;
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ylinesize = frame->linesize[0] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
     uint16_t *yptr = (uint16_t *)frame->data[0] + slice_start * ylinesize;
     const float ihigh = 1.f - s->high;
     const float size = 1.f / s->size;
@@ -166,8 +166,8 @@ static int clear_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
     const int height = AV_CEIL_RSHIFT(frame->height, subh);
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1];
-    const int vlinesize = frame->linesize[2];
+    const ptrdiff_t ulinesize = frame->linesize[1];
+    const ptrdiff_t vlinesize = frame->linesize[2];
 
     for (int y = slice_start; y < slice_end; y++) {
         uint8_t *uptr = frame->data[1] + y * ulinesize;
@@ -192,8 +192,8 @@ static int clear_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
     const int height = AV_CEIL_RSHIFT(frame->height, subh);
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int ulinesize = frame->linesize[1] / 2;
-    const int vlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    const ptrdiff_t vlinesize = frame->linesize[2] / 2;
 
     for (int y = slice_start; y < slice_end; y++) {
         uint16_t *uptr = (uint16_t *)frame->data[1] + y * ulinesize;
diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index bc767c508c..0f813bae70 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -845,7 +845,7 @@ static void load_palette(PaletteUseContext *s, const AVFrame *palette_frame)
 {
     int i, x, y;
     const uint32_t *p = (const uint32_t *)palette_frame->data[0];
-    const int p_linesize = palette_frame->linesize[0] >> 2;
+    const ptrdiff_t p_linesize = palette_frame->linesize[0] >> 2;
 
     s->transparency_index = -1;
 
diff --git a/libavfilter/vf_vibrance.c b/libavfilter/vf_vibrance.c
index e17fce07c0..e1d6e64aeb 100644
--- a/libavfilter/vf_vibrance.c
+++ b/libavfilter/vf_vibrance.c
@@ -77,14 +77,14 @@ static int vibrance_slice8(AVFilterContext *avctx, void *arg, int jobnr, int nb_
     const float srintensity = alternate * FFSIGN(rintensity);
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int glinesize = frame->linesize[0];
-    const int blinesize = frame->linesize[1];
-    const int rlinesize = frame->linesize[2];
-    const int alinesize = frame->linesize[3];
-    const int gslinesize = in->linesize[0];
-    const int bslinesize = in->linesize[1];
-    const int rslinesize = in->linesize[2];
-    const int aslinesize = in->linesize[3];
+    const ptrdiff_t glinesize = frame->linesize[0];
+    const ptrdiff_t blinesize = frame->linesize[1];
+    const ptrdiff_t rlinesize = frame->linesize[2];
+    const ptrdiff_t alinesize = frame->linesize[3];
+    const ptrdiff_t gslinesize = in->linesize[0];
+    const ptrdiff_t bslinesize = in->linesize[1];
+    const ptrdiff_t rslinesize = in->linesize[2];
+    const ptrdiff_t aslinesize = in->linesize[3];
     const uint8_t *gsrc = in->data[0] + slice_start * glinesize;
     const uint8_t *bsrc = in->data[1] + slice_start * blinesize;
     const uint8_t *rsrc = in->data[2] + slice_start * rlinesize;
@@ -154,14 +154,14 @@ static int vibrance_slice16(AVFilterContext *avctx, void *arg, int jobnr, int nb
     const float srintensity = alternate * FFSIGN(rintensity);
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int gslinesize = in->linesize[0] / 2;
-    const int bslinesize = in->linesize[1] / 2;
-    const int rslinesize = in->linesize[2] / 2;
-    const int aslinesize = in->linesize[3] / 2;
-    const int glinesize = frame->linesize[0] / 2;
-    const int blinesize = frame->linesize[1] / 2;
-    const int rlinesize = frame->linesize[2] / 2;
-    const int alinesize = frame->linesize[3] / 2;
+    const ptrdiff_t gslinesize = in->linesize[0] / 2;
+    const ptrdiff_t bslinesize = in->linesize[1] / 2;
+    const ptrdiff_t rslinesize = in->linesize[2] / 2;
+    const ptrdiff_t aslinesize = in->linesize[3] / 2;
+    const ptrdiff_t glinesize = frame->linesize[0] / 2;
+    const ptrdiff_t blinesize = frame->linesize[1] / 2;
+    const ptrdiff_t rlinesize = frame->linesize[2] / 2;
+    const ptrdiff_t alinesize = frame->linesize[3] / 2;
     const uint16_t *gsrc = (const uint16_t *)in->data[0] + slice_start * gslinesize;
     const uint16_t *bsrc = (const uint16_t *)in->data[1] + slice_start * bslinesize;
     const uint16_t *rsrc = (const uint16_t *)in->data[2] + slice_start * rslinesize;
@@ -234,8 +234,8 @@ static int vibrance_slice8p(AVFilterContext *avctx, void *arg, int jobnr, int nb
     const float srintensity = alternate * FFSIGN(rintensity);
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int linesize = frame->linesize[0];
-    const int slinesize = in->linesize[0];
+    const ptrdiff_t linesize = frame->linesize[0];
+    const ptrdiff_t slinesize = in->linesize[0];
     const uint8_t *src = in->data[0] + slice_start * slinesize;
     uint8_t *ptr = frame->data[0] + slice_start * linesize;
 
@@ -300,8 +300,8 @@ static int vibrance_slice16p(AVFilterContext *avctx, void *arg, int jobnr, int n
     const float srintensity = alternate * FFSIGN(rintensity);
     const int slice_start = (height * jobnr) / nb_jobs;
     const int slice_end = (height * (jobnr + 1)) / nb_jobs;
-    const int linesize = frame->linesize[0] / 2;
-    const int slinesize = in->linesize[0] / 2;
+    const ptrdiff_t linesize = frame->linesize[0] / 2;
+    const ptrdiff_t slinesize = in->linesize[0] / 2;
     const uint16_t *src = (const uint16_t *)in->data[0] + slice_start * slinesize;
     uint16_t *ptr = (uint16_t *)frame->data[0] + slice_start * linesize;
 
diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c
index 10510c08bd..39e2670703 100644
--- a/libavfilter/vsrc_gradients.c
+++ b/libavfilter/vsrc_gradients.c
@@ -248,7 +248,7 @@ static int draw_gradients_slice(AVFilterContext *ctx, void *arg, int job, int nb
     const int height = frame->height;
     const int start = (height *  job   ) / nb_jobs;
     const int end   = (height * (job+1)) / nb_jobs;
-    const int linesize = frame->linesize[0] / 4;
+    const ptrdiff_t linesize = frame->linesize[0] / 4;
     uint32_t *dst = (uint32_t *)frame->data[0] + start * linesize;
     const int type = s->type;
 
@@ -272,7 +272,7 @@ static int draw_gradients_slice16(AVFilterContext *ctx, void *arg, int job, int
     const int height = frame->height;
     const int start = (height *  job   ) / nb_jobs;
     const int end   = (height * (job+1)) / nb_jobs;
-    const int linesize = frame->linesize[0] / 8;
+    const ptrdiff_t linesize = frame->linesize[0] / 8;
     uint64_t *dst = (uint64_t *)frame->data[0] + start * linesize;
     const int type = s->type;
 
@@ -296,10 +296,10 @@ static int draw_gradients_slice32_planar(AVFilterContext *ctx, void *arg, int jo
     const int height = frame->height;
     const int start = (height *  job   ) / nb_jobs;
     const int end   = (height * (job+1)) / nb_jobs;
-    const int linesize_g = frame->linesize[0] / 4;
-    const int linesize_b = frame->linesize[1] / 4;
-    const int linesize_r = frame->linesize[2] / 4;
-    const int linesize_a = frame->linesize[3] / 4;
+    const ptrdiff_t linesize_g = frame->linesize[0] / 4;
+    const ptrdiff_t linesize_b = frame->linesize[1] / 4;
+    const ptrdiff_t linesize_r = frame->linesize[2] / 4;
+    const ptrdiff_t linesize_a = frame->linesize[3] / 4;
     float *dst_g = (float *)frame->data[0] + start * linesize_g;
     float *dst_b = (float *)frame->data[1] + start * linesize_b;
     float *dst_r = (float *)frame->data[2] + start * linesize_r;
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 5e41416464..9081b55f1c 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -328,7 +328,7 @@ static void haldclutsrc_fill_picture(AVFilterContext *ctx, AVFrame *frame)
     const int w = frame->width;
     const int h = frame->height;
     uint8_t *data = frame->data[0];
-    const int linesize  = frame->linesize[0];
+    const ptrdiff_t linesize  = frame->linesize[0];
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
     const int depth = desc->comp[0].depth;
     const int planar = desc->flags & AV_PIX_FMT_FLAG_PLANAR;
@@ -510,7 +510,7 @@ AVFILTER_DEFINE_CLASS(testsrc);
  * @param w width  of the rectangle to draw, expressed as a number of segment_width units
  * @param h height of the rectangle to draw, expressed as a number of segment_width units
  */
-static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, int segment_width,
+static void draw_rectangle(unsigned val, uint8_t *dst, ptrdiff_t dst_linesize, int segment_width,
                            int x, int y, int w, int h)
 {
     int i;
@@ -525,7 +525,7 @@ static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, int seg
     }
 }
 
-static void draw_digit(int digit, uint8_t *dst, int dst_linesize,
+static void draw_digit(int digit, uint8_t *dst, ptrdiff_t dst_linesize,
                        int segment_width)
 {
 #define TOP_HBAR        1
@@ -1004,7 +1004,7 @@ static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
                               uint8_t rgba_map[4])
 {
     uint8_t *dst = dstp[0];
-    int dst_linesize = dst_linesizep[0];
+    ptrdiff_t dst_linesize = dst_linesizep[0];
     uint32_t v;
     uint8_t *p;
     uint16_t *p16;
@@ -1031,7 +1031,7 @@ static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
         AV_WL32(p, v);
         break;
     case AV_PIX_FMT_GBRP:
-        p = dstp[0] + x + y * dst_linesizep[0];
+        p = dstp[0] + x + y * dst_linesize;
         p[0] = g;
         p = dstp[1] + x + y * dst_linesizep[1];
         p[0] = b;
@@ -1160,9 +1160,9 @@ static void yuvtest_fill_picture8(AVFilterContext *ctx, AVFrame *frame)
     uint8_t *ydst = frame->data[0];
     uint8_t *udst = frame->data[1];
     uint8_t *vdst = frame->data[2];
-    int ylinesize = frame->linesize[0];
-    int ulinesize = frame->linesize[1];
-    int vlinesize = frame->linesize[2];
+    ptrdiff_t ylinesize = frame->linesize[0];
+    ptrdiff_t ulinesize = frame->linesize[1];
+    ptrdiff_t vlinesize = frame->linesize[2];
 
     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x++) {
@@ -1217,9 +1217,9 @@ static void yuvtest_fill_picture16(AVFilterContext *ctx, AVFrame *frame)
     uint16_t *ydst = (uint16_t *)frame->data[0];
     uint16_t *udst = (uint16_t *)frame->data[1];
     uint16_t *vdst = (uint16_t *)frame->data[2];
-    int ylinesize = frame->linesize[0] / 2;
-    int ulinesize = frame->linesize[1] / 2;
-    int vlinesize = frame->linesize[2] / 2;
+    ptrdiff_t ylinesize = frame->linesize[0] / 2;
+    ptrdiff_t ulinesize = frame->linesize[1] / 2;
+    ptrdiff_t vlinesize = frame->linesize[2] / 2;
 
     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x++) {
@@ -1394,7 +1394,7 @@ static void draw_bar(TestSourceContext *test, const uint8_t color[4],
 
     for (plane = 0; frame->data[plane]; plane++) {
         const int c = color[plane];
-        const int linesize = frame->linesize[plane];
+        const ptrdiff_t linesize = frame->linesize[plane];
         int i, px, py, pw, ph;
 
         if (plane == 1 || plane == 2) {
@@ -1702,9 +1702,9 @@ AVFILTER_DEFINE_CLASS_EXT(allyuv_allrgb, "allyuv/allrgb",
 
 static void allyuv_fill_picture(AVFilterContext *ctx, AVFrame *frame)
 {
-    const int ys = frame->linesize[0];
-    const int us = frame->linesize[1];
-    const int vs = frame->linesize[2];
+    const ptrdiff_t ys = frame->linesize[0];
+    const ptrdiff_t us = frame->linesize[1];
+    const ptrdiff_t vs = frame->linesize[2];
     int x, y, j;
 
     for (y = 0; y < 4096; y++) {
@@ -1763,7 +1763,7 @@ const AVFilter ff_vsrc_allyuv = {
 static void allrgb_fill_picture(AVFilterContext *ctx, AVFrame *frame)
 {
     unsigned x, y;
-    const int linesize = frame->linesize[0];
+    const ptrdiff_t linesize = frame->linesize[0];
     uint8_t *line = frame->data[0];
 
     for (y = 0; y < 4096; y++) {
@@ -2102,9 +2102,9 @@ static int zoneplate_fill_slice_##name(AVFilterContext *ctx,       \
     const int nkt2t = kt2 * t * t, nktt = kt * t;                  \
     const int start = (h *  job   ) / nb_jobs;                     \
     const int end   = (h * (job+1)) / nb_jobs;                     \
-    const int ylinesize = frame->linesize[0] / sizeof(type);       \
-    const int ulinesize = frame->linesize[1] / sizeof(type);       \
-    const int vlinesize = frame->linesize[2] / sizeof(type);       \
+    const ptrdiff_t ylinesize = frame->linesize[0] / sizeof(type); \
+    const ptrdiff_t ulinesize = frame->linesize[1] / sizeof(type); \
+    const ptrdiff_t vlinesize = frame->linesize[2] / sizeof(type); \
     const int xreset = -(w / 2) - test->xo;                        \
     const int yreset = -(h / 2) - test->yo + start;                \
     const int kU = test->kU, kV = test->kV;                        \




More information about the ffmpeg-cvslog mailing list