Fix render size with !CONFIG_FRAME_SUPERRES If CONFIG_FRAME_SUPERRES is disabled, and we don't explicitly signal a render size for a frame, then the render size would be set to the crop size of the *previous* frame (or 0 for the first frame in a video). Return to using the VP9 behaviour in this case (albeit coded slightly differently to help support superres) - ie, use the crop size of the current frame if an explicit render size is not provided. We do this by moving the calls to resize_context_buffers() (which sets up cm->width and cm->height) before the calls to setup_render_size (which might use those values). Because resize_context_buffers() does not read any data, the bitstream format should not be affected, aside from the intended bugfix. BUG=aomedia:1044 Change-Id: I4fc71b9aea36cc06e10408715c205d9674f87fc2
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index d2e9eac..650a053 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -1473,8 +1473,8 @@ #if CONFIG_FRAME_SUPERRES setup_superres(cm, rb, &width, &height); #endif // CONFIG_FRAME_SUPERRES - setup_render_size(cm, rb); resize_context_buffers(cm, width, height); + setup_render_size(cm, rb); lock_buffer_pool(pool); if (aom_realloc_frame_buffer( @@ -1540,6 +1540,7 @@ #if CONFIG_FRAME_SUPERRES setup_superres(cm, rb, &width, &height); #endif // CONFIG_FRAME_SUPERRES + resize_context_buffers(cm, width, height); found = 1; break; } @@ -1556,6 +1557,7 @@ #if CONFIG_FRAME_SUPERRES setup_superres(cm, rb, &width, &height); #endif // CONFIG_FRAME_SUPERRES + resize_context_buffers(cm, width, height); setup_render_size(cm, rb); } @@ -1584,8 +1586,6 @@ "Referenced frame has incompatible color format"); } - resize_context_buffers(cm, width, height); - lock_buffer_pool(pool); if (aom_realloc_frame_buffer( get_frame_new_buffer(cm), cm->width, cm->height, cm->subsampling_x,