diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2024-08-26 15:59:45 +0200 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2024-09-01 13:42:30 +0200 |
commit | 6aafe61285404022b1e8e882b8a875bc33a93aec (patch) | |
tree | 97b4fa8c25ffe3db1c520f08cb9ddb19f1c37581 /libavcodec | |
parent | 7753a9d62725d5bd8313e2d249acbe1c8af79ab1 (diff) | |
download | ffmpeg-6aafe61285404022b1e8e882b8a875bc33a93aec.tar.gz |
avcodec/mpegvideoencdsp: convert stride parameters from int to ptrdiff_t
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/aarch64/mpegvideoencdsp_init.c | 6 | ||||
-rw-r--r-- | libavcodec/aarch64/mpegvideoencdsp_neon.S | 9 | ||||
-rw-r--r-- | libavcodec/arm/mpegvideoencdsp_init_arm.c | 4 | ||||
-rw-r--r-- | libavcodec/mips/h263dsp_mips.h | 2 | ||||
-rw-r--r-- | libavcodec/mips/mpegvideoencdsp_msa.c | 2 | ||||
-rw-r--r-- | libavcodec/mpegvideoencdsp.c | 31 | ||||
-rw-r--r-- | libavcodec/mpegvideoencdsp.h | 10 | ||||
-rw-r--r-- | libavcodec/ppc/mpegvideoencdsp.c | 8 | ||||
-rw-r--r-- | libavcodec/riscv/mpegvideoencdsp_init.c | 4 | ||||
-rw-r--r-- | libavcodec/x86/mpegvideoencdsp.asm | 6 | ||||
-rw-r--r-- | libavcodec/x86/mpegvideoencdsp_init.c | 8 |
11 files changed, 47 insertions, 43 deletions
diff --git a/libavcodec/aarch64/mpegvideoencdsp_init.c b/libavcodec/aarch64/mpegvideoencdsp_init.c index d0ce07e178..0402ac9e82 100644 --- a/libavcodec/aarch64/mpegvideoencdsp_init.c +++ b/libavcodec/aarch64/mpegvideoencdsp_init.c @@ -24,11 +24,11 @@ #include "libavcodec/mpegvideoencdsp.h" #include "config.h" -int ff_pix_sum16_neon(const uint8_t *pix, int line_size); -int ff_pix_norm1_neon(const uint8_t *pix, int line_size); +int ff_pix_sum16_neon(const uint8_t *pix, ptrdiff_t line_size); +int ff_pix_norm1_neon(const uint8_t *pix, ptrdiff_t line_size); #if HAVE_DOTPROD -int ff_pix_norm1_neon_dotprod(const uint8_t *pix, int line_size); +int ff_pix_norm1_neon_dotprod(const uint8_t *pix, ptrdiff_t line_size); #endif av_cold void ff_mpegvideoencdsp_init_aarch64(MpegvideoEncDSPContext *c, diff --git a/libavcodec/aarch64/mpegvideoencdsp_neon.S b/libavcodec/aarch64/mpegvideoencdsp_neon.S index 4944e7b7f4..8175d8975e 100644 --- a/libavcodec/aarch64/mpegvideoencdsp_neon.S +++ b/libavcodec/aarch64/mpegvideoencdsp_neon.S @@ -22,9 +22,8 @@ function ff_pix_sum16_neon, export=1 // x0 const uint8_t *pix -// x1 int line_size +// x1 ptrdiff_t line_size - sxtw x1, w1 add x2, x0, x1 lsl x1, x1, #1 movi v0.16b, #0 @@ -46,9 +45,8 @@ endfunc function ff_pix_norm1_neon, export=1 // x0 const uint8_t *pix -// x1 int line_size +// x1 ptrdiff_t line_size - sxtw x1, w1 movi v0.16b, #0 mov w2, #16 @@ -72,9 +70,8 @@ ENABLE_DOTPROD function ff_pix_norm1_neon_dotprod, export=1 // x0 const uint8_t *pix -// x1 int line_size +// x1 ptrdiff_t line_size - sxtw x1, w1 movi v0.16b, #0 mov w2, #16 diff --git a/libavcodec/arm/mpegvideoencdsp_init_arm.c b/libavcodec/arm/mpegvideoencdsp_init_arm.c index a95b5bebe9..74c5964f74 100644 --- a/libavcodec/arm/mpegvideoencdsp_init_arm.c +++ b/libavcodec/arm/mpegvideoencdsp_init_arm.c @@ -24,8 +24,8 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpegvideoencdsp.h" -int ff_pix_norm1_armv6(const uint8_t *pix, int line_size); -int ff_pix_sum_armv6(const uint8_t *pix, int line_size); +int ff_pix_norm1_armv6(const uint8_t *pix, ptrdiff_t line_size); +int ff_pix_sum_armv6(const uint8_t *pix, ptrdiff_t line_size); av_cold void ff_mpegvideoencdsp_init_arm(MpegvideoEncDSPContext *c, AVCodecContext *avctx) diff --git a/libavcodec/mips/h263dsp_mips.h b/libavcodec/mips/h263dsp_mips.h index f225ee563e..d4de2233a7 100644 --- a/libavcodec/mips/h263dsp_mips.h +++ b/libavcodec/mips/h263dsp_mips.h @@ -31,6 +31,6 @@ void ff_dct_unquantize_h263_inter_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t q_scale); void ff_dct_unquantize_h263_intra_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t q_scale); -int ff_pix_sum_msa(const uint8_t *pix, int line_size); +int ff_pix_sum_msa(const uint8_t *pix, ptrdiff_t line_size); #endif // #ifndef AVCODEC_MIPS_H263DSP_MIPS_H diff --git a/libavcodec/mips/mpegvideoencdsp_msa.c b/libavcodec/mips/mpegvideoencdsp_msa.c index 9043730cd7..91e0f00686 100644 --- a/libavcodec/mips/mpegvideoencdsp_msa.c +++ b/libavcodec/mips/mpegvideoencdsp_msa.c @@ -56,7 +56,7 @@ static int32_t sum_u8src_16width_msa(const uint8_t *src, int32_t stride) return sum; } -int ff_pix_sum_msa(const uint8_t *pix, int line_size) +int ff_pix_sum_msa(const uint8_t *pix, ptrdiff_t line_size) { return sum_u8src_16width_msa(pix, line_size); } diff --git a/libavcodec/mpegvideoencdsp.c b/libavcodec/mpegvideoencdsp.c index 00a2c4ba71..5e4c446d99 100644 --- a/libavcodec/mpegvideoencdsp.c +++ b/libavcodec/mpegvideoencdsp.c @@ -57,7 +57,7 @@ static void add_8x8basis_c(int16_t rem[64], const int16_t basis[64], int scale) (BASIS_SHIFT - RECON_SHIFT); } -static int pix_sum_c(const uint8_t *pix, int line_size) +static int pix_sum_c(const uint8_t *pix, ptrdiff_t line_size) { int s = 0, i, j; @@ -78,7 +78,7 @@ static int pix_sum_c(const uint8_t *pix, int line_size) return s; } -static int pix_norm1_c(const uint8_t *pix, int line_size) +static int pix_norm1_c(const uint8_t *pix, ptrdiff_t line_size) { int s = 0, i, j; const uint32_t *sq = ff_square_tab + 256; @@ -114,7 +114,7 @@ static int pix_norm1_c(const uint8_t *pix, int line_size) return s; } -static av_always_inline void draw_edges_lr(uint8_t *ptr, int wrap, int width, int height, int w) +static av_always_inline void draw_edges_lr(uint8_t *ptr, ptrdiff_t wrap, int width, int height, int w) { for (int i = 0; i < height; i++) { memset(ptr - w, ptr[0], w); @@ -125,7 +125,7 @@ static av_always_inline void draw_edges_lr(uint8_t *ptr, int wrap, int width, in /* draw the edges of width 'w' of an image of size width, height */ // FIXME: Check that this is OK for MPEG-4 interlaced. -static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, +static void draw_edges_8_c(uint8_t *buf, ptrdiff_t wrap, int width, int height, int w, int h, int sides) { uint8_t *last_line; @@ -154,9 +154,18 @@ static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); } +/* This wrapper function only serves to convert the stride parameters + * from ptrdiff_t to int for av_image_copy_plane(). */ +static void copy_plane_wrapper(uint8_t *dst, ptrdiff_t dst_wrap, + const uint8_t *src, ptrdiff_t src_wrap, + int width, int height) +{ + av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height); +} + /* 2x2 -> 1x1 */ -static void shrink22(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, +static void shrink22(uint8_t *dst, ptrdiff_t dst_wrap, + const uint8_t *src, ptrdiff_t src_wrap, int width, int height) { int w; @@ -188,8 +197,8 @@ static void shrink22(uint8_t *dst, int dst_wrap, } /* 4x4 -> 1x1 */ -static void shrink44(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, +static void shrink44(uint8_t *dst, ptrdiff_t dst_wrap, + const uint8_t *src, ptrdiff_t src_wrap, int width, int height) { int w; @@ -219,8 +228,8 @@ static void shrink44(uint8_t *dst, int dst_wrap, } /* 8x8 -> 1x1 */ -static void shrink88(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, +static void shrink88(uint8_t *dst, ptrdiff_t dst_wrap, + const uint8_t *src, ptrdiff_t src_wrap, int width, int height) { int w, i; @@ -247,7 +256,7 @@ av_cold void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c, c->try_8x8basis = try_8x8basis_c; c->add_8x8basis = add_8x8basis_c; - c->shrink[0] = av_image_copy_plane; + c->shrink[0] = copy_plane_wrapper; c->shrink[1] = shrink22; c->shrink[2] = shrink44; c->shrink[3] = shrink88; diff --git a/libavcodec/mpegvideoencdsp.h b/libavcodec/mpegvideoencdsp.h index f437bc4e4e..6ec665677b 100644 --- a/libavcodec/mpegvideoencdsp.h +++ b/libavcodec/mpegvideoencdsp.h @@ -34,13 +34,13 @@ typedef struct MpegvideoEncDSPContext { const int16_t basis[64], int scale); void (*add_8x8basis)(int16_t rem[64], const int16_t basis[64], int scale); - int (*pix_sum)(const uint8_t *pix, int line_size); - int (*pix_norm1)(const uint8_t *pix, int line_size); + int (*pix_sum)(const uint8_t *pix, ptrdiff_t line_size); + int (*pix_norm1)(const uint8_t *pix, ptrdiff_t line_size); - void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, - int src_wrap, int width, int height); + void (*shrink[4])(uint8_t *dst, ptrdiff_t dst_wrap, const uint8_t *src, + ptrdiff_t src_wrap, int width, int height); - void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, + void (*draw_edges)(uint8_t *buf, ptrdiff_t wrap, int width, int height, int w, int h, int sides); } MpegvideoEncDSPContext; diff --git a/libavcodec/ppc/mpegvideoencdsp.c b/libavcodec/ppc/mpegvideoencdsp.c index 07d3e76ee0..bd0c7fb15d 100644 --- a/libavcodec/ppc/mpegvideoencdsp.c +++ b/libavcodec/ppc/mpegvideoencdsp.c @@ -30,7 +30,7 @@ #if HAVE_ALTIVEC #if HAVE_VSX -static int pix_norm1_altivec(const uint8_t *pix, int line_size) +static int pix_norm1_altivec(const uint8_t *pix, ptrdiff_t line_size) { int i, s = 0; const vector unsigned int zero = @@ -57,7 +57,7 @@ static int pix_norm1_altivec(const uint8_t *pix, int line_size) return s; } #else -static int pix_norm1_altivec(const uint8_t *pix, int line_size) +static int pix_norm1_altivec(const uint8_t *pix, ptrdiff_t line_size) { int i, s = 0; const vector unsigned int zero = @@ -87,7 +87,7 @@ static int pix_norm1_altivec(const uint8_t *pix, int line_size) #endif /* HAVE_VSX */ #if HAVE_VSX -static int pix_sum_altivec(const uint8_t *pix, int line_size) +static int pix_sum_altivec(const uint8_t *pix, ptrdiff_t line_size) { int i, s; const vector unsigned int zero = @@ -115,7 +115,7 @@ static int pix_sum_altivec(const uint8_t *pix, int line_size) return s; } #else -static int pix_sum_altivec(const uint8_t *pix, int line_size) +static int pix_sum_altivec(const uint8_t *pix, ptrdiff_t line_size) { int i, s; const vector unsigned int zero = diff --git a/libavcodec/riscv/mpegvideoencdsp_init.c b/libavcodec/riscv/mpegvideoencdsp_init.c index 1ac808af16..3ae38cf927 100644 --- a/libavcodec/riscv/mpegvideoencdsp_init.c +++ b/libavcodec/riscv/mpegvideoencdsp_init.c @@ -26,8 +26,8 @@ int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64], const int16_t basis[16], int scale); void ff_add_8x8basis_rvv(int16_t rem[64], const int16_t basis[16], int scale); -int ff_pix_sum_rvv(const uint8_t *pix, int line_size); -int ff_pix_norm1_rvv(const uint8_t *pix, int line_size); +int ff_pix_sum_rvv(const uint8_t *pix, ptrdiff_t line_size); +int ff_pix_norm1_rvv(const uint8_t *pix, ptrdiff_t line_size); av_cold void ff_mpegvideoencdsp_init_riscv(MpegvideoEncDSPContext *c, AVCodecContext *avctx) diff --git a/libavcodec/x86/mpegvideoencdsp.asm b/libavcodec/x86/mpegvideoencdsp.asm index 3cbe7b4d4b..c73b359c42 100644 --- a/libavcodec/x86/mpegvideoencdsp.asm +++ b/libavcodec/x86/mpegvideoencdsp.asm @@ -24,12 +24,11 @@ %include "libavutil/x86/x86util.asm" SECTION .text -; int ff_pix_sum16(const uint8_t *pix, int line_size) +; int ff_pix_sum16(const uint8_t *pix, ptrdiff_t line_size) ; %1 = number of loops ; %2 = number of GPRs used %macro PIX_SUM16 3 cglobal pix_sum16, 2, %2, 6 - movsxdifnidn r1, r1d mov r2, %1 lea r3, [r1*3] %if notcpuflag(xop) @@ -72,12 +71,11 @@ INIT_XMM xop PIX_SUM16 4, 4, 4 %endif -; int ff_pix_norm1(const uint8_t *pix, int line_size) +; int ff_pix_norm1(const uint8_t *pix, ptrdiff_t line_size) ; %1 = number of xmm registers used ; %2 = number of loops %macro PIX_NORM1 2 cglobal pix_norm1, 2, 3, %1 - movsxdifnidn r1, r1d mov r2, %2 pxor m0, m0 pxor m5, m5 diff --git a/libavcodec/x86/mpegvideoencdsp_init.c b/libavcodec/x86/mpegvideoencdsp_init.c index 5d23169450..d39091a5c9 100644 --- a/libavcodec/x86/mpegvideoencdsp_init.c +++ b/libavcodec/x86/mpegvideoencdsp_init.c @@ -23,9 +23,9 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpegvideoencdsp.h" -int ff_pix_sum16_sse2(const uint8_t *pix, int line_size); -int ff_pix_sum16_xop(const uint8_t *pix, int line_size); -int ff_pix_norm1_sse2(const uint8_t *pix, int line_size); +int ff_pix_sum16_sse2(const uint8_t *pix, ptrdiff_t line_size); +int ff_pix_sum16_xop(const uint8_t *pix, ptrdiff_t line_size); +int ff_pix_norm1_sse2(const uint8_t *pix, ptrdiff_t line_size); #if HAVE_INLINE_ASM @@ -96,7 +96,7 @@ int ff_pix_norm1_sse2(const uint8_t *pix, int line_size); #endif /* HAVE_SSSE3_INLINE */ /* Draw the edges of width 'w' of an image of size width, height */ -static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, +static void draw_edges_mmx(uint8_t *buf, ptrdiff_t wrap, int width, int height, int w, int h, int sides) { uint8_t *ptr, *last_line; |