History

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().

Andreas Rheinhardt committed 1 year ago

Commit d5fba4a1 parent 854a3ed1 file · +4 −6Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/mpegvideo_enc.c+4−6
@@ -3022,8 +3022,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 3021 unmodified lines
3022 ff_init_block_index(&s->c);3022 ff_init_block_index(&s->c);
3023 3023
3024 for (int mb_x = 0; mb_x < s->c.mb_width; mb_x++) {3024 for (int mb_x = 0; mb_x < s->c.mb_width; mb_x++) {
3025 int xy = mb_y*s->c.mb_stride + mb_x; // removed const, H261 needs to adjust this3025 int mb_type, xy;
3026 int mb_type= s->mb_type[xy];
3027// int d;3026// int d;
3028 int dmin= INT_MAX;3027 int dmin= INT_MAX;
3029 int dir;3028 int dir;
@@ -3047,11 +3046,10 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 17 unmodified lines
3047 s->c.mb_y = mb_y; // moved into loop, can get changed by H.2613046 s->c.mb_y = mb_y; // moved into loop, can get changed by H.261
3048 ff_update_block_index(&s->c, 8, 0, s->c.chroma_x_shift);3047 ff_update_block_index(&s->c, 8, 0, s->c.chroma_x_shift);
3049 3048
3050 if (CONFIG_H261_ENCODER && s->c.codec_id == AV_CODEC_ID_H261) {3049 if (CONFIG_H261_ENCODER && s->c.codec_id == AV_CODEC_ID_H261)
3051 ff_h261_reorder_mb_index(s);3050 ff_h261_reorder_mb_index(s);
3052 xy = s->c.mb_y*s->c.mb_stride + s->c.mb_x;3051 xy = s->c.mb_y * s->c.mb_stride + s->c.mb_x;
3053 mb_type= s->mb_type[xy];3052 mb_type = s->mb_type[xy];
3054 }
3055 3053
3056 /* write gob / video packet header */3054 /* write gob / video packet header */
3057 if(s->rtp_mode){3055 if(s->rtp_mode){

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t