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

avcodec/mpegvideo_enc: Defer initialization of mb-pos dependent vars

Only set them after mb_x and mb_y are known which happens
only after the call to ff_h261_reorder_mb_index().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-19 21:28:00 +01:00
parent 854a3ed547
commit d5fba4aef9

View File

@ -3022,8 +3022,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
ff_init_block_index(&s->c);
for (int mb_x = 0; mb_x < s->c.mb_width; mb_x++) {
int xy = mb_y*s->c.mb_stride + mb_x; // removed const, H261 needs to adjust this
int mb_type= s->mb_type[xy];
int mb_type, xy;
// int d;
int dmin= INT_MAX;
int dir;
@ -3047,11 +3046,10 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->c.mb_y = mb_y; // moved into loop, can get changed by H.261
ff_update_block_index(&s->c, 8, 0, s->c.chroma_x_shift);
if (CONFIG_H261_ENCODER && s->c.codec_id == AV_CODEC_ID_H261) {
if (CONFIG_H261_ENCODER && s->c.codec_id == AV_CODEC_ID_H261)
ff_h261_reorder_mb_index(s);
xy = s->c.mb_y * s->c.mb_stride + s->c.mb_x;
mb_type = s->mb_type[xy];
}
/* write gob / video packet header */
if(s->rtp_mode){