comparison libgsmefr/d_gains.c @ 188:9b07190a6d08

libgsmefr/d_gains.c: perf opt
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 03 Jan 2023 03:30:09 +0000
parents a18782a7d270
children
comparison
equal deleted inserted replaced
187:6ad363f7ea30 188:9b07190a6d08
131 } 131 }
132 } 132 }
133 133
134 st->past_gain_pit = gain; 134 st->past_gain_pit = gain;
135 135
136 if (sub (st->past_gain_pit, 4096) > 0) /* if (past_gain_pit > 1.0) */ 136 if (st->past_gain_pit > 4096) /* if (past_gain_pit > 1.0) */
137 { 137 {
138 st->past_gain_pit = 4096; 138 st->past_gain_pit = 4096;
139 } 139 }
140 for (i = 1; i < 5; i++) 140 for (i = 1; i < 5; i++)
141 { 141 {
261 /*----------------- Test erasure ---------------*/ 261 /*----------------- Test erasure ---------------*/
262 262
263 if (bfi != 0) 263 if (bfi != 0)
264 { 264 {
265 tmp = gmed5 (st->gbuf); 265 tmp = gmed5 (st->gbuf);
266 if (sub (tmp, st->past_gain_code) < 0) 266 if (tmp < st->past_gain_code)
267 { 267 {
268 st->past_gain_code = tmp; 268 st->past_gain_code = tmp;
269 } 269 }
270 st->past_gain_code = mult (st->past_gain_code, cdown[state]); 270 st->past_gain_code = mult (st->past_gain_code, cdown[state]);
271 *gain_code = st->past_gain_code; 271 *gain_code = st->past_gain_code;
278 278
279 /* av_pred_en = 0.25*av_pred_en - 4/(20Log10(2)) */ 279 /* av_pred_en = 0.25*av_pred_en - 4/(20Log10(2)) */
280 av_pred_en = mult (av_pred_en, 8192); /* *= 0.25 */ 280 av_pred_en = mult (av_pred_en, 8192); /* *= 0.25 */
281 281
282 /* if (av_pred_en < -14/(20Log10(2))) av_pred_en = .. */ 282 /* if (av_pred_en < -14/(20Log10(2))) av_pred_en = .. */
283 if (sub (av_pred_en, -2381) < 0) 283 if (av_pred_en < -2381)
284 { 284 {
285 av_pred_en = -2381; 285 av_pred_en = -2381;
286 } 286 }
287 for (i = 3; i > 0; i--) 287 for (i = 3; i > 0; i--)
288 { 288 {
390 st->past_qua_en[0] = shr (frac, 5); 390 st->past_qua_en[0] = shr (frac, 5);
391 st->past_qua_en[0] = add (st->past_qua_en[0], shl (sub (exp, 11), 10)); 391 st->past_qua_en[0] = add (st->past_qua_en[0], shl (sub (exp, 11), 10));
392 392
393 update_gain_code_history_rx (st, *gain_code); 393 update_gain_code_history_rx (st, *gain_code);
394 394
395 if (sub (i_subfr, (3 * L_SUBFR)) == 0) 395 if (i_subfr == (3 * L_SUBFR))
396 { 396 {
397 st->gain_code_old_CN = *gain_code; 397 st->gain_code_old_CN = *gain_code;
398 } 398 }
399 } 399 }
400 else 400 else