FreeCalypso > hg > gsm-codec-lib
view libtwamr/sid_sync.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 | a8b73b1c5b19 |
children |
line wrap: on
line source
/* ***************************************************************************** * * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 * R99 Version 3.3.0 * REL-4 Version 4.1.0 * ***************************************************************************** * * File : sid_sync.h * Purpose : To ensure that the mode only switches to a * neighbouring mode * ***************************************************************************** */ #ifndef sid_sync_h #define sid_sync_h "$Id $" /* ***************************************************************************** * INCLUDE FILES ***************************************************************************** */ #include "tw_amr.h" #include "typedef.h" /* ****************************************************************************** * CONSTANTS ****************************************************************************** */ /* ****************************************************************************** * DEFINITION OF DATA TYPES ****************************************************************************** */ typedef struct { Word16 sid_update_rate; /* Send SID Update every sid_update_rate frame */ Word16 sid_update_counter; /* Number of frames since last SID */ Word16 sid_handover_debt; /* Number of extra SID_UPD frames to schedule*/ enum TXFrameType prev_ft; } sid_syncState; /* ***************************************************************************** * LOCAL VARIABLES AND TABLES ***************************************************************************** */ /* ***************************************************************************** * DECLARATION OF PROTOTYPES ***************************************************************************** */ void sid_sync_reset (sid_syncState *st); /* reset of sid_sync module (i.e. set state memory to zero) returns 0 on success */ int sid_sync_set_handover_debt (sid_syncState *st, /* i/o: sid_sync state */ Word16 debtFrames); /* update handover debt debtFrames extra SID_UPD are scheduled . to update remote decoder CNI states, right after an handover. (primarily for use on MS UL side ) */ void sid_sync(sid_syncState *st , /* i/o: sid_sync state */ enum Mode mode, enum TXFrameType *tx_frame_type); #endif