1 /********************************************************************
3 * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS DISTRIBUTING. *
8 * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
9 * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************
14 function: window functions
15 last mod: $Id: window.c,v 1.8 2000/10/12 03:12:54 xiphmont Exp $
17 ********************************************************************/
24 float *_vorbis_window(int type, int window,int left,int right){
25 float *ret=calloc(window,sizeof(float));
29 /* The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi) */
31 int leftbegin=window/4-left/2;
32 int rightbegin=window-window/4-right/2;
36 float x=(i+.5)/left*M_PI/2.;
44 for(i=leftbegin+left;i<rightbegin;i++)
48 float x=(right-i-.5)/right*M_PI/2.;