Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / libvorbis / test / util.c
bloba9e195606d31a72f89db62710ca2007537f3ad69
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
10 * *
11 ********************************************************************
13 function: utility functions for vorbis codec test suite.
14 last mod: $Id: util.c 13293 2007-07-24 00:09:47Z erikd $
16 ********************************************************************/
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <math.h>
21 #include <string.h>
22 #include <errno.h>
24 #include <vorbis/codec.h>
25 #include <vorbis/vorbisenc.h>
27 #include "util.h"
29 void
30 gen_windowed_sine (float *data, int len, float maximum)
31 { int k ;
33 memset (data, 0, len * sizeof (float)) ;
35 len /= 2 ;
37 for (k = 0 ; k < len ; k++)
38 { data [k] = sin (2.0 * k * M_PI * 1.0 / 32.0 + 0.4) ;
40 /* Apply Hanning Window. */
41 data [k] *= maximum * (0.5 - 0.5 * cos (2.0 * M_PI * k / ((len) - 1))) ;
44 return ;
47 void
48 set_data_in (float * data, unsigned len, float value)
49 { unsigned k ;
51 for (k = 0 ; k < len ; k++)
52 data [k] = value ;