]> granicus.if.org Git - libvpx/commitdiff
vp8: quiet conversion warning when packing sizes
authorJohann <johannkoenig@google.com>
Mon, 29 Apr 2019 23:07:02 +0000 (16:07 -0700)
committerJohann <johannkoenig@google.com>
Mon, 29 Apr 2019 23:15:50 +0000 (16:15 -0700)
The values are or'd together and then stored 8 bits at a time:
9.1. Uncompressed Data Chunk
* 16 bits: (2 bits Horizontal Scale << 14) | Width (14 bits)
* 16 bits: (2 bits Vertical Scale << 14) | Height (14 bits)

BUG=webm:1615

Change-Id: Id2eb3deaccec299a0619990d3a6f1eb4f71e50e2

vp8/encoder/bitstream.c

index 8dd042775563922d2af9d1f1e539c8d4ffe9ac36..c28e93c28a3515073314a37b9324440d0e3c0fc8 100644 (file)
@@ -1043,12 +1043,18 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest,
     cx_data[1] = 0x01;
     cx_data[2] = 0x2a;
 
+    /* Pack scale and frame size into 16 bits. Store it 8 bits at a time.
+     * https://tools.ietf.org/html/rfc6386
+     * 9.1. Uncompressed Data Chunk
+     * 16 bits      :     (2 bits Horizontal Scale << 14) | Width (14 bits)
+     * 16 bits      :     (2 bits Vertical Scale << 14) | Height (14 bits)
+     */
     v = (pc->horiz_scale << 14) | pc->Width;
-    cx_data[3] = v;
+    cx_data[3] = v & 0xFF;
     cx_data[4] = v >> 8;
 
     v = (pc->vert_scale << 14) | pc->Height;
-    cx_data[5] = v;
+    cx_data[5] = v & 0xFF;
     cx_data[6] = v >> 8;
 
     extra_bytes_packed = 7;