forked from libsndfile/libsamplerate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownsample_test.c
61 lines (49 loc) · 1.24 KB
/
downsample_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
** Copyright (c) 2008-2016, Erik de Castro Lopo <[email protected]>
** All rights reserved.
**
** This code is released under 2-clause BSD license. Please see the
** file at : https://github.com/libsndfile/libsamplerate/blob/master/COPYING
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <samplerate.h>
#include "util.h"
static void
downsample_test (int converter)
{ static float in [1000], out [10] ;
SRC_DATA data ;
printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ;
fflush (stdout) ;
data.src_ratio = 1.0 / 255.0 ;
data.input_frames = ARRAY_LEN (in) ;
data.output_frames = ARRAY_LEN (out) ;
data.data_in = in ;
data.data_out = out ;
if (src_simple (&data, converter, 1))
{ puts ("src_simple failed.") ;
exit (1) ;
} ;
puts ("ok") ;
} /* downsample_test */
int
main (void)
{
puts ("") ;
downsample_test (SRC_ZERO_ORDER_HOLD) ;
downsample_test (SRC_LINEAR) ;
#ifdef ENABLE_SINC_FAST_CONVERTER
downsample_test (SRC_SINC_FASTEST) ;
#endif
#ifdef ENABLE_SINC_MEDIUM_CONVERTER
downsample_test (SRC_SINC_MEDIUM_QUALITY) ;
#endif
#ifdef ENABLE_SINC_BEST_CONVERTER
downsample_test (SRC_SINC_BEST_QUALITY) ;
#endif
puts ("") ;
return 0 ;
} /* main */