From: Johann Date: Wed, 1 May 2019 19:10:53 +0000 (-0700) Subject: vp8: quiet conversion warnings when packing bits X-Git-Tag: v1.8.1~74^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d79ef289f185b27e30b40a8f72a1331e99d1b8bf;p=libvpx 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 --- diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index c28e93c28..64bf0a79e 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -1050,11 +1050,11 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, * 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 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, /* 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; }