summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-02-03 20:49:02 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2009-02-03 20:49:02 +0000
commitcb99c652eb271098ccffbe416f38f589032e3d82 (patch)
treeb8f1f78267ff93e330a6a973b9fb3e500e4c2194 /libavcodec/h264.c
parent25a03ba358fe9c9805146b34863e928212e09961 (diff)
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
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 1d3dbc0ed5..0e81f13fd0 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2996,6 +2996,8 @@ static int pred_weight_table(H264Context *h){
chroma_def = 1<<h->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; i<h->ref_count[list]; i++){
int luma_weight_flag, chroma_weight_flag;
@@ -3004,8 +3006,10 @@ static int pred_weight_table(H264Context *h){
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 @@ static int pred_weight_table(H264Context *h){
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 int pred_weight_table(H264Context *h){
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 @@ static void implicit_weight_table(H264Context *h){
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 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
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 @@ static inline int decode_seq_parameter_set(H264Context *h){
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{