diff options
author | Josh Blum <josh@joshknows.com> | 2012-01-30 22:23:38 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-01-31 14:56:31 -0800 |
commit | d46c176af34b728fd43b3dd46485b38623a7335e (patch) | |
tree | 4c93a5dc27c6c5213c858f6c4312d1195a44e32d /host/lib/convert/gen_convert_general.py | |
parent | 781cafa8717f00b883a4543b4a9150060691eee3 (diff) | |
download | uhd-d46c176af34b728fd43b3dd46485b38623a7335e.tar.gz uhd-d46c176af34b728fd43b3dd46485b38623a7335e.tar.bz2 uhd-d46c176af34b728fd43b3dd46485b38623a7335e.zip |
dsp rework: tx trailer, scaling work (peak)
Diffstat (limited to 'host/lib/convert/gen_convert_general.py')
-rw-r--r-- | host/lib/convert/gen_convert_general.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/host/lib/convert/gen_convert_general.py b/host/lib/convert/gen_convert_general.py index b8d64aa4b..a6ae3f810 100644 --- a/host/lib/convert/gen_convert_general.py +++ b/host/lib/convert/gen_convert_general.py @@ -92,6 +92,22 @@ DECLARE_CONVERTER(sc8_item32_$(end), 1, $(cpu_type), 1, PRIORITY_GENERAL){ item32_sc8_to_$(cpu_type)(item_n, output[num_samps-1], dummy, scale_factor); } } + +DECLARE_CONVERTER($(cpu_type), 1, sc8_item32_$(end), 1, PRIORITY_GENERAL){ + const $(cpu_type)_t *input = reinterpret_cast<const $(cpu_type)_t *>(inputs[0]); + item32_t *output = reinterpret_cast<item32_t *>(outputs[0]); + + const size_t num_pairs = nsamps/2; + for (size_t i = 0, j = 0; i < num_pairs; i++, j+=2){ + const item32_t item = $(cpu_type)_to_item32_sc8(input[j], input[j+1], scale_factor); + output[i] = $(to_wire)(item); + } + + if (nsamps != num_pairs*2){ + const item32_t item = $(cpu_type)_to_item32_sc8(input[nsamps-1], 0, scale_factor); + output[num_pairs] = $(to_wire)(item); + } +} """ TMPL_CONV_USRP1_COMPLEX = """ |