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

Unified · Split

libavcodec/mpegvideo_enc.c+4−6
@@ -3022,8 +3022,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 3021 unmodified lines
30223022 ff_init_block_index(&s->c);
30233023
30243024 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 this
3026− int mb_type= s->mb_type[xy];
3025+ int mb_type, xy;
30273026 // int d;
30283027 int dmin= INT_MAX;
30293028 int dir;
@@ -3047,11 +3046,10 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 17 unmodified lines
30473046 s->c.mb_y = mb_y; // moved into loop, can get changed by H.261
30483047 ff_update_block_index(&s->c, 8, 0, s->c.chroma_x_shift);
30493048
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)
30513050 ff_h261_reorder_mb_index(s);
3052− xy = s->c.mb_y*s->c.mb_stride + s->c.mb_x;
3053− mb_type= s->mb_type[xy];
3054− }
3051+ xy = s->c.mb_y * s->c.mb_stride + s->c.mb_x;
3052+ mb_type = s->mb_type[xy];
30553053
30563054 /* write gob / video packet header */
30573055 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