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