Convert input to mono when producing mono output
When generating a monochrome encoded stream, convert the input image to
monochrome so that internally the encoder always gets NULL U, V planes.
This makes it easier to reproduce bugs involving monochrome input
images.
BUG=aomedia:2722
Change-Id: Icaf865f13e48baa675a36c6320de7417c00617c5
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index f84a64f..294ce92 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -2157,6 +2157,14 @@
YV12_BUFFER_CONFIG sd;
int use_highbitdepth, subsampling_x, subsampling_y;
res = image2yuvconfig(img, &sd);
+ // When generating a monochrome stream, make |sd| a monochrome image.
+ if (ctx->cfg.monochrome) {
+ sd.u_buffer = sd.v_buffer = NULL;
+ sd.uv_stride = 0;
+ sd.uv_width = sd.uv_height = sd.uv_crop_width = sd.uv_crop_height = 0;
+ sd.subsampling_x = sd.subsampling_y = 1;
+ sd.monochrome = 1;
+ }
use_highbitdepth = (sd.flags & YV12_FLAG_HIGHBITDEPTH) != 0;
subsampling_x = sd.subsampling_x;
subsampling_y = sd.subsampling_y;