Commit d9ff1f58 authored by Jean-Marc Valin's avatar Jean-Marc Valin Committed by Jean-Marc Valin

Duplicating deringing input superblock copy to make upcoming changes easier

No change in output

Change-Id: Iaa06043dcc31308c83f667424e5a83c2db50ed24
parent 4fda1e13
......@@ -175,6 +175,9 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
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 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
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) {
......
......@@ -111,10 +111,6 @@ int od_dir_find8_c(const od_dering_in *img, int stride, int32_t *var,
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 copy_blocks_16bit(int16_t *dst, int dstride, int16_t *src,
}
}
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 @@ 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_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;
......
......@@ -32,6 +32,10 @@ typedef int16_t od_dering_in;
#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 @@ typedef void (*od_filter_dering_orthogonal_func)(int16_t *y, int ystride,
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);
......
......@@ -107,6 +107,9 @@ int av1_dering_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
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 @@ int av1_dering_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
(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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment