/work/vvenc/source/Lib/CommonLib/TrQuant_EMT.cpp
Line | Count | Source |
1 | | /* ----------------------------------------------------------------------------- |
2 | | The copyright in this software is being made available under the Clear BSD |
3 | | License, included below. No patent rights, trademark rights and/or |
4 | | other Intellectual Property Rights other than the copyrights concerning |
5 | | the Software are granted under this license. |
6 | | |
7 | | The Clear BSD License |
8 | | |
9 | | Copyright (c) 2019-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVenC Authors. |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use in source and binary forms, with or without modification, |
13 | | are permitted (subject to the limitations in the disclaimer below) provided that |
14 | | the following conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above copyright notice, |
17 | | this list of conditions and the following disclaimer. |
18 | | |
19 | | * Redistributions in binary form must reproduce the above copyright |
20 | | notice, this list of conditions and the following disclaimer in the |
21 | | documentation and/or other materials provided with the distribution. |
22 | | |
23 | | * Neither the name of the copyright holder nor the names of its |
24 | | contributors may be used to endorse or promote products derived from this |
25 | | software without specific prior written permission. |
26 | | |
27 | | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY |
28 | | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
29 | | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
31 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
32 | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
33 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
34 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
35 | | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
37 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | | POSSIBILITY OF SUCH DAMAGE. |
39 | | |
40 | | |
41 | | ------------------------------------------------------------------------------------------- */ |
42 | | |
43 | | |
44 | | /** \file TrQuant_EMT.cpp |
45 | | \brief transform and quantization class |
46 | | */ |
47 | | |
48 | | #include "TrQuant_EMT.h" |
49 | | #include "Rom.h" |
50 | | |
51 | | #include <stdlib.h> |
52 | | #include <math.h> |
53 | | #include <memory.h> |
54 | | |
55 | | //! \ingroup CommonLib |
56 | | //! \{ |
57 | | |
58 | | namespace vvenc { |
59 | | |
60 | | // ********************************** DCT-II ********************************** |
61 | | |
62 | | #if ENABLE_SIMD_TRAFO |
63 | | template<int uiTrSize> |
64 | | inline void _fastInverseMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum, const TMatrixCoeff* iT ); |
65 | | |
66 | | template<> |
67 | | inline void _fastInverseMM<2>( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum, const TMatrixCoeff* iT ) |
68 | 0 | { |
69 | 0 | const int rnd_factor = 1 << (shift - 1); |
70 | 0 | const int reducedLine = line - iSkipLine; |
71 | 0 | const int cutoff = 2 - iSkipLine2; |
72 | 0 |
|
73 | 0 | memset( dst, 0, reducedLine * 2 * sizeof( TCoeff ) ); |
74 | 0 |
|
75 | 0 | for( int k = 0; k < cutoff; k++ ) |
76 | 0 | { |
77 | 0 | const TCoeff* srcPtr = &src[k * line]; |
78 | 0 | for( int i = 0; i < reducedLine; i++ ) |
79 | 0 | { |
80 | 0 | TCoeff* dstPtr = &dst[i << 1]; |
81 | 0 | const TMatrixCoeff* itPtr = &iT[k << 1]; |
82 | 0 | const TCoeff srcVal = *srcPtr; |
83 | 0 | for( int j = 0; j < 2; j++ ) |
84 | 0 | { |
85 | 0 | *dstPtr++ += srcVal * *itPtr++; |
86 | 0 | } |
87 | 0 | srcPtr++; |
88 | 0 | } |
89 | 0 | } |
90 | 0 |
|
91 | 0 | for( int i = 0; i < reducedLine; i++ ) |
92 | 0 | { |
93 | 0 | TCoeff* dstPtr = &dst[i << 1]; |
94 | 0 | for( int j = 0; j < 2; j++, dstPtr++ ) |
95 | 0 | { |
96 | 0 | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); |
97 | 0 | } |
98 | 0 | } |
99 | 0 |
|
100 | 0 | if( iSkipLine ) |
101 | 0 | { |
102 | 0 | memset( dst + ( reducedLine << 1 ), 0, ( iSkipLine << 1 ) * sizeof( TCoeff ) ); |
103 | 0 | } |
104 | 0 | } |
105 | | |
106 | | template<> |
107 | | inline void _fastInverseMM<4>( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum, const TMatrixCoeff* iT ) |
108 | 2.02k | { |
109 | 2.02k | const int rnd_factor = 1 << ( shift - 1 ); |
110 | 2.02k | const int reducedLine = line - iSkipLine; |
111 | 2.02k | const int cutoff = 4 - iSkipLine2; |
112 | | |
113 | 2.02k | memset( dst, 0, reducedLine * 4 * sizeof( TCoeff ) ); |
114 | | |
115 | 2.02k | #if ENABLE_SIMD_TRAFO |
116 | 2.02k | g_tCoeffOps.fastInvCore[0]( iT, src, dst, line, reducedLine, cutoff ); |
117 | 2.02k | g_tCoeffOps.roundClip4( dst, 4, reducedLine, 4, outputMinimum, outputMaximum, rnd_factor, shift ); |
118 | | #else |
119 | | for( int k = 0; k < cutoff; k++ ) |
120 | | { |
121 | | const TCoeff* srcPtr = &src[k * line]; |
122 | | for( int i = 0; i < reducedLine; i++ ) |
123 | | { |
124 | | TCoeff* dstPtr = &dst[i << 2]; |
125 | | const TMatrixCoeff* itPtr = &iT[k << 2]; |
126 | | for( int j = 0; j < 4; j++ ) |
127 | | { |
128 | | *dstPtr++ += *srcPtr * *itPtr++; |
129 | | } |
130 | | srcPtr++; |
131 | | } |
132 | | } |
133 | | |
134 | | for( int i = 0; i < reducedLine; i++ ) |
135 | | { |
136 | | TCoeff* dstPtr = &dst[i << 2]; |
137 | | for( int j = 0; j < 4; j++, dstPtr++ ) |
138 | | { |
139 | | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); |
140 | | } |
141 | | } |
142 | | #endif |
143 | | |
144 | 2.02k | if( iSkipLine ) |
145 | 0 | { |
146 | 0 | memset( dst + ( reducedLine << 2 ), 0, ( iSkipLine << 2 ) * sizeof( TCoeff ) ); |
147 | 0 | } |
148 | 2.02k | } |
149 | | |
150 | | #endif |
151 | | |
152 | | template< int uiTrSize > |
153 | | inline void _fastInverseMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum, const TMatrixCoeff* iT ) |
154 | 883k | { |
155 | 883k | const int rnd_factor = 1 << (shift - 1); |
156 | 883k | const int reducedLine = line - iSkipLine; |
157 | 883k | const int cutoff = uiTrSize - iSkipLine2; |
158 | | |
159 | 883k | memset( dst, 0, reducedLine * uiTrSize * sizeof( TCoeff ) ); |
160 | | |
161 | 883k | #if ENABLE_SIMD_TRAFO |
162 | 883k | g_tCoeffOps.fastInvCore[Log2( uiTrSize ) - 2]( iT, src, dst, line, reducedLine, cutoff ); |
163 | 883k | g_tCoeffOps.roundClip8( dst, uiTrSize, reducedLine, uiTrSize, outputMinimum, outputMaximum, rnd_factor, shift ); |
164 | | #else |
165 | | for( int k = 0; k < cutoff; k++ ) |
166 | | { |
167 | | const TCoeff* srcPtr = &src[k * line]; |
168 | | for( int i = 0; i < reducedLine; i++ ) |
169 | | { |
170 | | TCoeff* dstPtr = &dst[i * uiTrSize]; |
171 | | const TMatrixCoeff* itPtr = &iT[k * uiTrSize]; |
172 | | for( int j = 0; j < uiTrSize; j++ ) |
173 | | { |
174 | | *dstPtr++ += *srcPtr * *itPtr++; |
175 | | } |
176 | | srcPtr++; |
177 | | } |
178 | | } |
179 | | |
180 | | for( int i = 0; i < reducedLine; i++ ) |
181 | | { |
182 | | TCoeff* dstPtr = &dst[i * uiTrSize]; |
183 | | for( int j = 0; j < uiTrSize; j++, dstPtr++ ) |
184 | | { |
185 | | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); |
186 | | } |
187 | | } |
188 | | #endif |
189 | | |
190 | 883k | if( iSkipLine ) |
191 | 168k | { |
192 | 168k | memset( dst + ( reducedLine*uiTrSize ), 0, ( iSkipLine*uiTrSize ) * sizeof( TCoeff ) ); |
193 | 168k | } |
194 | 883k | } void vvenc::_fastInverseMM<16>(int const*, int*, int, int, int, int, int, int, short const*) Line | Count | Source | 154 | 579k | { | 155 | 579k | const int rnd_factor = 1 << (shift - 1); | 156 | 579k | const int reducedLine = line - iSkipLine; | 157 | 579k | const int cutoff = uiTrSize - iSkipLine2; | 158 | | | 159 | 579k | memset( dst, 0, reducedLine * uiTrSize * sizeof( TCoeff ) ); | 160 | | | 161 | 579k | #if ENABLE_SIMD_TRAFO | 162 | 579k | g_tCoeffOps.fastInvCore[Log2( uiTrSize ) - 2]( iT, src, dst, line, reducedLine, cutoff ); | 163 | 579k | g_tCoeffOps.roundClip8( dst, uiTrSize, reducedLine, uiTrSize, outputMinimum, outputMaximum, rnd_factor, shift ); | 164 | | #else | 165 | | for( int k = 0; k < cutoff; k++ ) | 166 | | { | 167 | | const TCoeff* srcPtr = &src[k * line]; | 168 | | for( int i = 0; i < reducedLine; i++ ) | 169 | | { | 170 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 171 | | const TMatrixCoeff* itPtr = &iT[k * uiTrSize]; | 172 | | for( int j = 0; j < uiTrSize; j++ ) | 173 | | { | 174 | | *dstPtr++ += *srcPtr * *itPtr++; | 175 | | } | 176 | | srcPtr++; | 177 | | } | 178 | | } | 179 | | | 180 | | for( int i = 0; i < reducedLine; i++ ) | 181 | | { | 182 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 183 | | for( int j = 0; j < uiTrSize; j++, dstPtr++ ) | 184 | | { | 185 | | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); | 186 | | } | 187 | | } | 188 | | #endif | 189 | | | 190 | 579k | if( iSkipLine ) | 191 | 104k | { | 192 | 104k | memset( dst + ( reducedLine*uiTrSize ), 0, ( iSkipLine*uiTrSize ) * sizeof( TCoeff ) ); | 193 | 104k | } | 194 | 579k | } |
void vvenc::_fastInverseMM<32>(int const*, int*, int, int, int, int, int, int, short const*) Line | Count | Source | 154 | 275k | { | 155 | 275k | const int rnd_factor = 1 << (shift - 1); | 156 | 275k | const int reducedLine = line - iSkipLine; | 157 | 275k | const int cutoff = uiTrSize - iSkipLine2; | 158 | | | 159 | 275k | memset( dst, 0, reducedLine * uiTrSize * sizeof( TCoeff ) ); | 160 | | | 161 | 275k | #if ENABLE_SIMD_TRAFO | 162 | 275k | g_tCoeffOps.fastInvCore[Log2( uiTrSize ) - 2]( iT, src, dst, line, reducedLine, cutoff ); | 163 | 275k | g_tCoeffOps.roundClip8( dst, uiTrSize, reducedLine, uiTrSize, outputMinimum, outputMaximum, rnd_factor, shift ); | 164 | | #else | 165 | | for( int k = 0; k < cutoff; k++ ) | 166 | | { | 167 | | const TCoeff* srcPtr = &src[k * line]; | 168 | | for( int i = 0; i < reducedLine; i++ ) | 169 | | { | 170 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 171 | | const TMatrixCoeff* itPtr = &iT[k * uiTrSize]; | 172 | | for( int j = 0; j < uiTrSize; j++ ) | 173 | | { | 174 | | *dstPtr++ += *srcPtr * *itPtr++; | 175 | | } | 176 | | srcPtr++; | 177 | | } | 178 | | } | 179 | | | 180 | | for( int i = 0; i < reducedLine; i++ ) | 181 | | { | 182 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 183 | | for( int j = 0; j < uiTrSize; j++, dstPtr++ ) | 184 | | { | 185 | | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); | 186 | | } | 187 | | } | 188 | | #endif | 189 | | | 190 | 275k | if( iSkipLine ) | 191 | 51.8k | { | 192 | 51.8k | memset( dst + ( reducedLine*uiTrSize ), 0, ( iSkipLine*uiTrSize ) * sizeof( TCoeff ) ); | 193 | 51.8k | } | 194 | 275k | } |
void vvenc::_fastInverseMM<64>(int const*, int*, int, int, int, int, int, int, short const*) Line | Count | Source | 154 | 26.8k | { | 155 | 26.8k | const int rnd_factor = 1 << (shift - 1); | 156 | 26.8k | const int reducedLine = line - iSkipLine; | 157 | 26.8k | const int cutoff = uiTrSize - iSkipLine2; | 158 | | | 159 | 26.8k | memset( dst, 0, reducedLine * uiTrSize * sizeof( TCoeff ) ); | 160 | | | 161 | 26.8k | #if ENABLE_SIMD_TRAFO | 162 | 26.8k | g_tCoeffOps.fastInvCore[Log2( uiTrSize ) - 2]( iT, src, dst, line, reducedLine, cutoff ); | 163 | 26.8k | g_tCoeffOps.roundClip8( dst, uiTrSize, reducedLine, uiTrSize, outputMinimum, outputMaximum, rnd_factor, shift ); | 164 | | #else | 165 | | for( int k = 0; k < cutoff; k++ ) | 166 | | { | 167 | | const TCoeff* srcPtr = &src[k * line]; | 168 | | for( int i = 0; i < reducedLine; i++ ) | 169 | | { | 170 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 171 | | const TMatrixCoeff* itPtr = &iT[k * uiTrSize]; | 172 | | for( int j = 0; j < uiTrSize; j++ ) | 173 | | { | 174 | | *dstPtr++ += *srcPtr * *itPtr++; | 175 | | } | 176 | | srcPtr++; | 177 | | } | 178 | | } | 179 | | | 180 | | for( int i = 0; i < reducedLine; i++ ) | 181 | | { | 182 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 183 | | for( int j = 0; j < uiTrSize; j++, dstPtr++ ) | 184 | | { | 185 | | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); | 186 | | } | 187 | | } | 188 | | #endif | 189 | | | 190 | 26.8k | if( iSkipLine ) | 191 | 12.6k | { | 192 | 12.6k | memset( dst + ( reducedLine*uiTrSize ), 0, ( iSkipLine*uiTrSize ) * sizeof( TCoeff ) ); | 193 | 12.6k | } | 194 | 26.8k | } |
void vvenc::_fastInverseMM<8>(int const*, int*, int, int, int, int, int, int, short const*) Line | Count | Source | 154 | 1.28k | { | 155 | 1.28k | const int rnd_factor = 1 << (shift - 1); | 156 | 1.28k | const int reducedLine = line - iSkipLine; | 157 | 1.28k | const int cutoff = uiTrSize - iSkipLine2; | 158 | | | 159 | 1.28k | memset( dst, 0, reducedLine * uiTrSize * sizeof( TCoeff ) ); | 160 | | | 161 | 1.28k | #if ENABLE_SIMD_TRAFO | 162 | 1.28k | g_tCoeffOps.fastInvCore[Log2( uiTrSize ) - 2]( iT, src, dst, line, reducedLine, cutoff ); | 163 | 1.28k | g_tCoeffOps.roundClip8( dst, uiTrSize, reducedLine, uiTrSize, outputMinimum, outputMaximum, rnd_factor, shift ); | 164 | | #else | 165 | | for( int k = 0; k < cutoff; k++ ) | 166 | | { | 167 | | const TCoeff* srcPtr = &src[k * line]; | 168 | | for( int i = 0; i < reducedLine; i++ ) | 169 | | { | 170 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 171 | | const TMatrixCoeff* itPtr = &iT[k * uiTrSize]; | 172 | | for( int j = 0; j < uiTrSize; j++ ) | 173 | | { | 174 | | *dstPtr++ += *srcPtr * *itPtr++; | 175 | | } | 176 | | srcPtr++; | 177 | | } | 178 | | } | 179 | | | 180 | | for( int i = 0; i < reducedLine; i++ ) | 181 | | { | 182 | | TCoeff* dstPtr = &dst[i * uiTrSize]; | 183 | | for( int j = 0; j < uiTrSize; j++, dstPtr++ ) | 184 | | { | 185 | | *dstPtr = Clip3( outputMinimum, outputMaximum, ( int ) ( *dstPtr + rnd_factor ) >> shift ); | 186 | | } | 187 | | } | 188 | | #endif | 189 | | | 190 | 1.28k | if( iSkipLine ) | 191 | 0 | { | 192 | 0 | memset( dst + ( reducedLine*uiTrSize ), 0, ( iSkipLine*uiTrSize ) * sizeof( TCoeff ) ); | 193 | 0 | } | 194 | 1.28k | } |
|
195 | | |
196 | | //Fast DCT-II transforms |
197 | | static void fastForwardDCT2_B2_Core(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
198 | 32.0k | { |
199 | 32.0k | int j; |
200 | 32.0k | int E, O; |
201 | 32.0k | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
202 | | |
203 | 32.0k | const TMatrixCoeff *iT = g_trCoreDCT2P2[TRANSFORM_FORWARD][0]; |
204 | | |
205 | 32.0k | TCoeff *pCoef = dst; |
206 | 32.0k | const int reducedLine = line - iSkipLine; |
207 | 422k | for (j = 0; j<reducedLine; j++) |
208 | 390k | { |
209 | | /* E and O */ |
210 | 390k | E = src[0] + src[1]; |
211 | 390k | O = src[0] - src[1]; |
212 | | |
213 | 390k | dst[0] = (iT[0] * E + add) >> shift; |
214 | 390k | dst[line] = (iT[2] * O + add) >> shift; |
215 | | |
216 | | |
217 | 390k | src += 2; |
218 | 390k | dst++; |
219 | 390k | } |
220 | 32.0k | if (iSkipLine) |
221 | 0 | { |
222 | 0 | dst = pCoef + reducedLine; |
223 | 0 | for (j = 0; j<2; j++) |
224 | 0 | { |
225 | 0 | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
226 | 0 | dst += line; |
227 | 0 | } |
228 | 0 | } |
229 | 32.0k | } |
230 | | |
231 | | static void fastInverseDCT2_B2_Core(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
232 | 19.3k | { |
233 | 19.3k | int j; |
234 | 19.3k | int E, O; |
235 | 19.3k | int add = 1 << (shift - 1); |
236 | | |
237 | 19.3k | const TMatrixCoeff *iT = g_trCoreDCT2P2[TRANSFORM_INVERSE][0]; |
238 | | |
239 | 19.3k | const int reducedLine = line - iSkipLine; |
240 | 253k | for (j = 0; j<reducedLine; j++) |
241 | 233k | { |
242 | | /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ |
243 | 233k | E = iT[0] * (src[0] + src[line]); |
244 | 233k | O = iT[2] * (src[0] - src[line]); |
245 | | |
246 | | /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ |
247 | 233k | dst[0] = Clip3(outputMinimum, outputMaximum, (E + add) >> shift); |
248 | 233k | dst[1] = Clip3(outputMinimum, outputMaximum, (O + add) >> shift); |
249 | | |
250 | 233k | src++; |
251 | 233k | dst += 2; |
252 | 233k | } |
253 | 19.3k | if (iSkipLine) |
254 | 0 | { |
255 | 0 | memset(dst, 0, (iSkipLine << 1) * sizeof(TCoeff)); |
256 | 0 | } |
257 | 19.3k | } |
258 | | |
259 | | /** 4x4 forward transform implemented using partial butterfly structure (1D) |
260 | | * \param src input data (residual) |
261 | | * \param dst output data (transform coefficients) |
262 | | * \param shift specifies right shift after 1D transform |
263 | | * \param line |
264 | | */ |
265 | | static void fastForwardDCT2_B4_Core(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
266 | 880k | { |
267 | 880k | int j; |
268 | 880k | TCoeff E[2], O[2]; |
269 | 880k | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
270 | | |
271 | 880k | const TMatrixCoeff *iT = g_trCoreDCT2P4[TRANSFORM_FORWARD][0]; |
272 | | |
273 | 880k | TCoeff *pCoef = dst; |
274 | 880k | const int reducedLine = line - iSkipLine; |
275 | 9.53M | for (j = 0; j<reducedLine; j++) |
276 | 8.65M | { |
277 | | /* E and O */ |
278 | 8.65M | E[0] = src[0] + src[3]; |
279 | 8.65M | O[0] = src[0] - src[3]; |
280 | 8.65M | E[1] = src[1] + src[2]; |
281 | 8.65M | O[1] = src[1] - src[2]; |
282 | | |
283 | 8.65M | dst[0] = (iT[0] * E[0] + iT[1] * E[1] + add) >> shift; |
284 | 8.65M | dst[2 * line] = (iT[8] * E[0] + iT[9] * E[1] + add) >> shift; |
285 | 8.65M | dst[line] = (iT[4] * O[0] + iT[5] * O[1] + add) >> shift; |
286 | 8.65M | dst[3 * line] = (iT[12] * O[0] + iT[13] * O[1] + add) >> shift; |
287 | | |
288 | 8.65M | src += 4; |
289 | 8.65M | dst++; |
290 | 8.65M | } |
291 | 880k | if (iSkipLine) |
292 | 204k | { |
293 | 204k | dst = pCoef + reducedLine; |
294 | 1.02M | for (j = 0; j<4; j++) |
295 | 817k | { |
296 | 817k | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
297 | 817k | dst += line; |
298 | 817k | } |
299 | 204k | } |
300 | 880k | } |
301 | | |
302 | | /** 4x4 inverse transform implemented using partial butterfly structure (1D) |
303 | | * \param src input data (transform coefficients) |
304 | | * \param dst output data (residual) |
305 | | * \param shift specifies right shift after 1D transform |
306 | | * \param line |
307 | | * \param outputMinimum minimum for clipping |
308 | | * \param outputMaximum maximum for clipping |
309 | | */ |
310 | | static void fastInverseDCT2_B4_Core( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum ) |
311 | 407k | { |
312 | 407k | int j; |
313 | 407k | int E[2], O[2]; |
314 | 407k | int add = 1 << ( shift - 1 ); |
315 | | |
316 | 407k | const TMatrixCoeff *iT = g_trCoreDCT2P4[TRANSFORM_INVERSE][0]; |
317 | | |
318 | 407k | const int reducedLine = line - iSkipLine; |
319 | 3.74M | for( j = 0; j < reducedLine; j++ ) |
320 | 3.34M | { |
321 | | /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ |
322 | 3.34M | O[0] = iT[1 * 4 + 0] * src[line] + iT[3 * 4 + 0] * src[3 * line]; |
323 | 3.34M | O[1] = iT[1 * 4 + 1] * src[line] + iT[3 * 4 + 1] * src[3 * line]; |
324 | 3.34M | E[0] = iT[0 * 4 + 0] * src[ 0] + iT[2 * 4 + 0] * src[2 * line]; |
325 | 3.34M | E[1] = iT[0 * 4 + 1] * src[ 0] + iT[2 * 4 + 1] * src[2 * line]; |
326 | | |
327 | | /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ |
328 | 3.34M | dst[0] = Clip3( outputMinimum, outputMaximum, ( E[0] + O[0] + add ) >> shift ); |
329 | 3.34M | dst[1] = Clip3( outputMinimum, outputMaximum, ( E[1] + O[1] + add ) >> shift ); |
330 | 3.34M | dst[2] = Clip3( outputMinimum, outputMaximum, ( E[1] - O[1] + add ) >> shift ); |
331 | 3.34M | dst[3] = Clip3( outputMinimum, outputMaximum, ( E[0] - O[0] + add ) >> shift ); |
332 | | |
333 | 3.34M | src++; |
334 | 3.34M | dst += 4; |
335 | 3.34M | } |
336 | | |
337 | 407k | if( iSkipLine ) |
338 | 87.3k | { |
339 | 87.3k | memset( dst, 0, ( iSkipLine << 2 ) * sizeof( TCoeff ) ); |
340 | 87.3k | } |
341 | 407k | } |
342 | | |
343 | | |
344 | | |
345 | | template< int uiTrSize > |
346 | | inline void _fastForwardMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TMatrixCoeff* tc ) |
347 | 3.87M | { |
348 | | #if !ENABLE_SIMD_TRAFO |
349 | | const int rnd_factor = 1 << (shift - 1); |
350 | | #endif |
351 | 3.87M | const int reducedLine = line - iSkipLine; |
352 | 3.87M | const int cutoff = uiTrSize - iSkipLine2; |
353 | 3.87M | TCoeff *pCoef; |
354 | | |
355 | 3.87M | #if ENABLE_SIMD_TRAFO |
356 | 3.87M | if( line == 1 ) |
357 | 316 | { |
358 | 316 | g_tCoeffOps.fastFwdCore_1D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); |
359 | 316 | } |
360 | 3.87M | else |
361 | 3.87M | { |
362 | 3.87M | g_tCoeffOps.fastFwdCore_2D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); |
363 | 3.87M | } |
364 | | #else |
365 | | for( int i = 0; i<reducedLine; i++ ) |
366 | | { |
367 | | pCoef = dst; |
368 | | const TMatrixCoeff* iT = tc; |
369 | | for( int j = 0; j<cutoff; j++ ) |
370 | | { |
371 | | int iSum = 0; |
372 | | for( int k = 0; k<uiTrSize; k++ ) |
373 | | { |
374 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] |
375 | | iSum += src[k] * iT[k]; |
376 | | } |
377 | | pCoef[i] = (iSum + rnd_factor) >> shift; |
378 | | pCoef += line; |
379 | | iT += uiTrSize; |
380 | | } |
381 | | src += uiTrSize; |
382 | | } |
383 | | #endif |
384 | | |
385 | 3.87M | if( iSkipLine ) |
386 | 669k | { |
387 | 669k | pCoef = dst + reducedLine; |
388 | 6.87M | for( int j = 0; j<cutoff; j++ ) |
389 | 6.20M | { |
390 | 6.20M | memset(pCoef, 0, sizeof(TCoeff) * iSkipLine); |
391 | 6.20M | pCoef += line; |
392 | 6.20M | } |
393 | 669k | } |
394 | | |
395 | 3.87M | if( iSkipLine2 ) |
396 | 1.75M | { |
397 | 1.75M | pCoef = dst + line*cutoff; |
398 | 1.75M | memset(pCoef, 0, sizeof(TCoeff) * line * iSkipLine2); |
399 | 1.75M | } |
400 | 3.87M | } void vvenc::_fastForwardMM<8>(int const*, int*, int, int, int, int, short const*) Line | Count | Source | 347 | 1.36M | { | 348 | | #if !ENABLE_SIMD_TRAFO | 349 | | const int rnd_factor = 1 << (shift - 1); | 350 | | #endif | 351 | 1.36M | const int reducedLine = line - iSkipLine; | 352 | 1.36M | const int cutoff = uiTrSize - iSkipLine2; | 353 | 1.36M | TCoeff *pCoef; | 354 | | | 355 | 1.36M | #if ENABLE_SIMD_TRAFO | 356 | 1.36M | if( line == 1 ) | 357 | 0 | { | 358 | 0 | g_tCoeffOps.fastFwdCore_1D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 359 | 0 | } | 360 | 1.36M | else | 361 | 1.36M | { | 362 | 1.36M | g_tCoeffOps.fastFwdCore_2D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 363 | 1.36M | } | 364 | | #else | 365 | | for( int i = 0; i<reducedLine; i++ ) | 366 | | { | 367 | | pCoef = dst; | 368 | | const TMatrixCoeff* iT = tc; | 369 | | for( int j = 0; j<cutoff; j++ ) | 370 | | { | 371 | | int iSum = 0; | 372 | | for( int k = 0; k<uiTrSize; k++ ) | 373 | | { | 374 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 375 | | iSum += src[k] * iT[k]; | 376 | | } | 377 | | pCoef[i] = (iSum + rnd_factor) >> shift; | 378 | | pCoef += line; | 379 | | iT += uiTrSize; | 380 | | } | 381 | | src += uiTrSize; | 382 | | } | 383 | | #endif | 384 | | | 385 | 1.36M | if( iSkipLine ) | 386 | 176k | { | 387 | 176k | pCoef = dst + reducedLine; | 388 | 1.58M | for( int j = 0; j<cutoff; j++ ) | 389 | 1.41M | { | 390 | 1.41M | memset(pCoef, 0, sizeof(TCoeff) * iSkipLine); | 391 | 1.41M | pCoef += line; | 392 | 1.41M | } | 393 | 176k | } | 394 | | | 395 | 1.36M | if( iSkipLine2 ) | 396 | 153k | { | 397 | 153k | pCoef = dst + line*cutoff; | 398 | 153k | memset(pCoef, 0, sizeof(TCoeff) * line * iSkipLine2); | 399 | 153k | } | 400 | 1.36M | } |
void vvenc::_fastForwardMM<16>(int const*, int*, int, int, int, int, short const*) Line | Count | Source | 347 | 1.25M | { | 348 | | #if !ENABLE_SIMD_TRAFO | 349 | | const int rnd_factor = 1 << (shift - 1); | 350 | | #endif | 351 | 1.25M | const int reducedLine = line - iSkipLine; | 352 | 1.25M | const int cutoff = uiTrSize - iSkipLine2; | 353 | 1.25M | TCoeff *pCoef; | 354 | | | 355 | 1.25M | #if ENABLE_SIMD_TRAFO | 356 | 1.25M | if( line == 1 ) | 357 | 268 | { | 358 | 268 | g_tCoeffOps.fastFwdCore_1D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 359 | 268 | } | 360 | 1.25M | else | 361 | 1.25M | { | 362 | 1.25M | g_tCoeffOps.fastFwdCore_2D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 363 | 1.25M | } | 364 | | #else | 365 | | for( int i = 0; i<reducedLine; i++ ) | 366 | | { | 367 | | pCoef = dst; | 368 | | const TMatrixCoeff* iT = tc; | 369 | | for( int j = 0; j<cutoff; j++ ) | 370 | | { | 371 | | int iSum = 0; | 372 | | for( int k = 0; k<uiTrSize; k++ ) | 373 | | { | 374 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 375 | | iSum += src[k] * iT[k]; | 376 | | } | 377 | | pCoef[i] = (iSum + rnd_factor) >> shift; | 378 | | pCoef += line; | 379 | | iT += uiTrSize; | 380 | | } | 381 | | src += uiTrSize; | 382 | | } | 383 | | #endif | 384 | | | 385 | 1.25M | if( iSkipLine ) | 386 | 227k | { | 387 | 227k | pCoef = dst + reducedLine; | 388 | 2.05M | for( int j = 0; j<cutoff; j++ ) | 389 | 1.83M | { | 390 | 1.83M | memset(pCoef, 0, sizeof(TCoeff) * iSkipLine); | 391 | 1.83M | pCoef += line; | 392 | 1.83M | } | 393 | 227k | } | 394 | | | 395 | 1.25M | if( iSkipLine2 ) | 396 | 789k | { | 397 | 789k | pCoef = dst + line*cutoff; | 398 | 789k | memset(pCoef, 0, sizeof(TCoeff) * line * iSkipLine2); | 399 | 789k | } | 400 | 1.25M | } |
void vvenc::_fastForwardMM<32>(int const*, int*, int, int, int, int, short const*) Line | Count | Source | 347 | 1.13M | { | 348 | | #if !ENABLE_SIMD_TRAFO | 349 | | const int rnd_factor = 1 << (shift - 1); | 350 | | #endif | 351 | 1.13M | const int reducedLine = line - iSkipLine; | 352 | 1.13M | const int cutoff = uiTrSize - iSkipLine2; | 353 | 1.13M | TCoeff *pCoef; | 354 | | | 355 | 1.13M | #if ENABLE_SIMD_TRAFO | 356 | 1.13M | if( line == 1 ) | 357 | 48 | { | 358 | 48 | g_tCoeffOps.fastFwdCore_1D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 359 | 48 | } | 360 | 1.13M | else | 361 | 1.13M | { | 362 | 1.13M | g_tCoeffOps.fastFwdCore_2D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 363 | 1.13M | } | 364 | | #else | 365 | | for( int i = 0; i<reducedLine; i++ ) | 366 | | { | 367 | | pCoef = dst; | 368 | | const TMatrixCoeff* iT = tc; | 369 | | for( int j = 0; j<cutoff; j++ ) | 370 | | { | 371 | | int iSum = 0; | 372 | | for( int k = 0; k<uiTrSize; k++ ) | 373 | | { | 374 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 375 | | iSum += src[k] * iT[k]; | 376 | | } | 377 | | pCoef[i] = (iSum + rnd_factor) >> shift; | 378 | | pCoef += line; | 379 | | iT += uiTrSize; | 380 | | } | 381 | | src += uiTrSize; | 382 | | } | 383 | | #endif | 384 | | | 385 | 1.13M | if( iSkipLine ) | 386 | 205k | { | 387 | 205k | pCoef = dst + reducedLine; | 388 | 1.85M | for( int j = 0; j<cutoff; j++ ) | 389 | 1.64M | { | 390 | 1.64M | memset(pCoef, 0, sizeof(TCoeff) * iSkipLine); | 391 | 1.64M | pCoef += line; | 392 | 1.64M | } | 393 | 205k | } | 394 | | | 395 | 1.13M | if( iSkipLine2 ) | 396 | 686k | { | 397 | 686k | pCoef = dst + line*cutoff; | 398 | 686k | memset(pCoef, 0, sizeof(TCoeff) * line * iSkipLine2); | 399 | 686k | } | 400 | 1.13M | } |
void vvenc::_fastForwardMM<64>(int const*, int*, int, int, int, int, short const*) Line | Count | Source | 347 | 121k | { | 348 | | #if !ENABLE_SIMD_TRAFO | 349 | | const int rnd_factor = 1 << (shift - 1); | 350 | | #endif | 351 | 121k | const int reducedLine = line - iSkipLine; | 352 | 121k | const int cutoff = uiTrSize - iSkipLine2; | 353 | 121k | TCoeff *pCoef; | 354 | | | 355 | 121k | #if ENABLE_SIMD_TRAFO | 356 | 121k | if( line == 1 ) | 357 | 0 | { | 358 | 0 | g_tCoeffOps.fastFwdCore_1D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 359 | 0 | } | 360 | 121k | else | 361 | 121k | { | 362 | 121k | g_tCoeffOps.fastFwdCore_2D[Log2( uiTrSize ) - 2]( tc, src, dst, line, reducedLine, cutoff, shift ); | 363 | 121k | } | 364 | | #else | 365 | | for( int i = 0; i<reducedLine; i++ ) | 366 | | { | 367 | | pCoef = dst; | 368 | | const TMatrixCoeff* iT = tc; | 369 | | for( int j = 0; j<cutoff; j++ ) | 370 | | { | 371 | | int iSum = 0; | 372 | | for( int k = 0; k<uiTrSize; k++ ) | 373 | | { | 374 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 375 | | iSum += src[k] * iT[k]; | 376 | | } | 377 | | pCoef[i] = (iSum + rnd_factor) >> shift; | 378 | | pCoef += line; | 379 | | iT += uiTrSize; | 380 | | } | 381 | | src += uiTrSize; | 382 | | } | 383 | | #endif | 384 | | | 385 | 121k | if( iSkipLine ) | 386 | 59.4k | { | 387 | 59.4k | pCoef = dst + reducedLine; | 388 | 1.37M | for( int j = 0; j<cutoff; j++ ) | 389 | 1.31M | { | 390 | 1.31M | memset(pCoef, 0, sizeof(TCoeff) * iSkipLine); | 391 | 1.31M | pCoef += line; | 392 | 1.31M | } | 393 | 59.4k | } | 394 | | | 395 | 121k | if( iSkipLine2 ) | 396 | 121k | { | 397 | 121k | pCoef = dst + line*cutoff; | 398 | 121k | memset(pCoef, 0, sizeof(TCoeff) * line * iSkipLine2); | 399 | 121k | } | 400 | 121k | } |
|
401 | | |
402 | | |
403 | | |
404 | | /** 8x8 forward transform implemented using partial butterfly structure (1D) |
405 | | * \param src input data (residual) |
406 | | * \param dst output data (transform coefficients) |
407 | | * \param shift specifies right shift after 1D transform |
408 | | * \param line |
409 | | */ |
410 | | void fastForwardDCT2_B8( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2 ) |
411 | 1.33M | { |
412 | | #if !JVET_M0497_MATRIX_MULT |
413 | | int j, k; |
414 | | TCoeff E[4], O[4]; |
415 | | TCoeff EE[2], EO[2]; |
416 | | TCoeff add = ( shift > 0 ) ? ( 1 << ( shift - 1 ) ) : 0; |
417 | | |
418 | | const TMatrixCoeff *iT = g_trCoreDCT2P8[TRANSFORM_FORWARD][0]; |
419 | | |
420 | | TCoeff *pCoef = dst; |
421 | | const int reducedLine = line - iSkipLine; |
422 | | for( j = 0; j < reducedLine; j++ ) |
423 | | { |
424 | | /* E and O*/ |
425 | | for( k = 0; k < 4; k++ ) |
426 | | { |
427 | | E[k] = src[k] + src[7 - k]; |
428 | | O[k] = src[k] - src[7 - k]; |
429 | | } |
430 | | /* EE and EO */ |
431 | | EE[0] = E[0] + E[3]; |
432 | | EO[0] = E[0] - E[3]; |
433 | | EE[1] = E[1] + E[2]; |
434 | | EO[1] = E[1] - E[2]; |
435 | | |
436 | | dst[0 ] = (iT[ 0] * EE[0] + iT[ 1] * EE[1] + add) >> shift; |
437 | | dst[4 * line] = (iT[32] * EE[0] + iT[33] * EE[1] + add) >> shift; |
438 | | dst[2 * line] = (iT[16] * EO[0] + iT[17] * EO[1] + add) >> shift; |
439 | | dst[6 * line] = (iT[48] * EO[0] + iT[49] * EO[1] + add) >> shift; |
440 | | |
441 | | dst[ line] = (iT[ 8] * O[0] + iT[ 9] * O[1] + iT[10] * O[2] + iT[11] * O[3] + add) >> shift; |
442 | | dst[3 * line] = (iT[24] * O[0] + iT[25] * O[1] + iT[26] * O[2] + iT[27] * O[3] + add) >> shift; |
443 | | dst[5 * line] = (iT[40] * O[0] + iT[41] * O[1] + iT[42] * O[2] + iT[43] * O[3] + add) >> shift; |
444 | | dst[7 * line] = (iT[56] * O[0] + iT[57] * O[1] + iT[58] * O[2] + iT[59] * O[3] + add) >> shift; |
445 | | |
446 | | src += 8; |
447 | | dst++; |
448 | | } |
449 | | if( iSkipLine ) |
450 | | { |
451 | | dst = pCoef + reducedLine; |
452 | | for( j = 0; j < 8; j++ ) |
453 | | { |
454 | | memset( dst, 0, sizeof( TCoeff )*iSkipLine ); |
455 | | dst += line; |
456 | | } |
457 | | } |
458 | | #else |
459 | 1.33M | _fastForwardMM< 8 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT2P8[TRANSFORM_FORWARD][0] ); |
460 | 1.33M | #endif |
461 | 1.33M | } |
462 | | |
463 | | /** 8x8 inverse transform implemented using partial butterfly structure (1D) |
464 | | * \param src input data (transform coefficients) |
465 | | * \param dst output data (residual) |
466 | | * \param shift specifies right shift after 1D transform |
467 | | * \param line |
468 | | * \param outputMinimum minimum for clipping |
469 | | * \param outputMaximum maximum for clipping |
470 | | */ |
471 | | static void fastInverseDCT2_B8_Core(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
472 | 629k | { |
473 | 629k | int j, k; |
474 | 629k | int E[4], O[4]; |
475 | 629k | int EE[2], EO[2]; |
476 | 629k | int add = 1 << (shift - 1); |
477 | | |
478 | 629k | const TMatrixCoeff *iT = g_trCoreDCT2P8[TRANSFORM_INVERSE][0]; |
479 | | |
480 | 629k | const int reducedLine = line - iSkipLine; |
481 | 7.46M | for( j = 0; j < reducedLine; j++ ) |
482 | 6.83M | { |
483 | | /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ |
484 | 34.1M | for( k = 0; k < 4; k++ ) |
485 | 27.3M | { |
486 | 27.3M | O[k] = iT[1 * 8 + k] * src[line] + iT[3 * 8 + k] * src[3 * line] + iT[5 * 8 + k] * src[5 * line] + iT[7 * 8 + k] * src[7 * line]; |
487 | 27.3M | } |
488 | | |
489 | 6.83M | EO[0] = iT[2 * 8 + 0] * src[2 * line] + iT[6 * 8 + 0] * src[6 * line]; |
490 | 6.83M | EO[1] = iT[2 * 8 + 1] * src[2 * line] + iT[6 * 8 + 1] * src[6 * line]; |
491 | 6.83M | EE[0] = iT[0 * 8 + 0] * src[0 ] + iT[4 * 8 + 0] * src[4 * line]; |
492 | 6.83M | EE[1] = iT[0 * 8 + 1] * src[0 ] + iT[4 * 8 + 1] * src[4 * line]; |
493 | | |
494 | | /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ |
495 | 6.83M | E[0] = EE[0] + EO[0]; |
496 | 6.83M | E[3] = EE[0] - EO[0]; |
497 | 6.83M | E[1] = EE[1] + EO[1]; |
498 | 6.83M | E[2] = EE[1] - EO[1]; |
499 | | |
500 | 34.1M | for( k = 0; k < 4; k++ ) |
501 | 27.3M | { |
502 | 27.3M | dst[k ] = Clip3( outputMinimum, outputMaximum, ( E[ k] + O[ k] + add ) >> shift ); |
503 | 27.3M | dst[k + 4] = Clip3( outputMinimum, outputMaximum, ( E[3 - k] - O[3 - k] + add ) >> shift ); |
504 | 27.3M | } |
505 | 6.83M | src++; |
506 | 6.83M | dst += 8; |
507 | 6.83M | } |
508 | | |
509 | 629k | if( iSkipLine ) |
510 | 75.3k | { |
511 | 75.3k | memset( dst, 0, ( iSkipLine << 3 ) * sizeof( TCoeff ) ); |
512 | 75.3k | } |
513 | 629k | } |
514 | | |
515 | | |
516 | | // The partial-butterfly transforms are dispatched through g_tCoeffOps, which holds either the scalar _Core |
517 | | // functions above or their SIMD versions. |
518 | | |
519 | | void fastForwardDCT2_B2( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2 ) |
520 | 32.0k | { |
521 | 32.0k | #if ENABLE_SIMD_TRAFO |
522 | 32.0k | g_tCoeffOps.fastFwdDCT2[0]( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
523 | | #else |
524 | | fastForwardDCT2_B2_Core( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
525 | | #endif |
526 | 32.0k | } |
527 | | |
528 | | void fastInverseDCT2_B2( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum ) |
529 | 19.3k | { |
530 | 19.3k | #if ENABLE_SIMD_TRAFO |
531 | 19.3k | g_tCoeffOps.fastInvDCT2[0]( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum ); |
532 | | #else |
533 | | fastInverseDCT2_B2_Core( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum ); |
534 | | #endif |
535 | 19.3k | } |
536 | | |
537 | | void fastForwardDCT2_B4( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2 ) |
538 | 880k | { |
539 | 880k | #if ENABLE_SIMD_TRAFO |
540 | 880k | g_tCoeffOps.fastFwdDCT2[1]( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
541 | | #else |
542 | | fastForwardDCT2_B4_Core( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
543 | | #endif |
544 | 880k | } |
545 | | |
546 | | void fastInverseDCT2_B4( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum ) |
547 | 407k | { |
548 | 407k | #if ENABLE_SIMD_TRAFO |
549 | 407k | g_tCoeffOps.fastInvDCT2[1]( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum ); |
550 | | #else |
551 | | fastInverseDCT2_B4_Core( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum ); |
552 | | #endif |
553 | 407k | } |
554 | | |
555 | | void fastInverseDCT2_B8( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum ) |
556 | 629k | { |
557 | 629k | #if ENABLE_SIMD_TRAFO |
558 | 629k | g_tCoeffOps.fastInvDCT2[2]( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum ); |
559 | | #else |
560 | | fastInverseDCT2_B8_Core( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum ); |
561 | | #endif |
562 | 629k | } |
563 | | |
564 | | |
565 | | /** 16x16 forward transform implemented using partial butterfly structure (1D) |
566 | | * \param src input data (residual) |
567 | | * \param dst output data (transform coefficients) |
568 | | * \param shift specifies right shift after 1D transform |
569 | | * \param line |
570 | | */ |
571 | | void fastForwardDCT2_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
572 | 1.20M | { |
573 | | #if !JVET_M0497_MATRIX_MULT |
574 | | int j, k; |
575 | | TCoeff E [8], O [8]; |
576 | | TCoeff EE [4], EO [4]; |
577 | | TCoeff EEE[2], EEO[2]; |
578 | | TCoeff add = ( shift > 0 ) ? ( 1 << ( shift - 1 ) ) : 0; |
579 | | |
580 | | const TMatrixCoeff *iT = g_trCoreDCT2P16[TRANSFORM_FORWARD][0]; |
581 | | |
582 | | TCoeff *pCoef = dst; |
583 | | const int reducedLine = line - iSkipLine; |
584 | | for( j = 0; j < reducedLine; j++ ) |
585 | | { |
586 | | /* E and O*/ |
587 | | for( k = 0; k < 8; k++ ) |
588 | | { |
589 | | E[k] = src[k] + src[15 - k]; |
590 | | O[k] = src[k] - src[15 - k]; |
591 | | } |
592 | | /* EE and EO */ |
593 | | for( k = 0; k < 4; k++ ) |
594 | | { |
595 | | EE[k] = E[k] + E[7 - k]; |
596 | | EO[k] = E[k] - E[7 - k]; |
597 | | } |
598 | | /* EEE and EEO */ |
599 | | EEE[0] = EE[0] + EE[3]; |
600 | | EEO[0] = EE[0] - EE[3]; |
601 | | EEE[1] = EE[1] + EE[2]; |
602 | | EEO[1] = EE[1] - EE[2]; |
603 | | |
604 | | dst[ 0 ] = ( iT[ 0 ] * EEE[0] + iT[ 1] * EEE[1] + add ) >> shift; |
605 | | dst[ 8 * line] = ( iT[ 8 * 16] * EEE[0] + iT[ 8 * 16 + 1] * EEE[1] + add ) >> shift; |
606 | | dst[ 4 * line] = ( iT[ 4 * 16] * EEO[0] + iT[ 4 * 16 + 1] * EEO[1] + add ) >> shift; |
607 | | dst[12 * line] = ( iT[12 * 16] * EEO[0] + iT[12 * 16 + 1] * EEO[1] + add ) >> shift; |
608 | | |
609 | | for( k = 2; k < 16; k += 4 ) |
610 | | { |
611 | | dst[k*line] = ( iT[k * 16] * EO[0] + iT[k * 16 + 1] * EO[1] + iT[k * 16 + 2] * EO[2] + iT[k * 16 + 3] * EO[3] + add ) >> shift; |
612 | | } |
613 | | |
614 | | for( k = 1; k < 16; k += 2 ) |
615 | | { |
616 | | dst[k*line] = ( iT[k * 16 ] * O[0] + iT[k * 16 + 1] * O[1] + iT[k * 16 + 2] * O[2] + iT[k * 16 + 3] * O[3] + |
617 | | iT[k * 16 + 4] * O[4] + iT[k * 16 + 5] * O[5] + iT[k * 16 + 6] * O[6] + iT[k * 16 + 7] * O[7] + add ) >> shift; |
618 | | } |
619 | | |
620 | | src += 16; |
621 | | dst++; |
622 | | |
623 | | } |
624 | | if( iSkipLine ) |
625 | | { |
626 | | dst = pCoef + reducedLine; |
627 | | for( j = 0; j < 16; j++ ) |
628 | | { |
629 | | memset( dst, 0, sizeof( TCoeff )*iSkipLine ); |
630 | | dst += line; |
631 | | } |
632 | | } |
633 | | #else |
634 | 1.20M | _fastForwardMM< 16 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT2P16[TRANSFORM_FORWARD][0] ); |
635 | 1.20M | #endif |
636 | 1.20M | } |
637 | | |
638 | | /** 16x16 inverse transform implemented using partial butterfly structure (1D) |
639 | | * \param src input data (transform coefficients) |
640 | | * \param dst output data (residual) |
641 | | * \param shift specifies right shift after 1D transform |
642 | | * \param line |
643 | | * \param outputMinimum minimum for clipping |
644 | | * \param outputMaximum maximum for clipping |
645 | | */ |
646 | | void fastInverseDCT2_B16( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum ) |
647 | 573k | { |
648 | 573k | #if ENABLE_SIMD_TRAFO |
649 | 573k | const TMatrixCoeff *iT = g_trCoreDCT2P16[TRANSFORM_INVERSE][0]; |
650 | | |
651 | 573k | _fastInverseMM<16>( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, iT ); |
652 | | #else |
653 | | int j, k; |
654 | | int E [8], O [8]; |
655 | | int EE [4], EO [4]; |
656 | | int EEE[2], EEO[2]; |
657 | | int add = 1 << ( shift - 1 ); |
658 | | |
659 | | const TMatrixCoeff *iT = g_trCoreDCT2P16[TRANSFORM_INVERSE][0]; |
660 | | |
661 | | #if ENABLE_SIMD_TRAFO |
662 | | TCoeff *orgDst = dst; |
663 | | |
664 | | #endif |
665 | | const int reducedLine = line - iSkipLine; |
666 | | |
667 | | for( j = 0; j < reducedLine; j++ ) |
668 | | { |
669 | | /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ |
670 | | for( k = 0; k < 8; k++ ) |
671 | | { |
672 | | O[k] = iT[1 * 16 + k] * src[ line] + iT[ 3 * 16 + k] * src[ 3 * line] + iT[ 5 * 16 + k] * src[ 5 * line] + iT[ 7 * 16 + k] * src[ 7 * line] + |
673 | | iT[9 * 16 + k] * src[9 * line] + iT[11 * 16 + k] * src[11 * line] + iT[13 * 16 + k] * src[13 * line] + iT[15 * 16 + k] * src[15 * line]; |
674 | | } |
675 | | for( k = 0; k < 4; k++ ) |
676 | | { |
677 | | EO[k] = iT[2 * 16 + k] * src[2 * line] + iT[6 * 16 + k] * src[6 * line] + iT[10 * 16 + k] * src[10 * line] + iT[14 * 16 + k] * src[14 * line]; |
678 | | } |
679 | | EEO[0] = iT[4 * 16 ] * src[4 * line] + iT[12 * 16 ] * src[12 * line]; |
680 | | EEE[0] = iT[0 ] * src[0 ] + iT[ 8 * 16 ] * src[ 8 * line]; |
681 | | EEO[1] = iT[4 * 16 + 1] * src[4 * line] + iT[12 * 16 + 1] * src[12 * line]; |
682 | | EEE[1] = iT[0 * 16 + 1] * src[0 ] + iT[ 8 * 16 + 1] * src[ 8 * line]; |
683 | | |
684 | | /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ |
685 | | for( k = 0; k < 2; k++ ) |
686 | | { |
687 | | EE[k ] = EEE[ k] + EEO[ k]; |
688 | | EE[k + 2] = EEE[1 - k] - EEO[1 - k]; |
689 | | } |
690 | | for( k = 0; k < 4; k++ ) |
691 | | { |
692 | | E[k ] = EE[ k] + EO[ k]; |
693 | | E[k + 4] = EE[3 - k] - EO[3 - k]; |
694 | | } |
695 | | for( k = 0; k < 8; k++ ) |
696 | | { |
697 | | #if ENABLE_SIMD_TRAFO |
698 | | dst[k ] = E[ k] + O[ k]; |
699 | | dst[k + 8] = E[7 - k] - O[7 - k]; |
700 | | #else |
701 | | dst[k ] = Clip3( outputMinimum, outputMaximum, ( E[ k] + O[ k] + add ) >> shift ); |
702 | | dst[k + 8] = Clip3( outputMinimum, outputMaximum, ( E[7 - k] - O[7 - k] + add ) >> shift ); |
703 | | #endif |
704 | | } |
705 | | src++; |
706 | | dst += 16; |
707 | | } |
708 | | |
709 | | #if ENABLE_SIMD_TRAFO |
710 | | g_tCoeffOps.roundClip8( orgDst, 16, reducedLine, 16, outputMinimum, outputMaximum, add, shift ); |
711 | | |
712 | | #endif |
713 | | if( iSkipLine ) |
714 | | { |
715 | | memset( dst, 0, ( iSkipLine << 4 ) * sizeof( TCoeff ) ); |
716 | | } |
717 | | #endif |
718 | 573k | } |
719 | | |
720 | | |
721 | | |
722 | | /** 32x32 forward transform implemented using partial butterfly structure (1D) |
723 | | * \param src input data (residual) |
724 | | * \param dst output data (transform coefficients) |
725 | | * \param shift specifies right shift after 1D transform |
726 | | * \param line |
727 | | */ |
728 | | void fastForwardDCT2_B32( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2 ) |
729 | 1.13M | { |
730 | | #if !JVET_M0497_MATRIX_MULT |
731 | | int j, k; |
732 | | TCoeff E [16], O [16]; |
733 | | TCoeff EE [ 8], EO [ 8]; |
734 | | TCoeff EEE [ 4], EEO [ 4]; |
735 | | TCoeff EEEE[ 2], EEEO[ 2]; |
736 | | TCoeff add = ( shift > 0 ) ? ( 1 << ( shift - 1 ) ) : 0; |
737 | | |
738 | | const TMatrixCoeff *iT = g_trCoreDCT2P32[TRANSFORM_FORWARD][0]; |
739 | | |
740 | | TCoeff *pCoef = dst; |
741 | | const int reducedLine = line - iSkipLine; |
742 | | for (j = 0; j<reducedLine; j++) |
743 | | { |
744 | | /* E and O*/ |
745 | | for (k = 0;k<16;k++) |
746 | | { |
747 | | E[k] = src[k] + src[31 - k]; |
748 | | O[k] = src[k] - src[31 - k]; |
749 | | } |
750 | | /* EE and EO */ |
751 | | for (k = 0;k<8;k++) |
752 | | { |
753 | | EE[k] = E[k] + E[15 - k]; |
754 | | EO[k] = E[k] - E[15 - k]; |
755 | | } |
756 | | /* EEE and EEO */ |
757 | | for (k = 0;k<4;k++) |
758 | | { |
759 | | EEE[k] = EE[k] + EE[7 - k]; |
760 | | EEO[k] = EE[k] - EE[7 - k]; |
761 | | } |
762 | | /* EEEE and EEEO */ |
763 | | EEEE[0] = EEE[0] + EEE[3]; |
764 | | EEEO[0] = EEE[0] - EEE[3]; |
765 | | EEEE[1] = EEE[1] + EEE[2]; |
766 | | EEEO[1] = EEE[1] - EEE[2]; |
767 | | |
768 | | dst[0] = (iT[0 * 32 + 0] * EEEE[0] + iT[0 * 32 + 1] * EEEE[1] + add) >> shift; |
769 | | dst[16 * line] = (iT[16 * 32 + 0] * EEEE[0] + iT[16 * 32 + 1] * EEEE[1] + add) >> shift; |
770 | | dst[8 * line] = (iT[8 * 32 + 0] * EEEO[0] + iT[8 * 32 + 1] * EEEO[1] + add) >> shift; |
771 | | dst[24 * line] = (iT[24 * 32 + 0] * EEEO[0] + iT[24 * 32 + 1] * EEEO[1] + add) >> shift; |
772 | | for (k = 4;k<32;k += 8) |
773 | | { |
774 | | dst[k*line] = (iT[k * 32 + 0] * EEO[0] + iT[k * 32 + 1] * EEO[1] + iT[k * 32 + 2] * EEO[2] + iT[k * 32 + 3] * EEO[3] + add) >> shift; |
775 | | } |
776 | | for (k = 2;k<32;k += 4) |
777 | | { |
778 | | dst[k*line] = (iT[k * 32 + 0] * EO[0] + iT[k * 32 + 1] * EO[1] + iT[k * 32 + 2] * EO[2] + iT[k * 32 + 3] * EO[3] + |
779 | | iT[k * 32 + 4] * EO[4] + iT[k * 32 + 5] * EO[5] + iT[k * 32 + 6] * EO[6] + iT[k * 32 + 7] * EO[7] + add) >> shift; |
780 | | } |
781 | | for (k = 1;k<32;k += 2) |
782 | | { |
783 | | dst[k*line] = (iT[k * 32 + 0] * O[0] + iT[k * 32 + 1] * O[1] + iT[k * 32 + 2] * O[2] + iT[k * 32 + 3] * O[3] + |
784 | | iT[k * 32 + 4] * O[4] + iT[k * 32 + 5] * O[5] + iT[k * 32 + 6] * O[6] + iT[k * 32 + 7] * O[7] + |
785 | | iT[k * 32 + 8] * O[8] + iT[k * 32 + 9] * O[9] + iT[k * 32 + 10] * O[10] + iT[k * 32 + 11] * O[11] + |
786 | | iT[k * 32 + 12] * O[12] + iT[k * 32 + 13] * O[13] + iT[k * 32 + 14] * O[14] + iT[k * 32 + 15] * O[15] + add) >> shift; |
787 | | } |
788 | | src += 32; |
789 | | dst++; |
790 | | } |
791 | | if (iSkipLine) |
792 | | { |
793 | | dst = pCoef + reducedLine; |
794 | | for (j = 0; j<32; j++) |
795 | | { |
796 | | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
797 | | dst += line; |
798 | | } |
799 | | } |
800 | | #else |
801 | 1.13M | _fastForwardMM< 32 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT2P32[TRANSFORM_FORWARD][0] ); |
802 | 1.13M | #endif |
803 | 1.13M | } |
804 | | |
805 | | /** 32x32 inverse transform implemented using partial butterfly structure (1D) |
806 | | * \param src input data (transform coefficients) |
807 | | * \param dst output data (residual) |
808 | | * \param shift specifies right shift after 1D transform |
809 | | * \param line |
810 | | * \param outputMinimum minimum for clipping |
811 | | * \param outputMaximum maximum for clipping |
812 | | */ |
813 | | void fastInverseDCT2_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
814 | 275k | { |
815 | 275k | #if ENABLE_SIMD_TRAFO |
816 | 275k | const TMatrixCoeff *iT = g_trCoreDCT2P32[TRANSFORM_INVERSE][0]; |
817 | | |
818 | 275k | _fastInverseMM<32>( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, iT ); |
819 | | #else |
820 | | int j, k; |
821 | | int E[16], O[16]; |
822 | | int EE[8], EO[8]; |
823 | | int EEE[4], EEO[4]; |
824 | | int EEEE[2], EEEO[2]; |
825 | | int add = 1 << (shift - 1); |
826 | | |
827 | | const TMatrixCoeff *iT = g_trCoreDCT2P32[TRANSFORM_INVERSE][0]; |
828 | | |
829 | | #if ENABLE_SIMD_TRAFO |
830 | | TCoeff *orgDst = dst; |
831 | | |
832 | | #endif |
833 | | const int reducedLine = line - iSkipLine; |
834 | | for (j = 0; j<reducedLine; j++) |
835 | | { |
836 | | /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ |
837 | | for (k = 0;k<16;k++) |
838 | | { |
839 | | O[k] = iT[1 * 32 + k] * src[line] + iT[3 * 32 + k] * src[3 * line] + iT[5 * 32 + k] * src[5 * line] + iT[7 * 32 + k] * src[7 * line] + |
840 | | iT[9 * 32 + k] * src[9 * line] + iT[11 * 32 + k] * src[11 * line] + iT[13 * 32 + k] * src[13 * line] + iT[15 * 32 + k] * src[15 * line] + |
841 | | iT[17 * 32 + k] * src[17 * line] + iT[19 * 32 + k] * src[19 * line] + iT[21 * 32 + k] * src[21 * line] + iT[23 * 32 + k] * src[23 * line] + |
842 | | iT[25 * 32 + k] * src[25 * line] + iT[27 * 32 + k] * src[27 * line] + iT[29 * 32 + k] * src[29 * line] + iT[31 * 32 + k] * src[31 * line]; |
843 | | } |
844 | | for (k = 0;k<8;k++) |
845 | | { |
846 | | EO[k] = iT[2 * 32 + k] * src[2 * line] + iT[6 * 32 + k] * src[6 * line] + iT[10 * 32 + k] * src[10 * line] + iT[14 * 32 + k] * src[14 * line] + |
847 | | iT[18 * 32 + k] * src[18 * line] + iT[22 * 32 + k] * src[22 * line] + iT[26 * 32 + k] * src[26 * line] + iT[30 * 32 + k] * src[30 * line]; |
848 | | } |
849 | | for (k = 0;k<4;k++) |
850 | | { |
851 | | EEO[k] = iT[4 * 32 + k] * src[4 * line] + iT[12 * 32 + k] * src[12 * line] + iT[20 * 32 + k] * src[20 * line] + iT[28 * 32 + k] * src[28 * line]; |
852 | | } |
853 | | EEEO[0] = iT[8 * 32 + 0] * src[8 * line] + iT[24 * 32 + 0] * src[24 * line]; |
854 | | EEEO[1] = iT[8 * 32 + 1] * src[8 * line] + iT[24 * 32 + 1] * src[24 * line]; |
855 | | EEEE[0] = iT[0 * 32 + 0] * src[0] + iT[16 * 32 + 0] * src[16 * line]; |
856 | | EEEE[1] = iT[0 * 32 + 1] * src[0] + iT[16 * 32 + 1] * src[16 * line]; |
857 | | |
858 | | /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ |
859 | | EEE[0] = EEEE[0] + EEEO[0]; |
860 | | EEE[3] = EEEE[0] - EEEO[0]; |
861 | | EEE[1] = EEEE[1] + EEEO[1]; |
862 | | EEE[2] = EEEE[1] - EEEO[1]; |
863 | | for (k = 0;k<4;k++) |
864 | | { |
865 | | EE[k] = EEE[k] + EEO[k]; |
866 | | EE[k + 4] = EEE[3 - k] - EEO[3 - k]; |
867 | | } |
868 | | for (k = 0;k<8;k++) |
869 | | { |
870 | | E[k] = EE[k] + EO[k]; |
871 | | E[k + 8] = EE[7 - k] - EO[7 - k]; |
872 | | } |
873 | | for (k = 0;k<16;k++) |
874 | | { |
875 | | #if ENABLE_SIMD_TRAFO |
876 | | dst[k ] = E[k ] + O[k ]; |
877 | | dst[k + 16] = E[15 - k] - O[15 - k]; |
878 | | #else |
879 | | dst[k] = Clip3(outputMinimum, outputMaximum, (E[k] + O[k] + add) >> shift); |
880 | | dst[k + 16] = Clip3(outputMinimum, outputMaximum, (E[15 - k] - O[15 - k] + add) >> shift); |
881 | | #endif |
882 | | } |
883 | | src++; |
884 | | dst += 32; |
885 | | } |
886 | | |
887 | | #if ENABLE_SIMD_TRAFO |
888 | | g_tCoeffOps.roundClip8( orgDst, 32, reducedLine, 32, outputMinimum, outputMaximum, add, shift ); |
889 | | |
890 | | #endif |
891 | | if (iSkipLine) |
892 | | { |
893 | | memset(dst, 0, (iSkipLine << 5) * sizeof(TCoeff)); |
894 | | } |
895 | | #endif |
896 | 275k | } |
897 | | |
898 | | void fastForwardDCT2_B64(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
899 | 121k | { |
900 | | #if !JVET_M0497_MATRIX_MULT |
901 | | int rnd_factor = 1 << (shift - 1); |
902 | | |
903 | | const int uiTrSize = 64; |
904 | | const TMatrixCoeff *iT = g_trCoreDCT2P64[TRANSFORM_FORWARD][0]; |
905 | | |
906 | | int j, k; |
907 | | TCoeff E[32], O[32]; |
908 | | TCoeff EE[16], EO[16]; |
909 | | TCoeff EEE[8], EEO[8]; |
910 | | TCoeff EEEE[4], EEEO[4]; |
911 | | TCoeff EEEEE[2], EEEEO[2]; |
912 | | TCoeff *tmp = dst; |
913 | | |
914 | | //bool zo = iSkipLine2 >= 32; |
915 | | bool zo = iSkipLine2 != 0; |
916 | | for (j = 0; j<line - iSkipLine; j++) |
917 | | { |
918 | | /* E and O*/ |
919 | | for (k = 0;k<32;k++) |
920 | | { |
921 | | E[k] = src[k] + src[63 - k]; |
922 | | O[k] = src[k] - src[63 - k]; |
923 | | } |
924 | | /* EE and EO */ |
925 | | for (k = 0;k<16;k++) |
926 | | { |
927 | | EE[k] = E[k] + E[31 - k]; |
928 | | EO[k] = E[k] - E[31 - k]; |
929 | | } |
930 | | /* EEE and EEO */ |
931 | | for (k = 0;k<8;k++) |
932 | | { |
933 | | EEE[k] = EE[k] + EE[15 - k]; |
934 | | EEO[k] = EE[k] - EE[15 - k]; |
935 | | } |
936 | | /* EEEE and EEEO */ |
937 | | for (k = 0;k<4;k++) |
938 | | { |
939 | | EEEE[k] = EEE[k] + EEE[7 - k]; |
940 | | EEEO[k] = EEE[k] - EEE[7 - k]; |
941 | | } |
942 | | /* EEEEE and EEEEO */ |
943 | | EEEEE[0] = EEEE[0] + EEEE[3]; |
944 | | EEEEO[0] = EEEE[0] - EEEE[3]; |
945 | | EEEEE[1] = EEEE[1] + EEEE[2]; |
946 | | EEEEO[1] = EEEE[1] - EEEE[2]; |
947 | | |
948 | | dst[0] = (iT[0 * 64 + 0] * EEEEE[0] + iT[0 * 64 + 1] * EEEEE[1] + rnd_factor) >> shift; |
949 | | dst[16 * line] = (iT[16 * 64 + 0] * EEEEO[0] + iT[16 * 64 + 1] * EEEEO[1] + rnd_factor) >> shift; |
950 | | |
951 | | if (!zo) |
952 | | { |
953 | | dst[32 * line] = (iT[32 * 64 + 0] * EEEEE[0] + iT[32 * 64 + 1] * EEEEE[1] + rnd_factor) >> shift; |
954 | | dst[48 * line] = (iT[48 * 64 + 0] * EEEEO[0] + iT[48 * 64 + 1] * EEEEO[1] + rnd_factor) >> shift; |
955 | | } |
956 | | for (k = 8;k<(zo ? 32 : 64);k += 16) |
957 | | { |
958 | | dst[k*line] = (iT[k * 64 + 0] * EEEO[0] + iT[k * 64 + 1] * EEEO[1] + iT[k * 64 + 2] * EEEO[2] + iT[k * 64 + 3] * EEEO[3] + rnd_factor) >> shift; |
959 | | } |
960 | | for (k = 4;k<(zo ? 32 : 64);k += 8) |
961 | | { |
962 | | dst[k*line] = (iT[k * 64 + 0] * EEO[0] + iT[k * 64 + 1] * EEO[1] + iT[k * 64 + 2] * EEO[2] + iT[k * 64 + 3] * EEO[3] + |
963 | | iT[k * 64 + 4] * EEO[4] + iT[k * 64 + 5] * EEO[5] + iT[k * 64 + 6] * EEO[6] + iT[k * 64 + 7] * EEO[7] + rnd_factor) >> shift; |
964 | | } |
965 | | for (k = 2;k<(zo ? 32 : 64);k += 4) |
966 | | { |
967 | | dst[k*line] = (iT[k * 64 + 0] * EO[0] + iT[k * 64 + 1] * EO[1] + iT[k * 64 + 2] * EO[2] + iT[k * 64 + 3] * EO[3] + |
968 | | iT[k * 64 + 4] * EO[4] + iT[k * 64 + 5] * EO[5] + iT[k * 64 + 6] * EO[6] + iT[k * 64 + 7] * EO[7] + |
969 | | iT[k * 64 + 8] * EO[8] + iT[k * 64 + 9] * EO[9] + iT[k * 64 + 10] * EO[10] + iT[k * 64 + 11] * EO[11] + |
970 | | iT[k * 64 + 12] * EO[12] + iT[k * 64 + 13] * EO[13] + iT[k * 64 + 14] * EO[14] + iT[k * 64 + 15] * EO[15] + rnd_factor) >> shift; |
971 | | } |
972 | | for (k = 1;k<(zo ? 32 : 64);k += 2) |
973 | | { |
974 | | dst[k*line] = (iT[k * 64 + 0] * O[0] + iT[k * 64 + 1] * O[1] + iT[k * 64 + 2] * O[2] + iT[k * 64 + 3] * O[3] + |
975 | | iT[k * 64 + 4] * O[4] + iT[k * 64 + 5] * O[5] + iT[k * 64 + 6] * O[6] + iT[k * 64 + 7] * O[7] + |
976 | | iT[k * 64 + 8] * O[8] + iT[k * 64 + 9] * O[9] + iT[k * 64 + 10] * O[10] + iT[k * 64 + 11] * O[11] + |
977 | | iT[k * 64 + 12] * O[12] + iT[k * 64 + 13] * O[13] + iT[k * 64 + 14] * O[14] + iT[k * 64 + 15] * O[15] + |
978 | | iT[k * 64 + 16] * O[16] + iT[k * 64 + 17] * O[17] + iT[k * 64 + 18] * O[18] + iT[k * 64 + 19] * O[19] + |
979 | | iT[k * 64 + 20] * O[20] + iT[k * 64 + 21] * O[21] + iT[k * 64 + 22] * O[22] + iT[k * 64 + 23] * O[23] + |
980 | | iT[k * 64 + 24] * O[24] + iT[k * 64 + 25] * O[25] + iT[k * 64 + 26] * O[26] + iT[k * 64 + 27] * O[27] + |
981 | | iT[k * 64 + 28] * O[28] + iT[k * 64 + 29] * O[29] + iT[k * 64 + 30] * O[30] + iT[k * 64 + 31] * O[31] + rnd_factor) >> shift; |
982 | | } |
983 | | src += uiTrSize; |
984 | | dst++; |
985 | | } |
986 | | |
987 | | const int reducedLine = line - iSkipLine; |
988 | | const int cutoff = uiTrSize - iSkipLine2; |
989 | | if (iSkipLine) |
990 | | { |
991 | | dst = tmp + reducedLine; |
992 | | for (j = 0; j<cutoff; j++) |
993 | | { |
994 | | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
995 | | dst += line; |
996 | | } |
997 | | } |
998 | | if (iSkipLine2) |
999 | | { |
1000 | | dst = tmp + line*cutoff; |
1001 | | memset(dst, 0, sizeof(TCoeff)*line*iSkipLine2); |
1002 | | } |
1003 | | #else |
1004 | 121k | _fastForwardMM< 64 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT2P64[TRANSFORM_FORWARD][0] ); |
1005 | 121k | #endif |
1006 | 121k | } |
1007 | | |
1008 | | void fastInverseDCT2_B64(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1009 | 26.8k | { |
1010 | 26.8k | #if ENABLE_SIMD_TRAFO |
1011 | 26.8k | const TMatrixCoeff *iT = g_trCoreDCT2P64[TRANSFORM_INVERSE][0]; |
1012 | | |
1013 | 26.8k | _fastInverseMM<64>( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, iT ); |
1014 | | #else |
1015 | | int rnd_factor = 1 << (shift - 1); |
1016 | | const int uiTrSize = 64; |
1017 | | const TMatrixCoeff *iT = g_trCoreDCT2P64[TRANSFORM_INVERSE][0]; |
1018 | | |
1019 | | #if ENABLE_SIMD_TRAFO |
1020 | | TCoeff *orgDst = dst; |
1021 | | |
1022 | | #endif |
1023 | | int j, k; |
1024 | | TCoeff E[32], O[32]; |
1025 | | TCoeff EE[16], EO[16]; |
1026 | | TCoeff EEE[8], EEO[8]; |
1027 | | TCoeff EEEE[4], EEEO[4]; |
1028 | | TCoeff EEEEE[2], EEEEO[2]; |
1029 | | bool zo = iSkipLine2 >= 32; |
1030 | | for (j = 0; j<line - iSkipLine; j++) |
1031 | | { |
1032 | | /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ |
1033 | | for (k = 0;k<32;k++) |
1034 | | { |
1035 | | O[k] = iT[1 * 64 + k] * src[line] + iT[3 * 64 + k] * src[3 * line] + iT[5 * 64 + k] * src[5 * line] + iT[7 * 64 + k] * src[7 * line] + |
1036 | | iT[9 * 64 + k] * src[9 * line] + iT[11 * 64 + k] * src[11 * line] + iT[13 * 64 + k] * src[13 * line] + iT[15 * 64 + k] * src[15 * line] + |
1037 | | iT[17 * 64 + k] * src[17 * line] + iT[19 * 64 + k] * src[19 * line] + iT[21 * 64 + k] * src[21 * line] + iT[23 * 64 + k] * src[23 * line] + |
1038 | | iT[25 * 64 + k] * src[25 * line] + iT[27 * 64 + k] * src[27 * line] + iT[29 * 64 + k] * src[29 * line] + iT[31 * 64 + k] * src[31 * line] + |
1039 | | (zo ? 0 : ( |
1040 | | iT[33 * 64 + k] * src[33 * line] + iT[35 * 64 + k] * src[35 * line] + iT[37 * 64 + k] * src[37 * line] + iT[39 * 64 + k] * src[39 * line] + |
1041 | | iT[41 * 64 + k] * src[41 * line] + iT[43 * 64 + k] * src[43 * line] + iT[45 * 64 + k] * src[45 * line] + iT[47 * 64 + k] * src[47 * line] + |
1042 | | iT[49 * 64 + k] * src[49 * line] + iT[51 * 64 + k] * src[51 * line] + iT[53 * 64 + k] * src[53 * line] + iT[55 * 64 + k] * src[55 * line] + |
1043 | | iT[57 * 64 + k] * src[57 * line] + iT[59 * 64 + k] * src[59 * line] + iT[61 * 64 + k] * src[61 * line] + iT[63 * 64 + k] * src[63 * line])); |
1044 | | } |
1045 | | for (k = 0;k<16;k++) |
1046 | | { |
1047 | | EO[k] = iT[2 * 64 + k] * src[2 * line] + iT[6 * 64 + k] * src[6 * line] + iT[10 * 64 + k] * src[10 * line] + iT[14 * 64 + k] * src[14 * line] + |
1048 | | iT[18 * 64 + k] * src[18 * line] + iT[22 * 64 + k] * src[22 * line] + iT[26 * 64 + k] * src[26 * line] + iT[30 * 64 + k] * src[30 * line] + |
1049 | | (zo ? 0 : ( |
1050 | | iT[34 * 64 + k] * src[34 * line] + iT[38 * 64 + k] * src[38 * line] + iT[42 * 64 + k] * src[42 * line] + iT[46 * 64 + k] * src[46 * line] + |
1051 | | iT[50 * 64 + k] * src[50 * line] + iT[54 * 64 + k] * src[54 * line] + iT[58 * 64 + k] * src[58 * line] + iT[62 * 64 + k] * src[62 * line])); |
1052 | | } |
1053 | | for (k = 0;k<8;k++) |
1054 | | { |
1055 | | EEO[k] = iT[4 * 64 + k] * src[4 * line] + iT[12 * 64 + k] * src[12 * line] + iT[20 * 64 + k] * src[20 * line] + iT[28 * 64 + k] * src[28 * line] + |
1056 | | (zo ? 0 : ( |
1057 | | iT[36 * 64 + k] * src[36 * line] + iT[44 * 64 + k] * src[44 * line] + iT[52 * 64 + k] * src[52 * line] + iT[60 * 64 + k] * src[60 * line])); |
1058 | | } |
1059 | | for (k = 0;k<4;k++) |
1060 | | { |
1061 | | EEEO[k] = iT[8 * 64 + k] * src[8 * line] + iT[24 * 64 + k] * src[24 * line] + (zo ? 0 : (iT[40 * 64 + k] * src[40 * line] + iT[56 * 64 + k] * src[56 * line])); |
1062 | | } |
1063 | | EEEEO[0] = iT[16 * 64 + 0] * src[16 * line] + (zo ? 0 : iT[48 * 64 + 0] * src[48 * line]); |
1064 | | EEEEO[1] = iT[16 * 64 + 1] * src[16 * line] + (zo ? 0 : iT[48 * 64 + 1] * src[48 * line]); |
1065 | | EEEEE[0] = iT[0 * 64 + 0] * src[0] + (zo ? 0 : iT[32 * 64 + 0] * src[32 * line]); |
1066 | | EEEEE[1] = iT[0 * 64 + 1] * src[0] + (zo ? 0 : iT[32 * 64 + 1] * src[32 * line]); |
1067 | | |
1068 | | /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ |
1069 | | for (k = 0;k<2;k++) |
1070 | | { |
1071 | | EEEE[k] = EEEEE[k] + EEEEO[k]; |
1072 | | EEEE[k + 2] = EEEEE[1 - k] - EEEEO[1 - k]; |
1073 | | } |
1074 | | for (k = 0;k<4;k++) |
1075 | | { |
1076 | | EEE[k] = EEEE[k] + EEEO[k]; |
1077 | | EEE[k + 4] = EEEE[3 - k] - EEEO[3 - k]; |
1078 | | } |
1079 | | for (k = 0;k<8;k++) |
1080 | | { |
1081 | | EE[k] = EEE[k] + EEO[k]; |
1082 | | EE[k + 8] = EEE[7 - k] - EEO[7 - k]; |
1083 | | } |
1084 | | for (k = 0;k<16;k++) |
1085 | | { |
1086 | | E[k] = EE[k] + EO[k]; |
1087 | | E[k + 16] = EE[15 - k] - EO[15 - k]; |
1088 | | } |
1089 | | for (k = 0;k<32;k++) |
1090 | | { |
1091 | | #if ENABLE_SIMD_TRAFO |
1092 | | dst[k] = E[k] + O[k]; |
1093 | | dst[k + 32] = E[31 - k] - O[31 - k]; |
1094 | | #else |
1095 | | dst[k] = Clip3( outputMinimum, outputMaximum, ( E[k] + O[k] + rnd_factor ) >> shift ); |
1096 | | dst[k + 32] = Clip3( outputMinimum, outputMaximum, ( E[31 - k] - O[31 - k] + rnd_factor ) >> shift ); |
1097 | | #endif |
1098 | | } |
1099 | | src++; |
1100 | | dst += uiTrSize; |
1101 | | } |
1102 | | |
1103 | | #if ENABLE_SIMD_TRAFO |
1104 | | g_tCoeffOps.roundClip8( orgDst, 32, line - iSkipLine, 32, outputMinimum, outputMaximum, rnd_factor, shift ); |
1105 | | |
1106 | | |
1107 | | #endif |
1108 | | memset( dst, 0, uiTrSize*iSkipLine * sizeof( TCoeff ) ); |
1109 | | #endif |
1110 | 26.8k | } |
1111 | | |
1112 | | |
1113 | | |
1114 | | // ********************************** DST-VII ********************************** |
1115 | | static void fastForwardDST7_B4_Core(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1116 | 5.05k | { |
1117 | 5.05k | int i; |
1118 | 5.05k | TCoeff rnd_factor = (shift > 0) ? (1 << (shift - 1)) : 0; |
1119 | | |
1120 | 5.05k | const TMatrixCoeff *iT = g_trCoreDST7P4[TRANSFORM_FORWARD][0]; |
1121 | | |
1122 | 5.05k | int c[4]; |
1123 | 5.05k | TCoeff *pCoeff = dst; |
1124 | 5.05k | const int reducedLine = line - iSkipLine; |
1125 | 109k | for (i = 0; i<reducedLine; i++) |
1126 | 103k | { |
1127 | | // Intermediate Variables |
1128 | 103k | c[0] = src[0] + src[3]; |
1129 | 103k | c[1] = src[1] + src[3]; |
1130 | 103k | c[2] = src[0] - src[1]; |
1131 | 103k | c[3] = iT[2] * src[2]; |
1132 | | |
1133 | 103k | dst[0 * line] = (iT[0] * c[0] + iT[1] * c[1] + c[3] + rnd_factor) >> shift; |
1134 | 103k | dst[1 * line] = (iT[2] * (src[0] + src[1] - src[3]) + rnd_factor) >> shift; |
1135 | 103k | dst[2 * line] = (iT[0] * c[2] + iT[1] * c[0] - c[3] + rnd_factor) >> shift; |
1136 | 103k | dst[3 * line] = (iT[1] * c[2] - iT[0] * c[1] + c[3] + rnd_factor) >> shift; |
1137 | | |
1138 | 103k | src += 4; |
1139 | 103k | dst++; |
1140 | 103k | } |
1141 | 5.05k | if (iSkipLine) |
1142 | 0 | { |
1143 | 0 | dst = pCoeff + reducedLine; |
1144 | 0 | for (i = 0; i<4; i++) |
1145 | 0 | { |
1146 | 0 | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
1147 | 0 | dst += line; |
1148 | 0 | } |
1149 | 0 | } |
1150 | 5.05k | } |
1151 | | |
1152 | | void fastForwardDST7_B4( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2 ) |
1153 | 5.05k | { |
1154 | 5.05k | #if ENABLE_SIMD_TRAFO |
1155 | 5.05k | g_tCoeffOps.fastFwdDST7_4( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
1156 | | #else |
1157 | | fastForwardDST7_B4_Core( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
1158 | | #endif |
1159 | 5.05k | } |
1160 | | |
1161 | | void fastInverseDST7_B4(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1162 | 2.02k | { |
1163 | 2.02k | #if ENABLE_SIMD_TRAFO |
1164 | 2.02k | _fastInverseMM<4>( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDST7P4[TRANSFORM_INVERSE][0] ); |
1165 | | #else |
1166 | | int i; |
1167 | | TCoeff c[4]; |
1168 | | TCoeff rnd_factor = (shift > 0) ? (1 << (shift - 1)) : 0; |
1169 | | |
1170 | | const TMatrixCoeff *iT = g_trCoreDST7P4[TRANSFORM_INVERSE][0]; |
1171 | | |
1172 | | const int reducedLine = line - iSkipLine; |
1173 | | for (i = 0; i<reducedLine; i++) |
1174 | | { |
1175 | | // Intermediate Variables |
1176 | | c[0] = src[0 * line] + src[2 * line]; |
1177 | | c[1] = src[2 * line] + src[3 * line]; |
1178 | | c[2] = src[0 * line] - src[3 * line]; |
1179 | | c[3] = iT[2] * src[1 * line]; |
1180 | | |
1181 | | dst[0] = Clip3(outputMinimum, outputMaximum, (iT[0] * c[0] + iT[1] * c[1] + c[3] + rnd_factor) >> shift); |
1182 | | dst[1] = Clip3(outputMinimum, outputMaximum, (iT[1] * c[2] - iT[0] * c[1] + c[3] + rnd_factor) >> shift); |
1183 | | dst[2] = Clip3(outputMinimum, outputMaximum, (iT[2] * (src[0 * line] - src[2 * line] + src[3 * line]) + rnd_factor) >> shift); |
1184 | | dst[3] = Clip3(outputMinimum, outputMaximum, (iT[1] * c[0] + iT[0] * c[2] - c[3] + rnd_factor) >> shift); |
1185 | | |
1186 | | dst += 4; |
1187 | | src++; |
1188 | | } |
1189 | | if (iSkipLine) |
1190 | | { |
1191 | | memset(dst, 0, (iSkipLine << 2) * sizeof(TCoeff)); |
1192 | | } |
1193 | | #endif |
1194 | 2.02k | } |
1195 | | |
1196 | | |
1197 | | void fastForwardDST7_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1198 | 32.5k | { |
1199 | 32.5k | _fastForwardMM< 8 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDST7P8[TRANSFORM_FORWARD][0] ); |
1200 | 32.5k | } |
1201 | | |
1202 | | |
1203 | | void fastInverseDST7_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1204 | 1.28k | { |
1205 | 1.28k | _fastInverseMM< 8 >( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDST7P8[TRANSFORM_INVERSE][0]); |
1206 | 1.28k | } |
1207 | | |
1208 | | |
1209 | | void fastForwardDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1210 | 42.8k | { |
1211 | | #if !JVET_M0497_MATRIX_MULT |
1212 | | int j, k; |
1213 | | TCoeff a[5], b[5], c[5], d[5], t; |
1214 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1215 | | |
1216 | | const TMatrixCoeff *iT = g_trCoreDST7P16[TRANSFORM_FORWARD][0]; |
1217 | | |
1218 | | TCoeff *pCoef = dst; |
1219 | | const int reducedLine = line - iSkipLine; |
1220 | | const int cutoff = 16 - iSkipLine2; |
1221 | | |
1222 | | for (j = 0; j < reducedLine; j++) |
1223 | | { |
1224 | | for (k = 0; k < 5; k++) |
1225 | | { |
1226 | | a[k] = src[ k] + src[11 + k]; |
1227 | | b[k] = src[9 - k] + src[11 + k]; |
1228 | | c[k] = src[ k] - src[ 9 - k]; |
1229 | | d[k] = src[ k] + src[ 9 - k] - src[11 + k]; |
1230 | | } |
1231 | | |
1232 | | t = iT[10] * src[10]; |
1233 | | |
1234 | | dst[ 1 * line] = ( iT[ 2]*d[0] + iT[ 5]*d[1] + iT[ 8]*d[2] + iT[11]*d[3] + iT[14]*d[4] + add) >> shift; |
1235 | | dst[ 4 * line] = ( iT[ 8]*d[0] + iT[14]*d[1] + iT[ 5]*d[2] - iT[ 2]*d[3] - iT[11]*d[4] + add) >> shift; |
1236 | | dst[ 7 * line] = ( iT[14]*d[0] + iT[ 2]*d[1] - iT[11]*d[2] - iT[ 5]*d[3] + iT[ 8]*d[4] + add) >> shift; |
1237 | | dst[10 * line] = ( iT[11]*d[0] - iT[ 8]*d[1] - iT[ 2]*d[2] + iT[14]*d[3] - iT[ 5]*d[4] + add) >> shift; |
1238 | | dst[13 * line] = ( iT[ 5]*d[0] - iT[11]*d[1] + iT[14]*d[2] - iT[ 8]*d[3] + iT[ 2]*d[4] + add) >> shift; |
1239 | | |
1240 | | dst[5 * line] = ( iT[10] * (src[0] + src[1] - src[3] - src[4] + src[6] + src[7] - src[9] - src[10] + src[12] + src[13] - src[15]) + add) >> shift; |
1241 | | |
1242 | | dst[ 0 * line] = ( iT[0]*a[0] + iT[9]*b[0] + iT[1]*a[1] + iT[8]*b[1] + iT[2]*a[2] + iT[7]*b[2] + iT[3]*a[3] + iT[6]*b[3] + iT[4]*a[4] + iT[5]*b[4] + t + add ) >> shift; |
1243 | | dst[ 2 * line] = ( iT[4]*c[0] - iT[5]*b[0] + iT[9]*c[1] - iT[0]*b[1] + iT[6]*c[2] + iT[3]*a[2] + iT[1]*c[3] + iT[8]*a[3] + iT[7]*a[4] + iT[2]*b[4] - t + add ) >> shift; |
1244 | | dst[ 3 * line] = ( iT[6]*a[0] + iT[3]*b[0] + iT[2]*c[1] + iT[7]*a[1] + iT[9]*c[2] + iT[0]*a[2] + iT[4]*c[3] - iT[5]*b[3] - iT[1]*a[4] - iT[8]*b[4] + t + add ) >> shift; |
1245 | | dst[ 6 * line] = ( iT[8]*a[0] + iT[1]*c[0] + iT[6]*c[1] - iT[3]*b[1] - iT[5]*a[2] - iT[4]*b[2] - iT[7]*c[3] - iT[2]*a[3] - iT[0]*c[4] + iT[9]*b[4] + t + add ) >> shift; |
1246 | | dst[ 8 * line] = ( iT[4]*c[0] + iT[5]*a[0] - iT[0]*c[1] + iT[9]*b[1] - iT[3]*c[2] - iT[6]*a[2] + iT[1]*c[3] - iT[8]*b[3] + iT[2]*c[4] + iT[7]*a[4] - t + add ) >> shift; |
1247 | | dst[ 9 * line] = ( iT[7]*c[0] + iT[2]*a[0] - iT[4]*a[1] - iT[5]*b[1] - iT[8]*c[2] + iT[1]*b[2] + iT[9]*a[3] + iT[0]*b[3] + iT[3]*c[4] - iT[6]*b[4] + t + add ) >> shift; |
1248 | | dst[11 * line] = ( iT[9]*a[0] + iT[0]*b[0] - iT[8]*c[1] - iT[1]*a[1] + iT[2]*c[2] - iT[7]*b[2] + iT[6]*a[3] + iT[3]*b[3] - iT[5]*c[4] - iT[4]*a[4] - t + add ) >> shift; |
1249 | | dst[12 * line] = ( iT[7]*c[0] - iT[2]*b[0] - iT[5]*c[1] - iT[4]*a[1] + iT[8]*a[2] + iT[1]*b[2] - iT[0]*a[3] - iT[9]*b[3] - iT[6]*c[4] + iT[3]*b[4] + t + add ) >> shift; |
1250 | | dst[14 * line] = ( iT[3]*a[0] + iT[6]*b[0] - iT[7]*a[1] - iT[2]*b[1] + iT[0]*c[2] + iT[9]*a[2] - iT[4]*c[3] - iT[5]*a[3] + iT[8]*c[4] + iT[1]*a[4] - t + add ) >> shift; |
1251 | | dst[15 * line] = ( iT[1]*c[0] - iT[8]*b[0] - iT[3]*c[1] + iT[6]*b[1] + iT[5]*c[2] - iT[4]*b[2] - iT[7]*c[3] + iT[2]*b[3] + iT[9]*c[4] - iT[0]*b[4] + t + add ) >> shift; |
1252 | | |
1253 | | src += 16; |
1254 | | dst++; |
1255 | | } |
1256 | | |
1257 | | if (iSkipLine) |
1258 | | { |
1259 | | dst = pCoef + reducedLine; |
1260 | | for (j = 0; j < cutoff; j++) |
1261 | | { |
1262 | | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
1263 | | dst += line; |
1264 | | } |
1265 | | } |
1266 | | |
1267 | | if (iSkipLine2) |
1268 | | { |
1269 | | dst = pCoef + line * cutoff; |
1270 | | memset(dst, 0, sizeof(TCoeff) * line * iSkipLine2); |
1271 | | } |
1272 | | #else |
1273 | 42.8k | _fastForwardMM< 16 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDST7P16[TRANSFORM_FORWARD][0] ); |
1274 | 42.8k | #endif |
1275 | 42.8k | } |
1276 | | |
1277 | | |
1278 | | void fastInverseDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1279 | 6.37k | { |
1280 | | #if !JVET_M0497_MATRIX_MULT |
1281 | | int j, k; |
1282 | | TCoeff a[5], b[5], c[5], d[5], t; |
1283 | | |
1284 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1285 | | |
1286 | | const TMatrixCoeff *iT = g_trCoreDST7P16[TRANSFORM_INVERSE][0]; |
1287 | | |
1288 | | const int reducedLine = line - iSkipLine; |
1289 | | |
1290 | | for (j = 0; j < reducedLine; j++) |
1291 | | { |
1292 | | for (k = 0; k < 5; k++) |
1293 | | { |
1294 | | a[k] = src[ k * line] + src[(10 - k) * line]; |
1295 | | b[k] = src[(11 + k) * line] + src[(10 - k) * line]; |
1296 | | c[k] = src[ k * line] - src[(11 + k) * line]; |
1297 | | d[k] = src[ k * line] + src[(11 + k) * line] - src[(10 - k)*line]; |
1298 | | } |
1299 | | |
1300 | | t = iT[10] * src[5 * line]; |
1301 | | |
1302 | | dst[ 2] = Clip3(outputMinimum, outputMaximum, (int)( iT[ 2]*d[0] + iT[ 8]*d[1] + iT[14]*d[2] + iT[11]*d[3] + iT[ 5]*d[4] + add ) >> shift); |
1303 | | dst[ 5] = Clip3(outputMinimum, outputMaximum, (int)( iT[ 5]*d[0] + iT[14]*d[1] + iT[ 2]*d[2] - iT[ 8]*d[3] - iT[11]*d[4] + add ) >> shift); |
1304 | | dst[ 8] = Clip3(outputMinimum, outputMaximum, (int)( iT[ 8]*d[0] + iT[ 5]*d[1] - iT[11]*d[2] - iT[ 2]*d[3] + iT[14]*d[4] + add ) >> shift); |
1305 | | dst[11] = Clip3(outputMinimum, outputMaximum, (int)( iT[11]*d[0] - iT[ 2]*d[1] - iT[ 5]*d[2] + iT[14]*d[3] - iT[ 8]*d[4] + add ) >> shift); |
1306 | | dst[14] = Clip3(outputMinimum, outputMaximum, (int)( iT[14]*d[0] - iT[11]*d[1] + iT[ 8]*d[2] - iT[ 5]*d[3] + iT[ 2]*d[4] + add ) >> shift); |
1307 | | |
1308 | | dst[10] = Clip3(outputMinimum, outputMaximum, (int)( iT[10]*(src[ 0*line]-src[ 2*line]+src[ 3*line]-src[5*line] |
1309 | | +src[ 6*line]-src[ 8*line]+src[ 9*line]-src[11*line] |
1310 | | +src[12*line]-src[14*line]+src[15*line]) + add ) >> shift); |
1311 | | |
1312 | | dst[ 0] = Clip3(outputMinimum, outputMaximum, (int)( iT[0]*a[0] + iT[9]*b[0] + iT[2]*a[1] + iT[7]*b[1] + iT[4]*a[2] + iT[5]*b[2] + iT[6]*a[3] + iT[3]*b[3] + iT[8]*a[4] + iT[1]*b[4] + t + add ) >> shift); |
1313 | | dst[ 1] = Clip3(outputMinimum, outputMaximum, (int)( iT[1]*c[0] - iT[8]*b[0] + iT[5]*c[1] - iT[4]*b[1] + iT[9]*c[2] - iT[0]*b[2] + iT[2]*a[3] + iT[7]*c[3] + iT[6]*a[4] + iT[3]*c[4] + t + add ) >> shift); |
1314 | | dst[ 3] = Clip3(outputMinimum, outputMaximum, (int)( iT[3]*a[0] + iT[6]*b[0] + iT[0]*c[1] + iT[9]*a[1] + iT[1]*a[2] + iT[8]*c[2] + iT[4]*c[3] - iT[5]*b[3] - iT[2]*a[4] - iT[7]*b[4] - t + add ) >> shift); |
1315 | | dst[ 4] = Clip3(outputMinimum, outputMaximum, (int)( iT[4]*c[0] - iT[5]*b[0] + iT[6]*c[1] + iT[3]*a[1] + iT[7]*a[2] + iT[2]*b[2] - iT[1]*c[3] + iT[8]*b[3] - iT[9]*c[4] - iT[0]*a[4] - t + add ) >> shift); |
1316 | | dst[ 6] = Clip3(outputMinimum, outputMaximum, (int)( iT[6]*a[0] + iT[3]*b[0] + iT[9]*c[1] + iT[0]*a[1] - iT[1]*a[2] - iT[8]*b[2] - iT[4]*c[3] - iT[5]*a[3] - iT[2]*c[4] + iT[7]*b[4] + t + add ) >> shift); |
1317 | | dst[ 7] = Clip3(outputMinimum, outputMaximum, (int)( iT[7]*c[0] - iT[2]*b[0] + iT[8]*a[1] + iT[1]*b[1] - iT[6]*c[2] + iT[3]*b[2] - iT[9]*a[3] - iT[0]*b[3] + iT[5]*c[4] - iT[4]*b[4] + t + add ) >> shift); |
1318 | | dst[ 9] = Clip3(outputMinimum, outputMaximum, (int)( iT[9]*a[0] + iT[0]*b[0] + iT[2]*c[1] - iT[7]*b[1] - iT[5]*c[2] - iT[4]*a[2] + iT[3]*a[3] + iT[6]*b[3] + iT[8]*c[4] - iT[1]*b[4] - t + add ) >> shift); |
1319 | | dst[12] = Clip3(outputMinimum, outputMaximum, (int)( iT[1]*c[0] + iT[8]*a[0] - iT[5]*a[1] - iT[4]*b[1] - iT[0]*c[2] + iT[9]*b[2] + iT[7]*c[3] - iT[2]*b[3] - iT[6]*c[4] - iT[3]*a[4] + t + add ) >> shift); |
1320 | | dst[13] = Clip3(outputMinimum, outputMaximum, (int)( iT[7]*c[0] + iT[2]*a[0] - iT[8]*c[1] + iT[1]*b[1] + iT[3]*c[2] - iT[6]*b[2] + iT[0]*a[3] + iT[9]*b[3] - iT[5]*a[4] - iT[4]*b[4] + t + add ) >> shift); |
1321 | | dst[15] = Clip3(outputMinimum, outputMaximum, (int)( iT[4]*c[0] + iT[5]*a[0] - iT[3]*c[1] - iT[6]*a[1] + iT[2]*c[2] + iT[7]*a[2] - iT[1]*c[3] - iT[8]*a[3] + iT[0]*c[4] + iT[9]*a[4] - t + add ) >> shift); |
1322 | | |
1323 | | src++; |
1324 | | dst += 16; |
1325 | | } |
1326 | | |
1327 | | if (iSkipLine) |
1328 | | { |
1329 | | memset(dst, 0, (iSkipLine * 16) * sizeof(TCoeff)); |
1330 | | } |
1331 | | #else |
1332 | 6.37k | _fastInverseMM< 16 >( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDST7P16[TRANSFORM_INVERSE][0]); |
1333 | 6.37k | #endif |
1334 | 6.37k | } |
1335 | | |
1336 | | |
1337 | | void fastForwardDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1338 | 0 | { |
1339 | | #if !JVET_M0497_MATRIX_MULT |
1340 | | int j, k; |
1341 | | TCoeff a[10][6]; |
1342 | | TCoeff t[2]; |
1343 | | TCoeff b[6]; |
1344 | | TCoeff c[2]; |
1345 | | |
1346 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1347 | | const TMatrixCoeff *iT = g_trCoreDST7P32[TRANSFORM_FORWARD][0]; |
1348 | | TCoeff *pCoef = dst; |
1349 | | const int reducedLine = line - iSkipLine; |
1350 | | const int cutoff = 32 - iSkipLine2; |
1351 | | |
1352 | | for (j = 0; j < reducedLine; j++) |
1353 | | { |
1354 | | for (k = 0; k < 6; k++) |
1355 | | { |
1356 | | a[0][k] = src[ k] - src[11 - k]; |
1357 | | a[1][k] = src[ k] + src[13 + k]; |
1358 | | a[2][k] = src[ k] + src[24 - k]; |
1359 | | a[3][k] = src[ k] - src[26 + k]; |
1360 | | a[4][k] = src[ 6 + k] + src[18 - k]; |
1361 | | a[5][k] = src[ 6 + k] + src[19 + k]; |
1362 | | a[6][k] = src[ 6 + k] - src[31 - k]; |
1363 | | a[7][k] = src[13 + k] - src[24 - k]; |
1364 | | a[8][k] = src[13 + k] + src[26 + k]; |
1365 | | a[9][k] = src[19 + k] + src[31 - k]; |
1366 | | |
1367 | | b[k] = src[k] + src[11 - k] - src[13 + k] - src[24 - k] + src[26 + k]; |
1368 | | } |
1369 | | for (k = 0; k < 2; k++) |
1370 | | { |
1371 | | c[k] = src[k] + src[3 - k] - src[5 + k] - src[8 - k] + src[10 + k] + src[13 - k] - src[15 + k] - src[18 - k] + src[20 + k] + src[23 - k] - src[25 + k] - src[28 - k] + src[30 + k]; |
1372 | | } |
1373 | | |
1374 | | t[0] = iT[12] * src[12] + iT[25] * src[25]; |
1375 | | t[1] = iT[12] * src[25] - iT[25] * src[12]; |
1376 | | |
1377 | | dst[ 0 * line] = ( iT[0] * a[3][0] + iT[11] * a[6][5] + iT[13] * a[8][0] + iT[24] * a[9][5] + iT[1] * a[3][1] + iT[10] * a[6][4] + iT[14] * a[8][1] + iT[23] * a[9][4] + iT[2] * a[3][2] + iT[9] * a[6][3] + iT[15] * a[8][2] + iT[22] * a[9][3] + iT[3] * a[3][3] + iT[8] * a[6][2] + iT[16] * a[8][3] + iT[21] * a[9][2] + iT[4] * a[3][4] + iT[7] * a[6][1] + iT[17] * a[8][4] + iT[20] * a[9][1] + iT[5] * a[3][5] + iT[6] * a[6][0] + iT[18] * a[8][5] + iT[19] * a[9][0] + t[0] + add) >> shift; |
1378 | | dst[ 1 * line] = (-iT[0] * a[5][2] + iT[11] * a[0][3] + iT[13] * a[4][2] + iT[24] * a[6][2] + iT[1] * a[9][1] + iT[10] * a[8][4] + iT[14] * a[3][4] + iT[23] * a[6][1] + iT[2] * a[0][0] - iT[9] * a[5][5] + iT[15] * a[6][5] + iT[22] * a[4][5] - iT[3] * a[5][3] + iT[8] * a[0][2] + iT[16] * a[4][3] + iT[21] * a[6][3] + iT[4] * a[9][0] + iT[7] * a[8][5] + iT[17] * a[3][5] + iT[20] * a[6][0] + iT[5] * a[0][1] - iT[6] * a[5][4] + iT[18] * a[6][4] + iT[19] * a[4][4] - t[1] + add) >> shift; |
1379 | | dst[ 3 * line] = (-iT[0] * a[9][4] - iT[11] * a[5][4] + iT[13] * a[2][1] - iT[24] * a[7][1] - iT[1] * a[0][3] - iT[10] * a[1][3] + iT[14] * a[3][3] + iT[23] * a[2][3] + iT[2] * a[8][5] + iT[9] * a[9][0] + iT[15] * a[6][0] + iT[22] * a[3][5] - iT[3] * a[1][4] - iT[8] * a[0][4] + iT[16] * a[2][4] + iT[21] * a[3][4] - iT[4] * a[5][3] - iT[7] * a[9][3] - iT[17] * a[7][2] + iT[20] * a[2][2] + iT[5] * a[8][0] + iT[6] * a[1][0] - iT[18] * a[4][5] - iT[19] * a[7][0] + t[1] + add) >> shift; |
1380 | | dst[ 4 * line] = (-iT[0] * a[3][2] - iT[11] * a[2][2] + iT[13] * a[1][2] + iT[24] * a[0][2] + iT[1] * a[6][0] + iT[10] * a[3][5] + iT[14] * a[9][0] + iT[23] * a[8][5] - iT[2] * a[2][3] - iT[9] * a[3][3] + iT[15] * a[0][3] + iT[22] * a[1][3] - iT[3] * a[7][0] + iT[8] * a[2][0] - iT[16] * a[9][5] - iT[21] * a[5][5] + iT[4] * a[4][4] + iT[7] * a[6][4] + iT[17] * a[0][1] - iT[20] * a[5][4] - iT[5] * a[7][4] - iT[6] * a[4][1] + iT[18] * a[8][4] + iT[19] * a[1][4] - t[0] + add) >> shift; |
1381 | | dst[ 5 * line] = (-iT[0] * a[3][5] - iT[11] * a[6][0] - iT[13] * a[8][5] - iT[24] * a[9][0] + iT[1] * a[6][5] + iT[10] * a[3][0] + iT[14] * a[9][5] + iT[23] * a[8][0] - iT[2] * a[7][4] + iT[9] * a[2][4] - iT[15] * a[9][1] - iT[22] * a[5][1] - iT[3] * a[7][1] - iT[8] * a[4][4] + iT[16] * a[8][1] + iT[21] * a[1][1] + iT[4] * a[6][2] + iT[7] * a[4][2] - iT[17] * a[5][2] + iT[20] * a[0][3] - iT[5] * a[3][2] - iT[6] * a[2][2] + iT[18] * a[1][2] + iT[19] * a[0][2] + t[0] + add) >> shift; |
1382 | | dst[ 8 * line] = ( iT[0] * a[9][3] + iT[11] * a[8][2] + iT[13] * a[3][2] + iT[24] * a[6][3] + iT[1] * a[1][5] + iT[10] * a[0][5] - iT[14] * a[2][5] - iT[23] * a[3][5] - iT[2] * a[1][3] - iT[9] * a[8][3] + iT[15] * a[7][3] + iT[22] * a[4][2] - iT[3] * a[9][5] - iT[8] * a[5][5] + iT[16] * a[2][0] - iT[21] * a[7][0] - iT[4] * a[1][1] - iT[7] * a[0][1] + iT[17] * a[2][1] + iT[20] * a[3][1] + iT[5] * a[5][1] + iT[6] * a[9][1] + iT[18] * a[7][4] - iT[19] * a[2][4] + t[1] + add) >> shift; |
1383 | | dst[ 9 * line] = (-iT[0] * a[2][1] - iT[11] * a[3][1] + iT[13] * a[0][1] + iT[24] * a[1][1] + iT[1] * a[7][3] - iT[10] * a[2][3] + iT[14] * a[9][2] + iT[23] * a[5][2] + iT[2] * a[4][0] + iT[9] * a[7][5] - iT[15] * a[1][5] - iT[22] * a[8][5] + iT[3] * a[3][4] + iT[8] * a[2][4] - iT[16] * a[1][4] - iT[21] * a[0][4] + iT[4] * a[6][3] + iT[7] * a[3][2] + iT[17] * a[9][3] + iT[20] * a[8][2] + iT[5] * a[4][5] + iT[6] * a[6][5] + iT[18] * a[0][0] - iT[19] * a[5][5] - t[0] + add) >> shift; |
1384 | | dst[10 * line] = (-iT[0] * a[6][1] - iT[11] * a[4][1] + iT[13] * a[5][1] - iT[24] * a[0][4] + iT[1] * a[2][2] - iT[10] * a[7][2] - iT[14] * a[5][3] - iT[23] * a[9][3] + iT[2] * a[6][4] + iT[9] * a[4][4] - iT[15] * a[5][4] + iT[22] * a[0][1] - iT[3] * a[2][5] + iT[8] * a[7][5] + iT[16] * a[5][0] + iT[21] * a[9][0] - iT[4] * a[7][0] - iT[7] * a[4][5] + iT[17] * a[8][0] + iT[20] * a[1][0] + iT[5] * a[4][2] + iT[6] * a[7][3] - iT[18] * a[1][3] - iT[19] * a[8][3] + t[0] + add) >> shift; |
1385 | | dst[11 * line] = ( iT[0] * a[1][3] + iT[11] * a[0][3] - iT[13] * a[2][3] - iT[24] * a[3][3] + iT[1] * a[9][1] + iT[10] * a[5][1] - iT[14] * a[2][4] + iT[23] * a[7][4] + iT[2] * a[8][0] + iT[9] * a[9][5] + iT[15] * a[6][5] + iT[22] * a[3][0] - iT[3] * a[0][2] + iT[8] * a[5][3] - iT[16] * a[6][3] - iT[21] * a[4][3] - iT[4] * a[5][0] + iT[7] * a[0][5] + iT[17] * a[4][0] + iT[20] * a[6][0] - iT[5] * a[9][4] - iT[6] * a[5][4] + iT[18] * a[2][1] - iT[19] * a[7][1] - t[1] + add) >> shift; |
1386 | | dst[13 * line] = (-iT[0] * a[0][0] - iT[11] * a[1][0] + iT[13] * a[3][0] + iT[24] * a[2][0] - iT[1] * a[5][4] + iT[10] * a[0][1] + iT[14] * a[4][4] + iT[23] * a[6][4] + iT[2] * a[9][3] + iT[9] * a[5][3] - iT[15] * a[2][2] + iT[22] * a[7][2] - iT[3] * a[8][3] - iT[8] * a[9][2] - iT[16] * a[6][2] - iT[21] * a[3][3] + iT[4] * a[1][4] + iT[7] * a[8][4] - iT[17] * a[7][4] - iT[20] * a[4][1] - iT[5] * a[0][5] - iT[6] * a[1][5] + iT[18] * a[3][5] + iT[19] * a[2][5] + t[1] + add) >> shift; |
1387 | | dst[14 * line] = ( iT[0] * a[4][2] + iT[11] * a[7][3] - iT[13] * a[1][3] - iT[24] * a[8][3] + iT[1] * a[4][1] + iT[10] * a[6][1] + iT[14] * a[0][4] - iT[23] * a[5][1] - iT[2] * a[3][0] - iT[9] * a[2][0] + iT[15] * a[1][0] + iT[22] * a[0][0] - iT[3] * a[6][3] - iT[8] * a[4][3] + iT[16] * a[5][3] - iT[21] * a[0][2] - iT[4] * a[7][5] - iT[7] * a[4][0] + iT[17] * a[8][5] + iT[20] * a[1][5] + iT[5] * a[6][4] + iT[6] * a[3][1] + iT[18] * a[9][4] + iT[19] * a[8][1] - t[0] + add) >> shift; |
1388 | | dst[15 * line] = (-iT[0] * a[7][4] - iT[11] * a[4][1] + iT[13] * a[8][4] + iT[24] * a[1][4] + iT[1] * a[2][2] + iT[10] * a[3][2] - iT[14] * a[0][2] - iT[23] * a[1][2] + iT[2] * a[2][1] - iT[9] * a[7][1] - iT[15] * a[5][4] - iT[22] * a[9][4] - iT[3] * a[7][5] + iT[8] * a[2][5] - iT[16] * a[9][0] - iT[21] * a[5][0] - iT[4] * a[2][0] - iT[7] * a[3][0] + iT[17] * a[0][0] + iT[20] * a[1][0] - iT[5] * a[2][3] + iT[6] * a[7][3] + iT[18] * a[5][2] + iT[19] * a[9][2] + t[0] + add) >> shift; |
1389 | | dst[16 * line] = (-iT[0] * a[0][1] + iT[11] * a[5][4] - iT[13] * a[6][4] - iT[24] * a[4][4] + iT[1] * a[0][3] - iT[10] * a[5][2] + iT[14] * a[6][2] + iT[23] * a[4][2] - iT[2] * a[0][5] + iT[9] * a[5][0] - iT[15] * a[6][0] - iT[22] * a[4][0] - iT[3] * a[0][4] - iT[8] * a[1][4] + iT[16] * a[3][4] + iT[21] * a[2][4] + iT[4] * a[0][2] + iT[7] * a[1][2] - iT[17] * a[3][2] - iT[20] * a[2][2] - iT[5] * a[0][0] - iT[6] * a[1][0] + iT[18] * a[3][0] + iT[19] * a[2][0] - t[1] + add) >> shift; |
1390 | | dst[18 * line] = ( iT[0] * a[0][5] + iT[11] * a[1][5] - iT[13] * a[3][5] - iT[24] * a[2][5] - iT[1] * a[1][0] - iT[10] * a[0][0] + iT[14] * a[2][0] + iT[23] * a[3][0] - iT[2] * a[5][1] + iT[9] * a[0][4] + iT[15] * a[4][1] + iT[22] * a[6][1] - iT[3] * a[8][1] - iT[8] * a[1][1] + iT[16] * a[4][4] + iT[21] * a[7][1] - iT[4] * a[9][2] - iT[7] * a[5][2] + iT[17] * a[2][3] - iT[20] * a[7][3] - iT[5] * a[9][3] - iT[6] * a[8][2] - iT[18] * a[3][2] - iT[19] * a[6][3] + t[1] + add) >> shift; |
1391 | | dst[20 * line] = (-iT[0] * a[4][0] - iT[11] * a[6][0] - iT[13] * a[0][5] + iT[24] * a[5][0] + iT[1] * a[6][5] + iT[10] * a[4][5] - iT[14] * a[5][5] + iT[23] * a[0][0] - iT[2] * a[6][1] - iT[9] * a[3][4] - iT[15] * a[9][1] - iT[22] * a[8][4] + iT[3] * a[4][4] + iT[8] * a[7][1] - iT[16] * a[1][1] - iT[21] * a[8][1] - iT[4] * a[3][3] - iT[7] * a[2][3] + iT[17] * a[1][3] + iT[20] * a[0][3] + iT[5] * a[7][2] - iT[6] * a[2][2] + iT[18] * a[9][3] + iT[19] * a[5][3] + t[0] + add) >> shift; |
1392 | | dst[21 * line] = (-iT[0] * a[1][2] - iT[11] * a[8][2] + iT[13] * a[7][2] + iT[24] * a[4][3] - iT[1] * a[1][5] - iT[10] * a[8][5] + iT[14] * a[7][5] + iT[23] * a[4][0] - iT[2] * a[5][2] - iT[9] * a[9][2] - iT[15] * a[7][3] + iT[22] * a[2][3] - iT[3] * a[5][5] - iT[8] * a[9][5] - iT[16] * a[7][0] + iT[21] * a[2][0] - iT[4] * a[8][1] - iT[7] * a[9][4] - iT[17] * a[6][4] - iT[20] * a[3][1] - iT[5] * a[8][4] - iT[6] * a[9][1] - iT[18] * a[6][1] - iT[19] * a[3][4] - t[1] + add) >> shift; |
1393 | | dst[23 * line] = (-iT[0] * a[8][4] - iT[11] * a[9][1] - iT[13] * a[6][1] - iT[24] * a[3][4] + iT[1] * a[8][2] + iT[10] * a[1][2] - iT[14] * a[4][3] - iT[23] * a[7][2] + iT[2] * a[0][1] + iT[9] * a[1][1] - iT[15] * a[3][1] - iT[22] * a[2][1] - iT[3] * a[5][0] - iT[8] * a[9][0] - iT[16] * a[7][5] + iT[21] * a[2][5] + iT[4] * a[9][5] + iT[7] * a[8][0] + iT[17] * a[3][0] + iT[20] * a[6][5] - iT[5] * a[5][2] + iT[6] * a[0][3] + iT[18] * a[4][2] + iT[19] * a[6][2] + t[1] + add) >> shift; |
1394 | | dst[24 * line] = (-iT[0] * a[2][3] + iT[11] * a[7][3] + iT[13] * a[5][2] + iT[24] * a[9][2] + iT[1] * a[4][1] + iT[10] * a[7][4] - iT[14] * a[1][4] - iT[23] * a[8][4] - iT[2] * a[4][5] - iT[9] * a[7][0] + iT[15] * a[1][0] + iT[22] * a[8][0] + iT[3] * a[4][3] + iT[8] * a[6][3] + iT[16] * a[0][2] - iT[21] * a[5][3] - iT[4] * a[2][5] - iT[7] * a[3][5] + iT[17] * a[0][5] + iT[20] * a[1][5] + iT[5] * a[2][1] + iT[6] * a[3][1] - iT[18] * a[0][1] - iT[19] * a[1][1] - t[0] + add) >> shift; |
1395 | | dst[25 * line] = ( iT[0] * a[4][5] + iT[11] * a[6][5] + iT[13] * a[0][0] - iT[24] * a[5][5] + iT[1] * a[3][1] + iT[10] * a[2][1] - iT[14] * a[1][1] - iT[23] * a[0][1] - iT[2] * a[7][2] - iT[9] * a[4][3] + iT[15] * a[8][2] + iT[22] * a[1][2] - iT[3] * a[6][2] - iT[8] * a[3][3] - iT[16] * a[9][2] - iT[21] * a[8][3] - iT[4] * a[2][4] + iT[7] * a[7][4] + iT[17] * a[5][1] + iT[20] * a[9][1] + iT[5] * a[4][0] + iT[6] * a[6][0] + iT[18] * a[0][5] - iT[19] * a[5][0] + t[0] + add) >> shift; |
1396 | | dst[26 * line] = ( iT[0] * a[8][0] + iT[11] * a[1][0] - iT[13] * a[4][5] - iT[24] * a[7][0] + iT[1] * a[5][4] + iT[10] * a[9][4] + iT[14] * a[7][1] - iT[23] * a[2][1] - iT[2] * a[1][2] - iT[9] * a[0][2] + iT[15] * a[2][2] + iT[22] * a[3][2] - iT[3] * a[9][2] - iT[8] * a[8][3] - iT[16] * a[3][3] - iT[21] * a[6][2] + iT[4] * a[0][4] - iT[7] * a[5][1] + iT[17] * a[6][1] + iT[20] * a[4][1] + iT[5] * a[8][5] + iT[6] * a[1][5] - iT[18] * a[4][0] - iT[19] * a[7][5] - t[1] + add) >> shift; |
1397 | | dst[28 * line] = (-iT[0] * a[5][1] - iT[11] * a[9][1] - iT[13] * a[7][4] + iT[24] * a[2][4] + iT[1] * a[8][2] + iT[10] * a[9][3] + iT[14] * a[6][3] + iT[23] * a[3][2] - iT[2] * a[9][4] - iT[9] * a[8][1] - iT[15] * a[3][1] - iT[22] * a[6][4] + iT[3] * a[9][0] + iT[8] * a[5][0] - iT[16] * a[2][5] + iT[21] * a[7][5] - iT[4] * a[5][5] + iT[7] * a[0][0] + iT[17] * a[4][5] + iT[20] * a[6][5] + iT[5] * a[1][3] + iT[6] * a[0][3] - iT[18] * a[2][3] - iT[19] * a[3][3] + t[1] + add) >> shift; |
1398 | | dst[29 * line] = (-iT[0] * a[6][4] - iT[11] * a[3][1] - iT[13] * a[9][4] - iT[24] * a[8][1] + iT[1] * a[7][3] + iT[10] * a[4][2] - iT[14] * a[8][3] - iT[23] * a[1][3] + iT[2] * a[3][5] + iT[9] * a[2][5] - iT[15] * a[1][5] - iT[22] * a[0][5] - iT[3] * a[2][4] - iT[8] * a[3][4] + iT[16] * a[0][4] + iT[21] * a[1][4] - iT[4] * a[4][3] - iT[7] * a[7][2] + iT[17] * a[1][2] + iT[20] * a[8][2] + iT[5] * a[3][0] + iT[6] * a[6][5] + iT[18] * a[8][0] + iT[19] * a[9][5] - t[0] + add) >> shift; |
1399 | | dst[30 * line] = (-iT[0] * a[7][2] + iT[11] * a[2][2] - iT[13] * a[9][3] - iT[24] * a[5][3] - iT[1] * a[6][0] - iT[10] * a[4][0] + iT[14] * a[5][0] - iT[23] * a[0][5] - iT[2] * a[4][2] - iT[9] * a[6][2] - iT[15] * a[0][3] + iT[22] * a[5][2] + iT[3] * a[2][0] - iT[8] * a[7][0] - iT[16] * a[5][5] - iT[21] * a[9][5] + iT[4] * a[7][1] - iT[7] * a[2][1] + iT[17] * a[9][4] + iT[20] * a[5][4] + iT[5] * a[6][1] + iT[6] * a[4][1] - iT[18] * a[5][1] + iT[19] * a[0][4] + t[0] + add) >> shift; |
1400 | | dst[31 * line] = (-iT[0] * a[8][5] - iT[11] * a[1][5] + iT[13] * a[4][0] + iT[24] * a[7][5] + iT[1] * a[1][0] + iT[10] * a[8][0] - iT[14] * a[7][0] - iT[23] * a[4][5] + iT[2] * a[8][4] + iT[9] * a[1][4] - iT[15] * a[4][1] - iT[22] * a[7][4] - iT[3] * a[1][1] - iT[8] * a[8][1] + iT[16] * a[7][1] + iT[21] * a[4][4] - iT[4] * a[8][3] - iT[7] * a[1][3] + iT[17] * a[4][2] + iT[20] * a[7][3] + iT[5] * a[1][2] + iT[6] * a[8][2] - iT[18] * a[7][2] - iT[19] * a[4][3] - t[1] + add) >> shift; |
1401 | | |
1402 | | dst[ 2 * line] = (iT[ 4]*b[0] + iT[ 9]*b[1] + iT[14]*b[2] + iT[19]*b[3] + iT[24]*b[4] + iT[29]*b[5] + add) >> shift; |
1403 | | dst[ 7 * line] = (iT[14]*b[0] + iT[29]*b[1] + iT[19]*b[2] + iT[ 4]*b[3] - iT[ 9]*b[4] - iT[24]*b[5] + add) >> shift; |
1404 | | dst[12 * line] = (iT[24]*b[0] + iT[14]*b[1] - iT[ 9]*b[2] - iT[29]*b[3] - iT[ 4]*b[4] + iT[19]*b[5] + add) >> shift; |
1405 | | dst[17 * line] = (iT[29]*b[0] - iT[ 4]*b[1] - iT[24]*b[2] + iT[ 9]*b[3] + iT[19]*b[4] - iT[14]*b[5] + add) >> shift; |
1406 | | dst[22 * line] = (iT[19]*b[0] - iT[24]*b[1] + iT[ 4]*b[2] + iT[14]*b[3] - iT[29]*b[4] + iT[ 9]*b[5] + add) >> shift; |
1407 | | dst[27 * line] = (iT[ 9]*b[0] - iT[19]*b[1] + iT[29]*b[2] - iT[24]*b[3] + iT[14]*b[4] - iT[ 4]*b[5] + add) >> shift; |
1408 | | |
1409 | | dst[ 6 * line] = (iT[12]*c[0] + iT[25]*c[1] + add) >> shift; |
1410 | | dst[19 * line] = (iT[25]*c[0] - iT[12]*c[1] + add) >> shift; |
1411 | | |
1412 | | src += 32; |
1413 | | dst++; |
1414 | | } |
1415 | | |
1416 | | if (iSkipLine) |
1417 | | { |
1418 | | dst = pCoef + reducedLine; |
1419 | | for (j = 0; j < cutoff; j++) |
1420 | | { |
1421 | | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
1422 | | dst += line; |
1423 | | } |
1424 | | } |
1425 | | |
1426 | | if (iSkipLine2) |
1427 | | { |
1428 | | dst = pCoef + line * cutoff; |
1429 | | memset(dst, 0, sizeof(TCoeff) * line * iSkipLine2); |
1430 | | } |
1431 | | #else |
1432 | 0 | _fastForwardMM< 32 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDST7P32[TRANSFORM_FORWARD][0] ); |
1433 | 0 | #endif |
1434 | 0 | } |
1435 | | |
1436 | | |
1437 | | void fastInverseDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1438 | 0 | { |
1439 | | #if !JVET_M0497_MATRIX_MULT |
1440 | | int j, k; |
1441 | | TCoeff a[10][6]; |
1442 | | TCoeff t[2]; |
1443 | | TCoeff b[6]; |
1444 | | TCoeff c[2]; |
1445 | | |
1446 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1447 | | const TMatrixCoeff *iT = g_trCoreDST7P32[TRANSFORM_INVERSE][0]; |
1448 | | const int reducedLine = line - iSkipLine; |
1449 | | |
1450 | | for (j = 0; j < reducedLine; j++) |
1451 | | { |
1452 | | for (k = 0; k < 6; k++) |
1453 | | { |
1454 | | a[0][k] = src[ k * line] + src[(12 - k) * line]; |
1455 | | a[1][k] = src[ k * line] - src[(13 + k) * line]; |
1456 | | a[2][k] = src[ k * line] + src[(25 - k) * line]; |
1457 | | a[3][k] = src[ k * line] - src[(26 + k) * line]; |
1458 | | a[4][k] = src[( 7 + k) * line] + src[(18 - k) * line]; |
1459 | | a[5][k] = src[( 7 + k) * line] - src[(20 + k) * line]; |
1460 | | a[6][k] = src[( 7 + k) * line] + src[(31 - k) * line]; |
1461 | | a[7][k] = src[(13 + k) * line] + src[(25 - k) * line]; |
1462 | | a[8][k] = src[(13 + k) * line] - src[(26 + k) * line]; |
1463 | | a[9][k] = src[(20 + k) * line] + src[(31 - k) * line]; |
1464 | | |
1465 | | b[k] = src[k * line] - src[(12-k) * line] + src[(13+k) * line] - src[(25-k) * line] + src[(26+k) * line]; |
1466 | | } |
1467 | | for (k = 0; k < 2; k++) |
1468 | | { |
1469 | | c[k] = src[k * line] - src[(4-k) * line] + src[(5+k) * line] - src[(9-k) * line] + src[(10+k) * line] - src[(14-k) * line] + src[(15+k)*line] - src[(19-k)*line] + src[(20+k)*line] - src[(24-k)*line] + src[(25+k)*line] - src[(29-k)*line] + src[(30+k)*line]; |
1470 | | } |
1471 | | |
1472 | | t[0] = iT[12] * src[6*line] + iT[25] * src[19*line]; |
1473 | | t[1] = iT[25] * src[6*line] - iT[12] * src[19*line]; |
1474 | | |
1475 | | dst[ 0] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[1][0] - iT[11] * a[8][0] + iT[13] * a[7][0] + iT[24] * a[4][5] - iT[1] * a[8][5] + iT[10] * a[1][5] + iT[14] * a[4][0] + iT[23] * a[7][5] + iT[2] * a[1][1] - iT[9] * a[8][1] + iT[15] * a[7][1] + iT[22] * a[4][4] - iT[3] * a[8][4] + iT[8] * a[1][4] + iT[16] * a[4][1] + iT[21] * a[7][4] + iT[4] * a[1][2] - iT[7] * a[8][2] + iT[17] * a[7][2] + iT[20] * a[4][3] - iT[5] * a[8][3] + iT[6] * a[1][3] + iT[18] * a[4][2] + iT[19] * a[7][3] + t[0] + add) >> shift); |
1476 | | dst[ 1] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[4][2] - iT[11] * a[6][2] + iT[13] * a[0][3] + iT[24] * a[5][2] + iT[1] * a[2][0] + iT[10] * a[7][0] + iT[14] * a[5][5] - iT[23] * a[9][5] + iT[2] * a[7][2] + iT[9] * a[2][2] - iT[15] * a[9][3] + iT[22] * a[5][3] - iT[3] * a[6][0] - iT[8] * a[4][0] + iT[16] * a[5][0] + iT[21] * a[0][5] - iT[4] * a[4][1] - iT[7] * a[6][1] + iT[17] * a[0][4] + iT[20] * a[5][1] + iT[5] * a[2][1] + iT[6] * a[7][1] + iT[18] * a[5][4] - iT[19] * a[9][4] + t[1] + add) >> shift); |
1477 | | dst[ 2] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[2][4] - iT[11] * a[3][4] + iT[13] * a[0][4] + iT[24] * a[1][4] + iT[1] * a[4][3] + iT[10] * a[7][2] + iT[14] * a[1][2] - iT[23] * a[8][2] + iT[2] * a[3][0] - iT[9] * a[6][5] - iT[15] * a[8][0] + iT[22] * a[9][5] - iT[3] * a[6][4] + iT[8] * a[3][1] + iT[16] * a[9][4] - iT[21] * a[8][1] + iT[4] * a[7][3] + iT[7] * a[4][2] - iT[17] * a[8][3] + iT[20] * a[1][3] - iT[5] * a[3][5] - iT[6] * a[2][5] + iT[18] * a[1][5] + iT[19] * a[0][5] + t[1] + add) >> shift); |
1478 | | dst[ 3] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[5][4] + iT[11] * a[0][1] - iT[13] * a[4][4] - iT[24] * a[6][4] - iT[1] * a[1][3] - iT[10] * a[0][3] + iT[14] * a[2][3] + iT[23] * a[3][3] - iT[2] * a[0][4] - iT[9] * a[1][4] + iT[15] * a[3][4] + iT[22] * a[2][4] + iT[3] * a[0][0] + iT[8] * a[5][5] - iT[16] * a[6][5] - iT[21] * a[4][5] + iT[4] * a[5][0] - iT[7] * a[9][0] + iT[17] * a[7][5] + iT[20] * a[2][5] - iT[5] * a[8][2] + iT[6] * a[9][3] - iT[18] * a[6][3] + iT[19] * a[3][2] + t[0] + add) >> shift); |
1479 | | dst[ 5] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[1][5] + iT[11] * a[8][5] - iT[13] * a[7][5] - iT[24] * a[4][0] + iT[1] * a[5][1] + iT[10] * a[0][4] - iT[14] * a[4][1] - iT[23] * a[6][1] - iT[2] * a[8][3] + iT[9] * a[9][2] - iT[15] * a[6][2] + iT[22] * a[3][3] - iT[3] * a[0][2] - iT[8] * a[1][2] + iT[16] * a[3][2] + iT[21] * a[2][2] - iT[4] * a[9][4] + iT[7] * a[5][4] + iT[17] * a[2][1] + iT[20] * a[7][1] + iT[5] * a[1][0] - iT[6] * a[8][0] + iT[18] * a[7][0] + iT[19] * a[4][5] - t[0] + add) >> shift); |
1480 | | dst[ 6] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[7][5] - iT[11] * a[2][5] + iT[13] * a[9][0] - iT[24] * a[5][0] + iT[1] * a[3][4] - iT[10] * a[6][1] - iT[14] * a[8][4] + iT[23] * a[9][1] + iT[2] * a[4][2] + iT[9] * a[7][3] + iT[15] * a[1][3] - iT[22] * a[8][3] - iT[3] * a[2][2] - iT[8] * a[3][2] + iT[16] * a[0][2] + iT[21] * a[1][2] - iT[4] * a[6][4] - iT[7] * a[4][4] + iT[17] * a[5][4] + iT[20] * a[0][1] + iT[5] * a[7][0] + iT[6] * a[2][0] - iT[18] * a[9][5] + iT[19] * a[5][5] - t[1] + add) >> shift); |
1481 | | dst[ 7] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[6][3] - iT[11] * a[4][3] + iT[13] * a[5][3] + iT[24] * a[0][2] + iT[1] * a[7][1] + iT[10] * a[4][4] - iT[14] * a[8][1] + iT[23] * a[1][1] - iT[2] * a[7][5] - iT[9] * a[4][0] + iT[15] * a[8][5] - iT[22] * a[1][5] + iT[3] * a[7][3] + iT[8] * a[2][3] - iT[16] * a[9][2] + iT[21] * a[5][2] - iT[4] * a[6][5] + iT[7] * a[3][0] + iT[17] * a[9][5] - iT[20] * a[8][0] + iT[5] * a[6][1] - iT[6] * a[3][4] - iT[18] * a[9][1] + iT[19] * a[8][4] - t[1] + add) >> shift); |
1482 | | dst[ 8] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[1][1] - iT[11] * a[0][1] + iT[13] * a[2][1] + iT[24] * a[3][1] + iT[1] * a[1][3] - iT[10] * a[8][3] + iT[14] * a[7][3] + iT[23] * a[4][2] - iT[2] * a[9][1] + iT[9] * a[8][4] - iT[15] * a[3][4] + iT[22] * a[6][1] + iT[3] * a[5][5] + iT[8] * a[0][0] - iT[16] * a[4][5] - iT[21] * a[6][5] + iT[4] * a[0][5] + iT[7] * a[1][5] - iT[17] * a[3][5] - iT[20] * a[2][5] + iT[5] * a[5][3] - iT[6] * a[9][3] + iT[18] * a[7][2] + iT[19] * a[2][2] - t[0] + add) >> shift); |
1483 | | dst[10] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[8][3] - iT[11] * a[1][3] - iT[13] * a[4][2] - iT[24] * a[7][3] - iT[1] * a[8][0] + iT[10] * a[1][0] + iT[14] * a[4][5] + iT[23] * a[7][0] + iT[2] * a[5][3] + iT[9] * a[0][2] - iT[15] * a[4][3] - iT[22] * a[6][3] - iT[3] * a[5][0] - iT[8] * a[0][5] + iT[16] * a[4][0] + iT[21] * a[6][0] + iT[4] * a[1][4] + iT[7] * a[0][4] - iT[17] * a[2][4] - iT[20] * a[3][4] - iT[5] * a[1][1] - iT[6] * a[0][1] + iT[18] * a[2][1] + iT[19] * a[3][1] + t[0] + add) >> shift); |
1484 | | dst[11] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[7][0] + iT[11] * a[2][0] - iT[13] * a[9][5] + iT[24] * a[5][5] + iT[1] * a[2][5] + iT[10] * a[7][5] + iT[14] * a[5][0] - iT[23] * a[9][0] - iT[2] * a[2][1] - iT[9] * a[3][1] + iT[15] * a[0][1] + iT[22] * a[1][1] - iT[3] * a[7][4] - iT[8] * a[4][1] + iT[16] * a[8][4] - iT[21] * a[1][4] + iT[4] * a[3][2] - iT[7] * a[6][3] - iT[17] * a[8][2] + iT[20] * a[9][3] + iT[5] * a[4][2] + iT[6] * a[6][2] - iT[18] * a[0][3] - iT[19] * a[5][2] + t[1] + add) >> shift); |
1485 | | dst[13] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[9][5] - iT[11] * a[8][0] + iT[13] * a[3][0] - iT[24] * a[6][5] - iT[1] * a[8][5] + iT[10] * a[9][0] - iT[14] * a[6][0] + iT[23] * a[3][5] + iT[2] * a[5][4] - iT[9] * a[9][4] + iT[15] * a[7][1] + iT[22] * a[2][1] - iT[3] * a[1][4] + iT[8] * a[8][4] - iT[16] * a[7][4] - iT[21] * a[4][1] - iT[4] * a[0][2] - iT[7] * a[5][3] + iT[17] * a[6][3] + iT[20] * a[4][3] + iT[5] * a[0][3] + iT[6] * a[1][3] - iT[18] * a[3][3] - iT[19] * a[2][3] + t[0] + add) >> shift); |
1486 | | dst[15] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[9][1] + iT[11] * a[5][1] + iT[13] * a[2][4] + iT[24] * a[7][4] + iT[1] * a[9][3] - iT[10] * a[5][3] - iT[14] * a[2][2] - iT[23] * a[7][2] - iT[2] * a[9][5] + iT[9] * a[5][5] + iT[15] * a[2][0] + iT[22] * a[7][0] + iT[3] * a[9][4] - iT[8] * a[8][1] + iT[16] * a[3][1] - iT[21] * a[6][4] - iT[4] * a[9][2] + iT[7] * a[8][3] - iT[17] * a[3][3] + iT[20] * a[6][2] + iT[5] * a[9][0] - iT[6] * a[8][5] + iT[18] * a[3][5] - iT[19] * a[6][0] - t[0] + add) >> shift); |
1487 | | dst[16] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[4][4] + iT[11] * a[7][1] + iT[13] * a[1][1] - iT[24] * a[8][1] + iT[1] * a[6][2] - iT[10] * a[3][3] - iT[14] * a[9][2] + iT[23] * a[8][3] - iT[2] * a[6][1] - iT[9] * a[4][1] + iT[15] * a[5][1] + iT[22] * a[0][4] - iT[3] * a[4][5] - iT[8] * a[6][5] + iT[16] * a[0][0] + iT[21] * a[5][5] - iT[4] * a[6][0] + iT[7] * a[3][5] + iT[17] * a[9][0] - iT[20] * a[8][5] + iT[5] * a[6][3] + iT[6] * a[4][3] - iT[18] * a[5][3] - iT[19] * a[0][2] - t[1] + add) >> shift); |
1488 | | dst[17] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[7][2] - iT[11] * a[4][3] + iT[13] * a[8][2] - iT[24] * a[1][2] + iT[1] * a[7][1] + iT[10] * a[2][1] - iT[14] * a[9][4] + iT[23] * a[5][4] - iT[2] * a[3][5] + iT[9] * a[6][0] + iT[15] * a[8][5] - iT[22] * a[9][0] - iT[3] * a[2][3] - iT[8] * a[7][3] - iT[16] * a[5][2] + iT[21] * a[9][2] + iT[4] * a[4][5] + iT[7] * a[7][0] + iT[17] * a[1][0] - iT[20] * a[8][0] - iT[5] * a[2][4] - iT[6] * a[3][4] + iT[18] * a[0][4] + iT[19] * a[1][4] - t[1] + add) >> shift); |
1489 | | dst[18] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[9][0] + iT[11] * a[8][5] - iT[13] * a[3][5] + iT[24] * a[6][0] + iT[1] * a[5][1] - iT[10] * a[9][1] + iT[14] * a[7][4] + iT[23] * a[2][4] + iT[2] * a[0][3] + iT[9] * a[5][2] - iT[15] * a[6][2] - iT[22] * a[4][2] + iT[3] * a[1][2] + iT[8] * a[0][2] - iT[16] * a[2][2] - iT[21] * a[3][2] - iT[4] * a[8][1] + iT[7] * a[1][1] + iT[17] * a[4][4] + iT[20] * a[7][1] + iT[5] * a[9][5] - iT[6] * a[8][0] + iT[18] * a[3][0] - iT[19] * a[6][5] - t[0] + add) >> shift); |
1490 | | dst[20] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[8][2] - iT[11] * a[9][3] + iT[13] * a[6][3] - iT[24] * a[3][2] + iT[1] * a[0][1] + iT[10] * a[5][4] - iT[14] * a[6][4] - iT[23] * a[4][4] + iT[2] * a[1][5] + iT[9] * a[0][5] - iT[15] * a[2][5] - iT[22] * a[3][5] - iT[3] * a[9][2] + iT[8] * a[5][2] + iT[16] * a[2][3] + iT[21] * a[7][3] + iT[4] * a[5][5] - iT[7] * a[9][5] + iT[17] * a[7][0] + iT[20] * a[2][0] + iT[5] * a[0][4] + iT[6] * a[5][1] - iT[18] * a[6][1] - iT[19] * a[4][1] + t[0] + add) >> shift); |
1491 | | dst[21] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[2][1] - iT[11] * a[7][1] - iT[13] * a[5][4] + iT[24] * a[9][4] - iT[1] * a[6][2] - iT[10] * a[4][2] + iT[14] * a[5][2] + iT[23] * a[0][3] - iT[2] * a[2][4] - iT[9] * a[7][4] - iT[15] * a[5][1] + iT[22] * a[9][1] - iT[3] * a[6][5] - iT[8] * a[4][5] + iT[16] * a[5][5] + iT[21] * a[0][0] - iT[4] * a[4][0] - iT[7] * a[7][5] - iT[17] * a[1][5] + iT[20] * a[8][5] - iT[5] * a[7][2] - iT[6] * a[4][3] + iT[18] * a[8][2] - iT[19] * a[1][2] + t[1] + add) >> shift); |
1492 | | dst[22] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[6][1] - iT[11] * a[3][4] - iT[13] * a[9][1] + iT[24] * a[8][4] + iT[1] * a[4][3] + iT[10] * a[6][3] - iT[14] * a[0][2] - iT[23] * a[5][3] + iT[2] * a[7][0] + iT[9] * a[4][5] - iT[15] * a[8][0] + iT[22] * a[1][0] - iT[3] * a[3][1] + iT[8] * a[6][4] + iT[16] * a[8][1] - iT[21] * a[9][4] - iT[4] * a[2][3] - iT[7] * a[3][3] + iT[17] * a[0][3] + iT[20] * a[1][3] - iT[5] * a[7][5] - iT[6] * a[2][5] + iT[18] * a[9][0] - iT[19] * a[5][0] + t[1] + add) >> shift); |
1493 | | dst[23] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[0][3] - iT[11] * a[1][3] + iT[13] * a[3][3] + iT[24] * a[2][3] - iT[1] * a[8][0] + iT[10] * a[9][5] - iT[14] * a[6][5] + iT[23] * a[3][0] + iT[2] * a[8][2] - iT[9] * a[1][2] - iT[15] * a[4][3] - iT[22] * a[7][2] + iT[3] * a[0][5] + iT[8] * a[5][0] - iT[16] * a[6][0] - iT[21] * a[4][0] + iT[4] * a[8][4] - iT[7] * a[9][1] + iT[17] * a[6][1] - iT[20] * a[3][4] - iT[5] * a[5][4] - iT[6] * a[0][1] + iT[18] * a[4][4] + iT[19] * a[6][4] + t[0] + add) >> shift); |
1494 | | dst[26] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[3][0] - iT[11] * a[2][0] + iT[13] * a[1][0] + iT[24] * a[0][0] - iT[1] * a[2][5] - iT[10] * a[3][5] + iT[14] * a[0][5] + iT[23] * a[1][5] + iT[2] * a[4][4] + iT[9] * a[6][4] - iT[15] * a[0][1] - iT[22] * a[5][4] - iT[3] * a[4][1] - iT[8] * a[7][4] - iT[16] * a[1][4] + iT[21] * a[8][4] + iT[4] * a[2][2] + iT[7] * a[7][2] + iT[17] * a[5][3] - iT[20] * a[9][3] + iT[5] * a[3][3] - iT[6] * a[6][2] - iT[18] * a[8][3] + iT[19] * a[9][2] - t[1] + add) >> shift); |
1495 | | dst[27] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[3][3] + iT[11] * a[6][2] + iT[13] * a[8][3] - iT[24] * a[9][2] - iT[1] * a[2][0] - iT[10] * a[3][0] + iT[14] * a[0][0] + iT[23] * a[1][0] - iT[2] * a[6][3] + iT[9] * a[3][2] + iT[15] * a[9][3] - iT[22] * a[8][2] - iT[3] * a[4][0] - iT[8] * a[6][0] + iT[16] * a[0][5] + iT[21] * a[5][0] - iT[4] * a[7][4] - iT[7] * a[2][4] + iT[17] * a[9][1] - iT[20] * a[5][1] - iT[5] * a[4][4] - iT[6] * a[7][1] - iT[18] * a[1][1] + iT[19] * a[8][1] - t[1] + add) >> shift); |
1496 | | dst[28] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[0][4] + iT[11] * a[5][1] - iT[13] * a[6][1] - iT[24] * a[4][1] + iT[1] * a[9][3] - iT[10] * a[8][2] + iT[14] * a[3][2] - iT[23] * a[6][3] - iT[2] * a[1][0] - iT[9] * a[0][0] + iT[15] * a[2][0] + iT[22] * a[3][0] + iT[3] * a[8][1] - iT[8] * a[9][4] + iT[16] * a[6][4] - iT[21] * a[3][1] - iT[4] * a[5][2] - iT[7] * a[0][3] + iT[17] * a[4][2] + iT[20] * a[6][2] + iT[5] * a[1][5] - iT[6] * a[8][5] + iT[18] * a[7][5] + iT[19] * a[4][0] - t[0] + add) >> shift); |
1497 | | dst[30] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[5][3] - iT[11] * a[9][3] + iT[13] * a[7][2] + iT[24] * a[2][2] + iT[1] * a[0][1] + iT[10] * a[1][1] - iT[14] * a[3][1] - iT[23] * a[2][1] + iT[2] * a[9][0] - iT[9] * a[5][0] - iT[15] * a[2][5] - iT[22] * a[7][5] - iT[3] * a[5][2] + iT[8] * a[9][2] - iT[16] * a[7][3] - iT[21] * a[2][3] - iT[4] * a[0][0] - iT[7] * a[1][0] + iT[17] * a[3][0] + iT[20] * a[2][0] - iT[5] * a[9][1] + iT[6] * a[5][1] + iT[18] * a[2][4] + iT[19] * a[7][4] + t[0] + add) >> shift); |
1498 | | dst[31] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[3][5] + iT[11] * a[2][5] - iT[13] * a[1][5] - iT[24] * a[0][5] - iT[1] * a[3][4] - iT[10] * a[2][4] + iT[14] * a[1][4] + iT[23] * a[0][4] + iT[2] * a[3][3] + iT[9] * a[2][3] - iT[15] * a[1][3] - iT[22] * a[0][3] - iT[3] * a[3][2] - iT[8] * a[2][2] + iT[16] * a[1][2] + iT[21] * a[0][2] + iT[4] * a[3][1] + iT[7] * a[2][1] - iT[17] * a[1][1] - iT[20] * a[0][1] - iT[5] * a[3][0] - iT[6] * a[2][0] + iT[18] * a[1][0] + iT[19] * a[0][0] + t[1] + add) >> shift); |
1499 | | |
1500 | | dst[ 4] = Clip3(outputMinimum, outputMaximum, (int)(iT[ 4] * b[0] + iT[14] * b[1] + iT[24] * b[2] + iT[29] * b[3] + iT[19] * b[4] + iT[ 9] * b[5] + add) >> shift); |
1501 | | dst[ 9] = Clip3(outputMinimum, outputMaximum, (int)(iT[ 9] * b[0] + iT[29] * b[1] + iT[14] * b[2] - iT[ 4] * b[3] - iT[24] * b[4] - iT[19] * b[5] + add) >> shift); |
1502 | | dst[14] = Clip3(outputMinimum, outputMaximum, (int)(iT[14] * b[0] + iT[19] * b[1] - iT[ 9] * b[2] - iT[24] * b[3] + iT[ 4] * b[4] + iT[29] * b[5] + add) >> shift); |
1503 | | dst[19] = Clip3(outputMinimum, outputMaximum, (int)(iT[19] * b[0] + iT[ 4] * b[1] - iT[29] * b[2] + iT[ 9] * b[3] + iT[14] * b[4] - iT[24] * b[5] + add) >> shift); |
1504 | | dst[24] = Clip3(outputMinimum, outputMaximum, (int)(iT[24] * b[0] - iT[ 9] * b[1] - iT[ 4] * b[2] + iT[19] * b[3] - iT[29] * b[4] + iT[14] * b[5] + add) >> shift); |
1505 | | dst[29] = Clip3(outputMinimum, outputMaximum, (int)(iT[29] * b[0] - iT[24] * b[1] + iT[19] * b[2] - iT[14] * b[3] + iT[ 9] * b[4] - iT[ 4] * b[5] + add) >> shift); |
1506 | | |
1507 | | dst[12] = Clip3(outputMinimum, outputMaximum, (int)(iT[12]*c[0] + iT[25]*c[1] + add) >> shift); |
1508 | | dst[25] = Clip3(outputMinimum, outputMaximum, (int)(iT[25]*c[0] - iT[12]*c[1] + add) >> shift); |
1509 | | |
1510 | | src++; |
1511 | | dst += 32; |
1512 | | } |
1513 | | |
1514 | | if (iSkipLine) |
1515 | | { |
1516 | | memset(dst, 0, (iSkipLine * 32) * sizeof(TCoeff)); |
1517 | | } |
1518 | | #else |
1519 | 0 | _fastInverseMM< 32 >( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDST7P32[TRANSFORM_INVERSE][0] ); |
1520 | 0 | #endif |
1521 | 0 | } |
1522 | | |
1523 | | |
1524 | | // ********************************** DCT-VIII ********************************** |
1525 | | static void fastForwardDCT8_B4_Core(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1526 | 0 | { |
1527 | 0 | int i; |
1528 | 0 | int rnd_factor = 1 << (shift - 1); |
1529 | 0 | const TMatrixCoeff *iT = g_trCoreDCT8P4[TRANSFORM_FORWARD][0]; |
1530 | |
|
1531 | 0 | int c[4]; |
1532 | 0 | TCoeff *pCoeff = dst; |
1533 | 0 | const int reducedLine = line - iSkipLine; |
1534 | 0 | for (i = 0; i<reducedLine; i++) |
1535 | 0 | { |
1536 | | // Intermediate Variables |
1537 | 0 | c[0] = src[0] + src[3]; |
1538 | 0 | c[1] = src[2] + src[0]; |
1539 | 0 | c[2] = src[3] - src[2]; |
1540 | 0 | c[3] = iT[1] * src[1]; |
1541 | |
|
1542 | 0 | dst[0 * line] = (iT[3] * c[0] + iT[2] * c[1] + c[3] + rnd_factor) >> shift; |
1543 | 0 | dst[1 * line] = (iT[1] * (src[0] - src[2] - src[3]) + rnd_factor) >> shift; |
1544 | 0 | dst[2 * line] = (iT[3] * c[2] + iT[2] * c[0] - c[3] + rnd_factor) >> shift; |
1545 | 0 | dst[3 * line] = (iT[3] * c[1] - iT[2] * c[2] - c[3] + rnd_factor) >> shift; |
1546 | |
|
1547 | 0 | src += 4; |
1548 | 0 | dst++; |
1549 | 0 | } |
1550 | 0 | if (iSkipLine) |
1551 | 0 | { |
1552 | 0 | dst = pCoeff + reducedLine; |
1553 | 0 | for (i = 0; i<4; i++) |
1554 | 0 | { |
1555 | 0 | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
1556 | 0 | dst += line; |
1557 | 0 | } |
1558 | 0 | } |
1559 | 0 | } |
1560 | | |
1561 | | |
1562 | | void fastForwardDCT8_B4( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2 ) |
1563 | 0 | { |
1564 | 0 | #if ENABLE_SIMD_TRAFO |
1565 | 0 | g_tCoeffOps.fastFwdDCT8_4( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
1566 | | #else |
1567 | | fastForwardDCT8_B4_Core( src, dst, shift, line, iSkipLine, iSkipLine2 ); |
1568 | | #endif |
1569 | 0 | } |
1570 | | |
1571 | | void fastInverseDCT8_B4(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1572 | 0 | { |
1573 | 0 | #if ENABLE_SIMD_TRAFO |
1574 | 0 | _fastInverseMM<4>( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDCT8P4[TRANSFORM_INVERSE][0] ); |
1575 | | #else |
1576 | | int i; |
1577 | | int rnd_factor = 1 << (shift - 1); |
1578 | | |
1579 | | const TMatrixCoeff *iT = g_trCoreDCT8P4[TRANSFORM_INVERSE][0]; |
1580 | | |
1581 | | int c[4]; |
1582 | | const int reducedLine = line - iSkipLine; |
1583 | | for (i = 0; i<reducedLine; i++) |
1584 | | { |
1585 | | // Intermediate Variables |
1586 | | c[0] = src[0 * line] + src[3 * line]; |
1587 | | c[1] = src[2 * line] + src[0 * line]; |
1588 | | c[2] = src[3 * line] - src[2 * line]; |
1589 | | c[3] = iT[1] * src[1 * line]; |
1590 | | |
1591 | | dst[0] = Clip3(outputMinimum, outputMaximum, (iT[3] * c[0] + iT[2] * c[1] + c[3] + rnd_factor) >> shift); |
1592 | | dst[1] = Clip3(outputMinimum, outputMaximum, (iT[1] * (src[0 * line] - src[2 * line] - src[3 * line]) + rnd_factor) >> shift); |
1593 | | dst[2] = Clip3(outputMinimum, outputMaximum, (iT[3] * c[2] + iT[2] * c[0] - c[3] + rnd_factor) >> shift); |
1594 | | dst[3] = Clip3(outputMinimum, outputMaximum, (iT[3] * c[1] - iT[2] * c[2] - c[3] + rnd_factor) >> shift); |
1595 | | |
1596 | | dst += 4; |
1597 | | src++; |
1598 | | } |
1599 | | if (iSkipLine) |
1600 | | { |
1601 | | memset(dst, 0, (iSkipLine << 2) * sizeof(TCoeff)); |
1602 | | } |
1603 | | #endif |
1604 | 0 | } |
1605 | | |
1606 | | |
1607 | | void fastForwardDCT8_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1608 | 0 | { |
1609 | 0 | _fastForwardMM< 8 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT8P8[TRANSFORM_FORWARD][0] ); |
1610 | 0 | } |
1611 | | |
1612 | | |
1613 | | void fastInverseDCT8_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1614 | 0 | { |
1615 | 0 | _fastInverseMM< 8 >( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDCT8P8[TRANSFORM_INVERSE][0] ); |
1616 | 0 | } |
1617 | | |
1618 | | |
1619 | | void fastForwardDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1620 | 0 | { |
1621 | | #if !JVET_M0497_MATRIX_MULT |
1622 | | int j, k; |
1623 | | TCoeff a[5], b[5], c[5], d[5], t; |
1624 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1625 | | |
1626 | | const TMatrixCoeff *iT = g_trCoreDST7P16[TRANSFORM_FORWARD][0]; |
1627 | | |
1628 | | TCoeff *pCoef = dst; |
1629 | | const int reducedLine = line - iSkipLine; |
1630 | | const int cutoff = 16 - iSkipLine2; |
1631 | | |
1632 | | for (j = 0; j < reducedLine; j++) |
1633 | | { |
1634 | | for (k = 0; k < 5; k++) |
1635 | | { |
1636 | | a[k] = src[15 - k] + src[ 4 - k]; |
1637 | | b[k] = src[ 6 + k] + src[ 4 - k]; |
1638 | | c[k] = src[15 - k] - src[ 6 + k]; |
1639 | | d[k] = src[15 - k] + src[ 6 + k] - src[ 4 - k]; |
1640 | | } |
1641 | | |
1642 | | t = iT[10] * src[5]; |
1643 | | |
1644 | | dst[ 1 * line] = ( - iT[ 2]*d[0] - iT[ 5]*d[1] - iT[ 8]*d[2] - iT[11]*d[3] - iT[14]*d[4] + add) >> shift; |
1645 | | dst[ 4 * line] = ( iT[ 8]*d[0] + iT[14]*d[1] + iT[ 5]*d[2] - iT[ 2]*d[3] - iT[11]*d[4] + add) >> shift; |
1646 | | dst[ 7 * line] = ( - iT[14]*d[0] - iT[ 2]*d[1] + iT[11]*d[2] + iT[ 5]*d[3] - iT[ 8]*d[4] + add) >> shift; |
1647 | | dst[10 * line] = ( iT[11]*d[0] - iT[ 8]*d[1] - iT[ 2]*d[2] + iT[14]*d[3] - iT[ 5]*d[4] + add) >> shift; |
1648 | | dst[13 * line] = ( - iT[ 5]*d[0] + iT[11]*d[1] - iT[14]*d[2] + iT[ 8]*d[3] - iT[ 2]*d[4] + add) >> shift; |
1649 | | |
1650 | | dst[ 5 * line] = ( - iT[10] * (src[15] + src[14] - src[12] - src[11] + src[9] + src[8] - src[6] - src[5] + src[3] + src[2] - src[0]) + add) >> shift; |
1651 | | |
1652 | | dst[ 0 * line] = ( iT[0]*a[0] + iT[9]*b[0] + iT[1]*a[1] + iT[8]*b[1] + iT[2]*a[2] + iT[7]*b[2] + iT[3]*a[3] + iT[6]*b[3] + iT[4]*a[4] + iT[5]*b[4] + t + add ) >> shift; |
1653 | | dst[ 2 * line] = ( iT[4]*c[0] - iT[5]*b[0] + iT[9]*c[1] - iT[0]*b[1] + iT[6]*c[2] + iT[3]*a[2] + iT[1]*c[3] + iT[8]*a[3] + iT[7]*a[4] + iT[2]*b[4] - t + add ) >> shift; |
1654 | | dst[ 3 * line] = ( - iT[6]*a[0] - iT[3]*b[0] - iT[2]*c[1] - iT[7]*a[1] - iT[9]*c[2] - iT[0]*a[2] - iT[4]*c[3] + iT[5]*b[3] + iT[1]*a[4] + iT[8]*b[4] - t + add ) >> shift; |
1655 | | dst[ 6 * line] = ( iT[8]*a[0] + iT[1]*c[0] + iT[6]*c[1] - iT[3]*b[1] - iT[5]*a[2] - iT[4]*b[2] - iT[7]*c[3] - iT[2]*a[3] - iT[0]*c[4] + iT[9]*b[4] + t + add ) >> shift; |
1656 | | dst[ 8 * line] = ( iT[4]*c[0] + iT[5]*a[0] - iT[0]*c[1] + iT[9]*b[1] - iT[3]*c[2] - iT[6]*a[2] + iT[1]*c[3] - iT[8]*b[3] + iT[2]*c[4] + iT[7]*a[4] - t + add ) >> shift; |
1657 | | dst[ 9 * line] = ( - iT[7]*c[0] - iT[2]*a[0] + iT[4]*a[1] + iT[5]*b[1] + iT[8]*c[2] - iT[1]*b[2] - iT[9]*a[3] - iT[0]*b[3] - iT[3]*c[4] + iT[6]*b[4] - t + add ) >> shift; |
1658 | | dst[11 * line] = ( - iT[9]*a[0] - iT[0]*b[0] + iT[8]*c[1] + iT[1]*a[1] - iT[2]*c[2] + iT[7]*b[2] - iT[6]*a[3] - iT[3]*b[3] + iT[5]*c[4] + iT[4]*a[4] + t + add ) >> shift; |
1659 | | dst[12 * line] = ( iT[7]*c[0] - iT[2]*b[0] - iT[5]*c[1] - iT[4]*a[1] + iT[8]*a[2] + iT[1]*b[2] - iT[0]*a[3] - iT[9]*b[3] - iT[6]*c[4] + iT[3]*b[4] + t + add ) >> shift; |
1660 | | dst[14 * line] = ( iT[3]*a[0] + iT[6]*b[0] - iT[7]*a[1] - iT[2]*b[1] + iT[0]*c[2] + iT[9]*a[2] - iT[4]*c[3] - iT[5]*a[3] + iT[8]*c[4] + iT[1]*a[4] - t + add ) >> shift; |
1661 | | dst[15 * line] = ( - iT[1]*c[0] + iT[8]*b[0] + iT[3]*c[1] - iT[6]*b[1] - iT[5]*c[2] + iT[4]*b[2] + iT[7]*c[3] - iT[2]*b[3] - iT[9]*c[4] + iT[0]*b[4] - t + add ) >> shift; |
1662 | | |
1663 | | src += 16; |
1664 | | dst++; |
1665 | | } |
1666 | | |
1667 | | if (iSkipLine) |
1668 | | { |
1669 | | dst = pCoef + reducedLine; |
1670 | | for (j = 0; j < cutoff; j++) |
1671 | | { |
1672 | | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
1673 | | dst += line; |
1674 | | } |
1675 | | } |
1676 | | |
1677 | | if (iSkipLine2) |
1678 | | { |
1679 | | dst = pCoef + line * cutoff; |
1680 | | memset(dst, 0, sizeof(TCoeff) * line * iSkipLine2); |
1681 | | } |
1682 | | #else |
1683 | 0 | _fastForwardMM< 16 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT8P16[TRANSFORM_FORWARD][0] ); |
1684 | 0 | #endif |
1685 | 0 | } |
1686 | | |
1687 | | |
1688 | | void fastInverseDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1689 | 0 | { |
1690 | | #if !JVET_M0497_MATRIX_MULT |
1691 | | int j, k; |
1692 | | TCoeff a[5], b[5], c[5], d[5], t; |
1693 | | |
1694 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1695 | | |
1696 | | const TMatrixCoeff *iT = g_trCoreDST7P16[TRANSFORM_INVERSE][0]; |
1697 | | |
1698 | | const int reducedLine = line - iSkipLine; |
1699 | | |
1700 | | for (j = 0; j < reducedLine; j++) |
1701 | | { |
1702 | | for (k = 0; k < 5; k++) |
1703 | | { |
1704 | | a[k] = src[(15 - k ) * line] + src[( 4 - k) * line]; |
1705 | | b[k] = src[( 6 + k ) * line] + src[( 4 - k) * line]; |
1706 | | c[k] = src[(15 - k ) * line] - src[( 6 + k) * line]; |
1707 | | d[k] = src[(15 - k ) * line] + src[( 6 + k) * line] - src[(4 - k) * line]; |
1708 | | } |
1709 | | |
1710 | | t = iT[10] * src[5*line]; |
1711 | | |
1712 | | dst[ 1] = Clip3(outputMinimum, outputMaximum, (int)( - iT[ 2]*d[0] - iT[ 5]*d[1] - iT[ 8]*d[2] - iT[11]*d[3] - iT[14]*d[4] + add) >> shift); |
1713 | | dst[ 4] = Clip3(outputMinimum, outputMaximum, (int)( iT[ 8]*d[0] + iT[14]*d[1] + iT[ 5]*d[2] - iT[ 2]*d[3] - iT[11]*d[4] + add) >> shift); |
1714 | | dst[ 7] = Clip3(outputMinimum, outputMaximum, (int)( - iT[14]*d[0] - iT[ 2]*d[1] + iT[11]*d[2] + iT[ 5]*d[3] - iT[ 8]*d[4] + add) >> shift); |
1715 | | dst[10] = Clip3(outputMinimum, outputMaximum, (int)( iT[11]*d[0] - iT[ 8]*d[1] - iT[ 2]*d[2] + iT[14]*d[3] - iT[ 5]*d[4] + add) >> shift); |
1716 | | dst[13] = Clip3(outputMinimum, outputMaximum, (int)( - iT[ 5]*d[0] + iT[11]*d[1] - iT[14]*d[2] + iT[ 8]*d[3] - iT[ 2]*d[4] + add) >> shift); |
1717 | | |
1718 | | dst[ 5] = Clip3(outputMinimum, outputMaximum, (int)( - iT[10] * (src[15 * line] + src[14 * line] - src[12 * line] - src[11 * line] + src[9 * line] + src[8 * line] - src[6 * line] - src[5 * line] + src[3 * line] + src[2 * line] - src[0 * line]) + add) >> shift); |
1719 | | |
1720 | | dst[ 0] = Clip3(outputMinimum, outputMaximum, (int)( iT[0]*a[0] + iT[9]*b[0] + iT[1]*a[1] + iT[8]*b[1] + iT[2]*a[2] + iT[7]*b[2] + iT[3]*a[3] + iT[6]*b[3] + iT[4]*a[4] + iT[5]*b[4] + t + add ) >> shift ); |
1721 | | dst[ 2] = Clip3(outputMinimum, outputMaximum, (int)( iT[4]*c[0] - iT[5]*b[0] + iT[9]*c[1] - iT[0]*b[1] + iT[6]*c[2] + iT[3]*a[2] + iT[1]*c[3] + iT[8]*a[3] + iT[7]*a[4] + iT[2]*b[4] - t + add ) >> shift ); |
1722 | | dst[ 3] = Clip3(outputMinimum, outputMaximum, (int)( - iT[6]*a[0] - iT[3]*b[0] - iT[2]*c[1] - iT[7]*a[1] - iT[9]*c[2] - iT[0]*a[2] - iT[4]*c[3] + iT[5]*b[3] + iT[1]*a[4] + iT[8]*b[4] - t + add ) >> shift ); |
1723 | | dst[ 6] = Clip3(outputMinimum, outputMaximum, (int)( iT[8]*a[0] + iT[1]*c[0] + iT[6]*c[1] - iT[3]*b[1] - iT[5]*a[2] - iT[4]*b[2] - iT[7]*c[3] - iT[2]*a[3] - iT[0]*c[4] + iT[9]*b[4] + t + add ) >> shift ); |
1724 | | dst[ 8] = Clip3(outputMinimum, outputMaximum, (int)( iT[4]*c[0] + iT[5]*a[0] - iT[0]*c[1] + iT[9]*b[1] - iT[3]*c[2] - iT[6]*a[2] + iT[1]*c[3] - iT[8]*b[3] + iT[2]*c[4] + iT[7]*a[4] - t + add ) >> shift ); |
1725 | | dst[ 9] = Clip3(outputMinimum, outputMaximum, (int)( - iT[7]*c[0] - iT[2]*a[0] + iT[4]*a[1] + iT[5]*b[1] + iT[8]*c[2] - iT[1]*b[2] - iT[9]*a[3] - iT[0]*b[3] - iT[3]*c[4] + iT[6]*b[4] - t + add ) >> shift ); |
1726 | | dst[11] = Clip3(outputMinimum, outputMaximum, (int)( - iT[9]*a[0] - iT[0]*b[0] + iT[8]*c[1] + iT[1]*a[1] - iT[2]*c[2] + iT[7]*b[2] - iT[6]*a[3] - iT[3]*b[3] + iT[5]*c[4] + iT[4]*a[4] + t + add ) >> shift ); |
1727 | | dst[12] = Clip3(outputMinimum, outputMaximum, (int)( iT[7]*c[0] - iT[2]*b[0] - iT[5]*c[1] - iT[4]*a[1] + iT[8]*a[2] + iT[1]*b[2] - iT[0]*a[3] - iT[9]*b[3] - iT[6]*c[4] + iT[3]*b[4] + t + add ) >> shift ); |
1728 | | dst[14] = Clip3(outputMinimum, outputMaximum, (int)( iT[3]*a[0] + iT[6]*b[0] - iT[7]*a[1] - iT[2]*b[1] + iT[0]*c[2] + iT[9]*a[2] - iT[4]*c[3] - iT[5]*a[3] + iT[8]*c[4] + iT[1]*a[4] - t + add ) >> shift ); |
1729 | | dst[15] = Clip3(outputMinimum, outputMaximum, (int)( - iT[1]*c[0] + iT[8]*b[0] + iT[3]*c[1] - iT[6]*b[1] - iT[5]*c[2] + iT[4]*b[2] + iT[7]*c[3] - iT[2]*b[3] - iT[9]*c[4] + iT[0]*b[4] - t + add ) >> shift ); |
1730 | | |
1731 | | src++; |
1732 | | dst += 16; |
1733 | | } |
1734 | | |
1735 | | if (iSkipLine) |
1736 | | { |
1737 | | memset(dst, 0, (iSkipLine * 16) * sizeof(TCoeff)); |
1738 | | } |
1739 | | #else |
1740 | 0 | _fastInverseMM< 16 >( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDCT8P16[TRANSFORM_INVERSE][0] ); |
1741 | 0 | #endif |
1742 | 0 | } |
1743 | | |
1744 | | |
1745 | | void fastForwardDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) |
1746 | 0 | { |
1747 | | #if !JVET_M0497_MATRIX_MULT |
1748 | | int j, k; |
1749 | | TCoeff a[10][6]; |
1750 | | TCoeff t[2]; |
1751 | | TCoeff b[6]; |
1752 | | TCoeff c[2]; |
1753 | | |
1754 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1755 | | const TMatrixCoeff *iT = g_trCoreDST7P32[TRANSFORM_FORWARD][0]; |
1756 | | TCoeff *pCoef = dst; |
1757 | | const int reducedLine = line - iSkipLine; |
1758 | | const int cutoff = 32 - iSkipLine2; |
1759 | | |
1760 | | for (j = 0; j < reducedLine; j++) |
1761 | | { |
1762 | | for (k = 0; k < 6; k++) |
1763 | | { |
1764 | | a[0][k] = src[31-k] - src[20+k]; |
1765 | | a[1][k] = src[31-k] + src[18-k]; |
1766 | | a[2][k] = src[31-k] + src[ 7+k]; |
1767 | | a[3][k] = src[31-k] - src[ 5-k]; |
1768 | | a[4][k] = src[25-k] + src[13+k]; |
1769 | | a[5][k] = src[25-k] + src[12-k]; |
1770 | | a[6][k] = src[25-k] - src[ k]; |
1771 | | a[7][k] = src[18-k] - src[ 7+k]; |
1772 | | a[8][k] = src[18-k] + src[ 5-k]; |
1773 | | a[9][k] = src[12-k] + src[ k]; |
1774 | | |
1775 | | b[k] = src[31-k] + src[20+k] - src[18-k] - src[7+k] + src[5-k]; |
1776 | | } |
1777 | | |
1778 | | for (k = 0; k < 2; k++) |
1779 | | { |
1780 | | c[k] = src[31-k] + src[28+k] - src[26-k] - src[23+k] + src[21-k] + src[18+k] - src[16-k] - src[13+k] + src[11-k] + src[8+k] - src[6-k] - src[3+k] + src[1-k]; |
1781 | | } |
1782 | | |
1783 | | t[0] = iT[12] * src[19] + iT[25] * src[6]; |
1784 | | t[1] = iT[12] * src[6] - iT[25] * src[19]; |
1785 | | |
1786 | | dst[ 0 * line] = ( iT[0] * a[3][0] + iT[11] * a[6][5] + iT[13] * a[8][0] + iT[24] * a[9][5] + iT[1] * a[3][1] + iT[10] * a[6][4] + iT[14] * a[8][1] + iT[23] * a[9][4] + iT[2] * a[3][2] + iT[9] * a[6][3] + iT[15] * a[8][2] + iT[22] * a[9][3] + iT[3] * a[3][3] + iT[8] * a[6][2] + iT[16] * a[8][3] + iT[21] * a[9][2] + iT[4] * a[3][4] + iT[7] * a[6][1] + iT[17] * a[8][4] + iT[20] * a[9][1] + iT[5] * a[3][5] + iT[6] * a[6][0] + iT[18] * a[8][5] + iT[19] * a[9][0] + t[0] + add) >> shift; |
1787 | | dst[ 1 * line] = ( iT[0] * a[5][2] - iT[11] * a[0][3] - iT[13] * a[4][2] - iT[24] * a[6][2] - iT[1] * a[9][1] - iT[10] * a[8][4] - iT[14] * a[3][4] - iT[23] * a[6][1] - iT[2] * a[0][0] + iT[9] * a[5][5] - iT[15] * a[6][5] - iT[22] * a[4][5] + iT[3] * a[5][3] - iT[8] * a[0][2] - iT[16] * a[4][3] - iT[21] * a[6][3] - iT[4] * a[9][0] - iT[7] * a[8][5] - iT[17] * a[3][5] - iT[20] * a[6][0] - iT[5] * a[0][1] + iT[6] * a[5][4] - iT[18] * a[6][4] - iT[19] * a[4][4] + t[1] + add) >> shift; |
1788 | | dst[ 3 * line] = ( iT[0] * a[9][4] + iT[11] * a[5][4] - iT[13] * a[2][1] + iT[24] * a[7][1] + iT[1] * a[0][3] + iT[10] * a[1][3] - iT[14] * a[3][3] - iT[23] * a[2][3] - iT[2] * a[8][5] - iT[9] * a[9][0] - iT[15] * a[6][0] - iT[22] * a[3][5] + iT[3] * a[1][4] + iT[8] * a[0][4] - iT[16] * a[2][4] - iT[21] * a[3][4] + iT[4] * a[5][3] + iT[7] * a[9][3] + iT[17] * a[7][2] - iT[20] * a[2][2] - iT[5] * a[8][0] - iT[6] * a[1][0] + iT[18] * a[4][5] + iT[19] * a[7][0] - t[1] + add) >> shift; |
1789 | | dst[ 4 * line] = ( - iT[0] * a[3][2] - iT[11] * a[2][2] + iT[13] * a[1][2] + iT[24] * a[0][2] + iT[1] * a[6][0] + iT[10] * a[3][5] + iT[14] * a[9][0] + iT[23] * a[8][5] - iT[2] * a[2][3] - iT[9] * a[3][3] + iT[15] * a[0][3] + iT[22] * a[1][3] - iT[3] * a[7][0] + iT[8] * a[2][0] - iT[16] * a[9][5] - iT[21] * a[5][5] + iT[4] * a[4][4] + iT[7] * a[6][4] + iT[17] * a[0][1] - iT[20] * a[5][4] - iT[5] * a[7][4] - iT[6] * a[4][1] + iT[18] * a[8][4] + iT[19] * a[1][4] - t[0] + add) >> shift; |
1790 | | dst[ 5 * line] = ( iT[0] * a[3][5] + iT[11] * a[6][0] + iT[13] * a[8][5] + iT[24] * a[9][0] - iT[1] * a[6][5] - iT[10] * a[3][0] - iT[14] * a[9][5] - iT[23] * a[8][0] + iT[2] * a[7][4] - iT[9] * a[2][4] + iT[15] * a[9][1] + iT[22] * a[5][1] + iT[3] * a[7][1] + iT[8] * a[4][4] - iT[16] * a[8][1] - iT[21] * a[1][1] - iT[4] * a[6][2] - iT[7] * a[4][2] + iT[17] * a[5][2] - iT[20] * a[0][3] + iT[5] * a[3][2] + iT[6] * a[2][2] - iT[18] * a[1][2] - iT[19] * a[0][2] - t[0] + add) >> shift; |
1791 | | dst[ 8 * line] = ( iT[0] * a[9][3] + iT[11] * a[8][2] + iT[13] * a[3][2] + iT[24] * a[6][3] + iT[1] * a[1][5] + iT[10] * a[0][5] - iT[14] * a[2][5] - iT[23] * a[3][5] - iT[2] * a[1][3] - iT[9] * a[8][3] + iT[15] * a[7][3] + iT[22] * a[4][2] - iT[3] * a[9][5] - iT[8] * a[5][5] + iT[16] * a[2][0] - iT[21] * a[7][0] - iT[4] * a[1][1] - iT[7] * a[0][1] + iT[17] * a[2][1] + iT[20] * a[3][1] + iT[5] * a[5][1] + iT[6] * a[9][1] + iT[18] * a[7][4] - iT[19] * a[2][4] + t[1] + add) >> shift; |
1792 | | dst[ 9 * line] = ( iT[0] * a[2][1] + iT[11] * a[3][1] - iT[13] * a[0][1] - iT[24] * a[1][1] - iT[1] * a[7][3] + iT[10] * a[2][3] - iT[14] * a[9][2] - iT[23] * a[5][2] - iT[2] * a[4][0] - iT[9] * a[7][5] + iT[15] * a[1][5] + iT[22] * a[8][5] - iT[3] * a[3][4] - iT[8] * a[2][4] + iT[16] * a[1][4] + iT[21] * a[0][4] - iT[4] * a[6][3] - iT[7] * a[3][2] - iT[17] * a[9][3] - iT[20] * a[8][2] - iT[5] * a[4][5] - iT[6] * a[6][5] - iT[18] * a[0][0] + iT[19] * a[5][5] + t[0] + add) >> shift; |
1793 | | dst[10 * line] = ( - iT[0] * a[6][1] - iT[11] * a[4][1] + iT[13] * a[5][1] - iT[24] * a[0][4] + iT[1] * a[2][2] - iT[10] * a[7][2] - iT[14] * a[5][3] - iT[23] * a[9][3] + iT[2] * a[6][4] + iT[9] * a[4][4] - iT[15] * a[5][4] + iT[22] * a[0][1] - iT[3] * a[2][5] + iT[8] * a[7][5] + iT[16] * a[5][0] + iT[21] * a[9][0] - iT[4] * a[7][0] - iT[7] * a[4][5] + iT[17] * a[8][0] + iT[20] * a[1][0] + iT[5] * a[4][2] + iT[6] * a[7][3] - iT[18] * a[1][3] - iT[19] * a[8][3] + t[0] + add) >> shift; |
1794 | | dst[11 * line] = ( - iT[0] * a[1][3] - iT[11] * a[0][3] + iT[13] * a[2][3] + iT[24] * a[3][3] - iT[1] * a[9][1] - iT[10] * a[5][1] + iT[14] * a[2][4] - iT[23] * a[7][4] - iT[2] * a[8][0] - iT[9] * a[9][5] - iT[15] * a[6][5] - iT[22] * a[3][0] + iT[3] * a[0][2] - iT[8] * a[5][3] + iT[16] * a[6][3] + iT[21] * a[4][3] + iT[4] * a[5][0] - iT[7] * a[0][5] - iT[17] * a[4][0] - iT[20] * a[6][0] + iT[5] * a[9][4] + iT[6] * a[5][4] - iT[18] * a[2][1] + iT[19] * a[7][1] + t[1] + add) >> shift; |
1795 | | dst[13 * line] = ( iT[0] * a[0][0] + iT[11] * a[1][0] - iT[13] * a[3][0] - iT[24] * a[2][0] + iT[1] * a[5][4] - iT[10] * a[0][1] - iT[14] * a[4][4] - iT[23] * a[6][4] - iT[2] * a[9][3] - iT[9] * a[5][3] + iT[15] * a[2][2] - iT[22] * a[7][2] + iT[3] * a[8][3] + iT[8] * a[9][2] + iT[16] * a[6][2] + iT[21] * a[3][3] - iT[4] * a[1][4] - iT[7] * a[8][4] + iT[17] * a[7][4] + iT[20] * a[4][1] + iT[5] * a[0][5] + iT[6] * a[1][5] - iT[18] * a[3][5] - iT[19] * a[2][5] - t[1] + add) >> shift; |
1796 | | dst[14 * line] = ( iT[0] * a[4][2] + iT[11] * a[7][3] - iT[13] * a[1][3] - iT[24] * a[8][3] + iT[1] * a[4][1] + iT[10] * a[6][1] + iT[14] * a[0][4] - iT[23] * a[5][1] - iT[2] * a[3][0] - iT[9] * a[2][0] + iT[15] * a[1][0] + iT[22] * a[0][0] - iT[3] * a[6][3] - iT[8] * a[4][3] + iT[16] * a[5][3] - iT[21] * a[0][2] - iT[4] * a[7][5] - iT[7] * a[4][0] + iT[17] * a[8][5] + iT[20] * a[1][5] + iT[5] * a[6][4] + iT[6] * a[3][1] + iT[18] * a[9][4] + iT[19] * a[8][1] - t[0] + add) >> shift; |
1797 | | dst[15 * line] = ( iT[0] * a[7][4] + iT[11] * a[4][1] - iT[13] * a[8][4] - iT[24] * a[1][4] - iT[1] * a[2][2] - iT[10] * a[3][2] + iT[14] * a[0][2] + iT[23] * a[1][2] - iT[2] * a[2][1] + iT[9] * a[7][1] + iT[15] * a[5][4] + iT[22] * a[9][4] + iT[3] * a[7][5] - iT[8] * a[2][5] + iT[16] * a[9][0] + iT[21] * a[5][0] + iT[4] * a[2][0] + iT[7] * a[3][0] - iT[17] * a[0][0] - iT[20] * a[1][0] + iT[5] * a[2][3] - iT[6] * a[7][3] - iT[18] * a[5][2] - iT[19] * a[9][2] - t[0] + add) >> shift; |
1798 | | dst[16 * line] = ( - iT[0] * a[0][1] + iT[11] * a[5][4] - iT[13] * a[6][4] - iT[24] * a[4][4] + iT[1] * a[0][3] - iT[10] * a[5][2] + iT[14] * a[6][2] + iT[23] * a[4][2] - iT[2] * a[0][5] + iT[9] * a[5][0] - iT[15] * a[6][0] - iT[22] * a[4][0] - iT[3] * a[0][4] - iT[8] * a[1][4] + iT[16] * a[3][4] + iT[21] * a[2][4] + iT[4] * a[0][2] + iT[7] * a[1][2] - iT[17] * a[3][2] - iT[20] * a[2][2] - iT[5] * a[0][0] - iT[6] * a[1][0] + iT[18] * a[3][0] + iT[19] * a[2][0] - t[1] + add) >> shift; |
1799 | | dst[18 * line] = ( iT[0] * a[0][5] + iT[11] * a[1][5] - iT[13] * a[3][5] - iT[24] * a[2][5] - iT[1] * a[1][0] - iT[10] * a[0][0] + iT[14] * a[2][0] + iT[23] * a[3][0] - iT[2] * a[5][1] + iT[9] * a[0][4] + iT[15] * a[4][1] + iT[22] * a[6][1] - iT[3] * a[8][1] - iT[8] * a[1][1] + iT[16] * a[4][4] + iT[21] * a[7][1] - iT[4] * a[9][2] - iT[7] * a[5][2] + iT[17] * a[2][3] - iT[20] * a[7][3] - iT[5] * a[9][3] - iT[6] * a[8][2] - iT[18] * a[3][2] - iT[19] * a[6][3] + t[1] + add) >> shift; |
1800 | | dst[20 * line] = ( - iT[0] * a[4][0] - iT[11] * a[6][0] - iT[13] * a[0][5] + iT[24] * a[5][0] + iT[1] * a[6][5] + iT[10] * a[4][5] - iT[14] * a[5][5] + iT[23] * a[0][0] - iT[2] * a[6][1] - iT[9] * a[3][4] - iT[15] * a[9][1] - iT[22] * a[8][4] + iT[3] * a[4][4] + iT[8] * a[7][1] - iT[16] * a[1][1] - iT[21] * a[8][1] - iT[4] * a[3][3] - iT[7] * a[2][3] + iT[17] * a[1][3] + iT[20] * a[0][3] + iT[5] * a[7][2] - iT[6] * a[2][2] + iT[18] * a[9][3] + iT[19] * a[5][3] + t[0] + add) >> shift; |
1801 | | dst[21 * line] = ( iT[0] * a[1][2] + iT[11] * a[8][2] - iT[13] * a[7][2] - iT[24] * a[4][3] + iT[1] * a[1][5] + iT[10] * a[8][5] - iT[14] * a[7][5] - iT[23] * a[4][0] + iT[2] * a[5][2] + iT[9] * a[9][2] + iT[15] * a[7][3] - iT[22] * a[2][3] + iT[3] * a[5][5] + iT[8] * a[9][5] + iT[16] * a[7][0] - iT[21] * a[2][0] + iT[4] * a[8][1] + iT[7] * a[9][4] + iT[17] * a[6][4] + iT[20] * a[3][1] + iT[5] * a[8][4] + iT[6] * a[9][1] + iT[18] * a[6][1] + iT[19] * a[3][4] + t[1] + add) >> shift; |
1802 | | dst[23 * line] = ( iT[0] * a[8][4] + iT[11] * a[9][1] + iT[13] * a[6][1] + iT[24] * a[3][4] - iT[1] * a[8][2] - iT[10] * a[1][2] + iT[14] * a[4][3] + iT[23] * a[7][2] - iT[2] * a[0][1] - iT[9] * a[1][1] + iT[15] * a[3][1] + iT[22] * a[2][1] + iT[3] * a[5][0] + iT[8] * a[9][0] + iT[16] * a[7][5] - iT[21] * a[2][5] - iT[4] * a[9][5] - iT[7] * a[8][0] - iT[17] * a[3][0] - iT[20] * a[6][5] + iT[5] * a[5][2] - iT[6] * a[0][3] - iT[18] * a[4][2] - iT[19] * a[6][2] - t[1] + add) >> shift; |
1803 | | dst[24 * line] = ( - iT[0] * a[2][3] + iT[11] * a[7][3] + iT[13] * a[5][2] + iT[24] * a[9][2] + iT[1] * a[4][1] + iT[10] * a[7][4] - iT[14] * a[1][4] - iT[23] * a[8][4] - iT[2] * a[4][5] - iT[9] * a[7][0] + iT[15] * a[1][0] + iT[22] * a[8][0] + iT[3] * a[4][3] + iT[8] * a[6][3] + iT[16] * a[0][2] - iT[21] * a[5][3] - iT[4] * a[2][5] - iT[7] * a[3][5] + iT[17] * a[0][5] + iT[20] * a[1][5] + iT[5] * a[2][1] + iT[6] * a[3][1] - iT[18] * a[0][1] - iT[19] * a[1][1] - t[0] + add) >> shift; |
1804 | | dst[25 * line] = ( - iT[0] * a[4][5] - iT[11] * a[6][5] - iT[13] * a[0][0] + iT[24] * a[5][5] - iT[1] * a[3][1] - iT[10] * a[2][1] + iT[14] * a[1][1] + iT[23] * a[0][1] + iT[2] * a[7][2] + iT[9] * a[4][3] - iT[15] * a[8][2] - iT[22] * a[1][2] + iT[3] * a[6][2] + iT[8] * a[3][3] + iT[16] * a[9][2] + iT[21] * a[8][3] + iT[4] * a[2][4] - iT[7] * a[7][4] - iT[17] * a[5][1] - iT[20] * a[9][1] - iT[5] * a[4][0] - iT[6] * a[6][0] - iT[18] * a[0][5] + iT[19] * a[5][0] - t[0] + add) >> shift; |
1805 | | dst[26 * line] = ( iT[0] * a[8][0] + iT[11] * a[1][0] - iT[13] * a[4][5] - iT[24] * a[7][0] + iT[1] * a[5][4] + iT[10] * a[9][4] + iT[14] * a[7][1] - iT[23] * a[2][1] - iT[2] * a[1][2] - iT[9] * a[0][2] + iT[15] * a[2][2] + iT[22] * a[3][2] - iT[3] * a[9][2] - iT[8] * a[8][3] - iT[16] * a[3][3] - iT[21] * a[6][2] + iT[4] * a[0][4] - iT[7] * a[5][1] + iT[17] * a[6][1] + iT[20] * a[4][1] + iT[5] * a[8][5] + iT[6] * a[1][5] - iT[18] * a[4][0] - iT[19] * a[7][5] - t[1] + add) >> shift; |
1806 | | dst[28 * line] = ( - iT[0] * a[5][1] - iT[11] * a[9][1] - iT[13] * a[7][4] + iT[24] * a[2][4] + iT[1] * a[8][2] + iT[10] * a[9][3] + iT[14] * a[6][3] + iT[23] * a[3][2] - iT[2] * a[9][4] - iT[9] * a[8][1] - iT[15] * a[3][1] - iT[22] * a[6][4] + iT[3] * a[9][0] + iT[8] * a[5][0] - iT[16] * a[2][5] + iT[21] * a[7][5] - iT[4] * a[5][5] + iT[7] * a[0][0] + iT[17] * a[4][5] + iT[20] * a[6][5] + iT[5] * a[1][3] + iT[6] * a[0][3] - iT[18] * a[2][3] - iT[19] * a[3][3] + t[1] + add) >> shift; |
1807 | | dst[29 * line] = ( iT[0] * a[6][4] + iT[11] * a[3][1] + iT[13] * a[9][4] + iT[24] * a[8][1] - iT[1] * a[7][3] - iT[10] * a[4][2] + iT[14] * a[8][3] + iT[23] * a[1][3] - iT[2] * a[3][5] - iT[9] * a[2][5] + iT[15] * a[1][5] + iT[22] * a[0][5] + iT[3] * a[2][4] + iT[8] * a[3][4] - iT[16] * a[0][4] - iT[21] * a[1][4] + iT[4] * a[4][3] + iT[7] * a[7][2] - iT[17] * a[1][2] - iT[20] * a[8][2] - iT[5] * a[3][0] - iT[6] * a[6][5] - iT[18] * a[8][0] - iT[19] * a[9][5] + t[0] + add) >> shift; |
1808 | | dst[30 * line] = ( - iT[0] * a[7][2] + iT[11] * a[2][2] - iT[13] * a[9][3] - iT[24] * a[5][3] - iT[1] * a[6][0] - iT[10] * a[4][0] + iT[14] * a[5][0] - iT[23] * a[0][5] - iT[2] * a[4][2] - iT[9] * a[6][2] - iT[15] * a[0][3] + iT[22] * a[5][2] + iT[3] * a[2][0] - iT[8] * a[7][0] - iT[16] * a[5][5] - iT[21] * a[9][5] + iT[4] * a[7][1] - iT[7] * a[2][1] + iT[17] * a[9][4] + iT[20] * a[5][4] + iT[5] * a[6][1] + iT[6] * a[4][1] - iT[18] * a[5][1] + iT[19] * a[0][4] + t[0] + add) >> shift; |
1809 | | dst[31 * line] = ( iT[0] * a[8][5] + iT[11] * a[1][5] - iT[13] * a[4][0] - iT[24] * a[7][5] - iT[1] * a[1][0] - iT[10] * a[8][0] + iT[14] * a[7][0] + iT[23] * a[4][5] - iT[2] * a[8][4] - iT[9] * a[1][4] + iT[15] * a[4][1] + iT[22] * a[7][4] + iT[3] * a[1][1] + iT[8] * a[8][1] - iT[16] * a[7][1] - iT[21] * a[4][4] + iT[4] * a[8][3] + iT[7] * a[1][3] - iT[17] * a[4][2] - iT[20] * a[7][3] - iT[5] * a[1][2] - iT[6] * a[8][2] + iT[18] * a[7][2] + iT[19] * a[4][3] + t[1] + add) >> shift; |
1810 | | |
1811 | | dst[ 2 * line] = ( iT[ 4] * b[0] + iT[ 9] * b[1] + iT[14] * b[2] + iT[19] * b[3] + iT[24] * b[4] + iT[29] * b[5] + add) >> shift; |
1812 | | dst[ 7 * line] = ( - iT[14] * b[0] - iT[29] * b[1] - iT[19] * b[2] - iT[ 4] * b[3] + iT[ 9] * b[4] + iT[24] * b[5] + add) >> shift; |
1813 | | dst[12 * line] = ( iT[24] * b[0] + iT[14] * b[1] - iT[ 9] * b[2] - iT[29] * b[3] - iT[ 4] * b[4] + iT[19] * b[5] + add) >> shift; |
1814 | | dst[17 * line] = ( - iT[29] * b[0] + iT[ 4] * b[1] + iT[24] * b[2] - iT[ 9] * b[3] - iT[19] * b[4] + iT[14] * b[5] + add) >> shift; |
1815 | | dst[22 * line] = ( iT[19] * b[0] - iT[24] * b[1] + iT[ 4] * b[2] + iT[14] * b[3] - iT[29] * b[4] + iT[ 9] * b[5] + add) >> shift; |
1816 | | dst[27 * line] = ( - iT[ 9] * b[0] + iT[19] * b[1] - iT[29] * b[2] + iT[24] * b[3] - iT[14] * b[4] + iT[ 4] * b[5] + add) >> shift; |
1817 | | |
1818 | | dst[ 6 * line] = ( iT[12] * c[0] + iT[25] * c[1] + add) >> shift; |
1819 | | dst[19 * line] = ( - iT[25] * c[0] + iT[12] * c[1] + add) >> shift; |
1820 | | |
1821 | | src += 32; |
1822 | | dst++; |
1823 | | } |
1824 | | |
1825 | | if (iSkipLine) |
1826 | | { |
1827 | | dst = pCoef + reducedLine; |
1828 | | for (j = 0; j < cutoff; j++) |
1829 | | { |
1830 | | memset(dst, 0, sizeof(TCoeff)*iSkipLine); |
1831 | | dst += line; |
1832 | | } |
1833 | | } |
1834 | | |
1835 | | if (iSkipLine2) |
1836 | | { |
1837 | | dst = pCoef + line * cutoff; |
1838 | | memset(dst, 0, sizeof(TCoeff) * line * iSkipLine2); |
1839 | | } |
1840 | | #else |
1841 | 0 | _fastForwardMM< 32 >( src, dst, shift, line, iSkipLine, iSkipLine2, g_trCoreDCT8P32[TRANSFORM_FORWARD][0] ); |
1842 | 0 | #endif |
1843 | 0 | } |
1844 | | |
1845 | | |
1846 | | void fastInverseDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) |
1847 | 0 | { |
1848 | | #if !JVET_M0497_MATRIX_MULT |
1849 | | int j, k; |
1850 | | TCoeff a[10][6]; |
1851 | | TCoeff t[2]; |
1852 | | TCoeff b[6]; |
1853 | | TCoeff c[2]; |
1854 | | TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; |
1855 | | |
1856 | | const TMatrixCoeff *iT = g_trCoreDST7P32[TRANSFORM_INVERSE][0]; |
1857 | | |
1858 | | const int reducedLine = line - iSkipLine; |
1859 | | |
1860 | | for (j = 0; j < reducedLine; j++) |
1861 | | { |
1862 | | for (k = 0; k < 6; k++) |
1863 | | { |
1864 | | a[0][k] = src[(31 - k)*line] - src[(20 + k)*line]; |
1865 | | a[1][k] = src[(31 - k)*line] + src[(18 - k)*line]; |
1866 | | a[2][k] = src[(31 - k)*line] + src[( 7 + k)*line]; |
1867 | | a[3][k] = src[(31 - k)*line] - src[( 5 - k)*line]; |
1868 | | a[4][k] = src[(25 - k)*line] + src[(13 + k)*line]; |
1869 | | a[5][k] = src[(25 - k)*line] + src[(12 - k)*line]; |
1870 | | a[6][k] = src[(25 - k)*line] - src[ k *line]; |
1871 | | a[7][k] = src[(18 - k)*line] - src[( 7 + k)*line]; |
1872 | | a[8][k] = src[(18 - k)*line] + src[( 5 - k)*line]; |
1873 | | a[9][k] = src[(12 - k)*line] + src[ k *line]; |
1874 | | |
1875 | | b[k] = src[(31 - k)*line] + src[(20 + k)*line] - src[(18 - k)*line] - src[(7 + k)*line] + src[(5 - k)*line]; |
1876 | | } |
1877 | | |
1878 | | for (k = 0; k < 2; k++) |
1879 | | { |
1880 | | c[k] = src[(31 - k)*line] + src[(28 + k)*line] - src[(26 - k)*line] - src[(23 + k)*line] + src[(21 - k)*line] + src[(18 + k)*line] - src[(16 - k)*line] - src[(13 + k)*line] + src[(11 - k)*line] + src[(8 + k)*line] - src[(6 - k)*line] - src[(3 + k)*line] + src[(1 - k)*line]; |
1881 | | } |
1882 | | |
1883 | | t[0] = iT[12] * src[19 * line] + iT[25] * src[ 6 * line]; |
1884 | | t[1] = iT[12] * src[ 6 * line] - iT[25] * src[19 * line]; |
1885 | | |
1886 | | dst[ 0] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[3][0] + iT[11] * a[6][5] + iT[13] * a[8][0] + iT[24] * a[9][5] + iT[1] * a[3][1] + iT[10] * a[6][4] + iT[14] * a[8][1] + iT[23] * a[9][4] + iT[2] * a[3][2] + iT[9] * a[6][3] + iT[15] * a[8][2] + iT[22] * a[9][3] + iT[3] * a[3][3] + iT[8] * a[6][2] + iT[16] * a[8][3] + iT[21] * a[9][2] + iT[4] * a[3][4] + iT[7] * a[6][1] + iT[17] * a[8][4] + iT[20] * a[9][1] + iT[5] * a[3][5] + iT[6] * a[6][0] + iT[18] * a[8][5] + iT[19] * a[9][0] + t[0] + add) >> shift); |
1887 | | dst[ 1] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[5][2] - iT[11] * a[0][3] - iT[13] * a[4][2] - iT[24] * a[6][2] - iT[1] * a[9][1] - iT[10] * a[8][4] - iT[14] * a[3][4] - iT[23] * a[6][1] - iT[2] * a[0][0] + iT[9] * a[5][5] - iT[15] * a[6][5] - iT[22] * a[4][5] + iT[3] * a[5][3] - iT[8] * a[0][2] - iT[16] * a[4][3] - iT[21] * a[6][3] - iT[4] * a[9][0] - iT[7] * a[8][5] - iT[17] * a[3][5] - iT[20] * a[6][0] - iT[5] * a[0][1] + iT[6] * a[5][4] - iT[18] * a[6][4] - iT[19] * a[4][4] + t[1] + add) >> shift); |
1888 | | dst[ 3] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[9][4] + iT[11] * a[5][4] - iT[13] * a[2][1] + iT[24] * a[7][1] + iT[1] * a[0][3] + iT[10] * a[1][3] - iT[14] * a[3][3] - iT[23] * a[2][3] - iT[2] * a[8][5] - iT[9] * a[9][0] - iT[15] * a[6][0] - iT[22] * a[3][5] + iT[3] * a[1][4] + iT[8] * a[0][4] - iT[16] * a[2][4] - iT[21] * a[3][4] + iT[4] * a[5][3] + iT[7] * a[9][3] + iT[17] * a[7][2] - iT[20] * a[2][2] - iT[5] * a[8][0] - iT[6] * a[1][0] + iT[18] * a[4][5] + iT[19] * a[7][0] - t[1] + add) >> shift); |
1889 | | dst[ 4] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[3][2] - iT[11] * a[2][2] + iT[13] * a[1][2] + iT[24] * a[0][2] + iT[1] * a[6][0] + iT[10] * a[3][5] + iT[14] * a[9][0] + iT[23] * a[8][5] - iT[2] * a[2][3] - iT[9] * a[3][3] + iT[15] * a[0][3] + iT[22] * a[1][3] - iT[3] * a[7][0] + iT[8] * a[2][0] - iT[16] * a[9][5] - iT[21] * a[5][5] + iT[4] * a[4][4] + iT[7] * a[6][4] + iT[17] * a[0][1] - iT[20] * a[5][4] - iT[5] * a[7][4] - iT[6] * a[4][1] + iT[18] * a[8][4] + iT[19] * a[1][4] - t[0] + add) >> shift); |
1890 | | dst[ 5] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[3][5] + iT[11] * a[6][0] + iT[13] * a[8][5] + iT[24] * a[9][0] - iT[1] * a[6][5] - iT[10] * a[3][0] - iT[14] * a[9][5] - iT[23] * a[8][0] + iT[2] * a[7][4] - iT[9] * a[2][4] + iT[15] * a[9][1] + iT[22] * a[5][1] + iT[3] * a[7][1] + iT[8] * a[4][4] - iT[16] * a[8][1] - iT[21] * a[1][1] - iT[4] * a[6][2] - iT[7] * a[4][2] + iT[17] * a[5][2] - iT[20] * a[0][3] + iT[5] * a[3][2] + iT[6] * a[2][2] - iT[18] * a[1][2] - iT[19] * a[0][2] - t[0] + add) >> shift); |
1891 | | dst[ 8] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[9][3] + iT[11] * a[8][2] + iT[13] * a[3][2] + iT[24] * a[6][3] + iT[1] * a[1][5] + iT[10] * a[0][5] - iT[14] * a[2][5] - iT[23] * a[3][5] - iT[2] * a[1][3] - iT[9] * a[8][3] + iT[15] * a[7][3] + iT[22] * a[4][2] - iT[3] * a[9][5] - iT[8] * a[5][5] + iT[16] * a[2][0] - iT[21] * a[7][0] - iT[4] * a[1][1] - iT[7] * a[0][1] + iT[17] * a[2][1] + iT[20] * a[3][1] + iT[5] * a[5][1] + iT[6] * a[9][1] + iT[18] * a[7][4] - iT[19] * a[2][4] + t[1] + add) >> shift); |
1892 | | dst[ 9] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[2][1] + iT[11] * a[3][1] - iT[13] * a[0][1] - iT[24] * a[1][1] - iT[1] * a[7][3] + iT[10] * a[2][3] - iT[14] * a[9][2] - iT[23] * a[5][2] - iT[2] * a[4][0] - iT[9] * a[7][5] + iT[15] * a[1][5] + iT[22] * a[8][5] - iT[3] * a[3][4] - iT[8] * a[2][4] + iT[16] * a[1][4] + iT[21] * a[0][4] - iT[4] * a[6][3] - iT[7] * a[3][2] - iT[17] * a[9][3] - iT[20] * a[8][2] - iT[5] * a[4][5] - iT[6] * a[6][5] - iT[18] * a[0][0] + iT[19] * a[5][5] + t[0] + add) >> shift); |
1893 | | dst[10] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[6][1] - iT[11] * a[4][1] + iT[13] * a[5][1] - iT[24] * a[0][4] + iT[1] * a[2][2] - iT[10] * a[7][2] - iT[14] * a[5][3] - iT[23] * a[9][3] + iT[2] * a[6][4] + iT[9] * a[4][4] - iT[15] * a[5][4] + iT[22] * a[0][1] - iT[3] * a[2][5] + iT[8] * a[7][5] + iT[16] * a[5][0] + iT[21] * a[9][0] - iT[4] * a[7][0] - iT[7] * a[4][5] + iT[17] * a[8][0] + iT[20] * a[1][0] + iT[5] * a[4][2] + iT[6] * a[7][3] - iT[18] * a[1][3] - iT[19] * a[8][3] + t[0] + add) >> shift); |
1894 | | dst[11] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[1][3] - iT[11] * a[0][3] + iT[13] * a[2][3] + iT[24] * a[3][3] - iT[1] * a[9][1] - iT[10] * a[5][1] + iT[14] * a[2][4] - iT[23] * a[7][4] - iT[2] * a[8][0] - iT[9] * a[9][5] - iT[15] * a[6][5] - iT[22] * a[3][0] + iT[3] * a[0][2] - iT[8] * a[5][3] + iT[16] * a[6][3] + iT[21] * a[4][3] + iT[4] * a[5][0] - iT[7] * a[0][5] - iT[17] * a[4][0] - iT[20] * a[6][0] + iT[5] * a[9][4] + iT[6] * a[5][4] - iT[18] * a[2][1] + iT[19] * a[7][1] + t[1] + add) >> shift); |
1895 | | dst[13] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[0][0] + iT[11] * a[1][0] - iT[13] * a[3][0] - iT[24] * a[2][0] + iT[1] * a[5][4] - iT[10] * a[0][1] - iT[14] * a[4][4] - iT[23] * a[6][4] - iT[2] * a[9][3] - iT[9] * a[5][3] + iT[15] * a[2][2] - iT[22] * a[7][2] + iT[3] * a[8][3] + iT[8] * a[9][2] + iT[16] * a[6][2] + iT[21] * a[3][3] - iT[4] * a[1][4] - iT[7] * a[8][4] + iT[17] * a[7][4] + iT[20] * a[4][1] + iT[5] * a[0][5] + iT[6] * a[1][5] - iT[18] * a[3][5] - iT[19] * a[2][5] - t[1] + add) >> shift); |
1896 | | dst[14] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[4][2] + iT[11] * a[7][3] - iT[13] * a[1][3] - iT[24] * a[8][3] + iT[1] * a[4][1] + iT[10] * a[6][1] + iT[14] * a[0][4] - iT[23] * a[5][1] - iT[2] * a[3][0] - iT[9] * a[2][0] + iT[15] * a[1][0] + iT[22] * a[0][0] - iT[3] * a[6][3] - iT[8] * a[4][3] + iT[16] * a[5][3] - iT[21] * a[0][2] - iT[4] * a[7][5] - iT[7] * a[4][0] + iT[17] * a[8][5] + iT[20] * a[1][5] + iT[5] * a[6][4] + iT[6] * a[3][1] + iT[18] * a[9][4] + iT[19] * a[8][1] - t[0] + add) >> shift); |
1897 | | dst[15] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[7][4] + iT[11] * a[4][1] - iT[13] * a[8][4] - iT[24] * a[1][4] - iT[1] * a[2][2] - iT[10] * a[3][2] + iT[14] * a[0][2] + iT[23] * a[1][2] - iT[2] * a[2][1] + iT[9] * a[7][1] + iT[15] * a[5][4] + iT[22] * a[9][4] + iT[3] * a[7][5] - iT[8] * a[2][5] + iT[16] * a[9][0] + iT[21] * a[5][0] + iT[4] * a[2][0] + iT[7] * a[3][0] - iT[17] * a[0][0] - iT[20] * a[1][0] + iT[5] * a[2][3] - iT[6] * a[7][3] - iT[18] * a[5][2] - iT[19] * a[9][2] - t[0] + add) >> shift); |
1898 | | dst[16] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[0][1] + iT[11] * a[5][4] - iT[13] * a[6][4] - iT[24] * a[4][4] + iT[1] * a[0][3] - iT[10] * a[5][2] + iT[14] * a[6][2] + iT[23] * a[4][2] - iT[2] * a[0][5] + iT[9] * a[5][0] - iT[15] * a[6][0] - iT[22] * a[4][0] - iT[3] * a[0][4] - iT[8] * a[1][4] + iT[16] * a[3][4] + iT[21] * a[2][4] + iT[4] * a[0][2] + iT[7] * a[1][2] - iT[17] * a[3][2] - iT[20] * a[2][2] - iT[5] * a[0][0] - iT[6] * a[1][0] + iT[18] * a[3][0] + iT[19] * a[2][0] - t[1] + add) >> shift); |
1899 | | dst[18] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[0][5] + iT[11] * a[1][5] - iT[13] * a[3][5] - iT[24] * a[2][5] - iT[1] * a[1][0] - iT[10] * a[0][0] + iT[14] * a[2][0] + iT[23] * a[3][0] - iT[2] * a[5][1] + iT[9] * a[0][4] + iT[15] * a[4][1] + iT[22] * a[6][1] - iT[3] * a[8][1] - iT[8] * a[1][1] + iT[16] * a[4][4] + iT[21] * a[7][1] - iT[4] * a[9][2] - iT[7] * a[5][2] + iT[17] * a[2][3] - iT[20] * a[7][3] - iT[5] * a[9][3] - iT[6] * a[8][2] - iT[18] * a[3][2] - iT[19] * a[6][3] + t[1] + add) >> shift); |
1900 | | dst[20] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[4][0] - iT[11] * a[6][0] - iT[13] * a[0][5] + iT[24] * a[5][0] + iT[1] * a[6][5] + iT[10] * a[4][5] - iT[14] * a[5][5] + iT[23] * a[0][0] - iT[2] * a[6][1] - iT[9] * a[3][4] - iT[15] * a[9][1] - iT[22] * a[8][4] + iT[3] * a[4][4] + iT[8] * a[7][1] - iT[16] * a[1][1] - iT[21] * a[8][1] - iT[4] * a[3][3] - iT[7] * a[2][3] + iT[17] * a[1][3] + iT[20] * a[0][3] + iT[5] * a[7][2] - iT[6] * a[2][2] + iT[18] * a[9][3] + iT[19] * a[5][3] + t[0] + add) >> shift); |
1901 | | dst[21] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[1][2] + iT[11] * a[8][2] - iT[13] * a[7][2] - iT[24] * a[4][3] + iT[1] * a[1][5] + iT[10] * a[8][5] - iT[14] * a[7][5] - iT[23] * a[4][0] + iT[2] * a[5][2] + iT[9] * a[9][2] + iT[15] * a[7][3] - iT[22] * a[2][3] + iT[3] * a[5][5] + iT[8] * a[9][5] + iT[16] * a[7][0] - iT[21] * a[2][0] + iT[4] * a[8][1] + iT[7] * a[9][4] + iT[17] * a[6][4] + iT[20] * a[3][1] + iT[5] * a[8][4] + iT[6] * a[9][1] + iT[18] * a[6][1] + iT[19] * a[3][4] + t[1] + add) >> shift); |
1902 | | dst[23] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[8][4] + iT[11] * a[9][1] + iT[13] * a[6][1] + iT[24] * a[3][4] - iT[1] * a[8][2] - iT[10] * a[1][2] + iT[14] * a[4][3] + iT[23] * a[7][2] - iT[2] * a[0][1] - iT[9] * a[1][1] + iT[15] * a[3][1] + iT[22] * a[2][1] + iT[3] * a[5][0] + iT[8] * a[9][0] + iT[16] * a[7][5] - iT[21] * a[2][5] - iT[4] * a[9][5] - iT[7] * a[8][0] - iT[17] * a[3][0] - iT[20] * a[6][5] + iT[5] * a[5][2] - iT[6] * a[0][3] - iT[18] * a[4][2] - iT[19] * a[6][2] - t[1] + add) >> shift); |
1903 | | dst[24] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[2][3] + iT[11] * a[7][3] + iT[13] * a[5][2] + iT[24] * a[9][2] + iT[1] * a[4][1] + iT[10] * a[7][4] - iT[14] * a[1][4] - iT[23] * a[8][4] - iT[2] * a[4][5] - iT[9] * a[7][0] + iT[15] * a[1][0] + iT[22] * a[8][0] + iT[3] * a[4][3] + iT[8] * a[6][3] + iT[16] * a[0][2] - iT[21] * a[5][3] - iT[4] * a[2][5] - iT[7] * a[3][5] + iT[17] * a[0][5] + iT[20] * a[1][5] + iT[5] * a[2][1] + iT[6] * a[3][1] - iT[18] * a[0][1] - iT[19] * a[1][1] - t[0] + add) >> shift); |
1904 | | dst[25] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[4][5] - iT[11] * a[6][5] - iT[13] * a[0][0] + iT[24] * a[5][5] - iT[1] * a[3][1] - iT[10] * a[2][1] + iT[14] * a[1][1] + iT[23] * a[0][1] + iT[2] * a[7][2] + iT[9] * a[4][3] - iT[15] * a[8][2] - iT[22] * a[1][2] + iT[3] * a[6][2] + iT[8] * a[3][3] + iT[16] * a[9][2] + iT[21] * a[8][3] + iT[4] * a[2][4] - iT[7] * a[7][4] - iT[17] * a[5][1] - iT[20] * a[9][1] - iT[5] * a[4][0] - iT[6] * a[6][0] - iT[18] * a[0][5] + iT[19] * a[5][0] - t[0] + add) >> shift); |
1905 | | dst[26] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[8][0] + iT[11] * a[1][0] - iT[13] * a[4][5] - iT[24] * a[7][0] + iT[1] * a[5][4] + iT[10] * a[9][4] + iT[14] * a[7][1] - iT[23] * a[2][1] - iT[2] * a[1][2] - iT[9] * a[0][2] + iT[15] * a[2][2] + iT[22] * a[3][2] - iT[3] * a[9][2] - iT[8] * a[8][3] - iT[16] * a[3][3] - iT[21] * a[6][2] + iT[4] * a[0][4] - iT[7] * a[5][1] + iT[17] * a[6][1] + iT[20] * a[4][1] + iT[5] * a[8][5] + iT[6] * a[1][5] - iT[18] * a[4][0] - iT[19] * a[7][5] - t[1] + add) >> shift); |
1906 | | dst[28] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[5][1] - iT[11] * a[9][1] - iT[13] * a[7][4] + iT[24] * a[2][4] + iT[1] * a[8][2] + iT[10] * a[9][3] + iT[14] * a[6][3] + iT[23] * a[3][2] - iT[2] * a[9][4] - iT[9] * a[8][1] - iT[15] * a[3][1] - iT[22] * a[6][4] + iT[3] * a[9][0] + iT[8] * a[5][0] - iT[16] * a[2][5] + iT[21] * a[7][5] - iT[4] * a[5][5] + iT[7] * a[0][0] + iT[17] * a[4][5] + iT[20] * a[6][5] + iT[5] * a[1][3] + iT[6] * a[0][3] - iT[18] * a[2][3] - iT[19] * a[3][3] + t[1] + add) >> shift); |
1907 | | dst[29] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[6][4] + iT[11] * a[3][1] + iT[13] * a[9][4] + iT[24] * a[8][1] - iT[1] * a[7][3] - iT[10] * a[4][2] + iT[14] * a[8][3] + iT[23] * a[1][3] - iT[2] * a[3][5] - iT[9] * a[2][5] + iT[15] * a[1][5] + iT[22] * a[0][5] + iT[3] * a[2][4] + iT[8] * a[3][4] - iT[16] * a[0][4] - iT[21] * a[1][4] + iT[4] * a[4][3] + iT[7] * a[7][2] - iT[17] * a[1][2] - iT[20] * a[8][2] - iT[5] * a[3][0] - iT[6] * a[6][5] - iT[18] * a[8][0] - iT[19] * a[9][5] + t[0] + add) >> shift); |
1908 | | dst[30] = Clip3(outputMinimum, outputMaximum, (int)( - iT[0] * a[7][2] + iT[11] * a[2][2] - iT[13] * a[9][3] - iT[24] * a[5][3] - iT[1] * a[6][0] - iT[10] * a[4][0] + iT[14] * a[5][0] - iT[23] * a[0][5] - iT[2] * a[4][2] - iT[9] * a[6][2] - iT[15] * a[0][3] + iT[22] * a[5][2] + iT[3] * a[2][0] - iT[8] * a[7][0] - iT[16] * a[5][5] - iT[21] * a[9][5] + iT[4] * a[7][1] - iT[7] * a[2][1] + iT[17] * a[9][4] + iT[20] * a[5][4] + iT[5] * a[6][1] + iT[6] * a[4][1] - iT[18] * a[5][1] + iT[19] * a[0][4] + t[0] + add) >> shift); |
1909 | | dst[31] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[8][5] + iT[11] * a[1][5] - iT[13] * a[4][0] - iT[24] * a[7][5] - iT[1] * a[1][0] - iT[10] * a[8][0] + iT[14] * a[7][0] + iT[23] * a[4][5] - iT[2] * a[8][4] - iT[9] * a[1][4] + iT[15] * a[4][1] + iT[22] * a[7][4] + iT[3] * a[1][1] + iT[8] * a[8][1] - iT[16] * a[7][1] - iT[21] * a[4][4] + iT[4] * a[8][3] + iT[7] * a[1][3] - iT[17] * a[4][2] - iT[20] * a[7][3] - iT[5] * a[1][2] - iT[6] * a[8][2] + iT[18] * a[7][2] + iT[19] * a[4][3] + t[1] + add) >> shift); |
1910 | | |
1911 | | dst[ 2] = Clip3(outputMinimum, outputMaximum, (int)( iT[ 4] * b[0] + iT[ 9] * b[1] + iT[14] * b[2] + iT[19] * b[3] + iT[24] * b[4] + iT[29] * b[5] + add) >> shift); |
1912 | | dst[ 7] = Clip3(outputMinimum, outputMaximum, (int)( - iT[14] * b[0] - iT[29] * b[1] - iT[19] * b[2] - iT[ 4] * b[3] + iT[ 9] * b[4] + iT[24] * b[5] + add) >> shift); |
1913 | | dst[12] = Clip3(outputMinimum, outputMaximum, (int)( iT[24] * b[0] + iT[14] * b[1] - iT[ 9] * b[2] - iT[29] * b[3] - iT[ 4] * b[4] + iT[19] * b[5] + add) >> shift); |
1914 | | dst[17] = Clip3(outputMinimum, outputMaximum, (int)( - iT[29] * b[0] + iT[ 4] * b[1] + iT[24] * b[2] - iT[ 9] * b[3] - iT[19] * b[4] + iT[14] * b[5] + add) >> shift); |
1915 | | dst[22] = Clip3(outputMinimum, outputMaximum, (int)( iT[19] * b[0] - iT[24] * b[1] + iT[ 4] * b[2] + iT[14] * b[3] - iT[29] * b[4] + iT[ 9] * b[5] + add) >> shift); |
1916 | | dst[27] = Clip3(outputMinimum, outputMaximum, (int)( - iT[ 9] * b[0] + iT[19] * b[1] - iT[29] * b[2] + iT[24] * b[3] - iT[14] * b[4] + iT[ 4] * b[5] + add) >> shift); |
1917 | | |
1918 | | dst[ 6] = Clip3(outputMinimum, outputMaximum, (int)( iT[12] * c[0] + iT[25] * c[1] + add) >> shift); |
1919 | | dst[19] = Clip3(outputMinimum, outputMaximum, (int)( - iT[25] * c[0] + iT[12] * c[1] + add) >> shift); |
1920 | | |
1921 | | src++; |
1922 | | dst += 32; |
1923 | | } |
1924 | | |
1925 | | if (iSkipLine) |
1926 | | { |
1927 | | memset(dst, 0, (iSkipLine * 32) * sizeof(TCoeff)); |
1928 | | } |
1929 | | #else |
1930 | 0 | _fastInverseMM< 32 >( src, dst, shift, line, iSkipLine, iSkipLine2, outputMinimum, outputMaximum, g_trCoreDCT8P32[TRANSFORM_INVERSE][0] ); |
1931 | 0 | #endif |
1932 | 0 | } |
1933 | | |
1934 | | #if ENABLE_SIMD_TRAFO |
1935 | | |
1936 | | #define DONT_UNDEF_SIZE_AWARE_PER_EL_OP 1 |
1937 | | |
1938 | | } // namespace vvenc |
1939 | | |
1940 | | #include "Unit.h" |
1941 | | |
1942 | | namespace vvenc { |
1943 | | |
1944 | | void cpyCoeffCore( const Pel* src, ptrdiff_t stride, TCoeff* dst, unsigned width, unsigned height ) |
1945 | 2.54M | { |
1946 | 840M | #define CPYCOEFF_OP( ADDR ) dst[ADDR] = src[ADDR]; |
1947 | 2.54M | #define CPYCOEFF_INC src += stride; dst += width; |
1948 | | |
1949 | 840M | SIZE_AWARE_PER_EL_OP( CPYCOEFF_OP, CPYCOEFF_INC ); |
1950 | | |
1951 | 2.54M | #undef CPYCOEFF_INC |
1952 | 2.54M | #undef CPYCOEFF_OP |
1953 | 2.54M | } |
1954 | | |
1955 | | |
1956 | | void cpyResiCore( const TCoeff* src, Pel* dst, ptrdiff_t stride, unsigned width, unsigned height ) |
1957 | 1.03M | { |
1958 | 229M | #define CPYRESI_OP( ADDR ) dst[ADDR] = Pel( src[ADDR] ); |
1959 | 1.03M | #define CPYRESI_INC dst += stride; src += width; |
1960 | | |
1961 | 229M | SIZE_AWARE_PER_EL_OP( CPYRESI_OP, CPYRESI_INC ); |
1962 | | |
1963 | 1.03M | #undef CPYRESI_INC |
1964 | 1.03M | #undef CPYRESI_OP |
1965 | 1.03M | } |
1966 | | |
1967 | | |
1968 | | void clipCore( TCoeff *dst, unsigned width, unsigned height, unsigned stride, const TCoeff outputMin, const TCoeff outputMax, const TCoeff round, const TCoeff shift ) |
1969 | 885k | { |
1970 | 287M | #define CLIP_OP( ADDR ) dst[ADDR] = Clip3( outputMin, outputMax, ( dst[ADDR] + round ) >> shift ) |
1971 | 885k | #define CLIP_INC dst += stride |
1972 | | |
1973 | 287M | SIZE_AWARE_PER_EL_OP( CLIP_OP, CLIP_INC ); |
1974 | | |
1975 | 885k | #undef CLIP_INC |
1976 | 885k | #undef CLIP_OP |
1977 | 885k | } |
1978 | | |
1979 | | |
1980 | | template<unsigned trSize> |
1981 | | void fastInvCore_( const TMatrixCoeff* it, const TCoeff* src, TCoeff* dst, unsigned lines, unsigned reducedLines, unsigned rows ) |
1982 | 885k | { |
1983 | 11.6M | for( int k = 0; k < rows; k++ ) |
1984 | 10.8M | { |
1985 | 10.8M | const TCoeff* srcPtr = &src[k * lines]; |
1986 | 169M | for( int i = 0; i < reducedLines; i++ ) |
1987 | 158M | { |
1988 | 158M | TCoeff* dstPtr = &dst[i * trSize]; |
1989 | 158M | const TMatrixCoeff* itPtr = &it[k * trSize]; |
1990 | 4.55G | for( int j = 0; j < trSize; j++ ) |
1991 | 4.39G | { |
1992 | 4.39G | *dstPtr++ += *srcPtr * *itPtr++; |
1993 | 4.39G | } |
1994 | 158M | srcPtr++; |
1995 | 158M | } |
1996 | 10.8M | } |
1997 | 885k | } void vvenc::fastInvCore_<4u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int) Line | Count | Source | 1982 | 2.02k | { | 1983 | 10.1k | for( int k = 0; k < rows; k++ ) | 1984 | 8.08k | { | 1985 | 8.08k | const TCoeff* srcPtr = &src[k * lines]; | 1986 | 156k | for( int i = 0; i < reducedLines; i++ ) | 1987 | 148k | { | 1988 | 148k | TCoeff* dstPtr = &dst[i * trSize]; | 1989 | 148k | const TMatrixCoeff* itPtr = &it[k * trSize]; | 1990 | 743k | for( int j = 0; j < trSize; j++ ) | 1991 | 594k | { | 1992 | 594k | *dstPtr++ += *srcPtr * *itPtr++; | 1993 | 594k | } | 1994 | 148k | srcPtr++; | 1995 | 148k | } | 1996 | 8.08k | } | 1997 | 2.02k | } |
void vvenc::fastInvCore_<8u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int) Line | Count | Source | 1982 | 1.28k | { | 1983 | 11.5k | for( int k = 0; k < rows; k++ ) | 1984 | 10.2k | { | 1985 | 10.2k | const TCoeff* srcPtr = &src[k * lines]; | 1986 | 237k | for( int i = 0; i < reducedLines; i++ ) | 1987 | 227k | { | 1988 | 227k | TCoeff* dstPtr = &dst[i * trSize]; | 1989 | 227k | const TMatrixCoeff* itPtr = &it[k * trSize]; | 1990 | 2.04M | for( int j = 0; j < trSize; j++ ) | 1991 | 1.81M | { | 1992 | 1.81M | *dstPtr++ += *srcPtr * *itPtr++; | 1993 | 1.81M | } | 1994 | 227k | srcPtr++; | 1995 | 227k | } | 1996 | 10.2k | } | 1997 | 1.28k | } |
void vvenc::fastInvCore_<16u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int) Line | Count | Source | 1982 | 579k | { | 1983 | 6.49M | for( int k = 0; k < rows; k++ ) | 1984 | 5.91M | { | 1985 | 5.91M | const TCoeff* srcPtr = &src[k * lines]; | 1986 | 82.5M | for( int i = 0; i < reducedLines; i++ ) | 1987 | 76.6M | { | 1988 | 76.6M | TCoeff* dstPtr = &dst[i * trSize]; | 1989 | 76.6M | const TMatrixCoeff* itPtr = &it[k * trSize]; | 1990 | 1.30G | for( int j = 0; j < trSize; j++ ) | 1991 | 1.22G | { | 1992 | 1.22G | *dstPtr++ += *srcPtr * *itPtr++; | 1993 | 1.22G | } | 1994 | 76.6M | srcPtr++; | 1995 | 76.6M | } | 1996 | 5.91M | } | 1997 | 579k | } |
void vvenc::fastInvCore_<32u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int) Line | Count | Source | 1982 | 275k | { | 1983 | 4.70M | for( int k = 0; k < rows; k++ ) | 1984 | 4.43M | { | 1985 | 4.43M | const TCoeff* srcPtr = &src[k * lines]; | 1986 | 68.5M | for( int i = 0; i < reducedLines; i++ ) | 1987 | 64.1M | { | 1988 | 64.1M | TCoeff* dstPtr = &dst[i * trSize]; | 1989 | 64.1M | const TMatrixCoeff* itPtr = &it[k * trSize]; | 1990 | 2.11G | for( int j = 0; j < trSize; j++ ) | 1991 | 2.05G | { | 1992 | 2.05G | *dstPtr++ += *srcPtr * *itPtr++; | 1993 | 2.05G | } | 1994 | 64.1M | srcPtr++; | 1995 | 64.1M | } | 1996 | 4.43M | } | 1997 | 275k | } |
void vvenc::fastInvCore_<64u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int) Line | Count | Source | 1982 | 26.8k | { | 1983 | 473k | for( int k = 0; k < rows; k++ ) | 1984 | 446k | { | 1985 | 446k | const TCoeff* srcPtr = &src[k * lines]; | 1986 | 17.8M | for( int i = 0; i < reducedLines; i++ ) | 1987 | 17.4M | { | 1988 | 17.4M | TCoeff* dstPtr = &dst[i * trSize]; | 1989 | 17.4M | const TMatrixCoeff* itPtr = &it[k * trSize]; | 1990 | 1.13G | for( int j = 0; j < trSize; j++ ) | 1991 | 1.11G | { | 1992 | 1.11G | *dstPtr++ += *srcPtr * *itPtr++; | 1993 | 1.11G | } | 1994 | 17.4M | srcPtr++; | 1995 | 17.4M | } | 1996 | 446k | } | 1997 | 26.8k | } |
|
1998 | | |
1999 | | |
2000 | | template<unsigned trSize> |
2001 | | void fastFwdCore( const TMatrixCoeff* tc, const TCoeff* src, TCoeff* dst, unsigned line, unsigned reducedLine, unsigned cutoff, int shift ) |
2002 | 3.87M | { |
2003 | 3.87M | const int rnd_factor = 1 << ( shift - 1 ); |
2004 | | |
2005 | 58.9M | for( int i = 0; i < reducedLine; i++ ) |
2006 | 55.0M | { |
2007 | 55.0M | TCoeff* dstPtr = dst; |
2008 | 55.0M | const TMatrixCoeff* iT = tc; |
2009 | | |
2010 | 831M | for( int j = 0; j < cutoff; j++ ) |
2011 | 776M | { |
2012 | 776M | int sum = 0; |
2013 | | |
2014 | 23.3G | for( int k = 0; k < trSize; k++ ) |
2015 | 22.5G | { |
2016 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] |
2017 | 22.5G | sum += src[k] * iT[k]; |
2018 | 22.5G | } |
2019 | | |
2020 | 776M | dstPtr[i] = ( sum + rnd_factor ) >> shift; |
2021 | 776M | dstPtr += line; |
2022 | 776M | iT += trSize; |
2023 | 776M | } |
2024 | | |
2025 | 55.0M | src += trSize; |
2026 | 55.0M | } |
2027 | 3.87M | } Unexecuted instantiation: void vvenc::fastFwdCore<4u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int, int) void vvenc::fastFwdCore<8u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int, int) Line | Count | Source | 2002 | 1.36M | { | 2003 | 1.36M | const int rnd_factor = 1 << ( shift - 1 ); | 2004 | | | 2005 | 17.8M | for( int i = 0; i < reducedLine; i++ ) | 2006 | 16.5M | { | 2007 | 16.5M | TCoeff* dstPtr = dst; | 2008 | 16.5M | const TMatrixCoeff* iT = tc; | 2009 | | | 2010 | 146M | for( int j = 0; j < cutoff; j++ ) | 2011 | 129M | { | 2012 | 129M | int sum = 0; | 2013 | | | 2014 | 1.16G | for( int k = 0; k < trSize; k++ ) | 2015 | 1.03G | { | 2016 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 2017 | 1.03G | sum += src[k] * iT[k]; | 2018 | 1.03G | } | 2019 | | | 2020 | 129M | dstPtr[i] = ( sum + rnd_factor ) >> shift; | 2021 | 129M | dstPtr += line; | 2022 | 129M | iT += trSize; | 2023 | 129M | } | 2024 | | | 2025 | 16.5M | src += trSize; | 2026 | 16.5M | } | 2027 | 1.36M | } |
void vvenc::fastFwdCore<16u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int, int) Line | Count | Source | 2002 | 1.25M | { | 2003 | 1.25M | const int rnd_factor = 1 << ( shift - 1 ); | 2004 | | | 2005 | 17.7M | for( int i = 0; i < reducedLine; i++ ) | 2006 | 16.4M | { | 2007 | 16.4M | TCoeff* dstPtr = dst; | 2008 | 16.4M | const TMatrixCoeff* iT = tc; | 2009 | | | 2010 | 205M | for( int j = 0; j < cutoff; j++ ) | 2011 | 188M | { | 2012 | 188M | int sum = 0; | 2013 | | | 2014 | 3.20G | for( int k = 0; k < trSize; k++ ) | 2015 | 3.01G | { | 2016 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 2017 | 3.01G | sum += src[k] * iT[k]; | 2018 | 3.01G | } | 2019 | | | 2020 | 188M | dstPtr[i] = ( sum + rnd_factor ) >> shift; | 2021 | 188M | dstPtr += line; | 2022 | 188M | iT += trSize; | 2023 | 188M | } | 2024 | | | 2025 | 16.4M | src += trSize; | 2026 | 16.4M | } | 2027 | 1.25M | } |
void vvenc::fastFwdCore<32u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int, int) Line | Count | Source | 2002 | 1.13M | { | 2003 | 1.13M | const int rnd_factor = 1 << ( shift - 1 ); | 2004 | | | 2005 | 18.1M | for( int i = 0; i < reducedLine; i++ ) | 2006 | 17.0M | { | 2007 | 17.0M | TCoeff* dstPtr = dst; | 2008 | 17.0M | const TMatrixCoeff* iT = tc; | 2009 | | | 2010 | 353M | for( int j = 0; j < cutoff; j++ ) | 2011 | 336M | { | 2012 | 336M | int sum = 0; | 2013 | | | 2014 | 11.0G | for( int k = 0; k < trSize; k++ ) | 2015 | 10.7G | { | 2016 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 2017 | 10.7G | sum += src[k] * iT[k]; | 2018 | 10.7G | } | 2019 | | | 2020 | 336M | dstPtr[i] = ( sum + rnd_factor ) >> shift; | 2021 | 336M | dstPtr += line; | 2022 | 336M | iT += trSize; | 2023 | 336M | } | 2024 | | | 2025 | 17.0M | src += trSize; | 2026 | 17.0M | } | 2027 | 1.13M | } |
void vvenc::fastFwdCore<64u>(short const*, int const*, int*, unsigned int, unsigned int, unsigned int, int) Line | Count | Source | 2002 | 121k | { | 2003 | 121k | const int rnd_factor = 1 << ( shift - 1 ); | 2004 | | | 2005 | 5.15M | for( int i = 0; i < reducedLine; i++ ) | 2006 | 5.02M | { | 2007 | 5.02M | TCoeff* dstPtr = dst; | 2008 | 5.02M | const TMatrixCoeff* iT = tc; | 2009 | | | 2010 | 126M | for( int j = 0; j < cutoff; j++ ) | 2011 | 121M | { | 2012 | 121M | int sum = 0; | 2013 | | | 2014 | 7.91G | for( int k = 0; k < trSize; k++ ) | 2015 | 7.79G | { | 2016 | | // dst[j * line + i] += src[i * trSize + k] * t[j * trSize + k] | 2017 | 7.79G | sum += src[k] * iT[k]; | 2018 | 7.79G | } | 2019 | | | 2020 | 121M | dstPtr[i] = ( sum + rnd_factor ) >> shift; | 2021 | 121M | dstPtr += line; | 2022 | 121M | iT += trSize; | 2023 | 121M | } | 2024 | | | 2025 | 5.02M | src += trSize; | 2026 | 5.02M | } | 2027 | 121k | } |
|
2028 | | |
2029 | | |
2030 | | TCoeffOps::TCoeffOps() |
2031 | 14 | { |
2032 | 14 | cpyResi4 = cpyResiCore; |
2033 | 14 | cpyResi8 = cpyResiCore; |
2034 | 14 | cpyCoeff4 = cpyCoeffCore; |
2035 | 14 | cpyCoeff8 = cpyCoeffCore; |
2036 | 14 | roundClip4 = clipCore; |
2037 | 14 | roundClip8 = clipCore; |
2038 | 14 | fastInvCore[0] = fastInvCore_< 4>; |
2039 | 14 | fastInvCore[1] = fastInvCore_< 8>; |
2040 | 14 | fastInvCore[2] = fastInvCore_<16>; |
2041 | 14 | fastInvCore[3] = fastInvCore_<32>; |
2042 | 14 | fastInvCore[4] = fastInvCore_<64>; |
2043 | 14 | fastFwdCore_1D[0] = fastFwdCore< 4>; |
2044 | 14 | fastFwdCore_1D[1] = fastFwdCore< 8>; |
2045 | 14 | fastFwdCore_1D[2] = fastFwdCore<16>; |
2046 | 14 | fastFwdCore_1D[3] = fastFwdCore<32>; |
2047 | 14 | fastFwdCore_1D[4] = fastFwdCore<64>; |
2048 | 14 | fastFwdCore_2D[0] = fastFwdCore< 4>; |
2049 | 14 | fastFwdCore_2D[1] = fastFwdCore< 8>; |
2050 | 14 | fastFwdCore_2D[2] = fastFwdCore<16>; |
2051 | 14 | fastFwdCore_2D[3] = fastFwdCore<32>; |
2052 | 14 | fastFwdCore_2D[4] = fastFwdCore<64>; |
2053 | 14 | fastInvDCT2[0] = fastInverseDCT2_B2_Core; |
2054 | 14 | fastInvDCT2[1] = fastInverseDCT2_B4_Core; |
2055 | 14 | fastInvDCT2[2] = fastInverseDCT2_B8_Core; |
2056 | 14 | fastFwdDCT2[0] = fastForwardDCT2_B2_Core; |
2057 | 14 | fastFwdDCT2[1] = fastForwardDCT2_B4_Core; |
2058 | 14 | fastFwdDST7_4 = fastForwardDST7_B4_Core; |
2059 | 14 | fastFwdDCT8_4 = fastForwardDCT8_B4_Core; |
2060 | 14 | } |
2061 | | |
2062 | | void TCoeffOps::initTCoeffOps( bool enableOpt ) |
2063 | 0 | { |
2064 | 0 | if( enableOpt ) |
2065 | 0 | { |
2066 | | # if defined( TARGET_SIMD_X86 ) && ENABLE_SIMD_TRAFO |
2067 | | initTCoeffOpsX86(); |
2068 | | # endif |
2069 | | # if defined( TARGET_SIMD_ARM ) && ENABLE_SIMD_TRAFO |
2070 | | initTCoeffOpsARM(); |
2071 | | # endif |
2072 | 0 | } |
2073 | 0 | } |
2074 | | |
2075 | | TCoeffOps g_tCoeffOps; |
2076 | | |
2077 | | #endif |
2078 | | |
2079 | | |
2080 | | } // namespace vvenc |
2081 | | |
2082 | | //! \} |
2083 | | |