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 : #include <assert.h>
13 :
14 : #include "av1/common/filter.h"
15 :
16 : DECLARE_ALIGNED(256, static const InterpKernel,
17 : bilinear_filters[SUBPEL_SHIFTS]) = {
18 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 0, 120, 8, 0, 0, 0 },
19 : { 0, 0, 0, 112, 16, 0, 0, 0 }, { 0, 0, 0, 104, 24, 0, 0, 0 },
20 : { 0, 0, 0, 96, 32, 0, 0, 0 }, { 0, 0, 0, 88, 40, 0, 0, 0 },
21 : { 0, 0, 0, 80, 48, 0, 0, 0 }, { 0, 0, 0, 72, 56, 0, 0, 0 },
22 : { 0, 0, 0, 64, 64, 0, 0, 0 }, { 0, 0, 0, 56, 72, 0, 0, 0 },
23 : { 0, 0, 0, 48, 80, 0, 0, 0 }, { 0, 0, 0, 40, 88, 0, 0, 0 },
24 : { 0, 0, 0, 32, 96, 0, 0, 0 }, { 0, 0, 0, 24, 104, 0, 0, 0 },
25 : { 0, 0, 0, 16, 112, 0, 0, 0 }, { 0, 0, 0, 8, 120, 0, 0, 0 }
26 : };
27 :
28 : #if USE_TEMPORALFILTER_12TAP
29 : DECLARE_ALIGNED(16, static const int16_t,
30 : sub_pel_filters_temporalfilter_12[SUBPEL_SHIFTS][12]) = {
31 : // intfilt 0.8
32 : { 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 },
33 : { 0, 1, -1, 3, -7, 127, 8, -4, 2, -1, 0, 0 },
34 : { 0, 1, -3, 5, -12, 124, 18, -8, 4, -2, 1, 0 },
35 : { -1, 2, -4, 8, -17, 120, 28, -11, 6, -3, 1, -1 },
36 : { -1, 2, -4, 10, -21, 114, 38, -15, 8, -4, 2, -1 },
37 : { -1, 3, -5, 11, -23, 107, 49, -18, 9, -5, 2, -1 },
38 : { -1, 3, -6, 12, -25, 99, 60, -21, 11, -6, 3, -1 },
39 : { -1, 3, -6, 12, -25, 90, 70, -23, 12, -6, 3, -1 },
40 : { -1, 3, -6, 12, -24, 80, 80, -24, 12, -6, 3, -1 },
41 : { -1, 3, -6, 12, -23, 70, 90, -25, 12, -6, 3, -1 },
42 : { -1, 3, -6, 11, -21, 60, 99, -25, 12, -6, 3, -1 },
43 : { -1, 2, -5, 9, -18, 49, 107, -23, 11, -5, 3, -1 },
44 : { -1, 2, -4, 8, -15, 38, 114, -21, 10, -4, 2, -1 },
45 : { -1, 1, -3, 6, -11, 28, 120, -17, 8, -4, 2, -1 },
46 : { 0, 1, -2, 4, -8, 18, 124, -12, 5, -3, 1, 0 },
47 : { 0, 0, -1, 2, -4, 8, 127, -7, 3, -1, 1, 0 },
48 : };
49 : #endif // USE_TEMPORALFILTER_12TAP
50 :
51 : #if USE_EXTRA_FILTER
52 : DECLARE_ALIGNED(256, static const InterpKernel,
53 : sub_pel_filters_8[SUBPEL_SHIFTS]) = {
54 : #if CONFIG_FILTER_7BIT
55 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
56 : { 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
57 : { 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
58 : { 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
59 : { 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
60 : { 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
61 : { 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
62 : { 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
63 : #else
64 : // intfilt 0.575
65 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
66 : { -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 },
67 : { -1, 5, -16, 112, 37, -12, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 },
68 : { -1, 6, -19, 97, 58, -17, 5, -1 }, { -1, 6, -20, 88, 68, -18, 6, -1 },
69 : { -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 6, -18, 68, 88, -20, 6, -1 },
70 : { -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
71 : { -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 },
72 : { -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 },
73 : #endif
74 : };
75 :
76 : DECLARE_ALIGNED(256, static const InterpKernel,
77 : sub_pel_filters_regular_uv[SUBPEL_SHIFTS]) = {
78 : #if CONFIG_FILTER_7BIT
79 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
80 : { 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
81 : { 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
82 : { 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
83 : { 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
84 : { 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
85 : { 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
86 : { 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
87 : #else
88 : // intfilt 0.575
89 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
90 : { -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 },
91 : { -1, 5, -16, 112, 37, -12, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 },
92 : { -1, 6, -19, 97, 58, -17, 5, -1 }, { -1, 6, -20, 88, 68, -18, 6, -1 },
93 : { -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 6, -18, 68, 88, -20, 6, -1 },
94 : { -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
95 : { -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 },
96 : { -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 },
97 : #endif
98 : };
99 :
100 : #if USE_12TAP_FILTER
101 : DECLARE_ALIGNED(256, static const InterpKernel,
102 : sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
103 : // intfilt 0.8
104 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 2, -6, 127, 9, -4, 2, -1 },
105 : { -2, 5, -12, 124, 18, -7, 4, -2 }, { -2, 7, -16, 119, 28, -11, 5, -2 },
106 : { -3, 8, -19, 114, 38, -14, 7, -3 }, { -3, 9, -22, 107, 49, -17, 8, -3 },
107 : { -4, 10, -23, 99, 60, -20, 10, -4 }, { -4, 11, -23, 90, 70, -22, 10, -4 },
108 : { -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -22, 70, 90, -23, 11, -4 },
109 : { -4, 10, -20, 60, 99, -23, 10, -4 }, { -3, 8, -17, 49, 107, -22, 9, -3 },
110 : { -3, 7, -14, 38, 114, -19, 8, -3 }, { -2, 5, -11, 28, 119, -16, 7, -2 },
111 : { -2, 4, -7, 18, 124, -12, 5, -2 }, { -1, 2, -4, 9, 127, -6, 2, -1 },
112 : };
113 :
114 : DECLARE_ALIGNED(256, static const int16_t,
115 : sub_pel_filters_10sharp[SUBPEL_SHIFTS][12]) = {
116 : // intfilt 0.85
117 : { 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 },
118 : { 0, 1, -2, 3, -7, 127, 8, -4, 2, -1, 1, 0 },
119 : { 0, 1, -3, 6, -13, 124, 18, -8, 4, -2, 1, 0 },
120 : { 0, 2, -4, 8, -18, 120, 28, -12, 6, -4, 2, 0 },
121 : { 0, 2, -5, 10, -21, 114, 38, -15, 8, -5, 2, 0 },
122 : { 0, 3, -6, 11, -24, 107, 49, -19, 10, -6, 3, 0 },
123 : { 0, 3, -7, 12, -25, 99, 59, -21, 11, -6, 3, 0 },
124 : { 0, 3, -7, 12, -25, 90, 70, -23, 12, -7, 3, 0 },
125 : { 0, 3, -7, 12, -25, 81, 81, -25, 12, -7, 3, 0 },
126 : { 0, 3, -7, 12, -23, 70, 90, -25, 12, -7, 3, 0 },
127 : { 0, 3, -6, 11, -21, 59, 99, -25, 12, -7, 3, 0 },
128 : { 0, 3, -6, 10, -19, 49, 107, -24, 11, -6, 3, 0 },
129 : { 0, 2, -5, 8, -15, 38, 114, -21, 10, -5, 2, 0 },
130 : { 0, 2, -4, 6, -12, 28, 120, -18, 8, -4, 2, 0 },
131 : { 0, 1, -2, 4, -8, 18, 124, -13, 6, -3, 1, 0 },
132 : { 0, 1, -1, 2, -4, 8, 127, -7, 3, -2, 1, 0 },
133 : };
134 : #else
135 : DECLARE_ALIGNED(256, static const InterpKernel,
136 : sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
137 : #if CONFIG_FILTER_7BIT
138 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
139 : { -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
140 : { -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
141 : { -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
142 : { -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
143 : { -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
144 : { -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
145 : { -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
146 : #else
147 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 3, -7, 127, 8, -3, 1, 0 },
148 : { -2, 5, -13, 125, 17, -6, 3, -1 }, { -3, 7, -17, 121, 27, -10, 5, -2 },
149 : { -4, 9, -20, 115, 37, -13, 6, -2 }, { -4, 10, -23, 108, 48, -16, 8, -3 },
150 : { -4, 10, -24, 100, 59, -19, 9, -3 }, { -4, 11, -24, 90, 70, -21, 10, -4 },
151 : { -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -21, 70, 90, -24, 11, -4 },
152 : { -3, 9, -19, 59, 100, -24, 10, -4 }, { -3, 8, -16, 48, 108, -23, 10, -4 },
153 : { -2, 6, -13, 37, 115, -20, 9, -4 }, { -2, 5, -10, 27, 121, -17, 7, -3 },
154 : { -1, 3, -6, 17, 125, -13, 5, -2 }, { 0, 1, -3, 8, 127, -7, 3, -1 }
155 : #endif
156 : };
157 : #endif
158 :
159 : DECLARE_ALIGNED(256, static const InterpKernel,
160 : sub_pel_filters_8smooth2[SUBPEL_SHIFTS]) = {
161 : // freqmultiplier = 0.2
162 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 9, 30, 44, 32, 11, 2, 0 },
163 : { 0, 8, 28, 44, 34, 12, 2, 0 }, { 0, 7, 27, 44, 35, 13, 2, 0 },
164 : { 0, 6, 26, 43, 37, 14, 2, 0 }, { 0, 5, 24, 43, 38, 16, 2, 0 },
165 : { 0, 5, 23, 42, 38, 17, 3, 0 }, { 0, 4, 21, 41, 40, 19, 3, 0 },
166 : { 0, 4, 20, 40, 40, 20, 4, 0 }, { 0, 3, 19, 40, 41, 21, 4, 0 },
167 : { 0, 3, 17, 38, 42, 23, 5, 0 }, { 0, 2, 16, 38, 43, 24, 5, 0 },
168 : { 0, 2, 14, 37, 43, 26, 6, 0 }, { 0, 2, 13, 35, 44, 27, 7, 0 },
169 : { 0, 2, 12, 34, 44, 28, 8, 0 }, { 0, 2, 11, 32, 44, 30, 9, 0 },
170 : };
171 :
172 : DECLARE_ALIGNED(256, static const InterpKernel,
173 : sub_pel_filters_smooth2_uv[SUBPEL_SHIFTS]) = {
174 : // freqmultiplier = 0.2
175 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 9, 30, 44, 32, 11, 2, 0 },
176 : { 0, 8, 28, 44, 34, 12, 2, 0 }, { 0, 7, 27, 44, 35, 13, 2, 0 },
177 : { 0, 6, 26, 43, 37, 14, 2, 0 }, { 0, 5, 24, 43, 38, 16, 2, 0 },
178 : { 0, 5, 23, 42, 38, 17, 3, 0 }, { 0, 4, 21, 41, 40, 19, 3, 0 },
179 : { 0, 4, 20, 40, 40, 20, 4, 0 }, { 0, 3, 19, 40, 41, 21, 4, 0 },
180 : { 0, 3, 17, 38, 42, 23, 5, 0 }, { 0, 2, 16, 38, 43, 24, 5, 0 },
181 : { 0, 2, 14, 37, 43, 26, 6, 0 }, { 0, 2, 13, 35, 44, 27, 7, 0 },
182 : { 0, 2, 12, 34, 44, 28, 8, 0 }, { 0, 2, 11, 32, 44, 30, 9, 0 },
183 : };
184 :
185 : DECLARE_ALIGNED(256, static const InterpKernel,
186 : sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
187 : #if CONFIG_FILTER_7BIT
188 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
189 : { 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
190 : { 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
191 : { 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
192 : { 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
193 : { 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
194 : { 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
195 : { 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
196 : #else
197 : // freqmultiplier = 0.8
198 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 },
199 : { 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 },
200 : { 0, -2, 0, 94, 44, -9, 1, 0 }, { 0, -2, -3, 90, 51, -9, 1, 0 },
201 : { 0, -1, -5, 84, 59, -9, 0, 0 }, { 0, 0, -7, 79, 65, -9, 0, 0 },
202 : { 0, 0, -8, 72, 72, -8, 0, 0 }, { 0, 0, -9, 65, 79, -7, 0, 0 },
203 : { 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 },
204 : { 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 },
205 : { 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
206 : #endif
207 : };
208 :
209 : DECLARE_ALIGNED(256, static const InterpKernel,
210 : sub_pel_filters_smooth_uv[SUBPEL_SHIFTS]) = {
211 : #if CONFIG_FILTER_7BIT
212 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
213 : { 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
214 : { 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
215 : { 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
216 : { 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
217 : { 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
218 : { 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
219 : { 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
220 : #else
221 : // freqmultiplier = 0.8
222 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 },
223 : { 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 },
224 : { 0, -2, 0, 94, 44, -9, 1, 0 }, { 0, -2, -3, 90, 51, -9, 1, 0 },
225 : { 0, -1, -5, 84, 59, -9, 0, 0 }, { 0, 0, -7, 79, 65, -9, 0, 0 },
226 : { 0, 0, -8, 72, 72, -8, 0, 0 }, { 0, 0, -9, 65, 79, -7, 0, 0 },
227 : { 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 },
228 : { 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 },
229 : { 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
230 : #endif
231 : };
232 : #else // USE_EXTRA_FILTER
233 :
234 : DECLARE_ALIGNED(256, static const InterpKernel,
235 : sub_pel_filters_8[SUBPEL_SHIFTS]) = {
236 : #if CONFIG_FILTER_7BIT
237 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
238 : { 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
239 : { 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
240 : { 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
241 : { 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
242 : { 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
243 : { 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
244 : { 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
245 : #else
246 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
247 : { -1, 3, -10, 122, 18, -6, 2, 0 }, { -1, 4, -13, 118, 27, -9, 3, -1 },
248 : { -1, 4, -16, 112, 37, -11, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 },
249 : { -1, 5, -19, 97, 58, -16, 5, -1 }, { -1, 6, -19, 88, 68, -18, 5, -1 },
250 : { -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 5, -18, 68, 88, -19, 6, -1 },
251 : { -1, 5, -16, 58, 97, -19, 5, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
252 : { -1, 4, -11, 37, 112, -16, 4, -1 }, { -1, 3, -9, 27, 118, -13, 4, -1 },
253 : { 0, 2, -6, 18, 122, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 }
254 : #endif
255 : };
256 :
257 : DECLARE_ALIGNED(256, static const InterpKernel,
258 : sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
259 : #if CONFIG_FILTER_7BIT
260 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
261 : { -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
262 : { -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
263 : { -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
264 : { -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
265 : { -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
266 : { -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
267 : { -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
268 : #else
269 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 3, -7, 127, 8, -3, 1, 0 },
270 : { -2, 5, -13, 125, 17, -6, 3, -1 }, { -3, 7, -17, 121, 27, -10, 5, -2 },
271 : { -4, 9, -20, 115, 37, -13, 6, -2 }, { -4, 10, -23, 108, 48, -16, 8, -3 },
272 : { -4, 10, -24, 100, 59, -19, 9, -3 }, { -4, 11, -24, 90, 70, -21, 10, -4 },
273 : { -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -21, 70, 90, -24, 11, -4 },
274 : { -3, 9, -19, 59, 100, -24, 10, -4 }, { -3, 8, -16, 48, 108, -23, 10, -4 },
275 : { -2, 6, -13, 37, 115, -20, 9, -4 }, { -2, 5, -10, 27, 121, -17, 7, -3 },
276 : { -1, 3, -6, 17, 125, -13, 5, -2 }, { 0, 1, -3, 8, 127, -7, 3, -1 }
277 : #endif
278 : };
279 :
280 : DECLARE_ALIGNED(256, static const InterpKernel,
281 : sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
282 : #if CONFIG_FILTER_7BIT
283 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
284 : { 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
285 : { 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
286 : { 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
287 : { 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
288 : { 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
289 : { 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
290 : { 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
291 : #else
292 : { 0, 0, 0, 128, 0, 0, 0, 0 }, { -3, -1, 32, 64, 38, 1, -3, 0 },
293 : { -2, -2, 29, 63, 41, 2, -3, 0 }, { -2, -2, 26, 63, 43, 4, -4, 0 },
294 : { -2, -3, 24, 62, 46, 5, -4, 0 }, { -2, -3, 21, 60, 49, 7, -4, 0 },
295 : { -1, -4, 18, 59, 51, 9, -4, 0 }, { -1, -4, 16, 57, 53, 12, -4, -1 },
296 : { -1, -4, 14, 55, 55, 14, -4, -1 }, { -1, -4, 12, 53, 57, 16, -4, -1 },
297 : { 0, -4, 9, 51, 59, 18, -4, -1 }, { 0, -4, 7, 49, 60, 21, -3, -2 },
298 : { 0, -4, 5, 46, 62, 24, -3, -2 }, { 0, -4, 4, 43, 63, 26, -2, -2 },
299 : { 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 1, 38, 64, 32, -1, -3 }
300 : #endif
301 : };
302 : #endif // USE_EXTRA_FILTER
303 :
304 : #if CONFIG_EXT_INTRA
305 : #if CONFIG_INTRA_INTERP
306 : const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
307 : bilinear_filters, // INTRA_FILTER_LINEAR
308 : sub_pel_filters_8, // INTRA_FILTER_8TAP
309 : sub_pel_filters_8sharp, // INTRA_FILTER_8TAP_SHARP
310 : sub_pel_filters_8smooth, // INTRA_FILTER_8TAP_SMOOTH
311 : };
312 : #endif // CONFIG_INTRA_INTERP
313 : #endif // CONFIG_EXT_INTRA
314 :
315 : #if USE_EXTRA_FILTER
316 : static const InterpFilterParams
317 : av1_interp_filter_params_list[SWITCHABLE_FILTERS + EXTRA_FILTERS] = {
318 : { (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
319 : EIGHTTAP_REGULAR },
320 : { (const int16_t *)sub_pel_filters_8smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
321 : EIGHTTAP_SMOOTH },
322 : #if USE_12TAP_FILTER
323 : { (const int16_t *)sub_pel_filters_10sharp, 12, SUBPEL_SHIFTS,
324 : MULTITAP_SHARP },
325 : #else
326 : { (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
327 : EIGHTTAP_SHARP },
328 : #endif
329 : { (const int16_t *)sub_pel_filters_8smooth2, SUBPEL_TAPS, SUBPEL_SHIFTS,
330 : EIGHTTAP_SMOOTH2 },
331 : { (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
332 : BILINEAR },
333 : { (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
334 : EIGHTTAP_SHARP },
335 : { (const int16_t *)sub_pel_filters_regular_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
336 : FILTER_REGULAR_UV },
337 : { (const int16_t *)sub_pel_filters_smooth_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
338 : FILTER_SMOOTH_UV },
339 : { (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
340 : FILTER_SHARP_UV },
341 : { (const int16_t *)sub_pel_filters_smooth2_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
342 : FILTER_SMOOTH2_UV },
343 : };
344 : #else
345 : static const InterpFilterParams
346 : av1_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = {
347 : { (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
348 : EIGHTTAP_REGULAR },
349 : { (const int16_t *)sub_pel_filters_8smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
350 : EIGHTTAP_SMOOTH },
351 : { (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
352 : MULTITAP_SHARP },
353 : { (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
354 : BILINEAR }
355 : };
356 : #endif // USE_EXTRA_FILTER
357 :
358 : #if USE_TEMPORALFILTER_12TAP
359 : static const InterpFilterParams av1_interp_temporalfilter_12tap = {
360 : (const int16_t *)sub_pel_filters_temporalfilter_12, 12, SUBPEL_SHIFTS,
361 : TEMPORALFILTER_12TAP
362 : };
363 : #endif // USE_TEMPORALFILTER_12TAP
364 :
365 0 : InterpFilterParams av1_get_interp_filter_params(
366 : const InterpFilter interp_filter) {
367 : #if USE_TEMPORALFILTER_12TAP
368 0 : if (interp_filter == TEMPORALFILTER_12TAP)
369 0 : return av1_interp_temporalfilter_12tap;
370 : #endif // USE_TEMPORALFILTER_12TAP
371 0 : return av1_interp_filter_params_list[interp_filter];
372 : }
373 :
374 0 : const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
375 : #if USE_TEMPORALFILTER_12TAP
376 0 : if (interp_filter == TEMPORALFILTER_12TAP)
377 0 : return av1_interp_temporalfilter_12tap.filter_ptr;
378 : #endif // USE_TEMPORALFILTER_12TAP
379 0 : return (const int16_t *)av1_interp_filter_params_list[interp_filter]
380 : .filter_ptr;
381 : }
382 :
383 : #if CONFIG_DUAL_FILTER
384 0 : InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
385 : int plane) {
386 : #if USE_TEMPORALFILTER_12TAP
387 : #if USE_EXTRA_FILTER
388 : assert(interp_filter <= EIGHTTAP_SHARP ||
389 : interp_filter == TEMPORALFILTER_12TAP);
390 : #else // USE_EXTRA_FILTER
391 0 : assert(interp_filter <= SWITCHABLE_FILTERS ||
392 : interp_filter == TEMPORALFILTER_12TAP);
393 : #endif // USE_EXTRA_FILTER
394 : #else
395 : assert(interp_filter <= EIGHTTAP_SHARP);
396 : #endif
397 : #if USE_EXTRA_FILTER
398 : if (plane == 0) {
399 : return interp_filter;
400 : } else {
401 : switch (interp_filter) {
402 : case EIGHTTAP_REGULAR: return FILTER_REGULAR_UV;
403 : case EIGHTTAP_SMOOTH: return FILTER_SMOOTH_UV;
404 : case MULTITAP_SHARP: return FILTER_SHARP_UV;
405 : case EIGHTTAP_SMOOTH2: return FILTER_SMOOTH2_UV;
406 : default: return interp_filter;
407 : }
408 : }
409 : #else // USE_EXTRA_FILTER
410 : (void)plane;
411 0 : return interp_filter;
412 : #endif // USE_EXTRA_FILTER
413 : }
414 : #endif
|