aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/convert_test.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-12 15:45:52 -0800
committerJosh Blum <josh@joshknows.com>2011-11-12 15:45:52 -0800
commitdd782308940e4b206e798eb2f0fa203b6e8c7f07 (patch)
tree9111a6128a4351ca7d9773e5ee4d057871ffd7b7 /host/tests/convert_test.cpp
parent74106084ed94668f11777f856e9b42e80b5d6599 (diff)
downloaduhd-dd782308940e4b206e798eb2f0fa203b6e8c7f07.tar.gz
uhd-dd782308940e4b206e798eb2f0fa203b6e8c7f07.tar.bz2
uhd-dd782308940e4b206e798eb2f0fa203b6e8c7f07.zip
convert: made conversion functions into classes so they can keep state
Diffstat (limited to 'host/tests/convert_test.cpp')
-rw-r--r--host/tests/convert_test.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp
index b63ff6752..1a5d30080 100644
--- a/host/tests/convert_test.cpp
+++ b/host/tests/convert_test.cpp
@@ -53,10 +53,14 @@ template <typename Range> static void loopback(
std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert to intermediate type
- convert::get_converter(in_id)(input0, output0, nsamps, 32767.);
+ convert::converter::sptr c0 = convert::get_converter(in_id)();
+ c0->set_scalar(32767.);
+ c0->conv(input0, output0, nsamps);
//convert back to host type
- convert::get_converter(out_id)(input1, output1, nsamps, 1/32767.);
+ convert::converter::sptr c1 = convert::get_converter(out_id)();
+ c1->set_scalar(1/32767.);
+ c1->conv(input1, output1, nsamps);
}
/***********************************************************************
@@ -216,10 +220,14 @@ BOOST_AUTO_TEST_CASE(test_convert_types_fc32_to_sc16){
std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert float to intermediate
- convert::get_converter(in_id)(input0, output0, nsamps, 32767.);
+ convert::converter::sptr c0 = convert::get_converter(in_id)();
+ c0->set_scalar(32767.);
+ c0->conv(input0, output0, nsamps);
//convert intermediate to short
- convert::get_converter(out_id)(input1, output1, nsamps, 1/32767.);
+ convert::converter::sptr c1 = convert::get_converter(out_id)();
+ c1->set_scalar(1/32767.);
+ c1->conv(input1, output1, nsamps);
//test that the inputs and outputs match
for (size_t i = 0; i < nsamps; i++){
@@ -257,10 +265,14 @@ BOOST_AUTO_TEST_CASE(test_convert_types_sc16_to_fc32){
std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert short to intermediate
- convert::get_converter(in_id)(input0, output0, nsamps, 32767.);
+ convert::converter::sptr c0 = convert::get_converter(in_id)();
+ c0->set_scalar(32767.);
+ c0->conv(input0, output0, nsamps);
//convert intermediate to float
- convert::get_converter(out_id)(input1, output1, nsamps, 1/32767.);
+ convert::converter::sptr c1 = convert::get_converter(out_id)();
+ c1->set_scalar(1/32767.);
+ c1->conv(input1, output1, nsamps);
//test that the inputs and outputs match
for (size_t i = 0; i < nsamps; i++){