blob: d0de6c5d20f4d347550d7d13258861f1399dff8b [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
Yaowu Xuf883b422016-08-30 14:01:10 -070011#ifndef AOM_DSP_AOM_CONVOLVE_H_
12#define AOM_DSP_AOM_CONVOLVE_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070013
Yaowu Xuf883b422016-08-30 14:01:10 -070014#include "./aom_config.h"
15#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21// Note: Fixed size intermediate buffers, place limits on parameters
22// of some functions. 2d filtering proceeds in 2 steps:
23// (1) Interpolate horizontally into an intermediate buffer, temp.
24// (2) Interpolate temp vertically to derive the sub-pixel result.
25// Deriving the maximum number of rows in the temp buffer (135):
26// --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
27// --Largest block size is 64x64 pixels.
28// --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
29// original frame (in 1/16th pixel units).
30// --Must round-up because block may be located at sub-pixel position.
31// --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
32// --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
Yaowu Xuf883b422016-08-30 14:01:10 -070033#if CONFIG_AV1 && CONFIG_EXT_PARTITION
Yaowu Xuc27fc142016-08-22 16:08:15 -070034#define MAX_EXT_SIZE 263
35#else
36#define MAX_EXT_SIZE 135
Yaowu Xuf883b422016-08-30 14:01:10 -070037#endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
Yaowu Xuc27fc142016-08-22 16:08:15 -070038
39typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
40 uint8_t *dst, ptrdiff_t dst_stride,
41 const int16_t *filter_x, int x_step_q4,
42 const int16_t *filter_y, int y_step_q4, int w,
43 int h);
44
Sebastien Alaiwan71e87842017-04-12 16:03:28 +020045#if CONFIG_HIGHBITDEPTH
Yaowu Xuc27fc142016-08-22 16:08:15 -070046typedef void (*highbd_convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
47 uint8_t *dst, ptrdiff_t dst_stride,
48 const int16_t *filter_x, int x_step_q4,
49 const int16_t *filter_y, int y_step_q4,
50 int w, int h, int bd);
51#endif
52
53#ifdef __cplusplus
54} // extern "C"
55#endif
56
Yaowu Xuf883b422016-08-30 14:01:10 -070057#endif // AOM_DSP_AOM_CONVOLVE_H_