From b6a3062d8181c48b8056458f12950bb6fd08628f Mon Sep 17 00:00:00 2001 From: John Koleszar <jkoleszar@google.com> Date: Thu, 28 Feb 2013 10:52:04 -0800 Subject: [PATCH] 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 --- vp9/encoder/vp9_onyx_if.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index ab3d19936e..b9d3049f27 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -2598,7 +2598,7 @@ static void scale_references(VP9_COMP *cpi) { 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 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, 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 { -- GitLab