diff --git a/av1/common/od_dering.c b/av1/common/od_dering.c index e9a83fa5d..f54f337ef 100644 --- a/av1/common/od_dering.c +++ b/av1/common/od_dering.c @@ -176,14 +176,6 @@ void od_filter_dering_direction_4x4_c(uint16_t *y, int ystride, } } -/* This table approximates x^0.16 with the index being log2(x). It is clamped - to [-.5, 3]. The table is computed as: - round(256*min(3, max(.5, 1.08*(sqrt(2)*2.^([0:17]+8)/256/256).^.16))) */ -static const int16_t OD_THRESH_TABLE_Q8[18] = { - 128, 134, 150, 168, 188, 210, 234, 262, 292, - 327, 365, 408, 455, 509, 569, 635, 710, 768, -}; - /* Compute deringing filter threshold for an 8x8 block based on the directional variance difference. A high variance difference means that we have a highly directional pattern (e.g. a high contrast edge), so we can @@ -191,10 +183,9 @@ static const int16_t OD_THRESH_TABLE_Q8[18] = { contrast edge, or a non-directional texture, so we want to be careful not to blur. */ static INLINE int od_adjust_thresh(int threshold, int32_t var) { - int v1; + const int i = var >> 6 ? AOMMIN(get_msb(var >> 6), 12) : 0; /* We use the variance of 8x8 blocks to adjust the threshold. */ - v1 = OD_MINI(32767, var >> 6); - return (threshold * OD_THRESH_TABLE_Q8[OD_ILOG(v1)] + 128) >> 8; + return var ? (threshold * (4 + i) + 8) >> 4 : 0; } void copy_8x8_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src,