diff mbox series

[FFmpeg-devel,5/7] avcodec/mpegvideo_enc: Always set c funcs in ff_dct_encode_init()

Message ID AS8P250MB0744411BA18870A015CB72818FC52@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,1/7] avcodec/dnxhdenc: Remove always-false check | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt June 9, 2024, 9:54 a.m. UTC
Use the common approach whereby the _c versions are set first
and then (potentially) overwritten by the arch-specific ones
instead of calling the arch-specific code first, followed by
setting the function pointers that have not already been set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo_enc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bc36d4b5a6..7dd692c1e4 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -292,16 +292,15 @@  static void mpv_encode_defaults(MpegEncContext *s)
 
 av_cold int ff_dct_encode_init(MpegEncContext *s)
 {
+    s->dct_quantize = dct_quantize_c;
+    s->denoise_dct  = denoise_dct_c;
+
 #if ARCH_MIPS
     ff_mpvenc_dct_init_mips(s);
 #elif ARCH_X86
     ff_dct_encode_init_x86(s);
 #endif
 
-    if (!s->dct_quantize)
-        s->dct_quantize = dct_quantize_c;
-    if (!s->denoise_dct)
-        s->denoise_dct  = denoise_dct_c;
     s->fast_dct_quantize = s->dct_quantize;
     if (s->avctx->trellis)
         s->dct_quantize  = dct_quantize_trellis_c;