Commit 7b069a57 authored by Steinar Midtskogen's avatar Steinar Midtskogen

CDEF: Optionally filter 8x8 skip blocks

Optionaly filter 8x8 skip blocks, but still leave superblocks that are
completely skipped unchanged.  Use one bit in the dering level to
signal replacing the signal for dering damping.

This works better with cb4x4 that now is enabled by default.

Low latency, used-cpu=4 change:
   PSNR|PSNR Cb|PSNR Cr|PSNR HVS|   SSIM|MS SSIM|CIEDE 2000
-0.6260|-0.3263|-0.3797| -0.3574|-0.7072|-0.4828|   -0.6584

Change-Id: I42c4290b52a50779770884fbabb020fdb1034ff7
parent 1b2b739b
......@@ -75,20 +75,22 @@ int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
const int c_step = mi_size_wide[BLOCK_8X8];
const int r_shift = (r_step == 2);
const int c_shift = (c_step == 2);
int all_skip = 1;
assert(r_step == 1 || r_step == 2);
assert(c_step == 1 || c_step == 2);
for (r = 0; r < maxr; r += r_step) {
for (c = 0; c < maxc; c += c_step) {
if (!is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride)) {
dlist[count].by = r >> r_shift;
dlist[count].bx = c >> c_shift;
count++;
}
dlist[count].by = r >> r_shift;
dlist[count].bx = c >> c_shift;
dlist[count].skip =
is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride);
all_skip &= dlist[count].skip;
count++;
}
}
return count;
return all_skip ? 0 : count;
}
void copy_rect8_8bit_to_16bit_c(uint16_t *dst, int dstride, const uint8_t *src,
......
......@@ -320,10 +320,11 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
int bsize, bsizex, bsizey;
int threshold = (level >> 1) << coeff_shift;
int dering_damping = 4 + !pli + (level & 1) + coeff_shift;
int dering_damping = 5 + !pli + coeff_shift;
int filter_skip = level & 1;
if (level == 1) {
threshold = 1 << coeff_shift;
dering_damping = 3 + !pli + coeff_shift;
filter_skip = 0;
threshold = 31 << coeff_shift;
}
od_filter_dering_direction_func filter_dering_direction[] = {
......@@ -354,13 +355,14 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
if (threshold != 0) {
assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4);
for (bi = 0; bi < dering_count; bi++) {
int t = !filter_skip && dlist[bi].skip ? 0 : threshold;
by = dlist[bi].by;
bx = dlist[bi].bx;
(filter_dering_direction[bsize == BLOCK_8X8])(
&y[bi << (bsizex + bsizey)], 1 << bsizex,
&in[(by * OD_FILT_BSTRIDE << bsizey) + (bx << bsizex)],
pli ? threshold : od_adjust_thresh(threshold, var[by][bx]),
dir[by][bx], dering_damping);
pli ? t : od_adjust_thresh(t, var[by][bx]), dir[by][bx],
dering_damping);
}
}
}
......@@ -375,6 +377,7 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
int py = by << bsizey;
int px = bx << bsizex;
if (!filter_skip && dlist[bi].skip) continue;
if (!dst || hbd) {
// 16 bit destination if high bitdepth or 8 bit destination not given
(!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block_hbd
......
......@@ -30,8 +30,9 @@
extern const int OD_DIRECTION_OFFSETS_TABLE[8][3];
typedef struct {
unsigned char by;
unsigned char bx;
uint8_t by;
uint8_t bx;
uint8_t skip;
} dering_list;
typedef void (*od_filter_dering_direction_func)(uint16_t *y, int ystride,
......
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