Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2026 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : #include <stdint.h>
34 : #include "options.h"
35 : #include <math.h>
36 : #include "prot.h"
37 : #include "isar_prot.h"
38 : #include "isar_lcld_prot.h"
39 : #include "isar_rom_lcld_tables.h"
40 : #include "wmc_auto.h"
41 :
42 :
43 : /*-------------------------------------------------------------------*
44 : * Function CreatePredictionDecoder()
45 : *
46 : *
47 : *-------------------------------------------------------------------*/
48 :
49 715 : ivas_error CreatePredictionDecoder(
50 : PredictionDecoder **psPredictionDecoder_out,
51 : const int32_t iChannels,
52 : const int32_t iNumBlocks )
53 : {
54 : int16_t n;
55 : int16_t m;
56 715 : PredictionDecoder *psPredictionDecoder = NULL;
57 :
58 715 : if ( ( psPredictionDecoder = (PredictionDecoder *) malloc( sizeof( PredictionDecoder ) ) ) == NULL )
59 : {
60 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
61 : }
62 :
63 715 : psPredictionDecoder->iChannels = iChannels;
64 715 : psPredictionDecoder->iNumBlocks = iNumBlocks;
65 715 : psPredictionDecoder->iNumSubSets = LCLD_BLOCKS_PER_FRAME / psPredictionDecoder->iNumBlocks;
66 715 : psPredictionDecoder->iSubSetId = 0;
67 :
68 : /* PLC_IMPROVEMENT */
69 715 : if ( ( psPredictionDecoder->ppiDecodingFailedPrev = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
70 : {
71 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
72 : }
73 715 : if ( ( psPredictionDecoder->ppiDecodingFailed = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
74 : {
75 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
76 : }
77 715 : if ( ( psPredictionDecoder->ppiDecodingUnresolved = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
78 : {
79 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
80 : }
81 :
82 2145 : for ( n = 0; n < iChannels; n++ )
83 : {
84 : int32_t k;
85 1430 : if ( ( psPredictionDecoder->ppiDecodingUnresolved[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_MAX_NUM_PRED_SUBSETS ) ) == NULL )
86 : {
87 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
88 : }
89 1430 : if ( ( psPredictionDecoder->ppiDecodingFailed[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_MAX_NUM_PRED_SUBSETS ) ) == NULL )
90 : {
91 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
92 : }
93 1430 : if ( ( psPredictionDecoder->ppiDecodingFailedPrev[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_MAX_NUM_PRED_SUBSETS ) ) == NULL )
94 : {
95 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
96 : }
97 12870 : for ( k = 0; k < LCLD_MAX_NUM_PRED_SUBSETS; k++ )
98 : {
99 11440 : psPredictionDecoder->ppiDecodingUnresolved[n][k] = 0;
100 11440 : psPredictionDecoder->ppiDecodingFailed[n][k] = 0;
101 11440 : psPredictionDecoder->ppiDecodingFailedPrev[n][k] = 0;
102 : }
103 : }
104 :
105 715 : if ( ( psPredictionDecoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL )
106 : {
107 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
108 : }
109 715 : if ( ( psPredictionDecoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
110 : {
111 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
112 : }
113 715 : if ( ( psPredictionDecoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
114 : {
115 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
116 : }
117 715 : if ( ( psPredictionDecoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
118 : {
119 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
120 : }
121 715 : if ( ( psPredictionDecoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
122 : {
123 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
124 : }
125 715 : if ( ( psPredictionDecoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
126 : {
127 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
128 : }
129 715 : if ( ( psPredictionDecoder->ppfPredStateReal = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
130 : {
131 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
132 : }
133 715 : if ( ( psPredictionDecoder->ppfPredStateImag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
134 : {
135 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
136 : }
137 :
138 2145 : for ( n = 0; n < psPredictionDecoder->iChannels; n++ )
139 : {
140 1430 : psPredictionDecoder->piPredChanEnable[n] = 0;
141 1430 : if ( ( psPredictionDecoder->ppiPredBandEnable[n] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
142 : {
143 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
144 : }
145 87230 : for ( m = 0; m < LCLD_BANDS; m++ )
146 : {
147 85800 : psPredictionDecoder->ppiPredBandEnable[n][m] = 0;
148 : }
149 1430 : if ( ( psPredictionDecoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
150 : {
151 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
152 : }
153 1430 : if ( ( psPredictionDecoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
154 : {
155 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
156 : }
157 1430 : if ( ( psPredictionDecoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
158 : {
159 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
160 : }
161 1430 : if ( ( psPredictionDecoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
162 : {
163 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
164 : }
165 1430 : if ( ( psPredictionDecoder->ppfPredStateReal[n] = (float *) malloc( LCLD_BANDS * sizeof( float ) ) ) == NULL )
166 : {
167 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionDecoder Module \n" ) );
168 : }
169 1430 : if ( ( psPredictionDecoder->ppfPredStateImag[n] = (float *) malloc( LCLD_BANDS * sizeof( float ) ) ) == NULL )
170 : {
171 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionDecoder Module \n" ) );
172 : }
173 87230 : for ( m = 0; m < LCLD_BANDS; m++ )
174 : {
175 85800 : psPredictionDecoder->ppfPredStateReal[n][m] = 0;
176 85800 : psPredictionDecoder->ppfPredStateImag[n][m] = 0;
177 : }
178 : }
179 :
180 : /* pre-define these tables? */
181 6435 : for ( n = 0; n < ( 1 << PRED_QUNAT_FILTER_MAG_BITS ); n++ )
182 : {
183 5720 : const float fInvMagScale = M_PI / ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f );
184 5720 : psPredictionDecoder->pfMagLUT[n] = sinf( fInvMagScale * (float) n );
185 : }
186 :
187 23595 : for ( n = 0; n < ( 1 << PRED_QUANT_FILTER_PHASE_BITS ); n++ )
188 : {
189 22880 : const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) );
190 : int16_t iVal;
191 :
192 22880 : iVal = n + PRED_QUANT_FILTER_PHASE_MIN;
193 22880 : psPredictionDecoder->pfP2RRealLUT[n] = cosf( fInvPhaseScale * (float) iVal );
194 22880 : psPredictionDecoder->pfP2RImagLUT[n] = sinf( fInvPhaseScale * (float) iVal );
195 : }
196 :
197 715 : *psPredictionDecoder_out = psPredictionDecoder;
198 :
199 715 : return IVAS_ERR_OK;
200 : }
201 :
202 :
203 : /*-------------------------------------------------------------------*
204 : * Function DeletePredictionDecoder()
205 : *
206 : *
207 : *-------------------------------------------------------------------*/
208 :
209 715 : void DeletePredictionDecoder(
210 : PredictionDecoder *psPredictionDecoder )
211 : {
212 : int32_t n;
213 :
214 2145 : for ( n = 0; n < psPredictionDecoder->iChannels; n++ )
215 : {
216 1430 : free( psPredictionDecoder->ppiPredBandEnable[n] );
217 1430 : free( psPredictionDecoder->ppfA1Real[n] );
218 1430 : free( psPredictionDecoder->ppfA1Imag[n] );
219 1430 : free( psPredictionDecoder->ppiA1Mag[n] );
220 1430 : free( psPredictionDecoder->ppiA1Phase[n] );
221 1430 : free( psPredictionDecoder->ppfPredStateReal[n] );
222 1430 : free( psPredictionDecoder->ppfPredStateImag[n] );
223 : /* PLC_IMPROVEMENT */
224 1430 : free( psPredictionDecoder->ppiDecodingUnresolved[n] );
225 1430 : free( psPredictionDecoder->ppiDecodingFailed[n] );
226 1430 : free( psPredictionDecoder->ppiDecodingFailedPrev[n] );
227 : }
228 715 : free( psPredictionDecoder->piPredChanEnable );
229 715 : free( psPredictionDecoder->ppiPredBandEnable );
230 715 : free( psPredictionDecoder->ppfA1Real );
231 715 : free( psPredictionDecoder->ppfA1Imag );
232 715 : free( psPredictionDecoder->ppiA1Mag );
233 715 : free( psPredictionDecoder->ppiA1Phase );
234 715 : free( psPredictionDecoder->ppfPredStateReal );
235 715 : free( psPredictionDecoder->ppfPredStateImag );
236 : /* PLC_IMPROVEMENT */
237 715 : free( psPredictionDecoder->ppiDecodingUnresolved );
238 715 : free( psPredictionDecoder->ppiDecodingFailed );
239 715 : free( psPredictionDecoder->ppiDecodingFailedPrev );
240 :
241 715 : free( psPredictionDecoder );
242 715 : psPredictionDecoder = NULL;
243 :
244 715 : return;
245 : }
246 :
247 :
248 : /*-------------------------------------------------------------------*
249 : * Function ReadPredictors()
250 : *
251 : *
252 : *-------------------------------------------------------------------*/
253 :
254 144019 : int16_t ReadPredictors(
255 : PredictionDecoder *psPredictionDecoder,
256 : ISAR_SPLIT_REND_BITS_HANDLE pBits )
257 : {
258 144019 : int16_t iBitsRead = 0;
259 : int32_t c;
260 : int32_t b;
261 144019 : int16_t iNumPredBandBits = 6;
262 144019 : const int16_t iSubSetBits = ( LCLD_MAX_NUM_PRED_SUBSETS > 4 ? 3 : 2 );
263 :
264 144019 : psPredictionDecoder->iNumSubSets = ISAR_SPLIT_REND_BITStream_read_int32( pBits, iSubSetBits ) + 1;
265 144019 : iBitsRead += iSubSetBits;
266 :
267 144019 : if ( psPredictionDecoder->iNumSubSets > 1 )
268 : {
269 10049 : psPredictionDecoder->iSubSetId = ISAR_SPLIT_REND_BITStream_read_int32( pBits, iSubSetBits );
270 10049 : iBitsRead += iSubSetBits;
271 10049 : iNumPredBandBits = ( psPredictionDecoder->iNumSubSets >= 4 ? 4 : 5 );
272 : }
273 : else
274 : {
275 133970 : psPredictionDecoder->iSubSetId = 0;
276 : }
277 :
278 432057 : for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
279 : {
280 288038 : psPredictionDecoder->piPredChanEnable[c] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, psPredictionDecoder->iNumSubSets );
281 288038 : iBitsRead += (int16_t) psPredictionDecoder->iNumSubSets;
282 :
283 288038 : if ( get_bit( psPredictionDecoder->piPredChanEnable[c], psPredictionDecoder->iSubSetId ) )
284 : {
285 141793 : int32_t b0 = psPredictionDecoder->iSubSetId;
286 141793 : int32_t bstep = psPredictionDecoder->iNumSubSets;
287 : int32_t iNumPredBands;
288 :
289 8457598 : for ( b = b0; b < LCLD_BANDS; b += bstep )
290 : {
291 8315805 : psPredictionDecoder->ppiPredBandEnable[c][b] = 0;
292 : }
293 141793 : iNumPredBands = ISAR_SPLIT_REND_BITStream_read_int32( pBits, iNumPredBandBits );
294 141793 : iBitsRead += iNumPredBandBits;
295 141793 : iNumPredBands = iNumPredBands * psPredictionDecoder->iNumSubSets + b0;
296 :
297 1829685 : for ( b = b0; b < iNumPredBands; b += bstep )
298 : {
299 1687892 : psPredictionDecoder->ppiPredBandEnable[c][b] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 );
300 1687892 : iBitsRead += 1;
301 :
302 1687892 : if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 )
303 : {
304 : int32_t iA1Mag;
305 : int32_t iA1Phase;
306 : float fA1Real;
307 : float fA1Imag;
308 767140 : iA1Mag = ISAR_SPLIT_REND_BITStream_read_int32( pBits, PRED_QUNAT_FILTER_MAG_BITS );
309 767140 : iBitsRead += PRED_QUNAT_FILTER_MAG_BITS;
310 767140 : iA1Phase = ISAR_SPLIT_REND_BITStream_read_int32( pBits, PRED_QUANT_FILTER_PHASE_BITS );
311 767140 : iBitsRead += PRED_QUANT_FILTER_PHASE_BITS;
312 :
313 767140 : psPredictionDecoder->ppiA1Mag[c][b] = iA1Mag;
314 767140 : psPredictionDecoder->ppiA1Phase[c][b] = iA1Phase + PRED_QUANT_FILTER_PHASE_MIN;
315 :
316 767140 : fA1Real = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RRealLUT[iA1Phase];
317 767140 : fA1Imag = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RImagLUT[iA1Phase];
318 :
319 767140 : psPredictionDecoder->ppfA1Real[c][b] = fA1Real;
320 767140 : psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag;
321 : }
322 : }
323 : }
324 : }
325 :
326 : /* disable any inactive prediction bands */
327 432057 : for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
328 : {
329 : int32_t set;
330 616274 : for ( set = 0; set < psPredictionDecoder->iNumSubSets; set++ )
331 : {
332 328236 : if ( !get_bit( psPredictionDecoder->piPredChanEnable[c], set ) )
333 : {
334 8952386 : for ( b = set; b < LCLD_BANDS; b += psPredictionDecoder->iNumSubSets )
335 : {
336 8774940 : psPredictionDecoder->ppiPredBandEnable[c][b] = 0;
337 : }
338 : }
339 : }
340 : }
341 :
342 144019 : return iBitsRead;
343 : }
344 :
345 :
346 : /*-------------------------------------------------------------------*
347 : * Function AnyDecodingUnresolved()
348 : *
349 : *
350 : *-------------------------------------------------------------------*/
351 :
352 144019 : int32_t AnyDecodingUnresolved(
353 : PredictionDecoder *psPredictionDecoder )
354 : {
355 : int32_t n, ch;
356 432057 : for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
357 : {
358 616274 : for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
359 : {
360 328236 : if ( psPredictionDecoder->ppiDecodingUnresolved[ch][n] == 1 )
361 : {
362 0 : return 1;
363 : }
364 : }
365 : }
366 144019 : return 0;
367 : }
368 :
369 :
370 : /*-------------------------------------------------------------------*
371 : * Function UpdateDecodingFailedStatus()
372 : *
373 : *
374 : *-------------------------------------------------------------------*/
375 :
376 144019 : void UpdateDecodingFailedStatus(
377 : PredictionDecoder *psPredictionDecoder )
378 : {
379 : int32_t n, ch;
380 :
381 432057 : for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
382 : {
383 616274 : for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
384 : {
385 328236 : psPredictionDecoder->ppiDecodingFailedPrev[ch][n] = psPredictionDecoder->ppiDecodingFailed[ch][n];
386 : }
387 : }
388 :
389 144019 : return;
390 : }
391 :
392 :
393 : /*-------------------------------------------------------------------*
394 : * Function UpdateDecodingUnresolved()
395 : *
396 : *
397 : *-------------------------------------------------------------------*/
398 :
399 144019 : void UpdateDecodingUnresolved(
400 : PredictionDecoder *psPredictionDecoder )
401 : {
402 : int32_t n, ch;
403 :
404 144019 : int32_t iCurrentSubSet = psPredictionDecoder->iSubSetId;
405 :
406 432057 : for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
407 : {
408 : /* Prediction data always available for current subset */
409 288038 : psPredictionDecoder->ppiDecodingUnresolved[ch][iCurrentSubSet] = 0;
410 :
411 616274 : for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
412 : {
413 328236 : int32_t iSubSetActive = get_bit( psPredictionDecoder->piPredChanEnable[ch], n );
414 328236 : if ( iSubSetActive == 0 )
415 : {
416 : /* Prediction information available inactive subsets (e.g. no Prediction) */
417 177446 : psPredictionDecoder->ppiDecodingUnresolved[ch][n] = 0;
418 : }
419 : }
420 : }
421 :
422 144019 : return;
423 : }
424 :
425 :
426 : /*-------------------------------------------------------------------*
427 : * Function ApplyInversePredictors()
428 : *
429 : *
430 : *-------------------------------------------------------------------*/
431 :
432 144019 : void ApplyInversePredictors(
433 : PredictionDecoder *psPredictionDecoder,
434 : float ***pppfReal,
435 : float ***pppfImag )
436 : {
437 : int32_t c;
438 :
439 432057 : for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
440 : {
441 288038 : if ( psPredictionDecoder->piPredChanEnable[c] > 0 )
442 : {
443 : int32_t b;
444 9025743 : for ( b = 0; b < LCLD_BANDS; b++ )
445 : {
446 8877780 : if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 )
447 : {
448 : int32_t n;
449 : float fA1Real;
450 : float fA1Imag;
451 788242 : float fPrevReal = 0.0f;
452 788242 : float fPrevImag = 0.0f;
453 788242 : int32_t iSubset = b % psPredictionDecoder->iNumSubSets;
454 :
455 788242 : if ( iSubset != psPredictionDecoder->iSubSetId )
456 : {
457 21102 : fPrevReal = psPredictionDecoder->ppfPredStateReal[c][b];
458 21102 : fPrevImag = psPredictionDecoder->ppfPredStateImag[c][b];
459 : }
460 :
461 788242 : fA1Real = psPredictionDecoder->ppfA1Real[c][b];
462 788242 : fA1Imag = psPredictionDecoder->ppfA1Imag[c][b];
463 13062362 : for ( n = 0; n < psPredictionDecoder->iNumBlocks; n++ )
464 : {
465 : float fReal;
466 : float fImag;
467 :
468 12274120 : fReal = pppfReal[c][n][b] - fA1Real * fPrevReal + fA1Imag * fPrevImag;
469 12274120 : fImag = pppfImag[c][n][b] - fA1Real * fPrevImag - fA1Imag * fPrevReal;
470 :
471 12274120 : pppfReal[c][n][b] = fReal;
472 12274120 : pppfImag[c][n][b] = fImag;
473 :
474 12274120 : fPrevReal = fReal;
475 12274120 : fPrevImag = fImag;
476 : }
477 788242 : psPredictionDecoder->ppfPredStateReal[c][b] = fPrevReal;
478 788242 : psPredictionDecoder->ppfPredStateImag[c][b] = fPrevImag;
479 : }
480 : }
481 : }
482 : }
483 :
484 144019 : return;
485 : }
|