Revision 53b19144 libavcodec/h264.c

View differences:

libavcodec/h264.c
715 715
            }
716 716
            h->mv_cache_clean[list]= 0;
717 717

  
718
            if(IS_INTER(top_type)){
718
            if(USES_LIST(top_type, list)){
719 719
                const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
720 720
                const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride;
721 721
                *(uint32_t*)h->mv_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 0];
......
735 735
            }
736 736

  
737 737
            //FIXME unify cleanup or sth
738
            if(IS_INTER(left_type[0])){
738
            if(USES_LIST(left_type[0], list)){
739 739
                const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
740 740
                const int b8_xy= h->mb2b8_xy[left_xy[0]] + 1;
741 741
                *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0]];
......
749 749
                h->ref_cache[list][scan8[0] - 1 + 1*8]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE;
750 750
            }
751 751

  
752
            if(IS_INTER(left_type[1])){
752
            if(USES_LIST(left_type[1], list)){
753 753
                const int b_xy= h->mb2b_xy[left_xy[1]] + 3;
754 754
                const int b8_xy= h->mb2b8_xy[left_xy[1]] + 1;
755 755
                *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[2]];
......
767 767
            if(for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred))
768 768
                continue;
769 769

  
770
            if(IS_INTER(topleft_type)){
770
            if(USES_LIST(topleft_type, list)){
771 771
                const int b_xy = h->mb2b_xy[topleft_xy] + 3 + 3*h->b_stride;
772 772
                const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + h->b8_stride;
773 773
                *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy];
......
777 777
                h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
778 778
            }
779 779

  
780
            if(IS_INTER(topright_type)){
780
            if(USES_LIST(topright_type, list)){
781 781
                const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride;
782 782
                const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride;
783 783
                *(uint32_t*)h->mv_cache[list][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy];
......
801 801

  
802 802
            if( h->pps.cabac ) {
803 803
                /* XXX beurk, Load mvd */
804
                if(IS_INTER(topleft_type)){
804
                if(USES_LIST(topleft_type, list)){
805 805
                    const int b_xy = h->mb2b_xy[topleft_xy] + 3 + 3*h->b_stride;
806 806
                    *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy];
807 807
                }else{
808 808
                    *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 - 1*8]= 0;
809 809
                }
810 810

  
811
                if(IS_INTER(top_type)){
811
                if(USES_LIST(top_type, list)){
812 812
                    const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
813 813
                    *(uint32_t*)h->mvd_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 0];
814 814
                    *(uint32_t*)h->mvd_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 1];
......
820 820
                    *(uint32_t*)h->mvd_cache [list][scan8[0] + 2 - 1*8]=
821 821
                    *(uint32_t*)h->mvd_cache [list][scan8[0] + 3 - 1*8]= 0;
822 822
                }
823
                if(IS_INTER(left_type[0])){
823
                if(USES_LIST(left_type[0], list)){
824 824
                    const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
825 825
                    *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[0]];
826 826
                    *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[1]];
......
828 828
                    *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 0*8]=
829 829
                    *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 1*8]= 0;
830 830
                }
831
                if(IS_INTER(left_type[1])){
831
                if(USES_LIST(left_type[1], list)){
832 832
                    const int b_xy= h->mb2b_xy[left_xy[1]] + 3;
833 833
                    *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[2]];
834 834
                    *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 3*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[3]];
......
1424 1424

  
1425 1425
    for(list=0; list<2; list++){
1426 1426
        int y;
1427
        if(!USES_LIST(mb_type, list)){
1428
            if(1){ //FIXME skip or never read if mb_type doesn't use it
1429
                for(y=0; y<4; y++){
1430
                    *(uint64_t*)s->current_picture.motion_val[list][b_xy + 0 + y*h->b_stride]=
1431
                    *(uint64_t*)s->current_picture.motion_val[list][b_xy + 2 + y*h->b_stride]= 0;
1432
                }
1433
                if( h->pps.cabac ) {
1434
                    /* FIXME needed ? */
1435
                    for(y=0; y<4; y++){
1436
                        *(uint64_t*)h->mvd_table[list][b_xy + 0 + y*h->b_stride]=
1437
                        *(uint64_t*)h->mvd_table[list][b_xy + 2 + y*h->b_stride]= 0;
1438
                    }
1439
                }
1440
                for(y=0; y<2; y++){
1441
                    s->current_picture.ref_index[list][b8_xy + 0 + y*h->b8_stride]=
1442
                    s->current_picture.ref_index[list][b8_xy + 1 + y*h->b8_stride]= LIST_NOT_USED;
1443
                }
1444
            }
1427
        if(!USES_LIST(mb_type, list))
1445 1428
            continue;
1446
        }
1447 1429

  
1448 1430
        for(y=0; y<4; y++){
1449 1431
            *(uint64_t*)s->current_picture.motion_val[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+0 + 8*y];
......
1455 1437
                *(uint64_t*)h->mvd_table[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+2 + 8*y];
1456 1438
            }
1457 1439
        }
1458
        for(y=0; y<2; y++){
1459
            s->current_picture.ref_index[list][b8_xy + 0 + y*h->b8_stride]= h->ref_cache[list][scan8[0]+0 + 16*y];
1460
            s->current_picture.ref_index[list][b8_xy + 1 + y*h->b8_stride]= h->ref_cache[list][scan8[0]+2 + 16*y];
1440

  
1441
        {
1442
            uint8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
1443
            ref_index[0+0*h->b8_stride]= h->ref_cache[list][scan8[0]];
1444
            ref_index[1+0*h->b8_stride]= h->ref_cache[list][scan8[4]];
1445
            ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]];
1446
            ref_index[1+1*h->b8_stride]= h->ref_cache[list][scan8[12]];
1461 1447
        }
1462 1448
    }
1463 1449

  
1464 1450
    if(h->slice_type == B_TYPE && h->pps.cabac){
1465 1451
        if(IS_8X8(mb_type)){
1466
            h->direct_table[b8_xy+1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;
1467
            h->direct_table[b8_xy+0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0;
1468
            h->direct_table[b8_xy+1+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[3]) ? 1 : 0;
1452
            uint8_t *direct_table = &h->direct_table[b8_xy];
1453
            direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;
1454
            direct_table[0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0;
1455
            direct_table[1+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[3]) ? 1 : 0;
1469 1456
        }
1470 1457
    }
1471 1458
}

Also available in: Unified diff