1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/mpegvideo: Don't initialize [yc]_dc_scale_table by default

Only the H.263-based decoders as well as the encoders need it;
so move it to ff_h263_decode_init() as well as ff_mpv_encode_init().
Also for the latter make it only set these tables if none are
already set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-03 17:26:00 +01:00
parent b7ee7994cc
commit c757f948d1
3 changed files with 9 additions and 4 deletions

View File

@ -41,8 +41,8 @@
#include "mpeg_er.h"
#include "mpeg4video.h"
#include "mpeg4videodec.h"
#include "mpeg4videodefs.h"
#include "mpegvideo.h"
#include "mpegvideodata.h"
#include "mpegvideodec.h"
#include "msmpeg4dec.h"
#include "thread.h"
@ -102,6 +102,9 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->decode_mb = ff_h263_decode_mb;
s->low_delay = 1;
s->y_dc_scale_table =
s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
// dct_unquantize defaults for H.263;
// they might change on a per-frame basis for MPEG-4.
s->dct_unquantize_intra = s->dct_unquantize_h263_intra;

View File

@ -482,8 +482,6 @@ int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src)
*/
av_cold void ff_mpv_common_defaults(MpegEncContext *s)
{
s->y_dc_scale_table =
s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
s->chroma_qscale_table = ff_default_chroma_qscale_table;
s->progressive_frame = 1;
s->progressive_sequence = 1;

View File

@ -276,7 +276,6 @@ static av_cold void mpv_encode_init_static(void)
/**
* Set the given MpegEncContext to defaults for encoding.
* the changed fields will not depend upon the prior state of the MpegEncContext.
*/
static av_cold void mpv_encode_defaults(MpegEncContext *s)
{
@ -288,6 +287,11 @@ static av_cold void mpv_encode_defaults(MpegEncContext *s)
s->fcode_tab = default_fcode_tab + MAX_MV;
if (!s->y_dc_scale_table) {
s->y_dc_scale_table =
s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
}
s->input_picture_number = 0;
s->picture_in_gop_number = 0;
}