[FFmpeg-devel] [PATCH 30/57] avcodec/mpegvideo_enc: Initialize qscale tab for all codecs
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed Jun 12 16:48:26 EEST 2024
Calling it is the first thing ff_clean_h263_qscales() and
ff_clean_mpeg4_qscales() do anyway.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/h263enc.h | 1 -
libavcodec/ituh263enc.c | 2 --
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];
--
2.40.1
More information about the ffmpeg-devel
mailing list