hybrid_fwd_txfm.c 17.2 KB
Newer Older
Angie Chiang's avatar
Angie Chiang committed
1
/*
Yaowu Xu's avatar
Yaowu Xu committed
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Angie Chiang's avatar
Angie Chiang committed
3
 *
Yaowu Xu's avatar
Yaowu Xu committed
4
5
6
7
8
9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Angie Chiang's avatar
Angie Chiang committed
10
11
 */

Yaowu Xu's avatar
Yaowu Xu committed
12
13
14
#include "./av1_rtcd.h"
#include "./aom_config.h"
#include "./aom_dsp_rtcd.h"
Angie Chiang's avatar
Angie Chiang committed
15

16
17
#include "av1/common/idct.h"
#include "av1/encoder/hybrid_fwd_txfm.h"
Angie Chiang's avatar
Angie Chiang committed
18

19
#if CONFIG_CHROMA_2X2
Jingning Han's avatar
Jingning Han committed
20
static void fwd_txfm_2x2(const int16_t *src_diff, tran_low_t *coeff,
21
                         int diff_stride, TxfmParam *txfm_param) {
Jingning Han's avatar
Jingning Han committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  tran_high_t a1 = src_diff[0];
  tran_high_t b1 = src_diff[1];
  tran_high_t c1 = src_diff[diff_stride];
  tran_high_t d1 = src_diff[1 + diff_stride];

  tran_high_t a2 = a1 + c1;
  tran_high_t b2 = b1 + d1;
  tran_high_t c2 = a1 - c1;
  tran_high_t d2 = b1 - d1;

  a1 = a2 + b2;
  b1 = a2 - b2;
  c1 = c2 + d2;
  d1 = c2 - d2;

  coeff[0] = (tran_low_t)(4 * a1);
  coeff[1] = (tran_low_t)(4 * b1);
  coeff[2] = (tran_low_t)(4 * c1);
  coeff[3] = (tran_low_t)(4 * d1);

42
  (void)txfm_param;
Jingning Han's avatar
Jingning Han committed
43
44
45
}
#endif

46
static void fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
47
48
49
                         int diff_stride, TxfmParam *txfm_param) {
  if (txfm_param->lossless) {
    assert(txfm_param->tx_type == DCT_DCT);
Yaowu Xu's avatar
Yaowu Xu committed
50
    av1_fwht4x4(src_diff, coeff, diff_stride);
Angie Chiang's avatar
Angie Chiang committed
51
52
53
    return;
  }

Lester Lu's avatar
Lester Lu committed
54
55
#if CONFIG_LGT
  // only C version has LGTs
56
  av1_fht4x4_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
57
#else
58
  av1_fht4x4(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
59
#endif
Angie Chiang's avatar
Angie Chiang committed
60
61
}

62
static void fwd_txfm_4x8(const int16_t *src_diff, tran_low_t *coeff,
63
                         int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
64
#if CONFIG_LGT
65
  av1_fht4x8_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
66
#else
67
  av1_fht4x8(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
68
#endif
69
70
}

71
static void fwd_txfm_8x4(const int16_t *src_diff, tran_low_t *coeff,
72
                         int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
73
#if CONFIG_LGT
74
  av1_fht8x4_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
75
#else
76
  av1_fht8x4(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
77
#endif
78
79
80
}

static void fwd_txfm_8x16(const int16_t *src_diff, tran_low_t *coeff,
81
                          int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
82
#if CONFIG_LGT
83
  av1_fht8x16_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
84
#else
85
  av1_fht8x16(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
86
#endif
87
88
89
}

static void fwd_txfm_16x8(const int16_t *src_diff, tran_low_t *coeff,
90
                          int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
91
#if CONFIG_LGT
92
  av1_fht16x8_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
93
#else
94
  av1_fht16x8(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
95
#endif
96
97
98
}

static void fwd_txfm_16x32(const int16_t *src_diff, tran_low_t *coeff,
99
100
                           int diff_stride, TxfmParam *txfm_param) {
  av1_fht16x32(src_diff, coeff, diff_stride, txfm_param);
101
102
103
}

static void fwd_txfm_32x16(const int16_t *src_diff, tran_low_t *coeff,
104
105
                           int diff_stride, TxfmParam *txfm_param) {
  av1_fht32x16(src_diff, coeff, diff_stride, txfm_param);
106
107
}

Angie Chiang's avatar
Angie Chiang committed
108
static void fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff,
109
                         int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
110
#if CONFIG_LGT
111
  av1_fht8x8_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
112
#else
113
  av1_fht8x8(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
114
#endif
Angie Chiang's avatar
Angie Chiang committed
115
116
117
}

static void fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff,
118
119
                           int diff_stride, TxfmParam *txfm_param) {
  av1_fht16x16(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
120
121
}

122
static void fwd_txfm_32x32(const int16_t *src_diff, tran_low_t *coeff,
123
                           int diff_stride, TxfmParam *txfm_param) {
Sarah Parker's avatar
Sarah Parker committed
124
125
126
127
128
129
130
#if CONFIG_MRC_TX
  // MRC_DCT currently only has a C implementation
  if (txfm_param->tx_type == MRC_DCT) {
    av1_fht32x32_c(src_diff, coeff, diff_stride, txfm_param);
    return;
  }
#endif  // CONFIG_MRC_TX
131
  av1_fht32x32(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
132
133
}

134
135
#if CONFIG_TX64X64
static void fwd_txfm_64x64(const int16_t *src_diff, tran_low_t *coeff,
136
                           int diff_stride, TxfmParam *txfm_param) {
137
#if CONFIG_EXT_TX
138
139
  if (txfm_param->tx_type == IDTX)
    av1_fwd_idtx_c(src_diff, coeff, diff_stride, 64, txfm_param->tx_type);
Angie Chiang's avatar
Angie Chiang committed
140
141
  else
#endif
142
    av1_fht64x64(src_diff, coeff, diff_stride, txfm_param);
143
144
145
}
#endif  // CONFIG_TX64X64

Yue Chen's avatar
Yue Chen committed
146
#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
147
static void fwd_txfm_16x4(const int16_t *src_diff, tran_low_t *coeff,
148
                          int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
149
#if CONFIG_LGT
150
  av1_fht16x4_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
151
#else
152
  av1_fht16x4(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
153
#endif
154
155
156
}

static void fwd_txfm_4x16(const int16_t *src_diff, tran_low_t *coeff,
157
                          int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
158
#if CONFIG_LGT
159
  av1_fht4x16_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
160
#else
161
  av1_fht4x16(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
162
#endif
163
164
165
}

static void fwd_txfm_32x8(const int16_t *src_diff, tran_low_t *coeff,
166
                          int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
167
#if CONFIG_LGT
168
  av1_fht32x8_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
169
#else
170
  av1_fht32x8(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
171
#endif
172
173
174
}

static void fwd_txfm_8x32(const int16_t *src_diff, tran_low_t *coeff,
175
                          int diff_stride, TxfmParam *txfm_param) {
Lester Lu's avatar
Lester Lu committed
176
#if CONFIG_LGT
177
  av1_fht8x32_c(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
178
#else
179
  av1_fht8x32(src_diff, coeff, diff_stride, txfm_param);
Lester Lu's avatar
Lester Lu committed
180
#endif
181
}
Yue Chen's avatar
Yue Chen committed
182
#endif
183

184
#if CONFIG_CHROMA_2X2
185
static void highbd_fwd_txfm_2x2(const int16_t *src_diff, tran_low_t *coeff,
186
                                int diff_stride, TxfmParam *txfm_param) {
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
  tran_high_t a1 = src_diff[0];
  tran_high_t b1 = src_diff[1];
  tran_high_t c1 = src_diff[diff_stride];
  tran_high_t d1 = src_diff[1 + diff_stride];

  tran_high_t a2 = a1 + c1;
  tran_high_t b2 = b1 + d1;
  tran_high_t c2 = a1 - c1;
  tran_high_t d2 = b1 - d1;

  a1 = a2 + b2;
  b1 = a2 - b2;
  c1 = c2 + d2;
  d1 = c2 - d2;

  coeff[0] = (tran_low_t)(4 * a1);
  coeff[1] = (tran_low_t)(4 * b1);
  coeff[2] = (tran_low_t)(4 * c1);
  coeff[3] = (tran_low_t)(4 * d1);

207
  (void)txfm_param;
208
209
210
}
#endif

211
static void highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
212
                                int diff_stride, TxfmParam *txfm_param) {
213
  int32_t *dst_coeff = (int32_t *)coeff;
214
215
216
  const int tx_type = txfm_param->tx_type;
  const int bd = txfm_param->bd;
  if (txfm_param->lossless) {
Angie Chiang's avatar
Angie Chiang committed
217
    assert(tx_type == DCT_DCT);
Yaowu Xu's avatar
Yaowu Xu committed
218
    av1_highbd_fwht4x4(src_diff, coeff, diff_stride);
Angie Chiang's avatar
Angie Chiang committed
219
220
221
222
223
224
225
    return;
  }
  switch (tx_type) {
    case DCT_DCT:
    case ADST_DCT:
    case DCT_ADST:
    case ADST_ADST:
226
      // fallthrough intended
227
      av1_fwd_txfm2d_4x4(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
228
229
230
231
232
233
234
      break;
#if CONFIG_EXT_TX
    case FLIPADST_DCT:
    case DCT_FLIPADST:
    case FLIPADST_FLIPADST:
    case ADST_FLIPADST:
    case FLIPADST_ADST:
235
      // fallthrough intended
236
      av1_fwd_txfm2d_4x4(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
237
      break;
238
    // use the c version for anything including identity for now
239
    case V_DCT:
240
241
242
243
244
    case H_DCT:
    case V_ADST:
    case H_ADST:
    case V_FLIPADST:
    case H_FLIPADST:
245
246
    case IDTX:
      // fallthrough intended
247
      av1_fwd_txfm2d_4x4_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
Debargha Mukherjee's avatar
Debargha Mukherjee committed
248
      break;
Angie Chiang's avatar
Angie Chiang committed
249
#endif  // CONFIG_EXT_TX
250
    default: assert(0);
Angie Chiang's avatar
Angie Chiang committed
251
252
253
  }
}

254
static void highbd_fwd_txfm_4x8(const int16_t *src_diff, tran_low_t *coeff,
255
                                int diff_stride, TxfmParam *txfm_param) {
256
  int32_t *dst_coeff = (int32_t *)coeff;
257
258
  av1_fwd_txfm2d_4x8_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type,
                       txfm_param->bd);
259
260
}

261
static void highbd_fwd_txfm_8x4(const int16_t *src_diff, tran_low_t *coeff,
262
                                int diff_stride, TxfmParam *txfm_param) {
263
  int32_t *dst_coeff = (int32_t *)coeff;
264
265
  av1_fwd_txfm2d_8x4_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type,
                       txfm_param->bd);
266
267
268
}

static void highbd_fwd_txfm_8x16(const int16_t *src_diff, tran_low_t *coeff,
269
                                 int diff_stride, TxfmParam *txfm_param) {
270
  int32_t *dst_coeff = (int32_t *)coeff;
271
272
  av1_fwd_txfm2d_8x16_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type,
                        txfm_param->bd);
273
274
275
}

static void highbd_fwd_txfm_16x8(const int16_t *src_diff, tran_low_t *coeff,
276
                                 int diff_stride, TxfmParam *txfm_param) {
277
  int32_t *dst_coeff = (int32_t *)coeff;
278
279
  av1_fwd_txfm2d_16x8_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type,
                        txfm_param->bd);
280
281
282
}

static void highbd_fwd_txfm_16x32(const int16_t *src_diff, tran_low_t *coeff,
283
                                  int diff_stride, TxfmParam *txfm_param) {
284
  int32_t *dst_coeff = (int32_t *)coeff;
285
286
  av1_fwd_txfm2d_16x32_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type,
                         txfm_param->bd);
287
288
289
}

static void highbd_fwd_txfm_32x16(const int16_t *src_diff, tran_low_t *coeff,
290
                                  int diff_stride, TxfmParam *txfm_param) {
291
  int32_t *dst_coeff = (int32_t *)coeff;
292
293
  av1_fwd_txfm2d_32x16_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type,
                         txfm_param->bd);
294
295
}

Angie Chiang's avatar
Angie Chiang committed
296
static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff,
297
                                int diff_stride, TxfmParam *txfm_param) {
298
  int32_t *dst_coeff = (int32_t *)coeff;
299
300
  const int tx_type = txfm_param->tx_type;
  const int bd = txfm_param->bd;
Angie Chiang's avatar
Angie Chiang committed
301
302
303
304
305
  switch (tx_type) {
    case DCT_DCT:
    case ADST_DCT:
    case DCT_ADST:
    case ADST_ADST:
306
      // fallthrough intended
307
      av1_fwd_txfm2d_8x8(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
308
309
310
311
312
313
314
      break;
#if CONFIG_EXT_TX
    case FLIPADST_DCT:
    case DCT_FLIPADST:
    case FLIPADST_FLIPADST:
    case ADST_FLIPADST:
    case FLIPADST_ADST:
315
      // fallthrough intended
316
      av1_fwd_txfm2d_8x8(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
317
      break;
318
    // use the c version for anything including identity for now
Debargha Mukherjee's avatar
Debargha Mukherjee committed
319
    case V_DCT:
320
321
322
323
324
    case H_DCT:
    case V_ADST:
    case H_ADST:
    case V_FLIPADST:
    case H_FLIPADST:
325
326
    case IDTX:
      // fallthrough intended
327
      av1_fwd_txfm2d_8x8_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
328
329
      break;
#endif  // CONFIG_EXT_TX
330
    default: assert(0);
Angie Chiang's avatar
Angie Chiang committed
331
332
333
334
  }
}

static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff,
335
                                  int diff_stride, TxfmParam *txfm_param) {
336
  int32_t *dst_coeff = (int32_t *)coeff;
337
338
  const int tx_type = txfm_param->tx_type;
  const int bd = txfm_param->bd;
Angie Chiang's avatar
Angie Chiang committed
339
340
341
342
343
  switch (tx_type) {
    case DCT_DCT:
    case ADST_DCT:
    case DCT_ADST:
    case ADST_ADST:
344
      // fallthrough intended
345
      av1_fwd_txfm2d_16x16(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
346
347
348
349
350
351
352
      break;
#if CONFIG_EXT_TX
    case FLIPADST_DCT:
    case DCT_FLIPADST:
    case FLIPADST_FLIPADST:
    case ADST_FLIPADST:
    case FLIPADST_ADST:
353
      // fallthrough intended
354
      av1_fwd_txfm2d_16x16(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
355
      break;
356
    // use the c version for anything including identity for now
Debargha Mukherjee's avatar
Debargha Mukherjee committed
357
    case V_DCT:
358
359
360
361
362
    case H_DCT:
    case V_ADST:
    case H_ADST:
    case V_FLIPADST:
    case H_FLIPADST:
363
364
    case IDTX:
      // fallthrough intended
365
      av1_fwd_txfm2d_16x16_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
Angie Chiang's avatar
Angie Chiang committed
366
367
      break;
#endif  // CONFIG_EXT_TX
368
    default: assert(0);
Angie Chiang's avatar
Angie Chiang committed
369
370
371
  }
}

372
static void highbd_fwd_txfm_32x32(const int16_t *src_diff, tran_low_t *coeff,
373
                                  int diff_stride, TxfmParam *txfm_param) {
374
  int32_t *dst_coeff = (int32_t *)coeff;
375
376
  const int tx_type = txfm_param->tx_type;
  const int bd = txfm_param->bd;
Angie Chiang's avatar
Angie Chiang committed
377
378
379
380
381
  switch (tx_type) {
    case DCT_DCT:
    case ADST_DCT:
    case DCT_ADST:
    case ADST_ADST:
382
      // fallthrough intended
383
      av1_fwd_txfm2d_32x32(src_diff, dst_coeff, diff_stride, tx_type, bd);
384
385
      break;
#if CONFIG_EXT_TX
386
387
388
389
390
    case FLIPADST_DCT:
    case DCT_FLIPADST:
    case FLIPADST_FLIPADST:
    case ADST_FLIPADST:
    case FLIPADST_ADST:
391
      // fallthrough intended
392
      av1_fwd_txfm2d_32x32(src_diff, dst_coeff, diff_stride, tx_type, bd);
393
394
      break;
    // use the c version for anything including identity for now
395
    case V_DCT:
396
397
398
399
400
    case H_DCT:
    case V_ADST:
    case H_ADST:
    case V_FLIPADST:
    case H_FLIPADST:
401
402
    case IDTX:
      // fallthrough intended
403
      av1_fwd_txfm2d_32x32_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
404
405
      break;
#endif  // CONFIG_EXT_TX
406
    default: assert(0);
Angie Chiang's avatar
Angie Chiang committed
407
408
  }
}
409
410
411

#if CONFIG_TX64X64
static void highbd_fwd_txfm_64x64(const int16_t *src_diff, tran_low_t *coeff,
412
                                  int diff_stride, TxfmParam *txfm_param) {
413
  int32_t *dst_coeff = (int32_t *)coeff;
414
415
  const int tx_type = txfm_param->tx_type;
  const int bd = txfm_param->bd;
416
417
  switch (tx_type) {
    case DCT_DCT:
418
      av1_fwd_txfm2d_64x64(src_diff, dst_coeff, diff_stride, tx_type, bd);
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
      break;
#if CONFIG_EXT_TX
    case ADST_DCT:
    case DCT_ADST:
    case ADST_ADST:
    case FLIPADST_DCT:
    case DCT_FLIPADST:
    case FLIPADST_FLIPADST:
    case ADST_FLIPADST:
    case FLIPADST_ADST:
    case V_DCT:
    case H_DCT:
    case V_ADST:
    case H_ADST:
    case V_FLIPADST:
    case H_FLIPADST:
435
436
437
438
439
440
      // TODO(sarahparker)
      // I've deleted the 64x64 implementations that existed in lieu
      // of adst, flipadst and identity for simplicity but will bring back
      // in a later change. This shouldn't impact performance since
      // DCT_DCT is the only extended type currently allowed for 64x64,
      // as dictated by get_ext_tx_set_type in blockd.h.
441
      av1_fwd_txfm2d_64x64_c(src_diff, dst_coeff, diff_stride, DCT_DCT, bd);
442
      break;
443
444
445
    case IDTX:
      av1_fwd_idtx_c(src_diff, dst_coeff, diff_stride, 64, tx_type);
      break;
446
447
448
449
450
#endif  // CONFIG_EXT_TX
    default: assert(0); break;
  }
}
#endif  // CONFIG_TX64X64
Angie Chiang's avatar
Angie Chiang committed
451

hui su's avatar
hui su committed
452
void av1_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, int diff_stride,
453
454
                  TxfmParam *txfm_param) {
  const TX_SIZE tx_size = txfm_param->tx_size;
Angie Chiang's avatar
Angie Chiang committed
455
  switch (tx_size) {
456
457
#if CONFIG_TX64X64
    case TX_64X64:
458
      fwd_txfm_64x64(src_diff, coeff, diff_stride, txfm_param);
459
460
      break;
#endif  // CONFIG_TX64X64
Angie Chiang's avatar
Angie Chiang committed
461
    case TX_32X32:
462
      fwd_txfm_32x32(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
463
464
      break;
    case TX_16X16:
465
      fwd_txfm_16x16(src_diff, coeff, diff_stride, txfm_param);
466
      break;
467
468
469
    case TX_8X8: fwd_txfm_8x8(src_diff, coeff, diff_stride, txfm_param); break;
    case TX_4X8: fwd_txfm_4x8(src_diff, coeff, diff_stride, txfm_param); break;
    case TX_8X4: fwd_txfm_8x4(src_diff, coeff, diff_stride, txfm_param); break;
470
    case TX_8X16:
471
      fwd_txfm_8x16(src_diff, coeff, diff_stride, txfm_param);
472
473
      break;
    case TX_16X8:
474
      fwd_txfm_16x8(src_diff, coeff, diff_stride, txfm_param);
475
476
      break;
    case TX_16X32:
477
      fwd_txfm_16x32(src_diff, coeff, diff_stride, txfm_param);
478
479
      break;
    case TX_32X16:
480
      fwd_txfm_32x16(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
481
      break;
482
    case TX_4X4: fwd_txfm_4x4(src_diff, coeff, diff_stride, txfm_param); break;
483
#if CONFIG_CHROMA_2X2
484
    case TX_2X2: fwd_txfm_2x2(src_diff, coeff, diff_stride, txfm_param); break;
Jingning Han's avatar
Jingning Han committed
485
#endif
Yue Chen's avatar
Yue Chen committed
486
#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
487
    case TX_4X16:
488
      fwd_txfm_4x16(src_diff, coeff, diff_stride, txfm_param);
489
490
      break;
    case TX_16X4:
491
      fwd_txfm_16x4(src_diff, coeff, diff_stride, txfm_param);
492
493
      break;
    case TX_8X32:
494
      fwd_txfm_8x32(src_diff, coeff, diff_stride, txfm_param);
495
496
      break;
    case TX_32X8:
497
      fwd_txfm_32x8(src_diff, coeff, diff_stride, txfm_param);
498
      break;
Yue Chen's avatar
Yue Chen committed
499
#endif
500
    default: assert(0); break;
Angie Chiang's avatar
Angie Chiang committed
501
502
503
  }
}

hui su's avatar
hui su committed
504
void av1_highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff,
505
506
                         int diff_stride, TxfmParam *txfm_param) {
  const TX_SIZE tx_size = txfm_param->tx_size;
Angie Chiang's avatar
Angie Chiang committed
507
  switch (tx_size) {
508
509
#if CONFIG_TX64X64
    case TX_64X64:
510
      highbd_fwd_txfm_64x64(src_diff, coeff, diff_stride, txfm_param);
511
512
      break;
#endif  // CONFIG_TX64X64
Angie Chiang's avatar
Angie Chiang committed
513
    case TX_32X32:
514
      highbd_fwd_txfm_32x32(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
515
516
      break;
    case TX_16X16:
517
      highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
518
519
      break;
    case TX_8X8:
520
      highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
521
      break;
522
    case TX_4X8:
523
      highbd_fwd_txfm_4x8(src_diff, coeff, diff_stride, txfm_param);
524
525
      break;
    case TX_8X4:
526
      highbd_fwd_txfm_8x4(src_diff, coeff, diff_stride, txfm_param);
527
      break;
528
    case TX_8X16:
529
      highbd_fwd_txfm_8x16(src_diff, coeff, diff_stride, txfm_param);
530
531
      break;
    case TX_16X8:
532
      highbd_fwd_txfm_16x8(src_diff, coeff, diff_stride, txfm_param);
533
534
      break;
    case TX_16X32:
535
      highbd_fwd_txfm_16x32(src_diff, coeff, diff_stride, txfm_param);
536
537
      break;
    case TX_32X16:
538
      highbd_fwd_txfm_32x16(src_diff, coeff, diff_stride, txfm_param);
539
      break;
Angie Chiang's avatar
Angie Chiang committed
540
    case TX_4X4:
541
      highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, txfm_param);
Angie Chiang's avatar
Angie Chiang committed
542
      break;
543
#if CONFIG_CHROMA_2X2
544
    case TX_2X2:
545
      highbd_fwd_txfm_2x2(src_diff, coeff, diff_stride, txfm_param);
546
547
      break;
#endif
clang-format's avatar
clang-format committed
548
    default: assert(0); break;
Angie Chiang's avatar
Angie Chiang committed
549
550
  }
}