Revision 693399ba libavcodec/h264.c

View differences:

libavcodec/h264.c
296 296

  
297 297
    /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */
298 298
    uint16_t     *cbp_table;
299
    /* chroma_pred_mode for i4x4 or i16x16, else 0 */
299 300
    uint8_t     *chroma_pred_mode_table;
300 301
    int         last_qscale_diff;
301 302
    int16_t     (*mvd_table[2])[2];
......
3899 3900

  
3900 3901
    int ctx = 0;
3901 3902

  
3902
    if( s->mb_x > 0 &&
3903
        ( IS_INTRA4x4( s->current_picture.mb_type[mba_xy] ) || IS_INTRA16x16( s->current_picture.mb_type[mba_xy] ) ) &&
3904
        h->chroma_pred_mode_table[mba_xy] != 0 ) {
3903
    /* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */
3904
    if( s->mb_x > 0 && h->chroma_pred_mode_table[mba_xy] != 0 )
3905 3905
        ctx++;
3906
    }
3907
    if( s->mb_y > 0 &&
3908
        ( IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) || IS_INTRA16x16( s->current_picture.mb_type[mbb_xy] ) ) &&
3909
        h->chroma_pred_mode_table[mbb_xy] != 0 ) {
3906

  
3907
    if( s->mb_y > 0 && h->chroma_pred_mode_table[mbb_xy] != 0 )
3910 3908
        ctx++;
3911
    }
3912 3909

  
3913 3910
    if( get_cabac( &h->cabac, &h->cabac_state[64+ctx] ) == 0 )
3914 3911
        return 0;
......
3962 3959
        else if( s->mb_y > 0 )
3963 3960
            mbb_xy = mb_xy - s->mb_stride;
3964 3961

  
3962
        /* No need to test for skip as we put 0 for skip block */
3965 3963
        if( mba_xy >= 0 ) {
3966 3964
            int i8x8a = block_idx_xy[(x-1)&0x03][y]/4;
3967
            if( IS_SKIP( s->current_picture.mb_type[mba_xy] ) || ((h->cbp_table[mba_xy] >> i8x8a)&0x01) == 0 )
3965
            if( ((h->cbp_table[mba_xy] >> i8x8a)&0x01) == 0 )
3968 3966
                ctx++;
3969 3967
        }
3970 3968

  
3971 3969
        if( mbb_xy >= 0 ) {
3972 3970
            int i8x8b = block_idx_xy[x][(y-1)&0x03]/4;
3973
            if( IS_SKIP( s->current_picture.mb_type[mbb_xy] ) || ((h->cbp_table[mbb_xy] >> i8x8b)&0x01) == 0 )
3971
            if( ((h->cbp_table[mbb_xy] >> i8x8b)&0x01) == 0 )
3974 3972
                ctx += 2;
3975 3973
        }
3976 3974

  
......
3987 3985
    int ctx;
3988 3986
    int cbp_a, cbp_b;
3989 3987

  
3990
    if( s->mb_x > 0 && !IS_SKIP( s->current_picture.mb_type[mb_xy-1] ) )
3988
    /* No need to test for skip */
3989
    if( s->mb_x > 0 )
3991 3990
        cbp_a = (h->cbp_table[mb_xy-1]>>4)&0x03;
3992 3991
    else
3993 3992
        cbp_a = -1;
3994 3993

  
3995
    if( s->mb_y > 0 && !IS_SKIP( s->current_picture.mb_type[mb_xy-s->mb_stride] ) )
3994
    if( s->mb_y > 0 )
3996 3995
        cbp_b = (h->cbp_table[mb_xy-s->mb_stride]>>4)&0x03;
3997 3996
    else
3998 3997
        cbp_b = -1;
......
4146 4145
        else if( s->mb_y > 0 )
4147 4146
            mbb_xy = mb_xy - s->mb_stride;
4148 4147

  
4148
        /* No need to test for skip */
4149 4149
        if( mba_xy >= 0 ) {
4150 4150
            i8x8a = block_idx_xy[(x-1)&0x03][y]/4;
4151 4151

  
4152
            if( !IS_SKIP(s->current_picture.mb_type[mba_xy] ) &&
4153
                !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
4152
            if( !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
4154 4153
                ((h->cbp_table[mba_xy]&0x0f)>>i8x8a))
4155 4154
                nza = h->non_zero_count_cache[scan8[idx] - 1];
4156 4155
        }
......
4158 4157
        if( mbb_xy >= 0 ) {
4159 4158
            i8x8b = block_idx_xy[x][(y-1)&0x03]/4;
4160 4159

  
4161
            if( !IS_SKIP(s->current_picture.mb_type[mbb_xy] ) &&
4162
                !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
4160
            if( !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
4163 4161
                ((h->cbp_table[mbb_xy]&0x0f)>>i8x8b))
4164 4162
                nzb = h->non_zero_count_cache[scan8[idx] - 8];
4165 4163
        }
......
4167 4165
        if( s->mb_x > 0 ) {
4168 4166
            mba_xy = mb_xy - 1;
4169 4167

  
4170
            if( !IS_SKIP(s->current_picture.mb_type[mba_xy] ) &&
4171
                !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
4168
            if( !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
4172 4169
                (h->cbp_table[mba_xy]&0x30) )
4173 4170
                nza = (h->cbp_table[mba_xy]>>(6+idx))&0x01;
4174 4171
        }
4175 4172
        if( s->mb_y > 0 ) {
4176 4173
            mbb_xy = mb_xy - s->mb_stride;
4177 4174

  
4178
            if( !IS_SKIP(s->current_picture.mb_type[mbb_xy] ) &&
4179
                !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
4175
            if( !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
4180 4176
                (h->cbp_table[mbb_xy]&0x30) )
4181 4177
                nzb = (h->cbp_table[mbb_xy]>>(6+idx))&0x01;
4182 4178
        }
......
4193 4189
            mbb_xy = mb_xy - s->mb_stride;
4194 4190

  
4195 4191
        if( mba_xy >= 0 &&
4196
            !IS_SKIP(s->current_picture.mb_type[mba_xy] ) &&
4197 4192
            !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
4198 4193
            (h->cbp_table[mba_xy]&0x30) == 0x20 )
4199 4194
            nza = h->non_zero_count_cache[scan8[16+idx] - 1];
4200 4195

  
4201 4196
        if( mbb_xy >= 0 &&
4202
            !IS_SKIP(s->current_picture.mb_type[mbb_xy] ) &&
4203 4197
            !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
4204 4198
            (h->cbp_table[mbb_xy]&0x30) == 0x20 )
4205 4199
            nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
......
4393 4387
            s->current_picture.qscale_table[mb_xy]= s->qscale;
4394 4388
            h->slice_table[ mb_xy ]= h->slice_num;
4395 4389
            h->cbp_table[mb_xy] = 0;
4390
            h->chroma_pred_mode_table[mb_xy] = 0;
4396 4391
            h->last_qscale_diff = 0;
4397 4392

  
4398 4393
            h->prev_mb_skiped= 1;
......
4435 4430
    if(IS_INTRA_PCM(mb_type)) {
4436 4431
        /* TODO */
4437 4432
        h->cbp_table[mb_xy] = 0xf +4*2;
4433
        h->chroma_pred_mode_table[mb_xy] = 0;
4438 4434
        s->current_picture.qscale_table[mb_xy]= s->qscale;
4439 4435
        return -1;
4440 4436
    }
......
4624 4620
        }
4625 4621
    }
4626 4622

  
4627
   if( IS_INTER( mb_type ) )
4623
   if( IS_INTER( mb_type ) ) {
4624
        h->chroma_pred_mode_table[mb_xy] = 0;
4628 4625
        write_back_motion( h, mb_type );
4626
   }
4629 4627

  
4630 4628
    if( !IS_INTRA16x16( mb_type ) ) {
4631 4629
        cbp  = decode_cabac_mb_cbp_luma( h );
......
5582 5580
        
5583 5581
        buf_index += consumed;
5584 5582

  
5585
        if(h->nal_ref_idc < s->hurry_up)
5583
        if( s->hurry_up == 1 && h->nal_ref_idc  == 0 )
5586 5584
            continue;
5587 5585
        
5588 5586
        switch(h->nal_unit_type){
......
5595 5593
            s->data_partitioning = 0;
5596 5594
            
5597 5595
            if(decode_slice_header(h) < 0) return -1;
5598
            if(h->redundant_pic_count==0)
5596
            if(h->redundant_pic_count==0 && s->hurry_up < 5 )
5599 5597
                decode_slice(h);
5600 5598
            break;
5601 5599
        case NAL_DPA:
......
5614 5612
            init_get_bits(&h->inter_gb, ptr, bit_length);
5615 5613
            h->inter_gb_ptr= &h->inter_gb;
5616 5614

  
5617
            if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning)
5615
            if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning && s->hurry_up < 5 )
5618 5616
                decode_slice(h);
5619 5617
            break;
5620 5618
        case NAL_SEI:

Also available in: Unified diff