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 "options.h"
35 : #include "prot_fx.h" /* Function prototypes */
36 : #include "prot_fx_enc.h" /* Function prototypes */
37 : #include "rom_com.h"
38 : #include "stl.h"
39 :
40 : /*--------------------------------------------------------------------------*
41 : * GetSubbandCorrIndex2_har()
42 : *
43 : * Finds the index of best correlation between highband (*inBuf) and lowband (*predBuf) for current subband of length (fLen)
44 : *--------------------------------------------------------------------------*/
45 0 : static Word16 GetSubbandCorrIndex2_har_fx( /* o : best correlation index */
46 : const Word32 *L_inBuf, /* i : target buffer (i.e., highband signal) : spectra */
47 : const Word16 fLen, /* i : window length */
48 : const Word16 *predBuf_fx, /* i : prediction buffer (i.e., lowband) : sspectra */
49 : const Word16 predBufLen, /* i : sspectra buffer size */
50 : const Word16 maxLag_fx, /* i : search length */
51 : const GainItem_fx *G_item_fx, /* i : */
52 : const Word16 nZero_fx, /* i : number of nonzero components used in */
53 : Word16 *prev_frame_bstindx_fx /* i : previous frame best Indices */
54 : )
55 : {
56 : Word16 i, j;
57 : Word16 bestIdx_fx;
58 : Word32 L_lagCorr_sq;
59 : Word32 L_lagEnergy;
60 :
61 : Word32 L_energy;
62 : Word32 L_corr;
63 : Word32 L_corr_sq;
64 :
65 : Word16 corr_sq_hi_fx;
66 : Word32 L_corr_sq_tmp;
67 : Word32 L_lagCorr_sq_tmp;
68 : Word16 corr_sq_fx;
69 : Word16 lagCorr_sq_fx;
70 : Word32 L_energy_tmp;
71 : Word32 L_lagEnergy_tmp;
72 : Word16 energy_fx;
73 : Word16 lagEnergy_fx;
74 :
75 : Word16 N1_fx, N2_fx;
76 : Word16 exp_safe_e;
77 :
78 : Word16 exp_corr;
79 : Word16 exp_energy;
80 :
81 : Word32 L_buf;
82 :
83 : Word16 ibuf_fx[L_FRAME32k];
84 : Word16 pbuf_fx[L_FRAME32k];
85 : Word16 *ptr_pbuf;
86 : Word16 exp_shift;
87 :
88 : Word16 exp_norm;
89 :
90 : Word32 L_tmp;
91 :
92 : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
93 0 : Flag Overflow = 0;
94 0 : move16();
95 : #endif
96 :
97 0 : exp_safe_e = 4;
98 0 : move16();
99 :
100 0 : L_tmp = L_deposit_l( 0 );
101 0 : FOR( i = 0; i < fLen; i++ )
102 : {
103 0 : L_tmp = L_or( L_tmp, L_abs( L_inBuf[i] ) );
104 : }
105 0 : exp_norm = norm_l( L_tmp );
106 0 : exp_shift = sub( exp_norm, exp_safe_e );
107 :
108 0 : FOR( i = 0; i < fLen; i++ )
109 : {
110 0 : ibuf_fx[i] = extract_h( L_shl( L_inBuf[i], exp_shift ) ); /* Qi+exp_shift-16 */
111 0 : move16();
112 : }
113 :
114 0 : FOR( i = 0; i < predBufLen; i++ )
115 : {
116 0 : pbuf_fx[i] = shr( predBuf_fx[i], exp_safe_e );
117 0 : move16(); /* Qss-exp_safe_e */
118 : }
119 :
120 0 : bestIdx_fx = 0;
121 0 : move16();
122 0 : L_lagCorr_sq = L_deposit_l( 0 );
123 0 : L_lagEnergy = 0x7FFFFFFF;
124 0 : move32();
125 :
126 0 : N1_fx = s_max( 0x0, sub( *prev_frame_bstindx_fx, shr( maxLag_fx, 1 ) ) );
127 0 : IF( *prev_frame_bstindx_fx < 0 )
128 : {
129 0 : N2_fx = sub( maxLag_fx, 1 );
130 : }
131 : ELSE
132 : {
133 0 : N2_fx = s_min( sub( maxLag_fx, 1 ), add( *prev_frame_bstindx_fx, shr( maxLag_fx, 1 ) ) );
134 : }
135 0 : predBuf_fx += N1_fx;
136 0 : ptr_pbuf = pbuf_fx + N1_fx;
137 :
138 :
139 0 : Overflow = 0;
140 0 : move16();
141 :
142 : /* find the best lag */
143 0 : FOR( i = N1_fx; i <= N2_fx; i++ )
144 : {
145 0 : L_corr = L_deposit_l( 0 );
146 :
147 : /* get the energy, remove the old and update with the new energy index */
148 :
149 0 : L_energy = L_deposit_l( 0 );
150 0 : FOR( j = 0; j < fLen; j++ )
151 : {
152 : /*energy += *predBuf * *predBuf; */
153 0 : L_energy = L_mac_o( L_energy, *ptr_pbuf, *ptr_pbuf, &Overflow ); /* Q*2-1; */
154 0 : ptr_pbuf++;
155 : }
156 :
157 0 : ptr_pbuf -= fLen;
158 :
159 : /* get cross-correlation */
160 0 : IF( L_energy != 0x0L )
161 : {
162 0 : L_corr = L_deposit_l( 0 );
163 0 : FOR( j = 0; j < nZero_fx; j++ )
164 : {
165 : /*corr += inBuf[G_item[j].gainIndex]* predBuf[G_item[j].gainIndex]; */
166 0 : L_corr = L_mac_o( L_corr, ibuf_fx[G_item_fx[j].gainIndex_fx], ptr_pbuf[G_item_fx[j].gainIndex_fx], &Overflow ); /* Q*2-1 */
167 : }
168 :
169 : /*corr_sq = corr*corr; */
170 0 : exp_norm = norm_l( L_corr );
171 0 : exp_norm = sub( exp_norm, 1 ); /* added for Overflow 0x8000 * 0x8000 -> Overflow */
172 0 : L_corr_sq = L_shl( L_corr, exp_norm );
173 0 : corr_sq_hi_fx = extract_h( L_corr_sq );
174 :
175 0 : L_corr_sq = L_mult_o( corr_sq_hi_fx, corr_sq_hi_fx, &Overflow ); /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */
176 0 : L_corr_sq = L_shr_o( L_corr_sq, s_min( shl( exp_norm, 1 ), 31 ), &Overflow ); /* (QCorr-16)*2+1 */
177 0 : IF( Overflow != 0 )
178 : {
179 0 : L_corr_sq = 0x0L;
180 0 : move16();
181 0 : Overflow = 0;
182 0 : move16();
183 : }
184 :
185 : /* normalize for L_lagCorr_sq and L_corr_sq */
186 0 : L_buf = L_or( L_lagCorr_sq, L_corr_sq );
187 0 : exp_corr = norm_l( L_buf );
188 0 : L_corr_sq_tmp = L_shl( L_corr_sq, exp_corr );
189 0 : L_lagCorr_sq_tmp = L_shl( L_lagCorr_sq, exp_corr );
190 0 : corr_sq_fx = extract_h( L_corr_sq_tmp );
191 0 : lagCorr_sq_fx = extract_h( L_lagCorr_sq_tmp );
192 :
193 : /* normalize for L_lagEnergy and L_energy */
194 0 : L_buf = L_or( L_lagEnergy, L_energy );
195 0 : exp_energy = norm_l( L_buf );
196 0 : L_energy_tmp = L_shl( L_energy, exp_energy );
197 0 : L_lagEnergy_tmp = L_shl( L_lagEnergy, exp_energy );
198 0 : energy_fx = extract_h( L_energy_tmp );
199 0 : lagEnergy_fx = extract_h( L_lagEnergy_tmp );
200 :
201 : /*if( (double)lagCorr_sq*(double)energy < (double)corr_sq*(double)lagEnergy ) */
202 0 : IF( L_msu( L_mult( lagCorr_sq_fx, energy_fx ), corr_sq_fx, lagEnergy_fx ) < 0 )
203 : {
204 0 : bestIdx_fx = i;
205 0 : move16();
206 0 : L_lagCorr_sq = L_add( L_corr_sq, 0 );
207 0 : L_lagEnergy = L_add( L_energy, 0 );
208 : }
209 : }
210 0 : predBuf_fx++;
211 0 : ptr_pbuf++;
212 : }
213 :
214 0 : test();
215 0 : IF( L_lagCorr_sq == 0x0 && *prev_frame_bstindx_fx < 0 )
216 : {
217 0 : bestIdx_fx = 0x0;
218 0 : move16();
219 : }
220 : ELSE
221 : {
222 0 : if ( L_lagCorr_sq == 0x0 )
223 : {
224 0 : bestIdx_fx = *prev_frame_bstindx_fx;
225 0 : move16();
226 : }
227 : }
228 :
229 0 : *prev_frame_bstindx_fx = bestIdx_fx;
230 0 : move16();
231 :
232 0 : return bestIdx_fx;
233 : }
234 :
235 : /*--------------------------------------------------------------------------*
236 : * getswbindices_har()
237 : *
238 : * Finds the pulse index of best correlation between highband (*yos) and lowband (*y2) for two groups of length sbLen
239 : *--------------------------------------------------------------------------*/
240 :
241 0 : static void getswbindices_har_fx(
242 : const Word32 *L_yos, /* i : original input spectrum */
243 : Word16 exp_refBuf, /* i : */
244 : Word16 *y2_fx, /* i : decoded spectrum */
245 : const Word16 nBands_search_fx, /* i : number of bands */
246 : Word16 *lagIndices_fx, /* o : pulse index */
247 : Word16 *prev_frame_bstindx_fx, /* i/o: prev frame index */
248 : const Word16 swb_lowband_fx, /* i : length of the LF spectrum */
249 : const Word16 *subband_offsets_fx, /* i : */
250 : const Word16 *sbWidth_fx, /* i : */
251 : const Word16 *subband_search_offset_fx /* i : */
252 : )
253 : {
254 : Word16 i, j, k, sb, tmp;
255 : Word16 *ptr_predBuf;
256 : GainItem_fx Nbiggest_fx[(NB_SWB_SUBBANDS_HAR_SEARCH_SB) *N_NBIGGEST_PULSEARCH];
257 : Word16 n_nbiggestsearch_fx[NB_SWB_SUBBANDS_HAR];
258 :
259 : Word16 search_offset_fx[NB_SWB_SUBBANDS_HAR_SEARCH_SB];
260 : Word16 nlags_fx[NB_SWB_SUBBANDS_HAR_SEARCH_SB];
261 :
262 : Word16 low_freqsgnl_fx[L_FRAME32k]; /* Qy2 (sspectra) */
263 :
264 0 : ptr_predBuf = y2_fx;
265 :
266 : /* Get the number of HF groups for performing Similarity search */
267 0 : FOR( sb = 0; sb < nBands_search_fx; sb++ )
268 : {
269 : /*nlags[sb] = (short)pow(2, bits_lagIndices_mode0_Har[sb]); */
270 0 : nlags_fx[sb] = shl( 1, bits_lagIndices_mode0_Har[sb] );
271 0 : move16();
272 : }
273 :
274 0 : j = 0;
275 0 : move16();
276 0 : FOR( sb = 0; sb < nBands_search_fx; sb++ )
277 : {
278 : /* Find NBiggest samples in HF Groups */
279 0 : FindNBiggest2_simple_fx_har( L_yos + add( swb_lowband_fx, subband_offsets_fx[sb] ), exp_refBuf, Nbiggest_fx + j,
280 0 : sbWidth_fx[sb], &n_nbiggestsearch_fx[sb], N_NBIGGEST_PULSEARCH );
281 :
282 0 : search_offset_fx[sb] = subband_search_offset_fx[sb];
283 0 : move16();
284 0 : j = add( j, N_NBIGGEST_PULSEARCH );
285 : }
286 :
287 : /* Similarity Search for the HF spectrum */
288 0 : FOR( sb = 0; sb < nBands_search_fx; sb++ )
289 : {
290 0 : IF( sb == 0 )
291 : {
292 : /* copy SSmoothed LF Spectrum */
293 0 : ptr_predBuf = y2_fx + sub( search_offset_fx[sb], shr( nlags_fx[sb], 1 ) );
294 0 : tmp = add( sbWidth_fx[sb], nlags_fx[sb] );
295 0 : FOR( i = 0; i < tmp; i++ )
296 : {
297 0 : low_freqsgnl_fx[i] = *ptr_predBuf++;
298 0 : move16();
299 : }
300 : }
301 : ELSE
302 : {
303 : /* copy SSmoothed LF Spectrum */
304 0 : k = 0;
305 0 : move16();
306 0 : tmp = sub( search_offset_fx[sb], add( sbWidth_fx[sb], shr( nlags_fx[sb], 1 ) ) );
307 0 : FOR( j = add( search_offset_fx[sb], shr( nlags_fx[sb], 1 ) ); j > tmp; j-- )
308 : {
309 0 : low_freqsgnl_fx[k] = y2_fx[j];
310 0 : move16();
311 0 : k++;
312 : }
313 : }
314 : /* correlation b/w HF spectrum Group1 of length sbLen and decoded LF spectrum */
315 0 : lagIndices_fx[sb] = (Word16) GetSubbandCorrIndex2_har_fx( L_yos + add( swb_lowband_fx, subband_offsets_fx[sb] ),
316 0 : sbWidth_fx[sb],
317 : low_freqsgnl_fx,
318 0 : add( sbWidth_fx[sb], nlags_fx[sb] ),
319 0 : nlags_fx[sb], Nbiggest_fx + ( sb * N_NBIGGEST_PULSEARCH ),
320 0 : n_nbiggestsearch_fx[sb], &prev_frame_bstindx_fx[sb] );
321 0 : move16();
322 : }
323 :
324 0 : return;
325 : }
326 : /*--------------------------------------------------------------------------*
327 : * GetSubbandCorrIndex2_pulsestep_fx()
328 : *
329 : *--------------------------------------------------------------------------*/
330 :
331 144 : static Word16 GetSubbandCorrIndex2_pulsestep_fx(
332 : const Word32 *L_inBuf, /* i: original input vector (highband) */
333 : const Word16 *predBuf_fx, /* i: spectrum smoothing vector */
334 : const Word16 *predBufMa_fx, /* i: moving averaged spectrum smoothing vector Q=Qss */
335 : const Word16 fLen, /* i: subband length of highband */
336 : const Word16 maxLag, /* i: number of search pulse number */
337 : const GainItem_fx *gi_fx, /* i: lag gain structure */
338 : const Word16 nZero, /* i: */
339 : const Word16 ssearch_buflim, /* i: length of search buffer */
340 : const Word16 *predBuf_ni_fx /* i: spectrum including noise smoothing vector */
341 : )
342 : {
343 : Word16 i, j;
344 : Word16 absPos_fx;
345 : Word16 bestIdx_fx;
346 : Word32 L_lagCorr_sq;
347 : Word32 L_lagEnergy;
348 :
349 : const Word16 *ptr_predBuf;
350 :
351 : Word32 L_energy;
352 : Word32 L_corr;
353 : Word16 corr_fx;
354 :
355 : Word32 L_corr_sq;
356 :
357 :
358 : Word16 hiBuf_fx[L_FRAME32k];
359 : Word16 exp_norm_hi;
360 :
361 : Word16 exp_norm;
362 : Word32 L_corr_sq_tmp;
363 : Word32 L_lagCorr_sq_tmp;
364 : Word16 corr_sq_fx;
365 : Word16 lagCorr_sq_fx;
366 : Word32 L_energy_tmp;
367 : Word32 L_lagEnergy_tmp;
368 : Word16 energy_fx;
369 : Word16 lagEnergy_fx;
370 :
371 : Word16 ib_flag_fx;
372 :
373 : Word32 L_buf;
374 : Word32 L_buf2;
375 : Word32 L_temp;
376 :
377 : Word16 ssBuf_fx[L_FRAME32k];
378 : Word16 ssBuf_ni_fx[L_FRAME32k];
379 : Word16 *ptr_ssBuf_ni_fx;
380 : Word16 exp_norm_ss;
381 :
382 144 : set16_fx( hiBuf_fx, 0x0, L_FRAME32k );
383 144 : set16_fx( ssBuf_fx, 0x0, L_FRAME32k );
384 :
385 144 : ib_flag_fx = 0;
386 144 : move16();
387 :
388 144 : absPos_fx = 0;
389 144 : move16();
390 144 : bestIdx_fx = -1;
391 144 : move16();
392 144 : L_lagCorr_sq = L_deposit_l( 0 );
393 144 : L_lagEnergy = 0x7FFFFFFFL;
394 144 : move32();
395 :
396 144 : ptr_predBuf = predBuf_fx;
397 : /* This part must be computed on parent function. */
398 144 : exp_norm_ss = 2;
399 144 : move16();
400 :
401 144 : j = add( ssearch_buflim, fLen );
402 32400 : FOR( i = 0; i < j; i++ )
403 : {
404 32256 : ssBuf_fx[i] = shr( predBuf_fx[i], exp_norm_ss );
405 32256 : move16(); /* Qss+exp_norm_ss */
406 32256 : ssBuf_ni_fx[i] = shr( predBuf_ni_fx[i], exp_norm_ss );
407 32256 : move16(); /* Qss+exp_norm_ss */
408 : }
409 :
410 144 : L_temp = L_deposit_l( 0 );
411 11376 : FOR( i = 0; i < fLen; i++ )
412 : {
413 11232 : L_temp = L_or( L_temp, L_abs( L_inBuf[i] ) );
414 : }
415 144 : exp_norm_hi = norm_l( L_temp );
416 144 : exp_norm_hi = sub( exp_norm_hi, 3 ); /* max 109 < 2^7 , sspectrum is sparse, it is't need 4 */
417 :
418 11376 : FOR( i = 0; i < fLen; i++ )
419 : {
420 11232 : hiBuf_fx[i] = extract_h( L_shl( L_inBuf[i], exp_norm_hi ) );
421 11232 : move16(); /* Qsh+exp_norm_hi-16 */
422 : }
423 :
424 : /* Get the initial energy for zero lag */
425 144 : test();
426 708 : WHILE( *ptr_predBuf == 0 && LT_16( absPos_fx, ssearch_buflim ) )
427 : {
428 564 : test();
429 564 : ptr_predBuf++;
430 564 : absPos_fx = add( absPos_fx, 1 );
431 : }
432 :
433 144 : IF( EQ_16( absPos_fx, ssearch_buflim ) )
434 : {
435 0 : ptr_predBuf--;
436 0 : absPos_fx = sub( absPos_fx, 1 );
437 : }
438 :
439 144 : ptr_ssBuf_ni_fx = ssBuf_ni_fx + absPos_fx;
440 144 : L_energy = L_deposit_l( 0 );
441 11376 : FOR( i = 0; i < fLen; i++ )
442 : {
443 11232 : L_energy = L_mac( L_energy, *ptr_ssBuf_ni_fx, *ptr_ssBuf_ni_fx ); /* (Qss-exp_norm_ss)*2+1 */
444 11232 : ptr_ssBuf_ni_fx++;
445 : }
446 :
447 144 : ptr_ssBuf_ni_fx -= fLen;
448 :
449 144 : L_lagEnergy = L_add( L_energy, 0 );
450 :
451 : /* Find the best lag */
452 576 : FOR( i = 0; i < maxLag; i++ )
453 : {
454 432 : L_corr = L_deposit_l( 0 );
455 :
456 : /* Get the energy, remove the old and update with the new energy index */
457 432 : L_energy = L_deposit_l( 0 );
458 31752 : FOR( j = 0; j < fLen; j++ )
459 : {
460 31320 : L_energy = L_mac( L_energy, *ptr_ssBuf_ni_fx, *ptr_ssBuf_ni_fx );
461 31320 : ptr_ssBuf_ni_fx++;
462 : }
463 432 : ptr_ssBuf_ni_fx -= fLen;
464 :
465 : /* Get cross-correlation */
466 432 : IF( L_energy != 0x0L )
467 : {
468 432 : L_corr = L_deposit_l( 0 );
469 8160 : FOR( j = 0; j < nZero; j++ )
470 : {
471 : /*corr += inBuf[G_item[j].gainIndex]* predBufMa[G_item[j].gainIndex]; */
472 7728 : L_corr = L_mac( L_corr, hiBuf_fx[gi_fx[j].gainIndex_fx], predBufMa_fx[gi_fx[j].gainIndex_fx] ); /* Qsh+Qss+1 */
473 : }
474 :
475 : /*corr_sq = corr*corr; */
476 432 : exp_norm = norm_l( L_corr );
477 432 : exp_norm = sub( exp_norm, 1 ); /* added for Overflow 0x8000 * 0x8000 -> Overflow */
478 432 : L_corr_sq = L_shl( L_corr, exp_norm );
479 432 : corr_fx = extract_h( L_corr_sq );
480 432 : L_corr_sq = L_mult( corr_fx, corr_fx ); /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */
481 432 : L_corr_sq = L_shr( L_corr_sq, s_min( shl( exp_norm, 1 ), 31 ) ); /* (QCorr-16)*2+1 */
482 :
483 : /*if( (lagCorr_sq == 0.0f && corr_sq == 0.0f) || (double)lagCorr_sq*(double)energy < (double)corr_sq*(double)lagEnergy ) */
484 : /*{ */
485 : /* bestIdx = i; */
486 : /* bestAbsPos = absPos; */
487 : /* lagCorr_sq = corr_sq; */
488 : /* lagCorr = corr; */
489 : /* lagEnergy = energy; */
490 : /*} */
491 : /* normalize for L_lagCorr_sq and L_corr_sq */
492 432 : L_buf = L_or( L_lagCorr_sq, L_corr_sq );
493 432 : exp_norm = norm_l( L_buf ); /* overflow allowed */
494 432 : L_corr_sq_tmp = L_shl( L_corr_sq, exp_norm );
495 432 : L_lagCorr_sq_tmp = L_shl( L_lagCorr_sq, exp_norm );
496 432 : corr_sq_fx = extract_h( L_corr_sq_tmp );
497 432 : lagCorr_sq_fx = extract_h( L_lagCorr_sq_tmp );
498 :
499 : /* normalize for L_lagEnergy and L_energy */
500 432 : L_buf = L_or( L_lagEnergy, L_energy );
501 432 : exp_norm = norm_l( L_buf ); /* overflow allowed */
502 432 : L_energy_tmp = L_shl( L_energy, exp_norm );
503 432 : L_lagEnergy_tmp = L_shl( L_lagEnergy, exp_norm );
504 432 : energy_fx = extract_h( L_energy_tmp );
505 432 : lagEnergy_fx = extract_h( L_lagEnergy_tmp );
506 :
507 432 : L_buf = L_or( L_lagCorr_sq, L_corr_sq );
508 432 : L_buf2 = L_msu( L_mult( lagCorr_sq_fx, energy_fx ), corr_sq_fx, lagEnergy_fx );
509 432 : test();
510 432 : IF( L_buf == 0 || L_buf2 < 0 )
511 : {
512 331 : bestIdx_fx = i;
513 331 : move16();
514 331 : L_lagCorr_sq = L_add( L_corr_sq, 0 );
515 331 : L_lagEnergy = L_add( L_energy, 0 );
516 : }
517 : }
518 432 : ptr_predBuf++;
519 432 : ptr_ssBuf_ni_fx++;
520 432 : absPos_fx++;
521 432 : test();
522 1578 : WHILE( *ptr_predBuf == 0 && LT_16( absPos_fx, ssearch_buflim ) )
523 : {
524 1146 : test();
525 1146 : ptr_predBuf++;
526 1146 : ptr_ssBuf_ni_fx++;
527 1146 : absPos_fx = add( absPos_fx, 1 );
528 : }
529 :
530 432 : IF( GE_16( absPos_fx, ssearch_buflim ) )
531 : {
532 0 : if ( EQ_16( bestIdx_fx, -1 ) )
533 : {
534 0 : ib_flag_fx = 1;
535 0 : move16();
536 : }
537 :
538 0 : BREAK;
539 : }
540 : }
541 :
542 144 : if ( EQ_16( ib_flag_fx, 1 ) )
543 : {
544 0 : bestIdx_fx = 0;
545 0 : move16();
546 : }
547 :
548 144 : return bestIdx_fx;
549 : }
550 : /*--------------------------------------------------------------------------*
551 : * GetSWBIndices_fx()
552 : *
553 : *--------------------------------------------------------------------------*/
554 36 : static void GetSWBIndices_fx(
555 : const Word16 *predBuf_fx, /* i : low-frequency band */
556 : /*const Word16 Qss,*/ /* i : Q value of predBuf_fx */
557 : const Word32 *L_targetBuf, /* i : SWB MDCT coeff. */
558 : const Word16 Qsh, /* i : Q value of L_targetBuf */
559 : const Word16 nBands_search, /* i : number of search subbands */
560 : const Word16 *sbWidth, /* i : subband lengths */
561 : Word16 *lagIndices, /* o : selected lags for subband coding */
562 : const Word16 predBufLen, /* i : low-frequency band length */
563 : GainItem_fx *gi_fx, /* o : most representative region */
564 : const Word16 *subband_offsets, /* o : N biggest components */
565 : Word16 *predBuf_ni_fx /* i : low-frequency band filled noise */
566 : )
567 : {
568 : Word16 j;
569 : Word16 sb, tmp;
570 : Word16 sbLen;
571 : Word16 n_nbiggestsearch_fx[NB_SWB_SUBBANDS];
572 : Word16 ssearch_buflim_fx;
573 : Word16 search_offset_fx[NB_SWB_SUBBANDS];
574 : Word16 nlags_fx[NB_SWB_SUBBANDS];
575 :
576 : Word16 exp_refBuf;
577 : Word16 sspectra_ma_fx[L_FRAME32k];
578 :
579 :
580 : Word32 L_temp;
581 :
582 :
583 : /* Initializations */
584 36 : exp_refBuf = Qsh;
585 :
586 36 : j = 0;
587 36 : move16();
588 180 : FOR( sb = 0; sb < nBands_search; sb++ )
589 : {
590 144 : FindNBiggest2_simple_fx_har( L_targetBuf + subband_offsets[sb], exp_refBuf, gi_fx + j, sbWidth[sb], &n_nbiggestsearch_fx[sb], N_NBIGGEST_PULSEARCH );
591 :
592 144 : j = add( j, N_NBIGGEST_PULSEARCH );
593 144 : move16();
594 : }
595 :
596 : /* Selection of most representative subband (full search) */
597 180 : FOR( sb = 0; sb < nBands_search; sb++ )
598 : {
599 144 : nlags_fx[sb] = shl( 1, bits_lagIndices_modeNormal[sb] );
600 144 : move16();
601 : }
602 :
603 180 : FOR( sb = 0; sb < nBands_search; sb++ )
604 : {
605 144 : search_offset_fx[sb] = subband_search_offsets[sb];
606 144 : move16();
607 : }
608 :
609 36 : sspectra_ma_fx[0] = add( shr( predBuf_ni_fx[0], 1 ), shr( predBuf_ni_fx[1], 1 ) );
610 36 : move16();
611 36 : tmp = sub( predBufLen, 1 );
612 9180 : FOR( sb = 1; sb < tmp; sb++ )
613 : {
614 : /*sspectra_ma[sb] = (predBuf[sb-1] + predBuf[sb] + predBuf[sb+1])/3.0f; */
615 9144 : L_temp = L_mult( predBuf_ni_fx[sb], 10922 ); /* 10922 = 0.33333 (Q15) */
616 9144 : L_temp = L_add( L_temp, L_mult( predBuf_ni_fx[sb - 1], 10922 ) );
617 9144 : L_temp = L_add( L_temp, L_mult( predBuf_ni_fx[sb + 1], 10922 ) ); /* Qss+15+1 */
618 9144 : sspectra_ma_fx[sb] = round_fx( L_temp );
619 9144 : move16();
620 : }
621 36 : sspectra_ma_fx[sb] = add( shr( predBuf_ni_fx[sb - 1], 1 ), shr( predBuf_ni_fx[sb], 1 ) );
622 36 : move16();
623 :
624 : /* Partial search for rest of subbands except the last which is fixed */
625 180 : FOR( sb = 0; sb < nBands_search; sb++ )
626 : {
627 144 : sbLen = sbWidth[sb];
628 144 : ssearch_buflim_fx = sub( predBufLen, add( sbLen, search_offset_fx[sb] ) );
629 288 : lagIndices[sb] = GetSubbandCorrIndex2_pulsestep_fx(
630 144 : L_targetBuf + subband_offsets[sb],
631 144 : predBuf_fx + search_offset_fx[sb],
632 144 : sspectra_ma_fx + search_offset_fx[sb],
633 144 : sbLen, nlags_fx[sb], gi_fx + ( sb * N_NBIGGEST_PULSEARCH ),
634 144 : n_nbiggestsearch_fx[sb],
635 144 : ssearch_buflim_fx, predBuf_ni_fx + search_offset_fx[sb] );
636 144 : move16();
637 : }
638 36 : }
639 : /*--------------------------------------------------------------------------*
640 : * gethar_noisegn_fx()
641 : *
642 : *--------------------------------------------------------------------------*/
643 :
644 0 : static void gethar_noisegn_fx(
645 : BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
646 : const Word32 L_spectra[], /* i : Qs input MDCT */
647 : const Word16 QsL, /* i : Q0 Q value for L_spectra, L_xSynth_har */
648 : const Word16 noise_flr_fx[], /* i : Qss noise floor */
649 : const Word16 Qss, /* i : Q0 Q value for noise_flr_fx, sspectra */
650 : Word32 L_xSynth_har[], /* o : Qs output SWB MDCT */
651 : const Word16 sbWidth[], /* i : Q0 band width for SWB */
652 : const Word16 lagIndices[], /* i : Q0 lag Indices */
653 : const Word16 bands, /* i : Q0 all band number */
654 : const Word16 har_bands, /* i : Q0 harmonic band number */
655 : const Word16 fLenLow, /* i : Q0 low frequency band width */
656 : const Word16 fLenHigh, /* i : Q0 SWB band width */
657 : const Word16 subband_offsets[], /* i : Q0 offset */
658 : const Word16 subband_search_offset[], /* i : Q0 offset */
659 : const Word16 band_start[], /* i : Q0 band start array */
660 : const Word16 band_end[], /* i : Q0 band end array */
661 : const Word16 band_width[], /* i : Q0 band width */
662 : Word32 L_band_energy[], /* i : Qbe band energy (Log scale) */
663 : const Word16 Qbe, /* i : Q0 Q value for L_band_energy */
664 : Word32 L_be_tonal[], /* o : QbeL tonal energy */
665 : Word16 *QbeL, /* o : Q0 Q value for L_be_tonal */
666 : const Word16 *sspectra_fx, /* i : Qss smoothed spectrum */
667 : const Word16 har_freq_est2, /* i : Q0 for harmonic structure */
668 : const Word16 pos_max_hfe2, /* i/o : Q0 for harmonic structure */
669 : Word16 *pul_res_fx, /* o : Q0 */
670 : GainItem_fx pk_sf_fx[] /* o : */
671 : )
672 : {
673 : Word16 i;
674 :
675 : Word32 L_xSynth_har_sft[L_FRAME32k];
676 : Word32 L_hfspec_sft[L_FRAME32k];
677 :
678 : Word32 L_hfspec[L_FRAME32k];
679 :
680 : GainItem_fx get_pk_fx[N_NBIGGEST_SEARCH_LRG_B];
681 : Word16 n_nbiggestsearch_fx, imin_fx, gqlevs_fx;
682 :
683 : Word32 L_g1, L_g2;
684 : Word16 exp_safe;
685 : Word32 L_temp;
686 :
687 : Word16 exp_normn, exp_normd;
688 : Word16 temp_fx;
689 : Word16 div_fx;
690 :
691 : Word16 exp_norm_g1, exp_norm_g2;
692 : Word16 sqrt_fx, Qsqrt;
693 : Word16 g_fx;
694 : Word16 exp, frac;
695 :
696 : Word16 dmin_fx, d_fx;
697 :
698 : Word16 temp_lo, temp_hi;
699 : Word16 Qg;
700 : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
701 0 : Flag Overflow = 0;
702 0 : move16();
703 : #endif
704 : /*Generate HF noise*/
705 0 : genhf_noise_fx( noise_flr_fx, Qss, L_xSynth_har, QsL, sspectra_fx, bands, har_bands, har_freq_est2, pos_max_hfe2, pul_res_fx, pk_sf_fx, fLenLow,
706 : fLenHigh, sbWidth, lagIndices, subband_offsets, subband_search_offset );
707 :
708 0 : Copy32( &L_spectra[fLenLow], L_hfspec, fLenHigh );
709 0 : FindNBiggest2_simple_fx_har( L_hfspec, QsL, get_pk_fx, fLenHigh, &n_nbiggestsearch_fx, N_NBIGGEST_SEARCH_LRG_B );
710 0 : FOR( i = 0; i < n_nbiggestsearch_fx; i++ )
711 : {
712 0 : L_hfspec[get_pk_fx[i].gainIndex_fx] = 0x0;
713 0 : move16();
714 : }
715 :
716 0 : L_temp = 0x0;
717 0 : move32();
718 0 : FOR( i = 0; i < fLenHigh; i++ )
719 : {
720 0 : L_temp = L_or( L_temp, L_abs( L_hfspec[i] ) );
721 : }
722 0 : exp_norm_g1 = norm_l( L_temp );
723 0 : FOR( i = 0; i < fLenHigh; i++ )
724 : {
725 0 : L_hfspec_sft[i] = L_shl( L_hfspec[i], exp_norm_g1 );
726 0 : move32();
727 : }
728 :
729 0 : L_temp = 0x0;
730 0 : move32();
731 0 : FOR( i = 0; i < fLenHigh; i++ )
732 : {
733 0 : L_temp = L_or( L_temp, L_abs( L_xSynth_har[i] ) );
734 : }
735 0 : exp_norm_g2 = norm_l( L_temp );
736 0 : FOR( i = 0; i < fLenHigh; i++ )
737 : {
738 0 : L_xSynth_har_sft[i] = L_shl( L_xSynth_har[i], exp_norm_g2 );
739 0 : move32();
740 : }
741 :
742 0 : exp_safe = 4;
743 0 : move16();
744 0 : L_g1 = L_deposit_l( 0 );
745 0 : L_g2 = L_deposit_l( 0 );
746 0 : FOR( i = 0; i < fLenHigh; i++ )
747 : {
748 0 : temp_fx = round_fx( L_shr( L_hfspec_sft[i], exp_safe ) );
749 0 : L_g1 = L_mac( L_g1, temp_fx, temp_fx ); /* 4: safe shift */
750 0 : temp_fx = round_fx( L_shr( L_xSynth_har_sft[i], exp_safe ) );
751 0 : L_g2 = L_mac( L_g2, temp_fx, temp_fx ); /* 4: safe shift */
752 : }
753 :
754 : /*g = (float) log10(sqrt(g1/g2));*/
755 : /* Div Part */
756 0 : exp_normn = norm_l( L_g1 );
757 0 : exp_normn = sub( exp_normn, 1 );
758 0 : exp_normd = norm_l( L_g2 );
759 0 : temp_fx = extract_h( L_shl( L_g2, exp_normd ) );
760 0 : exp_normd = sub( exp_normd, 16 );
761 :
762 0 : imin_fx = 0;
763 0 : move16();
764 0 : test();
765 0 : IF( L_g1 != 0 && temp_fx != 0x0 )
766 : {
767 0 : div_fx = div_l( L_shl( L_g1, exp_normn ), temp_fx );
768 : /* SQRT Part */
769 0 : sqrt_32n_16_fx( L_deposit_h( div_fx ), add( add( sub( exp_normn, exp_normd ), shl( sub( exp_norm_g1, exp_norm_g2 ), 1 ) ), 15 ), &sqrt_fx, &Qsqrt ); /* (exp_normn-exp_normd+(exp_norm_g1-exp_norm_g2)*2 -1)+16 */
770 :
771 : /* Log10 Part */
772 0 : g_fx = 0x0;
773 0 : move16();
774 0 : IF( sqrt_fx > 0x0 )
775 : {
776 0 : L_temp = L_deposit_l( sqrt_fx );
777 :
778 0 : exp = norm_l( L_temp );
779 0 : frac = Log2_norm_lc( L_shl( L_temp, exp ) );
780 0 : exp = sub( 30, exp );
781 0 : exp = sub( exp, Qsqrt );
782 0 : L_temp = L_Comp( exp, frac );
783 :
784 0 : L_temp = Mpy_32_16_1( L_temp, 19728 ); /* log(2)/log(10)=.30102999566398119521 = 19728.3(Q16) Q(0+16+1)=Q17 */
785 0 : L_temp = L_shl_o( L_temp, 13, &Overflow ); /* Q17+13=30 30-16=14 */
786 0 : g_fx = round_fx_o( L_temp, &Overflow );
787 : }
788 :
789 0 : gqlevs_fx = 4;
790 0 : move16();
791 0 : dmin_fx = 32767;
792 0 : move16();
793 0 : imin_fx = 0;
794 0 : move16();
795 :
796 0 : FOR( i = 0; i < gqlevs_fx; i++ )
797 : {
798 0 : d_fx = abs_s( g_fx - gain_table_SWB_BWE_fx[i] );
799 0 : IF( LT_16( d_fx, dmin_fx ) )
800 : {
801 0 : dmin_fx = d_fx;
802 0 : move16();
803 0 : imin_fx = i;
804 0 : move16();
805 : }
806 : }
807 : }
808 :
809 0 : push_indice( hBstr, IND_NOISEG, imin_fx, 2 );
810 :
811 : /*g=(float) pow (10.0f,gain_table[imin]);*/
812 0 : L_temp = L_mult( gain_table_SWB_BWE_fx[imin_fx], 27213 ); /* Q14+Q13+1=Q28 log(10)/log(2)=3.3219 27213.23(Q13) */
813 0 : L_temp = L_shr( L_temp, 12 ); /* Q28-Q12 -> Q16 */
814 0 : temp_lo = L_Extract_lc( L_temp, &temp_hi );
815 0 : Qg = sub( 14, temp_hi );
816 0 : g_fx = extract_l( Pow2( 14, temp_lo ) );
817 0 : g_fx = shl( g_fx, sub( 11, Qg ) );
818 :
819 0 : ton_ene_est_fx(
820 : L_xSynth_har, QsL, L_be_tonal, QbeL, L_band_energy, Qbe,
821 : band_start, band_end, band_width, fLenLow, fLenHigh, bands, har_bands, g_fx,
822 : pk_sf_fx, Qss, pul_res_fx );
823 :
824 0 : return;
825 : }
826 : /*--------------------------------------------------------------------------*
827 : * EncodeSWBSubbands()
828 : *
829 : * Main routine for generic SWB coding. High-frequency subband
830 : * replicated based on the lowband signal. A search is perform
831 : * find lowband indices denoting the selected lowband subband.
832 : *--------------------------------------------------------------------------*/
833 36 : static void EncodeSWBSubbands_fx(
834 : Encoder_State *st_fx, /* i/o: encoder state structure */
835 : Word32 *L_spectra, /* i/o: MDCT domain spectrum */
836 : Word16 QsL, /* i : Q value for L_spectra */
837 : const Word16 fLenLow_fx, /* i : lowband length */
838 : const Word16 fLenHigh_fx, /* i : highband length */
839 : const Word16 nBands_fx, /* i : number of subbands */
840 : const Word16 nBands_search_fx, /* i : number of subbands to be searched for BWE */
841 : const Word16 *sbWidth_fx, /* i : subband lengths */
842 : const Word16 *subband_offsets_fx, /* i : Subband offset for BWE */
843 : Word16 *lagIndices_fx, /* o : lowband index for each subband */
844 : const Word16 BANDS_fx, /* i : noise estimate from WB part */
845 : const Word16 *band_start_fx, /* i : Number subbands/Frame */
846 : const Word16 *band_end_fx, /* i : Band Start of each SB */
847 : Word32 *L_band_energy, /* i : Band end of each SB, :Qbe */
848 : Word16 Qbe, /* i : Q value of band energy */
849 : const Word16 *p2a_flags_fx, /* i : BAnd energy of each SB */
850 : const Word16 hqswb_clas_fx, /* i : lowband synthesis */
851 : Word16 *prev_frm_index_fx, /* i : clas information */
852 : const Word16 har_bands_fx, /* i/o: Index of the previous Frame */
853 : const Word16 *subband_search_offset_fx, /* i : Number of harmonic LF bands */
854 : Word16 *prev_frm_hfe2, /* i/o: */
855 : Word16 *prev_stab_hfe2, /* i/o: */
856 : const Word16 band_width_fx[], /* i : band width */
857 : const Word32 L_spectra_ni[], /* i : Qs noise injected spectra */
858 : Word16 *ni_seed_fx /* i/o: random seed */
859 : )
860 : {
861 : Word16 i, k;
862 : Word16 sspectra_fx[L_FRAME32k];
863 : Word16 sspectra_ni_fx[L_FRAME32k];
864 : Word16 sspectra_diff_fx[L_FRAME32k];
865 : Word16 Qss; /* Q value of Smoothed Spectrum low-subband */
866 : Word32 L_be_tonal[SWB_HAR_RAN1]; /* Q */
867 : Word16 ss_min_fx; /* Qss */
868 : Word32 L_th_g[NB_SWB_SUBBANDS];
869 : Word16 QbeL;
870 : GainItem_fx pk_sf_fx[(NB_SWB_SUBBANDS) *8];
871 : Word16 pul_res_fx[NB_SWB_SUBBANDS];
872 :
873 : GainItem_fx Nbiggest_fx[NB_SWB_SUBBANDS * N_NBIGGEST_PULSEARCH];
874 :
875 : Word32 L_xSynth_har[L_FRAME32k]; /* Qs */
876 :
877 : Word16 lagGains_fx[NB_SWB_SUBBANDS];
878 : Word16 QlagGains[NB_SWB_SUBBANDS];
879 : Word16 har_freq_est1, har_freq_est2;
880 : Word16 flag_dis;
881 : Word16 pos_max_hfe2;
882 36 : HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core;
883 :
884 36 : har_freq_est1 = 0;
885 36 : move16();
886 36 : har_freq_est2 = 0;
887 36 : move16();
888 36 : flag_dis = 1;
889 36 : move16();
890 36 : pos_max_hfe2 = 0;
891 36 : move16();
892 :
893 36 : set16_fx( sspectra_fx, 0, fLenLow_fx );
894 36 : set16_fx( sspectra_ni_fx, 0, fLenLow_fx );
895 36 : set32_fx( L_xSynth_har, 0, L_FRAME32k );
896 36 : set16_fx( pul_res_fx, 0, NB_SWB_SUBBANDS );
897 :
898 :
899 36 : IF( EQ_16( hqswb_clas_fx, HQ_HARMONIC ) )
900 : {
901 0 : pos_max_hfe2 = har_est_fx( L_spectra, fLenLow_fx, &har_freq_est1, &har_freq_est2, &flag_dis, prev_frm_hfe2, subband_search_offset_fx, sbWidth_fx, prev_stab_hfe2 );
902 0 : noise_extr_corcod_fx( L_spectra, L_spectra_ni, sspectra_fx, sspectra_diff_fx, sspectra_ni_fx, fLenLow_fx, hHQ_core->prev_hqswb_clas, &hHQ_core->prev_ni_ratio_fx, &Qss );
903 : /* Find best indices for each group */
904 0 : getswbindices_har_fx(
905 : L_spectra,
906 : QsL, sspectra_ni_fx,
907 : nBands_search_fx, lagIndices_fx, prev_frm_index_fx, fLenLow_fx, subband_offsets_fx, sbWidth_fx, subband_search_offset_fx );
908 :
909 : /* Write the indices into the bitstream */
910 0 : FOR( k = 0; k < nBands_search_fx; k++ )
911 : {
912 0 : push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_mode0_Har[k] );
913 : }
914 :
915 0 : IF( flag_dis == 0 )
916 : {
917 0 : test();
918 0 : IF( NE_16( har_freq_est2, SWB_HAR_RAN1 ) || NE_16( har_freq_est2, *prev_frm_hfe2 ) )
919 : {
920 0 : har_freq_est2 = add( har_freq_est2, lagIndices_fx[0] );
921 0 : move16();
922 : }
923 : }
924 :
925 0 : gethar_noisegn_fx( st_fx->hBstr, L_spectra, QsL, sspectra_diff_fx, Qss, L_xSynth_har,
926 : sbWidth_fx, lagIndices_fx, BANDS_fx, har_bands_fx, fLenLow_fx, fLenHigh_fx,
927 : subband_offsets_fx, subband_search_offset_fx, band_start_fx, band_end_fx, band_width_fx,
928 : L_band_energy, Qbe, L_be_tonal, &QbeL, sspectra_fx,
929 : har_freq_est2, pos_max_hfe2, pul_res_fx, pk_sf_fx );
930 :
931 :
932 0 : Gettonl_scalfact_fx( L_xSynth_har, QsL, L_spectra_ni, fLenLow_fx, fLenHigh_fx, har_bands_fx, BANDS_fx, L_band_energy, Qbe, band_start_fx, band_end_fx,
933 : p2a_flags_fx, L_be_tonal, QbeL, pk_sf_fx, Qss, pul_res_fx );
934 :
935 0 : IF( flag_dis == 0 )
936 : {
937 0 : *prev_frm_hfe2 = 0;
938 0 : move16();
939 : }
940 : ELSE
941 : {
942 0 : *prev_frm_hfe2 = har_freq_est2;
943 0 : move16();
944 : }
945 :
946 0 : FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
947 : {
948 0 : FOR( i = band_start_fx[k]; i <= band_end_fx[k]; i++ )
949 : {
950 0 : L_spectra[i] = L_xSynth_har[i - fLenLow_fx];
951 0 : move32(); /* QsL */
952 : }
953 : }
954 : }
955 : ELSE
956 : {
957 36 : ss_min_fx = spectrumsmooth_noiseton_fx( L_spectra, /*QsL,*/ L_spectra_ni, sspectra_fx, sspectra_diff_fx, sspectra_ni_fx, &Qss, fLenLow_fx, ni_seed_fx );
958 :
959 : /* Get lag indices */
960 36 : GetSWBIndices_fx( sspectra_fx, /*Qss,*/ L_spectra + fLenLow_fx, QsL, nBands_fx, sbWidth_fx, lagIndices_fx, fLenLow_fx,
961 : Nbiggest_fx, subband_offsets_fx, sspectra_fx );
962 :
963 : /* Bitstream operations */
964 180 : FOR( k = 0; k < nBands_fx; k++ )
965 : {
966 144 : IF( EQ_16( p2a_flags_fx[BANDS_fx - NB_SWB_SUBBANDS + k], 1 ) )
967 : {
968 5 : lagIndices_fx[k] = 0;
969 5 : move16();
970 5 : lagGains_fx[k] = 0;
971 5 : move16();
972 5 : QlagGains[k] = 15;
973 5 : move16();
974 : }
975 : ELSE
976 : {
977 139 : push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_modeNormal[k] );
978 : }
979 : }
980 :
981 36 : convert_lagIndices_pls2smp_fx( lagIndices_fx, nBands_fx, lagIndices_fx, sspectra_fx, sbWidth_fx, fLenLow_fx );
982 :
983 36 : GetlagGains_fx( sspectra_ni_fx, Qss, &L_band_energy[BANDS_fx - NB_SWB_SUBBANDS], Qbe, nBands_fx, sbWidth_fx, lagIndices_fx, fLenLow_fx, lagGains_fx, QlagGains );
984 180 : FOR( k = 0; k < NB_SWB_SUBBANDS; k++ )
985 : {
986 144 : lagGains_fx[k] = mult_r( lagGains_fx[k], 29491 ); /* lagGains[k]*0.9f; */
987 144 : move16();
988 : }
989 :
990 180 : FOR( k = 0; k < NB_SWB_SUBBANDS; k++ )
991 : {
992 144 : L_th_g[k] = L_deposit_l( 0 );
993 144 : move32();
994 144 : IF( p2a_flags_fx[BANDS_fx - NB_SWB_SUBBANDS + k] == 0 )
995 : {
996 139 : L_th_g[k] = L_shl( L_mult( lagGains_fx[k], ss_min_fx ), sub( QsL, add( add( QlagGains[k], Qss ), 1 ) ) ); /* QlagGain+Qss -> QsL */
997 139 : move32();
998 : }
999 : }
1000 :
1001 36 : GetSynthesizedSpecThinOut_fx( sspectra_ni_fx, Qss, L_xSynth_har, QsL, nBands_fx, sbWidth_fx, lagIndices_fx, lagGains_fx, QlagGains, fLenLow_fx );
1002 :
1003 : /*Level adjustment for the missing bands*/
1004 36 : noiseinj_hf_fx( L_xSynth_har, QsL, L_th_g, L_band_energy, Qbe, hHQ_core->prev_En_sb_fx, p2a_flags_fx, BANDS_fx, band_start_fx, band_end_fx, fLenLow_fx, fLenHigh_fx );
1005 :
1006 :
1007 180 : FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
1008 : {
1009 144 : IF( p2a_flags_fx[k] == 0 )
1010 : {
1011 10888 : FOR( i = band_start_fx[k]; i <= band_end_fx[k]; i++ )
1012 : {
1013 10749 : L_spectra[i] = L_xSynth_har[i - fLenLow_fx];
1014 10749 : move32(); /* Qob */
1015 : }
1016 : }
1017 : ELSE
1018 : {
1019 488 : FOR( i = band_start_fx[k]; i <= band_end_fx[k]; i++ )
1020 : {
1021 483 : L_spectra[i] = L_spectra_ni[i];
1022 483 : move32();
1023 : }
1024 : }
1025 : }
1026 : }
1027 :
1028 36 : return;
1029 : }
1030 :
1031 0 : static void EncodeSWBSubbands_ivas_fx(
1032 : Encoder_State *st_fx, /* i/o: encoder state structure */
1033 : Word32 *L_spectra, /* i/o: MDCT domain spectrum */
1034 : Word16 QsL, /* i : Q value for L_spectra */
1035 : const Word16 fLenLow_fx, /* i : lowband length */
1036 : const Word16 fLenHigh_fx, /* i : highband length */
1037 : const Word16 nBands_fx, /* i : number of subbands */
1038 : const Word16 nBands_search_fx, /* i : number of subbands to be searched for BWE */
1039 : const Word16 *sbWidth_fx, /* i : subband lengths */
1040 : const Word16 *subband_offsets_fx, /* i : Subband offset for BWE */
1041 : Word16 *lagIndices_fx, /* o : lowband index for each subband */
1042 : const Word16 BANDS_fx, /* i : noise estimate from WB part */
1043 : const Word16 *band_start_fx, /* i : Number subbands/Frame */
1044 : const Word16 *band_end_fx, /* i : Band Start of each SB */
1045 : Word32 *L_band_energy, /* i : Band end of each SB, :Qbe */
1046 : Word16 Qbe, /* i : Q value of band energy */
1047 : const Word16 *p2a_flags_fx, /* i : BAnd energy of each SB */
1048 : const Word16 hqswb_clas_fx, /* i : lowband synthesis */
1049 : Word16 *prev_frm_index_fx, /* i : clas information */
1050 : const Word16 har_bands_fx, /* i/o: Index of the previous Frame */
1051 : const Word16 *subband_search_offset_fx, /* i : Number of harmonic LF bands */
1052 : Word16 *prev_frm_hfe2, /* i/o: */
1053 : Word16 *prev_stab_hfe2, /* i/o: */
1054 : const Word16 band_width_fx[], /* i : band width */
1055 : const Word32 L_spectra_ni[], /* i : Qs noise injected spectra */
1056 : Word16 *ni_seed_fx /* i/o: random seed */
1057 : )
1058 : {
1059 : Word16 i, k;
1060 : Word16 sspectra_fx[L_FRAME32k];
1061 : Word16 sspectra_ni_fx[L_FRAME32k];
1062 : Word16 sspectra_diff_fx[L_FRAME32k];
1063 : Word16 Qss; /* Q value of Smoothed Spectrum low-subband */
1064 : Word32 L_be_tonal[SWB_HAR_RAN1]; /* Q */
1065 : Word16 ss_min_fx; /* Qss */
1066 : Word32 L_th_g[NB_SWB_SUBBANDS];
1067 : Word16 QbeL;
1068 : GainItem_fx pk_sf_fx[(NB_SWB_SUBBANDS) *8];
1069 : Word16 pul_res_fx[NB_SWB_SUBBANDS];
1070 :
1071 : GainItem_fx Nbiggest_fx[NB_SWB_SUBBANDS * N_NBIGGEST_PULSEARCH];
1072 :
1073 : Word32 L_xSynth_har[L_FRAME32k]; /* Qs */
1074 :
1075 : Word16 lagGains_fx[NB_SWB_SUBBANDS];
1076 : Word16 QlagGains[NB_SWB_SUBBANDS];
1077 : Word16 har_freq_est1, har_freq_est2;
1078 : Word16 flag_dis;
1079 : Word16 pos_max_hfe2;
1080 0 : HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core;
1081 :
1082 0 : har_freq_est1 = 0;
1083 0 : move16();
1084 0 : har_freq_est2 = 0;
1085 0 : move16();
1086 0 : flag_dis = 1;
1087 0 : move16();
1088 0 : pos_max_hfe2 = 0;
1089 0 : move16();
1090 :
1091 0 : set16_fx( sspectra_fx, 0, fLenLow_fx );
1092 0 : set16_fx( sspectra_ni_fx, 0, fLenLow_fx );
1093 0 : set32_fx( L_xSynth_har, 0, L_FRAME32k );
1094 0 : set16_fx( pul_res_fx, 0, NB_SWB_SUBBANDS );
1095 :
1096 :
1097 0 : IF( EQ_16( hqswb_clas_fx, HQ_HARMONIC ) )
1098 : {
1099 0 : pos_max_hfe2 = har_est_fx( L_spectra, fLenLow_fx, &har_freq_est1, &har_freq_est2, &flag_dis, prev_frm_hfe2, subband_search_offset_fx, sbWidth_fx, prev_stab_hfe2 );
1100 0 : noise_extr_corcod_fx( L_spectra, L_spectra_ni, sspectra_fx, sspectra_diff_fx, sspectra_ni_fx, fLenLow_fx, hHQ_core->prev_hqswb_clas, &hHQ_core->prev_ni_ratio_fx, &Qss );
1101 : /* Find best indices for each group */
1102 0 : getswbindices_har_fx(
1103 : L_spectra,
1104 : QsL, sspectra_ni_fx,
1105 : nBands_search_fx, lagIndices_fx, prev_frm_index_fx, fLenLow_fx, subband_offsets_fx, sbWidth_fx, subband_search_offset_fx );
1106 :
1107 : /* Write the indices into the bitstream */
1108 0 : FOR( k = 0; k < nBands_search_fx; k++ )
1109 : {
1110 0 : push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_mode0_Har[k] );
1111 : }
1112 :
1113 0 : IF( flag_dis == 0 )
1114 : {
1115 0 : test();
1116 0 : IF( NE_16( har_freq_est2, SWB_HAR_RAN1 ) || NE_16( har_freq_est2, *prev_frm_hfe2 ) )
1117 : {
1118 0 : har_freq_est2 = add( har_freq_est2, lagIndices_fx[0] );
1119 0 : move16();
1120 : }
1121 : }
1122 :
1123 0 : gethar_noisegn_fx( st_fx->hBstr, L_spectra, QsL, sspectra_diff_fx, Qss, L_xSynth_har,
1124 : sbWidth_fx, lagIndices_fx, BANDS_fx, har_bands_fx, fLenLow_fx, fLenHigh_fx,
1125 : subband_offsets_fx, subband_search_offset_fx, band_start_fx, band_end_fx, band_width_fx,
1126 : L_band_energy, Qbe, L_be_tonal, &QbeL, sspectra_fx,
1127 : har_freq_est2, pos_max_hfe2, pul_res_fx, pk_sf_fx );
1128 :
1129 :
1130 0 : Gettonl_scalfact_fx( L_xSynth_har, QsL, L_spectra_ni, fLenLow_fx, fLenHigh_fx, har_bands_fx, BANDS_fx, L_band_energy, Qbe, band_start_fx, band_end_fx,
1131 : p2a_flags_fx, L_be_tonal, QbeL, pk_sf_fx, Qss, pul_res_fx );
1132 :
1133 0 : IF( flag_dis == 0 )
1134 : {
1135 0 : *prev_frm_hfe2 = 0;
1136 0 : move16();
1137 : }
1138 : ELSE
1139 : {
1140 0 : *prev_frm_hfe2 = har_freq_est2;
1141 0 : move16();
1142 : }
1143 :
1144 0 : FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
1145 : {
1146 0 : FOR( i = band_start_fx[k]; i <= band_end_fx[k]; i++ )
1147 : {
1148 0 : L_spectra[i] = L_xSynth_har[i - fLenLow_fx];
1149 0 : move32(); /* QsL */
1150 : }
1151 : }
1152 : }
1153 : ELSE
1154 : {
1155 0 : ss_min_fx = spectrumsmooth_noiseton_fx( L_spectra, /*QsL,*/ L_spectra_ni, sspectra_fx, sspectra_diff_fx, sspectra_ni_fx, &Qss, fLenLow_fx, ni_seed_fx );
1156 :
1157 : /* Get lag indices */
1158 0 : GetSWBIndices_fx( sspectra_fx, /*Qss,*/ L_spectra + fLenLow_fx, QsL, nBands_fx, sbWidth_fx, lagIndices_fx, fLenLow_fx,
1159 : Nbiggest_fx, subband_offsets_fx, sspectra_fx );
1160 :
1161 : /* Bitstream operations */
1162 0 : FOR( k = 0; k < nBands_fx; k++ )
1163 : {
1164 0 : IF( EQ_16( p2a_flags_fx[BANDS_fx - NB_SWB_SUBBANDS + k], 1 ) )
1165 : {
1166 0 : lagIndices_fx[k] = 0;
1167 0 : move16();
1168 0 : lagGains_fx[k] = 0;
1169 0 : move16();
1170 0 : QlagGains[k] = 15;
1171 0 : move16();
1172 : }
1173 : ELSE
1174 : {
1175 0 : push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_modeNormal[k] );
1176 : }
1177 : }
1178 :
1179 0 : convert_lagIndices_pls2smp_fx( lagIndices_fx, nBands_fx, lagIndices_fx, sspectra_fx, sbWidth_fx, fLenLow_fx );
1180 :
1181 0 : GetlagGains_fx( sspectra_ni_fx, Qss, &L_band_energy[BANDS_fx - NB_SWB_SUBBANDS], Qbe, nBands_fx, sbWidth_fx, lagIndices_fx, fLenLow_fx, lagGains_fx, QlagGains );
1182 0 : FOR( k = 0; k < NB_SWB_SUBBANDS; k++ )
1183 : {
1184 0 : lagGains_fx[k] = mult_r( lagGains_fx[k], 29491 ); /* lagGains[k]*0.9f; */
1185 0 : move16();
1186 : }
1187 :
1188 0 : FOR( k = 0; k < NB_SWB_SUBBANDS; k++ )
1189 : {
1190 0 : L_th_g[k] = L_deposit_l( 0 );
1191 0 : move32();
1192 0 : IF( p2a_flags_fx[BANDS_fx - NB_SWB_SUBBANDS + k] == 0 )
1193 : {
1194 0 : L_th_g[k] = L_shl( L_mult( lagGains_fx[k], ss_min_fx ), sub( QsL, add( add( QlagGains[k], Qss ), 1 ) ) ); /* QlagGain+Qss -> QsL */
1195 0 : move32();
1196 : }
1197 : }
1198 :
1199 0 : GetSynthesizedSpecThinOut_fx( sspectra_ni_fx, Qss, L_xSynth_har, QsL, nBands_fx, sbWidth_fx, lagIndices_fx, lagGains_fx, QlagGains, fLenLow_fx );
1200 :
1201 : /*Level adjustment for the missing bands*/
1202 0 : noiseinj_hf_fx( L_xSynth_har, QsL, L_th_g, L_band_energy, Qbe, hHQ_core->prev_En_sb_fx, p2a_flags_fx, BANDS_fx, band_start_fx, band_end_fx, fLenLow_fx, fLenHigh_fx );
1203 :
1204 :
1205 0 : FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
1206 : {
1207 0 : IF( p2a_flags_fx[k] == 0 )
1208 : {
1209 0 : FOR( i = band_start_fx[k]; i <= band_end_fx[k]; i++ )
1210 : {
1211 0 : L_spectra[i] = L_xSynth_har[i - fLenLow_fx];
1212 0 : move32(); /* Qob */
1213 : }
1214 : }
1215 : ELSE
1216 : {
1217 0 : FOR( i = band_start_fx[k]; i <= band_end_fx[k]; i++ )
1218 : {
1219 0 : L_spectra[i] = L_spectra_ni[i];
1220 0 : move32();
1221 : }
1222 : }
1223 : }
1224 : }
1225 :
1226 0 : return;
1227 : }
1228 : /*--------------------------------------------------------------------------*
1229 : * swb_bwe_enc_lr()
1230 : *
1231 : * Main encoding routine of SWB BWE for the LR MDCT core
1232 : *--------------------------------------------------------------------------*/
1233 36 : void swb_bwe_enc_lr_fx(
1234 : Encoder_State *st_fx, /* i/o: encoder state structure */
1235 : const Word32 L_m_core[], /* i : lowband synthesis */
1236 : Word16 QsL, /* i : Q value */
1237 : const Word32 L_m_orig[], /* i/o: scaled orig signal (MDCT) */
1238 : Word32 L_m[], /* o : highband synthesis with lowband zeroed */
1239 : const Word32 L_total_brate, /* i : total bitrate for selecting subband pattern */
1240 : Word16 BANDS_fx, /* i : Total number of Subbands in a frame */
1241 : Word16 *band_start_fx, /* i : band start of each SB */
1242 : Word16 *band_end_fx, /* i : band end of each SB */
1243 : Word32 *L_band_energy, /* i : band_energy of each SB */
1244 : Word16 Qbe, /* i : Q value of band energy */
1245 : Word16 *p2a_flags_fx, /* i : HF tonal indicator */
1246 : const Word16 hqswb_clas_fx, /* i : HQ_NORMAL2 or HQ_HARMONIC mode */
1247 : Word16 lowlength_fx, /* i : lowband length */
1248 : Word16 highlength_fx, /* i : highband length */
1249 : Word16 *prev_frm_index_fx, /* i/o: previous frame lag index for harmonic mode */
1250 : const Word16 har_bands_fx, /* i : Number of LF harmonic bands */
1251 : Word16 *prev_frm_hfe2, /* i/o: */
1252 : Word16 *prev_stab_hfe2, /* i/o: */
1253 : const Word16 band_width_fx[], /* i : band_width information */
1254 : const Word32 L_y2_ni[], /* i : band_width information */
1255 : Word16 *ni_seed_fx /* i/o: random seed for search buffer NI */
1256 : )
1257 : {
1258 : Word16 k;
1259 : Word16 nBands_fx;
1260 : Word16 nBands_search_fx;
1261 : Word16 wBands_fx[NB_SWB_SUBBANDS];
1262 : Word16 lagIndices_fx[NB_SWB_SUBBANDS];
1263 : Word16 swb_lowband_fx, swb_highband_fx, allband_fx;
1264 :
1265 : const Word16 *subband_offsets_fx;
1266 : const Word16 *subband_search_offset_fx;
1267 :
1268 : Word32 *p_L_m;
1269 :
1270 36 : subband_search_offset_fx = subband_search_offsets_13p2kbps_Har;
1271 36 : subband_offsets_fx = subband_offsets_sub5_13p2kbps_Har;
1272 :
1273 36 : hf_parinitiz_fx( L_total_brate, hqswb_clas_fx, lowlength_fx, highlength_fx, wBands_fx, &subband_search_offset_fx, &subband_offsets_fx, &nBands_fx, &nBands_search_fx, &swb_lowband_fx, &swb_highband_fx );
1274 36 : allband_fx = add( swb_lowband_fx, swb_highband_fx );
1275 36 : move16();
1276 :
1277 : /* Prepare m[], low part from WB core, high part from 32k input */
1278 36 : Copy32( L_m_core, L_m, swb_lowband_fx );
1279 36 : Copy32( &L_m_orig[swb_lowband_fx], &L_m[swb_lowband_fx], swb_highband_fx );
1280 :
1281 36 : EncodeSWBSubbands_fx(
1282 : st_fx,
1283 : L_m, QsL,
1284 : swb_lowband_fx, swb_highband_fx, nBands_fx, nBands_search_fx, wBands_fx, subband_offsets_fx,
1285 : lagIndices_fx,
1286 : BANDS_fx, band_start_fx, band_end_fx,
1287 : L_band_energy, Qbe,
1288 : p2a_flags_fx,
1289 : hqswb_clas_fx, prev_frm_index_fx, har_bands_fx, subband_search_offset_fx,
1290 : prev_frm_hfe2, prev_stab_hfe2,
1291 : band_width_fx, L_y2_ni, ni_seed_fx );
1292 :
1293 36 : p_L_m = &L_m[sub( allband_fx, 1 )];
1294 36 : *p_L_m = Mult_32_16( *p_L_m, 2028 );
1295 36 : move32();
1296 36 : p_L_m--; /* 0.0625 = 2028 (Q15) */
1297 36 : *p_L_m = Mult_32_16( *p_L_m, 4096 );
1298 36 : move32();
1299 36 : p_L_m--; /* 0.125 = 4096 (Q15) */
1300 36 : *p_L_m = Mult_32_16( *p_L_m, 8192 );
1301 36 : move32();
1302 36 : p_L_m--; /* 0.25 = 8192 (Q15) */
1303 36 : *p_L_m = Mult_32_16( *p_L_m, 16384 );
1304 36 : move32();
1305 36 : p_L_m--; /* 0.5 = 16384 (Q15) */
1306 :
1307 : /* set low frequencies to zero */
1308 9252 : FOR( k = 0; k < swb_lowband_fx; k++ )
1309 : {
1310 9216 : L_m[k] = L_deposit_l( 0 );
1311 9216 : move32();
1312 : }
1313 :
1314 36 : return;
1315 : }
1316 :
1317 0 : void swb_bwe_enc_lr_ivas_fx(
1318 : Encoder_State *st_fx, /* i/o: encoder state structure */
1319 : const Word32 L_m_core[], /* i : lowband synthesis */
1320 : Word16 QsL, /* i : Q value */
1321 : const Word32 L_m_orig[], /* i/o: scaled orig signal (MDCT) */
1322 : Word32 L_m[], /* o : highband synthesis with lowband zeroed */
1323 : const Word32 L_total_brate, /* i : total bitrate for selecting subband pattern */
1324 : Word16 BANDS_fx, /* i : Total number of Subbands in a frame */
1325 : Word16 *band_start_fx, /* i : band start of each SB */
1326 : Word16 *band_end_fx, /* i : band end of each SB */
1327 : Word32 *L_band_energy, /* i : band_energy of each SB */
1328 : Word16 Qbe, /* i : Q value of band energy */
1329 : Word16 *p2a_flags_fx, /* i : HF tonal indicator */
1330 : const Word16 hqswb_clas_fx, /* i : HQ_NORMAL2 or HQ_HARMONIC mode */
1331 : Word16 lowlength_fx, /* i : lowband length */
1332 : Word16 highlength_fx, /* i : highband length */
1333 : Word16 *prev_frm_index_fx, /* i/o: previous frame lag index for harmonic mode */
1334 : const Word16 har_bands_fx, /* i : Number of LF harmonic bands */
1335 : Word16 *prev_frm_hfe2, /* i/o: */
1336 : Word16 *prev_stab_hfe2, /* i/o: */
1337 : const Word16 band_width_fx[], /* i : band_width information */
1338 : const Word32 L_y2_ni[], /* i : band_width information */
1339 : Word16 *ni_seed_fx /* i/o: random seed for search buffer NI */
1340 : )
1341 : {
1342 : Word16 k;
1343 : Word16 nBands_fx;
1344 : Word16 nBands_search_fx;
1345 : Word16 wBands_fx[NB_SWB_SUBBANDS];
1346 : Word16 lagIndices_fx[NB_SWB_SUBBANDS];
1347 : Word16 swb_lowband_fx, swb_highband_fx, allband_fx;
1348 :
1349 : const Word16 *subband_offsets_fx;
1350 : const Word16 *subband_search_offset_fx;
1351 :
1352 : Word32 *p_L_m;
1353 :
1354 0 : subband_search_offset_fx = subband_search_offsets_13p2kbps_Har;
1355 0 : subband_offsets_fx = subband_offsets_sub5_13p2kbps_Har;
1356 :
1357 0 : hf_parinitiz_fx( L_total_brate, hqswb_clas_fx, lowlength_fx, highlength_fx, wBands_fx, &subband_search_offset_fx, &subband_offsets_fx, &nBands_fx, &nBands_search_fx, &swb_lowband_fx, &swb_highband_fx );
1358 0 : allband_fx = add( swb_lowband_fx, swb_highband_fx );
1359 0 : move16();
1360 :
1361 : /* Prepare m[], low part from WB core, high part from 32k input */
1362 0 : Copy32( L_m_core, L_m, swb_lowband_fx );
1363 0 : Copy32( &L_m_orig[swb_lowband_fx], &L_m[swb_lowband_fx], swb_highband_fx );
1364 :
1365 0 : EncodeSWBSubbands_ivas_fx(
1366 : st_fx,
1367 : L_m, QsL,
1368 : swb_lowband_fx, swb_highband_fx, nBands_fx, nBands_search_fx, wBands_fx, subband_offsets_fx,
1369 : lagIndices_fx,
1370 : BANDS_fx, band_start_fx, band_end_fx,
1371 : L_band_energy, Qbe,
1372 : p2a_flags_fx,
1373 : hqswb_clas_fx, prev_frm_index_fx, har_bands_fx, subband_search_offset_fx,
1374 : prev_frm_hfe2, prev_stab_hfe2,
1375 : band_width_fx, L_y2_ni, ni_seed_fx );
1376 :
1377 0 : p_L_m = &L_m[sub( allband_fx, 1 )];
1378 0 : *p_L_m = Mult_32_16( *p_L_m, 2028 );
1379 0 : move32();
1380 0 : p_L_m--; /* 0.0625 = 2028 (Q15) */
1381 0 : *p_L_m = Mult_32_16( *p_L_m, 4096 );
1382 0 : move32();
1383 0 : p_L_m--; /* 0.125 = 4096 (Q15) */
1384 0 : *p_L_m = Mult_32_16( *p_L_m, 8192 );
1385 0 : move32();
1386 0 : p_L_m--; /* 0.25 = 8192 (Q15) */
1387 0 : *p_L_m = Mult_32_16( *p_L_m, 16384 );
1388 0 : move32();
1389 0 : p_L_m--; /* 0.5 = 16384 (Q15) */
1390 :
1391 : /* set low frequencies to zero */
1392 0 : FOR( k = 0; k < swb_lowband_fx; k++ )
1393 : {
1394 0 : L_m[k] = L_deposit_l( 0 );
1395 0 : move32();
1396 : }
1397 :
1398 0 : return;
1399 : }
|