Duplicating deringing input superblock copy to make upcoming changes easier No change in output Change-Id: Iaa06043dcc31308c83f667424e5a83c2db50ed24
diff --git a/av1/common/dering.c b/av1/common/dering.c index 30c91e8..285cc3e 100644 --- a/av1/common/dering.c +++ b/av1/common/dering.c
@@ -175,6 +175,9 @@ for (pli = 0; pli < nplanes; pli++) { int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8]; int threshold; + int16_t inbuf[OD_DERING_INBUF_SIZE]; + int16_t *in; + int i, j; /* FIXME: This is a temporary hack that uses more conservative deringing for chroma. */ if (pli) @@ -182,10 +185,22 @@ else threshold = level << coeff_shift; if (threshold == 0) continue; - od_dering(dst, - &src[pli][(sbr * stride * MAX_MIB_SIZE << bsize[pli]) + - (sbc * MAX_MIB_SIZE << bsize[pli])], - stride, nhb, nvb, sbc, sbr, nhsb, nvsb, dec[pli], dir, pli, + in = inbuf + OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER; + /* We avoid filtering the pixels for which some of the pixels to average + are outside the frame. We could change the filter instead, but it would + add special cases for any future vectorization. */ + for (i = 0; i < OD_DERING_INBUF_SIZE; i++) inbuf[i] = OD_DERING_VERY_LARGE; + for (i = -OD_FILT_VBORDER * (sbr != 0); + i < (nvb << bsize[pli]) + OD_FILT_VBORDER * (sbr != nvsb - 1); i++) { + for (j = -OD_FILT_HBORDER * (sbc != 0); + j < (nhb << bsize[pli]) + OD_FILT_HBORDER * (sbc != nhsb - 1); j++) { + int16_t *x; + x = &src[pli][(sbr * stride * MAX_MIB_SIZE << bsize[pli]) + + (sbc * MAX_MIB_SIZE << bsize[pli])]; + in[i * OD_FILT_BSTRIDE + j] = x[i * stride + j]; + } + } + od_dering(dst, in, dec[pli], dir, pli, bskip, dering_count, threshold, coeff_shift); #if CONFIG_AOM_HIGHBITDEPTH if (cm->use_highbitdepth) {
diff --git a/av1/common/od_dering.c b/av1/common/od_dering.c index 4cc0ead..168bab1 100644 --- a/av1/common/od_dering.c +++ b/av1/common/od_dering.c
@@ -111,10 +111,6 @@ return best_dir; } -#define OD_DERING_VERY_LARGE (30000) -#define OD_DERING_INBUF_SIZE \ - ((OD_BSIZE_MAX + 2 * OD_FILT_HBORDER) * (OD_BSIZE_MAX + 2 * OD_FILT_VBORDER)) - /* Smooth in the direction detected. */ int od_filter_dering_direction_8x8_c(int16_t *y, int ystride, const int16_t *in, int threshold, int dir) { @@ -300,18 +296,13 @@ } } -void od_dering(int16_t *y, const od_dering_in *x, int xstride, - int nhb, int nvb, int sbx, int sby, int nhsb, int nvsb, int xdec, +void od_dering(int16_t *y, int16_t *in, int xdec, int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], int pli, unsigned char (*bskip)[2], int dering_count, int threshold, int coeff_shift) { - int i; - int j; int bi; int bx; int by; - int16_t inbuf[OD_DERING_INBUF_SIZE]; - int16_t *in; int bsize; int filter2_thresh[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS]; od_filter_dering_direction_func filter_dering_direction[OD_DERINGSIZES] = { @@ -321,18 +312,6 @@ od_filter_dering_orthogonal_4x4, od_filter_dering_orthogonal_8x8 }; bsize = 3 - xdec; - in = inbuf + OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER; - /* We avoid filtering the pixels for which some of the pixels to average - are outside the frame. We could change the filter instead, but it would - add special cases for any future vectorization. */ - for (i = 0; i < OD_DERING_INBUF_SIZE; i++) inbuf[i] = OD_DERING_VERY_LARGE; - for (i = -OD_FILT_VBORDER * (sby != 0); - i < (nvb << bsize) + OD_FILT_VBORDER * (sby != nvsb - 1); i++) { - for (j = -OD_FILT_HBORDER * (sbx != 0); - j < (nhb << bsize) + OD_FILT_HBORDER * (sbx != nhsb - 1); j++) { - in[i * OD_FILT_BSTRIDE + j] = x[i * xstride + j]; - } - } if (pli == 0) { for (bi = 0; bi < dering_count; bi++) { int32_t var;
diff --git a/av1/common/od_dering.h b/av1/common/od_dering.h index 9e4e732..e10871e 100644 --- a/av1/common/od_dering.h +++ b/av1/common/od_dering.h
@@ -32,6 +32,10 @@ #define OD_FILT_HBORDER (4) #define OD_FILT_BSTRIDE (OD_BSIZE_MAX + 2 * OD_FILT_HBORDER) +#define OD_DERING_VERY_LARGE (30000) +#define OD_DERING_INBUF_SIZE \ + (OD_FILT_BSTRIDE * (OD_BSIZE_MAX + 2 * OD_FILT_VBORDER)) + extern const int OD_DIRECTION_OFFSETS_TABLE[8][3]; typedef int (*od_filter_dering_direction_func)(int16_t *y, int ystride, @@ -43,8 +47,7 @@ void copy_blocks_16bit(int16_t *dst, int dstride, int16_t *src, unsigned char (*bskip)[2], int dering_count, int bsize); -void od_dering(int16_t *y, const od_dering_in *x, int xstride, - int nvb, int nhb, int sbx, int sby, int nhsb, int nvsb, int xdec, +void od_dering(int16_t *y, int16_t *in, int xdec, int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], int pli, unsigned char (*bskip)[2], int skip_stride, int threshold, int coeff_shift);
diff --git a/av1/encoder/pickdering.c b/av1/encoder/pickdering.c index 10cb8bc..0b65740 100644 --- a/av1/encoder/pickdering.c +++ b/av1/encoder/pickdering.c
@@ -107,6 +107,9 @@ for (gi = 0; gi < DERING_REFINEMENT_LEVELS; gi++) { int cur_mse; int threshold; + int16_t inbuf[OD_DERING_INBUF_SIZE]; + int16_t *in; + int i, j; level = compute_level_from_index(best_level, gi); threshold = level << coeff_shift; for (r = 0; r < nvb << bsize[0]; r++) { @@ -116,13 +119,23 @@ (sbc * MAX_MIB_SIZE << bsize[0]) + c]; } } - od_dering(tmp_dst, - &src[(sbr * stride * MAX_MIB_SIZE << bsize[0]) + - (sbc * MAX_MIB_SIZE << bsize[0])], - cm->mi_cols << bsize[0], nhb, nvb, sbc, sbr, nhsb, nvsb, 0, - dir, 0, - bskip, - dering_count, threshold, coeff_shift); + in = inbuf + OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER; + /* We avoid filtering the pixels for which some of the pixels to average + are outside the frame. We could change the filter instead, but it would + add special cases for any future vectorization. */ + for (i = 0; i < OD_DERING_INBUF_SIZE; i++) inbuf[i] = OD_DERING_VERY_LARGE; + for (i = -OD_FILT_VBORDER * (sbr != 0); + i < (nvb << bsize[0]) + OD_FILT_VBORDER * (sbr != nvsb - 1); i++) { + for (j = -OD_FILT_HBORDER * (sbc != 0); + j < (nhb << bsize[0]) + OD_FILT_HBORDER * (sbc != nhsb - 1); j++) { + int16_t *x; + x = &src[(sbr * stride * MAX_MIB_SIZE << bsize[0]) + + (sbc * MAX_MIB_SIZE << bsize[0])]; + in[i * OD_FILT_BSTRIDE + j] = x[i * stride + j]; + } + } + od_dering(tmp_dst, in, 0, dir, 0, bskip, dering_count, threshold, + coeff_shift); copy_blocks_16bit(dst, MAX_MIB_SIZE << bsize[0], tmp_dst, bskip, dering_count, 3); cur_mse = (int)compute_dist(