window.c

来自「关于AMR-WB+语音压缩编码的实现代码」· C语言 代码 · 共 31 行

C
31
字号
#include <math.h>
#define  PI2 6.283185307
#include "../include/amr_plus.h"
/*----------------------------------------------------------*
 * Procedure  cos_window:                                   *
 *            ~~~~~~~~~~~                                   *
 *    To find the cos window of length n1+n2                *
 *                                                          *
 * fh[i] = cos(-pi/2 ... pi/2)                              *
 *----------------------------------------------------------*/
void cos_window(float *fh, int n1, int n2)
{
  double cc, cte;
  int i;
  cte = 0.25*PI2/(float)n1;
  cc = 0.5*cte - 0.25*PI2;
  for (i = 0; i < n1; i++)
  {
    *fh++ = (float)cos(cc);
    cc += cte;
  }
  cte = 0.25*PI2/(float)n2;
  cc = 0.5*cte;
  for (i = 0; i < n2; i++)
  {
    *fh++ = (float)cos(cc);
    cc += cte;
  }
  return;
}

⌨️ 快捷键说明

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