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

📄 con_stch.c

📁 手机加密通话软件
💻 C
字号:
/* Copyright 2001,2002,2003 NAH6
 * All Rights Reserved
 *
 * Parts Copyright DoD, Parts Copyright Starium
 *
 */
#include "main.h"
#include "con_stch.h"
#include <stdio.h>

extern fxpt_16 StochCB[1082];   /* This is defined in StochCB.h */

/**************************************************************************
*                                                                         *
* ROUTINE
*               CalcStoch
*
* FUNCTION
*               Calculate Stochastic codebook contribution to synthesis
*               from code book index and gain
*
* SYNOPSIS
*               CalcStoch(s_index, s_gain, vector)
*
*   formal
*
*                       data    I/O
*       name            type    type    function
*       -------------------------------------------------------------------
*       s_index         int      i      stochastic codebook index
*       s_gain          fxpt_16  i      stochastic codebook gain
*       vector          fxpt_16  o      vector from stochastic codebook
*
**************************************************************************/
void ConstructStochCW(
int     s_index,
fxpt_16 s_gain,                 /* 11.4 format */
fxpt_16 vector[SF_LEN])         /* 15.0 format */
{
        int     codeword;
        int     i;

        /*  Copy selected vector to excitation array */
        codeword = 2 * (MAX_STOCH_CB_SIZE - s_index);
        if (codeword < 0) {
                CELP_PRINTF(("ConstructStochCW: Error in codeword calculation\n"));
                codeword = 0;
        }
        for (i = 0; i < SF_LEN; i++)
                switch (StochCB[i + codeword]) {
                case -1:
                        vector[i] = fxpt_shr16_round(fxpt_negate16(s_gain), 4);
                        break;
                case 0:
                        vector[i] = 0;
                        break;
                case 1:
                        vector[i] = fxpt_shr16_round(s_gain, 4);
                        break;
                default:
                        CELP_PRINTF(("Fatal: Error in stochastic codebook\n"));
                        CELP_PRINTF(("StochCB[%d] = %d\n", i+codeword,
                                StochCB[i+codeword]));
                        CELP_ABORT();
                }
}

⌨️ 快捷键说明

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