1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH *
6 * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: window functions
14 last mod: $Id: window.c,v 1.12 2001/02/02 03:51:58 xiphmont Exp $
16 ********************************************************************/
23 float *_vorbis_window(int type, int window,int left,int right){
24 float *ret=_ogg_calloc(window,sizeof(float));
28 /* The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi) */
30 int leftbegin=window/4-left/2;
31 int rightbegin=window-window/4-right/2;
35 float x=(i+.5f)/left*M_PI/2.;
43 for(i=leftbegin+left;i<rightbegin;i++)
47 float x=(right-i-.5f)/right*M_PI/2.;