/src/aom/aom_dsp/txfm_common.h
Line | Count | Source (jump to first uncovered line) |
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 | | #ifndef AOM_AOM_DSP_TXFM_COMMON_H_ |
13 | | #define AOM_AOM_DSP_TXFM_COMMON_H_ |
14 | | |
15 | | #include "aom_dsp/aom_dsp_common.h" |
16 | | |
17 | | // Constants and Macros used by all idct/dct functions |
18 | | #define DCT_CONST_BITS 14 |
19 | | #define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1)) |
20 | | |
21 | 2.28M | #define UNIT_QUANT_SHIFT 2 |
22 | | #define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT) |
23 | | |
24 | | // block transform size |
25 | | enum { |
26 | | TX_4X4, // 4x4 transform |
27 | | TX_8X8, // 8x8 transform |
28 | | TX_16X16, // 16x16 transform |
29 | | TX_32X32, // 32x32 transform |
30 | | TX_64X64, // 64x64 transform |
31 | | TX_4X8, // 4x8 transform |
32 | | TX_8X4, // 8x4 transform |
33 | | TX_8X16, // 8x16 transform |
34 | | TX_16X8, // 16x8 transform |
35 | | TX_16X32, // 16x32 transform |
36 | | TX_32X16, // 32x16 transform |
37 | | TX_32X64, // 32x64 transform |
38 | | TX_64X32, // 64x32 transform |
39 | | TX_4X16, // 4x16 transform |
40 | | TX_16X4, // 16x4 transform |
41 | | TX_8X32, // 8x32 transform |
42 | | TX_32X8, // 32x8 transform |
43 | | TX_16X64, // 16x64 transform |
44 | | TX_64X16, // 64x16 transform |
45 | | TX_SIZES_ALL, // Includes rectangular transforms |
46 | | TX_SIZES = TX_4X8, // Does NOT include rectangular transforms |
47 | | TX_SIZES_LARGEST = TX_64X64, |
48 | | TX_INVALID = 255 // Invalid transform size |
49 | | } UENUM1BYTE(TX_SIZE); |
50 | | |
51 | | enum { |
52 | | DCT_DCT, // DCT in both horizontal and vertical |
53 | | ADST_DCT, // ADST in vertical, DCT in horizontal |
54 | | DCT_ADST, // DCT in vertical, ADST in horizontal |
55 | | ADST_ADST, // ADST in both directions |
56 | | FLIPADST_DCT, // FLIPADST in vertical, DCT in horizontal |
57 | | DCT_FLIPADST, // DCT in vertical, FLIPADST in horizontal |
58 | | FLIPADST_FLIPADST, // FLIPADST in both directions |
59 | | ADST_FLIPADST, // ADST in vertical, FLIPADST in horizontal |
60 | | FLIPADST_ADST, // FLIPADST in vertical, ADST in horizontal |
61 | | IDTX, // Identity in both directions |
62 | | V_DCT, // DCT in vertical, identity in horizontal |
63 | | H_DCT, // Identity in vertical, DCT in horizontal |
64 | | V_ADST, // ADST in vertical, identity in horizontal |
65 | | H_ADST, // Identity in vertical, ADST in horizontal |
66 | | V_FLIPADST, // FLIPADST in vertical, identity in horizontal |
67 | | H_FLIPADST, // Identity in vertical, FLIPADST in horizontal |
68 | | TX_TYPES, |
69 | | DCT_ADST_TX_MASK = 0x000F, // Either DCT or ADST in each direction |
70 | | TX_TYPE_INVALID = 255, // Invalid transform type |
71 | | } UENUM1BYTE(TX_TYPE); |
72 | | |
73 | | enum { |
74 | | // DCT only |
75 | | EXT_TX_SET_DCTONLY, |
76 | | // DCT + Identity only |
77 | | EXT_TX_SET_DCT_IDTX, |
78 | | // Discrete Trig transforms w/o flip (4) + Identity (1) |
79 | | EXT_TX_SET_DTT4_IDTX, |
80 | | // Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2) |
81 | | EXT_TX_SET_DTT4_IDTX_1DDCT, |
82 | | // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver DCT (2) |
83 | | EXT_TX_SET_DTT9_IDTX_1DDCT, |
84 | | // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6) |
85 | | EXT_TX_SET_ALL16, |
86 | | EXT_TX_SET_TYPES |
87 | | } UENUM1BYTE(TxSetType); |
88 | | |
89 | | typedef struct txfm_param { |
90 | | // for both forward and inverse transforms |
91 | | TX_TYPE tx_type; |
92 | | TX_SIZE tx_size; |
93 | | int lossless; |
94 | | int bd; |
95 | | // are the pixel buffers octets or shorts? This should collapse to |
96 | | // bd==8 implies !is_hbd, but that's not certain right now. |
97 | | int is_hbd; |
98 | | TxSetType tx_set_type; |
99 | | // for inverse transforms only |
100 | | int eob; |
101 | | } TxfmParam; |
102 | | |
103 | | // Constants: |
104 | | // for (int i = 1; i< 32; ++i) |
105 | | // printf("static const int cospi_%d_64 = %.0f;\n", i, |
106 | | // round(16384 * cos(i*PI/64))); |
107 | | // Note: sin(k*Pi/64) = cos((32-k)*Pi/64) |
108 | | static const tran_high_t cospi_1_64 = 16364; |
109 | | static const tran_high_t cospi_2_64 = 16305; |
110 | | static const tran_high_t cospi_3_64 = 16207; |
111 | | static const tran_high_t cospi_4_64 = 16069; |
112 | | static const tran_high_t cospi_5_64 = 15893; |
113 | | static const tran_high_t cospi_6_64 = 15679; |
114 | | static const tran_high_t cospi_7_64 = 15426; |
115 | | static const tran_high_t cospi_8_64 = 15137; |
116 | | static const tran_high_t cospi_9_64 = 14811; |
117 | | static const tran_high_t cospi_10_64 = 14449; |
118 | | static const tran_high_t cospi_11_64 = 14053; |
119 | | static const tran_high_t cospi_12_64 = 13623; |
120 | | static const tran_high_t cospi_13_64 = 13160; |
121 | | static const tran_high_t cospi_14_64 = 12665; |
122 | | static const tran_high_t cospi_15_64 = 12140; |
123 | | static const tran_high_t cospi_16_64 = 11585; |
124 | | static const tran_high_t cospi_17_64 = 11003; |
125 | | static const tran_high_t cospi_18_64 = 10394; |
126 | | static const tran_high_t cospi_19_64 = 9760; |
127 | | static const tran_high_t cospi_20_64 = 9102; |
128 | | static const tran_high_t cospi_21_64 = 8423; |
129 | | static const tran_high_t cospi_22_64 = 7723; |
130 | | static const tran_high_t cospi_23_64 = 7005; |
131 | | static const tran_high_t cospi_24_64 = 6270; |
132 | | static const tran_high_t cospi_25_64 = 5520; |
133 | | static const tran_high_t cospi_26_64 = 4756; |
134 | | static const tran_high_t cospi_27_64 = 3981; |
135 | | static const tran_high_t cospi_28_64 = 3196; |
136 | | static const tran_high_t cospi_29_64 = 2404; |
137 | | static const tran_high_t cospi_30_64 = 1606; |
138 | | static const tran_high_t cospi_31_64 = 804; |
139 | | |
140 | | // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3 |
141 | | static const tran_high_t sinpi_1_9 = 5283; |
142 | | static const tran_high_t sinpi_2_9 = 9929; |
143 | | static const tran_high_t sinpi_3_9 = 13377; |
144 | | static const tran_high_t sinpi_4_9 = 15212; |
145 | | |
146 | | // 16384 * sqrt(2) |
147 | | static const tran_high_t Sqrt2 = 23170; |
148 | | static const tran_high_t InvSqrt2 = 11585; |
149 | | |
150 | 0 | static inline tran_high_t fdct_round_shift(tran_high_t input) { |
151 | 0 | tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS); |
152 | 0 | return rv; |
153 | 0 | } Unexecuted instantiation: av1_dx_iface.c:fdct_round_shift Unexecuted instantiation: decodeframe.c:fdct_round_shift Unexecuted instantiation: decodemv.c:fdct_round_shift Unexecuted instantiation: decoder.c:fdct_round_shift Unexecuted instantiation: decodetxb.c:fdct_round_shift Unexecuted instantiation: detokenize.c:fdct_round_shift Unexecuted instantiation: obu.c:fdct_round_shift Unexecuted instantiation: aom_dsp_rtcd.c:fdct_round_shift Unexecuted instantiation: av1_rtcd.c:fdct_round_shift Unexecuted instantiation: aom_convolve.c:fdct_round_shift Unexecuted instantiation: blend_a64_hmask.c:fdct_round_shift Unexecuted instantiation: blend_a64_mask.c:fdct_round_shift Unexecuted instantiation: blend_a64_vmask.c:fdct_round_shift Unexecuted instantiation: intrapred.c:fdct_round_shift Unexecuted instantiation: aom_convolve_copy_sse2.c:fdct_round_shift Unexecuted instantiation: intrapred_sse2.c:fdct_round_shift Unexecuted instantiation: loopfilter_sse2.c:fdct_round_shift Unexecuted instantiation: highbd_convolve_sse2.c:fdct_round_shift Unexecuted instantiation: highbd_loopfilter_sse2.c:fdct_round_shift Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:fdct_round_shift Unexecuted instantiation: intrapred_ssse3.c:fdct_round_shift Unexecuted instantiation: highbd_convolve_ssse3.c:fdct_round_shift Unexecuted instantiation: blend_a64_hmask_sse4.c:fdct_round_shift Unexecuted instantiation: blend_a64_mask_sse4.c:fdct_round_shift Unexecuted instantiation: blend_a64_vmask_sse4.c:fdct_round_shift Unexecuted instantiation: intrapred_sse4.c:fdct_round_shift Unexecuted instantiation: aom_convolve_copy_avx2.c:fdct_round_shift Unexecuted instantiation: aom_subpixel_8t_intrin_avx2.c:fdct_round_shift Unexecuted instantiation: intrapred_avx2.c:fdct_round_shift Unexecuted instantiation: loopfilter_avx2.c:fdct_round_shift Unexecuted instantiation: blend_a64_mask_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_convolve_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_loopfilter_avx2.c:fdct_round_shift Unexecuted instantiation: yv12config.c:fdct_round_shift Unexecuted instantiation: alloccommon.c:fdct_round_shift Unexecuted instantiation: av1_inv_txfm2d.c:fdct_round_shift Unexecuted instantiation: av1_loopfilter.c:fdct_round_shift Unexecuted instantiation: av1_txfm.c:fdct_round_shift Unexecuted instantiation: blockd.c:fdct_round_shift Unexecuted instantiation: cdef.c:fdct_round_shift Unexecuted instantiation: cdef_block.c:fdct_round_shift Unexecuted instantiation: cfl.c:fdct_round_shift Unexecuted instantiation: common_data.c:fdct_round_shift Unexecuted instantiation: convolve.c:fdct_round_shift Unexecuted instantiation: entropy.c:fdct_round_shift Unexecuted instantiation: entropymode.c:fdct_round_shift Unexecuted instantiation: entropymv.c:fdct_round_shift Unexecuted instantiation: idct.c:fdct_round_shift Unexecuted instantiation: mvref_common.c:fdct_round_shift Unexecuted instantiation: pred_common.c:fdct_round_shift Unexecuted instantiation: quant_common.c:fdct_round_shift Unexecuted instantiation: reconinter.c:fdct_round_shift Unexecuted instantiation: reconintra.c:fdct_round_shift Unexecuted instantiation: resize.c:fdct_round_shift Unexecuted instantiation: restoration.c:fdct_round_shift Unexecuted instantiation: scale.c:fdct_round_shift Unexecuted instantiation: scan.c:fdct_round_shift Unexecuted instantiation: seg_common.c:fdct_round_shift Unexecuted instantiation: thread_common.c:fdct_round_shift Unexecuted instantiation: tile_common.c:fdct_round_shift Unexecuted instantiation: timing.c:fdct_round_shift Unexecuted instantiation: txb_common.c:fdct_round_shift Unexecuted instantiation: warped_motion.c:fdct_round_shift Unexecuted instantiation: cfl_sse2.c:fdct_round_shift Unexecuted instantiation: convolve_2d_sse2.c:fdct_round_shift Unexecuted instantiation: convolve_sse2.c:fdct_round_shift Unexecuted instantiation: jnt_convolve_sse2.c:fdct_round_shift Unexecuted instantiation: resize_sse2.c:fdct_round_shift Unexecuted instantiation: wiener_convolve_sse2.c:fdct_round_shift Unexecuted instantiation: av1_inv_txfm_ssse3.c:fdct_round_shift Unexecuted instantiation: cfl_ssse3.c:fdct_round_shift Unexecuted instantiation: jnt_convolve_ssse3.c:fdct_round_shift Unexecuted instantiation: resize_ssse3.c:fdct_round_shift Unexecuted instantiation: highbd_convolve_2d_ssse3.c:fdct_round_shift Unexecuted instantiation: highbd_wiener_convolve_ssse3.c:fdct_round_shift Unexecuted instantiation: reconinter_ssse3.c:fdct_round_shift Unexecuted instantiation: av1_convolve_horiz_rs_sse4.c:fdct_round_shift Unexecuted instantiation: av1_convolve_scale_sse4.c:fdct_round_shift Unexecuted instantiation: av1_txfm_sse4.c:fdct_round_shift Unexecuted instantiation: cdef_block_sse4.c:fdct_round_shift Unexecuted instantiation: filterintra_sse4.c:fdct_round_shift Unexecuted instantiation: highbd_inv_txfm_sse4.c:fdct_round_shift Unexecuted instantiation: intra_edge_sse4.c:fdct_round_shift Unexecuted instantiation: reconinter_sse4.c:fdct_round_shift Unexecuted instantiation: selfguided_sse4.c:fdct_round_shift Unexecuted instantiation: warp_plane_sse4.c:fdct_round_shift Unexecuted instantiation: highbd_convolve_2d_sse4.c:fdct_round_shift Unexecuted instantiation: highbd_jnt_convolve_sse4.c:fdct_round_shift Unexecuted instantiation: highbd_warp_plane_sse4.c:fdct_round_shift Unexecuted instantiation: av1_inv_txfm_avx2.c:fdct_round_shift Unexecuted instantiation: cdef_block_avx2.c:fdct_round_shift Unexecuted instantiation: cfl_avx2.c:fdct_round_shift Unexecuted instantiation: convolve_2d_avx2.c:fdct_round_shift Unexecuted instantiation: convolve_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_inv_txfm_avx2.c:fdct_round_shift Unexecuted instantiation: jnt_convolve_avx2.c:fdct_round_shift Unexecuted instantiation: reconinter_avx2.c:fdct_round_shift Unexecuted instantiation: resize_avx2.c:fdct_round_shift Unexecuted instantiation: selfguided_avx2.c:fdct_round_shift Unexecuted instantiation: warp_plane_avx2.c:fdct_round_shift Unexecuted instantiation: wiener_convolve_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_convolve_2d_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_jnt_convolve_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_wiener_convolve_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_warp_affine_avx2.c:fdct_round_shift Unexecuted instantiation: highbd_intrapred_sse2.c:fdct_round_shift Unexecuted instantiation: av1_inv_txfm1d.c:fdct_round_shift |
154 | | |
155 | | #endif // AOM_AOM_DSP_TXFM_COMMON_H_ |