[FFmpeg-devel] [PATCH] checkasm/swscale: fix function prototypes
Kacper Michajlow
kasper93 at gmail.com
Wed Jul 16 13:52:00 EEST 2025
On Thu, 3 Jul 2025 at 23:08, Kacper Michajłow <kasper93 at gmail.com> wrote:
>
> This aligns declared function types in checkasm with real definition.
>
> Fixes FATE: checkasm-{sw_rgb,sw_scale,sw_yuv2rgb,sw_yuv2yuv}
>
> Fixes: runtime error: call to function <func> through pointer to incorrect function type
> Fixes: c1a0e657638f7007dcc807a2d985c22631fcd6d3
>
> Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>
> ---
> tests/checkasm/sw_rgb.c | 2 +-
> tests/checkasm/sw_scale.c | 8 ++++----
> tests/checkasm/sw_yuv2rgb.c | 6 +++---
> tests/checkasm/sw_yuv2yuv.c | 6 +++---
> 4 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
> index b98c7c6b47..6edfc93b0b 100644
> --- a/tests/checkasm/sw_rgb.c
> +++ b/tests/checkasm/sw_rgb.c
> @@ -142,7 +142,7 @@ static void check_rgb24toyv12(SwsContext *sws)
>
> declare_func(void, const uint8_t *src, uint8_t *ydst, uint8_t *udst,
> uint8_t *vdst, int width, int height, int lumStride,
> - int chromStride, int srcStride, int32_t *rgb2yuv);
> + int chromStride, int srcStride, const int32_t *rgb2yuv);
>
> randomize_buffers(src, BUFSIZE * 3);
>
> diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
> index 11c9174a6b..b91e0b64ed 100644
> --- a/tests/checkasm/sw_scale.c
> +++ b/tests/checkasm/sw_scale.c
> @@ -362,7 +362,7 @@ static void check_hscale(void)
>
> // The dst parameter here is either int16_t or int32_t but we use void* to
> // just cover both cases.
> - declare_func(void, void *c, void *dst, int dstW,
> + declare_func(void, SwsInternal *c, int16_t *dst, int dstW,
> const uint8_t *src, const int16_t *filter,
> const int32_t *filterPos, int filterSize);
>
> @@ -422,11 +422,11 @@ static void check_hscale(void)
> memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));
> memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0]));
>
> - call_ref(NULL, dst0, sws->dst_w, src, filter, filterPos, width);
> - call_new(NULL, dst1, sws->dst_w, src, filterAvx2, filterPosAvx, width);
> + call_ref(NULL, (int16_t *)dst0, sws->dst_w, src, filter, filterPos, width);
> + call_new(NULL, (int16_t *)dst1, sws->dst_w, src, filterAvx2, filterPosAvx, width);
> if (memcmp(dst0, dst1, sws->dst_w * sizeof(dst0[0])))
> fail();
> - bench_new(NULL, dst0, sws->dst_w, src, filter, filterPosAvx, width);
> + bench_new(NULL, (int16_t *)dst0, sws->dst_w, src, filter, filterPosAvx, width);
> }
> }
> }
> diff --git a/tests/checkasm/sw_yuv2rgb.c b/tests/checkasm/sw_yuv2rgb.c
> index c25fb99ca2..c6c1ad934b 100644
> --- a/tests/checkasm/sw_yuv2rgb.c
> +++ b/tests/checkasm/sw_yuv2rgb.c
> @@ -107,9 +107,9 @@ static void check_yuv2rgb(int src_pix_fmt)
> static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE};
>
> declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
> - int, SwsInternal *c, const uint8_t *src[],
> - int srcStride[], int srcSliceY, int srcSliceH,
> - uint8_t *dst[], int dstStride[]);
> + int, SwsInternal *c, const uint8_t *const src[],
> + const int srcStride[], int srcSliceY, int srcSliceH,
> + uint8_t *const dst[], const int dstStride[]);
>
> LOCAL_ALIGNED_8(uint8_t, src_y, [MAX_LINE_SIZE * 2]);
> LOCAL_ALIGNED_8(uint8_t, src_u, [MAX_LINE_SIZE]);
> diff --git a/tests/checkasm/sw_yuv2yuv.c b/tests/checkasm/sw_yuv2yuv.c
> index 6fe8e47d19..6a7a7a8b9a 100644
> --- a/tests/checkasm/sw_yuv2yuv.c
> +++ b/tests/checkasm/sw_yuv2yuv.c
> @@ -46,9 +46,9 @@ static void check_semiplanar(int dst_pix_fmt)
> static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE};
>
> declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
> - int, SwsInternal *c, const uint8_t *src[],
> - int srcStride[], int srcSliceY, int srcSliceH,
> - uint8_t *dst[], int dstStride[]);
> + int, SwsInternal *c, const uint8_t *const src[],
> + const int srcStride[], int srcSliceY, int srcSliceH,
> + uint8_t *const dstParam[], const int dstStride[]);
>
> LOCAL_ALIGNED_8(uint8_t, src_y, [MAX_LINE_SIZE * NUM_LINES]);
> LOCAL_ALIGNED_8(uint8_t, src_uv, [MAX_LINE_SIZE * NUM_LINES * 2]);
> --
> 2.43.0
>
Will merge later today, if there is no objection.
- Kacper
More information about the ffmpeg-devel
mailing list