diff options
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index cd6facb..0f4b613 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -477,7 +477,7 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){ *(uint32_t*)h->mvd_cache [list][scan8[4 ]]= *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0; - if(h->slice_type == B_TYPE){ + if(h->slice_type == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1); if(IS_DIRECT(top_type)){ @@ -918,16 +918,16 @@ static inline void direct_ref_list_init(H264Context * const h){ Picture * const ref1 = &h->ref_list[1][0]; Picture * const cur = s->current_picture_ptr; int list, i, j; - if(cur->pict_type == I_TYPE) + if(cur->pict_type == FF_I_TYPE) cur->ref_count[0] = 0; - if(cur->pict_type != B_TYPE) + if(cur->pict_type != FF_B_TYPE) cur->ref_count[1] = 0; for(list=0; list<2; list++){ cur->ref_count[list] = h->ref_count[list]; for(j=0; j<h->ref_count[list]; j++) cur->ref_poc[list][j] = h->ref_list[list][j].poc; } - if(cur->pict_type != B_TYPE || h->direct_spatial_mv_pred) + if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred) return; for(list=0; list<2; list++){ for(i=0; i<ref1->ref_count[list]; i++){ @@ -1358,7 +1358,7 @@ static inline void write_back_motion(H264Context *h, int mb_type){ } } - if(h->slice_type == B_TYPE && h->pps.cabac){ + if(h->slice_type == FF_B_TYPE && h->pps.cabac){ if(IS_8X8(mb_type)){ uint8_t *direct_table = &h->direct_table[b8_xy]; direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0; @@ -2857,7 +2857,7 @@ static int fill_default_ref_list(H264Context *h){ frame_list[1] = h->default_ref_list[1]; } - if(h->slice_type==B_TYPE){ + if(h->slice_type==FF_B_TYPE){ int list; int len[2]; int short_len[2]; @@ -2979,7 +2979,7 @@ static int fill_default_ref_list(H264Context *h){ for (i=0; i<h->ref_count[0]; i++) { 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]); } - if(h->slice_type==B_TYPE){ + if(h->slice_type==FF_B_TYPE){ for (i=0; i<h->ref_count[1]; i++) { 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]); } @@ -3021,7 +3021,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){ print_short_term(h); print_long_term(h); - if(h->slice_type==I_TYPE || h->slice_type==SI_TYPE) return 0; //FIXME move before func + if(h->slice_type==FF_I_TYPE || h->slice_type==FF_SI_TYPE) return 0; //FIXME move before func for(list=0; list<h->list_count; list++){ memcpy(h->ref_list[list], h->default_ref_list[list], sizeof(Picture)*h->ref_count[list]); @@ -3122,7 +3122,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){ } } - if(h->slice_type==B_TYPE && !h->direct_spatial_mv_pred) + if(h->slice_type==FF_B_TYPE && !h->direct_spatial_mv_pred) direct_dist_scale_factor(h); direct_ref_list_init(h); return 0; @@ -3205,7 +3205,7 @@ static int pred_weight_table(H264Context *h){ } } } - if(h->slice_type != B_TYPE) break; + if(h->slice_type != FF_B_TYPE) break; } h->use_weight= h->use_weight || h->use_weight_chroma; return 0; @@ -3864,7 +3864,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ unsigned int first_mb_in_slice; unsigned int pps_id; int num_ref_idx_active_override_flag; - static const uint8_t slice_type_map[5]= {P_TYPE, B_TYPE, I_TYPE, SP_TYPE, SI_TYPE}; + static const uint8_t slice_type_map[5]= {FF_P_TYPE, FF_B_TYPE, FF_I_TYPE, FF_SP_TYPE, FF_SI_TYPE}; unsigned int slice_type, tmp, i; int default_ref_list_done = 0; int last_pic_structure; @@ -3899,14 +3899,14 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ h->slice_type_fixed=0; slice_type= slice_type_map[ slice_type ]; - if (slice_type == I_TYPE + if (slice_type == FF_I_TYPE || (h0->current_slice != 0 && slice_type == h0->last_slice_type) ) { default_ref_list_done = 1; } h->slice_type= slice_type; s->pict_type= h->slice_type; // to make a few old func happy, it's wrong though - if (s->pict_type == B_TYPE && s0->last_picture_ptr == NULL) { + if (s->pict_type == FF_B_TYPE && s0->last_picture_ptr == NULL) { av_log(h->s.avctx, AV_LOG_ERROR, "B picture before any references, skipping\n"); return -1; @@ -4109,15 +4109,15 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ h->ref_count[0]= h->pps.ref_count[0]; h->ref_count[1]= h->pps.ref_count[1]; - if(h->slice_type == P_TYPE || h->slice_type == SP_TYPE || h->slice_type == B_TYPE){ - if(h->slice_type == B_TYPE){ + if(h->slice_type == FF_P_TYPE || h->slice_type == FF_SP_TYPE || h->slice_type == FF_B_TYPE){ + if(h->slice_type == FF_B_TYPE){ h->direct_spatial_mv_pred= get_bits1(&s->gb); } num_ref_idx_active_override_flag= get_bits1(&s->gb); if(num_ref_idx_active_override_flag){ h->ref_count[0]= get_ue_golomb(&s->gb) + 1; - if(h->slice_type==B_TYPE) + if(h->slice_type==FF_B_TYPE) h->ref_count[1]= get_ue_golomb(&s->gb) + 1; if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){ @@ -4126,7 +4126,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ return -1; } } - if(h->slice_type == B_TYPE) + if(h->slice_type == FF_B_TYPE) h->list_count= 2; else h->list_count= 1; @@ -4140,10 +4140,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ if(decode_ref_pic_list_reordering(h) < 0) return -1; - if( (h->pps.weighted_pred && (h->slice_type == P_TYPE || h->slice_type == SP_TYPE )) - || (h->pps.weighted_bipred_idc==1 && h->slice_type==B_TYPE ) ) + if( (h->pps.weighted_pred && (h->slice_type == FF_P_TYPE || h->slice_type == FF_SP_TYPE )) + || (h->pps.weighted_bipred_idc==1 && h->slice_type==FF_B_TYPE ) ) pred_weight_table(h); - else if(h->pps.weighted_bipred_idc==2 && h->slice_type==B_TYPE) + else if(h->pps.weighted_bipred_idc==2 && h->slice_type==FF_B_TYPE) implicit_weight_table(h); else h->use_weight = 0; @@ -4154,7 +4154,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ if(FRAME_MBAFF) fill_mbaff_ref_list(h); - if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE && h->pps.cabac ){ + if( h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE && h->pps.cabac ){ tmp = get_ue_golomb(&s->gb); if(tmp > 2){ av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n"); @@ -4173,10 +4173,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); //FIXME qscale / qp ... stuff - if(h->slice_type == SP_TYPE){ + if(h->slice_type == FF_SP_TYPE){ get_bits1(&s->gb); /* sp_for_switch_flag */ } - if(h->slice_type==SP_TYPE || h->slice_type == SI_TYPE){ + if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){ get_se_golomb(&s->gb); /* slice_qs_delta */ } @@ -4200,8 +4200,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ } if( s->avctx->skip_loop_filter >= AVDISCARD_ALL - ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type != I_TYPE) - ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type == B_TYPE) + ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type != FF_I_TYPE) + ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type == FF_B_TYPE) ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) h->deblocking_filter= 0; @@ -4462,7 +4462,7 @@ static void decode_mb_skip(H264Context *h){ if(MB_FIELD) mb_type|= MB_TYPE_INTERLACED; - if( h->slice_type == B_TYPE ) + if( h->slice_type == FF_B_TYPE ) { // just for fill_caches. pred_direct_motion will set the real mb_type mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP; @@ -4505,7 +4505,7 @@ static int decode_mb_cavlc(H264Context *h){ tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; /* avoid warning. FIXME: find a solution without slowing down the code */ - if(h->slice_type != I_TYPE && h->slice_type != SI_TYPE){ + if(h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); @@ -4529,7 +4529,7 @@ static int decode_mb_cavlc(H264Context *h){ h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); - if(h->slice_type == B_TYPE){ + if(h->slice_type == FF_B_TYPE){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; @@ -4537,7 +4537,7 @@ static int decode_mb_cavlc(H264Context *h){ mb_type -= 23; goto decode_intra_mb; } - }else if(h->slice_type == P_TYPE /*|| h->slice_type == SP_TYPE */){ + }else if(h->slice_type == FF_P_TYPE /*|| h->slice_type == FF_SP_TYPE */){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; @@ -4546,7 +4546,7 @@ static int decode_mb_cavlc(H264Context *h){ goto decode_intra_mb; } }else{ - assert(h->slice_type == I_TYPE); + assert(h->slice_type == FF_I_TYPE); decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); @@ -4652,7 +4652,7 @@ decode_intra_mb: }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; - if(h->slice_type == B_TYPE){ + if(h->slice_type == FF_B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ @@ -4671,7 +4671,7 @@ decode_intra_mb: h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ - assert(h->slice_type == P_TYPE || h->slice_type == SP_TYPE); //FIXME SP correct ? + assert(h->slice_type == FF_P_TYPE || h->slice_type == FF_SP_TYPE); //FIXME SP correct ? for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ @@ -5042,9 +5042,9 @@ static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_sl static int decode_cabac_mb_type( H264Context *h ) { MpegEncContext * const s = &h->s; - if( h->slice_type == I_TYPE ) { + if( h->slice_type == FF_I_TYPE ) { return decode_cabac_intra_mb_type(h, 3, 1); - } else if( h->slice_type == P_TYPE ) { + } else if( h->slice_type == FF_P_TYPE ) { if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { /* P-type */ if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { @@ -5057,7 +5057,7 @@ static int decode_cabac_mb_type( H264Context *h ) { } else { return decode_cabac_intra_mb_type(h, 17, 0) + 5; } - } else if( h->slice_type == B_TYPE ) { + } else if( h->slice_type == FF_B_TYPE ) { const int mba_xy = h->left_mb_xy[0]; const int mbb_xy = h->top_mb_xy; int ctx = 0; @@ -5127,7 +5127,7 @@ static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) { if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] )) ctx++; - if( h->slice_type == B_TYPE ) + if( h->slice_type == FF_B_TYPE ) ctx += 13; return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] ); } @@ -5264,7 +5264,7 @@ static int decode_cabac_mb_ref( H264Context *h, int list, int n ) { int ref = 0; int ctx = 0; - if( h->slice_type == B_TYPE) { + if( h->slice_type == FF_B_TYPE) { if( refa > 0 && !h->direct_cache[scan8[n] - 1] ) ctx++; if( refb > 0 && !h->direct_cache[scan8[n] - 8] ) @@ -5582,7 +5582,7 @@ static int decode_mb_cabac(H264Context *h) { s->dsp.clear_blocks(h->mb); //FIXME avoid if already clear (move after skip handlong?) tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); - if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE ) { + if( h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE ) { int skip; /* a skipped mb needs the aff flag from the following mb */ if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) @@ -5627,7 +5627,7 @@ static int decode_mb_cabac(H264Context *h) { return -1; } - if( h->slice_type == B_TYPE ) { + if( h->slice_type == FF_B_TYPE ) { if( mb_type < 23 ){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; @@ -5635,7 +5635,7 @@ static int decode_mb_cabac(H264Context *h) { mb_type -= 23; goto decode_intra_mb; } - } else if( h->slice_type == P_TYPE ) { + } else if( h->slice_type == FF_P_TYPE ) { if( mb_type < 5) { partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; @@ -5644,7 +5644,7 @@ static int decode_mb_cabac(H264Context *h) { goto decode_intra_mb; } } else { - assert(h->slice_type == I_TYPE); + assert(h->slice_type == FF_I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; @@ -5747,7 +5747,7 @@ decode_intra_mb: } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; - if( h->slice_type == B_TYPE ) { + if( h->slice_type == FF_B_TYPE ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; @@ -6445,7 +6445,7 @@ static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, int step = IS_8x8DCT(mb_type) ? 2 : 1; edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, - (h->slice_type == B_TYPE), edges, step, mask_edge0, mask_edge1 ); + (h->slice_type == FF_B_TYPE), edges, step, mask_edge0, mask_edge1 ); } if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) bSv[0][0] = 0x0004000400040004ULL; @@ -6676,7 +6676,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 int b_idx= 8 + 4 + edge * (dir ? 8:1); int bn_idx= b_idx - (dir ? 8:1); int v = 0; - for( l = 0; !v && l < 1 + (h->slice_type == B_TYPE); l++ ) { + for( l = 0; !v && l < 1 + (h->slice_type == FF_B_TYPE); l++ ) { v |= ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] || FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; @@ -6700,7 +6700,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 else if(!mv_done) { bS[i] = 0; - for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) { + for( l = 0; l < 1 + (h->slice_type == FF_B_TYPE); l++ ) { if( ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] || FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) { @@ -6763,7 +6763,7 @@ static int decode_slice(struct AVCodecContext *avctx, H264Context *h){ /* calculate pre-state */ for( i= 0; i < 460; i++ ) { int pre; - if( h->slice_type == I_TYPE ) + if( h->slice_type == FF_I_TYPE ) pre = av_clip( ((cabac_context_init_I[i][0] * s->qscale) >>4 ) + cabac_context_init_I[i][1], 1, 126 ); else pre = av_clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 ); @@ -7524,8 +7524,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ s->current_picture_ptr->key_frame|= (hx->nal_unit_type == NAL_IDR_SLICE); if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) - && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=B_TYPE) - && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==I_TYPE) + && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=FF_B_TYPE) + && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==FF_I_TYPE) && avctx->skip_frame < AVDISCARD_ALL) context_count++; break; @@ -7549,8 +7549,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ && s->context_initialized && s->hurry_up < 5 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) - && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=B_TYPE) - && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==I_TYPE) + && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=FF_B_TYPE) + && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==FF_I_TYPE) && avctx->skip_frame < AVDISCARD_ALL) context_count++; break; @@ -7814,7 +7814,7 @@ static int decode_frame(AVCodecContext *avctx, else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) || (s->low_delay && ((!cross_idr && prev && out->poc > prev->poc + 2) - || cur->pict_type == B_TYPE))) + || cur->pict_type == FF_B_TYPE))) { s->low_delay = 0; s->avctx->has_b_frames++; |