From 892313941428c5e208973dd52bad8ed5c58d7e04 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Sun, 3 Apr 2016 23:57:20 -0700 Subject: [PATCH] VP8GetHeaders(): initialize VP8Io with sane value for crop/scale dimensions so we can use crop_width/height elsewhere, instead of testing use_cropping Change-Id: I41705db9f6889b036ecc167d73d1a1536dc33552 --- src/dec/vp8.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dec/vp8.c b/src/dec/vp8.c index d89eb1c5..214b8273 100644 --- a/src/dec/vp8.c +++ b/src/dec/vp8.c @@ -303,15 +303,22 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) { dec->mb_w_ = (pic_hdr->width_ + 15) >> 4; dec->mb_h_ = (pic_hdr->height_ + 15) >> 4; + // Setup default output area (can be later modified during io->setup()) io->width = pic_hdr->width_; io->height = pic_hdr->height_; - io->use_scaling = 0; + // IMPORTANT! use some sane dimensions in crop_* and scaled_* fields. + // So they can be used interchangeably without always testing for + // 'use_cropping'. io->use_cropping = 0; io->crop_top = 0; io->crop_left = 0; io->crop_right = io->width; io->crop_bottom = io->height; + io->use_scaling = 0; + io->scaled_width = io->width; + io->scaled_height = io->height; + io->mb_w = io->width; // sanity check io->mb_h = io->height; // ditto