# HG changeset patch # User cehoyos # Date 1233694142 0 # Node ID 5d7ebbb7e91bc487942e2a564d2d546d3db66985 # Parent bb969c77ad18bcf258fae4c51af188bdc36b0048 Add fields to H264Context and SPS for upcoming VA API support. Patch by Gwenole Beauchesne gbeauchesne A splitted-desktop dotcom diff -r bb969c77ad18 -r 5d7ebbb7e91b h264.c --- a/h264.c Tue Feb 03 17:56:24 2009 +0000 +++ b/h264.c Tue Feb 03 20:49:02 2009 +0000 @@ -2996,6 +2996,8 @@ chroma_def = 1<chroma_log2_weight_denom; for(list=0; list<2; list++){ + h->luma_weight_flag[list] = 0; + h->chroma_weight_flag[list] = 0; for(i=0; iref_count[list]; i++){ int luma_weight_flag, chroma_weight_flag; @@ -3004,8 +3006,10 @@ h->luma_weight[list][i]= get_se_golomb(&s->gb); h->luma_offset[list][i]= get_se_golomb(&s->gb); if( h->luma_weight[list][i] != luma_def - || h->luma_offset[list][i] != 0) + || h->luma_offset[list][i] != 0) { h->use_weight= 1; + h->luma_weight_flag[list]= 1; + } }else{ h->luma_weight[list][i]= luma_def; h->luma_offset[list][i]= 0; @@ -3019,8 +3023,10 @@ h->chroma_weight[list][i][j]= get_se_golomb(&s->gb); h->chroma_offset[list][i][j]= get_se_golomb(&s->gb); if( h->chroma_weight[list][i][j] != chroma_def - || h->chroma_offset[list][i][j] != 0) + || h->chroma_offset[list][i][j] != 0) { h->use_weight_chroma= 1; + h->chroma_weight_flag[list]= 1; + } } }else{ int j; @@ -3039,7 +3045,7 @@ static void implicit_weight_table(H264Context *h){ MpegEncContext * const s = &h->s; - int ref0, ref1; + int ref0, ref1, i; int cur_poc = s->current_picture_ptr->poc; if( h->ref_count[0] == 1 && h->ref_count[1] == 1 @@ -3053,6 +3059,10 @@ h->use_weight_chroma= 2; h->luma_log2_weight_denom= 5; h->chroma_log2_weight_denom= 5; + for (i = 0; i < 2; i++) { + h->luma_weight_flag[i] = 0; + h->chroma_weight_flag[i] = 0; + } for(ref0=0; ref0 < h->ref_count[0]; ref0++){ int poc0 = h->ref_list[0][ref0].poc; @@ -3938,8 +3948,13 @@ pred_weight_table(h); else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE) implicit_weight_table(h); - else + else { h->use_weight = 0; + for (i = 0; i < 2; i++) { + h->luma_weight_flag[i] = 0; + h->chroma_weight_flag[i] = 0; + } + } if(h->nal_ref_idc) decode_ref_pic_marking(h0, &s->gb); @@ -7055,9 +7070,9 @@ if(sps->profile_idc >= 100){ //high profile sps->chroma_format_idc= get_ue_golomb_31(&s->gb); if(sps->chroma_format_idc == 3) - get_bits1(&s->gb); //residual_color_transform_flag - get_ue_golomb(&s->gb); //bit_depth_luma_minus8 - get_ue_golomb(&s->gb); //bit_depth_chroma_minus8 + sps->residual_color_transform_flag = get_bits1(&s->gb); + sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8; + sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8; sps->transform_bypass = get_bits1(&s->gb); decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); }else{ diff -r bb969c77ad18 -r 5d7ebbb7e91b h264.h --- a/h264.h Tue Feb 03 17:56:24 2009 +0000 +++ b/h264.h Tue Feb 03 20:49:02 2009 +0000 @@ -176,6 +176,9 @@ int time_offset_length; int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1 int dpb_output_delay_length; ///< dpb_output_delay_length_minus1 + 1 + int bit_depth_luma; ///< bit_depth_luma_minus8 + 8 + int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8 + int residual_color_transform_flag; ///< residual_colour_transform_flag }SPS; /** @@ -493,6 +496,9 @@ SEI_PicStructType sei_pic_struct; int is_complex; + + int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag + int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag }H264Context; #endif /* AVCODEC_H264_H */