shithub: libvpx

Download patch

ref: 9c836daf65495e753e9f29995b603b6fcf2588c2
parent: 128d2c23b34dce3c24daeee5dc619f6cda93cc5c
author: Attila Nagy <attilanagy@google.com>
date: Fri Mar 11 07:34:57 EST 2011

Fix "used uninitialized" warning in vp8_pack_bitstream()

Change-Id: Iadcbdba717439f47a2c24e65fd69a3a1464174b5

--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -1366,6 +1366,7 @@
     oh.show_frame = (int) pc->show_frame;
     oh.type = (int)pc->frame_type;
     oh.version = pc->version;
+    oh.first_partition_length_in_bytes = 0;
 
     mb_feature_data_bits = vp8_mb_feature_data_bits;
     cx_data += 3;
@@ -1634,7 +1635,22 @@
 
     vp8_stop_encode(bc);
 
+    oh.first_partition_length_in_bytes = cpi->bc.pos;
 
+    /* update frame tag */
+    {
+        int v = (oh.first_partition_length_in_bytes << 5) |
+                (oh.show_frame << 4) |
+                (oh.version << 1) |
+                oh.type;
+
+        dest[0] = v;
+        dest[1] = v >> 8;
+        dest[2] = v >> 16;
+    }
+
+    *size = VP8_HEADER_SIZE + extra_bytes_packed + cpi->bc.pos;
+
     if (pc->multi_token_partition != ONE_PARTITION)
     {
         int num_part;
@@ -1643,9 +1659,7 @@
 
         pack_tokens_into_partitions(cpi, cx_data + bc->pos, num_part, &asize);
 
-        oh.first_partition_length_in_bytes = cpi->bc.pos;
-
-        *size = cpi->bc.pos + VP8_HEADER_SIZE + asize + extra_bytes_packed;
+        *size += asize;
     }
     else
     {
@@ -1659,19 +1673,8 @@
             pack_tokens(&cpi->bc2, cpi->tok, cpi->tok_count);
 
         vp8_stop_encode(&cpi->bc2);
-        oh.first_partition_length_in_bytes = cpi->bc.pos ;
-        *size = cpi->bc2.pos + cpi->bc.pos + VP8_HEADER_SIZE + extra_bytes_packed;
-    }
 
-    {
-        int v = (oh.first_partition_length_in_bytes << 5) |
-                (oh.show_frame << 4) |
-                (oh.version << 1) |
-                oh.type;
-
-        dest[0] = v;
-        dest[1] = v >> 8;
-        dest[2] = v >> 16;
+        *size += cpi->bc2.pos;
     }
 }
 
--