Line data Source code
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 : #ifndef AV1_COMMON_FILTER_H_
13 : #define AV1_COMMON_FILTER_H_
14 :
15 : #include "./aom_config.h"
16 : #include "aom/aom_integer.h"
17 : #include "aom_dsp/aom_filter.h"
18 : #include "aom_ports/mem.h"
19 :
20 : #ifdef __cplusplus
21 : extern "C" {
22 : #endif
23 :
24 : #define USE_TEMPORALFILTER_12TAP 1
25 : #define MAX_FILTER_TAP 12
26 :
27 : #define USE_12TAP_FILTER 0
28 : #define USE_EXTRA_FILTER 0
29 :
30 : typedef enum {
31 : EIGHTTAP_REGULAR,
32 : EIGHTTAP_SMOOTH,
33 : MULTITAP_SHARP,
34 : #if USE_EXTRA_FILTER
35 : EIGHTTAP_SMOOTH2,
36 : #endif // USE_EXTRA_FILTER
37 : BILINEAR,
38 : #if USE_EXTRA_FILTER
39 : EIGHTTAP_SHARP,
40 : FILTER_REGULAR_UV,
41 : FILTER_SMOOTH_UV,
42 : FILTER_SHARP_UV,
43 : FILTER_SMOOTH2_UV,
44 : #endif // USE_EXTRA_FILTER
45 : INTERP_FILTERS_ALL,
46 : SWITCHABLE_FILTERS = BILINEAR,
47 : SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
48 : EXTRA_FILTERS = INTERP_FILTERS_ALL - SWITCHABLE_FILTERS,
49 : #if USE_TEMPORALFILTER_12TAP
50 : TEMPORALFILTER_12TAP = SWITCHABLE_FILTERS + EXTRA_FILTERS,
51 : #endif
52 : } InterpFilter;
53 :
54 : #if CONFIG_DUAL_FILTER
55 : #define MAX_SUBPEL_TAPS 12
56 : #define LOG_SWITCHABLE_FILTERS \
57 : 3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
58 : #define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
59 : #define INTER_FILTER_COMP_OFFSET (SWITCHABLE_FILTERS + 1)
60 : #define INTER_FILTER_DIR_OFFSET ((SWITCHABLE_FILTERS + 1) * 2)
61 : #else // CONFIG_DUAL_FILTER
62 : #define LOG_SWITCHABLE_FILTERS \
63 : 2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
64 : #define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
65 : #endif // CONFIG_DUAL_FILTER
66 :
67 : #if CONFIG_EXT_INTRA
68 : #if CONFIG_INTRA_INTERP
69 : typedef enum {
70 : INTRA_FILTER_LINEAR,
71 : INTRA_FILTER_8TAP,
72 : INTRA_FILTER_8TAP_SHARP,
73 : INTRA_FILTER_8TAP_SMOOTH,
74 : INTRA_FILTERS,
75 : } INTRA_FILTER;
76 :
77 : extern const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS];
78 : #endif // CONFIG_INTRA_INTERP
79 : #endif // CONFIG_EXT_INTRA
80 :
81 : typedef struct InterpFilterParams {
82 : const int16_t *filter_ptr;
83 : uint16_t taps;
84 : uint16_t subpel_shifts;
85 : InterpFilter interp_filter;
86 : } InterpFilterParams;
87 :
88 : InterpFilterParams av1_get_interp_filter_params(
89 : const InterpFilter interp_filter);
90 :
91 : const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter);
92 :
93 0 : static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
94 : const InterpFilterParams filter_params, const int subpel) {
95 0 : return filter_params.filter_ptr + filter_params.taps * subpel;
96 : }
97 :
98 : static INLINE int av1_is_interpolating_filter(
99 : const InterpFilter interp_filter) {
100 : const InterpFilterParams ip = av1_get_interp_filter_params(interp_filter);
101 : return (ip.filter_ptr[ip.taps / 2 - 1] == 128);
102 : }
103 :
104 : #if CONFIG_DUAL_FILTER
105 : InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter, int plane);
106 : #endif
107 :
108 : #ifdef __cplusplus
109 : } // extern "C"
110 : #endif
111 :
112 : #endif // AV1_COMMON_FILTER_H_
|