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

📄 lsp.cpp

📁 实现3GPP的GSM中AMR语音的CODECS。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    {        /* fprintf(stderr, "lsp_reset: invalid parameter\n"); */        return -1;    }    /* Init lsp_old[] */    oscl_memcpy(st->lsp_old,   lsp_init_data,   M*sizeof(Word16));    /* Initialize lsp_old_q[] */    oscl_memcpy(st->lsp_old_q,   st->lsp_old,  M*sizeof(Word16));    /* Reset quantization state */    Q_plsf_reset(st->qSt);    return 0;}/*------------------------------------------------------------------------------ FUNCTION NAME: lsp_exit------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs:    st = Pointer to type lspState Outputs:    None Returns:    None Global Variables Used:    None Local Variables Needed:    None------------------------------------------------------------------------------ FUNCTION DESCRIPTION    Frees memory used by lspState.------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES lsp.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 lsp_exit(lspState **st){    if (st == NULL || *st == NULL)        return;    /* Deallocate members */    Q_plsf_exit(&(*st)->qSt);    /* deallocate memory */    oscl_free(*st);    *st = NULL;    return;}/*------------------------------------------------------------------------------ FUNCTION NAME: lsp------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs:    st = Pointer to type lspState -- State struct    req_mode = enum Mode -- requested coder mode    used_mode = enum Mode -- used coder mode    az = array of type Word16 -- interpolated LP parameters Q12 Outputs:    azQ = array of type Word16 -- quantization interpol. LP parameters Q12    lsp_new = array of type Word16 -- new lsp vector    anap = Double pointer of type Word16 -- analysis parameters    pOverflow = Pointer to type Flag -- Flag set when overflow occurs    st = Pointer to type lspState -- State struct    az = array of type Word16 -- interpolated LP parameters Q12 Returns:    None Global Variables Used:    None Local Variables Needed:    None------------------------------------------------------------------------------ FUNCTION DESCRIPTION------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES lsp.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 lsp(lspState *st,       /* i/o : State struct                            */         enum Mode req_mode, /* i   : requested coder mode                    */         enum Mode used_mode,/* i   : used coder mode                         */         Word16 az[],        /* i/o : interpolated LP parameters Q12          */         Word16 azQ[],       /* o   : quantization interpol. LP parameters Q12*/         Word16 lsp_new[],   /* o   : new lsp vector                          */         Word16 **anap,      /* o   : analysis parameters                     */         Flag   *pOverflow)  /* o   : Flag set when overflow occurs           */{    Word16 lsp_new_q[M];    /* LSPs at 4th subframe           */    Word16 lsp_mid[M], lsp_mid_q[M];    /* LSPs at 2nd subframe           */    Word16 pred_init_i; /* init index for MA prediction in DTX mode */    if (req_mode == MR122)    {        Az_lsp(&az[MP1], lsp_mid, st->lsp_old, pOverflow);        Az_lsp(&az[MP1 * 3], lsp_new, lsp_mid, pOverflow);        /*--------------------------------------------------------------------*         * Find interpolated LPC parameters in all subframes (both quantized  *         * and unquantized).                                                  *         * The interpolated parameters are in array A_t[] of size (M+1)*4     *         * and the quantized interpolated parameters are in array Aq_t[]      *         *--------------------------------------------------------------------*/        Int_lpc_1and3_2(st->lsp_old, lsp_mid, lsp_new, az, pOverflow);        if (used_mode != MRDTX)        {            /* LSP quantization (lsp_mid[] and lsp_new[] jointly quantized) */            Q_plsf_5(                st->qSt,                lsp_mid,                lsp_new,                lsp_mid_q,                lsp_new_q,                *anap,                pOverflow);            Int_lpc_1and3(st->lsp_old_q, lsp_mid_q, lsp_new_q, azQ, pOverflow);            /* Advance analysis parameters pointer */            (*anap) += 5;        }    }    else    {        Az_lsp(&az[MP1 * 3], lsp_new, st->lsp_old, pOverflow);  /* From A(z) to lsp  */        /*--------------------------------------------------------------------*         * Find interpolated LPC parameters in all subframes (both quantized  *         * and unquantized).                                                  *         * The interpolated parameters are in array A_t[] of size (M+1)*4     *         * and the quantized interpolated parameters are in array Aq_t[]      *         *--------------------------------------------------------------------*/        Int_lpc_1to3_2(st->lsp_old, lsp_new, az, pOverflow);        if (used_mode != MRDTX)        {            /* LSP quantization */            Q_plsf_3(                st->qSt,                req_mode,                lsp_new,                lsp_new_q,                *anap,                &pred_init_i,                pOverflow);            Int_lpc_1to3(                st->lsp_old_q,                lsp_new_q,                azQ,                pOverflow);            /* Advance analysis parameters pointer */            (*anap) += 3;        }    }    /* update the LSPs for the next frame */    oscl_memcpy(st->lsp_old,   lsp_new,   M*sizeof(Word16));    oscl_memcpy(st->lsp_old_q, lsp_new_q, M*sizeof(Word16));}

⌨️ 快捷键说明

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