diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-03-19 21:28:00 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-03-26 04:12:58 +0100 |
commit | d5fba4aef9feb949f7ece3e35ccbf184a3be27e8 (patch) | |
tree | 71c1743942cb80c64d51c434c2f3e3410d9a4d4d | |
parent | 854a3ed54734719deddce7e2f18413c874b498e3 (diff) | |
download | ffmpeg-d5fba4aef9feb949f7ece3e35ccbf184a3be27e8.tar.gz |
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>
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 5ef0900ec0..65a466500c 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -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]; - } + 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){ |