diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-25 22:40:45 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-30 23:52:24 +0100 |
commit | ed5a438f055489c2e827508cb24f2fe71f2036ad (patch) | |
tree | ce36a1aef7de3dc4df08398f75e4a8d30c6fbf71 /libavcodec/mpegvideo_enc.c | |
parent | 5d5b87f68885f35ff365d1e64446c1676b4a9993 (diff) | |
download | ffmpeg-ed5a438f055489c2e827508cb24f2fe71f2036ad.tar.gz |
avcodec/mpegvideo_enc: Initialize dct_unquantize_int(ra|er) only once
For encoders, mpeg_quant is an option of the MPEG-4 encoder
and therefore constant. This implies that one can set
the dct_unquantize_(intra|inter) function pointers during init.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ce363a585d..0b709974a1 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -880,6 +880,17 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) ff_dct_encode_init(s); + if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { + s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra; + s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter; + } else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) { + s->dct_unquantize_intra = s->dct_unquantize_h263_intra; + s->dct_unquantize_inter = s->dct_unquantize_h263_inter; + } else { + s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra; + s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter; + } + if ((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table = ff_h263_chroma_qscale_table; @@ -1723,17 +1734,6 @@ static int frame_start(MpegEncContext *s) } } - if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { - s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra; - s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter; - } else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) { - s->dct_unquantize_intra = s->dct_unquantize_h263_intra; - s->dct_unquantize_inter = s->dct_unquantize_h263_inter; - } else { - s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra; - s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter; - } - if (s->dct_error_sum) { av_assert2(s->noise_reduction && s->encoding); update_noise_reduction(s); |