Avoid chroma resampling for 420mpeg2 input
BUG=aomedia:3080
Change-Id: I303ffb93474272be44c0d549730a0509fc0c31f1
(cherry picked from commit 2656f676d3fcdef83d1155cd91b1bfb7f657b486)
diff --git a/common/y4minput.c b/common/y4minput.c
index 46632bd..abd4d0b 100644
--- a/common/y4minput.c
+++ b/common/y4minput.c
@@ -307,26 +307,6 @@
}
}
-/*Handles both 422 and 420mpeg2 to 422jpeg and 420jpeg, respectively.*/
-static void y4m_convert_42xmpeg2_42xjpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- int c_w;
- int c_h;
- int c_sz;
- int pli;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- for (pli = 1; pli < 3; pli++) {
- y4m_42xmpeg2_42xjpeg_helper(_dst, _aux, c_w, c_h);
- _dst += c_sz;
- _aux += c_sz;
- }
-}
-
/*This format is only used for interlaced content, but is included for
completeness.
@@ -925,7 +905,8 @@
y4m_ctx->aux_buf = NULL;
y4m_ctx->dst_buf = NULL;
if (strcmp(y4m_ctx->chroma_type, "420") == 0 ||
- strcmp(y4m_ctx->chroma_type, "420jpeg") == 0) {
+ strcmp(y4m_ctx->chroma_type, "420jpeg") == 0 ||
+ strcmp(y4m_ctx->chroma_type, "420mpeg2") == 0) {
y4m_ctx->src_c_dec_h = y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_v =
y4m_ctx->dst_c_dec_v = 2;
y4m_ctx->dst_buf_read_sz =
@@ -970,18 +951,6 @@
fprintf(stderr, "Unsupported conversion from 420p12 to 420jpeg\n");
return -1;
}
- } else if (strcmp(y4m_ctx->chroma_type, "420mpeg2") == 0) {
- y4m_ctx->src_c_dec_h = y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_v =
- y4m_ctx->dst_c_dec_v = 2;
- y4m_ctx->dst_buf_read_sz = y4m_ctx->pic_w * y4m_ctx->pic_h;
- /*Chroma filter required: read into the aux buf first.*/
- y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz =
- 2 * ((y4m_ctx->pic_w + 1) / 2) * ((y4m_ctx->pic_h + 1) / 2);
- y4m_ctx->convert = y4m_convert_null;
- if (csp != AOM_CSP_VERTICAL) {
- y4m_ctx->convert = y4m_convert_42xmpeg2_42xjpeg;
- snprintf(y4m_ctx->chroma_type, sizeof(y4m_ctx->chroma_type), "420");
- }
} else if (strcmp(y4m_ctx->chroma_type, "420paldv") == 0) {
y4m_ctx->src_c_dec_h = y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_v =
y4m_ctx->dst_c_dec_v = 2;
diff --git a/test/y4m_test.cc b/test/y4m_test.cc
index f6f236a..d3d097b 100644
--- a/test/y4m_test.cc
+++ b/test/y4m_test.cc
@@ -40,7 +40,7 @@
{ "park_joy_90p_8_420_monochrome.y4m", 8, AOM_IMG_FMT_I420,
"95ef5bf6218580588be24a5271bb6a7f" },
{ "park_joy_90p_8_420_vertical_csp.y4m", 8, AOM_IMG_FMT_I420,
- "f53a40fec15254ac312527339d9c686b" },
+ "e5406275b9fc6bb3436c31d4a05c1cab" },
{ "park_joy_90p_8_422.y4m", 8, AOM_IMG_FMT_I422,
"284a47a47133b12884ec3a14e959a0b6" },
{ "park_joy_90p_8_444.y4m", 8, AOM_IMG_FMT_I444,