blob: 07242948f3e44dacb7c0c9c601388797b3505f53 [file] [log] [blame]
Sarah Parkereec47e62017-05-15 20:49:22 -07001/*
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_INV_TXFM2D_CFG_H_
13#define AV1_INV_TXFM2D_CFG_H_
14#include "av1/common/av1_inv_txfm1d.h"
Sarah Parker3eed4172017-05-15 20:49:22 -070015
Angie Chiangce3ad282017-08-08 09:51:54 -070016// sum of fwd_shift_##
Angie Chiangce3ad282017-08-08 09:51:54 -070017#if CONFIG_TX64X64
18static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2, -4 };
19#else // CONFIG_TX64X64
20static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2 };
21#endif // CONFIG_TX64X64
Angie Chiangce3ad282017-08-08 09:51:54 -070022
Sarah Parkereec47e62017-05-15 20:49:22 -070023// ---------------- 4x4 1D config -----------------------
24// shift
25static const int8_t inv_shift_4[2] = { 0, -4 };
26
27// stage range
Angie Chiangce3ad282017-08-08 09:51:54 -070028static const int8_t inv_stage_range_col_dct_4[4] = { 3, 3, 2, 2 };
29static const int8_t inv_stage_range_row_dct_4[4] = { 3, 3, 3, 3 };
30static const int8_t inv_stage_range_col_adst_4[6] = { 3, 3, 3, 3, 2, 2 };
31static const int8_t inv_stage_range_row_adst_4[6] = { 3, 3, 3, 3, 3, 3 };
32static const int8_t inv_stage_range_idx_4[1] = { 0 };
Jingning Han401680b2017-06-19 10:57:21 -070033
Sarah Parkereec47e62017-05-15 20:49:22 -070034// cos bit
35static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
36static const int8_t inv_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
37static const int8_t inv_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
38static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
39
40// ---------------- 8x8 1D constants -----------------------
41// shift
42static const int8_t inv_shift_8[2] = { 0, -5 };
43
44// stage range
Angie Chiangce3ad282017-08-08 09:51:54 -070045static const int8_t inv_stage_range_col_dct_8[6] = { 5, 5, 5, 5, 4, 4 };
46static const int8_t inv_stage_range_row_dct_8[6] = { 5, 5, 5, 5, 5, 5 };
47static const int8_t inv_stage_range_col_adst_8[8] = { 5, 5, 5, 5, 5, 5, 4, 4 };
48static const int8_t inv_stage_range_row_adst_8[8] = { 5, 5, 5, 5, 5, 5, 5, 5 };
49static const int8_t inv_stage_range_idx_8[1] = { 0 };
Jingning Han401680b2017-06-19 10:57:21 -070050
Sarah Parkereec47e62017-05-15 20:49:22 -070051// cos bit
52static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
53static const int8_t inv_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
54static const int8_t inv_cos_bit_col_adst_8[8] = {
55 13, 13, 13, 13, 13, 13, 13, 13
56};
57static const int8_t inv_cos_bit_row_adst_8[8] = {
58 13, 13, 13, 13, 13, 13, 13, 13
59};
60
61// ---------------- 16x16 1D constants -----------------------
62// shift
63static const int8_t inv_shift_16[2] = { -1, -5 };
64
65// stage range
Angie Chiangce3ad282017-08-08 09:51:54 -070066static const int8_t inv_stage_range_col_dct_16[8] = { 7, 7, 7, 7, 7, 7, 6, 6 };
67static const int8_t inv_stage_range_row_dct_16[8] = { 7, 7, 7, 7, 7, 7, 7, 7 };
68static const int8_t inv_stage_range_col_adst_16[10] = { 7, 7, 7, 7, 7,
69 7, 7, 7, 6, 6 };
70static const int8_t inv_stage_range_row_adst_16[10] = { 7, 7, 7, 7, 7,
71 7, 7, 7, 7, 7 };
72static const int8_t inv_stage_range_idx_16[1] = { 0 };
Sarah Parkereec47e62017-05-15 20:49:22 -070073
74// cos bit
75static const int8_t inv_cos_bit_col_dct_16[8] = {
76 13, 13, 13, 13, 13, 13, 13, 13
77};
78static const int8_t inv_cos_bit_row_dct_16[8] = {
79 12, 12, 12, 12, 12, 12, 12, 12
80};
81static const int8_t inv_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
82 13, 13, 13, 13, 13 };
83static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
84 12, 12, 12, 12, 12 };
85
86// ---------------- 32x32 1D constants -----------------------
87// shift
88static const int8_t inv_shift_32[2] = { -1, -5 };
89
90// stage range
Angie Chiangce3ad282017-08-08 09:51:54 -070091static const int8_t inv_stage_range_col_dct_32[10] = { 9, 9, 9, 9, 9,
92 9, 9, 9, 8, 8 };
93static const int8_t inv_stage_range_row_dct_32[10] = { 9, 9, 9, 9, 9,
94 9, 9, 9, 9, 9 };
95static const int8_t inv_stage_range_col_adst_32[12] = { 9, 9, 9, 9, 9, 9,
96 9, 9, 9, 9, 8, 8 };
97static const int8_t inv_stage_range_row_adst_32[12] = { 9, 9, 9, 9, 9, 9,
98 9, 9, 9, 9, 9, 9 };
99static const int8_t inv_stage_range_idx_32[1] = { 0 };
Sarah Parkereec47e62017-05-15 20:49:22 -0700100
101// cos bit
102static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13,
103 13, 13, 13, 13, 13 };
104static const int8_t inv_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
105 12, 12, 12, 12, 12 };
106static const int8_t inv_cos_bit_col_adst_32[12] = { 13, 13, 13, 13, 13, 13,
107 13, 13, 13, 13, 13, 13 };
108static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
109 12, 12, 12, 12, 12, 12 };
110
111// ---------------- 64x64 1D constants -----------------------
112// shift
Debargha Mukherjee3ed2d232017-10-03 15:59:26 -0700113static const int8_t inv_shift_64[2] = { -1, -5 };
Sarah Parkereec47e62017-05-15 20:49:22 -0700114
115// stage range
Angie Chiangce3ad282017-08-08 09:51:54 -0700116static const int8_t inv_stage_range_col_dct_64[12] = { 11, 11, 11, 11, 11, 11,
117 11, 11, 11, 11, 10, 10 };
118static const int8_t inv_stage_range_row_dct_64[12] = { 11, 11, 11, 11, 11, 11,
119 11, 11, 11, 11, 11, 11 };
120
121static const int8_t inv_stage_range_idx_64[1] = { 0 };
Sarah Parkereec47e62017-05-15 20:49:22 -0700122
123// cos bit
124static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13,
125 13, 13, 13, 13, 13, 13 };
126static const int8_t inv_cos_bit_row_dct_64[12] = { 12, 12, 12, 12, 12, 12,
127 12, 12, 12, 12, 12, 12 };
128
129// ---------------- row config inv_dct_4 ----------------
130static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_4 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200131 4, // .txfm_size
132 4, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700133 inv_shift_4, // .shift
134 inv_stage_range_row_dct_4, // .stage_range
135 inv_cos_bit_row_dct_4, // .cos_bit
136 TXFM_TYPE_DCT4 // .txfm_type
137};
138
139// ---------------- row config inv_dct_8 ----------------
140static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_8 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200141 8, // .txfm_size
142 6, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700143 inv_shift_8, // .shift
144 inv_stage_range_row_dct_8, // .stage_range
145 inv_cos_bit_row_dct_8, // .cos_bit_
146 TXFM_TYPE_DCT8 // .txfm_type
147};
148// ---------------- row config inv_dct_16 ----------------
149static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_16 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200150 16, // .txfm_size
151 8, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700152 inv_shift_16, // .shift
153 inv_stage_range_row_dct_16, // .stage_range
154 inv_cos_bit_row_dct_16, // .cos_bit
155 TXFM_TYPE_DCT16 // .txfm_type
156};
157
158// ---------------- row config inv_dct_32 ----------------
159static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_32 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200160 32, // .txfm_size
161 10, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700162 inv_shift_32, // .shift
163 inv_stage_range_row_dct_32, // .stage_range
164 inv_cos_bit_row_dct_32, // .cos_bit_row
165 TXFM_TYPE_DCT32 // .txfm_type
166};
167
Debargha Mukherjee570423c2017-10-01 00:35:20 -0700168#if CONFIG_TX64X64
Sarah Parkereec47e62017-05-15 20:49:22 -0700169// ---------------- row config inv_dct_64 ----------------
170static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_64 = {
171 64, // .txfm_size
172 12, // .stage_num
173 inv_shift_64, // .shift
174 inv_stage_range_row_dct_64, // .stage_range
175 inv_cos_bit_row_dct_64, // .cos_bit
176 TXFM_TYPE_DCT64, // .txfm_type_col
177};
Debargha Mukherjee570423c2017-10-01 00:35:20 -0700178#endif // CONFIG_TX64X64
Sarah Parkereec47e62017-05-15 20:49:22 -0700179
180// ---------------- row config inv_adst_4 ----------------
181static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200182 4, // .txfm_size
183 6, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700184 inv_shift_4, // .shift
185 inv_stage_range_row_adst_4, // .stage_range
186 inv_cos_bit_row_adst_4, // .cos_bit
187 TXFM_TYPE_ADST4, // .txfm_type
188};
189
190// ---------------- row config inv_adst_8 ----------------
191static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_8 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200192 8, // .txfm_size
193 8, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700194 inv_shift_8, // .shift
195 inv_stage_range_row_adst_8, // .stage_range
196 inv_cos_bit_row_adst_8, // .cos_bit
197 TXFM_TYPE_ADST8, // .txfm_type_col
198};
199
200// ---------------- row config inv_adst_16 ----------------
201static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_16 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200202 16, // .txfm_size
203 10, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700204 inv_shift_16, // .shift
205 inv_stage_range_row_adst_16, // .stage_range
206 inv_cos_bit_row_adst_16, // .cos_bit
207 TXFM_TYPE_ADST16, // .txfm_type
208};
209
210// ---------------- row config inv_adst_32 ----------------
211static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_32 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200212 32, // .txfm_size
213 12, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700214 inv_shift_32, // .shift
215 inv_stage_range_row_adst_32, // .stage_range
216 inv_cos_bit_row_adst_32, // .cos_bit
217 TXFM_TYPE_ADST32, // .txfm_type
218};
219
220// ---------------- col config inv_dct_4 ----------------
221static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_4 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200222 4, // .txfm_size
223 4, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700224 inv_shift_4, // .shift
225 inv_stage_range_col_dct_4, // .stage_range
226 inv_cos_bit_col_dct_4, // .cos_bit
227 TXFM_TYPE_DCT4 // .txfm_type
228};
229
230// ---------------- col config inv_dct_8 ----------------
231static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_8 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200232 8, // .txfm_size
233 6, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700234 inv_shift_8, // .shift
235 inv_stage_range_col_dct_8, // .stage_range
236 inv_cos_bit_col_dct_8, // .cos_bit_
237 TXFM_TYPE_DCT8 // .txfm_type
238};
239// ---------------- col config inv_dct_16 ----------------
240static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_16 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200241 16, // .txfm_size
242 8, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700243 inv_shift_16, // .shift
244 inv_stage_range_col_dct_16, // .stage_range
245 inv_cos_bit_col_dct_16, // .cos_bit
246 TXFM_TYPE_DCT16 // .txfm_type
247};
248
249// ---------------- col config inv_dct_32 ----------------
250static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_32 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200251 32, // .txfm_size
252 10, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700253 inv_shift_32, // .shift
254 inv_stage_range_col_dct_32, // .stage_range
255 inv_cos_bit_col_dct_32, // .cos_bit_col
256 TXFM_TYPE_DCT32 // .txfm_type
257};
258
259// ---------------- col config inv_dct_64 ----------------
260static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_64 = {
261 64, // .txfm_size
262 12, // .stage_num
263 inv_shift_64, // .shift
264 inv_stage_range_col_dct_64, // .stage_range
265 inv_cos_bit_col_dct_64, // .cos_bit
266 TXFM_TYPE_DCT64, // .txfm_type_col
267};
268
269// ---------------- col config inv_adst_4 ----------------
270static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_4 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200271 4, // .txfm_size
272 6, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700273 inv_shift_4, // .shift
274 inv_stage_range_col_adst_4, // .stage_range
275 inv_cos_bit_col_adst_4, // .cos_bit
276 TXFM_TYPE_ADST4, // .txfm_type
277};
278
279// ---------------- col config inv_adst_8 ----------------
280static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_8 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200281 8, // .txfm_size
282 8, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700283 inv_shift_8, // .shift
284 inv_stage_range_col_adst_8, // .stage_range
285 inv_cos_bit_col_adst_8, // .cos_bit
286 TXFM_TYPE_ADST8, // .txfm_type_col
287};
288
289// ---------------- col config inv_adst_16 ----------------
290static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_16 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200291 16, // .txfm_size
292 10, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700293 inv_shift_16, // .shift
294 inv_stage_range_col_adst_16, // .stage_range
295 inv_cos_bit_col_adst_16, // .cos_bit
296 TXFM_TYPE_ADST16, // .txfm_type
297};
298
299// ---------------- col config inv_adst_32 ----------------
300static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200301 32, // .txfm_size
302 12, // .stage_num
Sarah Parkereec47e62017-05-15 20:49:22 -0700303 inv_shift_32, // .shift
304 inv_stage_range_col_adst_32, // .stage_range
305 inv_cos_bit_col_adst_32, // .cos_bit
306 TXFM_TYPE_ADST32, // .txfm_type
307};
Sarah Parker3eed4172017-05-15 20:49:22 -0700308
309#if CONFIG_EXT_TX
310// identity does not need to differentiate between row and col
311// ---------------- row/col config inv_identity_4 ----------
312static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_4 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200313 4, // .txfm_size
314 1, // .stage_num
Jingning Han401680b2017-06-19 10:57:21 -0700315 inv_shift_4, // .shift
316 inv_stage_range_idx_4, // .stage_range
317 NULL, // .cos_bit
318 TXFM_TYPE_IDENTITY4, // .txfm_type
Sarah Parker3eed4172017-05-15 20:49:22 -0700319};
320
321// ---------------- row/col config inv_identity_8 ----------------
322static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200323 8, // .txfm_size
324 1, // .stage_num
Jingning Han401680b2017-06-19 10:57:21 -0700325 inv_shift_8, // .shift
326 inv_stage_range_idx_8, // .stage_range
327 NULL, // .cos_bit
328 TXFM_TYPE_IDENTITY8, // .txfm_type
Sarah Parker3eed4172017-05-15 20:49:22 -0700329};
330
331// ---------------- row/col config inv_identity_16 ----------------
332static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200333 16, // .txfm_size
334 1, // .stage_num
Jingning Han401680b2017-06-19 10:57:21 -0700335 inv_shift_16, // .shift
336 inv_stage_range_idx_16, // .stage_range
337 NULL, // .cos_bit
338 TXFM_TYPE_IDENTITY16, // .txfm_type
Sarah Parker3eed4172017-05-15 20:49:22 -0700339};
340
341// ---------------- row/col config inv_identity_32 ----------------
342static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_32 = {
Sebastien Alaiwan2fa0a332017-09-27 12:52:16 +0200343 32, // .txfm_size
344 1, // .stage_num
Jingning Han401680b2017-06-19 10:57:21 -0700345 inv_shift_32, // .shift
346 inv_stage_range_idx_32, // .stage_range
347 NULL, // .cos_bit
348 TXFM_TYPE_IDENTITY32, // .txfm_type
Sarah Parker3eed4172017-05-15 20:49:22 -0700349};
Debargha Mukherjee570423c2017-10-01 00:35:20 -0700350
351#if CONFIG_TX64X64
352// ---------------- row/col config inv_identity_32 ----------------
353static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_64 = {
354 64, // .txfm_size
355 1, // .stage_num
356 inv_shift_64, // .shift
357 inv_stage_range_idx_64, // .stage_range
358 NULL, // .cos_bit
359 TXFM_TYPE_IDENTITY64, // .txfm_type
360};
361#endif // CONFIG_TX64X64
Sarah Parker3eed4172017-05-15 20:49:22 -0700362#endif // CONFIG_EXT_TX
Sarah Parkereec47e62017-05-15 20:49:22 -0700363#endif // AV1_INV_TXFM2D_CFG_H_