diff options
-rw-r--r-- | gnuradio-core/src/lib/general/gr_delay.cc | 89 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_delay.h | 20 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_delay.i | 2 | ||||
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/gr/qa_delay.py | 2 | ||||
-rw-r--r-- | gr-audio/lib/osx/audio_osx_source.cc | 79 | ||||
-rw-r--r-- | gr-digital/examples/CMakeLists.txt | 14 | ||||
-rw-r--r-- | gr-digital/include/digital_costas_loop_cc.h | 9 | ||||
-rw-r--r-- | gr-gsm-fr-vocoder/Makefile.am | 27 | ||||
-rw-r--r-- | gr-vocoder/grc/Makefile.am | 25 | ||||
-rw-r--r-- | gr-vocoder/grc/vocoder_block_tree.xml | 1 | ||||
-rw-r--r-- | gr-vocoder/grc/vocoder_g721_decode_bs.xml | 6 | ||||
-rw-r--r-- | gr-vocoder/grc/vocoder_g723_24_decode_bs.xml | 8 | ||||
-rw-r--r-- | gr-vocoder/grc/vocoder_g723_40_decode_bs.xml | 8 | ||||
-rw-r--r-- | gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml | 4 | ||||
-rw-r--r-- | gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml | 4 | ||||
-rw-r--r-- | volk/apps/volk_profile.cc | 5 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h | 14 | ||||
-rw-r--r-- | volk/lib/qa_utils.cc | 32 | ||||
-rw-r--r-- | volk/lib/qa_utils.h | 5 |
19 files changed, 246 insertions, 108 deletions
diff --git a/gnuradio-core/src/lib/general/gr_delay.cc b/gnuradio-core/src/lib/general/gr_delay.cc index b06346f59..aedd461f8 100644 --- a/gnuradio-core/src/lib/general/gr_delay.cc +++ b/gnuradio-core/src/lib/general/gr_delay.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2010 Free Software Foundation, Inc. + * Copyright 2007,2010,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -35,30 +35,95 @@ gr_make_delay (size_t itemsize, int delay) } gr_delay::gr_delay (size_t itemsize, int delay) - : gr_sync_block ("delay", - gr_make_io_signature (1, -1, itemsize), - gr_make_io_signature (1, -1, itemsize)), + : gr_block ("delay", + gr_make_io_signature (1, -1, itemsize), + gr_make_io_signature (1, -1, itemsize)), d_itemsize(itemsize) { set_delay(delay); + d_delta = 0; +} + +void +gr_delay::forecast (int noutput_items, gr_vector_int &ninput_items_required) +{ + // make sure all inputs have noutput_items available + unsigned ninputs = ninput_items_required.size (); + for (unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = noutput_items; +} + +void +gr_delay::set_delay (int d) +{ + // only set a new delta if there is a change in the delay; this + // protects from quickly-repeated calls to this function that would + // end with d_delta=0. + if(d != delay()) { + gruel::scoped_lock l(d_mutex_delay); + int old = delay(); + set_history(d+1); + d_delta += delay() - old; + } } int -gr_delay::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +gr_delay::general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { + gruel::scoped_lock l(d_mutex_delay); assert(input_items.size() == output_items.size()); const char *iptr; char *optr; + int cons, ret; - for(size_t i = 0; i < input_items.size(); i++) { - iptr = (const char *) input_items[i]; - optr = (char *) output_items[i]; + // No change in delay; just memcpy ins to outs + if(d_delta == 0) { + for(size_t i = 0; i < input_items.size(); i++) { + iptr = (const char *) input_items[i]; + optr = (char *) output_items[i]; + std::memcpy(optr, iptr, noutput_items*d_itemsize); + } + cons = noutput_items; + ret = noutput_items; + } - memcpy(optr, iptr, noutput_items*d_itemsize); + // Skip over d_delta items on the input + else if(d_delta < 0) { + int n_to_copy, n_adj; + int delta = -d_delta; + n_to_copy = std::max(0, noutput_items-delta); + n_adj = std::min(delta, noutput_items); + for(size_t i = 0; i < input_items.size(); i++) { + iptr = (const char *) input_items[i]; + optr = (char *) output_items[i]; + std::memcpy(optr, iptr+delta*d_itemsize, n_to_copy*d_itemsize); + } + cons = noutput_items; + ret = n_to_copy; + delta -= n_adj; + d_delta = -delta; } - return noutput_items; + //produce but not consume (inserts zeros) + else { // d_delta > 0 + int n_from_input, n_padding; + n_from_input = std::max(0, noutput_items-d_delta); + n_padding = std::min(d_delta, noutput_items); + for(size_t i = 0; i < input_items.size(); i++) { + iptr = (const char *) input_items[i]; + optr = (char *) output_items[i]; + std::memset(optr, 0, n_padding*d_itemsize); + std::memcpy(optr, iptr, n_from_input*d_itemsize); + } + cons = n_from_input; + ret = noutput_items; + d_delta -= n_padding; + } + + consume_each(cons); + return ret; } diff --git a/gnuradio-core/src/lib/general/gr_delay.h b/gnuradio-core/src/lib/general/gr_delay.h index 14de9af1f..55f525c38 100644 --- a/gnuradio-core/src/lib/general/gr_delay.h +++ b/gnuradio-core/src/lib/general/gr_delay.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,7 +24,8 @@ #define INCLUDED_GR_DELAY_H #include <gr_core_api.h> -#include <gr_sync_block.h> +#include <gr_block.h> +#include <gruel/thread.h> class gr_delay; typedef boost::shared_ptr<gr_delay> gr_delay_sptr; @@ -35,21 +36,26 @@ GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay); * \brief delay the input by a certain number of samples * \ingroup misc_blk */ -class GR_CORE_API gr_delay : public gr_sync_block +class GR_CORE_API gr_delay : public gr_block { friend GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay); gr_delay (size_t itemsize, int delay); + void forecast (int noutput_items, gr_vector_int &ninput_items_required); + size_t d_itemsize; + int d_delta; + gruel::mutex d_mutex_delay; public: int delay () const { return history()-1; } - void set_delay (int delay) { set_history(delay+1); } + void set_delay (int delay); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_delay.i b/gnuradio-core/src/lib/general/gr_delay.i index a527d008f..2e62a222f 100644 --- a/gnuradio-core/src/lib/general/gr_delay.i +++ b/gnuradio-core/src/lib/general/gr_delay.i @@ -24,7 +24,7 @@ GR_SWIG_BLOCK_MAGIC(gr,delay) gr_delay_sptr gr_make_delay (size_t itemsize, int delay); -class gr_delay : public gr_sync_block +class gr_delay : public gr_block { private: gr_delay (size_t itemsize, int delay); diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py index 7cad0ae72..114e50108 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py @@ -50,7 +50,7 @@ class test_delay (gr_unittest.TestCase): delta_t = 10 tb = self.tb src_data = [float(x) for x in range(0, 100)] - expected_result = tuple(delta_t*[0.0] + src_data[0:-delta_t]) + expected_result = tuple(delta_t*[0.0] + src_data) src = gr.vector_source_f(src_data) op = gr.delay(gr.sizeof_float, delta_t) diff --git a/gr-audio/lib/osx/audio_osx_source.cc b/gr-audio/lib/osx/audio_osx_source.cc index 61f8eb4a6..6c5609d20 100644 --- a/gr-audio/lib/osx/audio_osx_source.cc +++ b/gr-audio/lib/osx/audio_osx_source.cc @@ -300,7 +300,7 @@ audio_osx_source::audio_osx_source (int sample_rate, // get the max number of input (& thus output) channels supported by // this device - d_n_max_channels = asbd_client.mChannelsPerFrame; + d_n_max_channels = asbd_device.mChannelsPerFrame; // create the output io signature; // no input siganture to set (source is hardware) @@ -319,6 +319,31 @@ audio_osx_source::audio_osx_source (int sample_rate, d_deviceSampleRate = asbd_device.mSampleRate; d_n_deviceChannels = asbd_device.mChannelsPerFrame; + asbd_client.mSampleRate = asbd_device.mSampleRate; + asbd_client.mFormatID = kAudioFormatLinearPCM; + asbd_client.mFormatFlags = (kAudioFormatFlagIsFloat | + kAudioFormatFlagIsPacked | + kAudioFormatFlagIsNonInterleaved); + if ((asbd_client.mFormatID == kAudioFormatLinearPCM) && + (d_n_deviceChannels == 1)) { + asbd_client.mFormatFlags &= ~kLinearPCMFormatFlagIsNonInterleaved; + } + asbd_client.mBytesPerFrame = sizeof (float); + asbd_client.mFramesPerPacket = 1; + asbd_client.mBitsPerChannel = asbd_client.mBytesPerFrame * 8; + asbd_client.mChannelsPerFrame = d_n_deviceChannels; + asbd_client.mBytesPerPacket = asbd_client.mBytesPerFrame; + + propertySize = sizeof(AudioStreamBasicDescription); + err = AudioUnitSetProperty (d_InputAU, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Output, + 1, + &asbd_client, + propertySize); + CheckErrorAndThrow (err, "AudioUnitSetProperty Device Ouput Stream Format", + "audio_osx_source::audio_osx_source"); + // create an ASBD for the user's wants asbd_user.mSampleRate = d_outputSampleRate; @@ -327,11 +352,11 @@ audio_osx_source::audio_osx_source (int sample_rate, GR_PCM_ENDIANNESS | kLinearPCMFormatFlagIsPacked | kAudioFormatFlagIsNonInterleaved); - asbd_user.mBytesPerPacket = 4; + asbd_user.mBytesPerPacket = sizeof (float); asbd_user.mFramesPerPacket = 1; - asbd_user.mBytesPerFrame = 4; - asbd_user.mChannelsPerFrame = d_n_max_channels; - asbd_user.mBitsPerChannel = 32; + asbd_user.mBytesPerFrame = asbd_user.mBytesPerPacket; + asbd_user.mChannelsPerFrame = d_n_deviceChannels; + asbd_user.mBitsPerChannel = asbd_user.mBytesPerPacket * 8; if (d_deviceSampleRate == d_outputSampleRate) { // no need to do conversion if asbd_client matches user wants @@ -914,17 +939,41 @@ audio_osx_source::SetDefaultInputDeviceAsCurrent () { // set the default input device - AudioDeviceID deviceID; + AudioDeviceID deviceID = 0; UInt32 dataSize = sizeof (AudioDeviceID); - AudioHardwareGetProperty (kAudioHardwarePropertyDefaultInputDevice, - &dataSize, - &deviceID); - OSStatus err = AudioUnitSetProperty (d_InputAU, - kAudioOutputUnitProperty_CurrentDevice, - kAudioUnitScope_Global, - 0, - &deviceID, - sizeof (AudioDeviceID)); + OSStatus err = noErr; + +#ifndef GR_USE_OLD_AUDIO_UNIT + AudioObjectPropertyAddress theAddress = + { kAudioHardwarePropertyDefaultInputDevice, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster }; + + err = AudioObjectGetPropertyData + (kAudioObjectSystemObject, + &theAddress, + 0, + NULL, + &dataSize, + &deviceID); +#else + err = AudioHardwareGetProperty + (kAudioHardwarePropertyDefaultInputDevice, + &dataSize, + &deviceID); +#endif + + CheckErrorAndThrow (err, "Get Audio Unit Property for Current Device", + "audio_osx_source::SetDefaultInputDeviceAsCurrent"); + + err = AudioUnitSetProperty + (d_InputAU, + kAudioOutputUnitProperty_CurrentDevice, + kAudioUnitScope_Global, + 0, + &deviceID, + sizeof (AudioDeviceID)); + CheckErrorAndThrow (err, "AudioUnitSetProperty Current Device", "audio_osx_source::SetDefaultInputDeviceAsCurrent"); } diff --git a/gr-digital/examples/CMakeLists.txt b/gr-digital/examples/CMakeLists.txt index 7b94f745c..5c652fc83 100644 --- a/gr-digital/examples/CMakeLists.txt +++ b/gr-digital/examples/CMakeLists.txt @@ -44,3 +44,17 @@ GR_PYTHON_INSTALL(PROGRAMS DESTINATION ${GR_PKG_DATA_DIR}/examples/digital/narrowband COMPONENT "digital_python" ) + +GR_PYTHON_INSTALL(PROGRAMS + ofdm/benchmark_add_channel.py + ofdm/benchmark_rx.py + ofdm/benchmark_tx.py + ofdm/gr_plot_ofdm.py + ofdm/ofdm_mod_demod_test.py + ofdm/receive_path.py + ofdm/transmit_path.py + ofdm/tunnel.py + ofdm/uhd_interface.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/digital/ofdm + COMPONENT "digital_python" +) diff --git a/gr-digital/include/digital_costas_loop_cc.h b/gr-digital/include/digital_costas_loop_cc.h index c8c722c93..4aab22fb4 100644 --- a/gr-digital/include/digital_costas_loop_cc.h +++ b/gr-digital/include/digital_costas_loop_cc.h @@ -50,11 +50,8 @@ * * http://rfdesign.com/images/archive/0102Feigin20.pdf * - * \param alpha the loop gain used for phase adjustment - * \param beta the loop gain for frequency adjustments - * \param max_freq the maximum frequency deviation (radians/sample) the loop can handle - * \param min_freq the minimum frequency deviation (radians/sample) the loop can handle - * \param order the loop order, either 2 or 4 + * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100) + * \param order the loop order, either 2, 4, or 8 */ #include <digital_api.h> @@ -76,7 +73,7 @@ digital_make_costas_loop_cc (float loop_bw, int order * stream 1 is the baseband I and Q; * stream 2 is the normalized frequency of the loop * - * \p order must be 2 or 4. + * \p order must be 2, 4, or 8. */ class DIGITAL_API digital_costas_loop_cc : public gr_sync_block, public gri_control_loop { diff --git a/gr-gsm-fr-vocoder/Makefile.am b/gr-gsm-fr-vocoder/Makefile.am deleted file mode 100644 index 968ce327c..000000000 --- a/gr-gsm-fr-vocoder/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2004,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -SUBDIRS = src - -pkgconfigdir = $(libdir)/pkgconfig -dist_pkgconfig_DATA = gnuradio-gsm-fr-vocoder.pc diff --git a/gr-vocoder/grc/Makefile.am b/gr-vocoder/grc/Makefile.am index b1c7b44d5..f25cb9ce6 100644 --- a/gr-vocoder/grc/Makefile.am +++ b/gr-vocoder/grc/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,4 +21,25 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = +grcblocksdir = $(grc_blocksdir) + +dist_grcblocks_DATA = \ + vocoder_alaw_decode_bs.xml \ + vocoder_alaw_encode_sb.xml \ + vocoder_block_tree.xml \ + vocoder_codec2_decode_ps.xml \ + vocoder_codec2_encode_sp.xml \ + vocoder_cvsd_decode_bs.xml \ + vocoder_cvsd_decode.xml \ + vocoder_cvsd_encode_sb.xml \ + vocoder_cvsd_encode.xml \ + vocoder_g721_decode_bs.xml \ + vocoder_g721_encode_sb.xml \ + vocoder_g723_24_decode_bs.xml \ + vocoder_g723_24_encode_sb.xml \ + vocoder_g723_40_decode_bs.xml \ + vocoder_g723_40_encode_sb.xml \ + vocoder_gsm_fr_decode_ps.xml \ + vocoder_gsm_fr_encode_sp.xml \ + vocoder_ulaw_decode_bs.xml \ + vocoder_ulaw_encode_sb.xml diff --git a/gr-vocoder/grc/vocoder_block_tree.xml b/gr-vocoder/grc/vocoder_block_tree.xml index 0c0fdd4a0..1766b4e26 100644 --- a/gr-vocoder/grc/vocoder_block_tree.xml +++ b/gr-vocoder/grc/vocoder_block_tree.xml @@ -30,7 +30,6 @@ <name></name> <!-- Blank for Root Name --> <cat> <name>Vocoders</name> - <block>vocoder_binary_slicer_fb</block> <block>vocoder_alaw_decode_bs</block> <block>vocoder_alaw_encode_sb</block> <block>vocoder_codec2_decode_ps</block> diff --git a/gr-vocoder/grc/vocoder_g721_decode_bs.xml b/gr-vocoder/grc/vocoder_g721_decode_bs.xml index e8a64f404..d5c0291b7 100644 --- a/gr-vocoder/grc/vocoder_g721_decode_bs.xml +++ b/gr-vocoder/grc/vocoder_g721_decode_bs.xml @@ -5,10 +5,10 @@ ################################################### --> <block> - <name>g271 Audio Decoder</name> - <key>vocoder_g271_decode_bs</key> + <name>g721 Audio Decoder</name> + <key>vocoder_g721_decode_bs</key> <import>from gnuradio import vocoder</import> - <make>vocoder.g271_decode_bs()</make> + <make>vocoder.g721_decode_bs()</make> <sink> <name>in</name> <type>byte</type> diff --git a/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml b/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml index 768f82d8b..939a7f91b 100644 --- a/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml +++ b/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml @@ -1,14 +1,14 @@ <?xml version="1.0"?> <!-- ################################################### -## g273_24 audio decoder +## g723_24 audio decoder ################################################### --> <block> - <name>g273_24 Audio Decoder</name> - <key>vocoder_g273_24_decode_bs</key> + <name>g723_24 Audio Decoder</name> + <key>vocoder_g723_24_decode_bs</key> <import>from gnuradio import vocoder</import> - <make>vocoder.g273_24_decode_bs()</make> + <make>vocoder.g723_24_decode_bs()</make> <sink> <name>in</name> <type>byte</type> diff --git a/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml b/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml index 09e31be4c..f3ba56e5b 100644 --- a/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml +++ b/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml @@ -1,14 +1,14 @@ <?xml version="1.0"?> <!-- ################################################### -## g273_40 audio decoder +## g723_40 audio decoder ################################################### --> <block> - <name>g273_40 Audio Decoder</name> - <key>vocoder_g273_40_decode_bs</key> + <name>g723_40 Audio Decoder</name> + <key>vocoder_g723_40_decode_bs</key> <import>from gnuradio import vocoder</import> - <make>vocoder.g273_40_decode_bs()</make> + <make>vocoder.g723_40_decode_bs()</make> <sink> <name>in</name> <type>byte</type> diff --git a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml b/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml index f90890032..44290f891 100644 --- a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml +++ b/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml @@ -6,9 +6,9 @@ --> <block> <name>GSM full-rate Audio Decoder</name> - <key>vocoder_gsm_fr_decode_bs</key> + <key>vocoder_gsm_fr_decode_ps</key> <import>from gnuradio import vocoder</import> - <make>vocoder.gsm_fr_decode_bs()</make> + <make>vocoder.gsm_fr_decode_ps()</make> <sink> <name>in</name> <type>byte</type> diff --git a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml b/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml index d39994b6b..13f6f3f2d 100644 --- a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml +++ b/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml @@ -6,9 +6,9 @@ --> <block> <name>GSM full-rate Audio Encoder</name> - <key>vocoder_gsm_fr_encode_sb</key> + <key>vocoder_gsm_fr_encode_sp</key> <import>from gnuradio import vocoder</import> - <make>vocoder.gsm_fr_encode_sb()</make> + <make>vocoder.gsm_fr_encode_sp()</make> <sink> <name>in</name> <type>short</type> diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc index 0da21ffa5..bd36d6dc7 100644 --- a/volk/apps/volk_profile.cc +++ b/volk/apps/volk_profile.cc @@ -113,11 +113,12 @@ int main(int argc, char *argv[]) { VOLK_PROFILE(volk_8i_convert_16i_u, 0, 0, 204600, 2000, &results); VOLK_PROFILE(volk_8i_s32f_convert_32f_a, 1e-4, 100, 204600, 2000, &results); VOLK_PROFILE(volk_8i_s32f_convert_32f_u, 1e-4, 100, 204600, 2000, &results); - VOLK_PROFILE(volk_32fc_s32fc_multiply_32fc_a, 1e-4, 0, 204600, 1000, &results); + //VOLK_PROFILE(volk_32fc_s32fc_multiply_32fc_a, 1e-4, lv_32fc_t(1.0, 0.5), 204600, 1000, &results); VOLK_PROFILE(volk_32fc_s32fc_multiply_32fc_u, 1e-4, 0, 204600, 1000, &results); - VOLK_PROFILE(volk_32f_s32f_multiply_32f_a, 1e-4, 0, 204600, 1000, &results); + VOLK_PROFILE(volk_32f_s32f_multiply_32f_a, 1e-4, 1.0, 204600, 10000, &results); VOLK_PROFILE(volk_32f_s32f_multiply_32f_u, 1e-4, 0, 204600, 1000, &results); + char path[256]; get_config_path(path); std::string config_path(path); diff --git a/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h b/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h index 205461afb..534dc2a25 100644 --- a/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h +++ b/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h @@ -84,20 +84,6 @@ static inline void volk_32fc_s32fc_multiply_32fc_a_generic(lv_32fc_t* cVector, c } #endif /* LV_HAVE_GENERIC */ -#ifdef LV_HAVE_ORC - /*! - \brief Multiplies the two input complex vectors and stores their results in the third vector - \param cVector The vector where the results will be stored - \param aVector One of the vectors to be multiplied - \param bVector One of the vectors to be multiplied - \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector - */ -extern void volk_32fc_s32fc_multiply_32fc_a_orc_impl(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points); -static inline void volk_32fc_s32fc_multiply_32fc_a_orc(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){ - volk_32fc_s32fc_multiply_32fc_a_orc_impl(cVector, aVector, scalar, num_points); -} -#endif /* LV_HAVE_ORC */ - diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index 9bb515e9f..bb37801c9 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -198,6 +198,18 @@ inline void run_cast_test3_s32f(volk_fn_3arg_s32f func, std::vector<void *> &buf while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str()); } +inline void run_cast_test1_s32fc(volk_fn_1arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) { + while(iter--) func(buffs[0], scalar, vlen, arch.c_str()); +} + +inline void run_cast_test2_s32fc(volk_fn_2arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) { + while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str()); +} + +inline void run_cast_test3_s32fc(volk_fn_3arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) { + while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str()); +} + template <class t> bool fcompare(t *in1, t *in2, unsigned int vlen, float tol) { bool fail = false; @@ -246,7 +258,7 @@ bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::string name, float tol, - float scalar, + lv_32fc_t scalar, int vlen, int iter, std::vector<std::string> *best_arch_vector = 0 @@ -316,21 +328,33 @@ bool run_volk_tests(struct volk_func_desc desc, if(inputsc.size() == 0) { run_cast_test1((volk_fn_1arg)(manual_func), test_data[i], vlen, iter, arch_list[i]); } else if(inputsc.size() == 1 && inputsc[0].is_float) { - run_cast_test1_s32f((volk_fn_1arg_s32f)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); + if(inputsc[0].is_complex) { + run_cast_test1_s32fc((volk_fn_1arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); + } else { + run_cast_test1_s32f((volk_fn_1arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]); + } } else throw "unsupported 1 arg function >1 scalars"; break; case 2: if(inputsc.size() == 0) { run_cast_test2((volk_fn_2arg)(manual_func), test_data[i], vlen, iter, arch_list[i]); } else if(inputsc.size() == 1 && inputsc[0].is_float) { - run_cast_test2_s32f((volk_fn_2arg_s32f)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); + if(inputsc[0].is_complex) { + run_cast_test2_s32fc((volk_fn_2arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); + } else { + run_cast_test2_s32f((volk_fn_2arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]); + } } else throw "unsupported 2 arg function >1 scalars"; break; case 3: if(inputsc.size() == 0) { run_cast_test3((volk_fn_3arg)(manual_func), test_data[i], vlen, iter, arch_list[i]); } else if(inputsc.size() == 1 && inputsc[0].is_float) { - run_cast_test3_s32f((volk_fn_3arg_s32f)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); + if(inputsc[0].is_complex) { + run_cast_test3_s32fc((volk_fn_3arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); + } else { + run_cast_test3_s32f((volk_fn_3arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]); + } } else throw "unsupported 3 arg function >1 scalars"; break; case 4: diff --git a/volk/lib/qa_utils.h b/volk/lib/qa_utils.h index a1bc1f20c..b998df852 100644 --- a/volk/lib/qa_utils.h +++ b/volk/lib/qa_utils.h @@ -21,7 +21,7 @@ volk_type_t volk_type_from_string(std::string); float uniform(void); void random_floats(float *buf, unsigned n); -bool run_volk_tests(struct volk_func_desc, void(*)(), std::string, float, float, int, int, std::vector<std::string> *); +bool run_volk_tests(struct volk_func_desc, void(*)(), std::string, float, lv_32fc_t, int, int, std::vector<std::string> *); #define VOLK_RUN_TESTS(func, tol, scalar, len, iter) BOOST_AUTO_TEST_CASE(func##_test) { BOOST_CHECK_EQUAL(run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, 0), 0); } #define VOLK_PROFILE(func, tol, scalar, len, iter, results) run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results) @@ -32,5 +32,8 @@ typedef void (*volk_fn_4arg)(void *, void *, void *, void *, unsigned int, const typedef void (*volk_fn_1arg_s32f)(void *, float, unsigned int, const char*); //one input vector, one scalar float input typedef void (*volk_fn_2arg_s32f)(void *, void *, float, unsigned int, const char*); typedef void (*volk_fn_3arg_s32f)(void *, void *, void *, float, unsigned int, const char*); +typedef void (*volk_fn_1arg_s32fc)(void *, lv_32fc_t, unsigned int, const char*); //one input vector, one scalar float input +typedef void (*volk_fn_2arg_s32fc)(void *, void *, lv_32fc_t, unsigned int, const char*); +typedef void (*volk_fn_3arg_s32fc)(void *, void *, void *, lv_32fc_t, unsigned int, const char*); #endif //VOLK_QA_UTILS_H |