comparison h264.c @ 7341:b75aa0197be4 libavcodec

Use slice_type_nos instead of slice_type where it makes no difference. This way we use slice_type_nos almost everywhere which means 1 variable less for gcc to put in a register.
author michael
date Mon, 21 Jul 2008 19:11:41 +0000
parents ef40221c1452
children 9a4cb430d8ff
comparison
equal deleted inserted replaced
7340:ef40221c1452 7341:b75aa0197be4
479 *(uint32_t*)h->mvd_cache [list][scan8[7 ]+1]= 479 *(uint32_t*)h->mvd_cache [list][scan8[7 ]+1]=
480 *(uint32_t*)h->mvd_cache [list][scan8[13]+1]= //FIXME remove past 3 (init somewhere else) 480 *(uint32_t*)h->mvd_cache [list][scan8[13]+1]= //FIXME remove past 3 (init somewhere else)
481 *(uint32_t*)h->mvd_cache [list][scan8[4 ]]= 481 *(uint32_t*)h->mvd_cache [list][scan8[4 ]]=
482 *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0; 482 *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0;
483 483
484 if(h->slice_type == FF_B_TYPE){ 484 if(h->slice_type_nos == FF_B_TYPE){
485 fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1); 485 fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1);
486 486
487 if(IS_DIRECT(top_type)){ 487 if(IS_DIRECT(top_type)){
488 *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0x01010101; 488 *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0x01010101;
489 }else if(IS_8X8(top_type)){ 489 }else if(IS_8X8(top_type)){
1354 ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]]; 1354 ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]];
1355 ref_index[1+1*h->b8_stride]= h->ref_cache[list][scan8[12]]; 1355 ref_index[1+1*h->b8_stride]= h->ref_cache[list][scan8[12]];
1356 } 1356 }
1357 } 1357 }
1358 1358
1359 if(h->slice_type == FF_B_TYPE && h->pps.cabac){ 1359 if(h->slice_type_nos == FF_B_TYPE && h->pps.cabac){
1360 if(IS_8X8(mb_type)){ 1360 if(IS_8X8(mb_type)){
1361 uint8_t *direct_table = &h->direct_table[b8_xy]; 1361 uint8_t *direct_table = &h->direct_table[b8_xy];
1362 direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0; 1362 direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;
1363 direct_table[0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0; 1363 direct_table[0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0;
1364 direct_table[1+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[3]) ? 1 : 0; 1364 direct_table[1+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[3]) ? 1 : 0;
2865 structure_sel = 0; 2865 structure_sel = 0;
2866 frame_list[0] = h->default_ref_list[0]; 2866 frame_list[0] = h->default_ref_list[0];
2867 frame_list[1] = h->default_ref_list[1]; 2867 frame_list[1] = h->default_ref_list[1];
2868 } 2868 }
2869 2869
2870 if(h->slice_type==FF_B_TYPE){ 2870 if(h->slice_type_nos==FF_B_TYPE){
2871 int list; 2871 int list;
2872 int len[2]; 2872 int len[2];
2873 int short_len[2]; 2873 int short_len[2];
2874 int out_i; 2874 int out_i;
2875 int limit= INT_MIN; 2875 int limit= INT_MIN;
2987 } 2987 }
2988 #ifdef TRACE 2988 #ifdef TRACE
2989 for (i=0; i<h->ref_count[0]; i++) { 2989 for (i=0; i<h->ref_count[0]; i++) {
2990 tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]); 2990 tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
2991 } 2991 }
2992 if(h->slice_type==FF_B_TYPE){ 2992 if(h->slice_type_nos==FF_B_TYPE){
2993 for (i=0; i<h->ref_count[1]; i++) { 2993 for (i=0; i<h->ref_count[1]; i++) {
2994 tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]); 2994 tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]);
2995 } 2995 }
2996 } 2996 }
2997 #endif 2997 #endif
3130 if(!h->ref_list[list][index].data[0]) 3130 if(!h->ref_list[list][index].data[0])
3131 h->ref_list[list][index]= s->current_picture; 3131 h->ref_list[list][index]= s->current_picture;
3132 } 3132 }
3133 } 3133 }
3134 3134
3135 if(h->slice_type==FF_B_TYPE && !h->direct_spatial_mv_pred) 3135 if(h->slice_type_nos==FF_B_TYPE && !h->direct_spatial_mv_pred)
3136 direct_dist_scale_factor(h); 3136 direct_dist_scale_factor(h);
3137 direct_ref_list_init(h); 3137 direct_ref_list_init(h);
3138 return 0; 3138 return 0;
3139 } 3139 }
3140 3140
3213 h->chroma_weight[list][i][j]= chroma_def; 3213 h->chroma_weight[list][i][j]= chroma_def;
3214 h->chroma_offset[list][i][j]= 0; 3214 h->chroma_offset[list][i][j]= 0;
3215 } 3215 }
3216 } 3216 }
3217 } 3217 }
3218 if(h->slice_type != FF_B_TYPE) break; 3218 if(h->slice_type_nos != FF_B_TYPE) break;
3219 } 3219 }
3220 h->use_weight= h->use_weight || h->use_weight_chroma; 3220 h->use_weight= h->use_weight || h->use_weight_chroma;
3221 return 0; 3221 return 0;
3222 } 3222 }
3223 3223
4113 //set defaults, might be overriden a few line later 4113 //set defaults, might be overriden a few line later
4114 h->ref_count[0]= h->pps.ref_count[0]; 4114 h->ref_count[0]= h->pps.ref_count[0];
4115 h->ref_count[1]= h->pps.ref_count[1]; 4115 h->ref_count[1]= h->pps.ref_count[1];
4116 4116
4117 if(h->slice_type_nos != FF_I_TYPE){ 4117 if(h->slice_type_nos != FF_I_TYPE){
4118 if(h->slice_type == FF_B_TYPE){ 4118 if(h->slice_type_nos == FF_B_TYPE){
4119 h->direct_spatial_mv_pred= get_bits1(&s->gb); 4119 h->direct_spatial_mv_pred= get_bits1(&s->gb);
4120 if(FIELD_PICTURE && h->direct_spatial_mv_pred) 4120 if(FIELD_PICTURE && h->direct_spatial_mv_pred)
4121 av_log(h->s.avctx, AV_LOG_ERROR, "PAFF + spatial direct mode is not implemented\n"); 4121 av_log(h->s.avctx, AV_LOG_ERROR, "PAFF + spatial direct mode is not implemented\n");
4122 } 4122 }
4123 num_ref_idx_active_override_flag= get_bits1(&s->gb); 4123 num_ref_idx_active_override_flag= get_bits1(&s->gb);
4124 4124
4125 if(num_ref_idx_active_override_flag){ 4125 if(num_ref_idx_active_override_flag){
4126 h->ref_count[0]= get_ue_golomb(&s->gb) + 1; 4126 h->ref_count[0]= get_ue_golomb(&s->gb) + 1;
4127 if(h->slice_type==FF_B_TYPE) 4127 if(h->slice_type_nos==FF_B_TYPE)
4128 h->ref_count[1]= get_ue_golomb(&s->gb) + 1; 4128 h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
4129 4129
4130 if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){ 4130 if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){
4131 av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n"); 4131 av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
4132 h->ref_count[0]= h->ref_count[1]= 1; 4132 h->ref_count[0]= h->ref_count[1]= 1;
4133 return -1; 4133 return -1;
4134 } 4134 }
4135 } 4135 }
4136 if(h->slice_type == FF_B_TYPE) 4136 if(h->slice_type_nos == FF_B_TYPE)
4137 h->list_count= 2; 4137 h->list_count= 2;
4138 else 4138 else
4139 h->list_count= 1; 4139 h->list_count= 1;
4140 }else 4140 }else
4141 h->list_count= 0; 4141 h->list_count= 0;
4146 4146
4147 if(decode_ref_pic_list_reordering(h) < 0) 4147 if(decode_ref_pic_list_reordering(h) < 0)
4148 return -1; 4148 return -1;
4149 4149
4150 if( (h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE ) 4150 if( (h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE )
4151 || (h->pps.weighted_bipred_idc==1 && h->slice_type==FF_B_TYPE ) ) 4151 || (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
4152 pred_weight_table(h); 4152 pred_weight_table(h);
4153 else if(h->pps.weighted_bipred_idc==2 && h->slice_type==FF_B_TYPE) 4153 else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE)
4154 implicit_weight_table(h); 4154 implicit_weight_table(h);
4155 else 4155 else
4156 h->use_weight = 0; 4156 h->use_weight = 0;
4157 4157
4158 if(h->nal_ref_idc) 4158 if(h->nal_ref_idc)
4215 } 4215 }
4216 } 4216 }
4217 4217
4218 if( s->avctx->skip_loop_filter >= AVDISCARD_ALL 4218 if( s->avctx->skip_loop_filter >= AVDISCARD_ALL
4219 ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE) 4219 ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE)
4220 ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type == FF_B_TYPE) 4220 ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
4221 ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) 4221 ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
4222 h->deblocking_filter= 0; 4222 h->deblocking_filter= 0;
4223 4223
4224 if(h->deblocking_filter == 1 && h0->max_contexts > 1) { 4224 if(h->deblocking_filter == 1 && h0->max_contexts > 1) {
4225 if(s->avctx->flags2 & CODEC_FLAG2_FAST) { 4225 if(s->avctx->flags2 & CODEC_FLAG2_FAST) {
4475 memset(h->non_zero_count_cache + 8, 0, 8*5); //FIXME ugly, remove pfui 4475 memset(h->non_zero_count_cache + 8, 0, 8*5); //FIXME ugly, remove pfui
4476 4476
4477 if(MB_FIELD) 4477 if(MB_FIELD)
4478 mb_type|= MB_TYPE_INTERLACED; 4478 mb_type|= MB_TYPE_INTERLACED;
4479 4479
4480 if( h->slice_type == FF_B_TYPE ) 4480 if( h->slice_type_nos == FF_B_TYPE )
4481 { 4481 {
4482 // just for fill_caches. pred_direct_motion will set the real mb_type 4482 // just for fill_caches. pred_direct_motion will set the real mb_type
4483 mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP; 4483 mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
4484 4484
4485 fill_caches(h, mb_type, 0); //FIXME check what is needed and what not ... 4485 fill_caches(h, mb_type, 0); //FIXME check what is needed and what not ...
4544 h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); 4544 h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME);
4545 4545
4546 h->prev_mb_skipped= 0; 4546 h->prev_mb_skipped= 0;
4547 4547
4548 mb_type= get_ue_golomb(&s->gb); 4548 mb_type= get_ue_golomb(&s->gb);
4549 if(h->slice_type == FF_B_TYPE){ 4549 if(h->slice_type_nos == FF_B_TYPE){
4550 if(mb_type < 23){ 4550 if(mb_type < 23){
4551 partition_count= b_mb_type_info[mb_type].partition_count; 4551 partition_count= b_mb_type_info[mb_type].partition_count;
4552 mb_type= b_mb_type_info[mb_type].type; 4552 mb_type= b_mb_type_info[mb_type].type;
4553 }else{ 4553 }else{
4554 mb_type -= 23; 4554 mb_type -= 23;
4669 return -1; 4669 return -1;
4670 h->chroma_pred_mode= pred_mode; 4670 h->chroma_pred_mode= pred_mode;
4671 }else if(partition_count==4){ 4671 }else if(partition_count==4){
4672 int i, j, sub_partition_count[4], list, ref[2][4]; 4672 int i, j, sub_partition_count[4], list, ref[2][4];
4673 4673
4674 if(h->slice_type == FF_B_TYPE){ 4674 if(h->slice_type_nos == FF_B_TYPE){
4675 for(i=0; i<4; i++){ 4675 for(i=0; i<4; i++){
4676 h->sub_mb_type[i]= get_ue_golomb(&s->gb); 4676 h->sub_mb_type[i]= get_ue_golomb(&s->gb);
4677 if(h->sub_mb_type[i] >=13){ 4677 if(h->sub_mb_type[i] >=13){
4678 av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); 4678 av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
4679 return -1; 4679 return -1;
5074 return 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] ); 5074 return 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] );
5075 } 5075 }
5076 } else { 5076 } else {
5077 return decode_cabac_intra_mb_type(h, 17, 0) + 5; 5077 return decode_cabac_intra_mb_type(h, 17, 0) + 5;
5078 } 5078 }
5079 } else if( h->slice_type == FF_B_TYPE ) { 5079 } else if( h->slice_type_nos == FF_B_TYPE ) {
5080 const int mba_xy = h->left_mb_xy[0]; 5080 const int mba_xy = h->left_mb_xy[0];
5081 const int mbb_xy = h->top_mb_xy; 5081 const int mbb_xy = h->top_mb_xy;
5082 int ctx = 0; 5082 int ctx = 0;
5083 int bits; 5083 int bits;
5084 5084
5144 if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] )) 5144 if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] ))
5145 ctx++; 5145 ctx++;
5146 if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] )) 5146 if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] ))
5147 ctx++; 5147 ctx++;
5148 5148
5149 if( h->slice_type == FF_B_TYPE ) 5149 if( h->slice_type_nos == FF_B_TYPE )
5150 ctx += 13; 5150 ctx += 13;
5151 return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] ); 5151 return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] );
5152 } 5152 }
5153 5153
5154 static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) { 5154 static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) {
5281 int refa = h->ref_cache[list][scan8[n] - 1]; 5281 int refa = h->ref_cache[list][scan8[n] - 1];
5282 int refb = h->ref_cache[list][scan8[n] - 8]; 5282 int refb = h->ref_cache[list][scan8[n] - 8];
5283 int ref = 0; 5283 int ref = 0;
5284 int ctx = 0; 5284 int ctx = 0;
5285 5285
5286 if( h->slice_type == FF_B_TYPE) { 5286 if( h->slice_type_nos == FF_B_TYPE) {
5287 if( refa > 0 && !h->direct_cache[scan8[n] - 1] ) 5287 if( refa > 0 && !h->direct_cache[scan8[n] - 1] )
5288 ctx++; 5288 ctx++;
5289 if( refb > 0 && !h->direct_cache[scan8[n] - 8] ) 5289 if( refb > 0 && !h->direct_cache[scan8[n] - 8] )
5290 ctx += 2; 5290 ctx += 2;
5291 } else { 5291 } else {
5682 if( ( mb_type = decode_cabac_mb_type( h ) ) < 0 ) { 5682 if( ( mb_type = decode_cabac_mb_type( h ) ) < 0 ) {
5683 av_log( h->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" ); 5683 av_log( h->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" );
5684 return -1; 5684 return -1;
5685 } 5685 }
5686 5686
5687 if( h->slice_type == FF_B_TYPE ) { 5687 if( h->slice_type_nos == FF_B_TYPE ) {
5688 if( mb_type < 23 ){ 5688 if( mb_type < 23 ){
5689 partition_count= b_mb_type_info[mb_type].partition_count; 5689 partition_count= b_mb_type_info[mb_type].partition_count;
5690 mb_type= b_mb_type_info[mb_type].type; 5690 mb_type= b_mb_type_info[mb_type].type;
5691 }else{ 5691 }else{
5692 mb_type -= 23; 5692 mb_type -= 23;
5805 if( pred_mode < 0 ) return -1; 5805 if( pred_mode < 0 ) return -1;
5806 h->chroma_pred_mode= pred_mode; 5806 h->chroma_pred_mode= pred_mode;
5807 } else if( partition_count == 4 ) { 5807 } else if( partition_count == 4 ) {
5808 int i, j, sub_partition_count[4], list, ref[2][4]; 5808 int i, j, sub_partition_count[4], list, ref[2][4];
5809 5809
5810 if( h->slice_type == FF_B_TYPE ) { 5810 if( h->slice_type_nos == FF_B_TYPE ) {
5811 for( i = 0; i < 4; i++ ) { 5811 for( i = 0; i < 4; i++ ) {
5812 h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); 5812 h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h );
5813 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; 5813 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
5814 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; 5814 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
5815 } 5815 }
6504 && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) 6504 && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16))
6505 ? 3 : 0; 6505 ? 3 : 0;
6506 int step = IS_8x8DCT(mb_type) ? 2 : 1; 6506 int step = IS_8x8DCT(mb_type) ? 2 : 1;
6507 edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; 6507 edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
6508 s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, 6508 s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache,
6509 (h->slice_type == FF_B_TYPE), edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); 6509 (h->slice_type_nos == FF_B_TYPE), edges, step, mask_edge0, mask_edge1, FIELD_PICTURE);
6510 } 6510 }
6511 if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) 6511 if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) )
6512 bSv[0][0] = 0x0004000400040004ULL; 6512 bSv[0][0] = 0x0004000400040004ULL;
6513 if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) ) 6513 if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) )
6514 bSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL; 6514 bSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL;
6730 } 6730 }
6731 else if( mask_par0 && (edge || (mbn_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) { 6731 else if( mask_par0 && (edge || (mbn_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {
6732 int b_idx= 8 + 4 + edge * (dir ? 8:1); 6732 int b_idx= 8 + 4 + edge * (dir ? 8:1);
6733 int bn_idx= b_idx - (dir ? 8:1); 6733 int bn_idx= b_idx - (dir ? 8:1);
6734 int v = 0; 6734 int v = 0;
6735 int xn= h->slice_type == FF_B_TYPE && h->ref2frm[0][h->ref_cache[0][b_idx]+2] != h->ref2frm[0][h->ref_cache[0][bn_idx]+2]; 6735 int xn= h->slice_type_nos == FF_B_TYPE && h->ref2frm[0][h->ref_cache[0][b_idx]+2] != h->ref2frm[0][h->ref_cache[0][bn_idx]+2];
6736 6736
6737 for( l = 0; !v && l < 1 + (h->slice_type == FF_B_TYPE); l++ ) { 6737 for( l = 0; !v && l < 1 + (h->slice_type_nos == FF_B_TYPE); l++ ) {
6738 int ln= l^xn; 6738 int ln= l^xn;
6739 v |= h->ref2frm[l][h->ref_cache[l][b_idx]+2] != h->ref2frm[ln][h->ref_cache[ln][bn_idx]+2] || 6739 v |= h->ref2frm[l][h->ref_cache[l][b_idx]+2] != h->ref2frm[ln][h->ref_cache[ln][bn_idx]+2] ||
6740 FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 || 6740 FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 ||
6741 FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit; 6741 FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit;
6742 } 6742 }
6756 h->non_zero_count_cache[bn_idx] != 0 ) { 6756 h->non_zero_count_cache[bn_idx] != 0 ) {
6757 bS[i] = 2; 6757 bS[i] = 2;
6758 } 6758 }
6759 else if(!mv_done) 6759 else if(!mv_done)
6760 { 6760 {
6761 int xn= h->slice_type == FF_B_TYPE && h->ref2frm[0][h->ref_cache[0][b_idx]+2] != h->ref2frm[0][h->ref_cache[0][bn_idx]+2]; 6761 int xn= h->slice_type_nos == FF_B_TYPE && h->ref2frm[0][h->ref_cache[0][b_idx]+2] != h->ref2frm[0][h->ref_cache[0][bn_idx]+2];
6762 bS[i] = 0; 6762 bS[i] = 0;
6763 for( l = 0; l < 1 + (h->slice_type == FF_B_TYPE); l++ ) { 6763 for( l = 0; l < 1 + (h->slice_type_nos == FF_B_TYPE); l++ ) {
6764 int ln= l^xn; 6764 int ln= l^xn;
6765 if( h->ref2frm[l][h->ref_cache[l][b_idx]+2] != h->ref2frm[ln][h->ref_cache[ln][bn_idx]+2] || 6765 if( h->ref2frm[l][h->ref_cache[l][b_idx]+2] != h->ref2frm[ln][h->ref_cache[ln][bn_idx]+2] ||
6766 FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 || 6766 FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 ||
6767 FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit ) { 6767 FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit ) {
6768 bS[i] = 1; 6768 bS[i] = 1;
7588 break; 7588 break;
7589 7589
7590 s->current_picture_ptr->key_frame|= (hx->nal_unit_type == NAL_IDR_SLICE); 7590 s->current_picture_ptr->key_frame|= (hx->nal_unit_type == NAL_IDR_SLICE);
7591 if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 7591 if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
7592 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) 7592 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
7593 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=FF_B_TYPE) 7593 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
7594 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) 7594 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
7595 && avctx->skip_frame < AVDISCARD_ALL) 7595 && avctx->skip_frame < AVDISCARD_ALL)
7596 context_count++; 7596 context_count++;
7597 break; 7597 break;
7598 case NAL_DPA: 7598 case NAL_DPA:
7613 7613
7614 if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning 7614 if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
7615 && s->context_initialized 7615 && s->context_initialized
7616 && s->hurry_up < 5 7616 && s->hurry_up < 5
7617 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) 7617 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
7618 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=FF_B_TYPE) 7618 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
7619 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) 7619 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
7620 && avctx->skip_frame < AVDISCARD_ALL) 7620 && avctx->skip_frame < AVDISCARD_ALL)
7621 context_count++; 7621 context_count++;
7622 break; 7622 break;
7623 case NAL_SEI: 7623 case NAL_SEI: