Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 12 | #include "config/aom_config.h" |
Tom Finegan | 44702c8 | 2018-05-22 13:00:39 -0700 | [diff] [blame^] | 13 | #include "config/av1_rtcd.h" |
| 14 | #include "config/aom_dsp_rtcd.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 15 | |
| 16 | #include "av1/common/idct.h" |
| 17 | #include "av1/encoder/hybrid_fwd_txfm.h" |
| 18 | |
Urvang Joshi | 8207b91 | 2018-05-07 14:37:51 -0700 | [diff] [blame] | 19 | /* 4-point reversible, orthonormal Walsh-Hadamard in 3.5 adds, 0.5 shifts per |
| 20 | pixel. */ |
| 21 | void av1_fwht4x4_c(const int16_t *input, tran_low_t *output, int stride) { |
| 22 | int i; |
| 23 | tran_high_t a1, b1, c1, d1, e1; |
| 24 | const int16_t *ip_pass0 = input; |
| 25 | const tran_low_t *ip = NULL; |
| 26 | tran_low_t *op = output; |
| 27 | |
| 28 | for (i = 0; i < 4; i++) { |
| 29 | a1 = ip_pass0[0 * stride]; |
| 30 | b1 = ip_pass0[1 * stride]; |
| 31 | c1 = ip_pass0[2 * stride]; |
| 32 | d1 = ip_pass0[3 * stride]; |
| 33 | |
| 34 | a1 += b1; |
| 35 | d1 = d1 - c1; |
| 36 | e1 = (a1 - d1) >> 1; |
| 37 | b1 = e1 - b1; |
| 38 | c1 = e1 - c1; |
| 39 | a1 -= c1; |
| 40 | d1 += b1; |
| 41 | op[0] = (tran_low_t)a1; |
| 42 | op[4] = (tran_low_t)c1; |
| 43 | op[8] = (tran_low_t)d1; |
| 44 | op[12] = (tran_low_t)b1; |
| 45 | |
| 46 | ip_pass0++; |
| 47 | op++; |
| 48 | } |
| 49 | ip = output; |
| 50 | op = output; |
| 51 | |
| 52 | for (i = 0; i < 4; i++) { |
| 53 | a1 = ip[0]; |
| 54 | b1 = ip[1]; |
| 55 | c1 = ip[2]; |
| 56 | d1 = ip[3]; |
| 57 | |
| 58 | a1 += b1; |
| 59 | d1 -= c1; |
| 60 | e1 = (a1 - d1) >> 1; |
| 61 | b1 = e1 - b1; |
| 62 | c1 = e1 - c1; |
| 63 | a1 -= c1; |
| 64 | d1 += b1; |
| 65 | op[0] = (tran_low_t)(a1 * UNIT_QUANT_FACTOR); |
| 66 | op[1] = (tran_low_t)(c1 * UNIT_QUANT_FACTOR); |
| 67 | op[2] = (tran_low_t)(d1 * UNIT_QUANT_FACTOR); |
| 68 | op[3] = (tran_low_t)(b1 * UNIT_QUANT_FACTOR); |
| 69 | |
| 70 | ip += 4; |
| 71 | op += 4; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | void av1_highbd_fwht4x4_c(const int16_t *input, tran_low_t *output, |
| 76 | int stride) { |
| 77 | av1_fwht4x4_c(input, output, stride); |
| 78 | } |
| 79 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 80 | static void highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 81 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 82 | int32_t *dst_coeff = (int32_t *)coeff; |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 83 | const TX_TYPE tx_type = txfm_param->tx_type; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 84 | const int bd = txfm_param->bd; |
| 85 | if (txfm_param->lossless) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 86 | assert(tx_type == DCT_DCT); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 87 | av1_highbd_fwht4x4(src_diff, coeff, diff_stride); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 88 | return; |
| 89 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 90 | switch (tx_type) { |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 91 | // use the c version for anything including identity for now |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 92 | case V_DCT: |
| 93 | case H_DCT: |
| 94 | case V_ADST: |
| 95 | case H_ADST: |
| 96 | case V_FLIPADST: |
| 97 | case H_FLIPADST: |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 98 | case IDTX: |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 99 | av1_fwd_txfm2d_4x4_c(src_diff, dst_coeff, diff_stride, tx_type, bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 100 | break; |
Sebastien Alaiwan | 735e750 | 2018-03-21 16:53:10 +0100 | [diff] [blame] | 101 | default: |
| 102 | av1_fwd_txfm2d_4x4(src_diff, dst_coeff, diff_stride, tx_type, bd); |
| 103 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 104 | } |
| 105 | } |
| 106 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 107 | static void highbd_fwd_txfm_4x8(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 108 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 109 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 110 | av1_fwd_txfm2d_4x8_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 111 | txfm_param->bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | static void highbd_fwd_txfm_8x4(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 115 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 116 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 117 | av1_fwd_txfm2d_8x4_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 118 | txfm_param->bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | static void highbd_fwd_txfm_8x16(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 122 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 123 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 124 | av1_fwd_txfm2d_8x16_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 125 | txfm_param->bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | static void highbd_fwd_txfm_16x8(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 129 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 130 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 131 | av1_fwd_txfm2d_16x8_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 132 | txfm_param->bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | static void highbd_fwd_txfm_16x32(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 136 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 137 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 138 | av1_fwd_txfm2d_16x32_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 139 | txfm_param->bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | static void highbd_fwd_txfm_32x16(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 143 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 144 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 145 | av1_fwd_txfm2d_32x16_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 146 | txfm_param->bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 147 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 148 | |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 149 | static void highbd_fwd_txfm_16x4(const int16_t *src_diff, tran_low_t *coeff, |
| 150 | int diff_stride, TxfmParam *txfm_param) { |
Debargha Mukherjee | 69f914a | 2017-11-15 20:58:23 -0800 | [diff] [blame] | 151 | int32_t *dst_coeff = (int32_t *)coeff; |
| 152 | av1_fwd_txfm2d_16x4_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 153 | txfm_param->bd); |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | static void highbd_fwd_txfm_4x16(const int16_t *src_diff, tran_low_t *coeff, |
| 157 | int diff_stride, TxfmParam *txfm_param) { |
Debargha Mukherjee | 69f914a | 2017-11-15 20:58:23 -0800 | [diff] [blame] | 158 | int32_t *dst_coeff = (int32_t *)coeff; |
| 159 | av1_fwd_txfm2d_4x16_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 160 | txfm_param->bd); |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | static void highbd_fwd_txfm_32x8(const int16_t *src_diff, tran_low_t *coeff, |
| 164 | int diff_stride, TxfmParam *txfm_param) { |
Debargha Mukherjee | 69f914a | 2017-11-15 20:58:23 -0800 | [diff] [blame] | 165 | int32_t *dst_coeff = (int32_t *)coeff; |
| 166 | av1_fwd_txfm2d_32x8_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 167 | txfm_param->bd); |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | static void highbd_fwd_txfm_8x32(const int16_t *src_diff, tran_low_t *coeff, |
| 171 | int diff_stride, TxfmParam *txfm_param) { |
Debargha Mukherjee | 69f914a | 2017-11-15 20:58:23 -0800 | [diff] [blame] | 172 | int32_t *dst_coeff = (int32_t *)coeff; |
| 173 | av1_fwd_txfm2d_8x32_c(src_diff, dst_coeff, diff_stride, txfm_param->tx_type, |
| 174 | txfm_param->bd); |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 175 | } |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 176 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 177 | static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 178 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 179 | int32_t *dst_coeff = (int32_t *)coeff; |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 180 | const TX_TYPE tx_type = txfm_param->tx_type; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 181 | const int bd = txfm_param->bd; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 182 | switch (tx_type) { |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 183 | // use the c version for anything including identity for now |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 184 | case V_DCT: |
| 185 | case H_DCT: |
| 186 | case V_ADST: |
| 187 | case H_ADST: |
| 188 | case V_FLIPADST: |
| 189 | case H_FLIPADST: |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 190 | case IDTX: |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 191 | av1_fwd_txfm2d_8x8_c(src_diff, dst_coeff, diff_stride, tx_type, bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 192 | break; |
Sebastien Alaiwan | 735e750 | 2018-03-21 16:53:10 +0100 | [diff] [blame] | 193 | default: |
| 194 | av1_fwd_txfm2d_8x8(src_diff, dst_coeff, diff_stride, tx_type, bd); |
| 195 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | |
| 199 | static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 200 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 201 | int32_t *dst_coeff = (int32_t *)coeff; |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 202 | const TX_TYPE tx_type = txfm_param->tx_type; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 203 | const int bd = txfm_param->bd; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 204 | switch (tx_type) { |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 205 | // use the c version for anything including identity for now |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 206 | case V_DCT: |
| 207 | case H_DCT: |
| 208 | case V_ADST: |
| 209 | case H_ADST: |
| 210 | case V_FLIPADST: |
| 211 | case H_FLIPADST: |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 212 | case IDTX: |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 213 | av1_fwd_txfm2d_16x16_c(src_diff, dst_coeff, diff_stride, tx_type, bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 214 | break; |
Sebastien Alaiwan | 735e750 | 2018-03-21 16:53:10 +0100 | [diff] [blame] | 215 | default: |
| 216 | av1_fwd_txfm2d_16x16(src_diff, dst_coeff, diff_stride, tx_type, bd); |
| 217 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 218 | } |
| 219 | } |
| 220 | |
Angie Chiang | 8fd2d7a | 2017-01-03 15:50:15 -0800 | [diff] [blame] | 221 | static void highbd_fwd_txfm_32x32(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 222 | int diff_stride, TxfmParam *txfm_param) { |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 223 | int32_t *dst_coeff = (int32_t *)coeff; |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 224 | const TX_TYPE tx_type = txfm_param->tx_type; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 225 | const int bd = txfm_param->bd; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 226 | switch (tx_type) { |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 227 | // use the c version for anything including identity for now |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 228 | case V_DCT: |
| 229 | case H_DCT: |
| 230 | case V_ADST: |
| 231 | case H_ADST: |
| 232 | case V_FLIPADST: |
| 233 | case H_FLIPADST: |
Sarah Parker | 31c6650 | 2017-05-19 16:51:07 -0700 | [diff] [blame] | 234 | case IDTX: |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 235 | av1_fwd_txfm2d_32x32_c(src_diff, dst_coeff, diff_stride, tx_type, bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 236 | break; |
Sebastien Alaiwan | 735e750 | 2018-03-21 16:53:10 +0100 | [diff] [blame] | 237 | default: |
| 238 | av1_fwd_txfm2d_32x32(src_diff, dst_coeff, diff_stride, tx_type, bd); |
| 239 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 240 | } |
| 241 | } |
Debargha Mukherjee | 6a47cff | 2016-11-02 14:57:42 -0700 | [diff] [blame] | 242 | |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 243 | static void highbd_fwd_txfm_32x64(const int16_t *src_diff, tran_low_t *coeff, |
| 244 | int diff_stride, TxfmParam *txfm_param) { |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 245 | assert(txfm_param->tx_type == DCT_DCT); |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 246 | int32_t *dst_coeff = (int32_t *)coeff; |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 247 | const int bd = txfm_param->bd; |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 248 | av1_fwd_txfm2d_32x64_c(src_diff, dst_coeff, diff_stride, DCT_DCT, bd); |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | static void highbd_fwd_txfm_64x32(const int16_t *src_diff, tran_low_t *coeff, |
| 252 | int diff_stride, TxfmParam *txfm_param) { |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 253 | assert(txfm_param->tx_type == DCT_DCT); |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 254 | int32_t *dst_coeff = (int32_t *)coeff; |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 255 | const int bd = txfm_param->bd; |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 256 | av1_fwd_txfm2d_64x32_c(src_diff, dst_coeff, diff_stride, DCT_DCT, bd); |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 257 | } |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 258 | |
| 259 | static void highbd_fwd_txfm_16x64(const int16_t *src_diff, tran_low_t *coeff, |
| 260 | int diff_stride, TxfmParam *txfm_param) { |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 261 | assert(txfm_param->tx_type == DCT_DCT); |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 262 | int32_t *dst_coeff = (int32_t *)coeff; |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 263 | const int bd = txfm_param->bd; |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 264 | av1_fwd_txfm2d_16x64_c(src_diff, dst_coeff, diff_stride, DCT_DCT, bd); |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | static void highbd_fwd_txfm_64x16(const int16_t *src_diff, tran_low_t *coeff, |
| 268 | int diff_stride, TxfmParam *txfm_param) { |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 269 | assert(txfm_param->tx_type == DCT_DCT); |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 270 | int32_t *dst_coeff = (int32_t *)coeff; |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 271 | const int bd = txfm_param->bd; |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 272 | av1_fwd_txfm2d_64x16_c(src_diff, dst_coeff, diff_stride, DCT_DCT, bd); |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 273 | } |
| 274 | |
Debargha Mukherjee | 6a47cff | 2016-11-02 14:57:42 -0700 | [diff] [blame] | 275 | static void highbd_fwd_txfm_64x64(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 276 | int diff_stride, TxfmParam *txfm_param) { |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 277 | assert(txfm_param->tx_type == DCT_DCT); |
Yi Luo | 0f4195c | 2017-06-27 16:07:28 -0700 | [diff] [blame] | 278 | int32_t *dst_coeff = (int32_t *)coeff; |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 279 | const int bd = txfm_param->bd; |
Hui Su | 98626d3 | 2018-04-13 12:08:48 -0700 | [diff] [blame] | 280 | av1_fwd_txfm2d_64x64(src_diff, dst_coeff, diff_stride, DCT_DCT, bd); |
Debargha Mukherjee | 6a47cff | 2016-11-02 14:57:42 -0700 | [diff] [blame] | 281 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 282 | |
hui su | f11fb88 | 2017-03-27 14:56:33 -0700 | [diff] [blame] | 283 | void av1_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, int diff_stride, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 284 | TxfmParam *txfm_param) { |
Angie Chiang | 7d8b13e | 2018-02-07 22:55:45 -0800 | [diff] [blame] | 285 | if (txfm_param->bd == 8) |
| 286 | av1_lowbd_fwd_txfm(src_diff, coeff, diff_stride, txfm_param); |
| 287 | else |
| 288 | av1_highbd_fwd_txfm(src_diff, coeff, diff_stride, txfm_param); |
| 289 | } |
| 290 | |
| 291 | void av1_lowbd_fwd_txfm_c(const int16_t *src_diff, tran_low_t *coeff, |
| 292 | int diff_stride, TxfmParam *txfm_param) { |
| 293 | av1_highbd_fwd_txfm(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 294 | } |
| 295 | |
hui su | f11fb88 | 2017-03-27 14:56:33 -0700 | [diff] [blame] | 296 | void av1_highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 297 | int diff_stride, TxfmParam *txfm_param) { |
Sarah Parker | 90024e4 | 2017-10-06 16:50:47 -0700 | [diff] [blame] | 298 | assert(av1_ext_tx_used[txfm_param->tx_set_type][txfm_param->tx_type]); |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 299 | const TX_SIZE tx_size = txfm_param->tx_size; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 300 | switch (tx_size) { |
Debargha Mukherjee | 6a47cff | 2016-11-02 14:57:42 -0700 | [diff] [blame] | 301 | case TX_64X64: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 302 | highbd_fwd_txfm_64x64(src_diff, coeff, diff_stride, txfm_param); |
Debargha Mukherjee | 6a47cff | 2016-11-02 14:57:42 -0700 | [diff] [blame] | 303 | break; |
Debargha Mukherjee | 2b43501 | 2017-09-28 08:30:35 -0700 | [diff] [blame] | 304 | case TX_32X64: |
| 305 | highbd_fwd_txfm_32x64(src_diff, coeff, diff_stride, txfm_param); |
| 306 | break; |
| 307 | case TX_64X32: |
| 308 | highbd_fwd_txfm_64x32(src_diff, coeff, diff_stride, txfm_param); |
| 309 | break; |
Debargha Mukherjee | 0254fee | 2017-12-02 09:08:52 -0800 | [diff] [blame] | 310 | case TX_16X64: |
| 311 | highbd_fwd_txfm_16x64(src_diff, coeff, diff_stride, txfm_param); |
| 312 | break; |
| 313 | case TX_64X16: |
| 314 | highbd_fwd_txfm_64x16(src_diff, coeff, diff_stride, txfm_param); |
| 315 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 316 | case TX_32X32: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 317 | highbd_fwd_txfm_32x32(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 318 | break; |
| 319 | case TX_16X16: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 320 | highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 321 | break; |
| 322 | case TX_8X8: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 323 | highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 324 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 325 | case TX_4X8: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 326 | highbd_fwd_txfm_4x8(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 327 | break; |
| 328 | case TX_8X4: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 329 | highbd_fwd_txfm_8x4(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 330 | break; |
| 331 | case TX_8X16: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 332 | highbd_fwd_txfm_8x16(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 333 | break; |
| 334 | case TX_16X8: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 335 | highbd_fwd_txfm_16x8(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 336 | break; |
| 337 | case TX_16X32: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 338 | highbd_fwd_txfm_16x32(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 339 | break; |
| 340 | case TX_32X16: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 341 | highbd_fwd_txfm_32x16(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 342 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 343 | case TX_4X4: |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 344 | highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, txfm_param); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 345 | break; |
Debargha Mukherjee | 845057f | 2017-11-13 07:03:36 -0800 | [diff] [blame] | 346 | case TX_4X16: |
| 347 | highbd_fwd_txfm_4x16(src_diff, coeff, diff_stride, txfm_param); |
| 348 | break; |
| 349 | case TX_16X4: |
| 350 | highbd_fwd_txfm_16x4(src_diff, coeff, diff_stride, txfm_param); |
| 351 | break; |
| 352 | case TX_8X32: |
| 353 | highbd_fwd_txfm_8x32(src_diff, coeff, diff_stride, txfm_param); |
| 354 | break; |
| 355 | case TX_32X8: |
| 356 | highbd_fwd_txfm_32x8(src_diff, coeff, diff_stride, txfm_param); |
| 357 | break; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 358 | default: assert(0); break; |
| 359 | } |
| 360 | } |