Commit cb99c652 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Carl Eugen Hoyos

Add fields to H264Context and SPS for upcoming VA API support.

Patch by Gwenole Beauchesne gbeauchesne A splitted-desktop dotcom

Originally committed as revision 16976 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 25a03ba3
...@@ -2996,6 +2996,8 @@ static int pred_weight_table(H264Context *h){ ...@@ -2996,6 +2996,8 @@ static int pred_weight_table(H264Context *h){
chroma_def = 1<<h->chroma_log2_weight_denom; chroma_def = 1<<h->chroma_log2_weight_denom;
for(list=0; list<2; list++){ for(list=0; list<2; list++){
h->luma_weight_flag[list] = 0;
h->chroma_weight_flag[list] = 0;
for(i=0; i<h->ref_count[list]; i++){ for(i=0; i<h->ref_count[list]; i++){
int luma_weight_flag, chroma_weight_flag; int luma_weight_flag, chroma_weight_flag;
...@@ -3004,8 +3006,10 @@ static int pred_weight_table(H264Context *h){ ...@@ -3004,8 +3006,10 @@ static int pred_weight_table(H264Context *h){
h->luma_weight[list][i]= get_se_golomb(&s->gb); h->luma_weight[list][i]= get_se_golomb(&s->gb);
h->luma_offset[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 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->use_weight= 1;
h->luma_weight_flag[list]= 1;
}
}else{ }else{
h->luma_weight[list][i]= luma_def; h->luma_weight[list][i]= luma_def;
h->luma_offset[list][i]= 0; h->luma_offset[list][i]= 0;
...@@ -3019,8 +3023,10 @@ static int pred_weight_table(H264Context *h){ ...@@ -3019,8 +3023,10 @@ static int pred_weight_table(H264Context *h){
h->chroma_weight[list][i][j]= get_se_golomb(&s->gb); h->chroma_weight[list][i][j]= get_se_golomb(&s->gb);
h->chroma_offset[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 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->use_weight_chroma= 1;
h->chroma_weight_flag[list]= 1;
}
} }
}else{ }else{
int j; int j;
...@@ -3039,7 +3045,7 @@ static int pred_weight_table(H264Context *h){ ...@@ -3039,7 +3045,7 @@ static int pred_weight_table(H264Context *h){
static void implicit_weight_table(H264Context *h){ static void implicit_weight_table(H264Context *h){
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;
int ref0, ref1; int ref0, ref1, i;
int cur_poc = s->current_picture_ptr->poc; int cur_poc = s->current_picture_ptr->poc;
if( h->ref_count[0] == 1 && h->ref_count[1] == 1 if( h->ref_count[0] == 1 && h->ref_count[1] == 1
...@@ -3053,6 +3059,10 @@ static void implicit_weight_table(H264Context *h){ ...@@ -3053,6 +3059,10 @@ static void implicit_weight_table(H264Context *h){
h->use_weight_chroma= 2; h->use_weight_chroma= 2;
h->luma_log2_weight_denom= 5; h->luma_log2_weight_denom= 5;
h->chroma_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++){ for(ref0=0; ref0 < h->ref_count[0]; ref0++){
int poc0 = h->ref_list[0][ref0].poc; int poc0 = h->ref_list[0][ref0].poc;
...@@ -3938,8 +3948,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ ...@@ -3938,8 +3948,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
pred_weight_table(h); pred_weight_table(h);
else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE) else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE)
implicit_weight_table(h); implicit_weight_table(h);
else else {
h->use_weight = 0; 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) if(h->nal_ref_idc)
decode_ref_pic_marking(h0, &s->gb); decode_ref_pic_marking(h0, &s->gb);
...@@ -7055,9 +7070,9 @@ static inline int decode_seq_parameter_set(H264Context *h){ ...@@ -7055,9 +7070,9 @@ static inline int decode_seq_parameter_set(H264Context *h){
if(sps->profile_idc >= 100){ //high profile if(sps->profile_idc >= 100){ //high profile
sps->chroma_format_idc= get_ue_golomb_31(&s->gb); sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
if(sps->chroma_format_idc == 3) if(sps->chroma_format_idc == 3)
get_bits1(&s->gb); //residual_color_transform_flag sps->residual_color_transform_flag = get_bits1(&s->gb);
get_ue_golomb(&s->gb); //bit_depth_luma_minus8 sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8;
get_ue_golomb(&s->gb); //bit_depth_chroma_minus8 sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8;
sps->transform_bypass = get_bits1(&s->gb); sps->transform_bypass = get_bits1(&s->gb);
decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
}else{ }else{
......
...@@ -176,6 +176,9 @@ typedef struct SPS{ ...@@ -176,6 +176,9 @@ typedef struct SPS{
int time_offset_length; int time_offset_length;
int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1 int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1
int dpb_output_delay_length; ///< dpb_output_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; }SPS;
/** /**
...@@ -493,6 +496,9 @@ typedef struct H264Context{ ...@@ -493,6 +496,9 @@ typedef struct H264Context{
SEI_PicStructType sei_pic_struct; SEI_PicStructType sei_pic_struct;
int is_complex; 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; }H264Context;
#endif /* AVCODEC_H264_H */ #endif /* AVCODEC_H264_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment