diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-06-11 06:19:27 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-06-20 18:58:38 +0200 |
commit | 85cc6478b64f9f59c585de6329b8d2e403f3c95d (patch) | |
tree | 3466493ed1cb91be22e6e856b0788b17245d702f | |
parent | 3b67ab85eefd36af8fb369423f6f623b85977fe7 (diff) | |
download | ffmpeg-85cc6478b64f9f59c585de6329b8d2e403f3c95d.tar.gz |
avcodec/mpegvideo_enc: Initialize qscale tab for all codecs
Calling it is the first thing ff_clean_h263_qscales() and
ff_clean_mpeg4_qscales() do anyway.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/h263enc.h | 1 | ||||
-rw-r--r-- | libavcodec/ituh263enc.c | 2 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 6 |
3 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/h263enc.h b/libavcodec/h263enc.h index cd5ded1593..6e07440b30 100644 --- a/libavcodec/h263enc.h +++ b/libavcodec/h263enc.h @@ -32,7 +32,6 @@ void ff_h263_encode_mb(MpegEncContext *s, int motion_x, int motion_y); void ff_h263_encode_mba(MpegEncContext *s); -void ff_init_qscale_tab(MpegEncContext *s); void ff_clean_h263_qscales(MpegEncContext *s); void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code); diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 8d0c4147bf..b1fe4e241e 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -274,8 +274,6 @@ void ff_clean_h263_qscales(MpegEncContext *s){ int i; int8_t * const qscale_table = s->cur_pic.qscale_table; - ff_init_qscale_tab(s); - for(i=1; i<s->mb_num; i++){ if(qscale_table[ s->mb_index2xy[i] ] - qscale_table[ s->mb_index2xy[i-1] ] >2) qscale_table[ s->mb_index2xy[i] ]= qscale_table[ s->mb_index2xy[i-1] ]+2; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 73e1a69490..6d26b2d619 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -237,7 +237,7 @@ void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix) /** * init s->cur_pic.qscale_table from s->lambda_table */ -void ff_init_qscale_tab(MpegEncContext *s) +static void init_qscale_tab(MpegEncContext *s) { int8_t * const qscale_table = s->cur_pic.qscale_table; int i; @@ -3542,6 +3542,8 @@ static int estimate_qp(MpegEncContext *s, int dry_run){ } if(s->adaptive_quant){ + init_qscale_tab(s); + switch(s->codec_id){ case AV_CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) @@ -3553,8 +3555,6 @@ static int estimate_qp(MpegEncContext *s, int dry_run){ if (CONFIG_H263_ENCODER) ff_clean_h263_qscales(s); break; - default: - ff_init_qscale_tab(s); } s->lambda= s->lambda_table[0]; |