Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 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 <assert.h>
35 : #include "options.h"
36 : #include "prot_fx.h"
37 : #include "ivas_prot_fx.h"
38 : #include "ivas_prot_rend_fx.h"
39 : #include "math.h"
40 : #include "wmc_auto.h"
41 : #ifdef DEBUGGING
42 : #include "debug.h"
43 : #endif
44 :
45 : /*------------------------------------------------------------------------------------------*
46 : * Local constants
47 : *------------------------------------------------------------------------------------------*/
48 : static const Word16 ivas_hadamard_decorr_APD_coeff[IVAS_APD_16_SECT][IVAS_APD_16_SECT] = { /* Q15 */
49 : { 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107 },
50 : { 13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107 },
51 : { 13107, 13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, -13107, -13107 },
52 : { 13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107 },
53 : { 13107, 13107, 13107, 13107, -13107, -13107, -13107, -13107, 13107, 13107, 13107, 13107, -13107, -13107, -13107, -13107 },
54 : { 13107, -13107, 13107, -13107, -13107, 13107, -13107, 13107, 13107, -13107, 13107, -13107, -13107, 13107, -13107, 13107 },
55 : { 13107, 13107, -13107, -13107, -13107, -13107, 13107, 13107, 13107, 13107, -13107, -13107, -13107, -13107, 13107, 13107 },
56 : { 13107, -13107, -13107, 13107, -13107, 13107, 13107, -13107, 13107, -13107, -13107, 13107, -13107, 13107, 13107, -13107 },
57 : { 13107, 13107, 13107, 13107, 13107, 13107, 13107, 13107, -13107, -13107, -13107, -13107, -13107, -13107, -13107, -13107 },
58 : { 13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, 13107 },
59 : { 13107, 13107, -13107, -13107, 13107, 13107, -13107, -13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107 },
60 : { 13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, -13107 },
61 : { 13107, 13107, 13107, 13107, -13107, -13107, -13107, -13107, -13107, -13107, -13107, -13107, 13107, 13107, 13107, 13107 },
62 : { 13107, -13107, 13107, -13107, -13107, 13107, -13107, 13107, -13107, 13107, -13107, 13107, 13107, -13107, 13107, -13107 },
63 : { 13107, 13107, -13107, -13107, -13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, 13107, 13107, -13107, -13107 },
64 : { 13107, -13107, -13107, 13107, -13107, 13107, 13107, -13107, -13107, 13107, 13107, -13107, 13107, -13107, -13107, 13107 }
65 : };
66 :
67 : /* For R = 3.^([0:obj.parm_APD_nSections-1]/4); Q22 */
68 : static const Word32 ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = { /* Q22 */
69 : 4194304, 5520015, 7264748, 9560946, 12582912, 16560043, 21794242,
70 : 28682836, 37748736, 49680132, 65382728, 86048512, 113246208,
71 : 149040384, 196148192, 258145536
72 : };
73 :
74 : #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 1073741824 ) // Q29
75 : #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 1610612736 ) // Q29
76 : /*------------------------------------------------------------------------------------------*
77 : * Local functions declaration
78 : *------------------------------------------------------------------------------------------*/
79 :
80 : static Word16 ivas_get_APD_filt_orders_fx( const Word16 num_out_chans, const Word32 output_Fs, Word16 *APD_filt_orders );
81 :
82 : static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const Word16 num_out_chans, const Word16 ducking_flag );
83 :
84 : /*-------------------------------------------------------------------------
85 : * ivas_td_decorr_reconfig_dec()
86 : *
87 : * Allocate and initialize time domain decorrelator handle
88 : *------------------------------------------------------------------------*/
89 :
90 3665 : ivas_error ivas_td_decorr_reconfig_dec(
91 : const IVAS_FORMAT ivas_format, /* i : IVAS format */
92 : const Word32 ivas_total_brate, /* i : total IVAS bitrate */
93 : const Word16 nchan_transport, /* i : number of transport channels */
94 : const Word32 output_Fs, /* i : output sampling rate */
95 : ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */
96 : UWord16 *useTdDecorr /* i/o: TD decorrelator flag */
97 : )
98 : {
99 : UWord16 useTdDecorr_new;
100 : ivas_error error;
101 :
102 3665 : useTdDecorr_new = 0;
103 3665 : move16();
104 :
105 3665 : test();
106 3665 : IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) )
107 : {
108 495 : if ( EQ_16( nchan_transport, 1 ) )
109 : {
110 315 : useTdDecorr_new = 1;
111 315 : move16();
112 : }
113 : }
114 3170 : ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) )
115 : {
116 1706 : test();
117 1706 : test();
118 1706 : if ( ( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 1 ) ) || LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) )
119 : {
120 928 : useTdDecorr_new = 1;
121 928 : move16();
122 : }
123 : }
124 1464 : ELSE IF( EQ_32( ivas_format, MC_FORMAT ) )
125 : {
126 221 : test();
127 221 : if ( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 1 ) )
128 : {
129 198 : useTdDecorr_new = 1;
130 198 : move16();
131 : }
132 : }
133 :
134 3665 : IF( NE_32( *useTdDecorr, useTdDecorr_new ) )
135 : {
136 798 : *useTdDecorr = useTdDecorr_new;
137 798 : move16();
138 :
139 798 : IF( *useTdDecorr )
140 : {
141 503 : test();
142 503 : test();
143 503 : IF( GE_32( ivas_total_brate, IVAS_13k2 ) && ( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) )
144 : {
145 133 : IF( *hTdDecorr == NULL )
146 : {
147 133 : IF( NE_32( ( error = ivas_td_decorr_dec_open_fx( hTdDecorr, output_Fs, 3, 1 ) ), IVAS_ERR_OK ) )
148 : {
149 0 : return error;
150 : }
151 : }
152 :
153 133 : IF( LT_32( ivas_total_brate, IVAS_24k4 ) )
154 : {
155 74 : ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR; // Q29
156 74 : move32();
157 : }
158 : ELSE
159 : {
160 59 : ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN; // Q29
161 59 : move32();
162 : }
163 : }
164 : ELSE
165 : {
166 370 : IF( *hTdDecorr == NULL )
167 : {
168 370 : IF( NE_32( ( error = ivas_td_decorr_dec_open_fx( hTdDecorr, output_Fs, 3, 0 ) ), IVAS_ERR_OK ) )
169 : {
170 0 : return error;
171 : }
172 : }
173 : ELSE
174 : {
175 0 : ivas_td_decorr_init( *hTdDecorr, 3, 0 );
176 : }
177 : }
178 : }
179 : ELSE
180 : {
181 295 : ivas_td_decorr_dec_close( hTdDecorr );
182 : }
183 : }
184 :
185 3665 : return IVAS_ERR_OK;
186 : }
187 :
188 : /*-------------------------------------------------------------------------
189 : * ivas_td_decorr_dec_open_fx()
190 : *
191 : * Allocate and initialize time domain decorrelator handle
192 : *------------------------------------------------------------------------*/
193 :
194 1788 : ivas_error ivas_td_decorr_dec_open_fx(
195 : ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */
196 : const Word32 output_Fs, /* i : output sampling rate */
197 : const Word16 nchan_internal, /* i : number of internal channels */
198 : const Word16 ducking_flag /* i : ducking flag */
199 : )
200 : {
201 : Word16 i, j, len;
202 : Word16 num_out_chans, buf_len;
203 : ivas_td_decorr_state_t *hTdDecorr_loc;
204 : ivas_error error;
205 :
206 1788 : buf_len = extract_l( Mpy_32_32( output_Fs, 4294968 ) ); // IVAS_DECORR_PARM_LOOKAHEAD_TAU * 2 ^ 31 -> 4294968
207 :
208 1788 : num_out_chans = sub( nchan_internal, 1 );
209 :
210 1788 : error = IVAS_ERR_OK;
211 1788 : move32();
212 :
213 1788 : IF( ( hTdDecorr_loc = (ivas_td_decorr_state_t *) malloc( sizeof( ivas_td_decorr_state_t ) ) ) == NULL )
214 : {
215 0 : return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR SPAR COV decoder" );
216 : }
217 :
218 1788 : IF( ( hTdDecorr_loc->look_ahead_buf = (Word32 *) malloc( sizeof( Word32 ) * buf_len ) ) == NULL )
219 : {
220 0 : return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR SPAR COV decoder" );
221 : }
222 1788 : set32_fx( hTdDecorr_loc->look_ahead_buf, 0, buf_len );
223 1788 : hTdDecorr_loc->offset = buf_len;
224 1788 : hTdDecorr_loc->num_apd_sections = ivas_get_APD_filt_orders_fx( num_out_chans, output_Fs, hTdDecorr_loc->APD_filt_state[0].order );
225 1788 : move16();
226 1788 : move16();
227 :
228 6993 : FOR( j = 0; j < num_out_chans; j++ )
229 : {
230 27213 : FOR( i = 0; i < hTdDecorr_loc->num_apd_sections; i++ )
231 : {
232 22008 : len = hTdDecorr_loc->APD_filt_state[0].order[i];
233 22008 : move16();
234 :
235 22008 : IF( ( hTdDecorr_loc->APD_filt_state[j].state[i] = (Word32 *) malloc( sizeof( Word32 ) * len ) ) == NULL )
236 : {
237 0 : return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR SPAR COV decoder" );
238 : }
239 :
240 22008 : set32_fx( hTdDecorr_loc->APD_filt_state[j].state[i], 0, len );
241 : }
242 : }
243 :
244 1788 : ivas_td_decorr_init( hTdDecorr_loc, num_out_chans, ducking_flag );
245 :
246 1788 : IF( ducking_flag )
247 : {
248 1418 : IF( NE_32( ( error = ivas_transient_det_open_fx( &hTdDecorr_loc->pTrans_det, output_Fs ) ), IVAS_ERR_OK ) )
249 : {
250 0 : return error;
251 : }
252 : }
253 : ELSE
254 : {
255 370 : hTdDecorr_loc->pTrans_det = NULL;
256 : }
257 :
258 1788 : *hTdDecorr = hTdDecorr_loc;
259 :
260 1788 : return error;
261 : }
262 :
263 : /*-------------------------------------------------------------------------
264 : * ivas_td_decorr_dec_close()
265 : *
266 : * Deallocate time domain decorrelator handle
267 : *------------------------------------------------------------------------*/
268 :
269 2233 : void ivas_td_decorr_dec_close(
270 : ivas_td_decorr_state_t **hTdDecorr /* i/o: TD decorrelator handle */
271 : )
272 : {
273 : Word16 i, j;
274 :
275 2233 : test();
276 2233 : IF( hTdDecorr == NULL || *hTdDecorr == NULL )
277 : {
278 445 : return;
279 : }
280 :
281 1788 : free( ( *hTdDecorr )->look_ahead_buf );
282 1788 : ( *hTdDecorr )->look_ahead_buf = NULL;
283 :
284 6993 : FOR( j = 0; j < ( *hTdDecorr )->num_apd_outputs; j++ )
285 : {
286 27213 : FOR( i = 0; i < ( *hTdDecorr )->num_apd_sections; i++ )
287 : {
288 22008 : free( ( *hTdDecorr )->APD_filt_state[j].state[i] );
289 22008 : ( *hTdDecorr )->APD_filt_state[j].state[i] = NULL;
290 : }
291 : }
292 :
293 1788 : IF( ( *hTdDecorr )->pTrans_det != NULL )
294 : {
295 1418 : ivas_transient_det_close_fx( &( *hTdDecorr )->pTrans_det );
296 : }
297 :
298 1788 : free( ( *hTdDecorr ) );
299 1788 : ( *hTdDecorr ) = NULL;
300 :
301 1788 : return;
302 : }
303 :
304 : /*-----------------------------------------------------------------------------------------*
305 : * Function ivas_get_APD_filt_orders_fx()
306 : *
307 : * Calculate the orders of the APD IIR filters and return num APD sections
308 : *-----------------------------------------------------------------------------------------*/
309 :
310 1788 : static Word16 ivas_get_APD_filt_orders_fx(
311 : const Word16 num_out_chans,
312 : const Word32 output_Fs,
313 : Word16 *APD_filt_orders )
314 : {
315 : Word16 i;
316 1788 : Word16 num_apd_sections = 0;
317 1788 : move16();
318 : Word32 sum_R, R[IVAS_MAX_DECORR_APD_SECTIONS];
319 :
320 1788 : SWITCH( num_out_chans )
321 : {
322 593 : case IVAS_TD_DECORR_OUT_1CH:
323 : case IVAS_TD_DECORR_OUT_2CH:
324 593 : num_apd_sections = IVAS_APD_2_SECT;
325 593 : move16();
326 593 : BREAK;
327 1063 : case IVAS_TD_DECORR_OUT_3CH:
328 : case IVAS_TD_DECORR_OUT_4CH:
329 1063 : num_apd_sections = IVAS_APD_4_SECT;
330 1063 : move16();
331 1063 : BREAK;
332 132 : case IVAS_TD_DECORR_OUT_5CH:
333 : case IVAS_TD_DECORR_OUT_6CH:
334 : case IVAS_TD_DECORR_OUT_7CH:
335 : case IVAS_TD_DECORR_OUT_8CH:
336 132 : num_apd_sections = IVAS_APD_8_SECT;
337 132 : move16();
338 132 : BREAK;
339 0 : default:
340 0 : assert( !"Invalid num out chans" );
341 : BREAK;
342 : }
343 :
344 1788 : sum_R = 0;
345 1788 : move32();
346 8282 : FOR( i = 0; i < num_apd_sections; i++ )
347 : {
348 6494 : R[i] = ivas_three_pow_frac[i];
349 6494 : move32();
350 6494 : sum_R = L_add( sum_R, R[i] );
351 : }
352 :
353 8282 : FOR( i = 0; i < num_apd_sections; i++ )
354 : {
355 6494 : APD_filt_orders[i] = (Word16) L_add( L_shr( Mpy_32_32( L_shl( output_Fs, Q15 ), Mpy_32_32( IVAS_DECORR_PARM_APD_TAU, L_shl( (Word32) divide3232( R[i], sum_R ), Q15 ) ) ), Q14 ), 1 );
356 6494 : move16();
357 : }
358 :
359 1788 : return num_apd_sections;
360 : }
361 : /*-----------------------------------------------------------------------------------------*
362 : * Function ivas_td_decorr_init()
363 : *
364 : * TD decorr Initialisation function
365 : *-----------------------------------------------------------------------------------------*/
366 :
367 1788 : static void ivas_td_decorr_init(
368 : ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decorrelator handle */
369 : const Word16 num_out_chans, /* i : number of channels */
370 : const Word16 ducking_flag /* i : TD ducking flag */
371 : )
372 : {
373 : Word16 i, j;
374 :
375 1788 : hTdDecorr->ducking_flag = ducking_flag;
376 1788 : hTdDecorr->num_apd_outputs = num_out_chans;
377 1788 : move16();
378 1788 : move16();
379 :
380 6993 : FOR( i = 0; i < hTdDecorr->num_apd_outputs; i++ )
381 : {
382 27213 : FOR( j = 0; j < hTdDecorr->num_apd_sections; j++ )
383 : {
384 22008 : hTdDecorr->APD_filt_state[i].order[j] = hTdDecorr->APD_filt_state[0].order[j];
385 22008 : hTdDecorr->APD_filt_state[i].coeffs[j] = ivas_hadamard_decorr_APD_coeff[i][j]; // Q15
386 22008 : hTdDecorr->APD_filt_state[i].idx[j] = 0;
387 :
388 22008 : move16();
389 22008 : move16();
390 22008 : move16();
391 : }
392 : }
393 :
394 1788 : return;
395 : }
396 :
397 : /*-----------------------------------------------------------------------------------------*
398 : * Function ivas_td_decorr_APD_iir_filter_fx()
399 : *
400 : * APD IIR filter
401 : *-----------------------------------------------------------------------------------------*/
402 :
403 352787 : void ivas_td_decorr_APD_iir_filter_fx(
404 : ivas_td_decorr_APD_filt_state_t *filter_state,
405 : Word32 *pIn_out, // Q11
406 : const Word16 num_APD_sections,
407 : const Word16 length )
408 : {
409 : Word16 i, k;
410 : Word16 idx;
411 352787 : Word32 *pIn = pIn_out;
412 352787 : Word32 *pOut = pIn_out;
413 : Word32 tmp_pIn_buf_i;
414 :
415 1898175 : FOR( k = 0; k < num_APD_sections; k++ )
416 : {
417 1545388 : Word32 *pFilt_state = filter_state->state[k];
418 1545388 : Word16 filt_coeff = filter_state->coeffs[k]; // Q15
419 1545388 : Word16 order = filter_state->order[k];
420 1545388 : move16();
421 1545388 : move16();
422 :
423 1545388 : idx = filter_state->idx[k];
424 1545388 : move16();
425 :
426 1272686268 : FOR( i = 0; i < length; i++ )
427 : {
428 1271140880 : tmp_pIn_buf_i = pIn[i];
429 1271140880 : move32();
430 :
431 1271140880 : pOut[i] = Madd_32_16( pFilt_state[idx], pIn[i], filt_coeff ); // Q11
432 1271140880 : move32();
433 :
434 1271140880 : pFilt_state[idx++] = Msub_32_16( tmp_pIn_buf_i, pOut[i], filt_coeff ); // Q11
435 1271140880 : move32();
436 :
437 1271140880 : if ( EQ_16( order, idx ) )
438 : {
439 10400335 : idx = 0;
440 10400335 : move16();
441 : }
442 : }
443 1545388 : filter_state->idx[k] = idx;
444 1545388 : move16();
445 : }
446 :
447 352787 : return;
448 : }
449 :
450 : /*-----------------------------------------------------------------------------------------*
451 : * Function ivas_td_decorr_APD_sections()
452 : *
453 : * TD decorr all pass delay sections
454 : *-----------------------------------------------------------------------------------------*/
455 :
456 115238 : static void ivas_td_decorr_APD_sections_fx(
457 : ivas_td_decorr_state_t *hTdDecorr,
458 : Word32 **ppOut_pcm,
459 : const Word16 output_frame )
460 : {
461 : Word16 i;
462 464945 : FOR( i = 0; i < hTdDecorr->num_apd_outputs; i++ )
463 : {
464 349707 : ivas_td_decorr_APD_iir_filter_fx( &hTdDecorr->APD_filt_state[i], ppOut_pcm[i], hTdDecorr->num_apd_sections, output_frame );
465 : }
466 :
467 115238 : return;
468 : }
469 :
470 : /*-----------------------------------------------------------------------------------------*
471 : * Function ivas_td_decorr_process_fx()
472 : *
473 : * TD decorr process call
474 : *-----------------------------------------------------------------------------------------*/
475 :
476 115238 : void ivas_td_decorr_process_fx(
477 : ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */
478 : Word32 *pcm_in[], /* i : input audio channels Q11 */
479 : Word32 **ppOut_pcm, /* o : output audio channels Q11 */
480 : const Word16 output_frame /* i : output frame length */
481 : )
482 : {
483 : Word16 i, j;
484 : Word32 in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k];
485 :
486 : /* Look-ahead delay */
487 115238 : Copy32( pcm_in[0], ppOut_pcm[0], output_frame );
488 115238 : delay_signal32_fx( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset );
489 :
490 : /* In ducking gains */
491 115238 : IF( hTdDecorr->ducking_flag )
492 : {
493 83050 : ivas_td_decorr_get_ducking_gains_fx( hTdDecorr->pTrans_det, pcm_in[0], in_duck_gain, out_duck_gain, output_frame, 0 );
494 :
495 66474510 : FOR( j = 0; j < output_frame; j++ )
496 : {
497 66391460 : ppOut_pcm[0][j] = L_shl( Mpy_32_32( ppOut_pcm[0][j], in_duck_gain[j] ), 1 ); // Q11
498 66391460 : move32();
499 : }
500 : }
501 :
502 349707 : FOR( i = 1; i < hTdDecorr->num_apd_outputs; i++ )
503 : {
504 234469 : Copy32( ppOut_pcm[0], ppOut_pcm[i], output_frame );
505 : }
506 :
507 : /* All pass delay section */
508 115238 : ivas_td_decorr_APD_sections_fx( hTdDecorr, ppOut_pcm, output_frame );
509 :
510 : /* Out ducking gains */
511 115238 : IF( hTdDecorr->ducking_flag )
512 : {
513 345963 : FOR( i = 0; i < hTdDecorr->num_apd_outputs; i++ )
514 : {
515 215055393 : FOR( j = 0; j < output_frame; j++ )
516 : {
517 214792480 : ppOut_pcm[i][j] = L_shl( Mpy_32_32( ppOut_pcm[i][j], out_duck_gain[j] ), 1 ); // Q11
518 214792480 : move32();
519 : }
520 : }
521 : }
522 :
523 115238 : return;
524 : }
|