shithub: libvpx

Download patch

ref: b6a3062d8181c48b8056458f12950bb6fd08628f
parent: 714aa9f3c072624186df161589bacbb778369312
author: John Koleszar <jkoleszar@google.com>
date: Thu Feb 28 05:52:04 EST 2013

Fix incorrect comparison of frame size

The width and height stored in the reference frames are padded out to
a multiple of 16. The Width and Height variables in common are the
displayed size, which may be smaller. The incorrect comparison was
causing scaling related code to be called when it shouldn't have
been. A notable case where this happens is 1080p, since 1088 != 1080.

Change-Id: I55f743eeeeaefbf2e777e193bc9a77ff726e16b5

--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2598,7 +2598,7 @@
   for (i = 0; i < 3; i++) {
     YV12_BUFFER_CONFIG *ref = &cm->yv12_fb[cm->ref_frame_map[i]];
 
-    if (ref->y_width != cm->Width || ref->y_height != cm->Height) {
+    if (ref->y_width != cm->mb_cols * 16 || ref->y_height != cm->mb_rows * 16) {
       int new_fb = get_free_fb(cm);
 
       vp8_yv12_realloc_frame_buffer(&cm->yv12_fb[new_fb],
@@ -2672,8 +2672,8 @@
   int64_t mcomp_filter_cost[4];
 
   /* Scale the source buffer, if required */
-  if (cm->Width != cpi->un_scaled_source->y_width ||
-      cm->Height != cpi->un_scaled_source->y_height) {
+  if (cm->mb_cols * 16 != cpi->un_scaled_source->y_width ||
+      cm->mb_rows * 16 != cpi->un_scaled_source->y_height) {
     scale_and_extend_frame(cpi->un_scaled_source, &cpi->scaled_source);
     cpi->Source = &cpi->scaled_source;
   } else {