[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec vc9.c,1.21,1.22

Ivan Kalvachev CVS iive
Tue May 17 01:11:41 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv4545

Modified Files:
	vc9.c 
Log Message:
parse and save hrd_fullness and range_map

Index: vc9.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/vc9.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- vc9.c	16 May 2005 14:55:22 -0000	1.21
+++ vc9.c	16 May 2005 23:11:38 -0000	1.22
@@ -321,6 +321,11 @@
     BitPlane over_flags_plane;    ///< Overflags bitplane
     uint8_t condover;
     uint16_t *hrd_rate, *hrd_buffer;
+    uint8_t *hrd_fullness;
+    uint8_t range_mapy_flag;
+    uint8_t range_mapuv_flag;
+    uint8_t range_mapy;
+    uint8_t range_mapuv;
     //@}
 #endif
 } VC9Context;
@@ -461,6 +466,7 @@
 
     num = 1 + get_bits(gb, 5);
 
+    /*hrd rate*/
     if (v->hrd_rate || num != v->hrd_num_leaky_buckets)
     {
         av_freep(&v->hrd_rate);
@@ -468,13 +474,30 @@
     if (!v->hrd_rate) v->hrd_rate = av_malloc(num*sizeof(uint16_t));
     if (!v->hrd_rate) return -1;
 
+    /*hrd buffer*/
     if (v->hrd_buffer || num != v->hrd_num_leaky_buckets)
     {
         av_freep(&v->hrd_buffer);
     }
     if (!v->hrd_buffer) v->hrd_buffer = av_malloc(num*sizeof(uint16_t));
-    if (!v->hrd_buffer) return -1;
+    if (!v->hrd_buffer)
+    {
+        av_freep(&v->hrd_rate);
+        return -1;
+    }
 
+    /*hrd fullness*/
+    if (v->hrd_fullness || num != v->hrd_num_leaky_buckets)
+    {
+        av_freep(&v->hrd_buffer);
+    }
+    if (!v->hrd_fullness) v->hrd_fullness = av_malloc(num*sizeof(uint8_t));
+    if (!v->hrd_fullness)
+    {
+        av_freep(&v->hrd_rate);
+        av_freep(&v->hrd_buffer);
+        return -1;
+    }
     v->hrd_num_leaky_buckets = num;
 
     //exponent in base-2 for rate
@@ -664,6 +687,10 @@
       if (decode_hrd(v, gb) < 0) return -1;
     }
 
+    /*reset scaling ranges, 6.2.2 & 6.2.3, p33*/
+    v->range_mapy_flag = 0;
+    v->range_mapuv_flag = 0;
+
     av_log(avctx, AV_LOG_DEBUG, "Advanced profile not supported yet\n");
     return -1;
 }
@@ -837,7 +864,7 @@
 static int advanced_entry_point_process(AVCodecContext *avctx, GetBitContext *gb)
 {
     VC9Context *v = avctx->priv_data;
-    int range_mapy_flag, range_mapuv_flag, i;
+    int i;
     if (v->profile != PROFILE_ADVANCED)
     {
         av_log(avctx, AV_LOG_ERROR,
@@ -848,20 +875,21 @@
     {
         //Update buffer fullness
         av_log(avctx, AV_LOG_DEBUG, "Buffer fullness update\n");
+        assert(v->hrd_num_leaky_buckets > 0);
         for (i=0; i<v->hrd_num_leaky_buckets; i++)
-            skip_bits(gb, 8);
+            v->hrd_fullness[i] = get_bits(gb, 8);
     }
-    if ((range_mapy_flag = get_bits(gb, 1)))
+    if ((v->range_mapy_flag = get_bits(gb, 1)))
     {
         //RANGE_MAPY
         av_log(avctx, AV_LOG_DEBUG, "RANGE_MAPY\n");
-        skip_bits(gb, 3);
+        v->range_mapy = get_bits(gb, 3);
     }
-    if ((range_mapuv_flag = get_bits(gb, 1)))
+    if ((v->range_mapuv_flag = get_bits(gb, 1)))
     {
         //RANGE_MAPUV
         av_log(avctx, AV_LOG_DEBUG, "RANGE_MAPUV\n");
-        skip_bits(gb, 3);
+        v->range_mapuv = get_bits(gb, 3);
     }
     if (v->panscanflag)
     {





More information about the ffmpeg-cvslog mailing list