Revision d1d10e91

View differences:

libavcodec/h264.c
217 217
            h->top_samples_available= 0x33FF;
218 218
            h->topright_samples_available= 0x26EA;
219 219
        }
220
        for(i=0; i<2; i++){
221
            if(!IS_INTRA(left_type[i]) && (left_type[i]==0 || h->pps.constrained_intra_pred)){
220
        if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
221
            if(IS_INTERLACED(mb_type)){
222
                if(!IS_INTRA(left_type[0]) && (left_type[0]==0 || h->pps.constrained_intra_pred)){
223
                    h->topleft_samples_available&= 0xDFFF;
224
                    h->left_samples_available&= 0x5FFF;
225
                }
226
                if(!IS_INTRA(left_type[1]) && (left_type[1]==0 || h->pps.constrained_intra_pred)){
227
                    h->topleft_samples_available&= 0xFF5F;
228
                    h->left_samples_available&= 0xFF5F;
229
                }
230
            }else{
231
                int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num
232
                                ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0;
233
                assert(left_xy[0] == left_xy[1]);
234
                if(!(IS_INTRA(left_typei) && IS_INTRA(left_type[0])) && (left_typei==0 || h->pps.constrained_intra_pred)){
235
                    h->topleft_samples_available&= 0xDF5F;
236
                    h->left_samples_available&= 0x5F5F;
237
                }
238
            }
239
        }else{
240
            if(!IS_INTRA(left_type[0]) && (left_type[0]==0 || h->pps.constrained_intra_pred)){
222 241
                h->topleft_samples_available&= 0xDF5F;
223 242
                h->left_samples_available&= 0x5F5F;
224 243
            }
......
565 584
        }
566 585
    }
567 586

  
568
    if(!(h->left_samples_available&0x8000)){
587
    if((h->left_samples_available&0x8888)!=0x8888){
588
        static const int mask[4]={0x8000,0x2000,0x80,0x20};
569 589
        for(i=0; i<4; i++){
590
            if(!(h->left_samples_available&mask[i])){
570 591
            int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ];
571 592
            if(status<0){
572 593
                av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
......
574 595
            } else if(status){
575 596
                h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status;
576 597
            }
598
            }
577 599
        }
578 600
    }
579 601

  
......
601 623
        }
602 624
    }
603 625

  
604
    if(!(h->left_samples_available&0x8000)){
626
    if((h->left_samples_available&0x8080) != 0x8080){
605 627
        mode= left[ mode ];
628
        if(h->left_samples_available&0x8080){ //mad cow disease mode, aka MBAFF + constrained_intra_pred
629
            mode= ALZHEIMER_DC_L0T_PRED8x8 + (!(h->left_samples_available&0x8000)) + 2*(mode == DC_128_PRED8x8);
630
        }
606 631
        if(mode<0){
607 632
            av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
608 633
            return -1;
libavcodec/h264pred.c
690 690
    }
691 691
}
692 692

  
693
//the following 4 function should not be optimized!
694
static void pred8x8_mad_cow_dc_l0t(uint8_t *src, int stride){
695
    pred8x8_top_dc_c(src, stride);
696
    pred4x4_dc_c(src, NULL, stride);
697
}
698

  
699
static void pred8x8_mad_cow_dc_0lt(uint8_t *src, int stride){
700
    pred8x8_dc_c(src, stride);
701
    pred4x4_top_dc_c(src, NULL, stride);
702
}
703

  
704
static void pred8x8_mad_cow_dc_l00(uint8_t *src, int stride){
705
    pred8x8_left_dc_c(src, stride);
706
    pred4x4_128_dc_c(src + 4*stride    , NULL, stride);
707
    pred4x4_128_dc_c(src + 4*stride + 4, NULL, stride);
708
}
709

  
710
static void pred8x8_mad_cow_dc_0l0(uint8_t *src, int stride){
711
    pred8x8_left_dc_c(src, stride);
712
    pred4x4_128_dc_c(src    , NULL, stride);
713
    pred4x4_128_dc_c(src + 4, NULL, stride);
714
}
715

  
693 716
static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
694 717
    int i;
695 718
    int dc0=0;
......
1046 1069
        h->pred8x8[DC_PRED8x8     ]= pred8x8_dc_c;
1047 1070
        h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_c;
1048 1071
        h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c;
1072
        h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= pred8x8_mad_cow_dc_l0t;
1073
        h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= pred8x8_mad_cow_dc_0lt;
1074
        h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= pred8x8_mad_cow_dc_l00;
1075
        h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= pred8x8_mad_cow_dc_0l0;
1049 1076
    }else{
1050 1077
        h->pred8x8[DC_PRED8x8     ]= pred8x8_dc_rv40_c;
1051 1078
        h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_rv40_c;
libavcodec/h264pred.h
60 60
#define LEFT_DC_PRED8x8       4
61 61
#define TOP_DC_PRED8x8        5
62 62
#define DC_128_PRED8x8        6
63

  
64
#define ALZHEIMER_DC_L0T_PRED8x8 7
65
#define ALZHEIMER_DC_0LT_PRED8x8 8
66
#define ALZHEIMER_DC_L00_PRED8x8 9
67
#define ALZHEIMER_DC_0L0_PRED8x8 10
63 68
//@}
64 69

  
65 70
/**
......
68 73
typedef struct H264PredContext{
69 74
    void (*pred4x4  [9+3+3])(uint8_t *src, uint8_t *topright, int stride);//FIXME move to dsp?
70 75
    void (*pred8x8l [9+3])(uint8_t *src, int topleft, int topright, int stride);
71
    void (*pred8x8  [4+3])(uint8_t *src, int stride);
76
    void (*pred8x8  [4+3+4])(uint8_t *src, int stride);
72 77
    void (*pred16x16[4+3])(uint8_t *src, int stride);
73 78
}H264PredContext;
74 79

  

Also available in: Unified diff