convolve.c 18.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

12
#include <assert.h>
Angie Chiang's avatar
Angie Chiang committed
13
#include <string.h>
14

15
#include "./aom_dsp_rtcd.h"
Yaowu Xu's avatar
Yaowu Xu committed
16
#include "./av1_rtcd.h"
17
#include "av1/common/convolve.h"
18
#include "av1/common/filter.h"
Yaowu Xu's avatar
Yaowu Xu committed
19
#include "aom_dsp/aom_dsp_common.h"
20
#include "aom_ports/mem.h"
21

22 23
#define MAX_BLOCK_WIDTH (MAX_SB_SIZE)
#define MAX_BLOCK_HEIGHT (MAX_SB_SIZE)
24 25 26
#define MAX_STEP (32)
#define MAX_FILTER_TAP (12)

Yaowu Xu's avatar
Yaowu Xu committed
27 28 29 30
void av1_convolve_horiz_c(const uint8_t *src, int src_stride, uint8_t *dst,
                          int dst_stride, int w, int h,
                          const InterpFilterParams filter_params,
                          const int subpel_x_q4, int x_step_q4, int avg) {
31
  int x, y;
32
  int filter_size = filter_params.taps;
33 34 35 36 37
  src -= filter_size / 2 - 1;
  for (y = 0; y < h; ++y) {
    int x_q4 = subpel_x_q4;
    for (x = 0; x < w; ++x) {
      const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
Yaowu Xu's avatar
Yaowu Xu committed
38
      const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
clang-format's avatar
clang-format committed
39
          filter_params, x_q4 & SUBPEL_MASK);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
      int k, sum = 0;
      for (k = 0; k < filter_size; ++k) sum += src_x[k] * x_filter[k];
      if (avg) {
        dst[x] = ROUND_POWER_OF_TWO(
            dst[x] + clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
      } else {
        dst[x] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
      }
      x_q4 += x_step_q4;
    }
    src += src_stride;
    dst += dst_stride;
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
55 56 57 58
void av1_convolve_vert_c(const uint8_t *src, int src_stride, uint8_t *dst,
                         int dst_stride, int w, int h,
                         const InterpFilterParams filter_params,
                         const int subpel_y_q4, int y_step_q4, int avg) {
59
  int x, y;
60
  int filter_size = filter_params.taps;
61 62 63 64 65 66
  src -= src_stride * (filter_size / 2 - 1);

  for (x = 0; x < w; ++x) {
    int y_q4 = subpel_y_q4;
    for (y = 0; y < h; ++y) {
      const uint8_t *const src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
Yaowu Xu's avatar
Yaowu Xu committed
67
      const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
clang-format's avatar
clang-format committed
68
          filter_params, y_q4 & SUBPEL_MASK);
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
      int k, sum = 0;
      for (k = 0; k < filter_size; ++k)
        sum += src_y[k * src_stride] * y_filter[k];
      if (avg) {
        dst[y * dst_stride] = ROUND_POWER_OF_TWO(
            dst[y * dst_stride] +
                clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)),
            1);
      } else {
        dst[y * dst_stride] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
      }
      y_q4 += y_step_q4;
    }
    ++src;
    ++dst;
  }
}

Angie Chiang's avatar
Angie Chiang committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
static void convolve_copy(const uint8_t *src, int src_stride, uint8_t *dst,
                          int dst_stride, int w, int h, int avg) {
  if (avg == 0) {
    int r;
    for (r = 0; r < h; ++r) {
      memcpy(dst, src, w);
      src += src_stride;
      dst += dst_stride;
    }
  } else {
    int r, c;
    for (r = 0; r < h; ++r) {
      for (c = 0; c < w; ++c) {
        dst[c] = clip_pixel(ROUND_POWER_OF_TWO(dst[c] + src[c], 1));
      }
      src += src_stride;
      dst += dst_stride;
    }
  }
}

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
void av1_convolve_horiz_facade(const uint8_t *src, int src_stride, uint8_t *dst,
                               int dst_stride, int w, int h,
                               const InterpFilterParams filter_params,
                               const int subpel_x_q4, int x_step_q4, int avg) {
  if (filter_params.taps == SUBPEL_TAPS) {
    const int16_t *filter_x =
        av1_get_interp_filter_subpel_kernel(filter_params, subpel_x_q4);
    if (avg == 0)
      aom_convolve8_horiz(src, src_stride, dst, dst_stride, filter_x, x_step_q4,
                          NULL, -1, w, h);
    else
      aom_convolve8_avg_horiz(src, src_stride, dst, dst_stride, filter_x,
                              x_step_q4, NULL, -1, w, h);
  } else {
    av1_convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params,
                       subpel_x_q4, x_step_q4, avg);
  }
}

void av1_convolve_vert_facade(const uint8_t *src, int src_stride, uint8_t *dst,
                              int dst_stride, int w, int h,
                              const InterpFilterParams filter_params,
                              const int subpel_y_q4, int y_step_q4, int avg) {
  if (filter_params.taps == SUBPEL_TAPS) {
    const int16_t *filter_y =
        av1_get_interp_filter_subpel_kernel(filter_params, subpel_y_q4);
    if (avg == 0) {
      aom_convolve8_vert(src, src_stride, dst, dst_stride, NULL, -1, filter_y,
                         y_step_q4, w, h);
    } else {
      aom_convolve8_avg_vert(src, src_stride, dst, dst_stride, NULL, -1,
                             filter_y, y_step_q4, w, h);
    }
  } else {
    av1_convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params,
                      subpel_y_q4, y_step_q4, avg);
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
147 148
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
                  int dst_stride, int w, int h,
149
#if CONFIG_DUAL_FILTER
James Zern's avatar
James Zern committed
150
                  const InterpFilter *interp_filter,
151
#else
James Zern's avatar
James Zern committed
152
                  const InterpFilter interp_filter,
153
#endif
Yaowu Xu's avatar
Yaowu Xu committed
154 155
                  const int subpel_x_q4, int x_step_q4, const int subpel_y_q4,
                  int y_step_q4, int ref_idx) {
Angie Chiang's avatar
Angie Chiang committed
156 157
  int ignore_horiz = x_step_q4 == 16 && subpel_x_q4 == 0;
  int ignore_vert = y_step_q4 == 16 && subpel_y_q4 == 0;
158 159 160 161 162 163

  assert(w <= MAX_BLOCK_WIDTH);
  assert(h <= MAX_BLOCK_HEIGHT);
  assert(y_step_q4 <= MAX_STEP);
  assert(x_step_q4 <= MAX_STEP);

Angie Chiang's avatar
Angie Chiang committed
164
  if (ignore_horiz && ignore_vert) {
165
    convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx);
Angie Chiang's avatar
Angie Chiang committed
166
  } else if (ignore_vert) {
167 168
#if CONFIG_DUAL_FILTER
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
169
        av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
170 171
#else
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
172
        av1_get_interp_filter_params(interp_filter);
173 174
#endif
    assert(filter_params.taps <= MAX_FILTER_TAP);
175 176
    av1_convolve_horiz_facade(src, src_stride, dst, dst_stride, w, h,
                              filter_params, subpel_x_q4, x_step_q4, ref_idx);
Angie Chiang's avatar
Angie Chiang committed
177
  } else if (ignore_horiz) {
178 179
#if CONFIG_DUAL_FILTER
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
180
        av1_get_interp_filter_params(interp_filter[2 * ref_idx]);
181 182
#else
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
183
        av1_get_interp_filter_params(interp_filter);
184 185
#endif
    assert(filter_params.taps <= MAX_FILTER_TAP);
186 187
    av1_convolve_vert_facade(src, src_stride, dst, dst_stride, w, h,
                             filter_params, subpel_y_q4, y_step_q4, ref_idx);
Angie Chiang's avatar
Angie Chiang committed
188
  } else {
189 190 191 192 193 194
    // temp's size is set to a 256 aligned value to facilitate SIMD
    // implementation. The value is greater than (maximum possible intermediate
    // height or width) * MAX_SB_SIZE
    DECLARE_ALIGNED(16, uint8_t,
                    temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]);
    int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16);
195 196
    int filter_size;
    InterpFilterParams filter_params;
197
#if CONFIG_DUAL_FILTER
198
    InterpFilterParams filter_params_x =
Yaowu Xu's avatar
Yaowu Xu committed
199
        av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
200
    InterpFilterParams filter_params_y =
Yaowu Xu's avatar
Yaowu Xu committed
201
        av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
202 203 204 205 206 207
    if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP &&
        interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) {
      // Avoid two directions both using 12-tap filter.
      // This will reduce hardware implementation cost.
      filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
    }
208
#endif
209

210 211 212 213 214
#if CONFIG_DUAL_FILTER
    // we do filter with fewer taps first to reduce hardware implementation
    // complexity
    if (filter_params_y.taps < filter_params_x.taps) {
      int intermediate_width;
215
      int temp_stride = max_intermediate_size;
216 217 218
#if CONFIG_DUAL_FILTER
      filter_params = filter_params_y;
      filter_size = filter_params_x.taps;
219
#else
220 221
      filter_params = av1_get_interp_filter_params(interp_filter);
      filter_size = filter_params.taps;
222
#endif
223 224
      intermediate_width =
          (((w - 1) * x_step_q4 + subpel_x_q4) >> SUBPEL_BITS) + filter_size;
225
      assert(intermediate_width <= max_intermediate_size);
Angie Chiang's avatar
Angie Chiang committed
226

227
      assert(filter_params.taps <= MAX_FILTER_TAP);
228

229 230 231
      av1_convolve_vert_facade(src - (filter_size / 2 - 1), src_stride, temp,
                               temp_stride, intermediate_width, h,
                               filter_params, subpel_y_q4, y_step_q4, 0);
232 233

#if CONFIG_DUAL_FILTER
234
      filter_params = filter_params_x;
235
#else
236
      filter_params = av1_get_interp_filter_params(interp_filter);
237
#endif
238
      assert(filter_params.taps <= MAX_FILTER_TAP);
239

240 241 242
      av1_convolve_horiz_facade(temp + (filter_size / 2 - 1), temp_stride, dst,
                                dst_stride, w, h, filter_params, subpel_x_q4,
                                x_step_q4, ref_idx);
243 244 245 246
    } else
#endif
    {
      int intermediate_height;
247
      int temp_stride = MAX_SB_SIZE;
248 249 250 251 252 253 254 255 256
#if CONFIG_DUAL_FILTER
      filter_params = filter_params_x;
      filter_size = filter_params_y.taps;
#else
      filter_params = av1_get_interp_filter_params(interp_filter);
      filter_size = filter_params.taps;
#endif
      intermediate_height =
          (((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size;
257 258
      assert(intermediate_height <= max_intermediate_size);
      (void)max_intermediate_size;
259 260 261

      assert(filter_params.taps <= MAX_FILTER_TAP);

262 263 264 265
      av1_convolve_horiz_facade(src - src_stride * (filter_size / 2 - 1),
                                src_stride, temp, temp_stride, w,
                                intermediate_height, filter_params, subpel_x_q4,
                                x_step_q4, 0);
266 267 268 269 270 271 272 273

#if CONFIG_DUAL_FILTER
      filter_params = filter_params_y;
#else
      filter_params = av1_get_interp_filter_params(interp_filter);
#endif
      assert(filter_params.taps <= MAX_FILTER_TAP);

274 275 276
      av1_convolve_vert_facade(temp + temp_stride * (filter_size / 2 - 1),
                               temp_stride, dst, dst_stride, w, h,
                               filter_params, subpel_y_q4, y_step_q4, ref_idx);
277
    }
Angie Chiang's avatar
Angie Chiang committed
278
  }
279 280
}

Angie Chiang's avatar
Angie Chiang committed
281 282 283 284 285
void av1_convolve_init_c(void) {
  // A placeholder for SIMD initialization
  return;
}

Yaowu Xu's avatar
Yaowu Xu committed
286 287 288 289 290 291
#if CONFIG_AOM_HIGHBITDEPTH
void av1_highbd_convolve_horiz_c(const uint16_t *src, int src_stride,
                                 uint16_t *dst, int dst_stride, int w, int h,
                                 const InterpFilterParams filter_params,
                                 const int subpel_x_q4, int x_step_q4, int avg,
                                 int bd) {
292
  int x, y;
293
  int filter_size = filter_params.taps;
294 295 296 297 298
  src -= filter_size / 2 - 1;
  for (y = 0; y < h; ++y) {
    int x_q4 = subpel_x_q4;
    for (x = 0; x < w; ++x) {
      const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
Yaowu Xu's avatar
Yaowu Xu committed
299
      const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
clang-format's avatar
clang-format committed
300
          filter_params, x_q4 & SUBPEL_MASK);
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
      int k, sum = 0;
      for (k = 0; k < filter_size; ++k) sum += src_x[k] * x_filter[k];
      if (avg)
        dst[x] = ROUND_POWER_OF_TWO(
            dst[x] +
                clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
            1);
      else
        dst[x] = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
      x_q4 += x_step_q4;
    }
    src += src_stride;
    dst += dst_stride;
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
317 318 319 320 321
void av1_highbd_convolve_vert_c(const uint16_t *src, int src_stride,
                                uint16_t *dst, int dst_stride, int w, int h,
                                const InterpFilterParams filter_params,
                                const int subpel_y_q4, int y_step_q4, int avg,
                                int bd) {
322
  int x, y;
323
  int filter_size = filter_params.taps;
324 325 326 327 328 329
  src -= src_stride * (filter_size / 2 - 1);

  for (x = 0; x < w; ++x) {
    int y_q4 = subpel_y_q4;
    for (y = 0; y < h; ++y) {
      const uint16_t *const src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
Yaowu Xu's avatar
Yaowu Xu committed
330
      const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
clang-format's avatar
clang-format committed
331
          filter_params, y_q4 & SUBPEL_MASK);
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
      int k, sum = 0;
      for (k = 0; k < filter_size; ++k)
        sum += src_y[k * src_stride] * y_filter[k];
      if (avg) {
        dst[y * dst_stride] = ROUND_POWER_OF_TWO(
            dst[y * dst_stride] +
                clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
            1);
      } else {
        dst[y * dst_stride] =
            clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
      }
      y_q4 += y_step_q4;
    }
    ++src;
    ++dst;
  }
}

Angie Chiang's avatar
Angie Chiang committed
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
static void highbd_convolve_copy(const uint16_t *src, int src_stride,
                                 uint16_t *dst, int dst_stride, int w, int h,
                                 int avg, int bd) {
  if (avg == 0) {
    int r;
    for (r = 0; r < h; ++r) {
      memcpy(dst, src, w * sizeof(*src));
      src += src_stride;
      dst += dst_stride;
    }
  } else {
    int r, c;
    for (r = 0; r < h; ++r) {
      for (c = 0; c < w; ++c) {
        dst[c] = clip_pixel_highbd(ROUND_POWER_OF_TWO(dst[c] + src[c], 1), bd);
      }
      src += src_stride;
      dst += dst_stride;
    }
  }
}

373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
void av1_highbd_convolve_horiz_facade(const uint8_t *src8, int src_stride,
                                      uint8_t *dst8, int dst_stride, int w,
                                      int h,
                                      const InterpFilterParams filter_params,
                                      const int subpel_x_q4, int x_step_q4,
                                      int avg, int bd) {
  uint16_t *src = CONVERT_TO_SHORTPTR(src8);
  uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
  if (filter_params.taps == SUBPEL_TAPS) {
    const int16_t *filter_x =
        av1_get_interp_filter_subpel_kernel(filter_params, subpel_x_q4);
    if (avg == 0)
      aom_highbd_convolve8_horiz(src8, src_stride, dst8, dst_stride, filter_x,
                                 x_step_q4, NULL, -1, w, h, bd);
    else
      aom_highbd_convolve8_avg_horiz(src8, src_stride, dst8, dst_stride,
                                     filter_x, x_step_q4, NULL, -1, w, h, bd);
  } else {
    av1_highbd_convolve_horiz(src, src_stride, dst, dst_stride, w, h,
                              filter_params, subpel_x_q4, x_step_q4, avg, bd);
  }
}

void av1_highbd_convolve_vert_facade(const uint8_t *src8, int src_stride,
                                     uint8_t *dst8, int dst_stride, int w,
                                     int h,
                                     const InterpFilterParams filter_params,
                                     const int subpel_y_q4, int y_step_q4,
                                     int avg, int bd) {
  uint16_t *src = CONVERT_TO_SHORTPTR(src8);
  uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
  if (filter_params.taps == SUBPEL_TAPS) {
    const int16_t *filter_y =
        av1_get_interp_filter_subpel_kernel(filter_params, subpel_y_q4);
    if (avg == 0) {
      aom_highbd_convolve8_vert(src8, src_stride, dst8, dst_stride, NULL, -1,
                                filter_y, y_step_q4, w, h, bd);
    } else {
      aom_highbd_convolve8_avg_vert(src8, src_stride, dst8, dst_stride, NULL,
                                    -1, filter_y, y_step_q4, w, h, bd);
    }
  } else {
    av1_highbd_convolve_vert(src, src_stride, dst, dst_stride, w, h,
                             filter_params, subpel_y_q4, y_step_q4, avg, bd);
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
420 421
void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
                         int dst_stride, int w, int h,
422
#if CONFIG_DUAL_FILTER
James Zern's avatar
James Zern committed
423
                         const InterpFilter *interp_filter,
424
#else
James Zern's avatar
James Zern committed
425
                         const InterpFilter interp_filter,
426
#endif
Yaowu Xu's avatar
Yaowu Xu committed
427 428 429
                         const int subpel_x_q4, int x_step_q4,
                         const int subpel_y_q4, int y_step_q4, int ref_idx,
                         int bd) {
Angie Chiang's avatar
Angie Chiang committed
430 431 432 433
  uint16_t *src = CONVERT_TO_SHORTPTR(src8);
  uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
  int ignore_horiz = x_step_q4 == 16 && subpel_x_q4 == 0;
  int ignore_vert = y_step_q4 == 16 && subpel_y_q4 == 0;
434 435 436 437 438 439

  assert(w <= MAX_BLOCK_WIDTH);
  assert(h <= MAX_BLOCK_HEIGHT);
  assert(y_step_q4 <= MAX_STEP);
  assert(x_step_q4 <= MAX_STEP);

Angie Chiang's avatar
Angie Chiang committed
440
  if (ignore_horiz && ignore_vert) {
441
    highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx, bd);
Angie Chiang's avatar
Angie Chiang committed
442
  } else if (ignore_vert) {
443 444
#if CONFIG_DUAL_FILTER
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
445
        av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
446 447
#else
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
448
        av1_get_interp_filter_params(interp_filter);
449
#endif
450 451 452
    av1_highbd_convolve_horiz_facade(src8, src_stride, dst8, dst_stride, w, h,
                                     filter_params, subpel_x_q4, x_step_q4,
                                     ref_idx, bd);
Angie Chiang's avatar
Angie Chiang committed
453
  } else if (ignore_horiz) {
454 455
#if CONFIG_DUAL_FILTER
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
456
        av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
457 458
#else
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
459
        av1_get_interp_filter_params(interp_filter);
460
#endif
461 462 463
    av1_highbd_convolve_vert_facade(src8, src_stride, dst8, dst_stride, w, h,
                                    filter_params, subpel_y_q4, y_step_q4,
                                    ref_idx, bd);
Angie Chiang's avatar
Angie Chiang committed
464 465 466 467 468 469
  } else {
    // temp's size is set to (maximum possible intermediate_height) *
    // MAX_BLOCK_WIDTH
    uint16_t temp[((((MAX_BLOCK_HEIGHT - 1) * MAX_STEP + 15) >> SUBPEL_BITS) +
                   MAX_FILTER_TAP) *
                  MAX_BLOCK_WIDTH];
470
    uint8_t *temp8 = CONVERT_TO_BYTEPTR(temp);
Angie Chiang's avatar
Angie Chiang committed
471 472
    int temp_stride = MAX_BLOCK_WIDTH;

473
#if CONFIG_DUAL_FILTER
474
    InterpFilterParams filter_params_x =
Yaowu Xu's avatar
Yaowu Xu committed
475
        av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
476
    InterpFilterParams filter_params_y =
Yaowu Xu's avatar
Yaowu Xu committed
477
        av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
478 479
    InterpFilterParams filter_params = filter_params_x;
    int filter_size = filter_params_y.taps;
480 481
#else
    InterpFilterParams filter_params =
Yaowu Xu's avatar
Yaowu Xu committed
482
        av1_get_interp_filter_params(interp_filter);
483
    int filter_size = filter_params.taps;
484
#endif
485

Angie Chiang's avatar
Angie Chiang committed
486 487 488
    int intermediate_height =
        (((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size;

489 490 491 492
    av1_highbd_convolve_horiz_facade(src8 - src_stride * (filter_size / 2 - 1),
                                     src_stride, temp8, temp_stride, w,
                                     intermediate_height, filter_params,
                                     subpel_x_q4, x_step_q4, 0, bd);
493 494

#if CONFIG_DUAL_FILTER
495
    filter_params = filter_params_y;
496 497 498 499
#endif
    filter_size = filter_params.taps;
    assert(filter_params.taps <= MAX_FILTER_TAP);

500 501 502
    av1_highbd_convolve_vert_facade(
        temp8 + temp_stride * (filter_size / 2 - 1), temp_stride, dst8,
        dst_stride, w, h, filter_params, subpel_y_q4, y_step_q4, ref_idx, bd);
Angie Chiang's avatar
Angie Chiang committed
503
  }
504
}
Yaowu Xu's avatar
Yaowu Xu committed
505
#endif  // CONFIG_AOM_HIGHBITDEPTH