Revision 05307427

View differences:

libavcodec/h264_cabac.c
1182 1182
#endif
1183 1183
}
1184 1184

  
1185
static inline void compute_mb_neighbors(H264Context *h)
1186
{
1187
    MpegEncContext * const s = &h->s;
1188
    const int mb_xy  = h->mb_xy;
1189
    h->top_mb_xy     = mb_xy - s->mb_stride;
1190
    h->left_mb_xy[0] = mb_xy - 1;
1191
    if(FRAME_MBAFF){
1192
        const int pair_xy          = s->mb_x     + (s->mb_y & ~1)*s->mb_stride;
1193
        const int top_pair_xy      = pair_xy     - s->mb_stride;
1194
        const int top_mb_field_flag  = IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]);
1195
        const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]);
1196
        const int curr_mb_field_flag = MB_FIELD;
1197
        const int bottom = (s->mb_y & 1);
1198

  
1199
        if (curr_mb_field_flag && (bottom || top_mb_field_flag)){
1200
            h->top_mb_xy -= s->mb_stride;
1201
        }
1202
        if (!left_mb_field_flag == curr_mb_field_flag) {
1203
            h->left_mb_xy[0] = pair_xy - 1;
1204
        }
1205
    } else if (FIELD_PICTURE) {
1206
        h->top_mb_xy -= s->mb_stride;
1207
    }
1208
    return;
1209
}
1210

  
1211 1185
/**
1212 1186
 * decodes a macroblock
1213 1187
 * @returns 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
......
1257 1231

  
1258 1232
    h->prev_mb_skipped = 0;
1259 1233

  
1260
    compute_mb_neighbors(h);
1234
    fill_decode_neighbors(h, -(MB_FIELD));
1261 1235

  
1262 1236
    if( h->slice_type_nos == FF_B_TYPE ) {
1263 1237
        const int mba_xy = h->left_mb_xy[0];
......
1365 1339
        h->ref_count[1] <<= 1;
1366 1340
    }
1367 1341

  
1368
    fill_decode_neighbors(h, mb_type);
1369 1342
    fill_decode_caches(h, mb_type);
1370 1343

  
1371 1344
    if( IS_INTRA( mb_type ) ) {

Also available in: Unified diff