1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker *
4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker */
11*77c1e3ccSAndroid Build Coastguard Worker
12*77c1e3ccSAndroid Build Coastguard Worker #include <assert.h>
13*77c1e3ccSAndroid Build Coastguard Worker
14*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_dsp_rtcd.h"
15*77c1e3ccSAndroid Build Coastguard Worker #include "config/av1_rtcd.h"
16*77c1e3ccSAndroid Build Coastguard Worker
17*77c1e3ccSAndroid Build Coastguard Worker #include "aom_dsp/txfm_common.h"
18*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/enums.h"
19*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/av1_txfm.h"
20*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/av1_fwd_txfm1d.h"
21*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/av1_fwd_txfm1d_cfg.h"
22*77c1e3ccSAndroid Build Coastguard Worker
fwd_txfm_type_to_func(TXFM_TYPE txfm_type)23*77c1e3ccSAndroid Build Coastguard Worker static inline TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
24*77c1e3ccSAndroid Build Coastguard Worker switch (txfm_type) {
25*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_DCT4: return av1_fdct4;
26*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_DCT8: return av1_fdct8;
27*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_DCT16: return av1_fdct16;
28*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_DCT32: return av1_fdct32;
29*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_DCT64: return av1_fdct64;
30*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_ADST4: return av1_fadst4;
31*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_ADST8: return av1_fadst8;
32*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_ADST16: return av1_fadst16;
33*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_IDENTITY4: return av1_fidentity4_c;
34*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_IDENTITY8: return av1_fidentity8_c;
35*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_IDENTITY16: return av1_fidentity16_c;
36*77c1e3ccSAndroid Build Coastguard Worker case TXFM_TYPE_IDENTITY32: return av1_fidentity32_c;
37*77c1e3ccSAndroid Build Coastguard Worker default: assert(0); return NULL;
38*77c1e3ccSAndroid Build Coastguard Worker }
39*77c1e3ccSAndroid Build Coastguard Worker }
40*77c1e3ccSAndroid Build Coastguard Worker
av1_gen_fwd_stage_range(int8_t * stage_range_col,int8_t * stage_range_row,const TXFM_2D_FLIP_CFG * cfg,int bd)41*77c1e3ccSAndroid Build Coastguard Worker void av1_gen_fwd_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
42*77c1e3ccSAndroid Build Coastguard Worker const TXFM_2D_FLIP_CFG *cfg, int bd) {
43*77c1e3ccSAndroid Build Coastguard Worker // Take the shift from the larger dimension in the rectangular case.
44*77c1e3ccSAndroid Build Coastguard Worker const int8_t *shift = cfg->shift;
45*77c1e3ccSAndroid Build Coastguard Worker // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
46*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < cfg->stage_num_col && i < MAX_TXFM_STAGE_NUM; ++i) {
47*77c1e3ccSAndroid Build Coastguard Worker stage_range_col[i] = cfg->stage_range_col[i] + shift[0] + bd + 1;
48*77c1e3ccSAndroid Build Coastguard Worker }
49*77c1e3ccSAndroid Build Coastguard Worker
50*77c1e3ccSAndroid Build Coastguard Worker // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
51*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < cfg->stage_num_row && i < MAX_TXFM_STAGE_NUM; ++i) {
52*77c1e3ccSAndroid Build Coastguard Worker stage_range_row[i] = cfg->stage_range_row[i] + shift[0] + shift[1] + bd + 1;
53*77c1e3ccSAndroid Build Coastguard Worker }
54*77c1e3ccSAndroid Build Coastguard Worker }
55*77c1e3ccSAndroid Build Coastguard Worker
fwd_txfm2d_c(const int16_t * input,int32_t * output,const int stride,const TXFM_2D_FLIP_CFG * cfg,int32_t * buf,int bd)56*77c1e3ccSAndroid Build Coastguard Worker static inline void fwd_txfm2d_c(const int16_t *input, int32_t *output,
57*77c1e3ccSAndroid Build Coastguard Worker const int stride, const TXFM_2D_FLIP_CFG *cfg,
58*77c1e3ccSAndroid Build Coastguard Worker int32_t *buf, int bd) {
59*77c1e3ccSAndroid Build Coastguard Worker int c, r;
60*77c1e3ccSAndroid Build Coastguard Worker // Note when assigning txfm_size_col, we use the txfm_size from the
61*77c1e3ccSAndroid Build Coastguard Worker // row configuration and vice versa. This is intentionally done to
62*77c1e3ccSAndroid Build Coastguard Worker // accurately perform rectangular transforms. When the transform is
63*77c1e3ccSAndroid Build Coastguard Worker // rectangular, the number of columns will be the same as the
64*77c1e3ccSAndroid Build Coastguard Worker // txfm_size stored in the row cfg struct. It will make no difference
65*77c1e3ccSAndroid Build Coastguard Worker // for square transforms.
66*77c1e3ccSAndroid Build Coastguard Worker const int txfm_size_col = tx_size_wide[cfg->tx_size];
67*77c1e3ccSAndroid Build Coastguard Worker const int txfm_size_row = tx_size_high[cfg->tx_size];
68*77c1e3ccSAndroid Build Coastguard Worker // Take the shift from the larger dimension in the rectangular case.
69*77c1e3ccSAndroid Build Coastguard Worker const int8_t *shift = cfg->shift;
70*77c1e3ccSAndroid Build Coastguard Worker const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
71*77c1e3ccSAndroid Build Coastguard Worker int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
72*77c1e3ccSAndroid Build Coastguard Worker int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
73*77c1e3ccSAndroid Build Coastguard Worker assert(cfg->stage_num_col <= MAX_TXFM_STAGE_NUM);
74*77c1e3ccSAndroid Build Coastguard Worker assert(cfg->stage_num_row <= MAX_TXFM_STAGE_NUM);
75*77c1e3ccSAndroid Build Coastguard Worker av1_gen_fwd_stage_range(stage_range_col, stage_range_row, cfg, bd);
76*77c1e3ccSAndroid Build Coastguard Worker
77*77c1e3ccSAndroid Build Coastguard Worker const int8_t cos_bit_col = cfg->cos_bit_col;
78*77c1e3ccSAndroid Build Coastguard Worker const int8_t cos_bit_row = cfg->cos_bit_row;
79*77c1e3ccSAndroid Build Coastguard Worker const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->txfm_type_col);
80*77c1e3ccSAndroid Build Coastguard Worker const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->txfm_type_row);
81*77c1e3ccSAndroid Build Coastguard Worker
82*77c1e3ccSAndroid Build Coastguard Worker // use output buffer as temp buffer
83*77c1e3ccSAndroid Build Coastguard Worker int32_t *temp_in = output;
84*77c1e3ccSAndroid Build Coastguard Worker int32_t *temp_out = output + txfm_size_row;
85*77c1e3ccSAndroid Build Coastguard Worker
86*77c1e3ccSAndroid Build Coastguard Worker // Columns
87*77c1e3ccSAndroid Build Coastguard Worker for (c = 0; c < txfm_size_col; ++c) {
88*77c1e3ccSAndroid Build Coastguard Worker if (cfg->ud_flip == 0) {
89*77c1e3ccSAndroid Build Coastguard Worker for (r = 0; r < txfm_size_row; ++r) temp_in[r] = input[r * stride + c];
90*77c1e3ccSAndroid Build Coastguard Worker } else {
91*77c1e3ccSAndroid Build Coastguard Worker for (r = 0; r < txfm_size_row; ++r)
92*77c1e3ccSAndroid Build Coastguard Worker // flip upside down
93*77c1e3ccSAndroid Build Coastguard Worker temp_in[r] = input[(txfm_size_row - r - 1) * stride + c];
94*77c1e3ccSAndroid Build Coastguard Worker }
95*77c1e3ccSAndroid Build Coastguard Worker av1_round_shift_array(temp_in, txfm_size_row, -shift[0]);
96*77c1e3ccSAndroid Build Coastguard Worker txfm_func_col(temp_in, temp_out, cos_bit_col, stage_range_col);
97*77c1e3ccSAndroid Build Coastguard Worker av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
98*77c1e3ccSAndroid Build Coastguard Worker if (cfg->lr_flip == 0) {
99*77c1e3ccSAndroid Build Coastguard Worker for (r = 0; r < txfm_size_row; ++r)
100*77c1e3ccSAndroid Build Coastguard Worker buf[r * txfm_size_col + c] = temp_out[r];
101*77c1e3ccSAndroid Build Coastguard Worker } else {
102*77c1e3ccSAndroid Build Coastguard Worker for (r = 0; r < txfm_size_row; ++r)
103*77c1e3ccSAndroid Build Coastguard Worker // flip from left to right
104*77c1e3ccSAndroid Build Coastguard Worker buf[r * txfm_size_col + (txfm_size_col - c - 1)] = temp_out[r];
105*77c1e3ccSAndroid Build Coastguard Worker }
106*77c1e3ccSAndroid Build Coastguard Worker }
107*77c1e3ccSAndroid Build Coastguard Worker
108*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(16, int32_t, row_buffer[MAX_TX_SIZE]);
109*77c1e3ccSAndroid Build Coastguard Worker
110*77c1e3ccSAndroid Build Coastguard Worker // Rows
111*77c1e3ccSAndroid Build Coastguard Worker for (r = 0; r < txfm_size_row; ++r) {
112*77c1e3ccSAndroid Build Coastguard Worker txfm_func_row(buf + r * txfm_size_col, row_buffer, cos_bit_row,
113*77c1e3ccSAndroid Build Coastguard Worker stage_range_row);
114*77c1e3ccSAndroid Build Coastguard Worker av1_round_shift_array(row_buffer, txfm_size_col, -shift[2]);
115*77c1e3ccSAndroid Build Coastguard Worker if (abs(rect_type) == 1) {
116*77c1e3ccSAndroid Build Coastguard Worker // Multiply everything by Sqrt2 if the transform is rectangular and the
117*77c1e3ccSAndroid Build Coastguard Worker // size difference is a factor of 2.
118*77c1e3ccSAndroid Build Coastguard Worker for (c = 0; c < txfm_size_col; ++c) {
119*77c1e3ccSAndroid Build Coastguard Worker row_buffer[c] =
120*77c1e3ccSAndroid Build Coastguard Worker round_shift((int64_t)row_buffer[c] * NewSqrt2, NewSqrt2Bits);
121*77c1e3ccSAndroid Build Coastguard Worker }
122*77c1e3ccSAndroid Build Coastguard Worker }
123*77c1e3ccSAndroid Build Coastguard Worker for (c = 0; c < txfm_size_col; ++c) {
124*77c1e3ccSAndroid Build Coastguard Worker output[c * txfm_size_row + r] = row_buffer[c];
125*77c1e3ccSAndroid Build Coastguard Worker }
126*77c1e3ccSAndroid Build Coastguard Worker }
127*77c1e3ccSAndroid Build Coastguard Worker }
128*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_4x8_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)129*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride,
130*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
131*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[4 * 8]);
132*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
133*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_4X8, &cfg);
134*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
135*77c1e3ccSAndroid Build Coastguard Worker }
136*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_8x4_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)137*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_8x4_c(const int16_t *input, int32_t *output, int stride,
138*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
139*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[8 * 4];
140*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
141*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_8X4, &cfg);
142*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
143*77c1e3ccSAndroid Build Coastguard Worker }
144*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_8x16_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)145*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride,
146*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
147*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[8 * 16]);
148*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
149*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_8X16, &cfg);
150*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
151*77c1e3ccSAndroid Build Coastguard Worker }
152*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_16x8_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)153*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_16x8_c(const int16_t *input, int32_t *output, int stride,
154*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
155*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[16 * 8];
156*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
157*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_16X8, &cfg);
158*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
159*77c1e3ccSAndroid Build Coastguard Worker }
160*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_16x32_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)161*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride,
162*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
163*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[16 * 32]);
164*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
165*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_16X32, &cfg);
166*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
167*77c1e3ccSAndroid Build Coastguard Worker }
168*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_32x16_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)169*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_32x16_c(const int16_t *input, int32_t *output, int stride,
170*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
171*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[32 * 16];
172*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
173*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_32X16, &cfg);
174*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
175*77c1e3ccSAndroid Build Coastguard Worker }
176*77c1e3ccSAndroid Build Coastguard Worker
177*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
av1_fwd_txfm2d_4x16_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)178*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_4x16_c(const int16_t *input, int32_t *output, int stride,
179*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
180*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[4 * 16]);
181*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
182*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_4X16, &cfg);
183*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
184*77c1e3ccSAndroid Build Coastguard Worker }
185*77c1e3ccSAndroid Build Coastguard Worker #endif // !CONFIG_REALTIME_ONLY
186*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_16x4_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)187*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_16x4_c(const int16_t *input, int32_t *output, int stride,
188*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
189*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[16 * 4];
190*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
191*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_16X4, &cfg);
192*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
193*77c1e3ccSAndroid Build Coastguard Worker }
194*77c1e3ccSAndroid Build Coastguard Worker
195*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
av1_fwd_txfm2d_8x32_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)196*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_8x32_c(const int16_t *input, int32_t *output, int stride,
197*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
198*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[32 * 8]);
199*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
200*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_8X32, &cfg);
201*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
202*77c1e3ccSAndroid Build Coastguard Worker }
203*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_32x8_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)204*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_32x8_c(const int16_t *input, int32_t *output, int stride,
205*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
206*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[32 * 8];
207*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
208*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_32X8, &cfg);
209*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
210*77c1e3ccSAndroid Build Coastguard Worker }
211*77c1e3ccSAndroid Build Coastguard Worker #endif // !CONFIG_REALTIME_ONLY
212*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_4x4_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)213*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_4x4_c(const int16_t *input, int32_t *output, int stride,
214*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
215*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[4 * 4];
216*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
217*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_4X4, &cfg);
218*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
219*77c1e3ccSAndroid Build Coastguard Worker }
220*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_8x8_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)221*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_8x8_c(const int16_t *input, int32_t *output, int stride,
222*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
223*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[8 * 8];
224*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
225*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_8X8, &cfg);
226*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
227*77c1e3ccSAndroid Build Coastguard Worker }
228*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_16x16_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)229*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_16x16_c(const int16_t *input, int32_t *output, int stride,
230*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
231*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[16 * 16];
232*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
233*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_16X16, &cfg);
234*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
235*77c1e3ccSAndroid Build Coastguard Worker }
236*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_32x32_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)237*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_32x32_c(const int16_t *input, int32_t *output, int stride,
238*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
239*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[32 * 32];
240*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
241*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_32X32, &cfg);
242*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
243*77c1e3ccSAndroid Build Coastguard Worker }
244*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_64x64_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)245*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
246*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
247*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[64 * 64];
248*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
249*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_64X64, &cfg);
250*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
251*77c1e3ccSAndroid Build Coastguard Worker
252*77c1e3ccSAndroid Build Coastguard Worker // Zero out top-right 32x32 area.
253*77c1e3ccSAndroid Build Coastguard Worker for (int col = 0; col < 32; ++col) {
254*77c1e3ccSAndroid Build Coastguard Worker memset(output + col * 64 + 32, 0, 32 * sizeof(*output));
255*77c1e3ccSAndroid Build Coastguard Worker }
256*77c1e3ccSAndroid Build Coastguard Worker // Zero out the bottom 64x32 area.
257*77c1e3ccSAndroid Build Coastguard Worker memset(output + 32 * 64, 0, 32 * 64 * sizeof(*output));
258*77c1e3ccSAndroid Build Coastguard Worker // Re-pack non-zero coeffs in the first 32x32 indices.
259*77c1e3ccSAndroid Build Coastguard Worker for (int col = 1; col < 32; ++col) {
260*77c1e3ccSAndroid Build Coastguard Worker memcpy(output + col * 32, output + col * 64, 32 * sizeof(*output));
261*77c1e3ccSAndroid Build Coastguard Worker }
262*77c1e3ccSAndroid Build Coastguard Worker }
263*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_32x64_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)264*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_32x64_c(const int16_t *input, int32_t *output, int stride,
265*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
266*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[32 * 64]);
267*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
268*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_32X64, &cfg);
269*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
270*77c1e3ccSAndroid Build Coastguard Worker // Zero out right 32x32 area.
271*77c1e3ccSAndroid Build Coastguard Worker for (int col = 0; col < 32; ++col) {
272*77c1e3ccSAndroid Build Coastguard Worker memset(output + col * 64 + 32, 0, 32 * sizeof(*output));
273*77c1e3ccSAndroid Build Coastguard Worker }
274*77c1e3ccSAndroid Build Coastguard Worker // Re-pack non-zero coeffs in the first 32x32 indices.
275*77c1e3ccSAndroid Build Coastguard Worker for (int col = 1; col < 32; ++col) {
276*77c1e3ccSAndroid Build Coastguard Worker memcpy(output + col * 32, output + col * 64, 32 * sizeof(*output));
277*77c1e3ccSAndroid Build Coastguard Worker }
278*77c1e3ccSAndroid Build Coastguard Worker }
279*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_64x32_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)280*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_64x32_c(const int16_t *input, int32_t *output, int stride,
281*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
282*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[64 * 32];
283*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
284*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_64X32, &cfg);
285*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
286*77c1e3ccSAndroid Build Coastguard Worker // Zero out the bottom 32x32 area.
287*77c1e3ccSAndroid Build Coastguard Worker memset(output + 32 * 32, 0, 32 * 32 * sizeof(*output));
288*77c1e3ccSAndroid Build Coastguard Worker // Note: no repacking needed here.
289*77c1e3ccSAndroid Build Coastguard Worker }
290*77c1e3ccSAndroid Build Coastguard Worker
291*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
av1_fwd_txfm2d_16x64_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)292*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_16x64_c(const int16_t *input, int32_t *output, int stride,
293*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
294*77c1e3ccSAndroid Build Coastguard Worker DECLARE_ALIGNED(32, int32_t, txfm_buf[64 * 16]);
295*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
296*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_16X64, &cfg);
297*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
298*77c1e3ccSAndroid Build Coastguard Worker // Zero out right 32x16 area.
299*77c1e3ccSAndroid Build Coastguard Worker for (int row = 0; row < 16; ++row) {
300*77c1e3ccSAndroid Build Coastguard Worker memset(output + row * 64 + 32, 0, 32 * sizeof(*output));
301*77c1e3ccSAndroid Build Coastguard Worker }
302*77c1e3ccSAndroid Build Coastguard Worker // Re-pack non-zero coeffs in the first 32x16 indices.
303*77c1e3ccSAndroid Build Coastguard Worker for (int row = 1; row < 16; ++row) {
304*77c1e3ccSAndroid Build Coastguard Worker memcpy(output + row * 32, output + row * 64, 32 * sizeof(*output));
305*77c1e3ccSAndroid Build Coastguard Worker }
306*77c1e3ccSAndroid Build Coastguard Worker }
307*77c1e3ccSAndroid Build Coastguard Worker
av1_fwd_txfm2d_64x16_c(const int16_t * input,int32_t * output,int stride,TX_TYPE tx_type,int bd)308*77c1e3ccSAndroid Build Coastguard Worker void av1_fwd_txfm2d_64x16_c(const int16_t *input, int32_t *output, int stride,
309*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE tx_type, int bd) {
310*77c1e3ccSAndroid Build Coastguard Worker int32_t txfm_buf[64 * 16];
311*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG cfg;
312*77c1e3ccSAndroid Build Coastguard Worker av1_get_fwd_txfm_cfg(tx_type, TX_64X16, &cfg);
313*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
314*77c1e3ccSAndroid Build Coastguard Worker // Zero out the bottom 16x32 area.
315*77c1e3ccSAndroid Build Coastguard Worker memset(output + 16 * 32, 0, 16 * 32 * sizeof(*output));
316*77c1e3ccSAndroid Build Coastguard Worker // Note: no repacking needed here.
317*77c1e3ccSAndroid Build Coastguard Worker }
318*77c1e3ccSAndroid Build Coastguard Worker #endif // !CONFIG_REALTIME_ONLY
319*77c1e3ccSAndroid Build Coastguard Worker
320*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_4x4[3] = { 2, 0, 0 };
321*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_8x8[3] = { 2, -1, 0 };
322*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_16x16[3] = { 2, -2, 0 };
323*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_32x32[3] = { 2, -4, 0 };
324*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_64x64[3] = { 0, -2, -2 };
325*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_4x8[3] = { 2, -1, 0 };
326*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_8x4[3] = { 2, -1, 0 };
327*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_8x16[3] = { 2, -2, 0 };
328*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_16x8[3] = { 2, -2, 0 };
329*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_16x32[3] = { 2, -4, 0 };
330*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_32x16[3] = { 2, -4, 0 };
331*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_32x64[3] = { 0, -2, -2 };
332*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_64x32[3] = { 2, -4, -2 };
333*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_4x16[3] = { 2, -1, 0 };
334*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_16x4[3] = { 2, -1, 0 };
335*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_8x32[3] = { 2, -2, 0 };
336*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_32x8[3] = { 2, -2, 0 };
337*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_16x64[3] = { 0, -2, 0 };
338*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fwd_shift_64x16[3] = { 2, -4, 0 };
339*77c1e3ccSAndroid Build Coastguard Worker
340*77c1e3ccSAndroid Build Coastguard Worker const int8_t *av1_fwd_txfm_shift_ls[TX_SIZES_ALL] = {
341*77c1e3ccSAndroid Build Coastguard Worker fwd_shift_4x4, fwd_shift_8x8, fwd_shift_16x16, fwd_shift_32x32,
342*77c1e3ccSAndroid Build Coastguard Worker fwd_shift_64x64, fwd_shift_4x8, fwd_shift_8x4, fwd_shift_8x16,
343*77c1e3ccSAndroid Build Coastguard Worker fwd_shift_16x8, fwd_shift_16x32, fwd_shift_32x16, fwd_shift_32x64,
344*77c1e3ccSAndroid Build Coastguard Worker fwd_shift_64x32, fwd_shift_4x16, fwd_shift_16x4, fwd_shift_8x32,
345*77c1e3ccSAndroid Build Coastguard Worker fwd_shift_32x8, fwd_shift_16x64, fwd_shift_64x16,
346*77c1e3ccSAndroid Build Coastguard Worker };
347*77c1e3ccSAndroid Build Coastguard Worker
348*77c1e3ccSAndroid Build Coastguard Worker const int8_t av1_fwd_cos_bit_col[MAX_TXWH_IDX /*txw_idx*/]
349*77c1e3ccSAndroid Build Coastguard Worker [MAX_TXWH_IDX /*txh_idx*/] = {
350*77c1e3ccSAndroid Build Coastguard Worker { 13, 13, 13, 0, 0 },
351*77c1e3ccSAndroid Build Coastguard Worker { 13, 13, 13, 12, 0 },
352*77c1e3ccSAndroid Build Coastguard Worker { 13, 13, 13, 12, 13 },
353*77c1e3ccSAndroid Build Coastguard Worker { 0, 13, 13, 12, 13 },
354*77c1e3ccSAndroid Build Coastguard Worker { 0, 0, 13, 12, 13 }
355*77c1e3ccSAndroid Build Coastguard Worker };
356*77c1e3ccSAndroid Build Coastguard Worker
357*77c1e3ccSAndroid Build Coastguard Worker const int8_t av1_fwd_cos_bit_row[MAX_TXWH_IDX /*txw_idx*/]
358*77c1e3ccSAndroid Build Coastguard Worker [MAX_TXWH_IDX /*txh_idx*/] = {
359*77c1e3ccSAndroid Build Coastguard Worker { 13, 13, 12, 0, 0 },
360*77c1e3ccSAndroid Build Coastguard Worker { 13, 13, 13, 12, 0 },
361*77c1e3ccSAndroid Build Coastguard Worker { 13, 13, 12, 13, 12 },
362*77c1e3ccSAndroid Build Coastguard Worker { 0, 12, 13, 12, 11 },
363*77c1e3ccSAndroid Build Coastguard Worker { 0, 0, 12, 11, 10 }
364*77c1e3ccSAndroid Build Coastguard Worker };
365*77c1e3ccSAndroid Build Coastguard Worker
366*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fdct4_range_mult2[4] = { 0, 2, 3, 3 };
367*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fdct8_range_mult2[6] = { 0, 2, 4, 5, 5, 5 };
368*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fdct16_range_mult2[8] = { 0, 2, 4, 6, 7, 7, 7, 7 };
369*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fdct32_range_mult2[10] = { 0, 2, 4, 6, 8, 9, 9, 9, 9, 9 };
370*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fdct64_range_mult2[12] = { 0, 2, 4, 6, 8, 10,
371*77c1e3ccSAndroid Build Coastguard Worker 11, 11, 11, 11, 11, 11 };
372*77c1e3ccSAndroid Build Coastguard Worker
373*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fadst4_range_mult2[7] = { 0, 2, 4, 3, 3, 3, 3 };
374*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fadst8_range_mult2[8] = { 0, 0, 1, 3, 3, 5, 5, 5 };
375*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fadst16_range_mult2[10] = { 0, 0, 1, 3, 3, 5, 5, 7, 7, 7 };
376*77c1e3ccSAndroid Build Coastguard Worker
377*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fidtx4_range_mult2[1] = { 1 };
378*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fidtx8_range_mult2[1] = { 2 };
379*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fidtx16_range_mult2[1] = { 3 };
380*77c1e3ccSAndroid Build Coastguard Worker static const int8_t fidtx32_range_mult2[1] = { 4 };
381*77c1e3ccSAndroid Build Coastguard Worker
382*77c1e3ccSAndroid Build Coastguard Worker static const int8_t *fwd_txfm_range_mult2_list[TXFM_TYPES] = {
383*77c1e3ccSAndroid Build Coastguard Worker fdct4_range_mult2, fdct8_range_mult2, fdct16_range_mult2,
384*77c1e3ccSAndroid Build Coastguard Worker fdct32_range_mult2, fdct64_range_mult2, fadst4_range_mult2,
385*77c1e3ccSAndroid Build Coastguard Worker fadst8_range_mult2, fadst16_range_mult2, fidtx4_range_mult2,
386*77c1e3ccSAndroid Build Coastguard Worker fidtx8_range_mult2, fidtx16_range_mult2, fidtx32_range_mult2
387*77c1e3ccSAndroid Build Coastguard Worker };
388*77c1e3ccSAndroid Build Coastguard Worker
set_fwd_txfm_non_scale_range(TXFM_2D_FLIP_CFG * cfg)389*77c1e3ccSAndroid Build Coastguard Worker static inline void set_fwd_txfm_non_scale_range(TXFM_2D_FLIP_CFG *cfg) {
390*77c1e3ccSAndroid Build Coastguard Worker av1_zero(cfg->stage_range_col);
391*77c1e3ccSAndroid Build Coastguard Worker av1_zero(cfg->stage_range_row);
392*77c1e3ccSAndroid Build Coastguard Worker
393*77c1e3ccSAndroid Build Coastguard Worker const int8_t *const range_mult2_col =
394*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm_range_mult2_list[cfg->txfm_type_col];
395*77c1e3ccSAndroid Build Coastguard Worker const int stage_num_col = cfg->stage_num_col;
396*77c1e3ccSAndroid Build Coastguard Worker // i < MAX_TXFM_STAGE_NUM will quiet -Wstringop-overflow.
397*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < stage_num_col && i < MAX_TXFM_STAGE_NUM; ++i)
398*77c1e3ccSAndroid Build Coastguard Worker cfg->stage_range_col[i] = (range_mult2_col[i] + 1) >> 1;
399*77c1e3ccSAndroid Build Coastguard Worker
400*77c1e3ccSAndroid Build Coastguard Worker const int8_t *const range_mult2_row =
401*77c1e3ccSAndroid Build Coastguard Worker fwd_txfm_range_mult2_list[cfg->txfm_type_row];
402*77c1e3ccSAndroid Build Coastguard Worker const int stage_num_row = cfg->stage_num_row;
403*77c1e3ccSAndroid Build Coastguard Worker // i < MAX_TXFM_STAGE_NUM will quiet -Wstringop-overflow.
404*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < stage_num_row && i < MAX_TXFM_STAGE_NUM; ++i) {
405*77c1e3ccSAndroid Build Coastguard Worker cfg->stage_range_row[i] =
406*77c1e3ccSAndroid Build Coastguard Worker (range_mult2_col[stage_num_col - 1] + range_mult2_row[i] + 1) >> 1;
407*77c1e3ccSAndroid Build Coastguard Worker }
408*77c1e3ccSAndroid Build Coastguard Worker }
409*77c1e3ccSAndroid Build Coastguard Worker
av1_get_fwd_txfm_cfg(TX_TYPE tx_type,TX_SIZE tx_size,TXFM_2D_FLIP_CFG * cfg)410*77c1e3ccSAndroid Build Coastguard Worker void av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
411*77c1e3ccSAndroid Build Coastguard Worker TXFM_2D_FLIP_CFG *cfg) {
412*77c1e3ccSAndroid Build Coastguard Worker assert(cfg != NULL);
413*77c1e3ccSAndroid Build Coastguard Worker cfg->tx_size = tx_size;
414*77c1e3ccSAndroid Build Coastguard Worker set_flip_cfg(tx_type, cfg);
415*77c1e3ccSAndroid Build Coastguard Worker const TX_TYPE_1D tx_type_1d_col = vtx_tab[tx_type];
416*77c1e3ccSAndroid Build Coastguard Worker const TX_TYPE_1D tx_type_1d_row = htx_tab[tx_type];
417*77c1e3ccSAndroid Build Coastguard Worker const int txw_idx = get_txw_idx(tx_size);
418*77c1e3ccSAndroid Build Coastguard Worker const int txh_idx = get_txh_idx(tx_size);
419*77c1e3ccSAndroid Build Coastguard Worker cfg->shift = av1_fwd_txfm_shift_ls[tx_size];
420*77c1e3ccSAndroid Build Coastguard Worker cfg->cos_bit_col = av1_fwd_cos_bit_col[txw_idx][txh_idx];
421*77c1e3ccSAndroid Build Coastguard Worker cfg->cos_bit_row = av1_fwd_cos_bit_row[txw_idx][txh_idx];
422*77c1e3ccSAndroid Build Coastguard Worker cfg->txfm_type_col = av1_txfm_type_ls[txh_idx][tx_type_1d_col];
423*77c1e3ccSAndroid Build Coastguard Worker assert(cfg->txfm_type_col != TXFM_TYPE_INVALID);
424*77c1e3ccSAndroid Build Coastguard Worker cfg->txfm_type_row = av1_txfm_type_ls[txw_idx][tx_type_1d_row];
425*77c1e3ccSAndroid Build Coastguard Worker assert(cfg->txfm_type_row != TXFM_TYPE_INVALID);
426*77c1e3ccSAndroid Build Coastguard Worker cfg->stage_num_col = av1_txfm_stage_num_list[cfg->txfm_type_col];
427*77c1e3ccSAndroid Build Coastguard Worker cfg->stage_num_row = av1_txfm_stage_num_list[cfg->txfm_type_row];
428*77c1e3ccSAndroid Build Coastguard Worker set_fwd_txfm_non_scale_range(cfg);
429*77c1e3ccSAndroid Build Coastguard Worker }
430