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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Jun 9 12:54:36 EEST 2024


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 at outlook.com>
---
 libavcodec/mpegvideo_enc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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;
-- 
2.40.1



More information about the ffmpeg-devel mailing list