Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 11 | #ifndef AOM_DSP_AOM_CONVOLVE_H_ |
| 12 | #define AOM_DSP_AOM_CONVOLVE_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 13 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 14 | #include "./aom_config.h" |
| 15 | #include "aom/aom_integer.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "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 Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 33 | #if CONFIG_AV1 && CONFIG_EXT_PARTITION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 34 | #define MAX_EXT_SIZE 263 |
| 35 | #else |
| 36 | #define MAX_EXT_SIZE 135 |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 37 | #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 38 | |
| 39 | typedef 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 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 45 | #if CONFIG_AOM_HIGHBITDEPTH |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 46 | typedef 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 Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 57 | #endif // AOM_DSP_AOM_CONVOLVE_H_ |