From: Jean-Marc Valin Date: Tue, 18 Oct 2016 21:39:03 +0000 (-0400) Subject: Deringing support for 4:2:2 by not deringing chroma X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c67b895fa4a0dcb5c897a44fcc57c79153975879;p=libvpx Deringing support for 4:2:2 by not deringing chroma No change in output for 4:2:0 and 4:4:4 Change-Id: Ic46753d23a5b5f90b611a3da1a4574870519957c --- diff --git a/av1/common/dering.c b/av1/common/dering.c index fd5167af8..451903161 100644 --- a/av1/common/dering.c +++ b/av1/common/dering.c @@ -60,18 +60,24 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, int dec_y[3]; int pli; int coeff_shift = AOMMAX(cm->bit_depth - 8, 0); + int nplanes; + if (xd->plane[1].subsampling_x == xd->plane[1].subsampling_y && + xd->plane[2].subsampling_x == xd->plane[2].subsampling_y) + nplanes = 3; + else + nplanes = 1; nvsb = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE; nhsb = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE; bskip = aom_malloc(sizeof(*bskip) * cm->mi_rows * cm->mi_cols); av1_setup_dst_planes(xd->plane, frame, 0, 0); - for (pli = 0; pli < 3; pli++) { + for (pli = 0; pli < nplanes; pli++) { dec_x[pli] = xd->plane[pli].subsampling_x; dec_y[pli] = xd->plane[pli].subsampling_y; bsize_x[pli] = 8 >> dec_x[pli]; bsize_y[pli] = 8 >> dec_y[pli]; } stride = bsize_x[0] * cm->mi_cols; - for (pli = 0; pli < 3; pli++) { + for (pli = 0; pli < nplanes; pli++) { src[pli] = aom_malloc(sizeof(*src) * cm->mi_rows * cm->mi_cols * 64); for (r = 0; r < bsize_y[pli] * cm->mi_rows; ++r) { for (c = 0; c < bsize_x[pli] * cm->mi_cols; ++c) { @@ -108,7 +114,7 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ->mbmi.dering_gain); if (level == 0 || sb_all_skip(cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE)) continue; - for (pli = 0; pli < 3; pli++) { + for (pli = 0; pli < nplanes; pli++) { int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8]; int threshold; /* FIXME: This is a temporary hack that uses more conservative @@ -149,7 +155,7 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, } } } - for (pli = 0; pli < 3; pli++) { + for (pli = 0; pli < nplanes; pli++) { aom_free(src[pli]); } aom_free(bskip);