Y4M input support for 4:2:2, 4:4:4, 4:4:4:4
Adds a new experiment CONFIG_NON420 that allows other chroma subsamplings
to be passed to the codec. This commit allows the data to be passed from
a y4m input file through vpxenc to the codec, where they're currently
rejected. Later commits will finish support for this inside the codec.
Change-Id: Ib3aac604d8cad9e24cef395fa1067f16ba7e8e43
diff --git a/vpxenc.c b/vpxenc.c
index 95c6cf2..33a56a4 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -326,6 +326,7 @@
unsigned int h;
struct vpx_rational framerate;
int use_i420;
+ int only_i420;
};
@@ -1793,7 +1794,8 @@
if (input->detect.buf_read == 4
&& file_is_y4m(input->file, &input->y4m, input->detect.buf)) {
- if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4) >= 0) {
+ if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4,
+ input->only_i420) >= 0) {
input->file_type = FILE_TYPE_Y4M;
input->w = input->y4m.pic_w;
input->h = input->y4m.pic_h;
@@ -2517,6 +2519,7 @@
input.framerate.num = 30;
input.framerate.den = 1;
input.use_i420 = 1;
+ input.only_i420 = 1;
/* First parse the global configuration values, because we want to apply
* other parameters on top of the default configuration provided by the
@@ -2551,6 +2554,12 @@
if (!input.fn)
usage_exit();
+#if CONFIG_NON420
+ /* Decide if other chroma subsamplings than 4:2:0 are supported */
+ if (global.codec->fourcc == VP9_FOURCC)
+ input.only_i420 = 0;
+#endif
+
for (pass = global.pass ? global.pass - 1 : 0; pass < global.passes; pass++) {
int frames_in = 0, seen_frames = 0;
int64_t estimated_time_left = -1;