ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Wed Mar 19 21:28:00 2025 +0100| [d5fba4aef9feb949f7ece3e35ccbf184a3be27e8] | committer: Andreas Rheinhardt
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.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5fba4aef9feb949f7ece3e35ccbf184a3be27e8 --- libavcodec/mpegvideo_enc.c | 10 ++++------ 1 file 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){ _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".