aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo_unquantize.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-03-19 15:24:57 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-03-26 04:17:00 +0100
commite5a33c898a3c82957d6e4b02b2bbaf2bb0c28165 (patch)
treec1f98a16ab684b945aeb870055dfffb8e03c5f39 /libavcodec/mpegvideo_unquantize.c
parent917652d7c8616edf615eb638e75c1778a8faa038 (diff)
downloadffmpeg-e5a33c898a3c82957d6e4b02b2bbaf2bb0c28165.tar.gz
avcodec/mpegvideo: Only keep the actually used unquantize funcs
For all encoders and all decoders except MPEG-4 the unquantize functions to use don't change at all and therefore needn't be kept in the context. So discard them after setting them; for MPEG-4, the functions get assigned on a per-frame basis. Decoders not using any unquantize functions (H.261, MPEG-1/2) as well as decoders that only call ff_mpv_reconstruct_mb() through error resilience (RV30/40, the VC-1 family) don't have the remaining pointers set at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpegvideo_unquantize.c')
-rw-r--r--libavcodec/mpegvideo_unquantize.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/mpegvideo_unquantize.c b/libavcodec/mpegvideo_unquantize.c
index 12bacdf424..213e37a514 100644
--- a/libavcodec/mpegvideo_unquantize.c
+++ b/libavcodec/mpegvideo_unquantize.c
@@ -246,28 +246,29 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
}
}
-av_cold void ff_mpv_unquantize_init(MpegEncContext *s)
+av_cold void ff_mpv_unquantize_init(MPVUnquantDSPContext *s,
+ int bitexact, int q_scale_type)
{
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c;
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c;
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c;
s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c;
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c;
- if (s->avctx->flags & AV_CODEC_FLAG_BITEXACT)
+ if (bitexact)
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
#if HAVE_INTRINSICS_NEON
- ff_mpv_common_init_neon(s);
+ ff_mpv_unquantize_init_neon(s, bitexact);
#endif
#if ARCH_ARM
- ff_mpv_common_init_arm(s);
+ ff_mpv_unquantize_init_arm(s, bitexact);
#elif ARCH_PPC
- ff_mpv_common_init_ppc(s);
+ ff_mpv_unquantize_init_ppc(s, bitexact);
#elif ARCH_X86
- ff_mpv_common_init_x86(s);
+ ff_mpv_unquantize_init_x86(s, bitexact);
#elif ARCH_MIPS
- ff_mpv_common_init_mips(s);
+ ff_mpv_unquantize_init_mips(s, bitexact, q_scale_type);
#endif
}