Coverage Report

Created: 2026-09-14 07:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/aom/av1/common/av1_inv_txfm2d.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3
 *
4
 * This source code is subject to the terms of the BSD 2 Clause License and
5
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
 * was not distributed with this source code in the LICENSE file, you can
7
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
 * Media Patent License 1.0 was not distributed with this source code in the
9
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
 */
11
12
#include "av1/common/av1_inv_txfm2d.h"
13
14
#include "config/aom_dsp_rtcd.h"
15
#include "config/av1_rtcd.h"
16
17
#include "av1/common/enums.h"
18
#include "av1/common/av1_txfm.h"
19
#include "av1/common/av1_inv_txfm1d.h"
20
#include "av1/common/av1_inv_txfm1d_cfg.h"
21
22
void av1_highbd_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
23
1.50M
                                 int stride, int bd) {
24
  /* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
25
     0.5 shifts per pixel. */
26
1.50M
  int i;
27
1.50M
  tran_low_t output[16];
28
1.50M
  tran_low_t a1, b1, c1, d1, e1;
29
1.50M
  const tran_low_t *ip = input;
30
1.50M
  tran_low_t *op = output;
31
1.50M
  uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
32
33
7.51M
  for (i = 0; i < 4; i++) {
34
6.01M
    a1 = ip[4 * 0] >> UNIT_QUANT_SHIFT;
35
6.01M
    c1 = ip[4 * 1] >> UNIT_QUANT_SHIFT;
36
6.01M
    d1 = ip[4 * 2] >> UNIT_QUANT_SHIFT;
37
6.01M
    b1 = ip[4 * 3] >> UNIT_QUANT_SHIFT;
38
6.01M
    a1 += c1;
39
6.01M
    d1 -= b1;
40
6.01M
    e1 = (a1 - d1) >> 1;
41
6.01M
    b1 = e1 - b1;
42
6.01M
    c1 = e1 - c1;
43
6.01M
    a1 -= b1;
44
6.01M
    d1 += c1;
45
46
6.01M
    op[4 * 0] = a1;
47
6.01M
    op[4 * 1] = b1;
48
6.01M
    op[4 * 2] = c1;
49
6.01M
    op[4 * 3] = d1;
50
6.01M
    ip++;
51
6.01M
    op++;
52
6.01M
  }
53
54
1.50M
  ip = output;
55
7.51M
  for (i = 0; i < 4; i++) {
56
6.01M
    a1 = ip[0];
57
6.01M
    c1 = ip[1];
58
6.01M
    d1 = ip[2];
59
6.01M
    b1 = ip[3];
60
6.01M
    a1 += c1;
61
6.01M
    d1 -= b1;
62
6.01M
    e1 = (a1 - d1) >> 1;
63
6.01M
    b1 = e1 - b1;
64
6.01M
    c1 = e1 - c1;
65
6.01M
    a1 -= b1;
66
6.01M
    d1 += c1;
67
68
6.01M
    range_check_value(a1, bd + 1);
69
6.01M
    range_check_value(b1, bd + 1);
70
6.01M
    range_check_value(c1, bd + 1);
71
6.01M
    range_check_value(d1, bd + 1);
72
73
6.01M
    dest[stride * 0] = highbd_clip_pixel_add(dest[stride * 0], a1, bd);
74
6.01M
    dest[stride * 1] = highbd_clip_pixel_add(dest[stride * 1], b1, bd);
75
6.01M
    dest[stride * 2] = highbd_clip_pixel_add(dest[stride * 2], c1, bd);
76
6.01M
    dest[stride * 3] = highbd_clip_pixel_add(dest[stride * 3], d1, bd);
77
78
6.01M
    ip += 4;
79
6.01M
    dest++;
80
6.01M
  }
81
1.50M
}
82
83
void av1_highbd_iwht4x4_1_add_c(const tran_low_t *in, uint8_t *dest8,
84
904k
                                int dest_stride, int bd) {
85
904k
  int i;
86
904k
  tran_low_t a1, e1;
87
904k
  tran_low_t tmp[4];
88
904k
  const tran_low_t *ip = in;
89
904k
  tran_low_t *op = tmp;
90
904k
  uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
91
904k
  (void)bd;
92
93
904k
  a1 = ip[0 * 4] >> UNIT_QUANT_SHIFT;
94
904k
  e1 = a1 >> 1;
95
904k
  a1 -= e1;
96
904k
  op[0] = a1;
97
904k
  op[1] = op[2] = op[3] = e1;
98
99
904k
  ip = tmp;
100
4.52M
  for (i = 0; i < 4; i++) {
101
3.61M
    e1 = ip[0] >> 1;
102
3.61M
    a1 = ip[0] - e1;
103
3.61M
    dest[dest_stride * 0] =
104
3.61M
        highbd_clip_pixel_add(dest[dest_stride * 0], a1, bd);
105
3.61M
    dest[dest_stride * 1] =
106
3.61M
        highbd_clip_pixel_add(dest[dest_stride * 1], e1, bd);
107
3.61M
    dest[dest_stride * 2] =
108
3.61M
        highbd_clip_pixel_add(dest[dest_stride * 2], e1, bd);
109
3.61M
    dest[dest_stride * 3] =
110
3.61M
        highbd_clip_pixel_add(dest[dest_stride * 3], e1, bd);
111
3.61M
    ip++;
112
3.61M
    dest++;
113
3.61M
  }
114
904k
}
115
116
2.47M
static inline TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
117
2.47M
  switch (txfm_type) {
118
276k
    case TXFM_TYPE_DCT4: return av1_idct4;
119
539k
    case TXFM_TYPE_DCT8: return av1_idct8;
120
354k
    case TXFM_TYPE_DCT16: return av1_idct16;
121
296k
    case TXFM_TYPE_DCT32: return av1_idct32;
122
65.8k
    case TXFM_TYPE_DCT64: return av1_idct64;
123
219k
    case TXFM_TYPE_ADST4: return av1_iadst4;
124
324k
    case TXFM_TYPE_ADST8: return av1_iadst8;
125
222k
    case TXFM_TYPE_ADST16: return av1_iadst16;
126
61.1k
    case TXFM_TYPE_IDENTITY4: return av1_iidentity4_c;
127
83.8k
    case TXFM_TYPE_IDENTITY8: return av1_iidentity8_c;
128
28.6k
    case TXFM_TYPE_IDENTITY16: return av1_iidentity16_c;
129
2.36k
    case TXFM_TYPE_IDENTITY32: return av1_iidentity32_c;
130
0
    default: assert(0); return NULL;
131
2.47M
  }
132
2.47M
}
133
134
static const int8_t inv_shift_4x4[2] = { 0, -4 };
135
static const int8_t inv_shift_8x8[2] = { -1, -4 };
136
static const int8_t inv_shift_16x16[2] = { -2, -4 };
137
static const int8_t inv_shift_32x32[2] = { -2, -4 };
138
static const int8_t inv_shift_64x64[2] = { -2, -4 };
139
static const int8_t inv_shift_4x8[2] = { 0, -4 };
140
static const int8_t inv_shift_8x4[2] = { 0, -4 };
141
static const int8_t inv_shift_8x16[2] = { -1, -4 };
142
static const int8_t inv_shift_16x8[2] = { -1, -4 };
143
static const int8_t inv_shift_16x32[2] = { -1, -4 };
144
static const int8_t inv_shift_32x16[2] = { -1, -4 };
145
static const int8_t inv_shift_32x64[2] = { -1, -4 };
146
static const int8_t inv_shift_64x32[2] = { -1, -4 };
147
static const int8_t inv_shift_4x16[2] = { -1, -4 };
148
static const int8_t inv_shift_16x4[2] = { -1, -4 };
149
static const int8_t inv_shift_8x32[2] = { -2, -4 };
150
static const int8_t inv_shift_32x8[2] = { -2, -4 };
151
static const int8_t inv_shift_16x64[2] = { -2, -4 };
152
static const int8_t inv_shift_64x16[2] = { -2, -4 };
153
154
const int8_t *av1_inv_txfm_shift_ls[TX_SIZES_ALL] = {
155
  inv_shift_4x4,   inv_shift_8x8,   inv_shift_16x16, inv_shift_32x32,
156
  inv_shift_64x64, inv_shift_4x8,   inv_shift_8x4,   inv_shift_8x16,
157
  inv_shift_16x8,  inv_shift_16x32, inv_shift_32x16, inv_shift_32x64,
158
  inv_shift_64x32, inv_shift_4x16,  inv_shift_16x4,  inv_shift_8x32,
159
  inv_shift_32x8,  inv_shift_16x64, inv_shift_64x16,
160
};
161
162
static const int8_t iadst4_range[7] = { 0, 1, 0, 0, 0, 0, 0 };
163
164
void av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
165
1.23M
                          TXFM_2D_FLIP_CFG *cfg) {
166
1.23M
  assert(cfg != NULL);
167
1.23M
  cfg->tx_size = tx_size;
168
1.23M
  av1_zero(cfg->stage_range_col);
169
1.23M
  av1_zero(cfg->stage_range_row);
170
1.23M
  set_flip_cfg(tx_type, cfg);
171
1.23M
  const TX_TYPE_1D tx_type_1d_col = vtx_tab[tx_type];
172
1.23M
  const TX_TYPE_1D tx_type_1d_row = htx_tab[tx_type];
173
1.23M
  cfg->shift = av1_inv_txfm_shift_ls[tx_size];
174
1.23M
  const int txw_idx = get_txw_idx(tx_size);
175
1.23M
  const int txh_idx = get_txh_idx(tx_size);
176
1.23M
  cfg->cos_bit_col = INV_COS_BIT;
177
1.23M
  cfg->cos_bit_row = INV_COS_BIT;
178
1.23M
  cfg->txfm_type_col = av1_txfm_type_ls[txh_idx][tx_type_1d_col];
179
1.23M
  if (cfg->txfm_type_col == TXFM_TYPE_ADST4) {
180
119k
    memcpy(cfg->stage_range_col, iadst4_range, sizeof(iadst4_range));
181
119k
  }
182
1.23M
  cfg->txfm_type_row = av1_txfm_type_ls[txw_idx][tx_type_1d_row];
183
1.23M
  if (cfg->txfm_type_row == TXFM_TYPE_ADST4) {
184
99.2k
    memcpy(cfg->stage_range_row, iadst4_range, sizeof(iadst4_range));
185
99.2k
  }
186
1.23M
  cfg->stage_num_col = av1_txfm_stage_num_list[cfg->txfm_type_col];
187
1.23M
  cfg->stage_num_row = av1_txfm_stage_num_list[cfg->txfm_type_row];
188
1.23M
}
189
190
void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
191
                             const TXFM_2D_FLIP_CFG *cfg, TX_SIZE tx_size,
192
1.23M
                             int bd) {
193
1.23M
  const int fwd_shift = inv_start_range[tx_size];
194
1.23M
  const int8_t *shift = cfg->shift;
195
1.23M
  int8_t opt_range_row, opt_range_col;
196
1.23M
  if (bd == 8) {
197
651k
    opt_range_row = 16;
198
651k
    opt_range_col = 16;
199
651k
  } else if (bd == 10) {
200
557k
    opt_range_row = 18;
201
557k
    opt_range_col = 16;
202
557k
  } else {
203
28.6k
    assert(bd == 12);
204
28.6k
    opt_range_row = 20;
205
28.6k
    opt_range_col = 18;
206
28.6k
  }
207
  // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
208
10.1M
  for (int i = 0; i < cfg->stage_num_row && i < MAX_TXFM_STAGE_NUM; ++i) {
209
8.94M
    int real_range_row = cfg->stage_range_row[i] + fwd_shift + bd + 1;
210
8.94M
    (void)real_range_row;
211
8.94M
    if (cfg->txfm_type_row == TXFM_TYPE_ADST4 && i == 1) {
212
      // the adst4 may use 1 extra bit on top of opt_range_row at stage 1
213
      // so opt_range_row >= real_range_row will not hold
214
99.2k
      stage_range_row[i] = opt_range_row;
215
8.85M
    } else {
216
8.85M
      assert(opt_range_row >= real_range_row);
217
8.85M
      stage_range_row[i] = opt_range_row;
218
8.85M
    }
219
8.94M
  }
220
  // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
221
9.74M
  for (int i = 0; i < cfg->stage_num_col && i < MAX_TXFM_STAGE_NUM; ++i) {
222
8.51M
    int real_range_col =
223
8.51M
        cfg->stage_range_col[i] + fwd_shift + shift[0] + bd + 1;
224
8.51M
    (void)real_range_col;
225
8.51M
    if (cfg->txfm_type_col == TXFM_TYPE_ADST4 && i == 1) {
226
      // the adst4 may use 1 extra bit on top of opt_range_col at stage 1
227
      // so opt_range_col >= real_range_col will not hold
228
119k
      stage_range_col[i] = opt_range_col;
229
8.39M
    } else {
230
8.39M
      assert(opt_range_col >= real_range_col);
231
8.39M
      stage_range_col[i] = opt_range_col;
232
8.39M
    }
233
8.51M
  }
234
1.23M
}
235
236
static inline void inv_txfm2d_add_c(const int32_t *input, uint16_t *output,
237
                                    int stride, TXFM_2D_FLIP_CFG *cfg,
238
                                    int32_t *txfm_buf, TX_SIZE tx_size,
239
1.23M
                                    int bd) {
240
  // Note when assigning txfm_size_col, we use the txfm_size from the
241
  // row configuration and vice versa. This is intentionally done to
242
  // accurately perform rectangular transforms. When the transform is
243
  // rectangular, the number of columns will be the same as the
244
  // txfm_size stored in the row cfg struct. It will make no difference
245
  // for square transforms.
246
1.23M
  const int txfm_size_col = tx_size_wide[cfg->tx_size];
247
1.23M
  const int txfm_size_row = tx_size_high[cfg->tx_size];
248
  // Take the shift from the larger dimension in the rectangular case.
249
1.23M
  const int8_t *shift = cfg->shift;
250
1.23M
  const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
251
1.23M
  int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
252
1.23M
  int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
253
1.23M
  assert(cfg->stage_num_row <= MAX_TXFM_STAGE_NUM);
254
1.23M
  assert(cfg->stage_num_col <= MAX_TXFM_STAGE_NUM);
255
1.23M
  av1_gen_inv_stage_range(stage_range_col, stage_range_row, cfg, tx_size, bd);
256
257
1.23M
  const int8_t cos_bit_col = cfg->cos_bit_col;
258
1.23M
  const int8_t cos_bit_row = cfg->cos_bit_row;
259
1.23M
  const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->txfm_type_col);
260
1.23M
  const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->txfm_type_row);
261
262
  // txfm_buf's length is  txfm_size_row * txfm_size_col + 2 *
263
  // AOMMAX(txfm_size_row, txfm_size_col)
264
  // it is used for intermediate data buffering
265
1.23M
  const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
266
1.23M
  int32_t *temp_in = txfm_buf;
267
1.23M
  int32_t *temp_out = temp_in + buf_offset;
268
1.23M
  int32_t *buf = temp_out + buf_offset;
269
1.23M
  int32_t *buf_ptr = buf;
270
1.23M
  int c, r;
271
272
  // Rows
273
17.4M
  for (r = 0; r < txfm_size_row; ++r) {
274
16.1M
    if (abs(rect_type) == 1) {
275
78.6M
      for (c = 0; c < txfm_size_col; ++c) {
276
74.1M
        temp_in[c] = round_shift(
277
74.1M
            (int64_t)input[c * txfm_size_row + r] * NewInvSqrt2, NewSqrt2Bits);
278
74.1M
      }
279
4.49M
      clamp_buf(temp_in, txfm_size_col, bd + 8);
280
4.49M
      txfm_func_row(temp_in, buf_ptr, cos_bit_row, stage_range_row);
281
11.6M
    } else {
282
284M
      for (c = 0; c < txfm_size_col; ++c) {
283
273M
        temp_in[c] = input[c * txfm_size_row + r];
284
273M
      }
285
11.6M
      clamp_buf(temp_in, txfm_size_col, bd + 8);
286
11.6M
      txfm_func_row(temp_in, buf_ptr, cos_bit_row, stage_range_row);
287
11.6M
    }
288
16.1M
    av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
289
16.1M
    buf_ptr += txfm_size_col;
290
16.1M
  }
291
292
  // Columns
293
18.3M
  for (c = 0; c < txfm_size_col; ++c) {
294
17.0M
    if (cfg->lr_flip == 0) {
295
363M
      for (r = 0; r < txfm_size_row; ++r)
296
346M
        temp_in[r] = buf[r * txfm_size_col + c];
297
17.0M
    } else {
298
      // flip left right
299
323k
      for (r = 0; r < txfm_size_row; ++r)
300
292k
        temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
301
30.7k
    }
302
17.0M
    clamp_buf(temp_in, txfm_size_row, AOMMAX(bd + 6, 16));
303
17.0M
    txfm_func_col(temp_in, temp_out, cos_bit_col, stage_range_col);
304
17.0M
    av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
305
17.0M
    if (cfg->ud_flip == 0) {
306
363M
      for (r = 0; r < txfm_size_row; ++r) {
307
346M
        output[r * stride + c] =
308
346M
            highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
309
346M
      }
310
17.0M
    } else {
311
      // flip upside down
312
349k
      for (r = 0; r < txfm_size_row; ++r) {
313
312k
        output[r * stride + c] = highbd_clip_pixel_add(
314
312k
            output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
315
312k
      }
316
36.9k
    }
317
17.0M
  }
318
1.23M
}
319
320
static inline void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
321
                                         int stride, int32_t *txfm_buf,
322
                                         TX_TYPE tx_type, TX_SIZE tx_size,
323
1.23M
                                         int bd) {
324
1.23M
  TXFM_2D_FLIP_CFG cfg;
325
1.23M
  av1_get_inv_txfm_cfg(tx_type, tx_size, &cfg);
326
  // Forward shift sum uses larger square size, to be consistent with what
327
  // av1_gen_inv_stage_range() does for inverse shifts.
328
1.23M
  inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf, tx_size, bd);
329
1.23M
}
330
331
void av1_inv_txfm2d_add_4x8_c(const int32_t *input, uint16_t *output,
332
65.3k
                              int stride, TX_TYPE tx_type, int bd) {
333
65.3k
  DECLARE_ALIGNED(32, int, txfm_buf[4 * 8 + 8 + 8]);
334
65.3k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X8, bd);
335
65.3k
}
336
337
void av1_inv_txfm2d_add_8x4_c(const int32_t *input, uint16_t *output,
338
94.2k
                              int stride, TX_TYPE tx_type, int bd) {
339
94.2k
  DECLARE_ALIGNED(32, int, txfm_buf[8 * 4 + 8 + 8]);
340
94.2k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X4, bd);
341
94.2k
}
342
343
void av1_inv_txfm2d_add_8x16_c(const int32_t *input, uint16_t *output,
344
60.7k
                               int stride, TX_TYPE tx_type, int bd) {
345
60.7k
  DECLARE_ALIGNED(32, int, txfm_buf[8 * 16 + 16 + 16]);
346
60.7k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X16, bd);
347
60.7k
}
348
349
void av1_inv_txfm2d_add_16x8_c(const int32_t *input, uint16_t *output,
350
95.2k
                               int stride, TX_TYPE tx_type, int bd) {
351
95.2k
  DECLARE_ALIGNED(32, int, txfm_buf[16 * 8 + 16 + 16]);
352
95.2k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X8, bd);
353
95.2k
}
354
355
void av1_inv_txfm2d_add_16x32_c(const int32_t *input, uint16_t *output,
356
29.1k
                                int stride, TX_TYPE tx_type, int bd) {
357
29.1k
  DECLARE_ALIGNED(32, int, txfm_buf[16 * 32 + 32 + 32]);
358
29.1k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X32, bd);
359
29.1k
}
360
361
void av1_inv_txfm2d_add_32x16_c(const int32_t *input, uint16_t *output,
362
25.6k
                                int stride, TX_TYPE tx_type, int bd) {
363
25.6k
  DECLARE_ALIGNED(32, int, txfm_buf[32 * 16 + 32 + 32]);
364
25.6k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X16, bd);
365
25.6k
}
366
367
void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output,
368
139k
                              int stride, TX_TYPE tx_type, int bd) {
369
139k
  DECLARE_ALIGNED(32, int, txfm_buf[4 * 4 + 4 + 4]);
370
139k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X4, bd);
371
139k
}
372
373
void av1_inv_txfm2d_add_8x8_c(const int32_t *input, uint16_t *output,
374
288k
                              int stride, TX_TYPE tx_type, int bd) {
375
288k
  DECLARE_ALIGNED(32, int, txfm_buf[8 * 8 + 8 + 8]);
376
288k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X8, bd);
377
288k
}
378
379
void av1_inv_txfm2d_add_16x16_c(const int32_t *input, uint16_t *output,
380
134k
                                int stride, TX_TYPE tx_type, int bd) {
381
134k
  DECLARE_ALIGNED(32, int, txfm_buf[16 * 16 + 16 + 16]);
382
134k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X16, bd);
383
134k
}
384
385
void av1_inv_txfm2d_add_32x32_c(const int32_t *input, uint16_t *output,
386
88.9k
                                int stride, TX_TYPE tx_type, int bd) {
387
88.9k
  DECLARE_ALIGNED(32, int, txfm_buf[32 * 32 + 32 + 32]);
388
88.9k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X32, bd);
389
88.9k
}
390
391
void av1_inv_txfm2d_add_64x64_c(const int32_t *input, uint16_t *output,
392
23.6k
                                int stride, TX_TYPE tx_type, int bd) {
393
  // TODO(urvang): Can the same array be reused, instead of using a new array?
394
  // Remap 32x32 input into a modified 64x64 by:
395
  // - Copying over these values in top-left 32x32 locations.
396
  // - Setting the rest of the locations to 0.
397
23.6k
  int32_t mod_input[64 * 64];
398
781k
  for (int col = 0; col < 32; ++col) {
399
758k
    memcpy(mod_input + col * 64, input + col * 32, 32 * sizeof(*mod_input));
400
758k
    memset(mod_input + col * 64 + 32, 0, 32 * sizeof(*mod_input));
401
758k
  }
402
23.6k
  memset(mod_input + 32 * 64, 0, 32 * 64 * sizeof(*mod_input));
403
23.6k
  DECLARE_ALIGNED(32, int, txfm_buf[64 * 64 + 64 + 64]);
404
23.6k
  inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_64X64,
405
23.6k
                        bd);
406
23.6k
}
407
408
void av1_inv_txfm2d_add_64x32_c(const int32_t *input, uint16_t *output,
409
4.18k
                                int stride, TX_TYPE tx_type, int bd) {
410
  // Remap 32x32 input into a modified 64x32 by:
411
  // - Copying over these values in top-left 32x32 locations.
412
  // - Setting the rest of the locations to 0.
413
4.18k
  int32_t mod_input[32 * 64];
414
4.18k
  memcpy(mod_input, input, 32 * 32 * sizeof(*mod_input));
415
4.18k
  memset(mod_input + 32 * 32, 0, 32 * 32 * sizeof(*mod_input));
416
4.18k
  DECLARE_ALIGNED(32, int, txfm_buf[64 * 32 + 64 + 64]);
417
4.18k
  inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_64X32,
418
4.18k
                        bd);
419
4.18k
}
420
421
void av1_inv_txfm2d_add_32x64_c(const int32_t *input, uint16_t *output,
422
6.06k
                                int stride, TX_TYPE tx_type, int bd) {
423
  // Remap 32x32 input into a modified 32x64 input by:
424
  // - Copying over these values in top-left 32x32 locations.
425
  // - Setting the rest of the locations to 0.
426
6.06k
  int32_t mod_input[64 * 32];
427
200k
  for (int col = 0; col < 32; ++col) {
428
194k
    memcpy(mod_input + col * 64, input + col * 32, 32 * sizeof(*mod_input));
429
194k
    memset(mod_input + col * 64 + 32, 0, 32 * sizeof(*mod_input));
430
194k
  }
431
6.06k
  DECLARE_ALIGNED(32, int, txfm_buf[64 * 32 + 64 + 64]);
432
6.06k
  inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_32X64,
433
6.06k
                        bd);
434
6.06k
}
435
436
void av1_inv_txfm2d_add_16x64_c(const int32_t *input, uint16_t *output,
437
4.68k
                                int stride, TX_TYPE tx_type, int bd) {
438
  // Remap 16x32 input into a modified 16x64 input by:
439
  // - Copying over these values in top-left 16x32 locations.
440
  // - Setting the rest of the locations to 0.
441
4.68k
  int32_t mod_input[64 * 16];
442
79.6k
  for (int col = 0; col < 16; ++col) {
443
74.9k
    memcpy(mod_input + col * 64, input + col * 32, 32 * sizeof(*mod_input));
444
74.9k
    memset(mod_input + col * 64 + 32, 0, 32 * sizeof(*mod_input));
445
74.9k
  }
446
4.68k
  DECLARE_ALIGNED(32, int, txfm_buf[16 * 64 + 64 + 64]);
447
4.68k
  inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_16X64,
448
4.68k
                        bd);
449
4.68k
}
450
451
void av1_inv_txfm2d_add_64x16_c(const int32_t *input, uint16_t *output,
452
3.54k
                                int stride, TX_TYPE tx_type, int bd) {
453
  // Remap 32x16 input into a modified 64x16 by:
454
  // - Copying over these values in top-left 32x16 locations.
455
  // - Setting the rest of the locations to 0.
456
3.54k
  int32_t mod_input[16 * 64];
457
3.54k
  memcpy(mod_input, input, 16 * 32 * sizeof(*mod_input));
458
3.54k
  memset(mod_input + 16 * 32, 0, 16 * 32 * sizeof(*mod_input));
459
3.54k
  DECLARE_ALIGNED(32, int, txfm_buf[16 * 64 + 64 + 64]);
460
3.54k
  inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_64X16,
461
3.54k
                        bd);
462
3.54k
}
463
464
void av1_inv_txfm2d_add_4x16_c(const int32_t *input, uint16_t *output,
465
42.0k
                               int stride, TX_TYPE tx_type, int bd) {
466
42.0k
  DECLARE_ALIGNED(32, int, txfm_buf[4 * 16 + 16 + 16]);
467
42.0k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X16, bd);
468
42.0k
}
469
470
void av1_inv_txfm2d_add_16x4_c(const int32_t *input, uint16_t *output,
471
75.5k
                               int stride, TX_TYPE tx_type, int bd) {
472
75.5k
  DECLARE_ALIGNED(32, int, txfm_buf[4 * 16 + 16 + 16]);
473
75.5k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X4, bd);
474
75.5k
}
475
476
void av1_inv_txfm2d_add_8x32_c(const int32_t *input, uint16_t *output,
477
22.4k
                               int stride, TX_TYPE tx_type, int bd) {
478
22.4k
  DECLARE_ALIGNED(32, int, txfm_buf[8 * 32 + 32 + 32]);
479
22.4k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X32, bd);
480
22.4k
}
481
482
void av1_inv_txfm2d_add_32x8_c(const int32_t *input, uint16_t *output,
483
33.1k
                               int stride, TX_TYPE tx_type, int bd) {
484
33.1k
  DECLARE_ALIGNED(32, int, txfm_buf[8 * 32 + 32 + 32]);
485
33.1k
  inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X8, bd);
486
33.1k
}