Line data Source code
1 : /*====================================================================================
2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
3 : ====================================================================================*/
4 :
5 : #include <stdint.h>
6 : #include "options.h"
7 : #include "cnst.h"
8 : #include "rom_com.h"
9 : #include "prot_fx.h" /* Function prototypes */
10 : #include "prot_fx_enc.h" /* Function prototypes */
11 :
12 :
13 : /*-------------------------------------------------------------------*
14 : * Local function prototypes
15 : *-------------------------------------------------------------------*/
16 :
17 : static Word16 edyn_fx( const Word16 *vec, const Word16 lvec, Word16 Qnew );
18 :
19 :
20 : /*-------------------------------------------------------------------*
21 : * encod_audio()
22 : *
23 : * Encode audio (AC) frames
24 : *-------------------------------------------------------------------*/
25 :
26 8 : void encod_audio_fx(
27 : Encoder_State *st_fx, /* i/o: State structure */
28 : const Word16 speech[], /* i : input speech Q_new */
29 : const Word16 Aw[], /* i : weighted A(z) unquantized for subframes Q12 */
30 : const Word16 Aq[], /* i : 12k8 Lp coefficient Q12 */
31 : const Word16 *res, /* i : residual signal Q_new */
32 : Word16 *synth, /* i/o: core synthesis Q-1 */
33 : Word16 *exc, /* i/o: current non-enhanced excitation Q_new */
34 : Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6 */
35 : Word16 *voice_factors, /* o : voicing factors Q15 */
36 : Word16 *bwe_exc, /* o : excitation for SWB TBE Q0 */
37 : const Word16 attack_flag, /* i : Flag that point to an attack coded with AC mode (GSC) */
38 : Word16 *lsf_new, /* i : current frame ISF vector Qx2.56 */
39 : Word16 *tmp_noise, /* o : noise energy Q2*/
40 : const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/
41 : const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/
42 : Word16 Q_new,
43 : Word16 shift )
44 : {
45 : const Word16 *p_Aq;
46 : Word16 i, i_subfr, nb_subfr, last_pit_bin;
47 : Word16 T0_tmp, T0_frac_tmp, nb_subfr_flag;
48 8 : Word16 tmp_nb_bits_tot = 0;
49 8 : move16();
50 : Word16 Es_pred;
51 : Word16 dct_res[L_FRAME16k], dct_epit[L_FRAME16k];
52 8 : Word16 m_mean = 0;
53 8 : move16();
54 : Word16 saved_bit_pos;
55 : Word16 exc_wo_nf[L_FRAME16k];
56 : Word32 Lm_mean;
57 : Word16 nb_bits;
58 : Word16 indice;
59 8 : SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas;
60 8 : GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
61 8 : BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
62 8 : LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;
63 :
64 8 : m_mean = 0;
65 8 : move16();
66 8 : tmp_nb_bits_tot = 0;
67 8 : move16();
68 :
69 8 : T0_tmp = 64;
70 8 : move16();
71 8 : T0_frac_tmp = 0;
72 8 : move16();
73 8 : Copy( hLPDmem->mem_syn, hGSCEnc->mem_syn_tmp_fx, M ); /* hLPDmem->q_mem_syn */
74 8 : hGSCEnc->mem_w0_tmp_fx = hLPDmem->mem_w0;
75 8 : move16();
76 8 : Es_pred = 0;
77 8 : move16();
78 :
79 : /*---------------------------------------------------------------*
80 : * Encode GSC IVAS mode
81 : * Encode GSC attack flag (used to reduce possible pre-echo)
82 : * Encode GSC SWB speech flag
83 : *---------------------------------------------------------------*/
84 :
85 8 : IF( attack_flag > 0 )
86 : {
87 0 : push_indice( hBstr, IND_GSC_ATTACK, 1, 1 );
88 : }
89 : ELSE
90 : {
91 8 : push_indice( hBstr, IND_GSC_ATTACK, 0, 1 );
92 : }
93 :
94 :
95 8 : test();
96 8 : test();
97 8 : test();
98 8 : test();
99 8 : test();
100 8 : test();
101 8 : test();
102 8 : IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( NE_16( st_fx->coder_type, INACTIVE ) && ( ( EQ_16( st_fx->element_mode, EVS_MONO ) && GE_32( st_fx->total_brate, ACELP_13k20 ) ) ||
103 : ( GT_16( st_fx->element_mode, EVS_MONO ) && GT_32( st_fx->total_brate, MIN_BRATE_GSC_NOISY_FLAG ) && GE_16( st_fx->bwidth, SWB ) && !st_fx->flag_ACELP16k ) ) ) )
104 : {
105 0 : push_indice( hBstr, IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1 );
106 : }
107 : /*---------------------------------------------------------------*
108 : * Find and encode the number of subframes
109 : *---------------------------------------------------------------*/
110 8 : test();
111 8 : IF( GE_32( st_fx->core_brate, ACELP_9k60 ) && LE_32( st_fx->core_brate, ACELP_13k20 ) )
112 : {
113 48 : FOR( i = 0; i < 5; i++ )
114 : {
115 40 : test();
116 40 : if ( GT_16( abs_s( hSpMusClas->gsc_lt_diff_etot_fx[MAX_LT - i - 1] ), 1536 /*6.0 in Q8*/ ) && EQ_16( hGSCEnc->cor_strong_limit, 1 ) )
117 : {
118 0 : hGSCEnc->cor_strong_limit = 0;
119 0 : move16();
120 : }
121 : }
122 : }
123 8 : test();
124 8 : test();
125 8 : test();
126 8 : test();
127 8 : IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( st_fx->GSC_noisy_speech && st_fx->GSC_IVAS_mode == 0 ) )
128 : {
129 0 : nb_subfr = NB_SUBFR;
130 0 : move16();
131 0 : test();
132 0 : test();
133 0 : if ( st_fx->GSC_IVAS_mode > 0 && LT_16( st_fx->GSC_IVAS_mode, 3 ) && LT_32( st_fx->core_brate, GSC_L_RATE_STG ) )
134 : {
135 0 : nb_subfr = 2;
136 0 : move16();
137 : }
138 0 : hGSCEnc->cor_strong_limit = 0;
139 0 : move16();
140 0 : nb_subfr_flag = 1;
141 0 : move16();
142 : }
143 8 : ELSE IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && ( LE_32( st_fx->core_brate, ACELP_13k20 ) || EQ_16( st_fx->coder_type, INACTIVE ) ) )
144 : {
145 0 : hGSCEnc->cor_strong_limit = 0;
146 0 : nb_subfr = SWNB_SUBFR;
147 0 : nb_subfr_flag = 1;
148 0 : move16();
149 0 : move16();
150 0 : move16();
151 : }
152 : ELSE
153 : {
154 8 : test();
155 8 : test();
156 8 : IF( ( hGSCEnc->cor_strong_limit == 0 || EQ_16( st_fx->coder_type, INACTIVE ) ) && GE_32( st_fx->core_brate, ACELP_9k60 ) )
157 : {
158 8 : nb_subfr = 2;
159 8 : move16();
160 8 : nb_subfr_flag = 0;
161 8 : move16();
162 8 : hGSCEnc->cor_strong_limit = 0;
163 8 : move16();
164 : }
165 : ELSE
166 : {
167 0 : nb_subfr = SWNB_SUBFR;
168 0 : move16();
169 0 : nb_subfr_flag = 1;
170 0 : move16();
171 : }
172 :
173 8 : test();
174 8 : test();
175 8 : test();
176 8 : IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && ( GT_16( hSpMusClas->mold_corr_fx, 26214 ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) && NE_16( st_fx->coder_type, INACTIVE ) ) )
177 : {
178 0 : nb_subfr = shl( nb_subfr, 1 );
179 0 : nb_subfr_flag = s_or( nb_subfr_flag, 0x2 );
180 0 : logic16();
181 : }
182 :
183 8 : IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) )
184 : {
185 0 : push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 2 );
186 : }
187 8 : ELSE IF( GE_32( st_fx->core_brate, ACELP_9k60 ) )
188 : {
189 : /* nb_subfr_flag can only have the value 0 or 1 */
190 8 : push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 1 );
191 : }
192 : }
193 8 : test();
194 8 : if ( EQ_16( st_fx->L_frame, L_FRAME16k ) && EQ_16( nb_subfr, NB_SUBFR ) )
195 : {
196 0 : nb_subfr = NB_SUBFR16k;
197 0 : move16();
198 : }
199 :
200 : /*---------------------------------------------------------------*
201 : * Compute adaptive (pitch) excitation contribution
202 : *---------------------------------------------------------------*/
203 :
204 8 : test();
205 8 : test();
206 8 : test();
207 8 : test();
208 8 : test();
209 8 : test();
210 8 : test();
211 8 : test();
212 8 : IF( !( st_fx->GSC_IVAS_mode > 0 && EQ_16( st_fx->L_frame, i_mult( nb_subfr, 2 * L_SUBFR ) ) && LT_16( st_fx->GSC_IVAS_mode, 3 ) ) &&
213 : ( ( GE_32( st_fx->core_brate, MIN_RATE_FCB ) || st_fx->GSC_noisy_speech ) &&
214 : ( ( EQ_16( nb_subfr, NB_SUBFR ) && EQ_16( st_fx->L_frame, L_FRAME ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && EQ_16( st_fx->L_frame, L_FRAME16k ) ) ) ) )
215 : {
216 0 : IF( ( st_fx->element_mode > EVS_MONO ) )
217 : {
218 0 : nb_bits = 5;
219 0 : move16();
220 : }
221 : ELSE
222 : {
223 0 : nb_bits = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx( st_fx->core_brate, GENERIC, -1, -1 )];
224 0 : move16();
225 : }
226 0 : Es_pred_enc_fx( &Es_pred, &indice, st_fx->L_frame, res, st_fx->voicing_fx, nb_bits, 0, Q_new );
227 0 : push_indice( hBstr, IND_ES_PRED, indice, nb_bits );
228 : }
229 :
230 8 : enc_pit_exc_fx( st_fx, speech, Aw, Aq, Es_pred, res, synth, exc, &T0_tmp,
231 : &T0_frac_tmp, pitch_buf, nb_subfr, &hGSCEnc->lt_gpitch_fx, &saved_bit_pos, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new, shift );
232 :
233 : /*---------------------------------------------------------------*
234 : * DCT transform
235 : *---------------------------------------------------------------*/
236 8 : edct_16fx( exc, dct_epit, st_fx->L_frame, 7, st_fx->element_mode );
237 8 : edct_16fx( res, dct_res, st_fx->L_frame, 7, st_fx->element_mode );
238 : /*---------------------------------------------------------------*
239 : * Calculate energy dynamics
240 : *---------------------------------------------------------------*/
241 8 : Lm_mean = L_deposit_l( 0 );
242 72 : FOR( i = 7; i < 15; i++ )
243 : {
244 : /*m_mean = add(m_mean,edyn_fx( dct_res+i*16, 16, Q_new )); */
245 64 : Lm_mean = L_mac( Lm_mean, edyn_fx( dct_res + i * 16, 16, Q_new ), 4096 ); /*Q7*/
246 : }
247 8 : m_mean = round_fx( Lm_mean ); /*Q7*/
248 :
249 8 : IF( GT_16( m_mean, hGSCEnc->mid_dyn_fx ) )
250 : {
251 : /*st_fx->mid_dyn_fx = 0.2f * st_fx->mid_dyn_fx + 0.8f * m_mean;*/
252 5 : hGSCEnc->mid_dyn_fx = round_fx( L_mac( L_mult( 26214, m_mean ), 6554, hGSCEnc->mid_dyn_fx ) ); /*Q7*/
253 5 : move16();
254 : }
255 : ELSE
256 : {
257 : /*st_fx->mid_dyn_fx = 0.6f * st_fx->mid_dyn_fx + 0.4f * m_mean;*/
258 3 : hGSCEnc->mid_dyn_fx = round_fx( L_mac( L_mult( 13107, m_mean ), 19661, hGSCEnc->mid_dyn_fx ) ); /*Q7*/
259 3 : move16();
260 : }
261 8 : IF( NE_16( st_fx->coder_type, INACTIVE ) )
262 : {
263 0 : hGSCEnc->noise_lev = sub( ( NOISE_LEVEL_SP3 + 1 ), usquant_fx( hGSCEnc->mid_dyn_fx, &m_mean, MIN_DYNAMIC_FX, shr( GSF_NF_DELTA_FX, 1 ), GSC_NF_STEPS ) );
264 0 : move16();
265 0 : hGSCEnc->noise_lev = s_min( hGSCEnc->noise_lev, NOISE_LEVEL_SP3 );
266 0 : move16();
267 : }
268 :
269 8 : hGSCEnc->past_dyn_dec = hGSCEnc->noise_lev;
270 8 : move16();
271 8 : IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) )
272 : {
273 0 : hGSCEnc->noise_lev = NOISE_LEVEL_SP2;
274 0 : move16();
275 0 : IF( EQ_16( st_fx->GSC_IVAS_mode, 3 ) ) /* Music like */
276 : {
277 0 : hGSCEnc->noise_lev = NOISE_LEVEL_SP0;
278 0 : move16();
279 : }
280 0 : ELSE IF( st_fx->GSC_noisy_speech == 0 )
281 : {
282 0 : hGSCEnc->noise_lev = NOISE_LEVEL_SP3;
283 0 : move16();
284 : }
285 : }
286 8 : ELSE IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
287 : {
288 0 : hGSCEnc->noise_lev = s_max( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 );
289 0 : move16();
290 0 : push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ), 2 );
291 : }
292 8 : ELSE IF( st_fx->GSC_noisy_speech )
293 : {
294 0 : hGSCEnc->noise_lev = NOISE_LEVEL_SP3;
295 0 : move16();
296 0 : move16();
297 : }
298 : ELSE
299 : {
300 8 : push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP0 ), 3 );
301 : }
302 :
303 : /*---------------------------------------------------------------*
304 : * Find and encode the last band where the adaptive (pitch) contribution is significant
305 : *---------------------------------------------------------------*/
306 :
307 8 : last_pit_bin = Pit_exc_contribution_len_fx( st_fx, dct_res, dct_epit, pitch_buf, nb_subfr, &hGSCEnc->pit_exc_hangover, Q_new );
308 :
309 8 : IF( last_pit_bin == 0 )
310 : {
311 0 : hLPDmem->tilt_code = 0;
312 0 : move16();
313 : }
314 : ELSE
315 : {
316 : /*last_pit_bin++;*/
317 8 : last_pit_bin = add( last_pit_bin, 1 );
318 : }
319 :
320 : /*--------------------------------------------------------------------------------------*
321 : * GSC encoder
322 : *--------------------------------------------------------------------------------------*/
323 :
324 : /* Find the current total number of bits used */
325 8 : tmp_nb_bits_tot = hBstr->nb_bits_tot;
326 8 : move16();
327 :
328 :
329 8 : if ( st_fx->extl_brate > 0 )
330 : {
331 : /* subtract 1 bit for TBE/BWE BWE flag (bit counted in extl_brate) */
332 8 : tmp_nb_bits_tot = sub( tmp_nb_bits_tot, 1 );
333 : }
334 8 : test();
335 8 : test();
336 8 : if ( EQ_16( st_fx->coder_type, INACTIVE ) && LE_32( st_fx->core_brate, ACELP_9k60 ) && st_fx->idchan == 0 )
337 : {
338 : /* add 5 bits for noisiness */
339 0 : tmp_nb_bits_tot = add( tmp_nb_bits_tot, 5 );
340 : }
341 :
342 8 : gsc_enc_fx( st_fx, dct_res, dct_epit, last_pit_bin, tmp_nb_bits_tot, nb_subfr, lsf_new, exc_wo_nf, tmp_noise, Q_new );
343 :
344 : /*--------------------------------------------------------------------------------------*
345 : * iDCT transform
346 : *--------------------------------------------------------------------------------------*/
347 :
348 8 : edct_16fx( dct_epit, exc, st_fx->L_frame, 7, st_fx->element_mode );
349 8 : edct_16fx( exc_wo_nf, exc_wo_nf, st_fx->L_frame, 7, st_fx->element_mode );
350 : /*--------------------------------------------------------------------------------------*
351 : * Remove potential pre-echo in case an onset has been detected
352 : *--------------------------------------------------------------------------------------*/
353 :
354 8 : pre_echo_att_fx( &hGSCEnc->Last_frame_ener_fx, exc, attack_flag, Q_new, st_fx->last_coder_type, st_fx->L_frame );
355 :
356 : /*--------------------------------------------------------------------------------------*
357 : * Update BWE excitation
358 : *--------------------------------------------------------------------------------------*/
359 8 : IF( st_fx->hBWE_TD != NULL )
360 : {
361 8 : IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
362 : {
363 0 : set16_fx( voice_factors, 0, NB_SUBFR16k );
364 0 : interp_code_4over2_fx( exc, bwe_exc, L_FRAME16k );
365 : }
366 : ELSE
367 : {
368 8 : set16_fx( voice_factors, 0, NB_SUBFR );
369 8 : interp_code_5over2_fx( exc, bwe_exc, L_FRAME );
370 : }
371 : }
372 : /*--------------------------------------------------------------------------------------*
373 : * Synthesis
374 : *--------------------------------------------------------------------------------------*/
375 :
376 8 : p_Aq = Aq;
377 40 : FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_SUBFR )
378 : {
379 32 : Syn_filt_s( 1, p_Aq, M, &exc_wo_nf[i_subfr], &synth[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 );
380 32 : p_Aq += ( M + 1 );
381 : }
382 :
383 : /*--------------------------------------------------------------------------------------*
384 : * Updates
385 : *--------------------------------------------------------------------------------------*/
386 :
387 8 : hLPDmem->mem_w0 = hGSCEnc->mem_w0_tmp_fx; /*_DIFF_FLOAT_FIX_ The way it is written in the original fix point is that at this point mem_w0 falls back to its original value (before enc_pit_exc, seems not the case in float */
388 8 : move16();
389 8 : Copy( exc_wo_nf, exc, st_fx->L_frame );
390 :
391 8 : return;
392 : }
393 :
394 15087 : void encod_audio_ivas_fx(
395 : Encoder_State *st_fx, /* i/o: State structure */
396 : const Word16 speech[], /* i : input speech Q_new */
397 : const Word16 Aw[], /* i : weighted A(z) unquantized for subframes Q12 */
398 : const Word16 Aq[], /* i : 12k8 Lp coefficient Q12 */
399 : const Word16 *res, /* i : residual signal Q_new */
400 : Word16 *synth, /* i/o: core synthesis Q-1 */
401 : Word16 *exc, /* i/o: current non-enhanced excitation Q_new */
402 : Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6 */
403 : Word16 *voice_factors, /* o : voicing factors Q15 */
404 : Word16 *bwe_exc, /* o : excitation for SWB TBE Q0 */
405 : const Word16 attack_flag, /* i : Flag that point to an attack coded with AC mode (GSC) */
406 : Word16 *lsf_new, /* i : current frame ISF vector Qx2.56 */
407 : Word16 *tmp_noise, /* o : noise energy Q8*/
408 : const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
409 : const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
410 : Word16 Q_new,
411 : Word16 shift )
412 : {
413 : const Word16 *p_Aq;
414 : Word16 i, i_subfr, nb_subfr, last_pit_bin;
415 : Word16 T0_tmp, T0_frac_tmp, nb_subfr_flag;
416 15087 : Word16 tmp_nb_bits_tot = 0;
417 : Word16 Es_pred;
418 : Word16 dct_res[L_FRAME16k], dct_epit[L_FRAME16k];
419 15087 : Word16 m_mean = 0;
420 : Word16 saved_bit_pos;
421 : Word16 exc_wo_nf[L_FRAME16k];
422 : Word32 Lm_mean;
423 : Word16 nb_bits;
424 : Word16 indice;
425 15087 : SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas;
426 15087 : GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
427 15087 : BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
428 15087 : LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;
429 :
430 15087 : m_mean = 0;
431 15087 : move16();
432 15087 : tmp_nb_bits_tot = 0;
433 15087 : move16();
434 :
435 15087 : T0_tmp = 64;
436 15087 : move16();
437 15087 : T0_frac_tmp = 0;
438 15087 : move16();
439 15087 : Copy_Scale_sig( hLPDmem->mem_syn, hGSCEnc->mem_syn_tmp_fx, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) );
440 15087 : Copy_Scale_sig( &hLPDmem->mem_w0, &hGSCEnc->mem_w0_tmp_fx, 1, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) );
441 15087 : move16();
442 15087 : Es_pred = 0;
443 15087 : move16();
444 :
445 : /*---------------------------------------------------------------*
446 : * Encode GSC IVAS mode
447 : * Encode GSC attack flag (used to reduce possible pre-echo)
448 : * Encode GSC SWB speech flag
449 : *---------------------------------------------------------------*/
450 :
451 15087 : test();
452 15087 : if ( ( st_fx->element_mode > EVS_MONO ) && st_fx->idchan == 0 )
453 : {
454 15087 : push_indice( hBstr, IND_GSC_IVAS_SP, st_fx->GSC_IVAS_mode, 2 );
455 : }
456 :
457 15087 : IF( attack_flag > 0 )
458 : {
459 0 : push_indice( hBstr, IND_GSC_ATTACK, 1, 1 );
460 : }
461 : ELSE
462 : {
463 15087 : push_indice( hBstr, IND_GSC_ATTACK, 0, 1 );
464 : }
465 :
466 :
467 15087 : test();
468 15087 : test();
469 15087 : test();
470 15087 : test();
471 15087 : test();
472 15087 : test();
473 15087 : test();
474 15087 : IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( NE_16( st_fx->coder_type, INACTIVE ) && ( ( EQ_16( st_fx->element_mode, EVS_MONO ) && GE_32( st_fx->total_brate, ACELP_13k20 ) ) ||
475 : ( GT_16( st_fx->element_mode, EVS_MONO ) && GT_32( st_fx->total_brate, MIN_BRATE_GSC_NOISY_FLAG ) && GE_16( st_fx->bwidth, SWB ) && !st_fx->flag_ACELP16k ) ) ) )
476 : {
477 5491 : push_indice( hBstr, IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1 );
478 : }
479 : /*---------------------------------------------------------------*
480 : * Find and encode the number of subframes
481 : *---------------------------------------------------------------*/
482 15087 : test();
483 15087 : IF( GE_32( st_fx->core_brate, ACELP_9k60 ) && LE_32( st_fx->core_brate, ACELP_13k20 ) )
484 : {
485 21768 : FOR( i = 0; i < 5; i++ )
486 : {
487 18140 : test();
488 18140 : if ( GT_16( abs_s( hSpMusClas->gsc_lt_diff_etot_fx[MAX_LT - i - 1] ), 1536 ) && EQ_16( hGSCEnc->cor_strong_limit, 1 ) )
489 : {
490 101 : hGSCEnc->cor_strong_limit = 0;
491 101 : move16();
492 : }
493 : }
494 : }
495 15087 : test();
496 15087 : test();
497 15087 : test();
498 15087 : test();
499 15087 : IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( st_fx->GSC_noisy_speech && st_fx->GSC_IVAS_mode == 0 ) )
500 : {
501 5489 : nb_subfr = NB_SUBFR;
502 5489 : move16();
503 5489 : test();
504 5489 : test();
505 5489 : if ( st_fx->GSC_IVAS_mode > 0 && LT_16( st_fx->GSC_IVAS_mode, 3 ) && LT_32( st_fx->core_brate, GSC_L_RATE_STG ) )
506 : {
507 1975 : nb_subfr = 2;
508 1975 : move16();
509 : }
510 5489 : hGSCEnc->cor_strong_limit = 0;
511 5489 : move16();
512 5489 : nb_subfr_flag = 1;
513 5489 : move16();
514 : }
515 9598 : ELSE IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && ( LE_32( st_fx->core_brate, ACELP_13k20 ) || EQ_16( st_fx->coder_type, INACTIVE ) ) )
516 : {
517 2659 : hGSCEnc->cor_strong_limit = 0;
518 2659 : nb_subfr = SWNB_SUBFR;
519 2659 : nb_subfr_flag = 1;
520 2659 : move16();
521 2659 : move16();
522 2659 : move16();
523 : }
524 : ELSE
525 : {
526 6939 : test();
527 6939 : test();
528 6939 : IF( ( hGSCEnc->cor_strong_limit == 0 || EQ_16( st_fx->coder_type, INACTIVE ) ) && GE_32( st_fx->core_brate, ACELP_9k60 ) )
529 : {
530 1328 : nb_subfr = 2;
531 1328 : move16();
532 1328 : nb_subfr_flag = 0;
533 1328 : move16();
534 1328 : hGSCEnc->cor_strong_limit = 0;
535 1328 : move16();
536 : }
537 : ELSE
538 : {
539 5611 : nb_subfr = SWNB_SUBFR;
540 5611 : move16();
541 5611 : nb_subfr_flag = 1;
542 5611 : move16();
543 : }
544 :
545 6939 : test();
546 6939 : test();
547 6939 : test();
548 6939 : IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && ( GT_16( hSpMusClas->mold_corr_fx, 26214 ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) && NE_16( st_fx->coder_type, INACTIVE ) ) )
549 : {
550 0 : nb_subfr = shl( nb_subfr, 1 );
551 0 : nb_subfr_flag |= 0x2;
552 0 : logic16();
553 : }
554 :
555 6939 : test();
556 6939 : IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) )
557 : {
558 0 : push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 2 );
559 : }
560 6939 : ELSE IF( GE_32( st_fx->core_brate, ACELP_9k60 ) )
561 : {
562 : /* nb_subfr_flag can only have the value 0 or 1 */
563 1336 : push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 1 );
564 : }
565 : }
566 15087 : test();
567 15087 : if ( EQ_16( st_fx->L_frame, L_FRAME16k ) && EQ_16( nb_subfr, NB_SUBFR ) )
568 : {
569 0 : nb_subfr = NB_SUBFR16k;
570 0 : move16();
571 : }
572 :
573 : /*---------------------------------------------------------------*
574 : * Compute adaptive (pitch) excitation contribution
575 : *---------------------------------------------------------------*/
576 :
577 15087 : test();
578 15087 : test();
579 15087 : test();
580 15087 : test();
581 15087 : test();
582 15087 : test();
583 15087 : test();
584 15087 : test();
585 15087 : IF( !( st_fx->GSC_IVAS_mode > 0 && EQ_16( st_fx->L_frame, i_mult( nb_subfr, 2 * L_SUBFR ) ) && LT_16( st_fx->GSC_IVAS_mode, 3 ) ) &&
586 : ( ( GE_32( st_fx->core_brate, MIN_RATE_FCB ) || st_fx->GSC_noisy_speech ) &&
587 : ( ( EQ_16( nb_subfr, NB_SUBFR ) && EQ_16( st_fx->L_frame, L_FRAME ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && EQ_16( st_fx->L_frame, L_FRAME16k ) ) ) ) )
588 : {
589 684 : IF( ( st_fx->element_mode > EVS_MONO ) )
590 : {
591 684 : nb_bits = 5;
592 684 : move16();
593 : }
594 : ELSE
595 : {
596 0 : nb_bits = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx( st_fx->core_brate, GENERIC, -1, -1 )];
597 0 : move16();
598 : }
599 684 : Es_pred_enc_fx( &Es_pred, &indice, st_fx->L_frame, res, st_fx->voicing_fx, nb_bits, 0, Q_new );
600 684 : push_indice( hBstr, IND_ES_PRED, indice, nb_bits );
601 : }
602 :
603 15087 : enc_pit_exc_ivas_fx( st_fx, speech, Aw, Aq, Es_pred, res, synth, exc, &T0_tmp,
604 : &T0_frac_tmp, pitch_buf, nb_subfr, &hGSCEnc->lt_gpitch_fx, &saved_bit_pos, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new, shift );
605 :
606 : /*---------------------------------------------------------------*
607 : * DCT transform
608 : *---------------------------------------------------------------*/
609 15087 : edct_16fx( exc, dct_epit, st_fx->L_frame, 7, st_fx->element_mode );
610 15087 : edct_16fx( res, dct_res, st_fx->L_frame, 7, st_fx->element_mode );
611 : /*---------------------------------------------------------------*
612 : * Calculate energy dynamics
613 : *---------------------------------------------------------------*/
614 15087 : Lm_mean = L_deposit_l( 0 );
615 135783 : FOR( i = 7; i < 15; i++ )
616 : {
617 : /*m_mean = add(m_mean,edyn_fx( dct_res+i*16, 16, Q_new )); */
618 120696 : Lm_mean = L_mac( Lm_mean, edyn_fx( dct_res + i * 16, 16, Q_new ), 4096 ); /*Q7*/
619 : }
620 15087 : m_mean = round_fx( Lm_mean ); /*Q7*/
621 :
622 15087 : IF( GT_16( m_mean, hGSCEnc->mid_dyn_fx ) )
623 : {
624 : /*st_fx->mid_dyn_fx = 0.2f * st_fx->mid_dyn_fx + 0.8f * m_mean;*/
625 6850 : hGSCEnc->mid_dyn_fx = round_fx( L_mac( L_mult( 26214, m_mean ), 6554, hGSCEnc->mid_dyn_fx ) ); /*Q7*/
626 6850 : move16();
627 : }
628 : ELSE
629 : {
630 : /*st_fx->mid_dyn_fx = 0.6f * st_fx->mid_dyn_fx + 0.4f * m_mean;*/
631 8237 : hGSCEnc->mid_dyn_fx = round_fx( L_mac( L_mult( 13107, m_mean ), 19661, hGSCEnc->mid_dyn_fx ) ); /*Q7*/
632 8237 : move16();
633 : }
634 15087 : IF( NE_16( st_fx->coder_type, INACTIVE ) )
635 : {
636 10930 : hGSCEnc->noise_lev = sub( ( NOISE_LEVEL_SP3 + 1 ), usquant_fx( hGSCEnc->mid_dyn_fx, &m_mean, MIN_DYNAMIC_FX, shr( GSF_NF_DELTA_FX, 1 ), GSC_NF_STEPS ) );
637 10930 : move16();
638 10930 : hGSCEnc->noise_lev = s_min( hGSCEnc->noise_lev, NOISE_LEVEL_SP3 );
639 10930 : move16();
640 : }
641 :
642 15087 : hGSCEnc->past_dyn_dec = hGSCEnc->noise_lev;
643 15087 : move16();
644 15087 : IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) )
645 : {
646 4805 : hGSCEnc->noise_lev = NOISE_LEVEL_SP2;
647 4805 : move16();
648 4805 : IF( EQ_16( st_fx->GSC_IVAS_mode, 3 ) ) /* Music like */
649 : {
650 2801 : hGSCEnc->noise_lev = NOISE_LEVEL_SP0;
651 2801 : move16();
652 : }
653 2004 : ELSE IF( st_fx->GSC_noisy_speech == 0 )
654 : {
655 1901 : hGSCEnc->noise_lev = NOISE_LEVEL_SP3;
656 1901 : move16();
657 : }
658 : }
659 10282 : ELSE IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
660 : {
661 5048 : hGSCEnc->noise_lev = s_max( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 );
662 5048 : push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ), 2 );
663 : }
664 5234 : ELSE IF( st_fx->GSC_noisy_speech )
665 : {
666 684 : hGSCEnc->noise_lev = NOISE_LEVEL_SP3;
667 684 : move16();
668 : }
669 : ELSE
670 : {
671 4550 : push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP0 ), 3 );
672 : }
673 :
674 : /*---------------------------------------------------------------*
675 : * Find and encode the last band where the adaptive (pitch) contribution is significant
676 : *---------------------------------------------------------------*/
677 :
678 15087 : last_pit_bin = Pit_exc_contribution_len_ivas_fx( st_fx, dct_res, dct_epit, pitch_buf, nb_subfr, &hGSCEnc->pit_exc_hangover, Q_new );
679 :
680 15087 : IF( last_pit_bin == 0 )
681 : {
682 2309 : hLPDmem->tilt_code = 0;
683 2309 : move16();
684 : }
685 : ELSE
686 : {
687 : /*last_pit_bin++;*/
688 12778 : last_pit_bin = add( last_pit_bin, 1 );
689 : }
690 :
691 : /*--------------------------------------------------------------------------------------*
692 : * GSC encoder
693 : *--------------------------------------------------------------------------------------*/
694 :
695 : /* Find the current total number of bits used */
696 15087 : tmp_nb_bits_tot = hBstr->nb_bits_tot;
697 15087 : move16();
698 :
699 :
700 15087 : if ( st_fx->extl_brate > 0 )
701 : {
702 : /* subtract 1 bit for TBE/BWE BWE flag (bit counted in extl_brate) */
703 14971 : tmp_nb_bits_tot = sub( tmp_nb_bits_tot, 1 );
704 : }
705 15087 : test();
706 15087 : test();
707 15087 : if ( EQ_16( st_fx->coder_type, INACTIVE ) && LE_32( st_fx->core_brate, ACELP_9k60 ) && st_fx->idchan == 0 )
708 : {
709 : /* add 5 bits for noisiness */
710 327 : tmp_nb_bits_tot = add( tmp_nb_bits_tot, 5 );
711 : }
712 :
713 15087 : Word16 Q_exc = Q_new;
714 15087 : move16();
715 15087 : gsc_enc_ivas_fx( st_fx, dct_res, dct_epit, last_pit_bin, tmp_nb_bits_tot, nb_subfr, lsf_new, exc_wo_nf, tmp_noise, &Q_exc );
716 :
717 : /*--------------------------------------------------------------------------------------*
718 : * iDCT transform
719 : *--------------------------------------------------------------------------------------*/
720 :
721 15087 : edct_16fx( dct_epit, exc, st_fx->L_frame, 7, st_fx->element_mode );
722 15087 : Scale_sig( exc, st_fx->L_frame, sub( Q_new, Q_exc ) );
723 15087 : edct_16fx( exc_wo_nf, exc_wo_nf, st_fx->L_frame, 7, st_fx->element_mode );
724 15087 : Scale_sig( exc_wo_nf, st_fx->L_frame, sub( Q_new, Q_exc ) );
725 15087 : Q_exc = Q_new;
726 15087 : move16();
727 : /*--------------------------------------------------------------------------------------*
728 : * Remove potential pre-echo in case an onset has been detected
729 : *--------------------------------------------------------------------------------------*/
730 :
731 15087 : pre_echo_att_ivas_fx( &hGSCEnc->Last_frame_ener_fx, exc, attack_flag, Q_exc, st_fx->last_coder_type, st_fx->L_frame );
732 :
733 : /*--------------------------------------------------------------------------------------*
734 : * Update BWE excitation
735 : *--------------------------------------------------------------------------------------*/
736 15087 : IF( st_fx->hBWE_TD != NULL )
737 : {
738 15087 : IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
739 : {
740 2659 : set16_fx( voice_factors, 0, NB_SUBFR16k );
741 2659 : interp_code_4over2_fx( exc, bwe_exc, L_FRAME16k );
742 : }
743 : ELSE
744 : {
745 12428 : set16_fx( voice_factors, 0, NB_SUBFR );
746 12428 : interp_code_5over2_fx( exc, bwe_exc, L_FRAME );
747 : }
748 : }
749 : /*--------------------------------------------------------------------------------------*
750 : * Synthesis
751 : *--------------------------------------------------------------------------------------*/
752 :
753 15087 : p_Aq = Aq; /* Q12 */
754 78094 : FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_SUBFR )
755 : {
756 63007 : Syn_filt_s( 1, p_Aq, M, &exc_wo_nf[i_subfr], &synth[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 );
757 63007 : p_Aq += ( M + 1 );
758 : }
759 :
760 : /*--------------------------------------------------------------------------------------*
761 : * Updates
762 : *--------------------------------------------------------------------------------------*/
763 15087 : Copy_Scale_sig( &hGSCEnc->mem_w0_tmp_fx, &hLPDmem->mem_w0, 1, sub( hLPDmem->q_mem_syn, sub( Q_new, 1 ) ) );
764 : /*_DIFF_FLOAT_FIX_ The way it is written in the original fix point is that at this point mem_w0 falls back to its original value (before enc_pit_exc, seems not the case in float */
765 15087 : move16();
766 15087 : Copy( exc_wo_nf, exc, st_fx->L_frame ); /* Q_new */
767 :
768 15087 : return;
769 : }
770 :
771 : /*================================================================================*/
772 : /* FUNCTION : void gsc_enc_fx () */
773 : /*--------------------------------------------------------------------------------*/
774 : /* PURPOSE : Generic audio signal encoder */
775 : /*--------------------------------------------------------------------------------*/
776 : /* INPUT ARGUMENTS : */
777 : /* _ (Word16) res_dct_in : dct of residual signal Q_exc */
778 : /* _ (Word16) Diff_len : Lenght of the difference signal Q0 */
779 : /* _ (Word16) coder_type : coding type Q0 */
780 : /* _ (Word16) bits_used : Number of bit used before frequency Q Q0 */
781 : /* _ (Word16) nb_subfr : Number of subframe considered Q0 */
782 : /* _ (Word16) Qexc : Q format of exc_dct_in */
783 : /*--------------------------------------------------------------------------------*/
784 : /* OUTPUT ARGUMENTS : */
785 : /* _ None */
786 : /*--------------------------------------------------------------------------------*/
787 : /* INPUT/OUTPUT ARGUMENTS : */
788 : /* Encoder_State *st_fx:Encoder State Structure */
789 : /* _ (Word16[]) exc_dct_in : dctof pitch-only excitation / total excitation Q_exc */
790 : /*--------------------------------------------------------------------------------*/
791 : /* RETURN ARGUMENTS : */
792 : /* _None */
793 : /*================================================================================*/
794 :
795 :
796 8 : void gsc_enc_fx(
797 : Encoder_State *st_fx, /* i/o: State structure */
798 : Word16 res_dct_in[], /* i : dct of residual signal Q_exc*/
799 : Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation Q_exc*/
800 : const Word16 Diff_len,
801 : const Word16 bits_used,
802 : const Word16 nb_subfr,
803 : Word16 *lsf_new, /* i : ISFs at the end of the frame Qx2.56*/
804 : Word16 *exc_wo_nf, /* o : excitation (in f domain) without noisefill Q_exc*/
805 : Word16 *tmp_noise, /* o : noise energy Q2*/
806 : Word16 Q_exc )
807 : {
808 : Word16 y2_filt[L_FRAME16k];
809 : Word16 exc_diffQ[L_FRAME16k];
810 : Word16 exc_diff[L_FRAME16k];
811 : Word16 bit, tmp;
812 : Word16 nb_subbands;
813 : Word16 pvq_len, i;
814 : Word16 bits_per_bands[MBANDS_GN_BITALLOC16k];
815 : Word16 tmp_band;
816 : Word16 concat_in[L_FRAME16k];
817 : Word16 concat_out[L_FRAME16k];
818 : Word16 max_ener_band[MBANDS_GN_BITALLOC16k], j;
819 : Word16 Ener_per_bd_iQ[MBANDS_GN_BITALLOC16k];
820 : Word16 last_bin, mean_gain;
821 : Word16 bitallocation_band[MBANDS_GN_BITALLOC16k];
822 : Word16 bitallocation_exc[2];
823 :
824 : Word16 inpulses_fx[NB_SFM];
825 : Word16 imaxpulse_fx[NB_SFM];
826 : Word16 Q_tmp;
827 : Word16 seed_init;
828 8 : GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
829 8 : BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
830 :
831 8 : set16_fx( inpulses_fx, 0, NB_SFM );
832 8 : set16_fx( imaxpulse_fx, 0, NB_SFM );
833 :
834 : /*--------------------------------------------------------------------------------------*
835 : * Initialization
836 : *--------------------------------------------------------------------------------------*/
837 :
838 8 : bit = bits_used;
839 8 : move16();
840 8 : test();
841 8 : test();
842 8 : test();
843 8 : if ( EQ_16( st_fx->coder_type, INACTIVE ) && ( EQ_16( st_fx->tdm_LRTD_flag, 1 ) || EQ_16( st_fx->element_mode, IVAS_SCE ) ) && LE_32( st_fx->core_brate, GSC_LRES_GAINQ_LIMIT ) )
844 : {
845 0 : bit = add( bit, GSC_LRES_NB_NITS );
846 : }
847 8 : move16();
848 8 : set16_fx( exc_diffQ, 0, st_fx->L_frame );
849 8 : set16_fx( y2_filt, 0, st_fx->L_frame );
850 :
851 : /*--------------------------------------------------------------------------------------*
852 : * Calculate the difference between the residual spectrum and the spectrum of adaptive excitation
853 : * (non valuable temporal content present in exc_dct_in is already zeroed)
854 : *--------------------------------------------------------------------------------------*/
855 :
856 8 : Vr_subt( res_dct_in, exc_dct_in, exc_diff, st_fx->L_frame );
857 8 : exc_diff[0] = 0;
858 8 : move16();
859 :
860 : /*--------------------------------------------------------------------------------------*
861 : * Multiply the difference spectrum with the normalized spectral shape of the residual signal
862 : * This improves the stability of the differnece spectrum since the spectral shape of the
863 : * residual signal is less suseptible to rapid changes than the difference spectrum
864 : *--------------------------------------------------------------------------------------*/
865 8 : IF( Diff_len == 0 )
866 : {
867 0 : tmp_band = 0;
868 0 : move16();
869 : }
870 : ELSE
871 : {
872 8 : tmp_band = hGSCEnc->mem_last_pit_band;
873 8 : move16();
874 : }
875 :
876 8 : Ener_per_band_comp_fx( exc_diff, Ener_per_bd_iQ, Q_exc, MBANDS_GN, 1 /*, st_fx->L_frame IVAS_CODE*/ );
877 :
878 : /*--------------------------------------------------------------------------------------*
879 : * Gain quantizaion
880 : *--------------------------------------------------------------------------------------*/
881 8 : i = 0;
882 8 : move16();
883 48 : WHILE( LT_16( i, SIZE_BRATE_INTERMED_TBL ) )
884 : {
885 48 : IF( LE_32( st_fx->core_brate, brate_intermed_tbl[i] ) )
886 : {
887 8 : BREAK;
888 : }
889 40 : i++;
890 : }
891 :
892 8 : test();
893 8 : test();
894 8 : test();
895 8 : if ( GT_16( st_fx->element_mode, EVS_MONO ) && EQ_16( st_fx->coder_type, AUDIO ) &&
896 0 : LE_32( st_fx->core_brate, STEREO_GSC_BIT_RATE_ALLOC ) && EQ_32( brate_intermed_tbl[i], ACELP_9k60 ) ) /* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */
897 : {
898 0 : i--;
899 : }
900 :
901 8 : mean_gain = gsc_gainQ_fx( hBstr, /*st_fX->element_mode, st_fx->idchan,IVAS_CODE*/ Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth /*, st_fx->L_frame, st_fx->tdm_LRTD_flag, st_fx->core_brate*/ );
902 :
903 8 : *tmp_noise = mult_r( 320, mean_gain ); /*10 in Q5 lp_gainc in Q3 */
904 8 : move16();
905 :
906 : /*--------------------------------------------------------------------------------------*
907 : * Frequency encoder
908 : *--------------------------------------------------------------------------------------*/
909 :
910 8 : bands_and_bit_alloc_fx( hGSCEnc->cor_strong_limit, hGSCEnc->noise_lev, st_fx->core_brate, Diff_len, bit, &bit, Ener_per_bd_iQ,
911 8 : max_ener_band, bits_per_bands, &nb_subbands, exc_diff, concat_in, &pvq_len, st_fx->coder_type, st_fx->bwidth,
912 8 : st_fx->GSC_noisy_speech, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );
913 :
914 8 : Q_tmp = Q_exc;
915 8 : move16();
916 8 : IF( bit == 0 )
917 : {
918 0 : set16_fx( concat_out, 0, L_FRAME16k );
919 : }
920 : ELSE
921 : {
922 8 : tmp = pvq_core_enc_fx( hBstr, concat_in, concat_out, &Q_tmp, bit, nb_subbands, gsc_sfm_start, gsc_sfm_end,
923 : gsc_sfm_size, bits_per_bands, NULL, inpulses_fx, imaxpulse_fx, ACELP_CORE );
924 8 : Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */
925 8 : bit = sub( bit, tmp );
926 : }
927 : /* write unused bits */
928 8 : WHILE( bit > 0 )
929 : {
930 0 : i = s_min( bit, 16 );
931 0 : push_indice( hBstr, IND_UNUSED, 0, i );
932 0 : bit = sub( bit, i );
933 : }
934 : /* Reorder Q bands */
935 8 : seed_init = 0;
936 8 : move16();
937 8 : last_bin = 0;
938 8 : move16();
939 8 : set16_fx( bitallocation_band, 0, MBANDS_GN_BITALLOC16k );
940 :
941 72 : FOR( j = 0; j < nb_subbands; j++ )
942 : {
943 64 : Copy( concat_out + j * 16, exc_diffQ + max_ener_band[j] * 16, 16 ); /*Q12*/
944 :
945 64 : last_bin = s_max( last_bin, max_ener_band[j] );
946 :
947 64 : bitallocation_band[max_ener_band[j]] = 1;
948 64 : move16();
949 :
950 64 : seed_init = add( seed_init, inpulses_fx[j] );
951 64 : move16();
952 : }
953 8 : test();
954 8 : IF( NE_16( st_fx->last_coder_type, AUDIO ) /* First audio frame */
955 : && NE_16( st_fx->last_coder_type, UNVOICED ) ) /* last_coder_type == INACTIVE is overwritten in update_enc to UNVOICED */
956 : {
957 258 : FOR( j = 0; j < shl( nb_subbands, 4 ); j++ )
958 : {
959 256 : IF( concat_out[j] > 0 )
960 : {
961 31 : seed_init = extract_l( L_shl( seed_init, 3 ) );
962 : }
963 256 : IF( concat_out[j] < 0 )
964 : {
965 37 : seed_init = add( seed_init, 3 );
966 37 : move16();
967 : }
968 : }
969 2 : hGSCEnc->seed_tcx = seed_init;
970 2 : move16();
971 : }
972 8 : test();
973 8 : IF( EQ_32( st_fx->core_brate, ACELP_8k00 ) && NE_16( st_fx->bwidth, NB ) )
974 : {
975 0 : bitallocation_exc[0] = 0;
976 0 : move16();
977 0 : bitallocation_exc[1] = 0;
978 0 : move16();
979 0 : if ( exc_diffQ[L_FRAME8k - 2] != 0 )
980 : {
981 0 : bitallocation_exc[0] = 1;
982 0 : move16();
983 : }
984 0 : if ( exc_diffQ[L_FRAME8k - 1] != 0 )
985 : {
986 0 : bitallocation_exc[1] = 1;
987 0 : move16();
988 : }
989 : }
990 :
991 : /*--------------------------------------------------------------------------------------*
992 : * Skip adaptive (pitch) contribution frequency band (no noise added over the adaptive (pitch) contribution)
993 : * Find x pulses between 1.6-3.2kHz to code in the spectrum of the residual signal
994 : * Gain is based on the inter-correlation gain between the pulses found and residual signal
995 : *--------------------------------------------------------------------------------------*/
996 :
997 : {
998 8 : freq_dnw_scaling_fx( hGSCEnc->cor_strong_limit, st_fx->coder_type, hGSCEnc->noise_lev, st_fx->core_brate, exc_diffQ, Q_PVQ_OUT, st_fx->L_frame );
999 : }
1000 : /*--------------------------------------------------------------------------------------*
1001 : * Estimate noise level
1002 : *--------------------------------------------------------------------------------------*/
1003 :
1004 8 : highband_exc_dct_in_fx( st_fx->core_brate, mfreq_bindiv_loc, last_bin, Diff_len, hGSCEnc->noise_lev, tmp_band, exc_diffQ,
1005 8 : &hGSCEnc->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new,
1006 8 : hGSCEnc->last_exc_dct_in_fx, &st_fx->last_ener_fx, hGSCEnc->last_bitallocation_band, bitallocation_exc, 0, st_fx->coder_type,
1007 8 : st_fx->bwidth, exc_wo_nf, Q_PVQ_OUT, Q_exc, st_fx->GSC_noisy_speech, NULL, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );
1008 :
1009 8 : exc_dct_in[0] = 0;
1010 8 : move16();
1011 :
1012 8 : return;
1013 : }
1014 :
1015 :
1016 22650 : void gsc_enc_ivas_fx(
1017 : Encoder_State *st, /* i/o: State structure */
1018 : Word16 res_dct_in_fx[],
1019 : /* i : dct of residual signal */ // Q_exc
1020 : Word16 exc_dct_in_fx[],
1021 : /* i/o: dct of pitch-only excitation / total excitation */ // Q_exc
1022 : const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/
1023 : const Word16 bits_used, /* i : Number of bit used before frequency Q */
1024 : const Word16 nb_subfr, /* i : Number of subframe considered */
1025 : const Word16 *lsf_new_fx, /* Qx2.56 */
1026 : /* i : ISFs at the end of the frame */ // Q15
1027 : Word16 *exc_wo_nf_fx,
1028 : /* o : excitation (in f domain) without noisefill */ // Q_exc
1029 : Word16 *tmp_noise_fx, /* o : long-term noise energy Q8*/
1030 : Word16 *Q_exc )
1031 : {
1032 : Word16 i;
1033 : GSC_ENC_HANDLE hGSCEnc;
1034 : BSTR_ENC_HANDLE hBstr;
1035 : Word16 exc_diffQ_fx[L_FRAME16k];
1036 : Word16 exc_diff_fx[L_FRAME16k];
1037 : Word16 bit;
1038 : Word16 nb_subbands;
1039 : Word16 pvq_len;
1040 : Word16 bits_per_bands[MBANDS_GN_BITALLOC16k]; /*Q3*/
1041 : Word16 tmp_band;
1042 : Word16 concat_in_fx[L_FRAME16k];
1043 : Word16 concat_out_fx[L_FRAME16k];
1044 : Word16 max_ener_band[MBANDS_GN_BITALLOC16k], j;
1045 : Word16 Ener_per_bd_iQ_fx[MBANDS_GN16k];
1046 : Word16 last_bin;
1047 : Word16 bitallocation_band[MBANDS_GN_BITALLOC16k];
1048 : Word16 bitallocation_exc[2];
1049 : Word16 npulses[NB_SFM];
1050 : Word16 maxpulse[NB_SFM];
1051 : Word16 mean_gain_fx;
1052 : Word16 seed_init;
1053 : Word32 L_tmp;
1054 : Word16 max_eq;
1055 :
1056 : /*--------------------------------------------------------------------------------------*
1057 : * Initialization
1058 : *--------------------------------------------------------------------------------------*/
1059 :
1060 22650 : hGSCEnc = st->hGSCEnc;
1061 22650 : hBstr = st->hBstr;
1062 :
1063 22650 : bit = bits_used;
1064 22650 : move16();
1065 :
1066 22650 : test();
1067 22650 : test();
1068 22650 : test();
1069 22650 : if ( st->coder_type == INACTIVE && ( EQ_16( st->tdm_LRTD_flag, 1 ) || EQ_16( st->element_mode, IVAS_SCE ) ) && LE_32( st->core_brate, GSC_LRES_GAINQ_LIMIT ) )
1070 : {
1071 7044 : bit = add( bit, GSC_LRES_NB_NITS );
1072 : }
1073 :
1074 22650 : set16_fx( exc_diffQ_fx, 0, st->L_frame );
1075 22650 : set16_fx( Ener_per_bd_iQ_fx, 0, MBANDS_GN16k );
1076 :
1077 : /*--------------------------------------------------------------------------------------*
1078 : * Calculate the difference between the residual spectrum and the spectrum of adaptive excitation
1079 : * (non valuable temporal content present in exc_dct_in is already zeroed)
1080 : *--------------------------------------------------------------------------------------*/
1081 :
1082 22650 : v_sub_16( res_dct_in_fx, exc_dct_in_fx, exc_diff_fx, st->L_frame ); /* Q_exc */
1083 22650 : exc_diff_fx[0] = 0;
1084 22650 : move16();
1085 :
1086 : /*--------------------------------------------------------------------------------------*
1087 : * Multiply the difference spectrum with the normalized spectral shape of the residual signal
1088 : * This improves the stability of the differnece spectrum since the spectral shape of the
1089 : * residual signal is less suseptible to rapid changes than the difference spectrum
1090 : *--------------------------------------------------------------------------------------*/
1091 :
1092 22650 : IF( Diff_len == 0 )
1093 : {
1094 2309 : tmp_band = 0;
1095 : }
1096 : ELSE
1097 : {
1098 20341 : tmp_band = hGSCEnc->mem_last_pit_band;
1099 : }
1100 22650 : move16();
1101 :
1102 22650 : Ener_per_band_comp_ivas_fx( exc_diff_fx, Ener_per_bd_iQ_fx, *Q_exc, MBANDS_GN, 1, st->L_frame );
1103 :
1104 : /*--------------------------------------------------------------------------------------*
1105 : * Gain quantizaion
1106 : *--------------------------------------------------------------------------------------*/
1107 :
1108 22650 : i = 0;
1109 22650 : move16();
1110 :
1111 105626 : WHILE( LT_16( i, SIZE_BRATE_INTERMED_TBL ) )
1112 : {
1113 105626 : IF( LE_32( st->core_brate, brate_intermed_tbl[i] ) )
1114 : {
1115 22650 : BREAK;
1116 : }
1117 82976 : i++;
1118 : }
1119 :
1120 22650 : test();
1121 22650 : test();
1122 22650 : test();
1123 33580 : if ( st->element_mode > EVS_MONO && EQ_16( st->coder_type, AUDIO ) &&
1124 17874 : LE_32( st->core_brate, STEREO_GSC_BIT_RATE_ALLOC ) && EQ_32( brate_intermed_tbl[i], ACELP_9k60 ) ) /* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */
1125 : {
1126 1221 : i--;
1127 : }
1128 :
1129 22650 : mean_gain_fx = gsc_gainQ_ivas_fx( hBstr, st->element_mode, st->idchan, Ener_per_bd_iQ_fx, Ener_per_bd_iQ_fx, brate_intermed_tbl[i], st->coder_type, st->bwidth, st->L_frame, st->tdm_LRTD_flag, st->core_brate );
1130 :
1131 22650 : *tmp_noise_fx = mult( mean_gain_fx, 20480 ); // 20480 => 10 in Q11
1132 22650 : move16(); // Q8
1133 :
1134 : /*--------------------------------------------------------------------------------------*
1135 : * PVQ encoder
1136 : *--------------------------------------------------------------------------------------*/
1137 :
1138 22650 : bands_and_bit_alloc_ivas_fx( hGSCEnc->cor_strong_limit, hGSCEnc->noise_lev, st->core_brate, Diff_len, bit, &bit, Ener_per_bd_iQ_fx, max_ener_band, bits_per_bands, &nb_subbands, exc_diff_fx, concat_in_fx, &pvq_len, st->coder_type, st->bwidth, st->GSC_noisy_speech, st->L_frame, st->element_mode, st->GSC_IVAS_mode );
1139 :
1140 22650 : set16_fx( npulses, 0, NB_SFM );
1141 :
1142 22650 : IF( bit == 0 )
1143 : {
1144 0 : set16_fx( concat_out_fx, 0, L_FRAME16k );
1145 : }
1146 : ELSE
1147 : {
1148 22650 : Word16 Q_concat = Q12;
1149 22650 : move16();
1150 22650 : bit = sub( bit, pvq_core_enc_ivas_fx( hBstr, concat_in_fx, concat_out_fx, &Q_concat, bit, nb_subbands, gsc_sfm_start, gsc_sfm_end, gsc_sfm_size, bits_per_bands, NULL, npulses, maxpulse, ACELP_CORE ) );
1151 : }
1152 :
1153 : /* write unused bits */
1154 22650 : WHILE( bit > 0 )
1155 : {
1156 0 : i = s_min( bit, 16 );
1157 0 : push_indice( hBstr, IND_UNUSED, 0, i );
1158 0 : bit = sub( bit, i );
1159 : }
1160 :
1161 : /* Reorder Q bands */
1162 22650 : last_bin = 0;
1163 22650 : move16();
1164 22650 : set16_fx( bitallocation_band, 0, MBANDS_GN_BITALLOC16k );
1165 22650 : seed_init = 0;
1166 22650 : move16();
1167 :
1168 22650 : max_eq = 0;
1169 22650 : move16();
1170 :
1171 22650 : test();
1172 22650 : test();
1173 22650 : test();
1174 22650 : test();
1175 22650 : IF( ( ( ( LT_32( st->core_brate, ACELP_7k20 ) && EQ_16( st->GSC_noisy_speech, 1 ) ) || LT_32( st->core_brate, 6000 ) ) && LE_16( st->coder_type, UNVOICED ) ) || GE_16( st->GSC_IVAS_mode, 1 ) )
1176 : {
1177 12306 : j = emaximum_fx( Q12, concat_out_fx, shl( nb_subbands, 4 ), &L_tmp );
1178 12306 : IF( LE_16( add( abs_s( concat_out_fx[j] ), 41 /* 0.01f in Q12 */ ), ONE_IN_Q12 ) )
1179 : {
1180 7022 : max_eq = 32767; /* Q15 */
1181 7022 : move16();
1182 : }
1183 : ELSE
1184 : {
1185 5284 : max_eq = div_s( ONE_IN_Q12, add( abs_s( concat_out_fx[j] ), 41 /* 0.01f in Q12 */ ) ); /* Q15 */
1186 : }
1187 : }
1188 :
1189 185427 : FOR( j = 0; j < nb_subbands; j++ )
1190 : {
1191 162777 : Copy( concat_out_fx + i_mult( j, 16 ), exc_diffQ_fx + i_mult( max_ener_band[j], 16 ), 16 ); /* Q12 */
1192 :
1193 162777 : IF( GT_16( max_ener_band[j], last_bin ) )
1194 : {
1195 118048 : last_bin = max_ener_band[j];
1196 118048 : move16();
1197 : }
1198 :
1199 162777 : bitallocation_band[max_ener_band[j]] = 1;
1200 162777 : move16();
1201 :
1202 162777 : seed_init = add( seed_init, npulses[j] );
1203 : }
1204 22650 : test();
1205 22650 : IF( NE_16( st->last_coder_type, AUDIO ) /* First audio frame */
1206 : && NE_16( st->last_coder_type, UNVOICED ) ) /* last_coder_type == INACTIVE is overwritten in update_enc to UNVOICED */
1207 : {
1208 461854 : FOR( j = 0; j < nb_subbands * 16; j++ )
1209 : {
1210 458384 : IF( concat_out_fx[j] > 0 )
1211 : {
1212 66934 : seed_init = (Word16) L_mult0( seed_init, 8 );
1213 66934 : move16();
1214 : }
1215 458384 : IF( concat_out_fx[j] < 0 )
1216 : {
1217 67240 : seed_init = (Word16) L_add( seed_init, 3 );
1218 67240 : move16();
1219 : }
1220 : }
1221 :
1222 3470 : hGSCEnc->seed_tcx = seed_init;
1223 3470 : move16();
1224 : }
1225 :
1226 22650 : test();
1227 22650 : IF( EQ_32( st->core_brate, ACELP_8k00 ) && st->bwidth != NB )
1228 : {
1229 43 : bitallocation_exc[0] = 0;
1230 43 : move16();
1231 43 : bitallocation_exc[1] = 0;
1232 43 : move16();
1233 :
1234 43 : if ( exc_diffQ_fx[L_FRAME8k - 2] != 0 )
1235 : {
1236 1 : bitallocation_exc[0] = 1;
1237 1 : move16();
1238 : }
1239 :
1240 43 : if ( exc_diffQ_fx[L_FRAME8k - 1] != 0 )
1241 : {
1242 4 : bitallocation_exc[1] = 1;
1243 4 : move16();
1244 : }
1245 : }
1246 :
1247 : /*--------------------------------------------------------------------------------------*
1248 : * Skip adaptive (pitch) contribution frequency band (no noise added over the adaptive (pitch) contribution)
1249 : * Find x pulses between 1.6-3.2kHz to code in the spectrum of the residual signal
1250 : * Gain is based on the inter-correlation gain between the pulses found and residual signal
1251 : *--------------------------------------------------------------------------------------*/
1252 :
1253 22650 : test();
1254 22650 : test();
1255 22650 : test();
1256 22650 : IF( st->GSC_IVAS_mode >= 1 && st->GSC_noisy_speech == 1 )
1257 : {
1258 19879 : FOR( i = 64; i < st->L_frame; i++ )
1259 : {
1260 19776 : exc_diffQ_fx[i] = mult( exc_diffQ_fx[i], max_eq ); /* Q12 */
1261 19776 : move16();
1262 : }
1263 : }
1264 22547 : ELSE IF( st->core_brate < ACELP_7k20 && st->GSC_noisy_speech == 1 && st->coder_type <= UNVOICED )
1265 : {
1266 1927757 : FOR( i = 0; i < L_FRAME; i++ )
1267 : {
1268 1920256 : exc_diffQ_fx[i] = mult( exc_diffQ_fx[i], max_eq ); /* Q12 */
1269 1920256 : move16();
1270 : }
1271 : }
1272 : ELSE
1273 : {
1274 15046 : freq_dnw_scaling_fx( hGSCEnc->cor_strong_limit, st->coder_type, hGSCEnc->noise_lev, st->core_brate, exc_diffQ_fx, Q12, st->L_frame );
1275 : }
1276 :
1277 22650 : Word16 Q_exc_new = s_min( *Q_exc, hGSCEnc->Q_last_exc_dct_in );
1278 22650 : IF( NE_16( Q_exc_new, hGSCEnc->Q_last_exc_dct_in ) )
1279 : {
1280 22599 : Scale_sig( hGSCEnc->last_exc_dct_in_fx, st->L_frame, sub( Q_exc_new, hGSCEnc->Q_last_exc_dct_in ) ); /* Q_exc_new */
1281 22599 : hGSCEnc->Q_last_exc_dct_in = Q_exc_new;
1282 22599 : move16();
1283 : }
1284 : ELSE
1285 : {
1286 51 : Scale_sig( exc_dct_in_fx, st->L_frame, sub( Q_exc_new, *Q_exc ) ); /* Q_exc_new */
1287 51 : *Q_exc = Q_exc_new;
1288 51 : move16();
1289 : }
1290 :
1291 : /*--------------------------------------------------------------------------------------*
1292 : * Estimate noise level
1293 : *--------------------------------------------------------------------------------------*/
1294 22650 : highband_exc_dct_in_ivas_fx( st->core_brate, mfreq_bindiv_loc, last_bin, Diff_len, hGSCEnc->noise_lev, tmp_band, exc_diffQ_fx /* Q12 */, &hGSCEnc->seed_tcx, Ener_per_bd_iQ_fx, nb_subfr, exc_dct_in_fx /* Q_exc */,
1295 22650 : st->last_coder_type, bitallocation_band, lsf_new_fx /* x2.56 */, hGSCEnc->last_exc_dct_in_fx /* Q_exc */, &hGSCEnc->last_ener_fx /* Q0 */, hGSCEnc->last_bitallocation_band, bitallocation_exc, 0, st->coder_type,
1296 22650 : st->bwidth, exc_wo_nf_fx, Q12, Q_exc, st->GSC_noisy_speech, NULL, st->L_frame, st->element_mode, st->GSC_IVAS_mode );
1297 :
1298 22650 : exc_dct_in_fx[0] = 0;
1299 22650 : move16();
1300 :
1301 22650 : return;
1302 : }
1303 :
1304 : /*======================================================================*/
1305 : /* FUNCTION : edyn_fx() */
1306 : /*----------------------------------------------------------------------*/
1307 : /* PURPOSE : Calculate energy dynamics in a vector */
1308 : /* (ratio of energy maximum to energy mean) */
1309 : /* */
1310 : /*----------------------------------------------------------------------*/
1311 : /* INPUT ARGUMENTS : */
1312 : /* _ (Word16 *) vec : ratio of max to mean Qnew */
1313 : /* _ (Word16) lvec : input vector */
1314 : /* _ (Word16) Q_new : */
1315 : /*-----------------------------------------------------------------------*/
1316 : /* OUTPUT ARGUMENTS : */
1317 : /* _ (Word16) dyn : ratio of energy maximum to energy mean (Q7) */
1318 : /*-----------------------------------------------------------------------*/
1319 :
1320 : /*-----------------------------------------------------------------------*/
1321 : /* RETURN ARGUMENTS : */
1322 : /* _ None */
1323 : /*=======================================================================*/
1324 :
1325 120760 : static Word16 edyn_fx( /* o : ratio of max to mean */
1326 : const Word16 *vec, /* i : input vector Qnew*/
1327 : const Word16 lvec, /* i : length of input vector */
1328 : Word16 Qnew )
1329 : {
1330 120760 : Word16 j = 0;
1331 : Word16 dyn;
1332 : Word32 L_tmp, ener_max, ener_mean;
1333 : Word16 tmp, exp2, tmp2, tmp1, exp1, exp3;
1334 : Word16 scale;
1335 :
1336 120760 : ener_mean = L_shl( 1, shl( Qnew, 1 ) ); /*2*Qnew*/
1337 120760 : ener_max = L_shl( 1, shl( Qnew, 1 ) );
1338 :
1339 2052920 : FOR( j = 0; j < lvec; j++ )
1340 : {
1341 1932160 : L_tmp = L_mult0( vec[j], vec[j] ); /*2*Qnew*/
1342 1932160 : ener_max = L_max( ener_max, L_tmp );
1343 1932160 : ener_mean = L_add_sat( ener_mean, L_tmp );
1344 : }
1345 : /*dyn = 10.0f * (ener_max / ener_mean);*/
1346 120760 : ener_mean = Mult_32_16( ener_mean, div_s( 1, lvec ) ); /*2*Qnew*/
1347 :
1348 120760 : IF( ener_mean > 0 )
1349 : {
1350 120760 : exp1 = norm_l( ener_mean );
1351 120760 : tmp1 = round_fx_sat( L_shl( ener_mean, exp1 ) );
1352 120760 : exp1 = sub( 30, exp1 );
1353 :
1354 120760 : exp2 = norm_l( ener_max );
1355 120760 : tmp2 = extract_h( L_shl( ener_max, exp2 ) );
1356 120760 : exp2 = sub( 30, exp2 );
1357 :
1358 120760 : scale = shr( sub( tmp1, tmp2 ), 15 );
1359 120760 : tmp2 = shl( tmp2, scale );
1360 120760 : exp2 = sub( exp2, scale );
1361 :
1362 120760 : exp3 = sub( exp1, exp2 );
1363 :
1364 120760 : tmp = div_s( tmp2, tmp1 ); /*Q(15+exp3)*/
1365 :
1366 120760 : L_tmp = L_shr_r( L_mult( tmp, 10 ), exp3 );
1367 120760 : dyn = round_fx( L_shl( L_tmp, 7 ) ); /*Q7*/
1368 : }
1369 : ELSE
1370 : {
1371 0 : dyn = 1280; /* 10.0f in Q7 */
1372 0 : move16();
1373 : }
1374 120760 : return dyn; /* Q7 */
1375 : }
1376 :
1377 :
1378 : /*-------------------------------------------------------------------*
1379 : * GSC_enc_init_fx()
1380 : *
1381 : * Initialize GSC encoder state structure
1382 : *-------------------------------------------------------------------*/
1383 :
1384 3898 : void GSC_enc_init_fx(
1385 : GSC_ENC_HANDLE hGSCEnc /* i/o: GSC data handle */
1386 : )
1387 : {
1388 : /* AC mode */
1389 3898 : hGSCEnc->seed_tcx = 15687; /* Q0 */
1390 3898 : move16();
1391 3898 : hGSCEnc->cor_strong_limit = 1;
1392 3898 : move16();
1393 3898 : set16_fx( hGSCEnc->last_exc_dct_in_fx, 0, L_FRAME16k );
1394 3898 : hGSCEnc->Q_last_exc_dct_in = Q15;
1395 3898 : move16();
1396 3898 : set16_fx( hGSCEnc->last_bitallocation_band, 0, 6 );
1397 :
1398 3898 : hGSCEnc->mem_last_pit_band = BAND1k2 + 1;
1399 3898 : move16();
1400 3898 : hGSCEnc->Last_frame_ener_fx = MAX_32;
1401 3898 : move32();
1402 3898 : hGSCEnc->lt_gpitch_fx = 0;
1403 3898 : move16();
1404 3898 : move16();
1405 3898 : hGSCEnc->pit_exc_hangover = 0;
1406 3898 : move16();
1407 :
1408 3898 : hGSCEnc->mem_w0_tmp_fx = 0;
1409 3898 : move16();
1410 :
1411 3898 : set16_fx( hGSCEnc->mem_syn_tmp_fx, 0, M );
1412 3898 : hGSCEnc->mid_dyn_fx = 5120; /*40 -> Q7 */
1413 3898 : move16();
1414 3898 : hGSCEnc->noise_lev = NOISE_LEVEL_SP0;
1415 3898 : move16();
1416 3898 : hGSCEnc->past_dyn_dec = 0;
1417 3898 : move16();
1418 :
1419 :
1420 3898 : return;
1421 : }
|