summaryrefslogtreecommitdiff
path: root/vp9/decoder/vp9_decodframe.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-03-14 14:36:08 -0700
committerJohn Koleszar <jkoleszar@google.com>2013-03-18 12:02:20 -0700
commit8a3f55f2d459b1de112502d32719ffa56fe7604c (patch)
tree5c1b84bce10c6fcde2b9b643e1846f448893de99 /vp9/decoder/vp9_decodframe.c
parentc5b317057b292718afc07a842b69f5f06caadb4e (diff)
downloadlibvpx-8a3f55f2d459b1de112502d32719ffa56fe7604c.tar
libvpx-8a3f55f2d459b1de112502d32719ffa56fe7604c.tar.gz
libvpx-8a3f55f2d459b1de112502d32719ffa56fe7604c.tar.bz2
libvpx-8a3f55f2d459b1de112502d32719ffa56fe7604c.zip
Replace scaling byte with explicit display size
If the intended display size is different than the size the frame is coded at, then send that size explicitly in the bitstream. Adds a new bit to the frame header to indicate whether the extra size fields are present. Change-Id: I525c66f22d207efaf1e5f903c6a2a91b80245854
Diffstat (limited to 'vp9/decoder/vp9_decodframe.c')
-rw-r--r--vp9/decoder/vp9_decodframe.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index b53e419b5..c61c11225 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -1275,12 +1275,13 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
if (data_end - data < 3) {
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME, "Truncated packet");
} else {
+ int scaling_active;
pc->last_frame_type = pc->frame_type;
pc->frame_type = (FRAME_TYPE)(data[0] & 1);
pc->version = (data[0] >> 1) & 7;
pc->show_frame = (data[0] >> 4) & 1;
- first_partition_length_in_bytes =
- (data[0] | (data[1] << 8) | (data[2] << 16)) >> 5;
+ scaling_active = (data[0] >> 5) & 1;
+ first_partition_length_in_bytes = data[1] | (data[2] << 8);
if (!read_is_valid(data, first_partition_length_in_bytes, data_end))
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
@@ -1310,14 +1311,20 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
* if we have enough data. Otherwise we will end up with the wrong
* size.
*/
- if (data + 5 < data_end) {
- pc->Width = read_le16(data);
+ if (scaling_active && data + 4 < data_end) {
+ pc->display_width = read_le16(data + 0);
+ pc->display_height = read_le16(data + 2);
+ data += 4;
+ }
+ if (data + 4 < data_end) {
+ pc->Width = read_le16(data + 0);
pc->Height = read_le16(data + 2);
-
- pc->horiz_scale = data[4] >> 4;
- pc->vert_scale = data[4] & 0x0F;
+ data += 4;
+ }
+ if (!scaling_active) {
+ pc->display_width = pc->Width;
+ pc->display_height = pc->Height;
}
- data += 5;
if (width != pc->Width || height != pc->Height) {
if (pc->Width <= 0) {