image2yuvconfig() should calculate uv_crop_width image2yuvconfig() should calculate uv_crop_width and uv_crop_height from y_crop_width and y_crop_height. Use the same formula to calculate uv_width and uv_height. BUG=aomedia:3115 Change-Id: I12d31f4fb0133e8e54809ae0c92bf07c14aa1edf (cherry picked from commit 0607f6bef891c005bbec7a6a23479e111a7048b5)
diff --git a/av1/av1_iface_common.h b/av1/av1_iface_common.h index 9b5ffcb..f5775d3 100644 --- a/av1/av1_iface_common.h +++ b/av1/av1_iface_common.h
@@ -93,12 +93,13 @@ yv12->y_width = img->w; yv12->y_height = img->h; - yv12->uv_width = - img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 : yv12->y_width; + yv12->uv_width = (yv12->y_width + img->x_chroma_shift) >> img->x_chroma_shift; yv12->uv_height = - img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 : yv12->y_height; - yv12->uv_crop_width = yv12->uv_width; - yv12->uv_crop_height = yv12->uv_height; + (yv12->y_height + img->y_chroma_shift) >> img->y_chroma_shift; + yv12->uv_crop_width = + (yv12->y_crop_width + img->x_chroma_shift) >> img->x_chroma_shift; + yv12->uv_crop_height = + (yv12->y_crop_height + img->y_chroma_shift) >> img->y_chroma_shift; yv12->y_stride = img->stride[AOM_PLANE_Y]; yv12->uv_stride = img->stride[AOM_PLANE_U];