1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00

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>
This commit is contained in:
Andreas Rheinhardt 2024-06-11 06:19:27 +02:00
parent 3b67ab85ee
commit 85cc6478b6
3 changed files with 3 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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];