aom: Pass the aligned width/height in av1_lookahead_push

From 8a3dfd53958db24f0e29ed43275fe3379acd164e Mon Sep 17 00:00:00 2001
From: Marco Paniconi <[EMAIL REDACTED]>
Date: Thu, 25 Jan 2024 22:04:02 +0000
Subject: [PATCH] Pass the aligned width/height in av1_lookahead_push

Also use the crop_width/height for the setting of
larger_dimensions.

Change-Id: I0382257b5ff51f1d8da99057140486532f66ee1c
---
 av1/encoder/lookahead.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/av1/encoder/lookahead.c b/av1/encoder/lookahead.c
index 9ef9b88675..ed86a3d5e7 100644
--- a/av1/encoder/lookahead.c
+++ b/av1/encoder/lookahead.c
@@ -124,9 +124,9 @@ int av1_lookahead_push(struct lookahead_ctx *ctx, const YV12_BUFFER_CONFIG *src,
                    height != buf->img.y_crop_height ||
                    uv_width != buf->img.uv_crop_width ||
                    uv_height != buf->img.uv_crop_height;
-  larger_dimensions = width > buf->img.y_width || height > buf->img.y_height ||
-                      uv_width > buf->img.uv_width ||
-                      uv_height > buf->img.uv_height;
+  larger_dimensions =
+      width > buf->img.y_crop_width || height > buf->img.y_crop_height ||
+      uv_width > buf->img.uv_crop_width || uv_height > buf->img.uv_crop_height;
   assert(!larger_dimensions || new_dimensions);
 
   if (larger_dimensions) {
@@ -139,6 +139,10 @@ int av1_lookahead_push(struct lookahead_ctx *ctx, const YV12_BUFFER_CONFIG *src,
     aom_free_frame_buffer(&buf->img);
     buf->img = new_img;
   } else if (new_dimensions) {
+    buf->img.y_width = src->y_width;
+    buf->img.y_height = src->y_height;
+    buf->img.uv_width = src->uv_width;
+    buf->img.uv_height = src->uv_height;
     buf->img.y_crop_width = src->y_crop_width;
     buf->img.y_crop_height = src->y_crop_height;
     buf->img.uv_crop_width = src->uv_crop_width;