FreeCalypso > hg > gsm-codec-lib
view libgsmhr1/mathhalf.h @ 581:e2d5cad04cbf
libgsmhr1 RxFE: store CN R0+LPC separately from speech
In the original GSM 06.06 code the ECU for speech mode is entirely
separate from the CN generator, maintaining separate state. (The
main intertie between them is the speech vs CN state variable,
distinguishing between speech and CN BFIs, in addition to the
CN-specific function of distinguishing between initial and update
SIDs.)
In the present RxFE implementation I initially thought that we could
use the same saved_frame buffer for both ECU and CN, overwriting
just the first 4 params (R0 and LPC) when a valid SID comes in.
However, I now realize it was a bad idea: the original code has a
corner case (long sequence of speech-mode BFIs to put the ECU in
state 6, then SID and CN-mode BFIs, then a good speech frame) that
would be broken by that buffer reuse approach. We could eliminate
this corner case by resetting the ECU state when passing through
a CN insertion period, but doing so would needlessly increase
the behavioral diffs between GSM 06.06 and our version.
Solution: use a separate CN-specific buffer for CN R0+LPC parameters,
and match the behavior of GSM 06.06 code in this regard.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Feb 2025 10:02:45 +0000 |
parents | 597b39aef484 |
children |
line wrap: on
line source
#ifndef __MATHHALF #define __MATHHALF #include "typedefs.h" /*_________________________________________________________________________ | | | Function Prototypes | |_________________________________________________________________________| */ /* addition */ /************/ Shortword add(Shortword var1, Shortword var2); /* 1 ops */ Shortword sub(Shortword var1, Shortword var2); /* 1 ops */ Longword L_add(Longword L_var1, Longword L_var2); /* 2 ops */ Longword L_sub(Longword L_var1, Longword L_var2); /* 2 ops */ /* multiplication */ /******************/ Shortword mult(Shortword var1, Shortword var2); /* 1 ops */ Longword L_mult(Shortword var1, Shortword var2); /* 1 ops */ Shortword mult_r(Shortword var1, Shortword var2); /* 2 ops */ /* arithmetic shifts */ /*********************/ Shortword shr(Shortword var1, Shortword var2); /* 1 ops */ Shortword shl(Shortword var1, Shortword var2); /* 1 ops */ Longword L_shr(Longword L_var1, Shortword var2); /* 2 ops */ Longword L_shl(Longword L_var1, Shortword var2); /* 2 ops */ Shortword shift_r(Shortword var, Shortword var2); /* 2 ops */ Longword L_shift_r(Longword L_var, Shortword var2); /* 3 ops */ /* absolute value */ /*******************/ Shortword abs_s(Shortword var1); /* 1 ops */ Longword L_abs(Longword var1); /* 3 ops */ /* multiply accumulate */ /************************/ Longword L_mac(Longword L_var3, Shortword var1, Shortword var2); /* 1 op */ Shortword mac_r(Longword L_var3, Shortword var1, Shortword var2); /* 2 op */ Longword L_msu(Longword L_var3, Shortword var1, Shortword var2); /* 1 op */ Shortword msu_r(Longword L_var3, Shortword var1, Shortword var2); /* 2 op */ /* negation */ /*************/ Shortword negate(Shortword var1); /* 1 ops */ Longword L_negate(Longword L_var1); /* 2 ops */ /* Accumulator manipulation */ /****************************/ Longword L_deposit_l(Shortword var1); /* 1 ops */ Longword L_deposit_h(Shortword var1); /* 1 ops */ Shortword extract_l(Longword L_var1); /* 1 ops */ Shortword extract_h(Longword L_var1); /* 1 ops */ /* Round */ /*********/ Shortword round(Longword L_var1); /* 1 ops */ /* Normalization */ /*****************/ Shortword norm_l(Longword L_var1); /* 30 ops */ Shortword norm_s(Shortword var1); /* 15 ops */ /* Division */ /************/ Shortword divide_s(Shortword var1, Shortword var2); /* 18 ops */ #endif