diff options
author | Josh Blum <josh@joshknows.com> | 2011-11-14 22:20:23 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-14 22:20:23 -0800 |
commit | 5efb340050f457d7743a80b350c366b27c05fd61 (patch) | |
tree | b22a5697e853fd369ff999e2c74fb6f7d937aa14 /host/lib/convert/convert_common.hpp | |
parent | 3738641290f6cbff8fae2c2a4d10ba48469c17eb (diff) | |
parent | aed619727e47bf2353164ac1788a6e3479b2fe16 (diff) | |
download | uhd-5efb340050f457d7743a80b350c366b27c05fd61.tar.gz uhd-5efb340050f457d7743a80b350c366b27c05fd61.tar.bz2 uhd-5efb340050f457d7743a80b350c366b27c05fd61.zip |
Merge branch 'convert_work'
Diffstat (limited to 'host/lib/convert/convert_common.hpp')
-rw-r--r-- | host/lib/convert/convert_common.hpp | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/host/lib/convert/convert_common.hpp b/host/lib/convert/convert_common.hpp index 34fb848c3..cc287114a 100644 --- a/host/lib/convert/convert_common.hpp +++ b/host/lib/convert/convert_common.hpp @@ -23,28 +23,43 @@ #include <boost/cstdint.hpp> #include <complex> -#define _DECLARE_CONVERTER(fcn, in_form, num_in, out_form, num_out, prio) \ - static void fcn( \ - const uhd::convert::input_type &inputs, \ - const uhd::convert::output_type &outputs, \ - const size_t nsamps, const double scale_factor \ - ); \ - UHD_STATIC_BLOCK(__register_##fcn##_##prio){ \ +#define _DECLARE_CONVERTER(name, in_form, num_in, out_form, num_out, prio) \ + struct name : public uhd::convert::converter{ \ + static sptr make(void){return sptr(new name());} \ + double scale_factor; \ + void set_scalar(const double s){scale_factor = s;} \ + void operator()(const input_type&, const output_type&, const size_t); \ + }; \ + UHD_STATIC_BLOCK(__register_##name##_##prio){ \ uhd::convert::id_type id; \ id.input_format = #in_form; \ id.num_inputs = num_in; \ id.output_format = #out_form; \ id.num_outputs = num_out; \ - uhd::convert::register_converter(id, fcn, prio); \ + uhd::convert::register_converter(id, &name::make, prio); \ } \ - static void fcn( \ - const uhd::convert::input_type &inputs, \ - const uhd::convert::output_type &outputs, \ - const size_t nsamps, const double scale_factor \ + void name::operator()( \ + const input_type &inputs, const output_type &outputs, const size_t nsamps \ ) #define DECLARE_CONVERTER(in_form, num_in, out_form, num_out, prio) \ - _DECLARE_CONVERTER(__convert_##in_form##_##num_in##_##out_form##_##num_out, in_form, num_in, out_form, num_out, prio) + _DECLARE_CONVERTER(__convert_##in_form##_##num_in##_##out_form##_##num_out##_##prio, in_form, num_in, out_form, num_out, prio) + +/*********************************************************************** + * Setup priorities + **********************************************************************/ +static const int PRIORITY_GENERAL = 0; +static const int PRIORITY_EMPTY = -1; + +#ifdef __ARM_NEON__ +static const int PRIORITY_LIBORC = 3; +static const int PRIORITY_SIMD = 1; //neon conversions could be implemented better, orc wins +static const int PRIORITY_TABLE = 2; //tables require large cache, so they are slower on arm +#else +static const int PRIORITY_LIBORC = 1; +static const int PRIORITY_SIMD = 2; +static const int PRIORITY_TABLE = 3; +#endif /*********************************************************************** * Typedefs |