Revision 02f7695b

View differences:

libavcodec/h264.c
82 82
    int topleft_xy, top_xy, topright_xy, left_xy[2];
83 83
    int topleft_type, top_type, topright_type, left_type[2];
84 84
    int left_block[8];
85
    int topleft_partition= -1;
85 86
    int i;
86 87

  
87 88
    top_xy     = mb_xy  - (s->mb_stride << FIELD_PICTURE);
......
126 127
                : (!curr_mb_frame_flag && !topleft_mb_frame_flag) // top macroblock
127 128
                ) {
128 129
            topleft_xy -= s->mb_stride;
130
        } else if(bottom && curr_mb_frame_flag && !left_mb_frame_flag) {
131
            topleft_xy += s->mb_stride;
132
            // take topleft mv from the middle of the mb, as opposed to all other modes which use the bottom-right partition
133
            topleft_partition = 0;
129 134
        }
130 135
        if (bottom
131 136
                ? !curr_mb_frame_flag // bottom macroblock
......
403 408
                continue;
404 409

  
405 410
            if(USES_LIST(topleft_type, list)){
406
                const int b_xy = h->mb2b_xy[topleft_xy] + 3 + 3*h->b_stride;
407
                const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + h->b8_stride;
411
                const int b_xy = h->mb2b_xy[topleft_xy] + 3 + h->b_stride + (topleft_partition & 2*h->b_stride);
412
                const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (topleft_partition & h->b8_stride);
408 413
                *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy];
409 414
                h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy];
410 415
            }else{
......
701 706
#define SET_DIAG_MV(MV_OP, REF_OP, X4, Y4)\
702 707
                const int x4 = X4, y4 = Y4;\
703 708
                const int mb_type = mb_types[(x4>>2)+(y4>>2)*s->mb_stride];\
704
                if(!USES_LIST(mb_type,list) && !IS_8X8(mb_type))\
709
                if(!USES_LIST(mb_type,list))\
705 710
                    return LIST_NOT_USED;\
706 711
                mv = s->current_picture_ptr->motion_val[list][x4 + y4*h->b_stride];\
707 712
                h->mv_cache[list][scan8[0]-2][0] = mv[0];\
......
722 727
               && !IS_INTERLACED(mb_types[h->left_mb_xy[0]])
723 728
               && i >= scan8[0]+8){
724 729
                // leftshift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's ok.
725
                SET_DIAG_MV(>>1, <<1, s->mb_x*4-1, (s->mb_y&~1)*4 - 1 + ((i-scan8[0])>>3)*2);
730
                SET_DIAG_MV(/2, <<1, s->mb_x*4-1, (s->mb_y&~1)*4 - 1 + ((i-scan8[0])>>3)*2);
726 731
            }
727 732
        }
728 733
#undef SET_DIAG_MV

Also available in: Unified diff