[FFmpeg-cvslog] r16976 - in trunk/libavcodec: h264.c h264.h

cehoyos subversion
Tue Feb 3 21:49:03 CET 2009


Author: cehoyos
Date: Tue Feb  3 21:49:02 2009
New Revision: 16976

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

Patch by Gwenole Beauchesne gbeauchesne A splitted-desktop dotcom

Modified:
   trunk/libavcodec/h264.c
   trunk/libavcodec/h264.h

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	Tue Feb  3 19:04:52 2009	(r16975)
+++ trunk/libavcodec/h264.c	Tue Feb  3 21:49:02 2009	(r16976)
@@ -2996,6 +2996,8 @@ static int pred_weight_table(H264Context
     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->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->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
 
 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(H264Co
     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(H264Conte
         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_s
     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{

Modified: trunk/libavcodec/h264.h
==============================================================================
--- trunk/libavcodec/h264.h	Tue Feb  3 19:04:52 2009	(r16975)
+++ trunk/libavcodec/h264.h	Tue Feb  3 21:49:02 2009	(r16976)
@@ -176,6 +176,9 @@ typedef struct SPS{
     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 @@ typedef struct H264Context{
     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 */




More information about the ffmpeg-cvslog mailing list