1 // Copyright 2021 The libgav1 Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "src/dsp/intrapred_cfl.h"
16
17 #include <algorithm>
18 #include <cassert>
19 #include <cstddef>
20 #include <cstdint>
21 #include <cstdlib>
22 #include <cstring>
23
24 #include "src/dsp/constants.h"
25 #include "src/dsp/dsp.h"
26 #include "src/utils/common.h"
27 #include "src/utils/constants.h"
28
29 namespace libgav1 {
30 namespace dsp {
31 namespace {
32
33 constexpr TransformSize kTransformSizesLargerThan32x32[] = {
34 kTransformSize16x64, kTransformSize32x64, kTransformSize64x16,
35 kTransformSize64x32, kTransformSize64x64};
36
37 //------------------------------------------------------------------------------
38 // CflIntraPredictor_C
39
40 // |luma| can be within +/-(((1 << bitdepth) - 1) << 3), inclusive.
41 // |alpha| can be -16 to 16 (inclusive).
42 template <int block_width, int block_height, int bitdepth, typename Pixel>
CflIntraPredictor_C(void * LIBGAV1_RESTRICT const dest,ptrdiff_t stride,const int16_t luma[kCflLumaBufferStride][kCflLumaBufferStride],const int alpha)43 void CflIntraPredictor_C(
44 void* LIBGAV1_RESTRICT const dest, ptrdiff_t stride,
45 const int16_t luma[kCflLumaBufferStride][kCflLumaBufferStride],
46 const int alpha) {
47 auto* dst = static_cast<Pixel*>(dest);
48 const int dc = dst[0];
49 stride /= sizeof(Pixel);
50 const int max_value = (1 << bitdepth) - 1;
51 for (int y = 0; y < block_height; ++y) {
52 for (int x = 0; x < block_width; ++x) {
53 assert(luma[y][x] >= -(((1 << bitdepth) - 1) << 3));
54 assert(luma[y][x] <= ((1 << bitdepth) - 1) << 3);
55 dst[x] = Clip3(dc + RightShiftWithRoundingSigned(alpha * luma[y][x], 6),
56 0, max_value);
57 }
58 dst += stride;
59 }
60 }
61
62 //------------------------------------------------------------------------------
63 // CflSubsampler_C
64
65 template <int block_width, int block_height, int bitdepth, typename Pixel,
66 int subsampling_x, int subsampling_y>
CflSubsampler_C(int16_t luma[kCflLumaBufferStride][kCflLumaBufferStride],const int max_luma_width,const int max_luma_height,const void * LIBGAV1_RESTRICT const source,ptrdiff_t stride)67 void CflSubsampler_C(int16_t luma[kCflLumaBufferStride][kCflLumaBufferStride],
68 const int max_luma_width, const int max_luma_height,
69 const void* LIBGAV1_RESTRICT const source,
70 ptrdiff_t stride) {
71 assert(max_luma_width >= 4);
72 assert(max_luma_height >= 4);
73 const auto* src = static_cast<const Pixel*>(source);
74 stride /= sizeof(Pixel);
75 int sum = 0;
76 for (int y = 0; y < block_height; ++y) {
77 for (int x = 0; x < block_width; ++x) {
78 const ptrdiff_t luma_x =
79 std::min(x << subsampling_x, max_luma_width - (1 << subsampling_x));
80 const ptrdiff_t luma_x_next = luma_x + stride;
81 luma[y][x] =
82 (src[luma_x] + ((subsampling_x != 0) ? src[luma_x + 1] : 0) +
83 ((subsampling_y != 0) ? (src[luma_x_next] + src[luma_x_next + 1])
84 : 0))
85 << (3 - subsampling_x - subsampling_y);
86 sum += luma[y][x];
87 }
88 if ((y << subsampling_y) < (max_luma_height - (1 << subsampling_y))) {
89 src += stride << subsampling_y;
90 }
91 }
92 const int average = RightShiftWithRounding(
93 sum, FloorLog2(block_width) + FloorLog2(block_height));
94 for (int y = 0; y < block_height; ++y) {
95 for (int x = 0; x < block_width; ++x) {
96 luma[y][x] -= average;
97 }
98 }
99 }
100
101 //------------------------------------------------------------------------------
102
103 // Initializes dsp entries for kTransformSize|W|x|H|.
104 #define INIT_CFL_INTRAPREDICTOR_WxH(W, H, BITDEPTH, PIXEL) \
105 dsp->cfl_intra_predictors[kTransformSize##W##x##H] = \
106 CflIntraPredictor_C<W, H, BITDEPTH, PIXEL>; \
107 dsp->cfl_subsamplers[kTransformSize##W##x##H][kSubsamplingType444] = \
108 CflSubsampler_C<W, H, BITDEPTH, PIXEL, 0, 0>; \
109 dsp->cfl_subsamplers[kTransformSize##W##x##H][kSubsamplingType422] = \
110 CflSubsampler_C<W, H, BITDEPTH, PIXEL, 1, 0>; \
111 dsp->cfl_subsamplers[kTransformSize##W##x##H][kSubsamplingType420] = \
112 CflSubsampler_C<W, H, BITDEPTH, PIXEL, 1, 1>
113
114 #define INIT_CFL_INTRAPREDICTORS(BITDEPTH, PIXEL) \
115 INIT_CFL_INTRAPREDICTOR_WxH(4, 4, BITDEPTH, PIXEL); \
116 INIT_CFL_INTRAPREDICTOR_WxH(4, 8, BITDEPTH, PIXEL); \
117 INIT_CFL_INTRAPREDICTOR_WxH(4, 16, BITDEPTH, PIXEL); \
118 INIT_CFL_INTRAPREDICTOR_WxH(8, 4, BITDEPTH, PIXEL); \
119 INIT_CFL_INTRAPREDICTOR_WxH(8, 8, BITDEPTH, PIXEL); \
120 INIT_CFL_INTRAPREDICTOR_WxH(8, 16, BITDEPTH, PIXEL); \
121 INIT_CFL_INTRAPREDICTOR_WxH(8, 32, BITDEPTH, PIXEL); \
122 INIT_CFL_INTRAPREDICTOR_WxH(16, 4, BITDEPTH, PIXEL); \
123 INIT_CFL_INTRAPREDICTOR_WxH(16, 8, BITDEPTH, PIXEL); \
124 INIT_CFL_INTRAPREDICTOR_WxH(16, 16, BITDEPTH, PIXEL); \
125 INIT_CFL_INTRAPREDICTOR_WxH(16, 32, BITDEPTH, PIXEL); \
126 INIT_CFL_INTRAPREDICTOR_WxH(32, 8, BITDEPTH, PIXEL); \
127 INIT_CFL_INTRAPREDICTOR_WxH(32, 16, BITDEPTH, PIXEL); \
128 INIT_CFL_INTRAPREDICTOR_WxH(32, 32, BITDEPTH, PIXEL)
129
Init8bpp()130 void Init8bpp() {
131 Dsp* const dsp = dsp_internal::GetWritableDspTable(8);
132 assert(dsp != nullptr);
133 #if LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
134 INIT_CFL_INTRAPREDICTORS(8, uint8_t);
135 #else // !LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
136 static_cast<void>(dsp);
137 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x4_CflIntraPredictor
138 dsp->cfl_intra_predictors[kTransformSize4x4] =
139 CflIntraPredictor_C<4, 4, 8, uint8_t>;
140 #endif
141 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x4_CflSubsampler444
142 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType444] =
143 CflSubsampler_C<4, 4, 8, uint8_t, 0, 0>;
144 #endif
145 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x4_CflSubsampler422
146 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType422] =
147 CflSubsampler_C<4, 4, 8, uint8_t, 1, 0>;
148 #endif
149 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x4_CflSubsampler420
150 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType420] =
151 CflSubsampler_C<4, 4, 8, uint8_t, 1, 1>;
152 #endif
153
154 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x8_CflIntraPredictor
155 dsp->cfl_intra_predictors[kTransformSize4x8] =
156 CflIntraPredictor_C<4, 8, 8, uint8_t>;
157 #endif
158 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x8_CflSubsampler444
159 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType444] =
160 CflSubsampler_C<4, 8, 8, uint8_t, 0, 0>;
161 #endif
162 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x8_CflSubsampler422
163 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType422] =
164 CflSubsampler_C<4, 8, 8, uint8_t, 1, 0>;
165 #endif
166 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x8_CflSubsampler420
167 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType420] =
168 CflSubsampler_C<4, 8, 8, uint8_t, 1, 1>;
169 #endif
170
171 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x16_CflIntraPredictor
172 dsp->cfl_intra_predictors[kTransformSize4x16] =
173 CflIntraPredictor_C<4, 16, 8, uint8_t>;
174 #endif
175 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x16_CflSubsampler444
176 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType444] =
177 CflSubsampler_C<4, 16, 8, uint8_t, 0, 0>;
178 #endif
179 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x16_CflSubsampler422
180 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType422] =
181 CflSubsampler_C<4, 16, 8, uint8_t, 1, 0>;
182 #endif
183 #ifndef LIBGAV1_Dsp8bpp_TransformSize4x16_CflSubsampler420
184 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType420] =
185 CflSubsampler_C<4, 16, 8, uint8_t, 1, 1>;
186 #endif
187
188 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x4_CflIntraPredictor
189 dsp->cfl_intra_predictors[kTransformSize8x4] =
190 CflIntraPredictor_C<8, 4, 8, uint8_t>;
191 #endif
192 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x4_CflSubsampler444
193 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType444] =
194 CflSubsampler_C<8, 4, 8, uint8_t, 0, 0>;
195 #endif
196 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x4_CflSubsampler422
197 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType422] =
198 CflSubsampler_C<8, 4, 8, uint8_t, 1, 0>;
199 #endif
200 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x4_CflSubsampler420
201 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType420] =
202 CflSubsampler_C<8, 4, 8, uint8_t, 1, 1>;
203 #endif
204
205 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x8_CflIntraPredictor
206 dsp->cfl_intra_predictors[kTransformSize8x8] =
207 CflIntraPredictor_C<8, 8, 8, uint8_t>;
208 #endif
209 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x8_CflSubsampler444
210 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType444] =
211 CflSubsampler_C<8, 8, 8, uint8_t, 0, 0>;
212 #endif
213 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x8_CflSubsampler422
214 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType422] =
215 CflSubsampler_C<8, 8, 8, uint8_t, 1, 0>;
216 #endif
217 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x8_CflSubsampler420
218 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType420] =
219 CflSubsampler_C<8, 8, 8, uint8_t, 1, 1>;
220 #endif
221
222 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x16_CflIntraPredictor
223 dsp->cfl_intra_predictors[kTransformSize8x16] =
224 CflIntraPredictor_C<8, 16, 8, uint8_t>;
225 #endif
226 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x16_CflSubsampler444
227 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType444] =
228 CflSubsampler_C<8, 16, 8, uint8_t, 0, 0>;
229 #endif
230 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x16_CflSubsampler422
231 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType422] =
232 CflSubsampler_C<8, 16, 8, uint8_t, 1, 0>;
233 #endif
234 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x16_CflSubsampler420
235 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType420] =
236 CflSubsampler_C<8, 16, 8, uint8_t, 1, 1>;
237 #endif
238
239 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x32_CflIntraPredictor
240 dsp->cfl_intra_predictors[kTransformSize8x32] =
241 CflIntraPredictor_C<8, 32, 8, uint8_t>;
242 #endif
243 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x32_CflSubsampler444
244 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType444] =
245 CflSubsampler_C<8, 32, 8, uint8_t, 0, 0>;
246 #endif
247 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x32_CflSubsampler422
248 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType422] =
249 CflSubsampler_C<8, 32, 8, uint8_t, 1, 0>;
250 #endif
251 #ifndef LIBGAV1_Dsp8bpp_TransformSize8x32_CflSubsampler420
252 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType420] =
253 CflSubsampler_C<8, 32, 8, uint8_t, 1, 1>;
254 #endif
255
256 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x4_CflIntraPredictor
257 dsp->cfl_intra_predictors[kTransformSize16x4] =
258 CflIntraPredictor_C<16, 4, 8, uint8_t>;
259 #endif
260 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x4_CflSubsampler444
261 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType444] =
262 CflSubsampler_C<16, 4, 8, uint8_t, 0, 0>;
263 #endif
264 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x4_CflSubsampler422
265 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType422] =
266 CflSubsampler_C<16, 4, 8, uint8_t, 1, 0>;
267 #endif
268 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x4_CflSubsampler420
269 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType420] =
270 CflSubsampler_C<16, 4, 8, uint8_t, 1, 1>;
271 #endif
272
273 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x8_CflIntraPredictor
274 dsp->cfl_intra_predictors[kTransformSize16x8] =
275 CflIntraPredictor_C<16, 8, 8, uint8_t>;
276 #endif
277 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x8_CflSubsampler444
278 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType444] =
279 CflSubsampler_C<16, 8, 8, uint8_t, 0, 0>;
280 #endif
281 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x8_CflSubsampler422
282 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType422] =
283 CflSubsampler_C<16, 8, 8, uint8_t, 1, 0>;
284 #endif
285 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x8_CflSubsampler420
286 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType420] =
287 CflSubsampler_C<16, 8, 8, uint8_t, 1, 1>;
288 #endif
289
290 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x16_CflIntraPredictor
291 dsp->cfl_intra_predictors[kTransformSize16x16] =
292 CflIntraPredictor_C<16, 16, 8, uint8_t>;
293 #endif
294 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x16_CflSubsampler444
295 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType444] =
296 CflSubsampler_C<16, 16, 8, uint8_t, 0, 0>;
297 #endif
298 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x16_CflSubsampler422
299 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType422] =
300 CflSubsampler_C<16, 16, 8, uint8_t, 1, 0>;
301 #endif
302 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x16_CflSubsampler420
303 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType420] =
304 CflSubsampler_C<16, 16, 8, uint8_t, 1, 1>;
305 #endif
306
307 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x32_CflIntraPredictor
308 dsp->cfl_intra_predictors[kTransformSize16x32] =
309 CflIntraPredictor_C<16, 32, 8, uint8_t>;
310 #endif
311 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x32_CflSubsampler444
312 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType444] =
313 CflSubsampler_C<16, 32, 8, uint8_t, 0, 0>;
314 #endif
315 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x32_CflSubsampler422
316 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType422] =
317 CflSubsampler_C<16, 32, 8, uint8_t, 1, 0>;
318 #endif
319 #ifndef LIBGAV1_Dsp8bpp_TransformSize16x32_CflSubsampler420
320 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType420] =
321 CflSubsampler_C<16, 32, 8, uint8_t, 1, 1>;
322 #endif
323
324 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x8_CflIntraPredictor
325 dsp->cfl_intra_predictors[kTransformSize32x8] =
326 CflIntraPredictor_C<32, 8, 8, uint8_t>;
327 #endif
328 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x8_CflSubsampler444
329 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType444] =
330 CflSubsampler_C<32, 8, 8, uint8_t, 0, 0>;
331 #endif
332 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x8_CflSubsampler422
333 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType422] =
334 CflSubsampler_C<32, 8, 8, uint8_t, 1, 0>;
335 #endif
336 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x8_CflSubsampler420
337 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType420] =
338 CflSubsampler_C<32, 8, 8, uint8_t, 1, 1>;
339 #endif
340
341 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x16_CflIntraPredictor
342 dsp->cfl_intra_predictors[kTransformSize32x16] =
343 CflIntraPredictor_C<32, 16, 8, uint8_t>;
344 #endif
345 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x16_CflSubsampler444
346 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType444] =
347 CflSubsampler_C<32, 16, 8, uint8_t, 0, 0>;
348 #endif
349 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x16_CflSubsampler422
350 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType422] =
351 CflSubsampler_C<32, 16, 8, uint8_t, 1, 0>;
352 #endif
353 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x16_CflSubsampler420
354 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType420] =
355 CflSubsampler_C<32, 16, 8, uint8_t, 1, 1>;
356 #endif
357
358 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x32_CflIntraPredictor
359 dsp->cfl_intra_predictors[kTransformSize32x32] =
360 CflIntraPredictor_C<32, 32, 8, uint8_t>;
361 #endif
362 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x32_CflSubsampler444
363 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType444] =
364 CflSubsampler_C<32, 32, 8, uint8_t, 0, 0>;
365 #endif
366 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x32_CflSubsampler422
367 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType422] =
368 CflSubsampler_C<32, 32, 8, uint8_t, 1, 0>;
369 #endif
370 #ifndef LIBGAV1_Dsp8bpp_TransformSize32x32_CflSubsampler420
371 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType420] =
372 CflSubsampler_C<32, 32, 8, uint8_t, 1, 1>;
373 #endif
374 #endif // LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
375 // Cfl predictors are available only for transform sizes with max(width,
376 // height) <= 32. Set all others to nullptr.
377 for (const auto i : kTransformSizesLargerThan32x32) {
378 dsp->cfl_intra_predictors[i] = nullptr;
379 for (int j = 0; j < kNumSubsamplingTypes; ++j) {
380 dsp->cfl_subsamplers[i][j] = nullptr;
381 }
382 }
383 } // NOLINT(readability/fn_size)
384
385 #if LIBGAV1_MAX_BITDEPTH >= 10
Init10bpp()386 void Init10bpp() {
387 Dsp* const dsp = dsp_internal::GetWritableDspTable(10);
388 assert(dsp != nullptr);
389 #if LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
390 INIT_CFL_INTRAPREDICTORS(10, uint16_t);
391 #else // !LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
392 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x4_CflIntraPredictor
393 dsp->cfl_intra_predictors[kTransformSize4x4] =
394 CflIntraPredictor_C<4, 4, 10, uint16_t>;
395 #endif
396 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x4_CflSubsampler444
397 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType444] =
398 CflSubsampler_C<4, 4, 10, uint16_t, 0, 0>;
399 #endif
400 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x4_CflSubsampler422
401 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType422] =
402 CflSubsampler_C<4, 4, 10, uint16_t, 1, 0>;
403 #endif
404 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x4_CflSubsampler420
405 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType420] =
406 CflSubsampler_C<4, 4, 10, uint16_t, 1, 1>;
407 #endif
408
409 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x8_CflIntraPredictor
410 dsp->cfl_intra_predictors[kTransformSize4x8] =
411 CflIntraPredictor_C<4, 8, 10, uint16_t>;
412 #endif
413 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x8_CflSubsampler444
414 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType444] =
415 CflSubsampler_C<4, 8, 10, uint16_t, 0, 0>;
416 #endif
417 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x8_CflSubsampler422
418 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType422] =
419 CflSubsampler_C<4, 8, 10, uint16_t, 1, 0>;
420 #endif
421 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x8_CflSubsampler420
422 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType420] =
423 CflSubsampler_C<4, 8, 10, uint16_t, 1, 1>;
424 #endif
425
426 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x16_CflIntraPredictor
427 dsp->cfl_intra_predictors[kTransformSize4x16] =
428 CflIntraPredictor_C<4, 16, 10, uint16_t>;
429 #endif
430 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x16_CflSubsampler444
431 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType444] =
432 CflSubsampler_C<4, 16, 10, uint16_t, 0, 0>;
433 #endif
434 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x16_CflSubsampler422
435 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType422] =
436 CflSubsampler_C<4, 16, 10, uint16_t, 1, 0>;
437 #endif
438 #ifndef LIBGAV1_Dsp10bpp_TransformSize4x16_CflSubsampler420
439 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType420] =
440 CflSubsampler_C<4, 16, 10, uint16_t, 1, 1>;
441 #endif
442
443 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x4_CflIntraPredictor
444 dsp->cfl_intra_predictors[kTransformSize8x4] =
445 CflIntraPredictor_C<8, 4, 10, uint16_t>;
446 #endif
447 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x4_CflSubsampler444
448 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType444] =
449 CflSubsampler_C<8, 4, 10, uint16_t, 0, 0>;
450 #endif
451 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x4_CflSubsampler422
452 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType422] =
453 CflSubsampler_C<8, 4, 10, uint16_t, 1, 0>;
454 #endif
455 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x4_CflSubsampler420
456 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType420] =
457 CflSubsampler_C<8, 4, 10, uint16_t, 1, 1>;
458 #endif
459
460 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x8_CflIntraPredictor
461 dsp->cfl_intra_predictors[kTransformSize8x8] =
462 CflIntraPredictor_C<8, 8, 10, uint16_t>;
463 #endif
464 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x8_CflSubsampler444
465 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType444] =
466 CflSubsampler_C<8, 8, 10, uint16_t, 0, 0>;
467 #endif
468 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x8_CflSubsampler422
469 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType422] =
470 CflSubsampler_C<8, 8, 10, uint16_t, 1, 0>;
471 #endif
472 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x8_CflSubsampler420
473 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType420] =
474 CflSubsampler_C<8, 8, 10, uint16_t, 1, 1>;
475 #endif
476
477 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x16_CflIntraPredictor
478 dsp->cfl_intra_predictors[kTransformSize8x16] =
479 CflIntraPredictor_C<8, 16, 10, uint16_t>;
480 #endif
481 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x16_CflSubsampler444
482 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType444] =
483 CflSubsampler_C<8, 16, 10, uint16_t, 0, 0>;
484 #endif
485 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x16_CflSubsampler422
486 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType422] =
487 CflSubsampler_C<8, 16, 10, uint16_t, 1, 0>;
488 #endif
489 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x16_CflSubsampler420
490 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType420] =
491 CflSubsampler_C<8, 16, 10, uint16_t, 1, 1>;
492 #endif
493
494 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x32_CflIntraPredictor
495 dsp->cfl_intra_predictors[kTransformSize8x32] =
496 CflIntraPredictor_C<8, 32, 10, uint16_t>;
497 #endif
498 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x32_CflSubsampler444
499 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType444] =
500 CflSubsampler_C<8, 32, 10, uint16_t, 0, 0>;
501 #endif
502 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x32_CflSubsampler422
503 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType422] =
504 CflSubsampler_C<8, 32, 10, uint16_t, 1, 0>;
505 #endif
506 #ifndef LIBGAV1_Dsp10bpp_TransformSize8x32_CflSubsampler420
507 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType420] =
508 CflSubsampler_C<8, 32, 10, uint16_t, 1, 1>;
509 #endif
510
511 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x4_CflIntraPredictor
512 dsp->cfl_intra_predictors[kTransformSize16x4] =
513 CflIntraPredictor_C<16, 4, 10, uint16_t>;
514 #endif
515 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x4_CflSubsampler444
516 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType444] =
517 CflSubsampler_C<16, 4, 10, uint16_t, 0, 0>;
518 #endif
519 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x4_CflSubsampler422
520 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType422] =
521 CflSubsampler_C<16, 4, 10, uint16_t, 1, 0>;
522 #endif
523 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x4_CflSubsampler420
524 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType420] =
525 CflSubsampler_C<16, 4, 10, uint16_t, 1, 1>;
526 #endif
527
528 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x8_CflIntraPredictor
529 dsp->cfl_intra_predictors[kTransformSize16x8] =
530 CflIntraPredictor_C<16, 8, 10, uint16_t>;
531 #endif
532 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x8_CflSubsampler444
533 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType444] =
534 CflSubsampler_C<16, 8, 10, uint16_t, 0, 0>;
535 #endif
536 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x8_CflSubsampler422
537 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType422] =
538 CflSubsampler_C<16, 8, 10, uint16_t, 1, 0>;
539 #endif
540 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x8_CflSubsampler420
541 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType420] =
542 CflSubsampler_C<16, 8, 10, uint16_t, 1, 1>;
543 #endif
544
545 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x16_CflIntraPredictor
546 dsp->cfl_intra_predictors[kTransformSize16x16] =
547 CflIntraPredictor_C<16, 16, 10, uint16_t>;
548 #endif
549 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x16_CflSubsampler444
550 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType444] =
551 CflSubsampler_C<16, 16, 10, uint16_t, 0, 0>;
552 #endif
553 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x16_CflSubsampler422
554 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType422] =
555 CflSubsampler_C<16, 16, 10, uint16_t, 1, 0>;
556 #endif
557 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x16_CflSubsampler420
558 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType420] =
559 CflSubsampler_C<16, 16, 10, uint16_t, 1, 1>;
560 #endif
561
562 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x32_CflIntraPredictor
563 dsp->cfl_intra_predictors[kTransformSize16x32] =
564 CflIntraPredictor_C<16, 32, 10, uint16_t>;
565 #endif
566 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x32_CflSubsampler444
567 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType444] =
568 CflSubsampler_C<16, 32, 10, uint16_t, 0, 0>;
569 #endif
570 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x32_CflSubsampler422
571 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType422] =
572 CflSubsampler_C<16, 32, 10, uint16_t, 1, 0>;
573 #endif
574 #ifndef LIBGAV1_Dsp10bpp_TransformSize16x32_CflSubsampler420
575 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType420] =
576 CflSubsampler_C<16, 32, 10, uint16_t, 1, 1>;
577 #endif
578
579 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x8_CflIntraPredictor
580 dsp->cfl_intra_predictors[kTransformSize32x8] =
581 CflIntraPredictor_C<32, 8, 10, uint16_t>;
582 #endif
583 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x8_CflSubsampler444
584 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType444] =
585 CflSubsampler_C<32, 8, 10, uint16_t, 0, 0>;
586 #endif
587 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x8_CflSubsampler422
588 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType422] =
589 CflSubsampler_C<32, 8, 10, uint16_t, 1, 0>;
590 #endif
591 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x8_CflSubsampler420
592 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType420] =
593 CflSubsampler_C<32, 8, 10, uint16_t, 1, 1>;
594 #endif
595
596 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x16_CflIntraPredictor
597 dsp->cfl_intra_predictors[kTransformSize32x16] =
598 CflIntraPredictor_C<32, 16, 10, uint16_t>;
599 #endif
600 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x16_CflSubsampler444
601 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType444] =
602 CflSubsampler_C<32, 16, 10, uint16_t, 0, 0>;
603 #endif
604 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x16_CflSubsampler422
605 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType422] =
606 CflSubsampler_C<32, 16, 10, uint16_t, 1, 0>;
607 #endif
608 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x16_CflSubsampler420
609 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType420] =
610 CflSubsampler_C<32, 16, 10, uint16_t, 1, 1>;
611 #endif
612
613 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x32_CflIntraPredictor
614 dsp->cfl_intra_predictors[kTransformSize32x32] =
615 CflIntraPredictor_C<32, 32, 10, uint16_t>;
616 #endif
617 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x32_CflSubsampler444
618 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType444] =
619 CflSubsampler_C<32, 32, 10, uint16_t, 0, 0>;
620 #endif
621 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x32_CflSubsampler422
622 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType422] =
623 CflSubsampler_C<32, 32, 10, uint16_t, 1, 0>;
624 #endif
625 #ifndef LIBGAV1_Dsp10bpp_TransformSize32x32_CflSubsampler420
626 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType420] =
627 CflSubsampler_C<32, 32, 10, uint16_t, 1, 1>;
628 #endif
629
630 #endif // LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
631 // Cfl predictors are available only for transform sizes with max(width,
632 // height) <= 32. Set all others to nullptr.
633 for (const auto i : kTransformSizesLargerThan32x32) {
634 dsp->cfl_intra_predictors[i] = nullptr;
635 for (int j = 0; j < kNumSubsamplingTypes; ++j) {
636 dsp->cfl_subsamplers[i][j] = nullptr;
637 }
638 }
639 } // NOLINT(readability/fn_size)
640 #endif // LIBGAV1_MAX_BITDEPTH >= 10
641
642 #if LIBGAV1_MAX_BITDEPTH == 12
Init12bpp()643 void Init12bpp() {
644 Dsp* const dsp = dsp_internal::GetWritableDspTable(12);
645 assert(dsp != nullptr);
646 #if LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
647 INIT_CFL_INTRAPREDICTORS(12, uint16_t);
648 #else // !LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
649 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x4_CflIntraPredictor
650 dsp->cfl_intra_predictors[kTransformSize4x4] =
651 CflIntraPredictor_C<4, 4, 12, uint16_t>;
652 #endif
653 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x4_CflSubsampler444
654 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType444] =
655 CflSubsampler_C<4, 4, 12, uint16_t, 0, 0>;
656 #endif
657 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x4_CflSubsampler422
658 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType422] =
659 CflSubsampler_C<4, 4, 12, uint16_t, 1, 0>;
660 #endif
661 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x4_CflSubsampler420
662 dsp->cfl_subsamplers[kTransformSize4x4][kSubsamplingType420] =
663 CflSubsampler_C<4, 4, 12, uint16_t, 1, 1>;
664 #endif
665
666 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x8_CflIntraPredictor
667 dsp->cfl_intra_predictors[kTransformSize4x8] =
668 CflIntraPredictor_C<4, 8, 12, uint16_t>;
669 #endif
670 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x8_CflSubsampler444
671 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType444] =
672 CflSubsampler_C<4, 8, 12, uint16_t, 0, 0>;
673 #endif
674 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x8_CflSubsampler422
675 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType422] =
676 CflSubsampler_C<4, 8, 12, uint16_t, 1, 0>;
677 #endif
678 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x8_CflSubsampler420
679 dsp->cfl_subsamplers[kTransformSize4x8][kSubsamplingType420] =
680 CflSubsampler_C<4, 8, 12, uint16_t, 1, 1>;
681 #endif
682
683 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x16_CflIntraPredictor
684 dsp->cfl_intra_predictors[kTransformSize4x16] =
685 CflIntraPredictor_C<4, 16, 12, uint16_t>;
686 #endif
687 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x16_CflSubsampler444
688 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType444] =
689 CflSubsampler_C<4, 16, 12, uint16_t, 0, 0>;
690 #endif
691 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x16_CflSubsampler422
692 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType422] =
693 CflSubsampler_C<4, 16, 12, uint16_t, 1, 0>;
694 #endif
695 #ifndef LIBGAV1_Dsp12bpp_TransformSize4x16_CflSubsampler420
696 dsp->cfl_subsamplers[kTransformSize4x16][kSubsamplingType420] =
697 CflSubsampler_C<4, 16, 12, uint16_t, 1, 1>;
698 #endif
699
700 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x4_CflIntraPredictor
701 dsp->cfl_intra_predictors[kTransformSize8x4] =
702 CflIntraPredictor_C<8, 4, 12, uint16_t>;
703 #endif
704 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x4_CflSubsampler444
705 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType444] =
706 CflSubsampler_C<8, 4, 12, uint16_t, 0, 0>;
707 #endif
708 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x4_CflSubsampler422
709 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType422] =
710 CflSubsampler_C<8, 4, 12, uint16_t, 1, 0>;
711 #endif
712 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x4_CflSubsampler420
713 dsp->cfl_subsamplers[kTransformSize8x4][kSubsamplingType420] =
714 CflSubsampler_C<8, 4, 12, uint16_t, 1, 1>;
715 #endif
716
717 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x8_CflIntraPredictor
718 dsp->cfl_intra_predictors[kTransformSize8x8] =
719 CflIntraPredictor_C<8, 8, 12, uint16_t>;
720 #endif
721 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x8_CflSubsampler444
722 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType444] =
723 CflSubsampler_C<8, 8, 12, uint16_t, 0, 0>;
724 #endif
725 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x8_CflSubsampler422
726 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType422] =
727 CflSubsampler_C<8, 8, 12, uint16_t, 1, 0>;
728 #endif
729 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x8_CflSubsampler420
730 dsp->cfl_subsamplers[kTransformSize8x8][kSubsamplingType420] =
731 CflSubsampler_C<8, 8, 12, uint16_t, 1, 1>;
732 #endif
733
734 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x16_CflIntraPredictor
735 dsp->cfl_intra_predictors[kTransformSize8x16] =
736 CflIntraPredictor_C<8, 16, 12, uint16_t>;
737 #endif
738 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x16_CflSubsampler444
739 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType444] =
740 CflSubsampler_C<8, 16, 12, uint16_t, 0, 0>;
741 #endif
742 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x16_CflSubsampler422
743 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType422] =
744 CflSubsampler_C<8, 16, 12, uint16_t, 1, 0>;
745 #endif
746 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x16_CflSubsampler420
747 dsp->cfl_subsamplers[kTransformSize8x16][kSubsamplingType420] =
748 CflSubsampler_C<8, 16, 12, uint16_t, 1, 1>;
749 #endif
750
751 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x32_CflIntraPredictor
752 dsp->cfl_intra_predictors[kTransformSize8x32] =
753 CflIntraPredictor_C<8, 32, 12, uint16_t>;
754 #endif
755 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x32_CflSubsampler444
756 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType444] =
757 CflSubsampler_C<8, 32, 12, uint16_t, 0, 0>;
758 #endif
759 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x32_CflSubsampler422
760 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType422] =
761 CflSubsampler_C<8, 32, 12, uint16_t, 1, 0>;
762 #endif
763 #ifndef LIBGAV1_Dsp12bpp_TransformSize8x32_CflSubsampler420
764 dsp->cfl_subsamplers[kTransformSize8x32][kSubsamplingType420] =
765 CflSubsampler_C<8, 32, 12, uint16_t, 1, 1>;
766 #endif
767
768 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x4_CflIntraPredictor
769 dsp->cfl_intra_predictors[kTransformSize16x4] =
770 CflIntraPredictor_C<16, 4, 12, uint16_t>;
771 #endif
772 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x4_CflSubsampler444
773 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType444] =
774 CflSubsampler_C<16, 4, 12, uint16_t, 0, 0>;
775 #endif
776 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x4_CflSubsampler422
777 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType422] =
778 CflSubsampler_C<16, 4, 12, uint16_t, 1, 0>;
779 #endif
780 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x4_CflSubsampler420
781 dsp->cfl_subsamplers[kTransformSize16x4][kSubsamplingType420] =
782 CflSubsampler_C<16, 4, 12, uint16_t, 1, 1>;
783 #endif
784
785 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x8_CflIntraPredictor
786 dsp->cfl_intra_predictors[kTransformSize16x8] =
787 CflIntraPredictor_C<16, 8, 12, uint16_t>;
788 #endif
789 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x8_CflSubsampler444
790 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType444] =
791 CflSubsampler_C<16, 8, 12, uint16_t, 0, 0>;
792 #endif
793 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x8_CflSubsampler422
794 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType422] =
795 CflSubsampler_C<16, 8, 12, uint16_t, 1, 0>;
796 #endif
797 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x8_CflSubsampler420
798 dsp->cfl_subsamplers[kTransformSize16x8][kSubsamplingType420] =
799 CflSubsampler_C<16, 8, 12, uint16_t, 1, 1>;
800 #endif
801
802 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x16_CflIntraPredictor
803 dsp->cfl_intra_predictors[kTransformSize16x16] =
804 CflIntraPredictor_C<16, 16, 12, uint16_t>;
805 #endif
806 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x16_CflSubsampler444
807 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType444] =
808 CflSubsampler_C<16, 16, 12, uint16_t, 0, 0>;
809 #endif
810 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x16_CflSubsampler422
811 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType422] =
812 CflSubsampler_C<16, 16, 12, uint16_t, 1, 0>;
813 #endif
814 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x16_CflSubsampler420
815 dsp->cfl_subsamplers[kTransformSize16x16][kSubsamplingType420] =
816 CflSubsampler_C<16, 16, 12, uint16_t, 1, 1>;
817 #endif
818
819 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x32_CflIntraPredictor
820 dsp->cfl_intra_predictors[kTransformSize16x32] =
821 CflIntraPredictor_C<16, 32, 12, uint16_t>;
822 #endif
823 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x32_CflSubsampler444
824 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType444] =
825 CflSubsampler_C<16, 32, 12, uint16_t, 0, 0>;
826 #endif
827 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x32_CflSubsampler422
828 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType422] =
829 CflSubsampler_C<16, 32, 12, uint16_t, 1, 0>;
830 #endif
831 #ifndef LIBGAV1_Dsp12bpp_TransformSize16x32_CflSubsampler420
832 dsp->cfl_subsamplers[kTransformSize16x32][kSubsamplingType420] =
833 CflSubsampler_C<16, 32, 12, uint16_t, 1, 1>;
834 #endif
835
836 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x8_CflIntraPredictor
837 dsp->cfl_intra_predictors[kTransformSize32x8] =
838 CflIntraPredictor_C<32, 8, 12, uint16_t>;
839 #endif
840 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x8_CflSubsampler444
841 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType444] =
842 CflSubsampler_C<32, 8, 12, uint16_t, 0, 0>;
843 #endif
844 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x8_CflSubsampler422
845 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType422] =
846 CflSubsampler_C<32, 8, 12, uint16_t, 1, 0>;
847 #endif
848 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x8_CflSubsampler420
849 dsp->cfl_subsamplers[kTransformSize32x8][kSubsamplingType420] =
850 CflSubsampler_C<32, 8, 12, uint16_t, 1, 1>;
851 #endif
852
853 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x16_CflIntraPredictor
854 dsp->cfl_intra_predictors[kTransformSize32x16] =
855 CflIntraPredictor_C<32, 16, 12, uint16_t>;
856 #endif
857 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x16_CflSubsampler444
858 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType444] =
859 CflSubsampler_C<32, 16, 12, uint16_t, 0, 0>;
860 #endif
861 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x16_CflSubsampler422
862 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType422] =
863 CflSubsampler_C<32, 16, 12, uint16_t, 1, 0>;
864 #endif
865 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x16_CflSubsampler420
866 dsp->cfl_subsamplers[kTransformSize32x16][kSubsamplingType420] =
867 CflSubsampler_C<32, 16, 12, uint16_t, 1, 1>;
868 #endif
869
870 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x32_CflIntraPredictor
871 dsp->cfl_intra_predictors[kTransformSize32x32] =
872 CflIntraPredictor_C<32, 32, 12, uint16_t>;
873 #endif
874 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x32_CflSubsampler444
875 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType444] =
876 CflSubsampler_C<32, 32, 12, uint16_t, 0, 0>;
877 #endif
878 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x32_CflSubsampler422
879 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType422] =
880 CflSubsampler_C<32, 32, 12, uint16_t, 1, 0>;
881 #endif
882 #ifndef LIBGAV1_Dsp12bpp_TransformSize32x32_CflSubsampler420
883 dsp->cfl_subsamplers[kTransformSize32x32][kSubsamplingType420] =
884 CflSubsampler_C<32, 32, 12, uint16_t, 1, 1>;
885 #endif
886
887 #endif // LIBGAV1_ENABLE_ALL_DSP_FUNCTIONS
888 // Cfl predictors are available only for transform sizes with max(width,
889 // height) <= 32. Set all others to nullptr.
890 for (const auto i : kTransformSizesLargerThan32x32) {
891 dsp->cfl_intra_predictors[i] = nullptr;
892 for (int j = 0; j < kNumSubsamplingTypes; ++j) {
893 dsp->cfl_subsamplers[i][j] = nullptr;
894 }
895 }
896 } // NOLINT(readability/fn_size)
897 #endif // LIBGAV1_MAX_BITDEPTH == 12
898
899 #undef INIT_CFL_INTRAPREDICTOR_WxH
900 #undef INIT_CFL_INTRAPREDICTORS
901
902 } // namespace
903
IntraPredCflInit_C()904 void IntraPredCflInit_C() {
905 Init8bpp();
906 #if LIBGAV1_MAX_BITDEPTH >= 10
907 Init10bpp();
908 #endif
909 #if LIBGAV1_MAX_BITDEPTH == 12
910 Init12bpp();
911 #endif
912 }
913
914 } // namespace dsp
915 } // namespace libgav1
916