improve integer version of filter
the lookup table is based on floating point calculations (see source) by moving the *3 before the downshift and adding the rounding bit, the delta (LUT - integer) goes from: ______________________________________ __ 1__ 1______________________________ __ 1__ 1______________________________ ____ 1______ 1________________________ ____ 1 2__ 2 1________________________ ______ 1 1 2__ 2__ 2__ 2 1 1__________ ________ 1 1 2 2__ 1 2 3 1 2__ 2__ 2__ to: __-1__-1______________________________ ______________________________________ ____-1______-1________________________ ______________________________________ ________-1______________-1____________ ______________________________________ it's important to be able to use the integer version because the LUT more or less precludes SIMD optimizations Change-Id: I45a81127dc7b72a06fba951649135d9d918386c0
This commit is contained in:
parent
4b6219cb33
commit
20b855c33e
@ -36,11 +36,18 @@
|
|||||||
|
|
||||||
#define ALT_REF_MC_ENABLED 1 // dis/enable MC in AltRef filtering
|
#define ALT_REF_MC_ENABLED 1 // dis/enable MC in AltRef filtering
|
||||||
#define ALT_REF_SUBPEL_ENABLED 1 // dis/enable subpel in MC AltRef filtering
|
#define ALT_REF_SUBPEL_ENABLED 1 // dis/enable subpel in MC AltRef filtering
|
||||||
|
#define USE_FILTER_LUT 0 // use lookup table to improve filter
|
||||||
|
|
||||||
#define USE_FILTER_LUT 1
|
|
||||||
#if VP8_TEMPORAL_ALT_REF
|
#if VP8_TEMPORAL_ALT_REF
|
||||||
|
|
||||||
#if USE_FILTER_LUT
|
#if USE_FILTER_LUT
|
||||||
|
// for (strength = 0; strength <= 6; strength++) {
|
||||||
|
// for (delta = 0; delta <= 18; delta++) {
|
||||||
|
// float coeff = (3.0 * delta * delta) / pow(2, strength);
|
||||||
|
// printf("%3d", (int)roundf(coeff > 16 ? 0 : 16-coeff));
|
||||||
|
// }
|
||||||
|
// printf("\n");
|
||||||
|
// }
|
||||||
static int modifier_lut[7][19] =
|
static int modifier_lut[7][19] =
|
||||||
{
|
{
|
||||||
// Strength=0
|
// Strength=0
|
||||||
@ -140,16 +147,14 @@ void vp8_temporal_filter_apply_c
|
|||||||
int pixel_value = *frame2++;
|
int pixel_value = *frame2++;
|
||||||
|
|
||||||
#if USE_FILTER_LUT
|
#if USE_FILTER_LUT
|
||||||
// LUT implementation --
|
|
||||||
// improves precision of filter
|
|
||||||
modifier = abs(src_byte-pixel_value);
|
modifier = abs(src_byte-pixel_value);
|
||||||
modifier = modifier>18 ? 0 : lut[modifier];
|
modifier = modifier>18 ? 0 : lut[modifier];
|
||||||
#else
|
#else
|
||||||
modifier = src_byte;
|
modifier = src_byte - pixel_value;
|
||||||
modifier -= pixel_value;
|
|
||||||
modifier *= modifier;
|
modifier *= modifier;
|
||||||
modifier >>= strength;
|
|
||||||
modifier *= 3;
|
modifier *= 3;
|
||||||
|
modifier += 1 << (strength - 1);
|
||||||
|
modifier >>= strength;
|
||||||
|
|
||||||
if (modifier > 16)
|
if (modifier > 16)
|
||||||
modifier = 16;
|
modifier = 16;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user