Coverage Report

Created: 2026-02-14 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/aom/av1/common/cdef_block.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3
 *
4
 * This source code is subject to the terms of the BSD 2 Clause License and
5
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
 * was not distributed with this source code in the LICENSE file, you can
7
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
 * Media Patent License 1.0 was not distributed with this source code in the
9
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
 */
11
12
#include <math.h>
13
#include <stdlib.h>
14
15
#include "config/aom_dsp_rtcd.h"
16
#include "config/av1_rtcd.h"
17
18
#include "av1/common/cdef.h"
19
/*
20
This is Cdef_Directions (section 7.15.3) with 2 padding entries at the
21
beginning and end of the table. The cdef direction range is [0, 7] and the
22
first index is offset +/-2. This removes the need to constrain the first
23
index to the same range using e.g., & 7.
24
*/
25
DECLARE_ALIGNED(16, static const int, cdef_directions_padded[12][2]) = {
26
  /* Padding: cdef_directions[6] */
27
  { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0 },
28
  /* Padding: cdef_directions[7] */
29
  { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1 },
30
31
  /* Begin cdef_directions */
32
  { -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2 },
33
  { 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2 },
34
  { 0 * CDEF_BSTRIDE + 1, 0 * CDEF_BSTRIDE + 2 },
35
  { 0 * CDEF_BSTRIDE + 1, 1 * CDEF_BSTRIDE + 2 },
36
  { 1 * CDEF_BSTRIDE + 1, 2 * CDEF_BSTRIDE + 2 },
37
  { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 1 },
38
  { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0 },
39
  { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1 },
40
  /* End cdef_directions */
41
42
  /* Padding: cdef_directions[0] */
43
  { -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2 },
44
  /* Padding: cdef_directions[1] */
45
  { 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2 },
46
};
47
48
const int (*const cdef_directions)[2] = cdef_directions_padded + 2;
49
50
/* Detect direction. 0 means 45-degree up-right, 2 is horizontal, and so on.
51
   The search minimizes the weighted variance along all the lines in a
52
   particular direction, i.e. the squared error between the input and a
53
   "predicted" block where each pixel is replaced by the average along a line
54
   in a particular direction. Since each direction have the same sum(x^2) term,
55
   that term is never computed. See Section 2, step 2, of:
56
   http://jmvalin.ca/notes/intra_paint.pdf */
57
int cdef_find_dir_c(const uint16_t *img, int stride, int32_t *var,
58
492k
                    int coeff_shift) {
59
492k
  int i;
60
492k
  int32_t cost[8] = { 0 };
61
492k
  int partial[8][15] = { { 0 } };
62
492k
  int32_t best_cost = 0;
63
492k
  int best_dir = 0;
64
  /* Instead of dividing by n between 2 and 8, we multiply by 3*5*7*8/n.
65
     The output is then 840 times larger, but we don't care for finding
66
     the max. */
67
492k
  static const int div_table[] = { 0, 840, 420, 280, 210, 168, 140, 120, 105 };
68
4.07M
  for (i = 0; i < 8; i++) {
69
3.57M
    int j;
70
31.9M
    for (j = 0; j < 8; j++) {
71
28.3M
      int x;
72
      /* We subtract 128 here to reduce the maximum range of the squared
73
         partial sums. */
74
28.3M
      x = (img[i * stride + j] >> coeff_shift) - 128;
75
28.3M
      partial[0][i + j] += x;
76
28.3M
      partial[1][i + j / 2] += x;
77
28.3M
      partial[2][i] += x;
78
28.3M
      partial[3][3 + i - j / 2] += x;
79
28.3M
      partial[4][7 + i - j] += x;
80
28.3M
      partial[5][3 - i / 2 + j] += x;
81
28.3M
      partial[6][j] += x;
82
28.3M
      partial[7][i / 2 + j] += x;
83
28.3M
    }
84
3.57M
  }
85
4.48M
  for (i = 0; i < 8; i++) {
86
3.99M
    cost[2] += partial[2][i] * partial[2][i];
87
3.99M
    cost[6] += partial[6][i] * partial[6][i];
88
3.99M
  }
89
492k
  cost[2] *= div_table[8];
90
492k
  cost[6] *= div_table[8];
91
3.98M
  for (i = 0; i < 7; i++) {
92
3.49M
    cost[0] += (partial[0][i] * partial[0][i] +
93
3.49M
                partial[0][14 - i] * partial[0][14 - i]) *
94
3.49M
               div_table[i + 1];
95
3.49M
    cost[4] += (partial[4][i] * partial[4][i] +
96
3.49M
                partial[4][14 - i] * partial[4][14 - i]) *
97
3.49M
               div_table[i + 1];
98
3.49M
  }
99
492k
  cost[0] += partial[0][7] * partial[0][7] * div_table[8];
100
492k
  cost[4] += partial[4][7] * partial[4][7] * div_table[8];
101
2.49M
  for (i = 1; i < 8; i += 2) {
102
2.00M
    int j;
103
12.0M
    for (j = 0; j < 4 + 1; j++) {
104
10.0M
      cost[i] += partial[i][3 + j] * partial[i][3 + j];
105
10.0M
    }
106
2.00M
    cost[i] *= div_table[8];
107
7.94M
    for (j = 0; j < 4 - 1; j++) {
108
5.94M
      cost[i] += (partial[i][j] * partial[i][j] +
109
5.94M
                  partial[i][10 - j] * partial[i][10 - j]) *
110
5.94M
                 div_table[2 * j + 2];
111
5.94M
    }
112
2.00M
  }
113
4.42M
  for (i = 0; i < 8; i++) {
114
3.93M
    if (cost[i] > best_cost) {
115
730k
      best_cost = cost[i];
116
730k
      best_dir = i;
117
730k
    }
118
3.93M
  }
119
  /* Difference between the optimal variance and the variance along the
120
     orthogonal direction. Again, the sum(x^2) terms cancel out. */
121
492k
  *var = best_cost - cost[(best_dir + 4) & 7];
122
  /* We'd normally divide by 840, but dividing by 1024 is close enough
123
     for what we're going to do with this. */
124
492k
  *var >>= 10;
125
492k
  return best_dir;
126
492k
}
127
128
void cdef_find_dir_dual_c(const uint16_t *img1, const uint16_t *img2,
129
                          int stride, int32_t *var1, int32_t *var2,
130
248k
                          int coeff_shift, int *out1, int *out2) {
131
248k
  *out1 = cdef_find_dir_c(img1, stride, var1, coeff_shift);
132
248k
  *out2 = cdef_find_dir_c(img2, stride, var2, coeff_shift);
133
248k
}
134
135
const int cdef_pri_taps[2][2] = { { 4, 2 }, { 3, 3 } };
136
const int cdef_sec_taps[2] = { 2, 1 };
137
138
/* Smooth in the direction detected. */
139
static void cdef_filter_block_internal(
140
    uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in,
141
    int pri_strength, int sec_strength, int dir, int pri_damping,
142
    int sec_damping, int coeff_shift, int block_width, int block_height,
143
1.23M
    int enable_primary, int enable_secondary) {
144
1.23M
  const int clipping_required = (enable_primary && enable_secondary);
145
1.23M
  int i, j, k;
146
1.23M
  const int s = CDEF_BSTRIDE;
147
1.23M
  const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
148
1.23M
  const int *sec_taps = cdef_sec_taps;
149
8.32M
  for (i = 0; i < block_height; i++) {
150
38.6M
    for (j = 0; j < block_width; j++) {
151
31.5M
      int16_t sum = 0;
152
31.5M
      int16_t y;
153
31.5M
      int16_t x = in[i * s + j];
154
31.5M
      int max = x;
155
31.5M
      int min = x;
156
74.1M
      for (k = 0; k < 2; k++) {
157
42.5M
        if (enable_primary) {
158
24.7M
          int16_t p0 = in[i * s + j + cdef_directions[dir][k]];
159
24.7M
          int16_t p1 = in[i * s + j - cdef_directions[dir][k]];
160
24.7M
          sum += pri_taps[k] * constrain(p0 - x, pri_strength, pri_damping);
161
24.7M
          sum += pri_taps[k] * constrain(p1 - x, pri_strength, pri_damping);
162
24.7M
          if (clipping_required) {
163
21.7M
            if (p0 != CDEF_VERY_LARGE) max = AOMMAX(p0, max);
164
21.7M
            if (p1 != CDEF_VERY_LARGE) max = AOMMAX(p1, max);
165
21.7M
            min = AOMMIN(p0, min);
166
21.7M
            min = AOMMIN(p1, min);
167
21.7M
          }
168
24.7M
        }
169
42.5M
        if (enable_secondary) {
170
33.0M
          int16_t s0 = in[i * s + j + cdef_directions[dir + 2][k]];
171
33.0M
          int16_t s1 = in[i * s + j - cdef_directions[dir + 2][k]];
172
33.0M
          int16_t s2 = in[i * s + j + cdef_directions[dir - 2][k]];
173
33.0M
          int16_t s3 = in[i * s + j - cdef_directions[dir - 2][k]];
174
33.0M
          if (clipping_required) {
175
21.5M
            if (s0 != CDEF_VERY_LARGE) max = AOMMAX(s0, max);
176
21.5M
            if (s1 != CDEF_VERY_LARGE) max = AOMMAX(s1, max);
177
21.5M
            if (s2 != CDEF_VERY_LARGE) max = AOMMAX(s2, max);
178
21.5M
            if (s3 != CDEF_VERY_LARGE) max = AOMMAX(s3, max);
179
21.5M
            min = AOMMIN(s0, min);
180
21.5M
            min = AOMMIN(s1, min);
181
21.5M
            min = AOMMIN(s2, min);
182
21.5M
            min = AOMMIN(s3, min);
183
21.5M
          }
184
33.0M
          sum += sec_taps[k] * constrain(s0 - x, sec_strength, sec_damping);
185
33.0M
          sum += sec_taps[k] * constrain(s1 - x, sec_strength, sec_damping);
186
33.0M
          sum += sec_taps[k] * constrain(s2 - x, sec_strength, sec_damping);
187
33.0M
          sum += sec_taps[k] * constrain(s3 - x, sec_strength, sec_damping);
188
33.0M
        }
189
42.5M
      }
190
31.5M
      y = ((int16_t)x + ((8 + sum - (sum < 0)) >> 4));
191
31.5M
      if (clipping_required) {
192
16.1M
        y = clamp(y, min, max);
193
16.1M
      }
194
195
31.5M
      if (dst8)
196
14.4M
        dst8[i * dstride + j] = (uint8_t)y;
197
17.1M
      else
198
17.1M
        dst16[i * dstride + j] = (uint16_t)y;
199
31.5M
    }
200
7.09M
  }
201
1.23M
}
202
203
void cdef_filter_8_0_c(void *dst8, int dstride, const uint16_t *in,
204
                       int pri_strength, int sec_strength, int dir,
205
                       int pri_damping, int sec_damping, int coeff_shift,
206
500k
                       int block_width, int block_height) {
207
500k
  cdef_filter_block_internal((uint8_t *)dst8, NULL, dstride, in, pri_strength,
208
500k
                             sec_strength, dir, pri_damping, sec_damping,
209
500k
                             coeff_shift, block_width, block_height,
210
500k
                             /*enable_primary=*/1, /*enable_secondary=*/1);
211
500k
}
212
213
void cdef_filter_8_1_c(void *dst8, int dstride, const uint16_t *in,
214
                       int pri_strength, int sec_strength, int dir,
215
                       int pri_damping, int sec_damping, int coeff_shift,
216
66.5k
                       int block_width, int block_height) {
217
66.5k
  cdef_filter_block_internal((uint8_t *)dst8, NULL, dstride, in, pri_strength,
218
66.5k
                             sec_strength, dir, pri_damping, sec_damping,
219
66.5k
                             coeff_shift, block_width, block_height,
220
66.5k
                             /*enable_primary=*/1, /*enable_secondary=*/0);
221
66.5k
}
222
223
void cdef_filter_8_2_c(void *dst8, int dstride, const uint16_t *in,
224
                       int pri_strength, int sec_strength, int dir,
225
                       int pri_damping, int sec_damping, int coeff_shift,
226
54.9k
                       int block_width, int block_height) {
227
54.9k
  cdef_filter_block_internal((uint8_t *)dst8, NULL, dstride, in, pri_strength,
228
54.9k
                             sec_strength, dir, pri_damping, sec_damping,
229
54.9k
                             coeff_shift, block_width, block_height,
230
54.9k
                             /*enable_primary=*/0, /*enable_secondary=*/1);
231
54.9k
}
232
233
void cdef_filter_8_3_c(void *dst8, int dstride, const uint16_t *in,
234
                       int pri_strength, int sec_strength, int dir,
235
                       int pri_damping, int sec_damping, int coeff_shift,
236
77.0k
                       int block_width, int block_height) {
237
77.0k
  cdef_filter_block_internal((uint8_t *)dst8, NULL, dstride, in, pri_strength,
238
77.0k
                             sec_strength, dir, pri_damping, sec_damping,
239
77.0k
                             coeff_shift, block_width, block_height,
240
77.0k
                             /*enable_primary=*/0, /*enable_secondary=*/0);
241
77.0k
}
242
243
void cdef_filter_16_0_c(void *dst16, int dstride, const uint16_t *in,
244
                        int pri_strength, int sec_strength, int dir,
245
                        int pri_damping, int sec_damping, int coeff_shift,
246
226k
                        int block_width, int block_height) {
247
226k
  cdef_filter_block_internal(NULL, (uint16_t *)dst16, dstride, in, pri_strength,
248
226k
                             sec_strength, dir, pri_damping, sec_damping,
249
226k
                             coeff_shift, block_width, block_height,
250
226k
                             /*enable_primary=*/1, /*enable_secondary=*/1);
251
226k
}
252
253
void cdef_filter_16_1_c(void *dst16, int dstride, const uint16_t *in,
254
                        int pri_strength, int sec_strength, int dir,
255
                        int pri_damping, int sec_damping, int coeff_shift,
256
19.8k
                        int block_width, int block_height) {
257
19.8k
  cdef_filter_block_internal(NULL, (uint16_t *)dst16, dstride, in, pri_strength,
258
19.8k
                             sec_strength, dir, pri_damping, sec_damping,
259
19.8k
                             coeff_shift, block_width, block_height,
260
19.8k
                             /*enable_primary=*/1, /*enable_secondary=*/0);
261
19.8k
}
262
263
void cdef_filter_16_2_c(void *dst16, int dstride, const uint16_t *in,
264
                        int pri_strength, int sec_strength, int dir,
265
                        int pri_damping, int sec_damping, int coeff_shift,
266
154k
                        int block_width, int block_height) {
267
154k
  cdef_filter_block_internal(NULL, (uint16_t *)dst16, dstride, in, pri_strength,
268
154k
                             sec_strength, dir, pri_damping, sec_damping,
269
154k
                             coeff_shift, block_width, block_height,
270
154k
                             /*enable_primary=*/0, /*enable_secondary=*/1);
271
154k
}
272
273
void cdef_filter_16_3_c(void *dst16, int dstride, const uint16_t *in,
274
                        int pri_strength, int sec_strength, int dir,
275
                        int pri_damping, int sec_damping, int coeff_shift,
276
128k
                        int block_width, int block_height) {
277
128k
  cdef_filter_block_internal(NULL, (uint16_t *)dst16, dstride, in, pri_strength,
278
128k
                             sec_strength, dir, pri_damping, sec_damping,
279
128k
                             coeff_shift, block_width, block_height,
280
128k
                             /*enable_primary=*/0, /*enable_secondary=*/0);
281
128k
}
282
283
/* Compute the primary filter strength for an 8x8 block based on the
284
   directional variance difference. A high variance difference means
285
   that we have a highly directional pattern (e.g. a high contrast
286
   edge), so we can apply more deringing. A low variance means that we
287
   either have a low contrast edge, or a non-directional texture, so
288
   we want to be careful not to blur. */
289
496k
static inline int adjust_strength(int strength, int32_t var) {
290
496k
  const int i = var >> 6 ? AOMMIN(get_msb(var >> 6), 12) : 0;
291
  /* We use the variance of 8x8 blocks to adjust the strength. */
292
496k
  return var ? (strength * (4 + i) + 8) >> 4 : 0;
293
496k
}
294
295
static inline void aom_cdef_find_dir(const uint16_t *in, cdef_list *dlist,
296
                                     int var[CDEF_NBLOCKS][CDEF_NBLOCKS],
297
                                     int cdef_count, int coeff_shift,
298
15.3k
                                     int dir[CDEF_NBLOCKS][CDEF_NBLOCKS]) {
299
15.3k
  int bi;
300
301
  // Find direction of two 8x8 blocks together.
302
263k
  for (bi = 0; bi < cdef_count - 1; bi += 2) {
303
248k
    const int by = dlist[bi].by;
304
248k
    const int bx = dlist[bi].bx;
305
248k
    const int by2 = dlist[bi + 1].by;
306
248k
    const int bx2 = dlist[bi + 1].bx;
307
248k
    const int pos1 = 8 * by * CDEF_BSTRIDE + 8 * bx;
308
248k
    const int pos2 = 8 * by2 * CDEF_BSTRIDE + 8 * bx2;
309
248k
    cdef_find_dir_dual(&in[pos1], &in[pos2], CDEF_BSTRIDE, &var[by][bx],
310
248k
                       &var[by2][bx2], coeff_shift, &dir[by][bx],
311
248k
                       &dir[by2][bx2]);
312
248k
  }
313
314
  // Process remaining 8x8 blocks here. One 8x8 at a time.
315
15.3k
  if (cdef_count % 2) {
316
1.53k
    const int by = dlist[bi].by;
317
1.53k
    const int bx = dlist[bi].bx;
318
1.53k
    dir[by][bx] = cdef_find_dir(&in[8 * by * CDEF_BSTRIDE + 8 * bx],
319
1.53k
                                CDEF_BSTRIDE, &var[by][bx], coeff_shift);
320
1.53k
  }
321
15.3k
}
322
323
void av1_cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride,
324
                        const uint16_t *in, int xdec, int ydec,
325
                        int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], int *dirinit,
326
                        int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli,
327
                        cdef_list *dlist, int cdef_count, int level,
328
39.9k
                        int sec_strength, int damping, int coeff_shift) {
329
39.9k
  int bi;
330
39.9k
  int bx;
331
39.9k
  int by;
332
39.9k
  const int pri_strength = level << coeff_shift;
333
39.9k
  sec_strength <<= coeff_shift;
334
39.9k
  damping += coeff_shift - (pli != AOM_PLANE_Y);
335
39.9k
  const int bw_log2 = 3 - xdec;
336
39.9k
  const int bh_log2 = 3 - ydec;
337
39.9k
  if (dirinit && pri_strength == 0 && sec_strength == 0) {
338
    // If we're here, both primary and secondary strengths are 0, and
339
    // we still haven't written anything to y[] yet, so we just copy
340
    // the input to y[]. This is necessary only for av1_cdef_search()
341
    // and only av1_cdef_search() sets dirinit.
342
0
    for (bi = 0; bi < cdef_count; bi++) {
343
0
      by = dlist[bi].by;
344
0
      bx = dlist[bi].bx;
345
      // TODO(stemidts/jmvalin): SIMD optimisations
346
0
      for (int iy = 0; iy < 1 << bh_log2; iy++) {
347
0
        memcpy(&dst16[(bi << (bw_log2 + bh_log2)) + (iy << bw_log2)],
348
0
               &in[((by << bh_log2) + iy) * CDEF_BSTRIDE + (bx << bw_log2)],
349
0
               ((size_t)1 << bw_log2) * sizeof(*dst16));
350
0
      }
351
0
    }
352
0
    return;
353
0
  }
354
355
39.9k
  if (pli == 0) {
356
15.3k
    if (!dirinit || !*dirinit) {
357
15.3k
      aom_cdef_find_dir(in, dlist, var, cdef_count, coeff_shift, dir);
358
15.3k
      if (dirinit) *dirinit = 1;
359
15.3k
    }
360
15.3k
  }
361
39.9k
  if (pli == 1 && xdec != ydec) {
362
7.70k
    for (bi = 0; bi < cdef_count; bi++) {
363
7.17k
      static const int conv422[8] = { 7, 0, 2, 4, 5, 6, 6, 6 };
364
7.17k
      static const int conv440[8] = { 1, 2, 2, 2, 3, 4, 6, 0 };
365
7.17k
      by = dlist[bi].by;
366
7.17k
      bx = dlist[bi].bx;
367
7.17k
      dir[by][bx] = (xdec ? conv422 : conv440)[dir[by][bx]];
368
7.17k
    }
369
533
  }
370
371
39.9k
  if (dst8) {
372
17.4k
    const int block_width = 8 >> xdec;
373
17.4k
    const int block_height = 8 >> ydec;
374
    /*
375
     * strength_index == 0 : enable_primary = 1, enable_secondary = 1
376
     * strength_index == 1 : enable_primary = 1, enable_secondary = 0
377
     * strength_index == 2 : enable_primary = 0, enable_secondary = 1
378
     * strength_index == 3 : enable_primary = 0, enable_secondary = 0
379
     */
380
17.4k
    const cdef_filter_block_func cdef_filter_fn[4] = {
381
17.4k
      cdef_filter_8_0, cdef_filter_8_1, cdef_filter_8_2, cdef_filter_8_3
382
17.4k
    };
383
384
711k
    for (bi = 0; bi < cdef_count; bi++) {
385
694k
      by = dlist[bi].by;
386
694k
      bx = dlist[bi].bx;
387
694k
      const int t =
388
694k
          (pli ? pri_strength : adjust_strength(pri_strength, var[by][bx]));
389
694k
      const int strength_index = (sec_strength == 0) | ((t == 0) << 1);
390
391
694k
      cdef_filter_fn[strength_index](
392
694k
          &dst8[(by << bh_log2) * dstride + (bx << bw_log2)], dstride,
393
694k
          &in[(by * CDEF_BSTRIDE << bh_log2) + (bx << bw_log2)], t,
394
694k
          sec_strength, pri_strength ? dir[by][bx] : 0, damping, damping,
395
694k
          coeff_shift, block_width, block_height);
396
694k
    }
397
22.4k
  } else {
398
22.4k
    const int block_width = 8 >> xdec;
399
22.4k
    const int block_height = 8 >> ydec;
400
    /*
401
     * strength_index == 0 : enable_primary = 1, enable_secondary = 1
402
     * strength_index == 1 : enable_primary = 1, enable_secondary = 0
403
     * strength_index == 2 : enable_primary = 0, enable_secondary = 1
404
     * strength_index == 3 : enable_primary = 0, enable_secondary = 0
405
     */
406
22.4k
    const cdef_filter_block_func cdef_filter_fn[4] = {
407
22.4k
      cdef_filter_16_0, cdef_filter_16_1, cdef_filter_16_2, cdef_filter_16_3
408
22.4k
    };
409
410
548k
    for (bi = 0; bi < cdef_count; bi++) {
411
526k
      by = dlist[bi].by;
412
526k
      bx = dlist[bi].bx;
413
526k
      const int t =
414
526k
          (pli ? pri_strength : adjust_strength(pri_strength, var[by][bx]));
415
526k
      const int strength_index = (sec_strength == 0) | ((t == 0) << 1);
416
417
526k
      cdef_filter_fn[strength_index](
418
526k
          &dst16[dirinit ? bi << (bw_log2 + bh_log2)
419
526k
                         : (by << bh_log2) * dstride + (bx << bw_log2)],
420
526k
          dirinit ? 1 << bw_log2 : dstride,
421
526k
          &in[(by * CDEF_BSTRIDE << bh_log2) + (bx << bw_log2)], t,
422
526k
          sec_strength, pri_strength ? dir[by][bx] : 0, damping, damping,
423
526k
          coeff_shift, block_width, block_height);
424
526k
    }
425
22.4k
  }
426
39.9k
}