📄 sid_sync.cpp
字号:
FUNCTION NAME: sid_sync_exit------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs: state = pointer containing a pointer to the state structure used for SID synchronization (void) Outputs: None Returns: None Global Variables Used: None Local Variables Needed: None------------------------------------------------------------------------------ FUNCTION DESCRIPTION This function frees up the state structure used by sid_sync function. It stores NULL in *state.------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001------------------------------------------------------------------------------ PSEUDO-CODE------------------------------------------------------------------------------ RESOURCES USED [optional] When the code is written for a specific target processor the the resources used should be documented below. HEAP MEMORY USED: x bytes STACK MEMORY USED: x bytes CLOCK CYCLES: (cycle count equation for this function) + (variable used to represent cycle count for each subroutine called) where: (cycle count variable) = cycle count for [subroutine name]------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function]------------------------------------------------------------------------------*/void sid_sync_exit(void **state){ sid_syncState **st = (sid_syncState **) state; if (st == NULL || *st == NULL) { return; } /* deallocate memory */ oscl_free(*st); *st = NULL; return;}/****************************************************************************//*------------------------------------------------------------------------------ FUNCTION NAME: sid_sync_set_handover_debt------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs: st = pointer to the state structure used for SID synchronization (sid_syncState) debtFrames = number of handover debt frames (Word16) Outputs: st->sid_handover_debt is set to debtFrames Returns: return_value = 0 Global Variables Used: None Local Variables Needed: None------------------------------------------------------------------------------ FUNCTION DESCRIPTION This function updates the handover debt to debtFrames. Extra SID_UPD are scheduled to update remote decoder CNI states, right after an handover. This is primarily for use on MS UL side.------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001------------------------------------------------------------------------------ PSEUDO-CODE------------------------------------------------------------------------------ RESOURCES USED [optional] When the code is written for a specific target processor the the resources used should be documented below. HEAP MEMORY USED: x bytes STACK MEMORY USED: x bytes CLOCK CYCLES: (cycle count equation for this function) + (variable used to represent cycle count for each subroutine called) where: (cycle count variable) = cycle count for [subroutine name]------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function]------------------------------------------------------------------------------*/void sid_sync_set_handover_debt(sid_syncState *st, Word16 debtFrames){ /* debtFrames >= 0 */ st->sid_handover_debt = debtFrames; return;}/****************************************************************************//*------------------------------------------------------------------------------ FUNCTION NAME: sid_sync------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs: state = pointer to the state structure used for SID synchronization (sid_syncState) mode = codec mode (enum Mode) tx_frame_type = pointer to TX frame type store (enum TXFrameType) Outputs: tx_frame_type contains the new TX frame type Returns: None Global Variables Used: None Local Variables Needed: None------------------------------------------------------------------------------ FUNCTION DESCRIPTION This function performs SID frame synchronization to ensure that the mode only switches to a neighbouring mode.------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001------------------------------------------------------------------------------ PSEUDO-CODE------------------------------------------------------------------------------ RESOURCES USED [optional] When the code is written for a specific target processor the the resources used should be documented below. HEAP MEMORY USED: x bytes STACK MEMORY USED: x bytes CLOCK CYCLES: (cycle count equation for this function) + (variable used to represent cycle count for each subroutine called) where: (cycle count variable) = cycle count for [subroutine name]------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function]------------------------------------------------------------------------------*/void sid_sync(void *state, enum Mode mode, enum TXFrameType *tx_frame_type){ sid_syncState *st = (sid_syncState *) state; if (mode == MRDTX) { st->sid_update_counter--; if (st->prev_ft == TX_SPEECH_GOOD) { *tx_frame_type = TX_SID_FIRST; st->sid_update_counter = 3; } else { /* TX_SID_UPDATE or TX_NO_DATA */ if ((st->sid_handover_debt > 0) && (st->sid_update_counter > 2)) { /* ensure extra updates are properly delayed after a possible SID_FIRST */ *tx_frame_type = TX_SID_UPDATE; st->sid_handover_debt--; } else { if (st->sid_update_counter == 0) { *tx_frame_type = TX_SID_UPDATE; st->sid_update_counter = st->sid_update_rate; } else { *tx_frame_type = TX_NO_DATA; } } } } else { st->sid_update_counter = st->sid_update_rate ; *tx_frame_type = TX_SPEECH_GOOD; } st->prev_ft = *tx_frame_type;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -