shithub: libvpx

Download patch

ref: d79ef289f185b27e30b40a8f72a1331e99d1b8bf
parent: e5f2e06a20a9c9040ca1ae080ade70d88c93e3f6
author: Johann <johannkoenig@google.com>
date: Wed May 1 08:10:53 EDT 2019

vp8: quiet conversion warnings when packing bits

Mask the values to show that we only want to store 1 byte. Switch
to lowercase ff since it's more prevalent in the file.

BUG=webm:1615

Change-Id: Ia8ede79cb3a4a39c868198ae207d606e30cfb1cb

--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -1050,11 +1050,11 @@
      * 16 bits      :     (2 bits Vertical Scale << 14) | Height (14 bits)
      */
     v = (pc->horiz_scale << 14) | pc->Width;
-    cx_data[3] = v & 0xFF;
+    cx_data[3] = v & 0xff;
     cx_data[4] = v >> 8;
 
     v = (pc->vert_scale << 14) | pc->Height;
-    cx_data[5] = v & 0xFF;
+    cx_data[5] = v & 0xff;
     cx_data[6] = v >> 8;
 
     extra_bytes_packed = 7;
@@ -1268,11 +1268,30 @@
 
   /* update frame tag */
   {
+    /* Pack partition size, show frame, version and frame type into to 24 bits.
+     * Store it 8 bits at a time.
+     * https://tools.ietf.org/html/rfc6386
+     * 9.1. Uncompressed Data Chunk
+     *    The uncompressed data chunk comprises a common (for key frames and
+     *    interframes) 3-byte frame tag that contains four fields, as follows:
+     *
+     *    1.  A 1-bit frame type (0 for key frames, 1 for interframes).
+     *
+     *    2.  A 3-bit version number (0 - 3 are defined as four different
+     *        profiles with different decoding complexity; other values may be
+     *        defined for future variants of the VP8 data format).
+     *
+     *    3.  A 1-bit show_frame flag (0 when current frame is not for display,
+     *        1 when current frame is for display).
+     *
+     *    4.  A 19-bit field containing the size of the first data partition in
+     *        bytes
+     */
     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[0] = v & 0xff;
+    dest[1] = (v >> 8) & 0xff;
     dest[2] = v >> 16;
   }