Re: [PR] avcodec/h264dsp: Use ptrdiff_t for stride in idct functions (PR #24066)

Kieran Kunhya via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <CABGuwEkpn_DOeNjMaCZ5L-gHXHH-uXE6GnjvW5Cefcsb63DU5A@mail.gmail.com>
On Mon, 10 Aug 2026, 02:48 mkver via ffmpeg-devel, <[email protected]>
wrote:

> PR #24066 opened by mkver
> URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24066
> Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24066.patch
>
> When porting the AARCH64 functions, I noticed that
> ff_h264_idct_add16_neon, ff_h264_idct_add16intra_neon and
> ff_h264_idct_add8_neon (all these functions call either
> ff_h264_idct_dc_add_neon or ff_h264_idct_add_neon) restore the stride
> parameter in the loop calling the other functions, although this seems to
> be unnecessary, as these callers do not modify their stride register at all.
>
>
> >From 7bfc57f36d84ebbe2b6f9fd89cb901083bf3efa2 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <[email protected]>
> Date: Mon, 10 Aug 2026 03:20:51 +0200
> Subject: [PATCH] avcodec/h264dsp: Use ptrdiff_t for stride in idct
> functions
>
> Signed-off-by: Andreas Rheinhardt <[email protected]>
> ---
>  libavcodec/aarch64/h264dsp_init_aarch64.c | 16 +++++-----
>  libavcodec/aarch64/h264idct_neon.S        | 18 +++++------
>  libavcodec/arm/h264dsp_init_arm.c         | 28 ++++++++---------
>  libavcodec/h264_mb.c                      |  6 ++--
>  libavcodec/h264_mb_template.c             |  2 +-
>  libavcodec/h264addpx_template.c           |  4 +--
>  libavcodec/h264dsp.h                      | 20 ++++++------
>  libavcodec/h264idct.h                     | 19 ++++++------
>  libavcodec/h264idct_template.c            | 25 +++++++++------
>  libavcodec/loongarch/h264dsp_lasx.c       |  4 +--
>  libavcodec/loongarch/h264dsp_loongarch.h  | 36 ++++++++++-----------
>  libavcodec/loongarch/h264idct.S           | 10 +++---
>  libavcodec/loongarch/h264idct_loongarch.c | 12 +++----
>  libavcodec/mips/h264dsp_mips.h            | 38 +++++++++++------------
>  libavcodec/mips/h264dsp_mmi.c             | 20 ++++++------
>  libavcodec/mips/h264idct_msa.c            | 22 ++++++-------
>  libavcodec/ppc/h264dsp.c                  | 22 ++++++-------
>  libavcodec/riscv/h264dsp_init.c           | 26 ++++++++--------
>  libavcodec/x86/h264_idct.asm              | 23 +++++---------
>  libavcodec/x86/h264_idct_10bit.asm        | 29 ++++++-----------
>  libavcodec/x86/h264dsp_init.c             |  6 ++--
>  tests/checkasm/h264dsp.c                  |  8 ++---
>  22 files changed, 190 insertions(+), 204 deletions(-)
>
> diff --git a/libavcodec/aarch64/h264dsp_init_aarch64.c
> b/libavcodec/aarch64/h264dsp_init_aarch64.c
> index c684574320..e4b3aac8ce 100644
> --- a/libavcodec/aarch64/h264dsp_init_aarch64.c
> +++ b/libavcodec/aarch64/h264dsp_init_aarch64.c
> @@ -65,22 +65,22 @@ void ff_biweight_h264_pixels_4_neon(uint8_t *dst,
> uint8_t *src, ptrdiff_t stride
>                                      int height, int log2_den, int weightd,
>                                      int weights, int offset);
>
> -void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
> +void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>  void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
> -                             int16_t *block, int stride,
> +                             int16_t *block, ptrdiff_t stride,
>                               const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
> -                                  int16_t *block, int stride,
> +                                  int16_t *block, ptrdiff_t stride,
>                                    const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
> -                            int16_t *block, int stride,
> +                            int16_t *block, ptrdiff_t stride,
>                              const uint8_t nnzc[15 * 8]);
>
> -void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
> +void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>  void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
> -                             int16_t *block, int stride,
> +                             int16_t *block, ptrdiff_t stride,
>                               const uint8_t nnzc[5 * 8]);
>
>  void ff_h264_v_loop_filter_luma_neon_10(uint8_t *pix, ptrdiff_t stride,
> int alpha,
> diff --git a/libavcodec/aarch64/h264idct_neon.S
> b/libavcodec/aarch64/h264idct_neon.S
> index 3f7ff2c49e..4e2f98b1da 100644
> --- a/libavcodec/aarch64/h264idct_neon.S
> +++ b/libavcodec/aarch64/h264idct_neon.S
> @@ -26,7 +26,6 @@ function ff_h264_idct_add_neon, export=1
>  .L_ff_h264_idct_add_neon:
>          AARCH64_VALID_CALL_TARGET
>          ld1             {v0.4h, v1.4h, v2.4h, v3.4h},  [x1]
> -        sxtw            x2,     w2
>          movi            v30.8h, #0
>
>          add             v4.4h,  v0.4h,  v2.4h
> @@ -81,7 +80,6 @@ endfunc
>  function ff_h264_idct_dc_add_neon, export=1
>  .L_ff_h264_idct_dc_add_neon:
>          AARCH64_VALID_CALL_TARGET
> -        sxtw            x2,  w2
>          mov             w3,       #0
>          ld1r            {v2.8h},  [x1]
>          strh            w3,       [x1]
> @@ -107,12 +105,12 @@ function ff_h264_idct_add16_neon, export=1
>          mov             x6,  x0         // dest
>          mov             x5,  x1         // block_offset
>          mov             x1,  x2         // block
> -        mov             w9,  w3         // stride
> +        mov             x9,  x3         // stride
>          movrel          x7,  scan8
>          mov             x10, #16
>          movrel          x13, .L_ff_h264_idct_dc_add_neon
>          movrel          x14, .L_ff_h264_idct_add_neon
> -1:      mov             w2,  w9
> +1:      mov             x2,  x9
>          ldrb            w3,  [x7], #1
>          ldrsw           x0,  [x5], #4
>          ldrb            w3,  [x4,  w3,  uxtw]
> @@ -134,12 +132,12 @@ function ff_h264_idct_add16intra_neon, export=1
>          mov             x6,  x0         // dest
>          mov             x5,  x1         // block_offset
>          mov             x1,  x2         // block
> -        mov             w9,  w3         // stride
> +        mov             x9,  x3         // stride
>          movrel          x7,  scan8
>          mov             x10, #16
>          movrel          x13, .L_ff_h264_idct_dc_add_neon
>          movrel          x14, .L_ff_h264_idct_add_neon
> -1:      mov             w2,  w9
> +1:      mov             x2,  x9
>          ldrb            w3,  [x7], #1
>          ldrsw           x0,  [x5], #4
>          ldrb            w3,  [x4,  w3,  uxtw]
> @@ -162,13 +160,13 @@ function ff_h264_idct_add8_neon, export=1
>          ldp             x6,  x15, [x0]          // dest[0], dest[1]
>          add             x5,  x1,  #16*4         // block_offset
>          add             x9,  x2,  #16*32        // block
> -        mov             w19, w3                 // stride
> +        mov             x19, x3                 // stride
>          movrel          x13, .L_ff_h264_idct_dc_add_neon
>          movrel          x14, .L_ff_h264_idct_add_neon
>          movrel          x7,  scan8, 16
>          mov             x10, #0
>          mov             x11, #16
> -1:      mov             w2,  w19
> +1:      mov             x2,  x19
>          ldrb            w3,  [x7, x10]          // scan8[i]
>          ldrsw           x0,  [x5, x10, lsl #2]  // block_offset[i]
>          ldrb            w3,  [x4, w3,  uxtw]    // nnzc[ scan8[i] ]
> @@ -268,7 +266,6 @@ function ff_h264_idct8_add_neon, export=1
>  .L_ff_h264_idct8_add_neon:
>          AARCH64_VALID_CALL_TARGET
>          movi            v19.8h,   #0
> -        sxtw            x2,       w2
>          ld1             {v24.8h, v25.8h}, [x1]
>          st1             {v19.8h},  [x1],   #16
>          st1             {v19.8h},  [x1],   #16
> @@ -333,7 +330,6 @@ function ff_h264_idct8_dc_add_neon, export=1
>  .L_ff_h264_idct8_dc_add_neon:
>          AARCH64_VALID_CALL_TARGET
>          mov             w3,       #0
> -        sxtw            x2,       w2
>          ld1r            {v31.8h}, [x1]
>          strh            w3,       [x1]
>          ld1             {v0.8b},  [x0], x2
> @@ -378,7 +374,7 @@ function ff_h264_idct8_add4_neon, export=1
>          mov             x6,  x0
>          mov             x5,  x1
>          mov             x1,  x2
> -        mov             w2,  w3
> +        mov             x2,  x3
>          movrel          x7,  scan8
>          mov             w10, #16
>          movrel          x13, .L_ff_h264_idct8_dc_add_neon
> diff --git a/libavcodec/arm/h264dsp_init_arm.c
> b/libavcodec/arm/h264dsp_init_arm.c
> index 050ceb90bf..80c2620637 100644
> --- a/libavcodec/arm/h264dsp_init_arm.c
> +++ b/libavcodec/arm/h264dsp_init_arm.c
> @@ -36,39 +36,39 @@ void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix,
> ptrdiff_t stride, int alpha
>  void ff_h264_h_loop_filter_chroma422_neon(uint8_t *pix, ptrdiff_t stride,
> int alpha,
>                                            int beta, int8_t *tc0);
>
> -void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height,
> +void ff_weight_h264_pixels_16_neon(uint8_t *dst, ptrdiff_t stride, int
> height,
>                                     int log2_den, int weight, int offset);
> -void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height,
> +void ff_weight_h264_pixels_8_neon(uint8_t *dst, ptrdiff_t stride, int
> height,
>                                    int log2_den, int weight, int offset);
> -void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height,
> +void ff_weight_h264_pixels_4_neon(uint8_t *dst, ptrdiff_t stride, int
> height,
>                                    int log2_den, int weight, int offset);
>
> -void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int
> stride,
> +void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src,
> ptrdiff_t stride,
>                                       int height, int log2_den, int
> weightd,
>                                       int weights, int offset);
> -void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int
> stride,
> +void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t
> stride,
>                                      int height, int log2_den, int weightd,
>                                      int weights, int offset);
> -void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int
> stride,
> +void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t
> stride,
>                                      int height, int log2_den, int weightd,
>                                      int weights, int offset);
>
> -void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
> +void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>  void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
> -                             int16_t *block, int stride,
> +                             int16_t *block, ptrdiff_t stride,
>                               const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
> -                                  int16_t *block, int stride,
> +                                  int16_t *block, ptrdiff_t stride,
>                                    const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
> -                            int16_t *block, int stride,
> +                            int16_t *block, ptrdiff_t stride,
>                              const uint8_t nnzc[15 * 8]);
>
> -void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
> +void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>  void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
> -                             int16_t *block, int stride,
> +                             int16_t *block, ptrdiff_t stride,
>                               const uint8_t nnzc[5 * 8]);
>
>  static av_cold void h264dsp_init_neon(H264DSPContext *c, const int
> bit_depth,
> diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
> index 67fa980de3..aa87db2449 100644
> --- a/libavcodec/h264_mb.c
> +++ b/libavcodec/h264_mb.c
> @@ -620,8 +620,8 @@ static av_always_inline void
> hl_decode_mb_predict_luma(const H264Context *h,
>                                                         int linesize,
>                                                         uint8_t *dest_y,
> int p)
>  {
> -    void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
> -    void (*idct_dc_add)(uint8_t *dst, int16_t *block, int stride);
> +    void (*idct_add)(uint8_t *dst, int16_t *block, ptrdiff_t stride);
> +    void (*idct_dc_add)(uint8_t *dst, int16_t *block, ptrdiff_t stride);
>      int i;
>      int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1];
>      block_offset += 16 * p;
> @@ -733,7 +733,7 @@ static av_always_inline void
> hl_decode_mb_idct_luma(const H264Context *h, H264Sl
>                                                      int linesize,
>                                                      uint8_t *dest_y, int
> p)
>  {
> -    void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
> +    void (*idct_add)(uint8_t *dst, int16_t *block, ptrdiff_t stride);
>      int i;
>      block_offset += 16 * p;
>      if (!IS_INTRA4x4(mb_type)) {
> diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c
> index ee8c81a10c..050e1db783 100644
> --- a/libavcodec/h264_mb_template.c
> +++ b/libavcodec/h264_mb_template.c
> @@ -49,7 +49,7 @@ static av_noinline void FUNC(hl_decode_mb)(const
> H264Context *h, H264SliceContex
>      int i, j;
>      const int *block_offset = &h->block_offset[0];
>      const int transform_bypass = !SIMPLE && (sl->qscale == 0 &&
> h->ps.sps->transform_bypass);
> -    void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
> +    void (*idct_add)(uint8_t *dst, int16_t *block, ptrdiff_t stride);
>      const int block_h   = 16 >> h->chroma_y_shift;
>      const int chroma422 = CHROMA422(h);
>
> diff --git a/libavcodec/h264addpx_template.c
> b/libavcodec/h264addpx_template.c
> index 9a1e6a2f2f..b04430edda 100644
> --- a/libavcodec/h264addpx_template.c
> +++ b/libavcodec/h264addpx_template.c
> @@ -27,7 +27,7 @@
>
>  #include "bit_depth_template.c"
>
> -static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int
> stride)
> +static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src,
> ptrdiff_t stride)
>  {
>      int i;
>      pixel *dst = (pixel *) _dst;
> @@ -47,7 +47,7 @@ static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst,
> int16_t *_src, int stride)
>      memset(_src, 0, sizeof(dctcoef) * 16);
>  }
>
> -static void FUNCC(ff_h264_add_pixels8)(uint8_t *_dst, int16_t *_src, int
> stride)
> +static void FUNCC(ff_h264_add_pixels8)(uint8_t *_dst, int16_t *_src,
> ptrdiff_t stride)
>  {
>      int i;
>      pixel *dst = (pixel *) _dst;
> diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
> index f40d324a4e..1ade25e4ac 100644
> --- a/libavcodec/h264dsp.h
> +++ b/libavcodec/h264dsp.h
> @@ -79,33 +79,33 @@ typedef struct H264DSPContext {
>
>      /* IDCT */
>      void (*idct_add)(uint8_t *dst /*align 4*/,
> -                     int16_t *block /*align 16*/, int stride);
> +                     int16_t *block /*align 16*/, ptrdiff_t stride);
>      void (*idct8_add)(uint8_t *dst /*align 8*/,
> -                      int16_t *block /*align 16*/, int stride);
> +                      int16_t *block /*align 16*/, ptrdiff_t stride);
>      void (*idct_dc_add)(uint8_t *dst /*align 4*/,
> -                        int16_t *block /*align 16*/, int stride);
> +                        int16_t *block /*align 16*/, ptrdiff_t stride);
>      void (*idct8_dc_add)(uint8_t *dst /*align 8*/,
> -                         int16_t *block /*align 16*/, int stride);
> +                         int16_t *block /*align 16*/, ptrdiff_t stride);
>
>      void (*idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset,
> -                       int16_t *block /*align 16*/, int stride,
> +                       int16_t *block /*align 16*/, ptrdiff_t stride,
>                         const uint8_t nnzc[5 * 8]);
>      void (*idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset,
> -                       int16_t *block /*align 16*/, int stride,
> +                       int16_t *block /*align 16*/, ptrdiff_t stride,
>                         const uint8_t nnzc[5 * 8]);
>      void (*idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset,
> -                      int16_t *block /*align 16*/, int stride,
> +                      int16_t *block /*align 16*/, ptrdiff_t stride,
>                        const uint8_t nnzc[15 * 8]);
>      void (*idct_add16intra)(uint8_t *dst /*align 16*/, const int
> *blockoffset,
>                              int16_t *block /*align 16*/,
> -                            int stride, const uint8_t nnzc[5 * 8]);
> +                            ptrdiff_t stride, const uint8_t nnzc[5 * 8]);
>      void (*luma_dc_dequant_idct)(int16_t *output,
>                                   int16_t *input /*align 16*/, int qmul);
>      void (*chroma_dc_dequant_idct)(int16_t *block, int qmul);
>
>      /* bypass-transform */
> -    void (*add_pixels8_clear)(uint8_t *dst, int16_t *block, int stride);
> -    void (*add_pixels4_clear)(uint8_t *dst, int16_t *block, int stride);
> +    void (*add_pixels8_clear)(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +    void (*add_pixels4_clear)(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>
>      /**
>       * Search buf from the start for up to size bytes. Return the index
> diff --git a/libavcodec/h264idct.h b/libavcodec/h264idct.h
> index 42e93ed17a..53629e1aac 100644
> --- a/libavcodec/h264idct.h
> +++ b/libavcodec/h264idct.h
> @@ -19,18 +19,19 @@
>  #ifndef AVCODEC_H264IDCT_H
>  #define AVCODEC_H264IDCT_H
>
> +#include <stddef.h>
>  #include <stdint.h>
>
>  #define H264_IDCT(depth) \
> -void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int
> stride);\
> -void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int
> stride);\
> -void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block,
> int stride);\
> -void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block,
> int stride);\
> -void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int
> *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\
> -void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int
> *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\
> -void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int
> *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\
> -void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int
> *blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\
> -void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int
> *blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\
> +void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, int16_t *block,
> ptrdiff_t stride);\
> +void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, int16_t *block,
> ptrdiff_t stride);\
> +void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block,
> ptrdiff_t stride);\
> +void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block,
> ptrdiff_t stride);\
> +void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int
> *blockoffset, int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);\
> +void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int
> *blockoffset, int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);\
> +void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int
> *blockoffset, int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);\
> +void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int
> *blockoffset, int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15 *
> 8]);\
> +void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int
> *blockoffset, int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15 *
> 8]);\
>
>  H264_IDCT( 8)
>  H264_IDCT( 9)
> diff --git a/libavcodec/h264idct_template.c
> b/libavcodec/h264idct_template.c
> index 64f5faddca..92be515c92 100644
> --- a/libavcodec/h264idct_template.c
> +++ b/libavcodec/h264idct_template.c
> @@ -30,7 +30,7 @@
>  #include "h264_parse.h"
>  #include "h264idct.h"
>
> -void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride)
> +void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, ptrdiff_t
> stride)
>  {
>      int i;
>      pixel *dst = (pixel*)_dst;
> @@ -66,7 +66,8 @@ void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t
> *_block, int stride)
>      memset(block, 0, 16 * sizeof(dctcoef));
>  }
>
> -void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
> +void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, ptrdiff_t
> stride)
> +{
>      int i;
>      pixel *dst = (pixel*)_dst;
>      dctcoef *block = (dctcoef*)_block;
> @@ -141,7 +142,8 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t
> *_block, int stride){
>  }
>
>  // assumes all AC coefs are 0
> -void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block, int
> stride){
> +void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block, ptrdiff_t
> stride)
> +{
>      int i, j;
>      pixel *dst = (pixel*)_dst;
>      dctcoef *block = (dctcoef*)_block;
> @@ -156,7 +158,8 @@ void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t
> *_block, int stride){
>      }
>  }
>
> -void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int
> stride){
> +void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block,
> ptrdiff_t stride)
> +{
>      int i, j;
>      pixel *dst = (pixel*)_dst;
>      dctcoef *block = (dctcoef*)_block;
> @@ -172,7 +175,7 @@ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst,
> int16_t *_block, int stride){
>  }
>
>  void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset,
> -                               int16_t *block, int stride,
> +                               int16_t *block, ptrdiff_t stride,
>                                 const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -186,7 +189,7 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int
> *block_offset,
>  }
>
>  void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset,
> -                                    int16_t *block, int stride,
> +                                    int16_t *block, ptrdiff_t stride,
>                                      const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -197,7 +200,7 @@ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst,
> const int *block_offset,
>  }
>
>  void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset,
> -                               int16_t *block, int stride,
> +                               int16_t *block, ptrdiff_t stride,
>                                 const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -210,7 +213,9 @@ void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int
> *block_offset,
>      }
>  }
>
> -void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset,
> int16_t *block, int stride, const uint8_t nnzc[15*8]){
> +void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset,
> int16_t *block,
> +                              ptrdiff_t stride, const uint8_t nnzc[15*8])
> +{
>      int i, j;
>      for(j=1; j<3; j++){
>          for(i=j*16; i<j*16+4; i++){
> @@ -222,7 +227,9 @@ void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const
> int *block_offset, int16_t *
>      }
>  }
>
> -void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int
> *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
> +void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset,
> +                                  int16_t *block, ptrdiff_t stride, const
> uint8_t nnzc[15*8])
> +{
>      int i, j;
>
>      for(j=1; j<3; j++){
> diff --git a/libavcodec/loongarch/h264dsp_lasx.c
> b/libavcodec/loongarch/h264dsp_lasx.c
> index 5205cc849f..c2c9ea7f0f 100644
> --- a/libavcodec/loongarch/h264dsp_lasx.c
> +++ b/libavcodec/loongarch/h264dsp_lasx.c
> @@ -699,7 +699,7 @@ void ff_h264_v_lpf_luma_intra_8_lasx(uint8_t *data,
> ptrdiff_t img_width,
>      }
>  }
>
> -void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, int stride)
> +void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride)
>  {
>      __m256i src0, dst0, dst1, dst2, dst3, zero;
>      __m256i tmp0, tmp1;
> @@ -726,7 +726,7 @@ void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t
> *_src, int stride)
>      __lasx_xvst(zero, _src, 0);
>  }
>
> -void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, int stride)
> +void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride)
>  {
>      __m256i src0, src1, src2, src3;
>      __m256i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
> diff --git a/libavcodec/loongarch/h264dsp_loongarch.h
> b/libavcodec/loongarch/h264dsp_loongarch.h
> index e17522dfe0..8d99910723 100644
> --- a/libavcodec/loongarch/h264dsp_loongarch.h
> +++ b/libavcodec/loongarch/h264dsp_loongarch.h
> @@ -26,25 +26,25 @@
>  #include "libavcodec/h264dec.h"
>  #include "config.h"
>
> -void ff_h264_idct_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
> -void ff_h264_idct8_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
> -void ff_h264_idct_dc_add_8_lsx(uint8_t *dst, int16_t *src, int
> dst_stride);
> -void ff_h264_idct8_dc_add_8_lsx(uint8_t *dst, int16_t *src, int
> dst_stride);
> +void ff_h264_idct_add_8_lsx(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
> +void ff_h264_idct8_add_8_lsx(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
> +void ff_h264_idct_dc_add_8_lsx(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
> +void ff_h264_idct8_dc_add_8_lsx(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
>  void ff_h264_luma_dc_dequant_idct_8_lsx(int16_t *_output, int16_t
> *_input, int qmul);
>  void ff_h264_idct_add16_8_lsx(uint8_t *dst, const int32_t *blk_offset,
> -                              int16_t *block, int32_t dst_stride,
> +                              int16_t *block, ptrdiff_t dst_stride,
>                                const uint8_t nzc[15 * 8]);
>  void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const int32_t *blk_offset,
> -                              int16_t *block, int32_t dst_stride,
> +                              int16_t *block, ptrdiff_t dst_stride,
>                                const uint8_t nzc[15 * 8]);
>  void ff_h264_idct_add8_8_lsx(uint8_t **dst, const int32_t *blk_offset,
> -                             int16_t *block, int32_t dst_stride,
> +                             int16_t *block, ptrdiff_t dst_stride,
>                               const uint8_t nzc[15 * 8]);
>  void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const int32_t *blk_offset,
> -                                 int16_t *block, int32_t dst_stride,
> +                                 int16_t *block, ptrdiff_t dst_stride,
>                                   const uint8_t nzc[15 * 8]);
>  void ff_h264_idct_add16_intra_8_lsx(uint8_t *dst, const int32_t
> *blk_offset,
> -                                    int16_t *block, int32_t dst_stride,
> +                                    int16_t *block, ptrdiff_t dst_stride,
>                                      const uint8_t nzc[15 * 8]);
>
>  void ff_h264_h_lpf_luma_8_lsx(uint8_t *src, ptrdiff_t stride,
> @@ -84,8 +84,8 @@ void ff_weight_h264_pixels8_8_lsx(uint8_t *src,
> ptrdiff_t stride,
>  void ff_weight_h264_pixels4_8_lsx(uint8_t *src, ptrdiff_t stride,
>                                    int height, int log2_denom,
>                                    int weight_src, int offset);
> -void ff_h264_add_pixels4_8_lsx(uint8_t *_dst, int16_t *_src, int stride);
> -void ff_h264_add_pixels8_8_lsx(uint8_t *_dst, int16_t *_src, int stride);
> +void ff_h264_add_pixels4_8_lsx(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride);
> +void ff_h264_add_pixels8_8_lsx(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride);
>  void ff_h264_loop_filter_strength_lsx(int16_t bS[2][4][4], uint8_t
> nnz[40],
>                                        int8_t ref[2][40], int16_t
> mv[2][40][2],
>                                        int bidir, int edges, int step,
> @@ -101,11 +101,11 @@ void ff_h264_h_lpf_luma_intra_8_lasx(uint8_t *src,
> ptrdiff_t stride,
>  void ff_h264_v_lpf_luma_intra_8_lasx(uint8_t *src, ptrdiff_t stride,
>                                       int alpha, int beta);
>  void ff_biweight_h264_pixels16_8_lasx(unsigned char *dst, unsigned char
> *src,
> -                                      long int stride, int height,
> +                                      ptrdiff_t stride, int height,
>                                        int log2_denom, int weight_dst,
>                                        int weight_src, int offset_in);
>  void ff_biweight_h264_pixels8_8_lasx(unsigned char *dst, unsigned char
> *src,
> -                                     long int stride, int height,
> +                                     ptrdiff_t stride, int height,
>                                       int log2_denom, int weight_dst,
>                                       int weight_src, int offset);
>  void ff_weight_h264_pixels16_8_lasx(uint8_t *src, ptrdiff_t stride,
> @@ -114,14 +114,14 @@ void ff_weight_h264_pixels16_8_lasx(uint8_t *src,
> ptrdiff_t stride,
>  void ff_weight_h264_pixels8_8_lasx(uint8_t *src, ptrdiff_t stride,
>                                     int height, int log2_denom,
>                                     int weight_src, int offset);
> -void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, int stride);
> +void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride);
>
> -void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, int stride);
> -void ff_h264_idct8_add_8_lasx(uint8_t *dst, int16_t *src, int32_t
> dst_stride);
> +void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride);
> +void ff_h264_idct8_add_8_lasx(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
>  void ff_h264_idct8_dc_add_8_lasx(uint8_t *dst, int16_t *src,
> -                                  int32_t dst_stride);
> +                                  ptrdiff_t dst_stride);
>  void ff_h264_idct8_add4_8_lasx(uint8_t *dst, const int32_t *blk_offset,
> -                               int16_t *block, int32_t dst_stride,
> +                               int16_t *block, ptrdiff_t dst_stride,
>                                 const uint8_t nzc[15 * 8]);
>  void ff_h264_loop_filter_strength_lasx(int16_t bS[2][4][4], uint8_t
> nnz[40],
>                                         int8_t ref[2][40], int16_t
> mv[2][40][2],
> diff --git a/libavcodec/loongarch/h264idct.S
> b/libavcodec/loongarch/h264idct.S
> index f504cfb714..d47c5209ef 100644
> --- a/libavcodec/loongarch/h264idct.S
> +++ b/libavcodec/loongarch/h264idct.S
> @@ -26,7 +26,7 @@
>  /*
>   * #define FUNC2(a, b, c)  FUNC3(a, b, c)
>   * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
> - * void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int
> stride)
> + * void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, ptrdiff_t
> stride)
>   * LSX optimization is enough for this function.
>   */
>  function ff_h264_idct_add_8_lsx
> @@ -88,7 +88,7 @@ endfunc
>  /*
>   * #define FUNC2(a, b, c)  FUNC3(a, b, c)
>   * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
> - * void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int
> stride)
> + * void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block,
> ptrdiff_t stride)
>   */
>  function ff_h264_idct8_add_8_lsx
>      ld.h          t0,     a1,    0
> @@ -295,7 +295,7 @@ endfunc
>  /*
>   * #define FUNC2(a, b, c)  FUNC3(a, b, c)
>   * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
> - * void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int
> stride)
> + * void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block,
> ptrdiff_t stride)
>   */
>  function ff_h264_idct8_add_8_lasx
>      ld.h          t0,     a1,    0
> @@ -466,7 +466,7 @@ endfunc
>  /*
>   * #define FUNC2(a, b, c)  FUNC3(a, b, c)
>   * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
> - * void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block, int
> stride)
> + * void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block,
> ptrdiff_t stride)
>   * LSX optimization is enough for this function.
>   */
>  function ff_h264_idct_dc_add_8_lsx
> @@ -500,7 +500,7 @@ endfunc
>  /*
>   * #define FUNC2(a, b, c)  FUNC3(a, b, c)
>   * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
> - * void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int
> stride)
> + * void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block,
> ptrdiff_t stride)
>   */
>  function ff_h264_idct8_dc_add_8_lsx
>      vldrepl.h     vr8,    a1,    0
> diff --git a/libavcodec/loongarch/h264idct_loongarch.c
> b/libavcodec/loongarch/h264idct_loongarch.c
> index 26af45503f..b51f9cd6ec 100644
> --- a/libavcodec/loongarch/h264idct_loongarch.c
> +++ b/libavcodec/loongarch/h264idct_loongarch.c
> @@ -26,7 +26,7 @@
>  #include "libavcodec/bit_depth_template.c"
>
>  void ff_h264_idct_add16_8_lsx(uint8_t *dst, const int32_t *blk_offset,
> -                              int16_t *block, int32_t dst_stride,
> +                              int16_t *block, ptrdiff_t dst_stride,
>                                const uint8_t nzc[15 * 8])
>  {
>      int32_t i;
> @@ -47,7 +47,7 @@ void ff_h264_idct_add16_8_lsx(uint8_t *dst, const
> int32_t *blk_offset,
>  }
>
>  void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const int32_t *blk_offset,
> -                              int16_t *block, int32_t dst_stride,
> +                              int16_t *block, ptrdiff_t dst_stride,
>                                const uint8_t nzc[15 * 8])
>  {
>      int32_t cnt;
> @@ -69,7 +69,7 @@ void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const
> int32_t *blk_offset,
>
>  #if HAVE_LASX
>  void ff_h264_idct8_add4_8_lasx(uint8_t *dst, const int32_t *blk_offset,
> -                               int16_t *block, int32_t dst_stride,
> +                               int16_t *block, ptrdiff_t dst_stride,
>                                 const uint8_t nzc[15 * 8])
>  {
>      int32_t cnt;
> @@ -91,7 +91,7 @@ void ff_h264_idct8_add4_8_lasx(uint8_t *dst, const
> int32_t *blk_offset,
>  #endif // #if HAVE_LASX
>
>  void ff_h264_idct_add8_8_lsx(uint8_t **dst, const int32_t *blk_offset,
> -                             int16_t *block, int32_t dst_stride,
> +                             int16_t *block, ptrdiff_t dst_stride,
>                               const uint8_t nzc[15 * 8])
>  {
>      int32_t i;
> @@ -119,7 +119,7 @@ void ff_h264_idct_add8_8_lsx(uint8_t **dst, const
> int32_t *blk_offset,
>  }
>
>  void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const int32_t *blk_offset,
> -                                 int16_t *block, int32_t dst_stride,
> +                                 int16_t *block, ptrdiff_t dst_stride,
>                                   const uint8_t nzc[15 * 8])
>  {
>      int32_t i;
> @@ -167,7 +167,7 @@ void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const
> int32_t *blk_offset,
>  }
>
>  void ff_h264_idct_add16_intra_8_lsx(uint8_t *dst, const int32_t
> *blk_offset,
> -                                    int16_t *block, int32_t dst_stride,
> +                                    int16_t *block, ptrdiff_t dst_stride,
>                                      const uint8_t nzc[15 * 8])
>  {
>      int32_t i;
> diff --git a/libavcodec/mips/h264dsp_mips.h
> b/libavcodec/mips/h264dsp_mips.h
> index 4a2a2c2559..2283dd6e17 100644
> --- a/libavcodec/mips/h264dsp_mips.h
> +++ b/libavcodec/mips/h264dsp_mips.h
> @@ -43,28 +43,28 @@ void ff_h264_h_loop_filter_luma_mbaff_msa(uint8_t
> *src, ptrdiff_t stride,
>                                            int32_t alpha, int32_t beta,
>                                            int8_t *tc0);
>
> -void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, int32_t dst_stride);
> +void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
>  void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src,
> -                                   int32_t dst_stride);
> +                                   ptrdiff_t dst_stride);
>  void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src,
>                                    int32_t de_q_val);
>  void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset,
> -                            int16_t *block, int32_t stride,
> +                            int16_t *block, ptrdiff_t stride,
>                              const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset,
> -                                  int16_t *block, int32_t dst_stride,
> +                                  int16_t *block, ptrdiff_t dst_stride,
>                                    const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset,
> -                           int16_t *block, int32_t dst_stride,
> +                           int16_t *block, ptrdiff_t dst_stride,
>                             const uint8_t nnzc[15 * 8]);
>  void ff_h264_idct_add8_422_msa(uint8_t **dst, const int32_t *blk_offset,
> -                               int16_t *block, int32_t dst_stride,
> +                               int16_t *block, ptrdiff_t dst_stride,
>                                 const uint8_t nnzc[15 * 8]);
> -void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t
> dst_stride);
> +void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride);
>  void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src,
> -                                 int32_t dst_stride);
> +                                 ptrdiff_t dst_stride);
>  void ff_h264_idct8_add4_msa(uint8_t *dst, const int *blk_offset,
> -                            int16_t *blk, int dst_stride,
> +                            int16_t *blk, ptrdiff_t dst_stride,
>                              const uint8_t nnzc[5 * 8]);
>
>  void ff_h264_h_lpf_luma_intra_msa(uint8_t *src, ptrdiff_t stride,
> @@ -323,21 +323,21 @@ void ff_h264_loop_filter_strength_msa(int16_t
> bS[2][4][4], uint8_t nnz[40],
>          int8_t ref[2][40], int16_t mv[2][40][2], int bidir, int edges,
>          int step, int mask_mv0, int mask_mv1, int field);
>
> -void ff_h264_add_pixels4_8_mmi(uint8_t *_dst, int16_t *_src, int stride);
> -void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride);
> +void ff_h264_add_pixels4_8_mmi(uint8_t *_dst, int16_t *_src, ptrdiff_t
> stride);
> +void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>  void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);
>  void ff_h264_idct_add8_8_mmi(uint8_t **dest, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[15*8]);
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15*8]);
>  void ff_h264_idct_add8_422_8_mmi(uint8_t **dest, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[15*8]);
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15*8]);
>  void ff_h264_luma_dc_dequant_idct_8_mmi(int16_t *output, int16_t *input,
>          int qmul);
>
> diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c
> index bae1052dcf..bee4e84e37 100644
> --- a/libavcodec/mips/h264dsp_mmi.c
> +++ b/libavcodec/mips/h264dsp_mmi.c
> @@ -28,7 +28,7 @@
>  #include "libavutil/mips/mmiutils.h"
>  #include "libavutil/mem_internal.h"
>
> -void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, int stride)
> +void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, ptrdiff_t
> stride)
>  {
>      double ftmp[9];
>      DECLARE_VAR_LOW32;
> @@ -76,7 +76,7 @@ void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t
> *src, int stride)
>
>  }
>
> -void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
> +void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride)
>  {
>      double ftmp[12];
>      uint64_t tmp[1];
> @@ -168,7 +168,7 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t
> *block, int stride)
>
>  }
>
> -void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
> +void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride)
>  {
>      double ftmp[16];
>      uint64_t tmp[7];
> @@ -636,7 +636,7 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t
> *block, int stride)
>
>  }
>
> -void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
> +void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride)
>  {
>      int dc = (block[0] + 32) >> 6;
>      double ftmp[6];
> @@ -680,7 +680,7 @@ void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t
> *block, int stride)
>      );
>  }
>
> -void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
> +void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, ptrdiff_t
> stride)
>  {
>      int dc = (block[0] + 32) >> 6;
>      double ftmp[10];
> @@ -766,7 +766,7 @@ void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t
> *block, int stride)
>  }
>
>  void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset,
> -                              int16_t *block, int stride,
> +                              int16_t *block, ptrdiff_t stride,
>                                const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -784,7 +784,7 @@ void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int
> *block_offset,
>  }
>
>  void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[5 * 8])
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8])
>  {
>      int i;
>      for(i=0; i<16; i++){
> @@ -797,7 +797,7 @@ void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const
> int *block_offset,
>  }
>
>  void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[5 * 8])
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8])
>  {
>      int i;
>      for(i=0; i<16; i+=4){
> @@ -814,7 +814,7 @@ void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int
> *block_offset,
>  }
>
>  void ff_h264_idct_add8_8_mmi(uint8_t **dest, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[15*8])
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15*8])
>  {
>      int i, j;
>      for(j=1; j<3; j++){
> @@ -830,7 +830,7 @@ void ff_h264_idct_add8_8_mmi(uint8_t **dest, const int
> *block_offset,
>  }
>
>  void ff_h264_idct_add8_422_8_mmi(uint8_t **dest, const int *block_offset,
> -        int16_t *block, int stride, const uint8_t nnzc[15*8])
> +        int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15*8])
>  {
>      int i, j;
>
> diff --git a/libavcodec/mips/h264idct_msa.c
> b/libavcodec/mips/h264idct_msa.c
> index 1a20a3e30e..cfa375f17d 100644
> --- a/libavcodec/mips/h264idct_msa.c
> +++ b/libavcodec/mips/h264idct_msa.c
> @@ -108,7 +108,7 @@ static void avc_deq_idct_luma_dc_msa(int16_t *dst,
> int16_t *src,
>  #undef DC_DEST_STRIDE
>  }
>
> -static void avc_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t
> dst_stride)
> +static void avc_idct8_addblk_msa(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride)
>  {
>      v8i16 src0, src1, src2, src3, src4, src5, src6, src7;
>      v8i16 vec0, vec1, vec2, vec3;
> @@ -240,7 +240,7 @@ static void avc_idct8_addblk_msa(uint8_t *dst, int16_t
> *src, int32_t dst_stride)
>  }
>
>  static void avc_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src,
> -                                    int32_t dst_stride)
> +                                    ptrdiff_t dst_stride)
>  {
>      int32_t dc_val;
>      v16i8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
> @@ -269,7 +269,7 @@ static void avc_idct8_dc_addblk_msa(uint8_t *dst,
> int16_t *src,
>      ST_D8(dst0, dst1, dst2, dst3, 0, 1, 0, 1, 0, 1, 0, 1, dst, dst_stride)
>  }
>
> -void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
> +void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, ptrdiff_t
> dst_stride)
>  {
>      uint32_t src0_m, src1_m, src2_m, src3_m, out0_m, out1_m, out2_m,
> out3_m;
>      v16i8 dst0_m = { 0 };
> @@ -311,13 +311,13 @@ void ff_h264_idct_add_msa(uint8_t *dst, int16_t
> *src, int32_t dst_stride)
>  }
>
>  void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src,
> -                              int32_t dst_stride)
> +                              ptrdiff_t dst_stride)
>  {
>      avc_idct8_addblk_msa(dst, src, dst_stride);
>  }
>
>  void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src,
> -                                   int32_t dst_stride)
> +                                   ptrdiff_t dst_stride)
>  {
>      v16u8 pred = { 0 };
>      v16i8 out;
> @@ -339,14 +339,14 @@ void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst,
> int16_t *src,
>  }
>
>  void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src,
> -                                 int32_t dst_stride)
> +                                 ptrdiff_t dst_stride)
>  {
>      avc_idct8_dc_addblk_msa(dst, src, dst_stride);
>  }
>
>  void ff_h264_idct_add16_msa(uint8_t *dst,
>                              const int32_t *blk_offset,
> -                            int16_t *block, int32_t dst_stride,
> +                            int16_t *block, ptrdiff_t dst_stride,
>                              const uint8_t nzc[5 * 8])
>  {
>      int32_t i;
> @@ -368,7 +368,7 @@ void ff_h264_idct_add16_msa(uint8_t *dst,
>  }
>
>  void ff_h264_idct8_add4_msa(uint8_t *dst, const int32_t *blk_offset,
> -                            int16_t *block, int32_t dst_stride,
> +                            int16_t *block, ptrdiff_t dst_stride,
>                              const uint8_t nzc[5 * 8])
>  {
>      int32_t cnt;
> @@ -391,7 +391,7 @@ void ff_h264_idct8_add4_msa(uint8_t *dst, const
> int32_t *blk_offset,
>
>  void ff_h264_idct_add8_msa(uint8_t **dst,
>                             const int32_t *blk_offset,
> -                           int16_t *block, int32_t dst_stride,
> +                           int16_t *block, ptrdiff_t dst_stride,
>                             const uint8_t nzc[15 * 8])
>  {
>      int32_t i, j;
> @@ -412,7 +412,7 @@ void ff_h264_idct_add8_msa(uint8_t **dst,
>
>  void ff_h264_idct_add8_422_msa(uint8_t **dst,
>                                 const int32_t *blk_offset,
> -                               int16_t *block, int32_t dst_stride,
> +                               int16_t *block, ptrdiff_t dst_stride,
>                                 const uint8_t nzc[15 * 8])
>  {
>      int32_t i, j;
> @@ -447,7 +447,7 @@ void ff_h264_idct_add8_422_msa(uint8_t **dst,
>  void ff_h264_idct_add16_intra_msa(uint8_t *dst,
>                                    const int32_t *blk_offset,
>                                    int16_t *block,
> -                                  int32_t dst_stride,
> +                                  ptrdiff_t dst_stride,
>                                    const uint8_t nzc[5 * 8])
>  {
>      int32_t i;
> diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c
> index 22d3db64a1..d832e7f01c 100644
> --- a/libavcodec/ppc/h264dsp.c
> +++ b/libavcodec/ppc/h264dsp.c
> @@ -83,7 +83,7 @@
>      va_u32 = vec_splat((vec_u32)va_u8, 0);                  \
>      vec_ste(va_u32, element, (uint32_t*)dst);
>
> -static void h264_idct_add_altivec(uint8_t *dst, int16_t *block, int
> stride)
> +static void h264_idct_add_altivec(uint8_t *dst, int16_t *block, ptrdiff_t
> stride)
>  {
>      vec_s16 va0, va1, va2, va3;
>      vec_s16 vz0, vz1, vz2, vz3;
> @@ -215,7 +215,7 @@ static void h264_idct_add_altivec(uint8_t *dst,
> int16_t *block, int stride)
>      dest_unligned_store(dest);\
>  }
>
> -static void h264_idct8_add_altivec(uint8_t *dst, int16_t *dct, int stride)
> +static void h264_idct8_add_altivec(uint8_t *dst, int16_t *dct, ptrdiff_t
> stride)
>  {
>      vec_s16 s0, s1, s2, s3, s4, s5, s6, s7;
>      vec_s16 d0, d1, d2, d3, d4, d5, d6, d7;
> @@ -266,7 +266,7 @@ static void h264_idct8_add_altivec(uint8_t *dst,
> int16_t *dct, int stride)
>  #else
>  #define DST_LD vec_vsx_ld
>  #endif
> -static av_always_inline void h264_idct_dc_add_internal(uint8_t *dst,
> int16_t *block, int stride, int size)
> +static av_always_inline void h264_idct_dc_add_internal(uint8_t *dst,
> int16_t *block, ptrdiff_t stride, int size)
>  {
>      vec_s16 dc16;
>      vec_u8 dcplus, dcminus, v0, v1, v2, v3, aligner;
> @@ -316,18 +316,18 @@ static av_always_inline void
> h264_idct_dc_add_internal(uint8_t *dst, int16_t *bl
>      }
>  }
>
> -static void h264_idct_dc_add_altivec(uint8_t *dst, int16_t *block, int
> stride)
> +static void h264_idct_dc_add_altivec(uint8_t *dst, int16_t *block,
> ptrdiff_t stride)
>  {
>      h264_idct_dc_add_internal(dst, block, stride, 4);
>  }
>
> -static void h264_idct8_dc_add_altivec(uint8_t *dst, int16_t *block, int
> stride)
> +static void h264_idct8_dc_add_altivec(uint8_t *dst, int16_t *block,
> ptrdiff_t stride)
>  {
>      h264_idct_dc_add_internal(dst, block, stride, 8);
>  }
>
>  static void h264_idct_add16_altivec(uint8_t *dst, const int *block_offset,
> -                                    int16_t *block, int stride,
> +                                    int16_t *block, ptrdiff_t stride,
>                                      const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -341,7 +341,7 @@ static void h264_idct_add16_altivec(uint8_t *dst,
> const int *block_offset,
>  }
>
>  static void h264_idct_add16intra_altivec(uint8_t *dst, const int
> *block_offset,
> -                                         int16_t *block, int stride,
> +                                         int16_t *block, ptrdiff_t stride,
>                                           const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -352,7 +352,7 @@ static void h264_idct_add16intra_altivec(uint8_t *dst,
> const int *block_offset,
>  }
>
>  static void h264_idct8_add4_altivec(uint8_t *dst, const int *block_offset,
> -                                    int16_t *block, int stride,
> +                                    int16_t *block, ptrdiff_t stride,
>                                      const uint8_t nnzc[5 * 8])
>  {
>      int i;
> @@ -366,7 +366,7 @@ static void h264_idct8_add4_altivec(uint8_t *dst,
> const int *block_offset,
>  }
>
>  static void h264_idct_add8_altivec(uint8_t **dest, const int
> *block_offset,
> -                                   int16_t *block, int stride,
> +                                   int16_t *block, ptrdiff_t stride,
>                                     const uint8_t nnzc[15 * 8])
>  {
>      int i, j;
> @@ -653,7 +653,7 @@ static void h264_h_loop_filter_luma_altivec(uint8_t
> *pix, ptrdiff_t stride, int
>  }
>
>  static av_always_inline
> -void weight_h264_W_altivec(uint8_t *block, int stride, int height,
> +void weight_h264_W_altivec(uint8_t *block, ptrdiff_t stride, int height,
>                             int log2_denom, int weight, int offset, int w)
>  {
>      int y, aligned;
> @@ -702,7 +702,7 @@ void weight_h264_W_altivec(uint8_t *block, int stride,
> int height,
>  }
>
>  static av_always_inline
> -void biweight_h264_W_altivec(uint8_t *dst, uint8_t *src, int stride, int
> height,
> +void biweight_h264_W_altivec(uint8_t *dst, uint8_t *src, ptrdiff_t
> stride, int height,
>                               int log2_denom, int weightd, int weights,
> int offset, int w)
>  {
>      int y, dst_aligned, src_aligned;
> diff --git a/libavcodec/riscv/h264dsp_init.c
> b/libavcodec/riscv/h264dsp_init.c
> index 5efec9eb5e..2f6b1c38af 100644
> --- a/libavcodec/riscv/h264dsp_init.c
> +++ b/libavcodec/riscv/h264dsp_init.c
> @@ -62,24 +62,24 @@ void
> ff_h264_h_loop_filter_chroma_mbaff_intra_8_rvv(uint8_t *pix,
>                                                      int alpha, int beta);
>
>  #define IDCT_DEPTH(depth) \
> -void ff_h264_idct_add_##depth##_rvv(uint8_t *d, int16_t *s, int stride); \
> -void ff_h264_idct8_add_##depth##_rvv(uint8_t *d, int16_t *s, int stride);
> \
> -void ff_h264_idct4_dc_add_##depth##_rvv(uint8_t *, int16_t *, int); \
> -void ff_h264_idct8_dc_add_##depth##_rvv(uint8_t *, int16_t *, int); \
> +void ff_h264_idct_add_##depth##_rvv(uint8_t *d, int16_t *s, ptrdiff_t
> stride); \
> +void ff_h264_idct8_add_##depth##_rvv(uint8_t *d, int16_t *s, ptrdiff_t
> stride); \
> +void ff_h264_idct4_dc_add_##depth##_rvv(uint8_t *, int16_t *, ptrdiff_t);
> \
> +void ff_h264_idct8_dc_add_##depth##_rvv(uint8_t *, int16_t *, ptrdiff_t);
> \
>  void ff_h264_idct_add16_##depth##_rvv(uint8_t *d, const int *soffset, \
> -                                      int16_t *s, int stride, \
> +                                      int16_t *s, ptrdiff_t stride, \
>                                        const uint8_t nnzc[5 * 8]); \
>  void ff_h264_idct_add16intra_##depth##_rvv(uint8_t *d, const int
> *soffset, \
> -                                   int16_t *s, int stride, \
> +                                   int16_t *s, ptrdiff_t stride, \
>                                     const uint8_t nnzc[5 * 8]); \
>  void ff_h264_idct8_add4_##depth##_rvv(uint8_t *d, const int *soffset, \
> -                                      int16_t *s, int stride, \
> +                                      int16_t *s, ptrdiff_t stride, \
>                                        const uint8_t nnzc[5 * 8]); \
>  void ff_h264_idct4_add8_##depth##_rvv(uint8_t **d, const int *soffset, \
> -                                      int16_t *s, int stride, \
> +                                      int16_t *s, ptrdiff_t stride, \
>                                        const uint8_t nnzc[5 * 8]); \
>  void ff_h264_idct4_add8_422_##depth##_rvv(uint8_t **d, const int
> *soffset, \
> -                                          int16_t *s, int stride, \
> +                                          int16_t *s, ptrdiff_t stride, \
>                                            const uint8_t nnzc[5 * 8]); \
>  void ff_h264_luma_dc_dequant_idct_##depth##_rvv(int16_t *d, int16_t *s,
> int q);
>
> @@ -90,10 +90,10 @@ IDCT_DEPTH(12)
>  IDCT_DEPTH(14)
>  #undef IDCT_DEPTH
>
> -void ff_h264_add_pixels8_8_rvv(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_add_pixels4_8_rvv(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_add_pixels8_16_rvv(uint8_t *dst, int16_t *block, int stride);
> -void ff_h264_add_pixels4_16_rvv(uint8_t *dst, int16_t *block, int stride);
> +void ff_h264_add_pixels8_8_rvv(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_add_pixels4_8_rvv(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_add_pixels8_16_rvv(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
> +void ff_h264_add_pixels4_16_rvv(uint8_t *dst, int16_t *block, ptrdiff_t
> stride);
>
>  extern int ff_startcode_find_candidate_rvb(const uint8_t *, int);
>  extern int ff_startcode_find_candidate_rvv(const uint8_t *, int);
> diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
> index 7f917a4424..1d4c9729fa 100644
> --- a/libavcodec/x86/h264_idct.asm
> +++ b/libavcodec/x86/h264_idct.asm
> @@ -225,9 +225,8 @@ SECTION .text
>  %endmacro
>
>  INIT_XMM sse2
> -; void ff_h264_idct8_add_8_sse2(uint8_t *dst, int16_t *block, int stride)
> +; void ff_h264_idct8_add_8_sse2(uint8_t *dst, int16_t *block, ptrdiff_t
> stride)
>  cglobal h264_idct8_add_8, 3, 4, 10
> -    movsxdifnidn  r2, r2d
>      IDCT8_ADD_SSE r0, r1, r2, r3
>      RET
>
> @@ -264,9 +263,8 @@ cglobal h264_idct8_add_8, 3, 4, 10
>
>  INIT_MMX mmxext
>  %if ARCH_X86_64
> -; void ff_h264_idct8_dc_add_8_mmxext(uint8_t *dst, int16_t *block, int
> stride)
> +; void ff_h264_idct8_dc_add_8_mmxext(uint8_t *dst, int16_t *block,
> ptrdiff_t stride)
>  cglobal h264_idct8_dc_add_8, 3, 4, 0
> -    movsxd       r2, r2d
>      movsx        r3, word [r1]
>      mov  dword [r1], 0
>      DC_ADD_MMXEXT_INIT r3, r2
> @@ -275,7 +273,7 @@ cglobal h264_idct8_dc_add_8, 3, 4, 0
>      DC_ADD_MMXEXT_OP mova, r0, r2, r3
>      RET
>  %else
> -; void ff_h264_idct8_dc_add_8_mmxext(uint8_t *dst, int16_t *block, int
> stride)
> +; void ff_h264_idct8_dc_add_8_mmxext(uint8_t *dst, int16_t *block,
> ptrdiff_t stride)
>  cglobal h264_idct8_dc_add_8, 2, 3, 0
>      movsx        r2, word [r1]
>      mov  dword [r1], 0
> @@ -289,10 +287,9 @@ cglobal h264_idct8_dc_add_8, 2, 3, 0
>
>  INIT_XMM sse2
>  ; void ff_h264_idct8_add4_8_sse2(uint8_t *dst, const int *block_offset,
> -;                                int16_t *block, int stride,
> +;                                int16_t *block, ptrdiff_t stride,
>  ;                                const uint8_t nnzc[6 * 8])
>  cglobal h264_idct8_add4_8, 5, 8 + npicregs, 10, dst1, block_offset,
> block, stride, nnzc, cntr, coeff, dst2, picreg
> -    movsxdifnidn r3, r3d
>      xor          r5, r5
>  %if PIC
>      lea     picregq, [scan8_mem]
> @@ -345,7 +342,6 @@ INIT_XMM cpuname
>  INIT_MMX mmx
>  cglobal h264_idct_add8_422_8, 5, 8 + npicregs, 0, dst1, block_offset,
> block, stride, nnzc, cntr, coeff, dst2, picreg
>  ; dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
> -    movsxdifnidn r3, r3d
>  %if PIC
>      lea     picregq, [scan8_mem]
>  %endif
> @@ -459,10 +455,9 @@ h264_add8x4_idct_sse2:
>  %endmacro
>
>  ; void ff_h264_idct_add16_8_sse2(uint8_t *dst, const int *block_offset,
> -;                                int16_t *block, int stride,
> +;                                int16_t *block, ptrdiff_t stride,
>  ;                                const uint8_t nnzc[6 * 8])
>  cglobal h264_idct_add16_8, 5, 5 + ARCH_X86_64, 8
> -    movsxdifnidn r3, r3d
>  %if ARCH_X86_64
>      mov         r5, r0
>  %endif
> @@ -507,10 +502,9 @@ RET
>  %endmacro
>
>  ; void ff_h264_idct_add16intra_8_sse2(uint8_t *dst, const int
> *block_offset,
> -;                                     int16_t *block, int stride,
> +;                                     int16_t *block, ptrdiff_t stride,
>  ;                                     const uint8_t nnzc[6 * 8])
>  cglobal h264_idct_add16intra_8, 5, 7 + ARCH_X86_64, 8
> -    movsxdifnidn r3, r3d
>  %if ARCH_X86_64
>      mov         r7, r0
>  %endif
> @@ -559,10 +553,9 @@ RET
>  %endmacro
>
>  ; void ff_h264_idct_add8_8_sse2(uint8_t **dest, const int *block_offset,
> -;                               int16_t *block, int stride,
> +;                               int16_t *block, ptrdiff_t stride,
>  ;                               const uint8_t nnzc[6 * 8])
>  cglobal h264_idct_add8_8, 5, 7 + ARCH_X86_64, 8
> -    movsxdifnidn r3, r3d
>      add          r2, 512
>  %if ARCH_X86_64
>      mov          r7, r0
> @@ -742,12 +735,10 @@ cglobal h264_luma_dc_dequant_idct, 3, 4, 6
>  INIT_XMM %1
>
>  cglobal h264_idct_add_8, 3, 3, 8, dst_, block_, stride_
> -    movsxdifnidn stride_q, stride_d
>      IDCT4_ADD    dst_q, block_q, stride_q
>  RET
>
>  cglobal h264_idct_dc_add_8, 3, 4, 6, dst_, block_, stride_
> -    movsxdifnidn stride_q, stride_d
>      movsx             r3d, word [block_q]
>      mov   dword [block_q], 0
>      DC_ADD_INIT r3
> diff --git a/libavcodec/x86/h264_idct_10bit.asm
> b/libavcodec/x86/h264_idct_10bit.asm
> index b990db7121..741b79d044 100644
> --- a/libavcodec/x86/h264_idct_10bit.asm
> +++ b/libavcodec/x86/h264_idct_10bit.asm
> @@ -31,7 +31,7 @@ cextern pw_1023
>  cextern pd_32
>
>
>  ;-----------------------------------------------------------------------------
> -; void ff_h264_idct_add_10(pixel *dst, int16_t *block, int stride)
> +; void ff_h264_idct_add_10(pixel *dst, int16_t *block, ptrdiff_t stride)
>
>  ;-----------------------------------------------------------------------------
>  %macro STORE_DIFFx2 6
>      psrad       %1, 6
> @@ -76,7 +76,6 @@ cextern pd_32
>
>  %macro IDCT_ADD_10 0
>  cglobal h264_idct_add_10, 3,3
> -    movsxdifnidn r2, r2d
>      IDCT4_ADD_10 r0, r1, r2
>      RET
>  %endmacro
> @@ -90,7 +89,7 @@ IDCT_ADD_10
>
>
>  ;-----------------------------------------------------------------------------
>  ; void ff_h264_idct_add16_10(pixel *dst, const int *block_offset,
> -;                            int16_t *block, int stride,
> +;                            int16_t *block, ptrdiff_t stride,
>  ;                            const uint8_t nnzc[6*8])
>
>  ;-----------------------------------------------------------------------------
>  ;;;;;;; NO FATE SAMPLES TRIGGER THIS
> @@ -138,7 +137,6 @@ ADD4x4IDCT
>
>  %macro IDCT_ADD16_10 0
>  cglobal h264_idct_add16_10, 5,6
> -    movsxdifnidn r3, r3d
>      ADD16_OP 0, 4+1*8
>      ADD16_OP 1, 5+1*8
>      ADD16_OP 2, 4+2*8
> @@ -166,7 +164,7 @@ IDCT_ADD16_10
>  %endif
>
>
>  ;-----------------------------------------------------------------------------
> -; void ff_h264_idct_dc_add_10(pixel *dst, int16_t *block, int stride)
> +; void ff_h264_idct_dc_add_10(pixel *dst, int16_t *block, ptrdiff_t
> stride)
>
>  ;-----------------------------------------------------------------------------
>  %macro IDCT_DC_ADD_OP_10 3
>      pxor      m5, m5
> @@ -197,7 +195,6 @@ IDCT_ADD16_10
>
>  INIT_MMX mmxext
>  cglobal h264_idct_dc_add_10,3,3
> -    movsxdifnidn r2, r2d
>      movd      m0, [r1]
>      mov dword [r1], 0
>      paddd     m0, [pd_32]
> @@ -209,11 +206,10 @@ cglobal h264_idct_dc_add_10,3,3
>      RET
>
>
>  ;-----------------------------------------------------------------------------
> -; void ff_h264_idct8_dc_add_10(pixel *dst, int16_t *block, int stride)
> +; void ff_h264_idct8_dc_add_10(pixel *dst, int16_t *block, ptrdiff_t
> stride)
>
>  ;-----------------------------------------------------------------------------
>  %macro IDCT8_DC_ADD 0
>  cglobal h264_idct8_dc_add_10,3,4,7
> -    movsxdifnidn r2, r2d
>      movd      m0, [r1]
>      mov dword[r1], 0
>      paddd     m0, [pd_32]
> @@ -236,7 +232,7 @@ IDCT8_DC_ADD
>
>
>  ;-----------------------------------------------------------------------------
>  ; void ff_h264_idct_add16intra_10(pixel *dst, const int *block_offset,
> -;                                 int16_t *block, int stride,
> +;                                 int16_t *block, ptrdiff_t stride,
>  ;                                 const uint8_t nnzc[6*8])
>
>  ;-----------------------------------------------------------------------------
>  %macro AC 1
> @@ -283,7 +279,6 @@ idct_dc_add %+ SUFFIX:
>      ret
>
>  cglobal h264_idct_add16intra_10,5,7,8
> -    movsxdifnidn r3, r3d
>      ADD16_OP_INTRA 0, 4+1*8
>      ADD16_OP_INTRA 2, 4+2*8
>      ADD16_OP_INTRA 4, 6+1*8
> @@ -313,12 +308,11 @@ IDCT_ADD16INTRA_10
>  %assign last_block 36
>
>  ;-----------------------------------------------------------------------------
>  ; void ff_h264_idct_add8_10(pixel **dst, const int *block_offset,
> -;                           int16_t *block, int stride,
> +;                           int16_t *block, ptrdiff_t stride,
>  ;                           const uint8_t nnzc[6*8])
>
>  ;-----------------------------------------------------------------------------
>  %macro IDCT_ADD8 0
>  cglobal h264_idct_add8_10,5,8,7
> -    movsxdifnidn r3, r3d
>  %if ARCH_X86_64
>      mov      r7, r0
>  %endif
> @@ -352,7 +346,7 @@ IDCT_ADD8
>
>
>  ;-----------------------------------------------------------------------------
>  ; void ff_h264_idct_add8_422_10(pixel **dst, const int *block_offset,
> -;                               int16_t *block, int stride,
> +;                               int16_t *block, ptrdiff_t stride,
>  ;                               const uint8_t nnzc[6*8])
>
>  ;-----------------------------------------------------------------------------
>  %assign last_block 44
> @@ -360,7 +354,6 @@ IDCT_ADD8
>  %macro IDCT_ADD8_422 0
>
>  cglobal h264_idct_add8_422_10, 5, 8, 7
> -    movsxdifnidn r3, r3d
>  %if ARCH_X86_64
>      mov      r7, r0
>  %endif
> @@ -404,7 +397,7 @@ IDCT_ADD8_422
>  %endif
>
>
>  ;-----------------------------------------------------------------------------
> -; void ff_h264_idct8_add_10(pixel *dst, int16_t *block, int stride)
> +; void ff_h264_idct8_add_10(pixel *dst, int16_t *block, ptrdiff_t stride)
>
>  ;-----------------------------------------------------------------------------
>  %macro IDCT8_1D 2
>      SWAP      0, 1
> @@ -488,7 +481,7 @@ IDCT_ADD8_422
>  %endif
>  %endmacro
>
> -; %1=uint8_t *dst, %2=int16_t *block, %3=int stride
> +; %1=uint8_t *dst, %2=int16_t *block, %3=ptrdiff_t stride
>  %macro IDCT8_ADD_SSE_END 3
>      IDCT8_1D_FULL %2
>      mova  [%2     ], m6
> @@ -508,7 +501,6 @@ IDCT_ADD8_422
>
>  %macro IDCT8_ADD 0
>  cglobal h264_idct8_add_10, 3,4,16
> -    movsxdifnidn r2, r2d
>  %if UNIX64 == 0
>      %assign pad 16-gprsize-(stack_offset&15)
>      sub  rsp, pad
> @@ -615,7 +607,7 @@ IDCT8_ADD
>
>
>  ;-----------------------------------------------------------------------------
>  ; void ff_h264_idct8_add4_10(pixel **dst, const int *block_offset,
> -;                            int16_t *block, int stride,
> +;                            int16_t *block, ptrdiff_t stride,
>  ;                            const uint8_t nnzc[6*8])
>
>  ;-----------------------------------------------------------------------------
>  ;;;;;;; NO FATE SAMPLES TRIGGER THIS
> @@ -633,7 +625,6 @@ IDCT8_ADD
>
>  %macro IDCT8_ADD4 0
>  cglobal h264_idct8_add4_10, 0,7,16
> -    movsxdifnidn r3, r3d
>      %assign pad 16-gprsize-(stack_offset&15)
>      SUB      rsp, pad
>      mov       r5, r0mp
> diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
> index f617078d15..d853219fb1 100644
> --- a/libavcodec/x86/h264dsp_init.c
> +++ b/libavcodec/x86/h264dsp_init.c
> @@ -28,7 +28,7 @@
>  #define IDCT_ADD_FUNC(NUM, DEPTH, OPT)                                  \
>  void ff_h264_idct ## NUM ## _add_ ## DEPTH ## _ ## OPT(uint8_t *dst,    \
>                                                         int16_t *block,  \
> -                                                       int stride);
> +                                                       ptrdiff_t stride);
>
>  IDCT_ADD_FUNC(, 8, sse2)
>  IDCT_ADD_FUNC(, 8, avx)
> @@ -48,7 +48,7 @@ IDCT_ADD_FUNC(8, 10, avx)
>  #define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT)                         \
>  void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT       \
>      (uint8_t *dst, const int *block_offset,                             \
> -     int16_t *block, int stride, const uint8_t nnzc[5 * 8]);
> +     int16_t *block, ptrdiff_t stride, const uint8_t nnzc[5 * 8]);
>
>  IDCT_ADD_REP_FUNC(8, 4, 8, sse2)
>  IDCT_ADD_REP_FUNC(8, 4, 10, sse2)
> @@ -64,7 +64,7 @@ IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
>  #define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT)                      \
>  void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT     \
>      (uint8_t **dst, const int *block_offset,                          \
> -     int16_t *block, int stride, const uint8_t nnzc[15 * 8]);
> +     int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15 * 8]);
>
>  IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
>  IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
> diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
> index 5a5a553901..9fbb24d2d3 100644
> --- a/tests/checkasm/h264dsp.c
> +++ b/tests/checkasm/h264dsp.c
> @@ -184,7 +184,7 @@ static void check_idct(void)
>      LOCAL_ALIGNED_16(int16_t, subcoef1, [8 * 8 * 2]);
>      H264DSPContext h;
>      int bit_depth, sz, align, dc, i;
> -    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t
> *block, int stride);
> +    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t
> *block, ptrdiff_t stride);
>
>      for (i = 0; i < FF_ARRAY_ELEMS(depths); i++) {
>          bit_depth = depths[i];
> @@ -192,7 +192,7 @@ static void check_idct(void)
>
>          for (dc = 0; dc <= 2; dc++) {
>              for (sz = 4; sz <= 8; sz += 4) {
> -                void (*idct)(uint8_t *, int16_t *, int) = NULL;
> +                void (*idct)(uint8_t *, int16_t *, ptrdiff_t) = NULL;
>                  const char fmts[3][28] = {
>                      "idct%d_add_%dbpp", "idct%d_dc_add_%dbpp",
>                      "add_pixels%d_%dbpp",
> @@ -250,12 +250,12 @@ static void check_idct_multiple(void)
>      LOCAL_ALIGNED_16(uint8_t, nnzc,  [15 * 8]);
>      H264DSPContext h;
>      int bit_depth, i, y, func;
> -    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const int
> *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]);
> +    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const int
> *block_offset, int16_t *block, ptrdiff_t stride, const uint8_t nnzc[15*8]);
>
>      for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
>          ff_h264dsp_init(&h, bit_depth, 1);
>          for (func = 0; func < 3; func++) {
> -            void (*idct)(uint8_t *, const int *, int16_t *, int, const
> uint8_t[]) = NULL;
> +            void (*idct)(uint8_t *, const int *, int16_t *, ptrdiff_t,
> const uint8_t[]) = NULL;
>              const char *name;
>              int sz = 4, intra = 0;
>              int block_offset[16] = { 0 };
> --
> 2.52.0
>
> _______________________________________________
> ffmpeg-devel mailing list -- [email protected]
> To unsubscribe send an email to [email protected]


LGTM
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.