ref: 285d1b7641df768621b57787a7ae3c20d6f6794d
parent: e0a05e5e1a73d0b2b0eb78f4a9c251ffa7331bb1
author: Luc Trudeau <ltrudeau@twoorioles.com>
date: Wed Oct 31 07:46:27 EDT 2018
Remove dav1d_sgr_one_by_x Since n equals either 25 or 9, the dav1d_sgr_one_by_x table can be replaced with a ternary operation.
--- a/src/looprestoration_tmpl.c
+++ b/src/looprestoration_tmpl.c
@@ -412,6 +412,8 @@
const ptrdiff_t src_stride, const int w,
const int h, const int n, const int s)
{
+ const int sgr_one_by_x = n == 25 ? 164 : 455;
+
// Selfguided filter is applied to a maximum stripe height of 64 + 3 pixels
// of padding above and below
int32_t A_[70 /*(64 + 3 + 3)*/ * REST_UNIT_STRIDE];
@@ -444,7 +446,7 @@
const int x = dav1d_sgr_x_by_xplus1[imin(z, 255)];
// This is where we invert A and B, so that B is of size coef.
- AA[i] = (((1 << 8) - x) * BB[i] * dav1d_sgr_one_by_x[n - 1] + (1 << 11)) >> 12;
+ AA[i] = (((1 << 8) - x) * BB[i] * sgr_one_by_x + (1 << 11)) >> 12;
BB[i] = x;
}
AA += step * REST_UNIT_STRIDE;
--- a/src/tables.c
+++ b/src/tables.c
@@ -523,11 +523,6 @@
256,
};
-const int16_t dav1d_sgr_one_by_x[25] = {
- 4096, 2048, 1365, 1024, 819, 683, 585, 512, 455, 410, 372, 341, 315,
- 293, 273, 256, 241, 228, 216, 205, 195, 186, 178, 171, 164,
-};
-
const int8_t ALIGN(dav1d_mc_subpel_filters[5][15][8], 8) = {
[FILTER_8TAP_REGULAR] = {
{ 0, 1, -3, 63, 4, -1, 0, 0 },