diff options
author | Adrian Grange <agrange@google.com> | 2014-08-21 08:15:23 -0700 |
---|---|---|
committer | Adrian Grange <agrange@google.com> | 2014-08-21 08:15:23 -0700 |
commit | 7b2177ce9ca1c82d992decd75ca6de878ecc785f (patch) | |
tree | 5aacb8d837ddd958c59ebd03908c7ddf44b72426 /vp9/decoder/vp9_decodeframe.c | |
parent | c6e9eb69352e43d8241cdbde212a6280065aa891 (diff) | |
download | libvpx-7b2177ce9ca1c82d992decd75ca6de878ecc785f.tar libvpx-7b2177ce9ca1c82d992decd75ca6de878ecc785f.tar.gz libvpx-7b2177ce9ca1c82d992decd75ca6de878ecc785f.tar.bz2 libvpx-7b2177ce9ca1c82d992decd75ca6de878ecc785f.zip |
Fix bug 837 (Part 2): Handle increase in frame width
The case where frame width increases but the overall memory
size required to hold the mi arrays does not was not
handled.
Change-Id: I72e70b912a7d1766687ad682979f1c9ee124449b
Diffstat (limited to 'vp9/decoder/vp9_decodeframe.c')
-rw-r--r-- | vp9/decoder/vp9_decodeframe.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index a0fff458c..572ab0efc 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -627,11 +627,12 @@ static void resize_context_buffers(VP9_COMMON *cm, int width, int height) { "Width and height beyond allowed size."); #endif if (cm->width != width || cm->height != height) { - const int new_rows = ALIGN_POWER_OF_TWO(height, - MI_SIZE_LOG2) >> MI_SIZE_LOG2; - const int new_cols = ALIGN_POWER_OF_TWO(width, - MI_SIZE_LOG2) >> MI_SIZE_LOG2; - if (calc_mi_size(new_rows) * calc_mi_size(new_cols) > cm->mi_alloc_size) { + const int new_mi_rows = + calc_mi_size(ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2) >> MI_SIZE_LOG2); + const int new_mi_cols = + calc_mi_size(ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2) >> MI_SIZE_LOG2); + if (new_mi_cols > cm->mi_stride || + (new_mi_rows * new_mi_cols > cm->mi_alloc_size)) { if (vp9_alloc_context_buffers(cm, width, height)) vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, "Failed to allocate context buffers"); |