Commit bc75305a authored by Steinar Midtskogen's avatar Steinar Midtskogen

Use alternate CDEF weights also for high bitdepths as for 8 bits

Change-Id: Ie1751b111ce8b21424e5e7b8c7407163d4c81b99
parent 830d2ac9
......@@ -486,7 +486,7 @@ if (aom_config("CONFIG_CDEF") eq "yes") {
add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
} else {
add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max";
add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max, int coeff_shift";
}
add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
......
......@@ -137,18 +137,18 @@ const int cdef_sec_taps[2][2] = { { 2, 1 }, { 2, 1 } };
void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
const uint16_t *in, int pri_strength, int sec_strength,
int dir, int pri_damping, int sec_damping, int bsize,
AOM_UNUSED int max_unused)
AOM_UNUSED int max_unused, int coeff_shift)
#else
void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
const uint16_t *in, int pri_strength, int sec_strength,
int dir, int pri_damping, int sec_damping, int bsize,
int max)
int max, int coeff_shift)
#endif
{
int i, j, k;
const int s = CDEF_BSTRIDE;
const int *pri_taps = cdef_pri_taps[pri_strength & 1];
const int *sec_taps = cdef_sec_taps[pri_strength & 1];
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
const int *sec_taps = cdef_sec_taps[(pri_strength >> coeff_shift) & 1];
for (i = 0; i < 4 << (bsize == BLOCK_8X8); i++) {
for (j = 0; j < 4 << (bsize == BLOCK_8X8); j++) {
int16_t sum = 0;
......@@ -566,11 +566,12 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
by = dlist[bi].by;
bx = dlist[bi].bx;
if (dst8)
cdef_filter_block(
&dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL, dstride,
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
(pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0,
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1);
cdef_filter_block(&dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL,
dstride,
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
(pli ? t : adjust_strength(t, var[by][bx])), s,
t ? dir[by][bx] : 0, pri_damping, sec_damping, bsize,
(256 << coeff_shift) - 1, coeff_shift);
else
cdef_filter_block(
NULL,
......@@ -579,7 +580,8 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
dirinit ? 1 << bsizex : dstride,
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
(pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0,
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1);
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1,
coeff_shift);
}
#endif
}
......@@ -61,7 +61,8 @@ typedef void (*cdef_filter_block_func)(uint8_t *dst8, uint16_t *dst16,
int dstride, const uint16_t *in,
int pri_strength, int sec_strength,
int dir, int pri_damping,
int sec_damping, int bsize, int max);
int sec_damping, int bsize, int max,
int coeff_shift);
void copy_cdef_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
cdef_list *dlist, int cdef_count, int bsize);
#else
......
......@@ -241,13 +241,14 @@ void SIMD_FUNC(cdef_filter_block_4x4_8)(uint8_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused)
AOM_UNUSED int max_unused,
int coeff_shift)
#else
void SIMD_FUNC(cdef_filter_block_4x4_8)(uint8_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
int max)
int max, int coeff_shift)
#endif
{
v128 p0, p1, p2, p3;
......@@ -265,8 +266,8 @@ void SIMD_FUNC(cdef_filter_block_4x4_8)(uint8_t *dst, int dstride,
int s2o1 = cdef_directions[(dir + 6) & 7][0];
int s2o2 = cdef_directions[(dir + 6) & 7][1];
const int *pri_taps = cdef_pri_taps[pri_strength & 1];
const int *sec_taps = cdef_sec_taps[pri_strength & 1];
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
const int *sec_taps = cdef_sec_taps[(pri_strength >> coeff_shift) & 1];
if (pri_strength)
pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength));
......@@ -478,13 +479,14 @@ void SIMD_FUNC(cdef_filter_block_8x8_8)(uint8_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused)
AOM_UNUSED int max_unused,
int coeff_shift)
#else
void SIMD_FUNC(cdef_filter_block_8x8_8)(uint8_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
int max)
int max, int coeff_shift)
#endif
{
int i;
......@@ -503,8 +505,8 @@ void SIMD_FUNC(cdef_filter_block_8x8_8)(uint8_t *dst, int dstride,
int s2o1 = cdef_directions[(dir + 6) & 7][0];
int s2o2 = cdef_directions[(dir + 6) & 7][1];
const int *pri_taps = cdef_pri_taps[pri_strength & 1];
const int *sec_taps = cdef_sec_taps[pri_strength & 1];
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
const int *sec_taps = cdef_sec_taps[(pri_strength >> coeff_shift) & 1];
if (pri_strength)
pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength));
......@@ -694,13 +696,14 @@ void SIMD_FUNC(cdef_filter_block_4x4_16)(uint16_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused)
AOM_UNUSED int max_unused,
int coeff_shift)
#else
void SIMD_FUNC(cdef_filter_block_4x4_16)(uint16_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
int max)
int max, int coeff_shift)
#endif
{
int i;
......@@ -718,8 +721,8 @@ void SIMD_FUNC(cdef_filter_block_4x4_16)(uint16_t *dst, int dstride,
int s2o1 = cdef_directions[(dir + 6) & 7][0];
int s2o2 = cdef_directions[(dir + 6) & 7][1];
const int *pri_taps = cdef_pri_taps[pri_strength & 1];
const int *sec_taps = cdef_sec_taps[pri_strength & 1];
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
const int *sec_taps = cdef_sec_taps[(pri_strength >> coeff_shift) & 1];
if (pri_strength)
pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength));
......@@ -867,13 +870,14 @@ void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused)
AOM_UNUSED int max_unused,
int coeff_shift)
#else
void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
int max)
int max, int coeff_shift)
#endif
{
int i;
......@@ -891,8 +895,8 @@ void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride,
int s2o1 = cdef_directions[(dir + 6) & 7][0];
int s2o2 = cdef_directions[(dir + 6) & 7][1];
const int *pri_taps = cdef_pri_taps[pri_strength & 1];
const int *sec_taps = cdef_sec_taps[pri_strength & 1];
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
const int *sec_taps = cdef_sec_taps[(pri_strength >> coeff_shift) & 1];
if (pri_strength)
pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength));
......@@ -1023,17 +1027,18 @@ void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride,
void SIMD_FUNC(cdef_filter_block)(uint8_t *dst8, uint16_t *dst16, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir, int pri_damping,
int sec_damping, int bsize, int max) {
int sec_damping, int bsize, int max,
int coeff_shift) {
if (dst8)
(bsize == BLOCK_8X8 ? SIMD_FUNC(cdef_filter_block_8x8_8)
: SIMD_FUNC(cdef_filter_block_4x4_8))(
dst8, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max);
sec_damping, max, coeff_shift);
else
(bsize == BLOCK_8X8 ? SIMD_FUNC(cdef_filter_block_8x8_16)
: SIMD_FUNC(cdef_filter_block_4x4_16))(
dst16, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max);
sec_damping, max, coeff_shift);
}
#else
......
......@@ -115,15 +115,15 @@ void test_cdef(int bsize, int iterations, cdef_filter_block_func cdef,
ref_cdef(depth == 8 ? (uint8_t *)ref_d : 0, ref_d, size,
s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE,
pristrength, secstrength, dir, pridamping,
secdamping, bsize, (1 << depth) - 1);
secdamping, bsize, (1 << depth) - 1, depth - 8);
// If cdef and ref_cdef are the same, we're just testing
// speed
if (cdef != ref_cdef)
ASM_REGISTER_STATE_CHECK(
cdef(depth == 8 ? (uint8_t *)d : 0, d, size,
s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE,
pristrength, secstrength, dir, pridamping,
secdamping, bsize, (1 << depth) - 1));
ASM_REGISTER_STATE_CHECK(cdef(
depth == 8 ? (uint8_t *)d : 0, d, size,
s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE,
pristrength, secstrength, dir, pridamping,
secdamping, bsize, (1 << depth) - 1, depth - 8));
if (ref_cdef != cdef) {
for (pos = 0; pos < max_pos && !error; pos++) {
error = ref_d[pos] != d[pos];
......
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