/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */
uint16_t *cbp_table;
+ /* chroma_pred_mode for i4x4 or i16x16, else 0 */
uint8_t *chroma_pred_mode_table;
int last_qscale_diff;
int16_t (*mvd_table[2])[2];
int ctx = 0;
- if( s->mb_x > 0 &&
- ( IS_INTRA4x4( s->current_picture.mb_type[mba_xy] ) || IS_INTRA16x16( s->current_picture.mb_type[mba_xy] ) ) &&
- h->chroma_pred_mode_table[mba_xy] != 0 ) {
+ /* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */
+ if( s->mb_x > 0 && h->chroma_pred_mode_table[mba_xy] != 0 )
ctx++;
- }
- if( s->mb_y > 0 &&
- ( IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) || IS_INTRA16x16( s->current_picture.mb_type[mbb_xy] ) ) &&
- h->chroma_pred_mode_table[mbb_xy] != 0 ) {
+
+ if( s->mb_y > 0 && h->chroma_pred_mode_table[mbb_xy] != 0 )
ctx++;
- }
if( get_cabac( &h->cabac, &h->cabac_state[64+ctx] ) == 0 )
return 0;
else if( s->mb_y > 0 )
mbb_xy = mb_xy - s->mb_stride;
+ /* No need to test for skip as we put 0 for skip block */
if( mba_xy >= 0 ) {
int i8x8a = block_idx_xy[(x-1)&0x03][y]/4;
- if( IS_SKIP( s->current_picture.mb_type[mba_xy] ) || ((h->cbp_table[mba_xy] >> i8x8a)&0x01) == 0 )
+ if( ((h->cbp_table[mba_xy] >> i8x8a)&0x01) == 0 )
ctx++;
}
if( mbb_xy >= 0 ) {
int i8x8b = block_idx_xy[x][(y-1)&0x03]/4;
- if( IS_SKIP( s->current_picture.mb_type[mbb_xy] ) || ((h->cbp_table[mbb_xy] >> i8x8b)&0x01) == 0 )
+ if( ((h->cbp_table[mbb_xy] >> i8x8b)&0x01) == 0 )
ctx += 2;
}
int ctx;
int cbp_a, cbp_b;
- if( s->mb_x > 0 && !IS_SKIP( s->current_picture.mb_type[mb_xy-1] ) )
+ /* No need to test for skip */
+ if( s->mb_x > 0 )
cbp_a = (h->cbp_table[mb_xy-1]>>4)&0x03;
else
cbp_a = -1;
- if( s->mb_y > 0 && !IS_SKIP( s->current_picture.mb_type[mb_xy-s->mb_stride] ) )
+ if( s->mb_y > 0 )
cbp_b = (h->cbp_table[mb_xy-s->mb_stride]>>4)&0x03;
else
cbp_b = -1;
else if( s->mb_y > 0 )
mbb_xy = mb_xy - s->mb_stride;
+ /* No need to test for skip */
if( mba_xy >= 0 ) {
i8x8a = block_idx_xy[(x-1)&0x03][y]/4;
- if( !IS_SKIP(s->current_picture.mb_type[mba_xy] ) &&
- !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
+ if( !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
((h->cbp_table[mba_xy]&0x0f)>>i8x8a))
nza = h->non_zero_count_cache[scan8[idx] - 1];
}
if( mbb_xy >= 0 ) {
i8x8b = block_idx_xy[x][(y-1)&0x03]/4;
- if( !IS_SKIP(s->current_picture.mb_type[mbb_xy] ) &&
- !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
+ if( !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
((h->cbp_table[mbb_xy]&0x0f)>>i8x8b))
nzb = h->non_zero_count_cache[scan8[idx] - 8];
}
if( s->mb_x > 0 ) {
mba_xy = mb_xy - 1;
- if( !IS_SKIP(s->current_picture.mb_type[mba_xy] ) &&
- !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
+ if( !IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
(h->cbp_table[mba_xy]&0x30) )
nza = (h->cbp_table[mba_xy]>>(6+idx))&0x01;
}
if( s->mb_y > 0 ) {
mbb_xy = mb_xy - s->mb_stride;
- if( !IS_SKIP(s->current_picture.mb_type[mbb_xy] ) &&
- !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
+ if( !IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
(h->cbp_table[mbb_xy]&0x30) )
nzb = (h->cbp_table[mbb_xy]>>(6+idx))&0x01;
}
mbb_xy = mb_xy - s->mb_stride;
if( mba_xy >= 0 &&
- !IS_SKIP(s->current_picture.mb_type[mba_xy] ) &&
!IS_INTRA_PCM(s->current_picture.mb_type[mba_xy] ) &&
(h->cbp_table[mba_xy]&0x30) == 0x20 )
nza = h->non_zero_count_cache[scan8[16+idx] - 1];
if( mbb_xy >= 0 &&
- !IS_SKIP(s->current_picture.mb_type[mbb_xy] ) &&
!IS_INTRA_PCM(s->current_picture.mb_type[mbb_xy] ) &&
(h->cbp_table[mbb_xy]&0x30) == 0x20 )
nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
s->current_picture.qscale_table[mb_xy]= s->qscale;
h->slice_table[ mb_xy ]= h->slice_num;
h->cbp_table[mb_xy] = 0;
+ h->chroma_pred_mode_table[mb_xy] = 0;
h->last_qscale_diff = 0;
h->prev_mb_skiped= 1;
if(IS_INTRA_PCM(mb_type)) {
/* TODO */
h->cbp_table[mb_xy] = 0xf +4*2;
+ h->chroma_pred_mode_table[mb_xy] = 0;
s->current_picture.qscale_table[mb_xy]= s->qscale;
return -1;
}
}
}
- if( IS_INTER( mb_type ) )
+ if( IS_INTER( mb_type ) ) {
+ h->chroma_pred_mode_table[mb_xy] = 0;
write_back_motion( h, mb_type );
+ }
if( !IS_INTRA16x16( mb_type ) ) {
cbp = decode_cabac_mb_cbp_luma( h );
buf_index += consumed;
- if(h->nal_ref_idc < s->hurry_up)
+ if( s->hurry_up == 1 && h->nal_ref_idc == 0 )
continue;
switch(h->nal_unit_type){
s->data_partitioning = 0;
if(decode_slice_header(h) < 0) return -1;
- if(h->redundant_pic_count==0)
+ if(h->redundant_pic_count==0 && s->hurry_up < 5 )
decode_slice(h);
break;
case NAL_DPA:
init_get_bits(&h->inter_gb, ptr, bit_length);
h->inter_gb_ptr= &h->inter_gb;
- if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning)
+ if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning && s->hurry_up < 5 )
decode_slice(h);
break;
case NAL_SEI: