Only set them after mb_x and mb_y are known which happens only after the call to ff_h261_reorder_mb_index().
Unified · Split
| @@ -3022,8 +3022,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 3021 unmodified lines | ||
| 3022 | 3022 | ff_init_block_index(&s->c); |
| 3023 | 3023 | |
| 3024 | 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 this | |
| 3026 | − int mb_type= s->mb_type[xy]; | |
| 3025 | + int mb_type, xy; | |
| 3027 | 3026 | // int d; |
| 3028 | 3027 | int dmin= INT_MAX; |
| 3029 | 3028 | int dir; |
| @@ -3047,11 +3046,10 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 17 unmodified lines | ||
| 3047 | 3046 | s->c.mb_y = mb_y; // moved into loop, can get changed by H.261 |
| 3048 | 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 | 3050 | 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]; | |
| 3055 | 3053 | |
| 3056 | 3054 | /* write gob / video packet header */ |
| 3057 | 3055 | if(s->rtp_mode){ |