summaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-05 11:44:37 -0700
committerJosh Blum <josh@joshknows.com>2011-11-06 14:53:52 -0800
commitf3afd2eb94a65b4e6494c269ff67cd283dcad1de (patch)
tree8e85061aa4cbd68cb561463301a44350f5c58ba8 /host/examples
parent8bb81824ea3544352cf528cbd67efd04bde681c9 (diff)
downloaduhd-f3afd2eb94a65b4e6494c269ff67cd283dcad1de.tar.gz
uhd-f3afd2eb94a65b4e6494c269ff67cd283dcad1de.tar.bz2
uhd-f3afd2eb94a65b4e6494c269ff67cd283dcad1de.zip
uhd: performance speed up for tx waveforms, no iterative libmath per sample
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/tx_waveforms.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 1eb6c2f1e..4abca5dae 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -76,7 +76,7 @@ public:
}
inline std::complex<float> operator()(const double theta) const{
- return _wave_table[unsigned(boost::math::iround(theta*wave_table_len))%wave_table_len];
+ return _wave_table[unsigned(theta*wave_table_len)%wave_table_len];
}
private:
@@ -100,7 +100,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
desc.add_options()
("help", "help message")
("args", po::value<std::string>(&args)->default_value(""), "single uhd device address args")
- ("spb", po::value<size_t>(&spb)->default_value(10000), "samples per buffer")
+ ("spb", po::value<size_t>(&spb)->default_value(0), "samples per buffer, 0 for default")
("rate", po::value<double>(&rate), "rate of outgoing samples")
("freq", po::value<double>(&freq), "RF center frequency in Hz")
("ampl", po::value<float>(&ampl)->default_value(float(0.3)), "amplitude of the waveform [0 to 0.7]")
@@ -210,6 +210,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);
//allocate a buffer which we re-use for each channel
+ if (spb == 0) spb = tx_stream->get_max_num_samps()*10;
std::vector<std::complex<float> > buff(spb);
std::vector<std::complex<float> *> buffs(usrp->get_tx_num_channels(), &buff.front());