[FFmpeg-devel] [RFC PATCH] avcodec/vvc: Don't use large array on stack
James Almer
jamrial at gmail.com
Thu Sep 19 22:18:02 EEST 2024
On 9/19/2024 2:27 PM, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao at tencent.com>
>
> tmp_array in dmvr_hv takes 33024 bytes on stack, which can be
> dangerous. This patch fixed the C version and comment out the
> x86 asm version.
You don't need to comment it out. The x86 versions don't use the new
argument, so just update the prototypes, like so:
> diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
> index c50eaf25ce..7ff3e2bdff 100644
> --- a/libavcodec/x86/vvc/vvcdsp_init.c
> +++ b/libavcodec/x86/vvc/vvcdsp_init.c
> @@ -90,13 +90,13 @@ AVG_PROTOTYPES(12, avx2)
>
> #define DMVR_PROTOTYPES(bd, opt) \
> void ff_vvc_dmvr_##bd##_##opt(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, \
> - int height, intptr_t mx, intptr_t my, int width); \
> + int height, intptr_t mx, intptr_t my, int width, int16_t *unused); \
> void ff_vvc_dmvr_h_##bd##_##opt(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, \
> - int height, intptr_t mx, intptr_t my, int width); \
> + int height, intptr_t mx, intptr_t my, int width, int16_t *unused); \
> void ff_vvc_dmvr_v_##bd##_##opt(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, \
> - int height, intptr_t mx, intptr_t my, int width); \
> + int height, intptr_t mx, intptr_t my, int width, int16_t *unused); \
> void ff_vvc_dmvr_hv_##bd##_##opt(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, \
> - int height, intptr_t mx, intptr_t my, int width); \
> + int height, intptr_t mx, intptr_t my, int width, int16_t *unused); \
>
> DMVR_PROTOTYPES( 8, avx2)
> DMVR_PROTOTYPES(10, avx2)
> @@ -371,8 +371,7 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
> AVG_INIT(8, avx2);
> MC_LINKS_AVX2(8);
> OF_INIT(8);
> - // TODO:
> - // DMVR_INIT(8);
> + DMVR_INIT(8);
> SAD_INIT();
> }
> break;
> @@ -386,7 +385,7 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
> MC_LINKS_AVX2(10);
> MC_LINKS_16BPC_AVX2(10);
> OF_INIT(10);
> - // DMVR_INIT(10);
> + DMVR_INIT(10);
> SAD_INIT();
> }
> break;
> @@ -400,7 +399,7 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
> MC_LINKS_AVX2(12);
> MC_LINKS_16BPC_AVX2(12);
> OF_INIT(12);
> - // DMVR_INIT(12);
> + DMVR_INIT(12);
> SAD_INIT();
> }
> break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240919/8b9090e3/attachment.sig>
More information about the ffmpeg-devel
mailing list