⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 homing.c

📁 GSM中半速率语音编解码源码
💻 C
📖 第 1 页 / 共 2 页
字号:
 *
 *   OUTPUT:
 *      None
 *
 *   RETURN:
 *      None
 *
 *   REFERENCES: Sub-clause 10 of GSM Recomendation 06.02
 *
 *   KEYWORDS:
 **************************************************************************/

void   encoderReset(void)
{

/*_________________________________________________________________________
 |                                                                         |
 |   External declarations for encoder variables which need to be reset    |
 |_________________________________________________________________________|
*/

  /* variables defined in sp_enc.c */
  /* ----------------------------- */

  extern Shortword swOldR0;
  extern Shortword swOldR0Index;

  extern struct NormSw psnsWSfrmEngSpace[];

  extern Shortword pswHPFXState[];
  extern Shortword pswHPFYState[];
  extern Shortword pswOldFrmKs[];
  extern Shortword pswOldFrmAs[];
  extern Shortword pswOldFrmSNWCoefs[];
  extern Shortword pswWgtSpeechSpace[];

  extern Shortword pswSpeech[];        /* input speech */

  extern Shortword swPtch;


  /* variables defined in sp_frm.c */
  /* ----------------------------- */

  extern Shortword pswAnalysisState[NP];

  extern Shortword pswWStateNum[NP],
         pswWStateDenom[NP];


  /* variables defined in sp_sfrm.c */
  /* ------------------------------ */

  extern Shortword pswLtpStateBase[LTP_LEN + S_LEN];
  extern Shortword pswHState[NP];
  extern Shortword pswHNWState[HNW_BUFF_LEN];

/*_________________________________________________________________________
 |                                                                         |
 |   Automatic Variables                                                   |
 |_________________________________________________________________________|
*/

  int    i;

/*_________________________________________________________________________
 |                                                                         |
 |   Executable code                                                       |
 |_________________________________________________________________________|
*/

  /* reset all the encoder state variables */
  /* ------------------------------------- */

  swOldR0Index = 0;
  swOldR0 = 0;

  for (i = 0; i < 2 * N_SUB; i++)
  {
    psnsWSfrmEngSpace[i].man = 0;
    psnsWSfrmEngSpace[i].sh = 0;
  }

  for (i = 0; i < 4; i++)
    pswHPFXState[i] = 0;

  for (i = 0; i < 8; i++)
    pswHPFYState[i] = 0;

  for (i = 0; i < NP; i++)
  {
    pswOldFrmKs[i] = 0;
    pswOldFrmAs[i] = 0;
    pswOldFrmSNWCoefs[i] = 0;
    pswAnalysisState[i] = 0;
    pswWStateNum[i] = 0;
    pswWStateDenom[i] = 0;
    pswHState[i] = 0;
  }

  for (i = 0; i < (F_LEN + LMAX + CG_INT_MACS / 2); i++)
    pswWgtSpeechSpace[i] = 0;

  for (i = 0; i < INBUFFSZ; i++)
    pswSpeech[i] = 0;

  for (i = 0; i < (LTP_LEN + S_LEN); i++)
    pswLtpStateBase[i] = 0;

  for (i = 0; i < HNW_BUFF_LEN; i++)
    pswHNWState[i] = 0;

  swPtch = 1;
}

/***************************************************************************
 *
 *   FUNCTION NAME:  resetDec
 *
 *   PURPOSE:
 *      resets all of the state variables for the decoder, and for the
 *      receive DTX and Comfort Noise.
 *
 *   INPUT:
 *      None
 *
 *   OUTPUT:
 *      None
 *
 *   RETURN:
 *      None
 *
 *   REFERENCES: Sub-clause 10 of GSM Recomendation 06.02
 *
 *   KEYWORDS:
 **************************************************************************/

void   resetDec(void)
{
  decoderReset();                      /* reset all the state variables in
                                        * the speech decoder */
  dtxResetRx();                        /* reset all the receive DTX and CN
                                        * state variables */
}

/***************************************************************************
 *
 *   FUNCTION NAME:  resetEnc
 *
 *   PURPOSE:
 *      resets all of the state variables for the encoder and VAD, and for
 *      the transmit DTX and Comfort Noise.
 *
 *   INPUT:
 *      None
 *
 *   OUTPUT:
 *      None
 *
 *   RETURN:
 *      None
 *
 *   REFERENCES: Sub-clause 10 of GSM Recomendation 06.02
 *
 *   KEYWORDS:
 **************************************************************************/

void   resetEnc(void)
{

  encoderReset();                      /* reset all the state variables in
                                        * the speech encoder */
  vad_reset();                         /* reset all the VAD state variables */

  dtxResetTx();                        /* reset all the transmit DTX and CN
                                        * state variables */
}

/***************************************************************************
 *
 *   FUNCTION NAME:  dtxResetTx
 *
 *   PURPOSE:
 *      reset all the transmit DTX and CN state variables
 *
 *   INPUT:
 *      None
 *
 *   OUTPUT:
 *      None
 *
 *   RETURN:
 *      None
 *
 *   REFERENCES: Sub-clause 10 of GSM Recomendation 06.02
 *
 *   KEYWORDS:
 **************************************************************************/

void   dtxResetTx(void)
{

/*_________________________________________________________________________
 |                                                                         |
 |   External declarations for encoder variables which need to be reset    |
 |_________________________________________________________________________|
*/

  /* variables defined in sp_enc.c */
  /* ----------------------------- */

  extern Shortword swTxGsHistPtr;


  /* variables defined in dtx.c */
  /* -------------------------- */

  extern Shortword swVadFrmCnt;        /* Indicates the number of sequential
                                        * frames where VAD == 0 */
  extern short int siUpdPointer;
  extern Shortword swNElapsed;

/*_________________________________________________________________________
 |                                                                         |
 |   Automatic Variables                                                   |
 |_________________________________________________________________________|
*/


/*_________________________________________________________________________
 |                                                                         |
 |   Executable code                                                       |
 |_________________________________________________________________________|
*/

  /* reset all the transmit DTX and CN state variables */
  /* ------------------------------------------------- */

  swTxGsHistPtr = 0;

  swVadFrmCnt = 0;

  siUpdPointer = 0;

  swNElapsed = 50;

}

/***************************************************************************
 *
 *   FUNCTION NAME:  dtxResetRx
 *
 *   PURPOSE:
 *      reset all the receive DTX and CN state variables
 *
 *   INPUT:
 *      None
 *
 *   OUTPUT:
 *      None
 *
 *   RETURN:
 *      None
 *
 *   REFERENCES: Sub-clause 10 of GSM Recomendation 06.02
 *
 *   KEYWORDS:
 **************************************************************************/

void   dtxResetRx(void)
{

/*_________________________________________________________________________
 |                                                                         |
 |   External declarations for encoder variables which need to be reset    |
 |_________________________________________________________________________|
*/

  /* variables defined in sp_dec.c */
  /* ----------------------------- */

  extern Shortword swRxDTXState;
  extern Shortword swDecoMode;
  extern Shortword swDtxMuting;
  extern Shortword swDtxBfiCnt;

  extern Shortword swOldR0IndexDec;

  extern Shortword swRxGsHistPtr;
  extern Longword pL_RxGsHist[(OVERHANG - 1) * N_SUB];


/*_________________________________________________________________________
 |                                                                         |
 |   Automatic Variables                                                   |
 |_________________________________________________________________________|
*/

  int    i;


/*_________________________________________________________________________
 |                                                                         |
 |   Executable code                                                       |
 |_________________________________________________________________________|
*/

  /* reset all the receive DTX and CN state variables */
  /* ------------------------------------------------ */

  swRxDTXState = CNINTPER - 1;
  swDecoMode = SPEECH;
  swDtxMuting = 0;
  swDtxBfiCnt = 0;

  swOldR0IndexDec = 0;

  swRxGsHistPtr = 0;

  for (i = 0; i < (OVERHANG - 1) * N_SUB; i++)
    pL_RxGsHist[i] = 0;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -