VirtualBox

source: vbox/trunk/src/libs/libvorbis-1.3.7/test/util.c@ 103131

Last change on this file since 103131 was 96468, checked in by vboxsync, 2 years ago

libs/libvorbis-1.3.7: Re-exporting, hopefully this time everything is there. bugref:10275

File size: 1.6 KB
Line 
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 https://xiph.org/ *
10 * *
11 ********************************************************************
12
13 function: utility functions for vorbis codec test suite.
14
15 ********************************************************************/
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <math.h>
20#include <string.h>
21#include <errno.h>
22
23#include <vorbis/codec.h>
24#include <vorbis/vorbisenc.h>
25
26#include "util.h"
27
28void
29gen_windowed_sine (float *data, int len, float maximum)
30{ int k ;
31
32 memset (data, 0, len * sizeof (float)) ;
33
34 len /= 2 ;
35
36 for (k = 0 ; k < len ; k++)
37 { data [k] = sin (2.0 * k * M_PI * 1.0 / 32.0 + 0.4) ;
38
39 /* Apply Hanning Window. */
40 data [k] *= maximum * (0.5 - 0.5 * cos (2.0 * M_PI * k / ((len) - 1))) ;
41 }
42
43 return ;
44}
45
46void
47set_data_in (float * data, unsigned len, float value)
48{ unsigned k ;
49
50 for (k = 0 ; k < len ; k++)
51 data [k] = value ;
52}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette