From 471687a9ac6f0fae7c0b1c7414332294122666fc Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Thu, 13 Oct 2016 14:14:39 -0400 Subject: [PATCH] Increase deringing horizontal padding to 4 pixels on each side This makes vectorization easier by having buffer lines be a multiple of 4. No change in output Change-Id: I7ec06e03a49554206af0a55aab03daccc411b50f --- av1/common/od_dering.c | 12 ++++++------ av1/common/od_dering.h | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/av1/common/od_dering.c b/av1/common/od_dering.c index f86335d39..3023202f6 100644 --- a/av1/common/od_dering.c +++ b/av1/common/od_dering.c @@ -113,7 +113,7 @@ int od_dir_find8_c(const od_dering_in *img, int stride, int32_t *var, #define OD_DERING_VERY_LARGE (30000) #define OD_DERING_INBUF_SIZE \ - ((OD_BSIZE_MAX + 2 * OD_FILT_BORDER) * (OD_BSIZE_MAX + 2 * OD_FILT_BORDER)) + ((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, @@ -321,15 +321,15 @@ void od_dering(int16_t *y, const od_dering_in *x, int xstride, od_filter_dering_orthogonal_4x4, od_filter_dering_orthogonal_8x8 }; bsize = 3 - xdec; - in = inbuf + OD_FILT_BORDER * OD_FILT_BSTRIDE + OD_FILT_BORDER; + 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_BORDER * (sby != 0); - i < (nvb << bsize) + OD_FILT_BORDER * (sby != nvsb - 1); i++) { - for (j = -OD_FILT_BORDER * (sbx != 0); - j < (nhb << bsize) + OD_FILT_BORDER * (sbx != nhsb - 1); j++) { + 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]; } } diff --git a/av1/common/od_dering.h b/av1/common/od_dering.h index 5ec902744..9e4e73233 100644 --- a/av1/common/od_dering.h +++ b/av1/common/od_dering.h @@ -25,8 +25,12 @@ typedef int16_t od_dering_in; #define OD_DERING_NBLOCKS (OD_BSIZE_MAX / 8) -#define OD_FILT_BORDER (3) -#define OD_FILT_BSTRIDE (OD_BSIZE_MAX + 2 * OD_FILT_BORDER) +/* We need to buffer three vertical lines. */ +#define OD_FILT_VBORDER (3) +/* We only need to buffer three horizontal lines too, but let's make it four + to make vectorization easier. */ +#define OD_FILT_HBORDER (4) +#define OD_FILT_BSTRIDE (OD_BSIZE_MAX + 2 * OD_FILT_HBORDER) extern const int OD_DIRECTION_OFFSETS_TABLE[8][3]; -- 2.49.0