diff options
86 files changed, 2912 insertions, 2658 deletions
diff --git a/gr-vocoder/CMakeLists.txt b/gr-vocoder/CMakeLists.txt index 95c7ae3c19..f8f7a20b46 100644 --- a/gr-vocoder/CMakeLists.txt +++ b/gr-vocoder/CMakeLists.txt @@ -32,10 +32,12 @@ GR_REGISTER_COMPONENT("gr-vocoder" ENABLE_GR_VOCODER ENABLE_GR_FFT ENABLE_GR_BLOCKS ENABLE_GR_FILTER + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_VOCODER_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_BINARY_DIR}/include ) SET(GR_PKG_VOCODER_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/vocoder) @@ -89,8 +91,8 @@ CPACK_COMPONENT("vocoder_swig" ######################################################################## # Add subdirectories ######################################################################## +add_subdirectory(include/vocoder) add_subdirectory(lib) -add_subdirectory(include) add_subdirectory(doc) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-vocoder/include/CMakeLists.txt b/gr-vocoder/include/vocoder/CMakeLists.txt index 719e993550..ea0562f36f 100644 --- a/gr-vocoder/include/CMakeLists.txt +++ b/gr-vocoder/include/vocoder/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,23 +21,23 @@ # Install header files ######################################################################## install(FILES - vocoder_api.h - vocoder_alaw_decode_bs.h - vocoder_alaw_encode_sb.h - vocoder_codec2_decode_ps.h - vocoder_codec2_encode_sp.h - vocoder_cvsd_decode_bs.h - vocoder_cvsd_encode_sb.h - vocoder_g721_decode_bs.h - vocoder_g721_encode_sb.h - vocoder_g723_24_decode_bs.h - vocoder_g723_24_encode_sb.h - vocoder_g723_40_decode_bs.h - vocoder_g723_40_encode_sb.h - vocoder_gsm_fr_decode_ps.h - vocoder_gsm_fr_encode_sp.h - vocoder_ulaw_decode_bs.h - vocoder_ulaw_encode_sb.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio + api.h + alaw_decode_bs.h + alaw_encode_sb.h + codec2_decode_ps.h + codec2_encode_sp.h + cvsd_decode_bs.h + cvsd_encode_sb.h + g721_decode_bs.h + g721_encode_sb.h + g723_24_decode_bs.h + g723_24_encode_sb.h + g723_40_decode_bs.h + g723_40_encode_sb.h + gsm_fr_decode_ps.h + gsm_fr_encode_sp.h + ulaw_decode_bs.h + ulaw_encode_sb.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/vocoder COMPONENT "vocoder_devel" ) diff --git a/gr-vocoder/include/vocoder_alaw_decode_bs.h b/gr-vocoder/include/vocoder/alaw_decode_bs.h index 083be21000..571794275b 100644 --- a/gr-vocoder/include/vocoder_alaw_decode_bs.h +++ b/gr-vocoder/include/vocoder/alaw_decode_bs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,34 +23,29 @@ #ifndef INCLUDED_VOCODER_ALAW_DECODE_BS_H #define INCLUDED_VOCODER_ALAW_DECODE_BS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_alaw_decode_bs; - -typedef boost::shared_ptr<vocoder_alaw_decode_bs> vocoder_alaw_decode_bs_sptr; - -VOCODER_API vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); - -/*! - * \brief This block performs alaw audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_alaw_decode_bs : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); - - vocoder_alaw_decode_bs(); - - public: - ~vocoder_alaw_decode_bs(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs alaw audio decoding. + * \ingroup vocoder_blk + */ + class VOCODER_API alaw_decode_bs : virtual public gr_sync_block + { + public: + // gr::vocoder::alaw_decode_bs::sptr + typedef boost::shared_ptr<alaw_decode_bs> sptr; + + /*! + * \brief Make alaw decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_ALAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_alaw_encode_sb.h b/gr-vocoder/include/vocoder/alaw_encode_sb.h index c2609a95c6..95ab4a12b2 100644 --- a/gr-vocoder/include/vocoder_alaw_encode_sb.h +++ b/gr-vocoder/include/vocoder/alaw_encode_sb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011.2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,33 +23,29 @@ #ifndef INCLUDED_VOCODER_ALAW_ENCODER_SB_H #define INCLUDED_VOCODER_ALAW_ENCODER_SB_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_alaw_encode_sb; - -typedef boost::shared_ptr<vocoder_alaw_encode_sb> vocoder_alaw_encode_sb_sptr; - -VOCODER_API vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); - -/*! - * \brief This block performs g.711 alaw audio encoding. - * - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_alaw_encode_sb : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); - - vocoder_alaw_encode_sb(); - - public: - ~vocoder_alaw_encode_sb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g.711 alaw audio encoding. + * \ingroup vocoder_blk + */ + class VOCODER_API alaw_encode_sb : virtual public gr_sync_block + { + public: + // gr::vocoder::alaw_encode_sb::sptr + typedef boost::shared_ptr<alaw_encode_sb> sptr; + + /*! + * \brief Make alaw encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_ALAW_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_api.h b/gr-vocoder/include/vocoder/api.h index 331cf5d0bc..331cf5d0bc 100644 --- a/gr-vocoder/include/vocoder_api.h +++ b/gr-vocoder/include/vocoder/api.h diff --git a/gr-vocoder/include/vocoder_codec2_decode_ps.h b/gr-vocoder/include/vocoder/codec2_decode_ps.h index 9ceef79214..31738fea16 100644 --- a/gr-vocoder/include/vocoder_codec2_decode_ps.h +++ b/gr-vocoder/include/vocoder/codec2_decode_ps.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,33 +19,33 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_VOCODER_CODEC2_DECODE_PS_H #define INCLUDED_VOCODER_CODEC2_DECODE_PS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_interpolator.h> -class vocoder_codec2_decode_ps; -typedef boost::shared_ptr<vocoder_codec2_decode_ps> vocoder_codec2_decode_ps_sptr; - -VOCODER_API vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); - -/*! - * \brief CODEC2 Vocoder Decoder - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_codec2_decode_ps : public gr_sync_interpolator { - void *d_codec2; - - friend VOCODER_API vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); - vocoder_codec2_decode_ps (); - -public: - ~vocoder_codec2_decode_ps (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief CODEC2 Vocoder Decoder + * \ingroup vocoder_blk + */ + class VOCODER_API codec2_decode_ps : virtual public gr_sync_interpolator + { + public: + // gr::vocoder::codec2_decode_ps::sptr + typedef boost::shared_ptr<codec2_decode_ps> sptr; + + /*! + * \brief Make Codec2 decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_CODEC2_DECODE_PS_H */ diff --git a/gr-vocoder/include/vocoder_codec2_encode_sp.h b/gr-vocoder/include/vocoder/codec2_encode_sp.h index c24aca1c48..59ed100837 100644 --- a/gr-vocoder/include/vocoder_codec2_encode_sp.h +++ b/gr-vocoder/include/vocoder/codec2_encode_sp.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,33 +19,33 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_VOCODER_CODEC2_ENCODE_SP_H #define INCLUDED_VOCODER_CODEC2_ENCODE_SP_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_decimator.h> -class vocoder_codec2_encode_sp; -typedef boost::shared_ptr<vocoder_codec2_encode_sp> vocoder_codec2_encode_sp_sptr; - -VOCODER_API vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); - -/*! - * \brief CODEC2 Vocoder Encoder - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_codec2_encode_sp : public gr_sync_decimator { - void *d_codec2; - - friend VOCODER_API vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); - vocoder_codec2_encode_sp (); - -public: - ~vocoder_codec2_encode_sp (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief CODEC2 Vocoder Encoder + * \ingroup vocoder_blk + */ + class VOCODER_API codec2_encode_sp : virtual public gr_sync_decimator + { + public: + // gr::vocoder::codec2_encode_sp::sptr + typedef boost::shared_ptr<codec2_encode_sp> sptr; + + /*! + * \brief Make Codec2 encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_CODEC2_ENCODE_SP_H */ diff --git a/gr-vocoder/include/vocoder/cvsd_decode_bs.h b/gr-vocoder/include/vocoder/cvsd_decode_bs.h new file mode 100644 index 0000000000..b9fa8fc080 --- /dev/null +++ b/gr-vocoder/include/vocoder/cvsd_decode_bs.h @@ -0,0 +1,134 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_H +#define INCLUDED_VOCODER_CVSD_DECODE_BS_H + +#include <vocoder/api.h> +#include <gr_sync_interpolator.h> + +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs CVSD audio decoding. Its design and + * implementation is modeled after the CVSD encoder/decoder + * specifications defined in the Bluetooth standard. + * + * \ingroup vocoder_blk + * + * CVSD is a method for encoding speech that seeks to reduce the + * bandwidth required for digital voice transmission. CVSD takes + * advantage of strong correlation between samples, quantizing the + * difference in amplitude between two consecutive samples. This + * difference requires fewer quantization levels as compared to + * other methods that quantize the actual amplitude level, + * reducing the bandwidth. CVSD employs a two level quantizer + * (one bit) and an adaptive algorithm that allows for continuous + * step size adjustment. + * + * The coder can represent low amplitude signals with accuracy + * without sacrificing performance on large amplitude signals, a + * trade off that occurs in some non-adaptive modulations. + * + * The CVSD decoder effectively provides 1-to-8 decompression. + * More specifically, for each incoming input bit, the decoder + * outputs one audio sample. If the input is a "1" bit, the + * internal reference is increased appropriately and then + * outputted as the next estimated audio sample. If the input is + * a "0" bit, the internal reference is decreased appropriately + * and then likewise outputted as the next estimated audio sample. + * Grouping 8 input bits together, the encoder essentially + * produces 8 output audio samples for everyone one input byte. + * + * This decoder requires that output audio samples are 2-byte + * short signed integers. The result bandwidth conversion, + * therefore, is 1 byte of encoded audio data to 16 output bytes + * of raw audio data. + * + * The CVSD decoder module must be post-fixed by a down-converter + * to under-sample the audio data after decoding. The Bluetooth + * standard specifically calls for a 8-to-1 decimating + * down-converter. This is required so that so that output + * sampling rate equals the original input sampling rate present + * before the encoder. In all cases, the output down-converter + * rate must be the inverse of the input up-converter rate before + * the CVSD encoder. + * + * References: + * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial, + * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF. + * 2. Specification of The Bluetooth System + * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf. + * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002. + * Bluetooth Voice Simulink� Model, Available: + * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html + */ + class VOCODER_API cvsd_decode_bs : virtual public gr_sync_interpolator + { + public: + // gr::vocoder::cvsd_decode_bs::sptr + typedef boost::shared_ptr<cvsd_decode_bs> sptr; + + /*! + * \brief Constructor parameters to initialize the CVSD decoder. + * The default values are modeled after the Bluetooth standard + * and should not be changed, except by an advanced user + * + * \ingroup vocoder_blk + * + * \param min_step Minimum step size used to update the internal reference. + * Default: "10" + * \param max_step Maximum step size used to update the internal reference. + * Default: "1280" + * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. + * Default: "0.9990234375" (i.e. 1-1/1024) + * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. + * Default: "0.96875" (i.e. 1-1/32) + * \param K; Size of shift register; the number of output bits remembered by codec (must be <= to 32). + * Default: "32" + * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. + * Default: "4" + * \param pos_accum_max Maximum integer value allowed for the internal reference. + * Default: "32767" (2^15 - 1 or MAXSHORT) + * \param neg_accum_max Minimum integer value allowed for the internal reference. + * Default: "-32767" (-2^15 + 1 or MINSHORT+1) + */ + static sptr make(short min_step=10, short max_step=1280, + double step_decay=0.9990234375, double accum_decay= 0.96875, + int K=32, int J=4, + short pos_accum_max=32767, short neg_accum_max=-32767); + + virtual short min_step() = 0; + virtual short max_step() = 0; + virtual double step_decay() = 0; + virtual double accum_decay() = 0; + virtual int K() = 0; + virtual int J() = 0; + virtual short pos_accum_max() = 0; + virtual short neg_accum_max() = 0; + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_CVSD_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder/cvsd_encode_sb.h b/gr-vocoder/include/vocoder/cvsd_encode_sb.h new file mode 100644 index 0000000000..1fca494469 --- /dev/null +++ b/gr-vocoder/include/vocoder/cvsd_encode_sb.h @@ -0,0 +1,133 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2013 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. + */ +#ifndef INCLUDED_VOCODER_CVSD_ENCODER_SB_H +#define INCLUDED_VOCODER_CVSD_ENCODER_SB_H + +#include <vocoder/api.h> +#include <gr_sync_decimator.h> + +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs CVSD audio encoding. Its design and + * implementation is modeled after the CVSD encoder/decoder + * specifications defined in the Bluetooth standard. + * + * \ingroup vocoder_blk + * + * CVSD is a method for encoding speech that seeks to reduce the + * bandwidth required for digital voice transmission. CVSD takes + * advantage of strong correlation between samples, quantizing the + * difference in amplitude between two consecutive samples. This + * difference requires fewer quantization levels as compared to + * other methods that quantize the actual amplitude level, + * reducing the bandwidth. CVSD employs a two level quantizer + * (one bit) and an adaptive algorithm that allows for continuous + * step size adjustment. + * + * The coder can represent low amplitude signals with accuracy + * without sacrificing performance on large amplitude signals, a + * trade off that occurs in some non-adaptive modulations. + * + * The CVSD encoder effectively provides 8-to-1 compression. More + * specifically, each incoming audio sample is compared to an + * internal reference value. If the input is greater or equal to + * the reference, the encoder outputs a "1" bit. If the input is + * less than the reference, the encoder outputs a "0" bit. The + * reference value is then updated accordingly based on the + * frequency of outputted "1" or "0" bits. By grouping 8 outputs + * bits together, the encoder essentially produce one output byte + * for every 8 input audio samples. + * + * This encoder requires that input audio samples are 2-byte short + * signed integers. The result bandwidth conversion, therefore, + * is 16 input bytes of raw audio data to 1 output byte of encoded + * audio data. + * + * The CVSD encoder module must be prefixed by an up-converter to + * over-sample the audio data prior to encoding. The Bluetooth + * standard specifically calls for a 1-to-8 interpolating + * up-converter. While this reduces the overall compression of + * the codec, this is required so that the encoder can accurately + * compute the slope between adjacent audio samples and correctly + * update its internal reference value. + * + * References: + * + * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial, + * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF. + * + * 2. Specification of The Bluetooth System + * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf. + * + * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002. + * Bluetooth Voice Simulink� Model, Available: + * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html + */ + class VOCODER_API cvsd_encode_sb : virtual public gr_sync_decimator + { + public: + // gr::vocoder::cvsd_encode_sb::sptr + typedef boost::shared_ptr<cvsd_encode_sb> sptr; + + /*! + * \brief Constructor parameters to initialize the CVSD encoder. + * The default values are modeled after the Bluetooth standard and + * should not be changed except by an advanced user + * + * \ingroup vocoder_blk + * + * \param min_step Minimum step size used to update the internal reference. Default: "10" + * \param max_step Maximum step size used to update the internal reference. Default: "1280" + * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. + * Default: "0.9990234375" (i.e. 1-1/1024) + * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. + * Default: "0.96875" (i.e. 1-1/32) + * \param K; Size of shift register; the number of output bits remembered by codec (must be <= to 32). + * Default: "32" + * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. + * Default: "4" + * \param pos_accum_max Maximum integer value allowed for the internal reference. + * Default: "32767" (2^15 - 1 or MAXSHORT) + * \param neg_accum_max Minimum integer value allowed for the internal reference. + * Default: "-32767" (-2^15 + 1 or MINSHORT+1) + */ + static sptr make(short min_step=10, short max_step=1280, + double step_decay=0.9990234375, double accum_decay= 0.96875, + int K=32, int J=4, + short pos_accum_max=32767, short neg_accum_max=-32767); + + virtual short min_step() = 0; + virtual short max_step() = 0; + virtual double step_decay() = 0; + virtual double accum_decay() = 0; + virtual int K() = 0; + virtual int J() = 0; + virtual short pos_accum_max() = 0; + virtual short neg_accum_max() = 0; + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_CVSD_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g721_decode_bs.h b/gr-vocoder/include/vocoder/g721_decode_bs.h index 61a386ffca..a836a1b63d 100644 --- a/gr-vocoder/include/vocoder_g721_decode_bs.h +++ b/gr-vocoder/include/vocoder/g721_decode_bs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,23 +23,29 @@ #ifndef INCLUDED_VOCODER_G721_DECODE_BS_H #define INCLUDED_VOCODER_G721_DECODE_BS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_g721_decode_bs; - -typedef boost::shared_ptr<vocoder_g721_decode_bs> vocoder_g721_decode_bs_sptr; - -VOCODER_API vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs(); - -/*! - * \brief This block performs g721 audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g721_decode_bs : virtual public gr_sync_block -{ -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g721 audio decoding. + * \ingroup vocoder_blk + */ + class VOCODER_API g721_decode_bs : virtual public gr_sync_block + { + public: + // gr::vocoder::g721_decode_bs::sptr + typedef boost::shared_ptr<g721_decode_bs> sptr; + + /*! + * \brief Make G721 decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_G721_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g721_encode_sb.h b/gr-vocoder/include/vocoder/g721_encode_sb.h index 694da92d6d..60df4d5d8e 100644 --- a/gr-vocoder/include/vocoder_g721_encode_sb.h +++ b/gr-vocoder/include/vocoder/g721_encode_sb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,23 +23,29 @@ #ifndef INCLUDED_VOCODER_G721_ENCODE_SB_H #define INCLUDED_VOCODER_G721_ENCODE_SB_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_g721_encode_sb; - -typedef boost::shared_ptr<vocoder_g721_encode_sb> vocoder_g721_encode_sb_sptr; - -VOCODER_API vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb(); - -/*! - * \brief This block performs g721 audio encoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g721_encode_sb : virtual public gr_sync_block -{ -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g721 audio encoding. + * \ingroup vocoder_blk + */ + class VOCODER_API g721_encode_sb : virtual public gr_sync_block + { + public: + // gr::vocoder::g721_encode_sb::sptr + typedef boost::shared_ptr<g721_encode_sb> sptr; + + /*! + * \brief Make G721 encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_G721_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g723_24_decode_bs.h b/gr-vocoder/include/vocoder/g723_24_decode_bs.h index 6c0f09838f..f3422ed72a 100644 --- a/gr-vocoder/include/vocoder_g723_24_decode_bs.h +++ b/gr-vocoder/include/vocoder/g723_24_decode_bs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,23 +23,29 @@ #ifndef INCLUDED_VOCODER_G723_24_DECODE_BS_H #define INCLUDED_VOCODER_G723_24_DECODE_BS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_g723_24_decode_bs; - -typedef boost::shared_ptr<vocoder_g723_24_decode_bs> vocoder_g723_24_decode_bs_sptr; - -VOCODER_API vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs(); - -/*! - * \brief This block performs g723_24 audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_24_decode_bs : virtual public gr_sync_block -{ -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g723_24 audio decoding. + * \ingroup vocoder_blk + */ + class VOCODER_API g723_24_decode_bs : virtual public gr_sync_block + { + public: + // gr::vocoder::g723_24_decode_bs::sptr + typedef boost::shared_ptr<g723_24_decode_bs> sptr; + + /*! + * \brief Make G722_24 decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_G723_24_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g723_24_encode_sb.h b/gr-vocoder/include/vocoder/g723_24_encode_sb.h index 105897583f..3860ca31c6 100644 --- a/gr-vocoder/include/vocoder_g723_24_encode_sb.h +++ b/gr-vocoder/include/vocoder/g723_24_encode_sb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,23 +23,29 @@ #ifndef INCLUDED_VOCODER_G723_24_ENCODE_SB_H #define INCLUDED_VOCODER_G723_24_ENCODE_SB_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_g723_24_encode_sb; - -typedef boost::shared_ptr<vocoder_g723_24_encode_sb> vocoder_g723_24_encode_sb_sptr; - -VOCODER_API vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb(); - -/*! - * \brief This block performs g723_24 audio encoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_24_encode_sb : virtual public gr_sync_block -{ -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g723_24 audio encoding. + * \ingroup vocoder_blk + */ + class VOCODER_API g723_24_encode_sb : virtual public gr_sync_block + { + public: + // gr::vocoder::g723_24_encode_sb::sptr + typedef boost::shared_ptr<g723_24_encode_sb> sptr; + + /*! + * \brief Make G722_24 encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_G723_24_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g723_40_decode_bs.h b/gr-vocoder/include/vocoder/g723_40_decode_bs.h index ce320a5266..8d00552565 100644 --- a/gr-vocoder/include/vocoder_g723_40_decode_bs.h +++ b/gr-vocoder/include/vocoder/g723_40_decode_bs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,23 +23,29 @@ #ifndef INCLUDED_VOCODER_G723_40_DECODE_BS_H #define INCLUDED_VOCODER_G723_40_DECODE_BS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_g723_40_decode_bs; - -typedef boost::shared_ptr<vocoder_g723_40_decode_bs> vocoder_g723_40_decode_bs_sptr; - -VOCODER_API vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs(); - -/*! - * \brief This block performs g723_40 audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_40_decode_bs : virtual public gr_sync_block -{ -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g723_40 audio decoding. + * \ingroup vocoder_blk + */ + class VOCODER_API g723_40_decode_bs : virtual public gr_sync_block + { + public: + // gr::vocoder::g723_40_decode_bs::sptr + typedef boost::shared_ptr<g723_40_decode_bs> sptr; + + /*! + * \brief Make G722_40 decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_G723_40_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g723_40_encode_sb.h b/gr-vocoder/include/vocoder/g723_40_encode_sb.h index eb732e73e2..cdab69cdb3 100644 --- a/gr-vocoder/include/vocoder_g723_40_encode_sb.h +++ b/gr-vocoder/include/vocoder/g723_40_encode_sb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,23 +23,29 @@ #ifndef INCLUDED_VOCODER_G723_40_ENCODE_SB_H #define INCLUDED_VOCODER_G723_40_ENCODE_SB_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_g723_40_encode_sb; - -typedef boost::shared_ptr<vocoder_g723_40_encode_sb> vocoder_g723_40_encode_sb_sptr; - -VOCODER_API vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb(); - -/*! - * \brief This block performs g723_40 audio encoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_40_encode_sb : virtual public gr_sync_block -{ -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g723_40 audio encoding. + * \ingroup vocoder_blk + */ + class VOCODER_API g723_40_encode_sb : virtual public gr_sync_block + { + public: + // gr::vocoder::g723_40_encode_sb::sptr + typedef boost::shared_ptr<g723_40_encode_sb> sptr; + + /*! + * \brief Make G722_40 encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_G723_40_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h b/gr-vocoder/include/vocoder/gsm_fr_decode_ps.h index 3af249436c..69aac7a0c8 100644 --- a/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h +++ b/gr-vocoder/include/vocoder/gsm_fr_decode_ps.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2011 Free Software Foundation, Inc. + * Copyright 2005,2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,30 +23,29 @@ #ifndef INCLUDED_VOCODER_GSM_FR_DECODE_PS_H #define INCLUDED_VOCODER_GSM_FR_DECODE_PS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_interpolator.h> -class vocoder_gsm_fr_decode_ps; -typedef boost::shared_ptr<vocoder_gsm_fr_decode_ps> vocoder_gsm_fr_decode_ps_sptr; - -VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); - -/*! - * \brief GSM 06.10 Full Rate Vocoder Decoder - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_gsm_fr_decode_ps : public gr_sync_interpolator { - struct gsm_state *d_gsm; - - friend VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); - vocoder_gsm_fr_decode_ps (); - -public: - ~vocoder_gsm_fr_decode_ps (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief GSM 06.10 Full Rate Vocoder Decoder + * \ingroup vocoder_blk + */ + class VOCODER_API gsm_fr_decode_ps : virtual public gr_sync_interpolator + { + public: + // gr::vocoder::gsm_fr_decode_ps::sptr + typedef boost::shared_ptr<gsm_fr_decode_ps> sptr; + + /*! + * \brief Make GSM decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_GSM_FR_DECODE_PS_H */ diff --git a/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h b/gr-vocoder/include/vocoder/gsm_fr_encode_sp.h index 2b65b5b44e..a54a8914bc 100644 --- a/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h +++ b/gr-vocoder/include/vocoder/gsm_fr_encode_sp.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2011 Free Software Foundation, Inc. + * Copyright 2005,2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,32 +23,31 @@ #ifndef INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H #define INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_decimator.h> -class vocoder_gsm_fr_encode_sp; -typedef boost::shared_ptr<vocoder_gsm_fr_encode_sp> vocoder_gsm_fr_encode_sp_sptr; - -VOCODER_API vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp (); - -/*! - * \brief GSM 06.10 Full Rate Vocoder Encoder - * \ingroup vocoder_blk - * - * shorts in; 33 byte packets out - */ -class VOCODER_API vocoder_gsm_fr_encode_sp : public gr_sync_decimator { - struct gsm_state *d_gsm; - - friend VOCODER_API vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp (); - vocoder_gsm_fr_encode_sp (); - -public: - ~vocoder_gsm_fr_encode_sp (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief GSM 06.10 Full Rate Vocoder Encoder + * \ingroup vocoder_blk + * + * shorts in; 33 byte packets out + */ + class VOCODER_API gsm_fr_encode_sp : virtual public gr_sync_decimator + { + public: + // gr::vocoder::gsm_fr_encode_sp::sptr + typedef boost::shared_ptr<gsm_fr_encode_sp> sptr; + + /*! + * \brief Make GSM encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_decode_bs.h b/gr-vocoder/include/vocoder/ulaw_decode_bs.h index e25e9cdcf5..6d81edc890 100644 --- a/gr-vocoder/include/vocoder_ulaw_decode_bs.h +++ b/gr-vocoder/include/vocoder/ulaw_decode_bs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,34 +23,29 @@ #ifndef INCLUDED_VOCODER_ULAW_DECODE_BS_H #define INCLUDED_VOCODER_ULAW_DECODE_BS_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_ulaw_decode_bs; - -typedef boost::shared_ptr<vocoder_ulaw_decode_bs> vocoder_ulaw_decode_bs_sptr; - -VOCODER_API vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); - -/*! - * \brief This block performs ulaw audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_ulaw_decode_bs : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); - - vocoder_ulaw_decode_bs(); - - public: - ~vocoder_ulaw_decode_bs(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs ulaw audio decoding. + * \ingroup vocoder_blk + */ + class VOCODER_API ulaw_decode_bs : virtual public gr_sync_block + { + public: + // gr::vocoder::ulaw_decode_bs::sptr + typedef boost::shared_ptr<ulaw_decode_bs> sptr; + + /*! + * \brief Make ulaw decoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_ULAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_encode_sb.h b/gr-vocoder/include/vocoder/ulaw_encode_sb.h index 702017d42a..92e562d55e 100644 --- a/gr-vocoder/include/vocoder_ulaw_encode_sb.h +++ b/gr-vocoder/include/vocoder/ulaw_encode_sb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,33 +23,29 @@ #ifndef INCLUDED_VOCODER_ULAW_ENCODER_SB_H #define INCLUDED_VOCODER_ULAW_ENCODER_SB_H -#include <vocoder_api.h> +#include <vocoder/api.h> #include <gr_sync_block.h> -class vocoder_ulaw_encode_sb; - -typedef boost::shared_ptr<vocoder_ulaw_encode_sb> vocoder_ulaw_encode_sb_sptr; - -VOCODER_API vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); - -/*! - * \brief This block performs g.711 ulaw audio encoding. - * - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_ulaw_encode_sb : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); - - vocoder_ulaw_encode_sb(); - - public: - ~vocoder_ulaw_encode_sb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace vocoder { + + /*! + * \brief This block performs g.711 ulaw audio encoding. + * \ingroup vocoder_blk + */ + class VOCODER_API ulaw_encode_sb : virtual public gr_sync_block + { + public: + // gr::vocoder::ulaw_encode_sb::sptr + typedef boost::shared_ptr<ulaw_encode_sb> sptr; + + /*! + * \brief Make ulaw encoder block. + */ + static sptr make(); + }; + + } /* namespace vocoder */ +} /* namespace gr */ #endif /* INCLUDED_VOCODER_ULAW_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_cvsd_decode_bs.h b/gr-vocoder/include/vocoder_cvsd_decode_bs.h deleted file mode 100644 index ebafeeb4ea..0000000000 --- a/gr-vocoder/include/vocoder_cvsd_decode_bs.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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. - */ - -#ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_H -#define INCLUDED_VOCODER_CVSD_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_interpolator.h> - -class vocoder_cvsd_decode_bs; - -typedef boost::shared_ptr<vocoder_cvsd_decode_bs> vocoder_cvsd_decode_bs_sptr; - - /*! - * \brief Constructor parameters to initialize the CVSD decoder. The default - * values are modeled after the Bluetooth standard and should not be changed, - * except by an advanced user - * - * \ingroup vocoder_blk - * - * \param min_step Minimum step size used to update the internal reference. Default: "10" - * \param max_step Maximum step size used to update the internal reference. Default: "1280" - * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024) - * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. Default: "0.96875" (i.e. 1-1/32) - * \param K; Size of shift register; the number of output bits remembered by codec (must be less or equal to 32). Default: "32" - * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4" - * \param pos_accum_max Maximum integer value allowed for the internal reference. Default: "32767" (2^15 - 1 or MAXSHORT) - * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1) - * - */ -VOCODER_API vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -/*! - * \brief This block performs CVSD audio decoding. Its design and implementation - * is modeled after the CVSD encoder/decoder specifications defined in the - * Bluetooth standard. - * - * \ingroup vocoder_blk - * - * CVSD is a method for encoding speech that seeks to reduce the - * bandwidth required for digital voice transmission. CVSD takes - * advantage of strong correlation between samples, quantizing the - * difference in amplitude between two consecutive samples. This - * difference requires fewer quantization levels as compared to other - * methods that quantize the actual amplitude level, reducing the - * bandwidth. CVSD employs a two level quantizer (one bit) and an - * adaptive algorithm that allows for continuous step size adjustment. - * - * The coder can represent low amplitude signals with accuracy without - * sacrificing performance on large amplitude signals, a trade off that - * occurs in some non-adaptive modulations. - * - * The CVSD decoder effectively provides 1-to-8 decompression. More - * specifically, for each incoming input bit, the decoder outputs one - * audio sample. If the input is a "1" bit, the internal reference is - * increased appropriately and then outputted as the next estimated audio - * sample. If the input is a "0" bit, the internal reference is - * decreased appropriately and then likewise outputted as the next estimated - * audio sample. Grouping 8 input bits together, the encoder essentially - * produces 8 output audio samples for everyone one input byte. - * - * This decoder requires that output audio samples are 2-byte short signed - * integers. The result bandwidth conversion, therefore, is 1 byte of - * encoded audio data to 16 output bytes of raw audio data. - * - * The CVSD decoder module must be post-fixed by a down-converter to - * under-sample the audio data after decoding. The Bluetooth standard - * specifically calls for a 8-to-1 decimating down-converter. This is - * required so that so that output sampling rate equals the original input - * sampling rate present before the encoder. In all cases, the output - * down-converter rate must be the inverse of the input up-converter rate - * before the CVSD encoder. - * - * References: - * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial, - * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF. - * 2. Specification of The Bluetooth System - * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf. - * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002. - * Bluetooth Voice Simulink� Model, Available: - * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html - * - */ - -class VOCODER_API vocoder_cvsd_decode_bs : public gr_sync_interpolator -{ -private: - friend VOCODER_API vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step, - short max_step, - double step_decay, - double accum_decay, - int K, - int J, - short pos_accum_max, - short neg_accum_max); - - vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); - - //! Member functions required by the encoder/decoder - //! \brief Rounding function specific to CVSD - //! \return the input value rounded to the nearest integer - int cvsd_round(double input); - - //! \brief A power function specific to CVSD data formats - //! \return (radix)^power, where radix and power are short integers - unsigned int cvsd_pow (short radix, short power); - - //! \brief Sums number of 1's in the input - //! \return the number of 1s in the four bytes of an input unsigned integer - unsigned char cvsd_bitwise_sum (unsigned int input); - - short d_min_step; - short d_max_step; - double d_step_decay; - double d_accum_decay; - - int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register - int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s - - short d_pos_accum_max; - short d_neg_accum_max; - - int d_accum; //!< \brief Current value of internal reference - int d_loop_counter; //!< \brief Current value of the loop counter - unsigned int d_runner; //!< \brief Current value of the shift register - unsigned int d_runner_mask; //!< \brief Value of the mask to access the last J bits of the shift register - short d_stepsize; //!< \brief Current value of the step sizer - - public: - ~vocoder_cvsd_decode_bs (); // public destructor - - short min_step() { return d_min_step; } - short max_step() { return d_max_step; } - double step_decay() { return d_step_decay; } - double accum_decay() { return d_accum_decay; } - int K() { return d_K; } - int J() { return d_J; } - short pos_accum_max() { return d_pos_accum_max; } - short neg_accum_max() { return d_neg_accum_max; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_CVSD_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_cvsd_encode_sb.h b/gr-vocoder/include/vocoder_cvsd_encode_sb.h deleted file mode 100644 index 876fd96de4..0000000000 --- a/gr-vocoder/include/vocoder_cvsd_encode_sb.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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. - */ -#ifndef INCLUDED_VOCODER_CVSD_ENCODER_SB_H -#define INCLUDED_VOCODER_CVSD_ENCODER_SB_H - -#include <vocoder_api.h> -#include <gr_sync_decimator.h> - -class vocoder_cvsd_encode_sb; - -typedef boost::shared_ptr<vocoder_cvsd_encode_sb> vocoder_cvsd_encode_sb_sptr; - - /*! - * \brief Constructor parameters to initialize the CVSD encoder. The - * default values are modeled after the Bluetooth standard and should - * not be changed except by an advanced user - * - * \ingroup vocoder_blk - * - * \param min_step Minimum step size used to update the internal reference. Default: "10" - * \param max_step Maximum step size used to update the internal reference. Default: "1280" - * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024) - * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. Default: "0.96875" (i.e. 1-1/32) - * \param K; Size of shift register; the number of output bits remembered by codec (must be less or equal to 32). Default: "32" - * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4" - * \param pos_accum_max Maximum integer value allowed for the internal reference. Default: "32767" (2^15 - 1 or MAXSHORT) - * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1) - * - */ - -VOCODER_API vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb(short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -/*! - * \brief This block performs CVSD audio encoding. Its design and implementation - * is modeled after the CVSD encoder/decoder specifications defined in the - * Bluetooth standard. - * - * \ingroup vocoder_blk - * - * CVSD is a method for encoding speech that seeks to reduce the - * bandwidth required for digital voice transmission. CVSD takes - * advantage of strong correlation between samples, quantizing the - * difference in amplitude between two consecutive samples. This - * difference requires fewer quantization levels as compared to other - * methods that quantize the actual amplitude level, reducing the - * bandwidth. CVSD employs a two level quantizer (one bit) and an - * adaptive algorithm that allows for continuous step size adjustment. - * - * The coder can represent low amplitude signals with accuracy without - * sacrificing performance on large amplitude signals, a trade off that - * occurs in some non-adaptive modulations. - * - * The CVSD encoder effectively provides 8-to-1 compression. More - * specifically, each incoming audio sample is compared to an internal - * reference value. If the input is greater or equal to the reference, - * the encoder outputs a "1" bit. If the input is less than the reference, - * the encoder outputs a "0" bit. The reference value is then updated - * accordingly based on the frequency of outputted "1" or "0" bits. By - * grouping 8 outputs bits together, the encoder essentially produce one - * output byte for every 8 input audio samples. - * - * This encoder requires that input audio samples are 2-byte short signed - * integers. The result bandwidth conversion, therefore, is 16 input bytes - * of raw audio data to 1 output byte of encoded audio data. - * - * The CVSD encoder module must be prefixed by an up-converter to over-sample - * the audio data prior to encoding. The Bluetooth standard specifically - * calls for a 1-to-8 interpolating up-converter. While this reduces the - * overall compression of the codec, this is required so that the encoder - * can accurately compute the slope between adjacent audio samples and - * correctly update its internal reference value. - * - * References: - * - * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial, - * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF. - * - * 2. Specification of The Bluetooth System - * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf. - * - * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002. - * Bluetooth Voice Simulink� Model, Available: - * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html - * - */ - -class VOCODER_API vocoder_cvsd_encode_sb : public gr_sync_decimator -{ -private: - friend VOCODER_API vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb(short min_step, - short max_step, - double step_decay, - double accum_decay, - int K, - int J, - short pos_accum_max, - short neg_accum_max); - - vocoder_cvsd_encode_sb(short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); - - //! Member functions required by the encoder/decoder - //! \brief Rounding function specific to CVSD - //! \return the input value rounded to the nearest integer - int cvsd_round(double input); - - //! \brief A power function specific to CVSD data formats - //! \return (radix)^power, where radix and power are short integers - unsigned int cvsd_pow (short radix, short power); - - //! \brief Sums number of 1's in the input - //! \return the number of 1s in the four bytes of an input unsigned integer - unsigned char cvsd_bitwise_sum (unsigned int input); - - // Members variables related to the CVSD encoder use to update interal reference value - short d_min_step; - short d_max_step; - double d_step_decay; - double d_accum_decay; - - int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register - int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s - - short d_pos_accum_max; - short d_neg_accum_max; - - int d_accum; //!< \brief Current value of internal reference - int d_loop_counter; //!< \brief Current value of the loop counter - unsigned int d_runner; //!< \brief Current value of the shift register - short d_stepsize; //!< \brief Current value of the step sizer - - public: - ~vocoder_cvsd_encode_sb (); // public destructor - - short min_step() { return d_min_step; } - short max_step() { return d_max_step; } - double step_decay() { return d_step_decay; } - double accum_decay() { return d_accum_decay; } - int K() { return d_K; } - int J() { return d_J; } - short pos_accum_max() { return d_pos_accum_max; } - short neg_accum_max() { return d_neg_accum_max; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_CVSD_ENCODE_SB_H */ diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt index 43a4156d06..7949e227b7 100644 --- a/gr-vocoder/lib/CMakeLists.txt +++ b/gr-vocoder/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,26 +29,30 @@ include_directories( link_directories(${Boost_LIBRARY_DIRS}) +if(ENABLE_GR_CTRLPORT) + ADD_DEFINITIONS(-DGR_CTRLPORT) +endif(ENABLE_GR_CTRLPORT) + ######################################################################## # Setup library ######################################################################## list(APPEND gr_vocoder_sources - vocoder_alaw_decode_bs.cc - vocoder_alaw_encode_sb.cc - vocoder_codec2_decode_ps.cc - vocoder_codec2_encode_sp.cc - vocoder_cvsd_decode_bs.cc - vocoder_cvsd_encode_sb.cc - vocoder_g721_decode_bs.cc - vocoder_g721_encode_sb.cc - vocoder_g723_24_decode_bs.cc - vocoder_g723_24_encode_sb.cc - vocoder_g723_40_decode_bs.cc - vocoder_g723_40_encode_sb.cc - vocoder_gsm_fr_decode_ps.cc - vocoder_gsm_fr_encode_sp.cc - vocoder_ulaw_decode_bs.cc - vocoder_ulaw_encode_sb.cc + alaw_decode_bs_impl.cc + alaw_encode_sb_impl.cc + codec2_decode_ps_impl.cc + codec2_encode_sp_impl.cc + cvsd_decode_bs_impl.cc + cvsd_encode_sb_impl.cc + g721_decode_bs_impl.cc + g721_encode_sb_impl.cc + g723_24_decode_bs_impl.cc + g723_24_encode_sb_impl.cc + g723_40_decode_bs_impl.cc + g723_40_encode_sb_impl.cc + gsm_fr_decode_ps_impl.cc + gsm_fr_encode_sp_impl.cc + ulaw_decode_bs_impl.cc + ulaw_encode_sb_impl.cc ) ######################################################################## diff --git a/gr-vocoder/lib/alaw_decode_bs_impl.cc b/gr-vocoder/lib/alaw_decode_bs_impl.cc new file mode 100644 index 0000000000..abea694da9 --- /dev/null +++ b/gr-vocoder/lib/alaw_decode_bs_impl.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "alaw_decode_bs_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + +extern "C" { +#include "g7xx/g72x.h" +} + + alaw_decode_bs::sptr + alaw_decode_bs::make() + { + return gnuradio::get_initial_sptr + (new alaw_decode_bs_impl()); + } + + alaw_decode_bs_impl::alaw_decode_bs_impl() + : gr_sync_block("vocoder_alaw_decode_bs", + gr_make_io_signature(1, 1, sizeof(unsigned char)), + gr_make_io_signature(1, 1, sizeof(short))) + { + } + + alaw_decode_bs_impl::~alaw_decode_bs_impl() + { + } + + int + alaw_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + out[i] = alaw2linear(in[i]); + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/swig/vocoder_g723_24_decode_bs.i b/gr-vocoder/lib/alaw_decode_bs_impl.h index 33f6e88b93..06b23f3cfa 100644 --- a/gr-vocoder/swig/vocoder_g723_24_decode_bs.i +++ b/gr-vocoder/lib/alaw_decode_bs_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011.2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,14 +20,26 @@ * Boston, MA 02110-1301, USA. */ -%{ -#include "vocoder_g723_24_decode_bs.h" -%} +#ifndef INCLUDED_VOCODER_ALAW_DECODE_BS_IMPL_H +#define INCLUDED_VOCODER_ALAW_DECODE_BS_IMPL_H -GR_SWIG_BLOCK_MAGIC(vocoder,g723_24_decode_bs); +#include <vocoder/alaw_decode_bs.h> -vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs(); +namespace gr { + namespace vocoder { -class vocoder_g723_24_decode_bs : public gr_sync_block -{ -}; + class alaw_decode_bs_impl : public alaw_decode_bs + { + public: + alaw_decode_bs_impl(); + ~alaw_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_ALAW_DECODE_BS_IMPL_H */ diff --git a/gr-vocoder/lib/alaw_encode_sb_impl.cc b/gr-vocoder/lib/alaw_encode_sb_impl.cc new file mode 100644 index 0000000000..4b316f2e14 --- /dev/null +++ b/gr-vocoder/lib/alaw_encode_sb_impl.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "alaw_encode_sb_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + +extern "C" { +#include "g7xx/g72x.h" +} + + alaw_encode_sb::sptr + alaw_encode_sb::make() + { + return gnuradio::get_initial_sptr + (new alaw_encode_sb_impl()); + } + + alaw_encode_sb_impl::alaw_encode_sb_impl() + : gr_sync_block("avocoder_law_encode_sb", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(unsigned char))) + { + } + + alaw_encode_sb_impl::~alaw_encode_sb_impl() + { + } + + int + alaw_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + out[i] = linear2alaw(in[i]); + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/alaw_encode_sb_impl.h b/gr-vocoder/lib/alaw_encode_sb_impl.h new file mode 100644 index 0000000000..72112e35a9 --- /dev/null +++ b/gr-vocoder/lib/alaw_encode_sb_impl.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_ALAW_ENCODER_SB_IMPL_H +#define INCLUDED_VOCODER_ALAW_ENCODER_SB_IMPL_H + +#include <vocoder/alaw_encode_sb.h> + +namespace gr { + namespace vocoder { + + class alaw_encode_sb_impl : public alaw_encode_sb + { + public: + alaw_encode_sb_impl(); + ~alaw_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_ALAW_ENCODE_SB_IMPL_H */ diff --git a/gr-vocoder/lib/codec2_decode_ps_impl.cc b/gr-vocoder/lib/codec2_decode_ps_impl.cc new file mode 100644 index 0000000000..cd47c9e702 --- /dev/null +++ b/gr-vocoder/lib/codec2_decode_ps_impl.cc @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "codec2_decode_ps_impl.h" + +extern "C" { +#include "codec2/codec2.h" +} + +#include <gr_io_signature.h> +#include <stdexcept> +#include <assert.h> + +namespace gr { + namespace vocoder { + + codec2_decode_ps::sptr + codec2_decode_ps::make() + { + return gnuradio::get_initial_sptr + (new codec2_decode_ps_impl()); + } + + + codec2_decode_ps_impl::codec2_decode_ps_impl () + : gr_sync_interpolator("vocoder_codec2_decode_ps", + gr_make_io_signature(1, 1, CODEC2_BITS_PER_FRAME * sizeof(char)), + gr_make_io_signature (1, 1, sizeof(short)), + CODEC2_SAMPLES_PER_FRAME) + { + if((d_codec2 = codec2_create()) == 0) + throw std::runtime_error("codec2_decode_ps_impl: codec2_create failed"); + } + + codec2_decode_ps_impl::~codec2_decode_ps_impl() + { + codec2_destroy(d_codec2); + } + + int + codec2_decode_ps_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short *) output_items[0]; + + assert((noutput_items % CODEC2_SAMPLES_PER_FRAME) == 0); + + for(int i = 0; i < noutput_items; i += CODEC2_SAMPLES_PER_FRAME) { + codec2_decode (d_codec2, out, const_cast<unsigned char*>(in)); + in += CODEC2_BITS_PER_FRAME * sizeof (char); + out += CODEC2_SAMPLES_PER_FRAME; + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/codec2_decode_ps_impl.h b/gr-vocoder/lib/codec2_decode_ps_impl.h new file mode 100644 index 0000000000..26e39da1de --- /dev/null +++ b/gr-vocoder/lib/codec2_decode_ps_impl.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_CODEC2_DECODE_PS_IMPL_H +#define INCLUDED_VOCODER_CODEC2_DECODE_PS_IMPL_H + +#include <vocoder/codec2_decode_ps.h> + +namespace gr { + namespace vocoder { + + class codec2_decode_ps_impl : public codec2_decode_ps + { + private: + void *d_codec2; + + public: + codec2_decode_ps_impl(); + ~codec2_decode_ps_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_CODEC2_DECODE_PS_IMPL_H */ diff --git a/gr-vocoder/lib/codec2_encode_sp_impl.cc b/gr-vocoder/lib/codec2_encode_sp_impl.cc new file mode 100644 index 0000000000..0217fbd424 --- /dev/null +++ b/gr-vocoder/lib/codec2_encode_sp_impl.cc @@ -0,0 +1,79 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "codec2_encode_sp_impl.h" + +extern "C" { +#include "codec2/codec2.h" +} + +#include <gr_io_signature.h> +#include <stdexcept> + +namespace gr { + namespace vocoder { + + codec2_encode_sp::sptr + codec2_encode_sp::make() + { + return gnuradio::get_initial_sptr + (new codec2_encode_sp_impl()); + } + + codec2_encode_sp_impl::codec2_encode_sp_impl() + : gr_sync_decimator("vocoder_codec2_encode_sp", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, CODEC2_BITS_PER_FRAME * sizeof(char)), + CODEC2_SAMPLES_PER_FRAME) + { + if((d_codec2 = codec2_create()) == 0) + throw std::runtime_error("codec2_encode_sp_impl: codec2_create failed"); + } + + codec2_encode_sp_impl::~codec2_encode_sp_impl() + { + codec2_destroy(d_codec2); + } + + int + codec2_encode_sp_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + codec2_encode(d_codec2, out, const_cast<short*>(in)); + in += CODEC2_SAMPLES_PER_FRAME; + out += CODEC2_BITS_PER_FRAME * sizeof(char); + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/codec2_encode_sp_impl.h b/gr-vocoder/lib/codec2_encode_sp_impl.h new file mode 100644 index 0000000000..1a5c34c9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2_encode_sp_impl.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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. + */ + +#ifndef INCLUDED_VOCODER_CODEC2_ENCODE_SP_IMPL_H +#define INCLUDED_VOCODER_CODEC2_ENCODE_SP_IMPL_H + +#include <vocoder/codec2_encode_sp.h> + +namespace gr { + namespace vocoder { + + class codec2_encode_sp_impl : public codec2_encode_sp + { + private: + void *d_codec2; + + public: + codec2_encode_sp_impl(); + ~codec2_encode_sp_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_CODEC2_ENCODE_SP_IMPL_H */ diff --git a/gr-vocoder/lib/cvsd_decode_bs_impl.cc b/gr-vocoder/lib/cvsd_decode_bs_impl.cc new file mode 100644 index 0000000000..e7f284adda --- /dev/null +++ b/gr-vocoder/lib/cvsd_decode_bs_impl.cc @@ -0,0 +1,192 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2010,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cvsd_decode_bs_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + cvsd_decode_bs::sptr + cvsd_decode_bs::make(short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) + { + return gnuradio::get_initial_sptr + (new cvsd_decode_bs_impl(min_step, max_step, + step_decay, accum_decay, K, J, + pos_accum_max, neg_accum_max)); + } + + cvsd_decode_bs_impl::cvsd_decode_bs_impl(short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) + : gr_sync_interpolator("vocoder_cvsd_decode_bs", + gr_make_io_signature(1, 1, sizeof(unsigned char)), + gr_make_io_signature(1, 1, sizeof(short)), + 8), + d_min_step(min_step), d_max_step(max_step), d_step_decay(step_decay), + d_accum_decay(accum_decay), d_K(K), d_J(J), + d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max), + d_accum(0), + d_loop_counter(1), + d_runner(0), + d_runner_mask(0), + d_stepsize(min_step) + { + if(d_K > 32) + throw std::runtime_error("cvsd_decode_bs_impl: K must be <= 32\n"); + + if(d_J > d_K) + throw std::runtime_error("cvsd_decode_bs_impl: J must be <= K\n"); + } + + cvsd_decode_bs_impl::~cvsd_decode_bs_impl() + { + // nothing else required in this example + } + + unsigned char + cvsd_decode_bs_impl::cvsd_bitwise_sum(unsigned int input) + { + unsigned int temp = input; + unsigned char bits = 0; + + while(temp) { + temp=temp&(temp-1); + bits++; + } + return bits; + } + + int + cvsd_decode_bs_impl::cvsd_round(double input) + { + double temp; + temp=input+0.5; + temp=floor(temp); + + return (int)temp; + } + + unsigned int + cvsd_decode_bs_impl::cvsd_pow(short radix, short power) + { + double d_radix = (double) radix; + int i_power = (int) power; + double output; + + output = pow(d_radix,i_power); + return ( (unsigned int)cvsd_round(output)); + } + + int + cvsd_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short *) output_items[0]; + + int i=0; + short output_short=0; // 2 bytes 0 .. 65,535 + unsigned char bit_count=0; // 1 byte, 0 .. 255 + unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295 + unsigned char input_byte=0; // 1 bytes + unsigned char input_bit=0; // 1 byte, 0 .. 255 + + // Loop through each input data point + for(i = 0; i < noutput_items/8.0; i++) { + input_byte = in[i]; + // Initiliaze bit counter + bit_count=0; + + while(bit_count<8) { + // Compute the Appropriate Mask + mask=cvsd_pow(2,7-bit_count); + + // Pull off the corresponding bit + input_bit = input_byte & mask; + + // Update the bit counter + bit_count++; + + // Update runner with the next input bit + // Runner is a shift-register; shift left, add on newest output bit + d_runner = (d_runner<<1) | ((unsigned int) input_bit); + + // Run this only if you have >= J bits in your shift register + if(d_loop_counter>=d_J) { + // Update Step Size + d_runner_mask=(cvsd_pow(2,d_J)-1); + if((cvsd_bitwise_sum(d_runner & d_runner_mask)>=d_J) || + (cvsd_bitwise_sum((~d_runner) & d_runner_mask)>=d_J)) { + // Runs of 1s and 0s + d_stepsize = std::min( (short) (d_stepsize + d_min_step), d_max_step); + } + else { + // No runs of 1s and 0s + d_stepsize = std::max( (short) cvsd_round(d_stepsize*d_step_decay), d_min_step); + } + } + + // Update Accum (i.e. the reference value) + if(input_bit) { + d_accum = d_accum+d_stepsize; + } + else { + d_accum = d_accum-d_stepsize; + } + + // Multiply by Accum_Decay + d_accum = (cvsd_round(d_accum*d_accum_decay)); + + // Check for overflow + if(d_accum >=((int) d_pos_accum_max)) { + d_accum = (int)d_pos_accum_max; + } + else if(d_accum <=((int) d_neg_accum_max)) { + d_accum = (int)d_neg_accum_max; + } + + // Find the output short to write to the file + output_short = ((short)d_accum); + + if(d_loop_counter <= d_K) { + d_loop_counter++; + } + + *(out++) = output_short; + } // while () + + } // for() + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/cvsd_decode_bs_impl.h b/gr-vocoder/lib/cvsd_decode_bs_impl.h new file mode 100644 index 0000000000..007c00c2bd --- /dev/null +++ b/gr-vocoder/lib/cvsd_decode_bs_impl.h @@ -0,0 +1,92 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_IMPL_H +#define INCLUDED_VOCODER_CVSD_DECODE_BS_IMPL_H + +#include <vocoder/cvsd_decode_bs.h> + +namespace gr { + namespace vocoder { + + class cvsd_decode_bs_impl : public cvsd_decode_bs + { + private: + //! Member functions required by the encoder/decoder + //! \brief Rounding function specific to CVSD + //! \return the input value rounded to the nearest integer + int cvsd_round(double input); + + //! \brief A power function specific to CVSD data formats + //! \return (radix)^power, where radix and power are short integers + unsigned int cvsd_pow(short radix, short power); + + //! \brief Sums number of 1's in the input + //! \return the number of 1s in the four bytes of an input unsigned integer + unsigned char cvsd_bitwise_sum(unsigned int input); + + short d_min_step; + short d_max_step; + double d_step_decay; + double d_accum_decay; + + int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register + int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s + + short d_pos_accum_max; + short d_neg_accum_max; + + int d_accum; //!< \brief Current value of internal reference + int d_loop_counter; //!< \brief Current value of the loop counter + unsigned int d_runner; //!< \brief Current value of the shift register + unsigned int d_runner_mask; //!< \brief Value of the mask to access the last J bits of the shift register + short d_stepsize; //!< \brief Current value of the step sizer + + public: + cvsd_decode_bs_impl(short min_step=10, + short max_step=1280, + double step_decay=0.9990234375, + double accum_decay= 0.96875, + int K=32, + int J=4, + short pos_accum_max=32767, + short neg_accum_max=-32767); + ~cvsd_decode_bs_impl(); + + short min_step() { return d_min_step; } + short max_step() { return d_max_step; } + double step_decay() { return d_step_decay; } + double accum_decay() { return d_accum_decay; } + int K() { return d_K; } + int J() { return d_J; } + short pos_accum_max() { return d_pos_accum_max; } + short neg_accum_max() { return d_neg_accum_max; } + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_CVSD_DECODE_BS_IMPL_H */ diff --git a/gr-vocoder/lib/cvsd_encode_sb_impl.cc b/gr-vocoder/lib/cvsd_encode_sb_impl.cc new file mode 100644 index 0000000000..74ecdb25e1 --- /dev/null +++ b/gr-vocoder/lib/cvsd_encode_sb_impl.cc @@ -0,0 +1,192 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2010,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cvsd_encode_sb_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + cvsd_encode_sb::sptr + cvsd_encode_sb::make(short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) + { + return gnuradio::get_initial_sptr + (new cvsd_encode_sb_impl(min_step, max_step, + step_decay, accum_decay, K, J, + pos_accum_max, neg_accum_max)); + } + + cvsd_encode_sb_impl::cvsd_encode_sb_impl(short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) + : gr_sync_decimator("vocoder_cvsd_encode_sb", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(unsigned char)), + 8), + d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay), + d_accum_decay(accum_decay), d_K(K), d_J(J), + d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max), + d_accum(0), + d_loop_counter(1), + d_runner(0), + d_stepsize(min_step) + { + if(d_K > 32) + throw std::runtime_error("cvsd_decode_bs_impl: K must be <= 32\n"); + + if(d_J > d_K) + throw std::runtime_error("cvsd_decode_bs_impl: J must be <= K\n"); + } + + cvsd_encode_sb_impl::~cvsd_encode_sb_impl() + { + // nothing else required in this example + } + + unsigned char + cvsd_encode_sb_impl::cvsd_bitwise_sum(unsigned int input) + { + unsigned int temp = input; + unsigned char bits = 0; + + while(temp) { + temp=temp&(temp-1); + bits++; + } + return bits; + } + + int + cvsd_encode_sb_impl::cvsd_round(double input) + { + double temp; + temp=input+0.5; + temp=floor(temp); + + return (int)temp; + } + + unsigned int + cvsd_encode_sb_impl::cvsd_pow(short radix, short power) + { + double d_radix = (double)radix; + int i_power = (int)power; + double output; + + output = pow(d_radix,i_power); + return ((unsigned int)cvsd_round(output)); + } + + int + cvsd_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + unsigned short i=0; // 2 bytes, 0 .. 65,535 + unsigned char output_bit=0; // 1 byte, 0 .. 255 + unsigned char output_byte=0; // 1 bytes 0.255 + unsigned char bit_count=0; // 1 byte, 0 .. 255 + unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295 + + // Loop through each input data point + for(i = 0; i < noutput_items*8; i++) { + if((int)in[i] >= d_accum) { // Note: sign((data(n)-accum)) + output_bit=1; + } + else { + output_bit=0; + } + + // Update Accum (i.e. the reference value) + if(output_bit) { + d_accum=d_accum+d_stepsize; + //printf("Addding %d to the accum; the result is: %d.\n", d_stepsize, d_accum); + } + else { + d_accum=d_accum-d_stepsize; + //printf("Subtracting %d to the accum; the result is: %d.\n", d_stepsize, d_accum); + } + + // Multiply by Accum_Decay + d_accum = (cvsd_round(d_accum*d_accum_decay)); + + // Check for overflow + if(d_accum >= ((int)d_pos_accum_max)) { + d_accum = (int)d_pos_accum_max; + } + else if(d_accum <= ((int) d_neg_accum_max)) { + d_accum = (int) d_neg_accum_max; + } + + // Update runner with the last output bit + // Update Step Size + if(d_loop_counter >= d_J) { // Run this only if you have >= J bits in your shift register + mask = (cvsd_pow(2, d_J) - 1); + if((cvsd_bitwise_sum(d_runner & mask) >= d_J) || + (cvsd_bitwise_sum((~d_runner) & mask) >= d_J)) { + // Runs of 1s and 0s + d_stepsize = std::min((short)(d_stepsize + d_min_step), d_max_step); + } + else { + // No runs of 1s and 0s + d_stepsize = std::max((short)cvsd_round(d_stepsize*d_step_decay), d_min_step); + } + } + + // Runner is a shift-register; shift left, add on newest output bit + d_runner = (d_runner<<1) | ((unsigned int) output_bit); + + // Update the ouput type; shift left, add on newest output bit + // If you have put in 8 bits, output it as a byte + output_byte = (output_byte<<1) | output_bit; + bit_count++; + + if(d_loop_counter <= d_K) { + d_loop_counter++; + } + + // If you have put 8 bits, output and clear. + if(bit_count==8) { + // Read in short from the file + *(out++) = output_byte; + + // Reset the bit_count + bit_count=0; + output_byte=0; + } + } // While + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/cvsd_encode_sb_impl.h b/gr-vocoder/lib/cvsd_encode_sb_impl.h new file mode 100644 index 0000000000..1189920fa0 --- /dev/null +++ b/gr-vocoder/lib/cvsd_encode_sb_impl.h @@ -0,0 +1,92 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2013 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. + */ + +#ifndef INCLUDED_VOCODER_CVSD_ENCODER_SB_IMPL_H +#define INCLUDED_VOCODER_CVSD_ENCODER_SB_IMPL_H + +#include <vocoder/cvsd_encode_sb.h> + +namespace gr { + namespace vocoder { + + class cvsd_encode_sb_impl : public cvsd_encode_sb + { + private: + //! Member functions required by the encoder/decoder + //! \brief Rounding function specific to CVSD + //! \return the input value rounded to the nearest integer + int cvsd_round(double input); + + //! \brief A power function specific to CVSD data formats + //! \return (radix)^power, where radix and power are short integers + unsigned int cvsd_pow(short radix, short power); + + //! \brief Sums number of 1's in the input + //! \return the number of 1s in the four bytes of an input unsigned integer + unsigned char cvsd_bitwise_sum(unsigned int input); + + // Members variables related to the CVSD encoder use to update interal reference value + short d_min_step; + short d_max_step; + double d_step_decay; + double d_accum_decay; + + int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register + int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s + + short d_pos_accum_max; + short d_neg_accum_max; + + int d_accum; //!< \brief Current value of internal reference + int d_loop_counter; //!< \brief Current value of the loop counter + unsigned int d_runner; //!< \brief Current value of the shift register + short d_stepsize; //!< \brief Current value of the step sizer + + public: + cvsd_encode_sb_impl(short min_step=10, + short max_step=1280, + double step_decay=0.9990234375, + double accum_decay= 0.96875, + int K=32, + int J=4, + short pos_accum_max=32767, + short neg_accum_max=-32767); + ~cvsd_encode_sb_impl(); + + short min_step() { return d_min_step; } + short max_step() { return d_max_step; } + double step_decay() { return d_step_decay; } + double accum_decay() { return d_accum_decay; } + int K() { return d_K; } + int J() { return d_J; } + short pos_accum_max() { return d_pos_accum_max; } + short neg_accum_max() { return d_neg_accum_max; } + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_CVSD_ENCODE_SB_IMPL_H */ diff --git a/gr-vocoder/lib/g721_decode_bs_impl.cc b/gr-vocoder/lib/g721_decode_bs_impl.cc new file mode 100644 index 0000000000..143bbc514d --- /dev/null +++ b/gr-vocoder/lib/g721_decode_bs_impl.cc @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "g721_decode_bs_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + g721_decode_bs::sptr + g721_decode_bs::make() + { + return gnuradio::get_initial_sptr + (new g721_decode_bs_impl()); + } + + g721_decode_bs_impl::g721_decode_bs_impl() + : gr_sync_block("vocoder_g721_decode_bs", + gr_make_io_signature(1, 1, sizeof(unsigned char)), + gr_make_io_signature(1, 1, sizeof(short))) + { + g72x_init_state(&d_state); + } + + g721_decode_bs_impl::~g721_decode_bs_impl() + { + } + + int + g721_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g721_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/g721_decode_bs_impl.h b/gr-vocoder/lib/g721_decode_bs_impl.h new file mode 100644 index 0000000000..b861591e49 --- /dev/null +++ b/gr-vocoder/lib/g721_decode_bs_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_G721_DECODE_BS_IMPL_H +#define INCLUDED_VOCODER_G721_DECODE_BS_IMPL_H + +#include <vocoder/g721_decode_bs.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +namespace gr { + namespace vocoder { + + class g721_decode_bs_impl : public g721_decode_bs + { + private: + g72x_state d_state; + + public: + g721_decode_bs_impl(); + ~g721_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_G721_DECODE_BS_IMPL_H */ diff --git a/gr-vocoder/lib/g721_encode_sb_impl.cc b/gr-vocoder/lib/g721_encode_sb_impl.cc new file mode 100644 index 0000000000..a961b0efeb --- /dev/null +++ b/gr-vocoder/lib/g721_encode_sb_impl.cc @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "g721_encode_sb_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + g721_encode_sb::sptr + g721_encode_sb::make() + { + return gnuradio::get_initial_sptr + (new g721_encode_sb_impl()); + } + + g721_encode_sb_impl::g721_encode_sb_impl() + : gr_sync_block("vocoder_g721_encode_sb", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(unsigned char))) + { + g72x_init_state(&d_state); + } + + g721_encode_sb_impl::~g721_encode_sb_impl() + { + } + + int + g721_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g721_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/g721_encode_sb_impl.h b/gr-vocoder/lib/g721_encode_sb_impl.h new file mode 100644 index 0000000000..f22949aa45 --- /dev/null +++ b/gr-vocoder/lib/g721_encode_sb_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_G721_ENCODE_SB_IMPL_H +#define INCLUDED_VOCODER_G721_ENCODE_SB_IMPL_H + +#include <vocoder/g721_encode_sb.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +namespace gr { + namespace vocoder { + + class g721_encode_sb_impl : public g721_encode_sb + { + private: + g72x_state d_state; + + public: + g721_encode_sb_impl(); + ~g721_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_G721_ENCODE_SB_IMPL_H */ diff --git a/gr-vocoder/lib/g723_24_decode_bs_impl.cc b/gr-vocoder/lib/g723_24_decode_bs_impl.cc new file mode 100644 index 0000000000..f7a8b59a08 --- /dev/null +++ b/gr-vocoder/lib/g723_24_decode_bs_impl.cc @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "g723_24_decode_bs_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + g723_24_decode_bs::sptr + g723_24_decode_bs::make() + { + return gnuradio::get_initial_sptr + (new g723_24_decode_bs_impl()); + } + + g723_24_decode_bs_impl::g723_24_decode_bs_impl() + : gr_sync_block("vocoder_g723_24_decode_bs", + gr_make_io_signature(1, 1, sizeof(unsigned char)), + gr_make_io_signature(1, 1, sizeof(short))) + { + g72x_init_state(&d_state); + } + + g723_24_decode_bs_impl::~g723_24_decode_bs_impl() + { + } + + int + g723_24_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_24_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/g723_24_decode_bs_impl.h b/gr-vocoder/lib/g723_24_decode_bs_impl.h new file mode 100644 index 0000000000..3ecea1b1ef --- /dev/null +++ b/gr-vocoder/lib/g723_24_decode_bs_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_G723_24_DECODE_BS_IMPL_H +#define INCLUDED_VOCODER_G723_24_DECODE_BS_IMPL_H + +#include <vocoder/g723_24_decode_bs.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +namespace gr { + namespace vocoder { + + class g723_24_decode_bs_impl : public g723_24_decode_bs + { + private: + g72x_state d_state; + + public: + g723_24_decode_bs_impl(); + ~g723_24_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_G723_24_DECODE_BS_IMPL_H */ diff --git a/gr-vocoder/lib/g723_24_encode_sb_impl.cc b/gr-vocoder/lib/g723_24_encode_sb_impl.cc new file mode 100644 index 0000000000..8b168197b5 --- /dev/null +++ b/gr-vocoder/lib/g723_24_encode_sb_impl.cc @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "g723_24_encode_sb_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + g723_24_encode_sb::sptr + g723_24_encode_sb::make() + { + return gnuradio::get_initial_sptr + (new g723_24_encode_sb_impl()); + } + + g723_24_encode_sb_impl::g723_24_encode_sb_impl() + : gr_sync_block("vocoder_g723_24_encode_sb", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(unsigned char))) + { + g72x_init_state(&d_state); + } + + g723_24_encode_sb_impl::~g723_24_encode_sb_impl() + { + } + + int + g723_24_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_24_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/g723_24_encode_sb_impl.h b/gr-vocoder/lib/g723_24_encode_sb_impl.h new file mode 100644 index 0000000000..d7a44bc57b --- /dev/null +++ b/gr-vocoder/lib/g723_24_encode_sb_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_G723_24_ENCODE_SB_IMPL_H +#define INCLUDED_VOCODER_G723_24_ENCODE_SB_IMPL_H + +#include <vocoder/g723_24_encode_sb.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +namespace gr { + namespace vocoder { + + class g723_24_encode_sb_impl : public g723_24_encode_sb + { + private: + g72x_state d_state; + + public: + g723_24_encode_sb_impl(); + ~g723_24_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_G723_24_ENCODE_SB_IMPL_H */ diff --git a/gr-vocoder/lib/g723_40_decode_bs_impl.cc b/gr-vocoder/lib/g723_40_decode_bs_impl.cc new file mode 100644 index 0000000000..0790c9481c --- /dev/null +++ b/gr-vocoder/lib/g723_40_decode_bs_impl.cc @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "g723_40_decode_bs_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + g723_40_decode_bs::sptr + g723_40_decode_bs::make() + { + return gnuradio::get_initial_sptr + (new g723_40_decode_bs_impl()); + } + + g723_40_decode_bs_impl::g723_40_decode_bs_impl() + : gr_sync_block("vocoder_g723_40_decode_bs", + gr_make_io_signature(1, 1, sizeof(unsigned char)), + gr_make_io_signature(1, 1, sizeof(short))) + { + g72x_init_state(&d_state); + } + + g723_40_decode_bs_impl::~g723_40_decode_bs_impl() + { + } + + int + g723_40_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_40_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/g723_40_decode_bs_impl.h b/gr-vocoder/lib/g723_40_decode_bs_impl.h new file mode 100644 index 0000000000..3d5b4d6b7f --- /dev/null +++ b/gr-vocoder/lib/g723_40_decode_bs_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_G723_40_DECODE_BS_IMPL_H +#define INCLUDED_VOCODER_G723_40_DECODE_BS_IMPL_H + +#include <vocoder/g723_40_decode_bs.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +namespace gr { + namespace vocoder { + + class g723_40_decode_bs_impl : public g723_40_decode_bs + { + private: + g72x_state d_state; + + public: + g723_40_decode_bs_impl(); + ~g723_40_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_G723_40_DECODE_BS_IMPL_H */ diff --git a/gr-vocoder/lib/g723_40_encode_sb_impl.cc b/gr-vocoder/lib/g723_40_encode_sb_impl.cc new file mode 100644 index 0000000000..54dd052637 --- /dev/null +++ b/gr-vocoder/lib/g723_40_encode_sb_impl.cc @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "g723_40_encode_sb_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + + g723_40_encode_sb::sptr + g723_40_encode_sb::make() + { + return gnuradio::get_initial_sptr + (new g723_40_encode_sb_impl()); + } + + g723_40_encode_sb_impl::g723_40_encode_sb_impl() + : gr_sync_block("vocoder_g723_40_encode_sb", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(unsigned char))) + { + g72x_init_state(&d_state); + } + + g723_40_encode_sb_impl::~g723_40_encode_sb_impl() + { + } + + int + g723_40_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_40_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/g723_40_encode_sb_impl.h b/gr-vocoder/lib/g723_40_encode_sb_impl.h new file mode 100644 index 0000000000..a4093e1fc7 --- /dev/null +++ b/gr-vocoder/lib/g723_40_encode_sb_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_G723_40_ENCODE_SB_IMPL_H +#define INCLUDED_VOCODER_G723_40_ENCODE_SB_IMPL_H + +#include <vocoder/g723_40_encode_sb.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +namespace gr { + namespace vocoder { + + class g723_40_encode_sb_impl : public g723_40_encode_sb + { + private: + g72x_state d_state; + + public: + g723_40_encode_sb_impl(); + ~g723_40_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_G723_40_ENCODE_SB_IMPL_H */ diff --git a/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc b/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc new file mode 100644 index 0000000000..2b3d11135c --- /dev/null +++ b/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc @@ -0,0 +1,77 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gsm_fr_decode_ps_impl.h" +#include <gr_io_signature.h> +#include <stdexcept> +#include <assert.h> + +namespace gr { + namespace vocoder { + + gsm_fr_decode_ps::sptr + gsm_fr_decode_ps::make() + { + return gnuradio::get_initial_sptr + (new gsm_fr_decode_ps_impl()); + } + + gsm_fr_decode_ps_impl::gsm_fr_decode_ps_impl() + : gr_sync_interpolator("vocoder_gsm_fr_decode_ps", + gr_make_io_signature(1, 1, sizeof(gsm_frame)), + gr_make_io_signature(1, 1, sizeof(short)), + GSM_SAMPLES_PER_FRAME) + { + if((d_gsm = gsm_create()) == 0) + throw std::runtime_error("gsm_fr_decode_ps_impl: gsm_create failed"); + } + + gsm_fr_decode_ps_impl::~gsm_fr_decode_ps_impl() + { + gsm_destroy(d_gsm); + } + + int + gsm_fr_decode_ps_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short*)output_items[0]; + + assert((noutput_items % GSM_SAMPLES_PER_FRAME) == 0); + + for(int i = 0; i < noutput_items; i += GSM_SAMPLES_PER_FRAME) { + gsm_decode(d_gsm, const_cast<unsigned char*>(in), out); + in += sizeof(gsm_frame); + out += GSM_SAMPLES_PER_FRAME; + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/gsm_fr_decode_ps_impl.h b/gr-vocoder/lib/gsm_fr_decode_ps_impl.h new file mode 100644 index 0000000000..3c1bb351d6 --- /dev/null +++ b/gr-vocoder/lib/gsm_fr_decode_ps_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_GSM_FR_DECODE_PS_IMPL_H +#define INCLUDED_VOCODER_GSM_FR_DECODE_PS_IMPL_H + +#include <vocoder/gsm_fr_decode_ps.h> + +extern "C"{ +#include "gsm/gsm.h" +} + +namespace gr { + namespace vocoder { + + class gsm_fr_decode_ps_impl : public gsm_fr_decode_ps + { + private: + struct gsm_state *d_gsm; + + public: + gsm_fr_decode_ps_impl(); + ~gsm_fr_decode_ps_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_GSM_FR_DECODE_PS_IMPL_H */ diff --git a/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc b/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc new file mode 100644 index 0000000000..c7b10089fb --- /dev/null +++ b/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc @@ -0,0 +1,74 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gsm_fr_encode_sp_impl.h" +#include <gr_io_signature.h> +#include <stdexcept> + +namespace gr { + namespace vocoder { + + gsm_fr_encode_sp::sptr + gsm_fr_encode_sp::make() + { + return gnuradio::get_initial_sptr + (new gsm_fr_encode_sp_impl()); + } + + gsm_fr_encode_sp_impl::gsm_fr_encode_sp_impl() + : gr_sync_decimator("vocoder_gsm_fr_encode_sp", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(gsm_frame)), + GSM_SAMPLES_PER_FRAME) + { + if((d_gsm = gsm_create ()) == 0) + throw std::runtime_error("gsm_fr_encode_sp_impl: gsm_create failed"); + } + + gsm_fr_encode_sp_impl::~gsm_fr_encode_sp_impl() + { + gsm_destroy (d_gsm); + } + + int + gsm_fr_encode_sp_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + gsm_encode(d_gsm, const_cast<short*>(in), out); + in += GSM_SAMPLES_PER_FRAME; + out += sizeof(gsm_frame); + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/gsm_fr_encode_sp_impl.h b/gr-vocoder/lib/gsm_fr_encode_sp_impl.h new file mode 100644 index 0000000000..a5501deaae --- /dev/null +++ b/gr-vocoder/lib/gsm_fr_encode_sp_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_GSM_FR_ENCODE_SP_IMPL_H +#define INCLUDED_VOCODER_GSM_FR_ENCODE_SP_IMPL_H + +#include <vocoder/gsm_fr_encode_sp.h> + +extern "C"{ +#include "gsm/gsm.h" +} + +namespace gr { + namespace vocoder { + + class gsm_fr_encode_sp_impl : public gsm_fr_encode_sp + { + private: + struct gsm_state *d_gsm; + + public: + gsm_fr_encode_sp_impl(); + ~gsm_fr_encode_sp_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_GSM_FR_ENCODE_SP_IMPL_H */ diff --git a/gr-vocoder/lib/ulaw_decode_bs_impl.cc b/gr-vocoder/lib/ulaw_decode_bs_impl.cc new file mode 100644 index 0000000000..d0c99b70a0 --- /dev/null +++ b/gr-vocoder/lib/ulaw_decode_bs_impl.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ulaw_decode_bs_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + +extern "C" { +#include "g7xx/g72x.h" +} + + ulaw_decode_bs::sptr + ulaw_decode_bs::make() + { + return gnuradio::get_initial_sptr + (new ulaw_decode_bs_impl()); + } + + ulaw_decode_bs_impl::ulaw_decode_bs_impl() + : gr_sync_block("vocoder_ulaw_decode_bs", + gr_make_io_signature(1, 1, sizeof(unsigned char)), + gr_make_io_signature(1, 1, sizeof(short))) + { + } + + ulaw_decode_bs_impl::~ulaw_decode_bs_impl() + { + } + + int + ulaw_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (const unsigned char*)input_items[0]; + short *out = (short*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + out[i] = ulaw2linear(in[i]); + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/swig/vocoder_g723_24_encode_sb.i b/gr-vocoder/lib/ulaw_decode_bs_impl.h index a362554abb..db7a0dcab9 100644 --- a/gr-vocoder/swig/vocoder_g723_24_encode_sb.i +++ b/gr-vocoder/lib/ulaw_decode_bs_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,14 +20,26 @@ * Boston, MA 02110-1301, USA. */ -%{ -#include "vocoder_g723_24_encode_sb.h" -%} +#ifndef INCLUDED_VOCODER_ULAW_DECODE_BS_IMPL_H +#define INCLUDED_VOCODER_ULAW_DECODE_BS_IMPL_H -GR_SWIG_BLOCK_MAGIC(vocoder,g723_24_encode_sb); +#include <vocoder/ulaw_decode_bs.h> -vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb(); +namespace gr { + namespace vocoder { -class vocoder_g723_24_encode_sb : public gr_sync_block -{ -}; + class ulaw_decode_bs_impl : public ulaw_decode_bs + { + public: + ulaw_decode_bs_impl(); + ~ulaw_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_ULAW_DECODE_BS_IMPL_H */ diff --git a/gr-vocoder/lib/ulaw_encode_sb_impl.cc b/gr-vocoder/lib/ulaw_encode_sb_impl.cc new file mode 100644 index 0000000000..a49df12b59 --- /dev/null +++ b/gr-vocoder/lib/ulaw_encode_sb_impl.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ulaw_encode_sb_impl.h" +#include <gr_io_signature.h> +#include <limits.h> + +namespace gr { + namespace vocoder { + +extern "C" { +#include "g7xx/g72x.h" +} + + ulaw_encode_sb::sptr + ulaw_encode_sb::make() + { + return gnuradio::get_initial_sptr + (new ulaw_encode_sb_impl()); + } + + ulaw_encode_sb_impl::ulaw_encode_sb_impl() + : gr_sync_block("vocoder_ulaw_encode_sb", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(1, 1, sizeof(unsigned char))) + { + } + + ulaw_encode_sb_impl::~ulaw_encode_sb_impl() + { + } + + int + ulaw_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *in = (const short*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + out[i] = linear2ulaw(in[i]); + } + + return noutput_items; + } + + } /* namespace vocoder */ +} /* namespace gr */ diff --git a/gr-vocoder/lib/ulaw_encode_sb_impl.h b/gr-vocoder/lib/ulaw_encode_sb_impl.h new file mode 100644 index 0000000000..2ce207fbf8 --- /dev/null +++ b/gr-vocoder/lib/ulaw_encode_sb_impl.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 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. + */ + +#ifndef INCLUDED_VOCODER_ULAW_ENCODER_SB_IMPL_H +#define INCLUDED_VOCODER_ULAW_ENCODER_SB_IMPL_H + +#include <vocoder/ulaw_encode_sb.h> + +namespace gr { + namespace vocoder { + + class ulaw_encode_sb_impl : public ulaw_encode_sb + { + public: + ulaw_encode_sb_impl(); + ~ulaw_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace vocoder */ +} /* namespace gr */ + +#endif /* INCLUDED_VOCODER_ULAW_ENCODE_SB_IMPL_H */ diff --git a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc deleted file mode 100644 index 33c119e05f..0000000000 --- a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_alaw_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_alaw_decode_bs()); -} - -vocoder_alaw_decode_bs::vocoder_alaw_decode_bs() - : gr_sync_block("vocoder_alaw_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ -} - -vocoder_alaw_decode_bs::~vocoder_alaw_decode_bs() -{ -} - - - -int -vocoder_alaw_decode_bs::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = alaw2linear(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc deleted file mode 100644 index ebb953c341..0000000000 --- a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_alaw_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_alaw_encode_sb()); -} - -vocoder_alaw_encode_sb::vocoder_alaw_encode_sb() - : gr_sync_block("vocoder_alaw_encode_sb", - gr_make_io_signature (1, 1, sizeof(short)), - gr_make_io_signature (1, 1, sizeof(unsigned char))) -{ -} - -vocoder_alaw_encode_sb::~vocoder_alaw_encode_sb() -{ -} - -int -vocoder_alaw_encode_sb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = linear2alaw(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc b/gr-vocoder/lib/vocoder_codec2_decode_ps.cc deleted file mode 100644 index 8e95c75dd1..0000000000 --- a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "vocoder_codec2_decode_ps.h" - -extern "C" { -#include "codec2/codec2.h" -} - -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> - -vocoder_codec2_decode_ps_sptr -vocoder_make_codec2_decode_ps () -{ - return gnuradio::get_initial_sptr(new vocoder_codec2_decode_ps ()); -} - -vocoder_codec2_decode_ps::vocoder_codec2_decode_ps () - : gr_sync_interpolator ("vocoder_codec2_decode_ps", - gr_make_io_signature (1, 1, CODEC2_BITS_PER_FRAME * sizeof (char)), - gr_make_io_signature (1, 1, sizeof (short)), - CODEC2_SAMPLES_PER_FRAME) -{ - if ((d_codec2 = codec2_create ()) == 0) - throw std::runtime_error ("vocoder_codec2_decode_ps: codec2_create failed"); -} - -vocoder_codec2_decode_ps::~vocoder_codec2_decode_ps () -{ - codec2_destroy(d_codec2); -} - -int -vocoder_codec2_decode_ps::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - short *out = (short *) output_items[0]; - - assert ((noutput_items % CODEC2_SAMPLES_PER_FRAME) == 0); - - for (int i = 0; i < noutput_items; i += CODEC2_SAMPLES_PER_FRAME){ - codec2_decode (d_codec2, out, const_cast<unsigned char*>(in)); - in += CODEC2_BITS_PER_FRAME * sizeof (char); - out += CODEC2_SAMPLES_PER_FRAME; - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc b/gr-vocoder/lib/vocoder_codec2_encode_sp.cc deleted file mode 100644 index da1c59c436..0000000000 --- a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "vocoder_codec2_encode_sp.h" - -extern "C" { -#include "codec2/codec2.h" -} - -#include <gr_io_signature.h> -#include <stdexcept> - -vocoder_codec2_encode_sp_sptr -vocoder_make_codec2_encode_sp () -{ - return gnuradio::get_initial_sptr(new vocoder_codec2_encode_sp ()); -} - -vocoder_codec2_encode_sp::vocoder_codec2_encode_sp () - : gr_sync_decimator ("vocoder_codec2_encode_sp", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, CODEC2_BITS_PER_FRAME * sizeof (char)), - CODEC2_SAMPLES_PER_FRAME) -{ - if ((d_codec2 = codec2_create ()) == 0) - throw std::runtime_error ("vocoder_codec2_encode_sp: codec2_create failed"); -} - -vocoder_codec2_encode_sp::~vocoder_codec2_encode_sp () -{ - codec2_destroy(d_codec2); -} - -int -vocoder_codec2_encode_sp::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - codec2_encode (d_codec2, out, const_cast<short*>(in)); - in += CODEC2_SAMPLES_PER_FRAME; - out += CODEC2_BITS_PER_FRAME * sizeof (char); - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc b/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc deleted file mode 100644 index 8202ec36ca..0000000000 --- a/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,2011 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. - */ - -/* - * config.h is generated by configure. It contains the results - * of probing for features, options etc. It should be the first - * file included in your .cc file. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_cvsd_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -/* - * Create a new instance of vocoder_cvsd_decode_bs and return - * a boost shared_ptr. This is effectively the public constructor. - */ -vocoder_cvsd_decode_bs_sptr -vocoder_make_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) -{ - return gnuradio::get_initial_sptr(new vocoder_cvsd_decode_bs (min_step, max_step, - step_decay, accum_decay, K, J, - pos_accum_max, neg_accum_max)); -} - -vocoder_cvsd_decode_bs::vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) - : gr_sync_interpolator ("vocoder_cvsd_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short)), - 8), - d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay), - d_accum_decay(accum_decay), d_K(K), d_J(J), - d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max), - d_accum(0), - d_loop_counter(1), - d_runner(0), - d_runner_mask(0), - d_stepsize(min_step) - -{ - assert(d_K <= 32); - assert(d_J <= d_K); -} - - -vocoder_cvsd_decode_bs::~vocoder_cvsd_decode_bs () -{ - // nothing else required in this example -} - -unsigned char vocoder_cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input) -{ - unsigned int temp=input; - unsigned char bits=0; - - while(temp) { - temp=temp&(temp-1); - bits++; - } - return bits; -} - -int vocoder_cvsd_decode_bs::cvsd_round (double input) -{ - double temp; - temp=input+0.5; - temp=floor(temp); - - return (int)temp; -} - -unsigned int vocoder_cvsd_decode_bs::cvsd_pow (short radix, short power) -{ - double d_radix = (double) radix; - int i_power = (int) power; - double output; - - output=pow(d_radix,i_power); - return ( (unsigned int) cvsd_round(output)); -} - - -int -vocoder_cvsd_decode_bs::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - - const unsigned char *in = (const unsigned char *) input_items[0]; - short *out = (short *) output_items[0]; - - int i=0; - short output_short=0; // 2 bytes 0 .. 65,535 - unsigned char bit_count=0; // 1 byte, 0 .. 255 - unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295 - unsigned char input_byte=0; // 1 bytes - unsigned char input_bit=0; // 1 byte, 0 .. 255 - - // Loop through each input data point - for(i = 0; i < noutput_items/8.0; i++) { - - input_byte = in[i]; - // Initiliaze bit counter - bit_count=0; - - while(bit_count<8) { - // Compute the Appropriate Mask - mask=cvsd_pow(2,7-bit_count); - - // Pull off the corresponding bit - input_bit = input_byte & mask; - - // Update the bit counter - bit_count++; - - // Update runner with the next input bit - // Runner is a shift-register; shift left, add on newest output bit - d_runner = (d_runner<<1) | ((unsigned int) input_bit); - - // Run this only if you have >= J bits in your shift register - if (d_loop_counter>=d_J) { - // Update Step Size - d_runner_mask=(cvsd_pow(2,d_J)-1); - if ((cvsd_bitwise_sum(d_runner & d_runner_mask)>=d_J)||(cvsd_bitwise_sum((~d_runner) & d_runner_mask)>=d_J)) { - // Runs of 1s and 0s - d_stepsize = std::min( (short) (d_stepsize + d_min_step), d_max_step); - } - else { - // No runs of 1s and 0s - d_stepsize = std::max( (short) cvsd_round(d_stepsize*d_step_decay), d_min_step); - } - } - - // Update Accum (i.e. the reference value) - if (input_bit) { - d_accum=d_accum+d_stepsize; - } - else { - d_accum=d_accum-d_stepsize; - } - - // Multiply by Accum_Decay - d_accum=(cvsd_round(d_accum*d_accum_decay)); - - // Check for overflow - if (d_accum >=((int) d_pos_accum_max)) { - d_accum=(int)d_pos_accum_max; - } - else if (d_accum <=((int) d_neg_accum_max)) { - d_accum=(int)d_neg_accum_max; - } - - // Find the output short to write to the file - output_short=((short) d_accum); - - if (d_loop_counter <= d_K) { - d_loop_counter++; - } - - *(out++) = output_short; - } // while () - - } // for() - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc b/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc deleted file mode 100644 index e15882c227..0000000000 --- a/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,2011 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. - */ - -/* - * config.h is generated by configure. It contains the results - * of probing for features, options etc. It should be the first - * file included in your .cc file. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_cvsd_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -/* - * Create a new instance of vocoder_cvsd_encode_sb and return - * a boost shared_ptr. This is effectively the public constructor. - */ -vocoder_cvsd_encode_sb_sptr -vocoder_make_cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) -{ - return gnuradio::get_initial_sptr(new vocoder_cvsd_encode_sb (min_step, max_step, - step_decay, accum_decay, K, J, - pos_accum_max, neg_accum_max)); -} - -vocoder_cvsd_encode_sb::vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) - : gr_sync_decimator ("vocoder_cvsd_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char)), - 8), - d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay), - d_accum_decay(accum_decay), d_K(K), d_J(J), - d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max), - d_accum(0), - d_loop_counter(1), - d_runner(0), - d_stepsize(min_step) - -{ - assert(d_K <= 32); - assert(d_J <= d_K); -} - - -vocoder_cvsd_encode_sb::~vocoder_cvsd_encode_sb () -{ - // nothing else required in this example -} - -unsigned char vocoder_cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input) -{ - unsigned int temp=input; - unsigned char bits=0; - - while(temp) { - temp=temp&(temp-1); - bits++; - } - return bits; -} - -int vocoder_cvsd_encode_sb::cvsd_round (double input) -{ - double temp; - temp=input+0.5; - temp=floor(temp); - - return (int)temp; -} - -unsigned int vocoder_cvsd_encode_sb::cvsd_pow (short radix, short power) -{ - double d_radix = (double) radix; - int i_power = (int) power; - double output; - - output=pow(d_radix,i_power); - return ( (unsigned int) cvsd_round(output)); -} - -int -vocoder_cvsd_encode_sb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - unsigned short i=0; // 2 bytes, 0 .. 65,535 - unsigned char output_bit=0; // 1 byte, 0 .. 255 - unsigned char output_byte=0; // 1 bytes 0.255 - unsigned char bit_count=0; // 1 byte, 0 .. 255 - unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295 - - // Loop through each input data point - for(i = 0; i < noutput_items*8; i++) { - if((int)in[i] >= d_accum) { // Note: sign((data(n)-accum)) - output_bit=1; - } - else { - output_bit=0; - } - - // Update Accum (i.e. the reference value) - if (output_bit) { - d_accum=d_accum+d_stepsize; - //printf("Addding %d to the accum; the result is: %d.\n", d_stepsize, d_accum); - } - else { - d_accum=d_accum-d_stepsize; - //printf("Subtracting %d to the accum; the result is: %d.\n", d_stepsize, d_accum); - } - - // Multiply by Accum_Decay - d_accum=(cvsd_round(d_accum*d_accum_decay)); - - // Check for overflow - if (d_accum >= ((int)d_pos_accum_max)) { - d_accum = (int)d_pos_accum_max; - } - else if(d_accum <= ((int) d_neg_accum_max)) { - d_accum = (int) d_neg_accum_max; - } - - // Update runner with the last output bit - // Update Step Size - if (d_loop_counter >= d_J) { // Run this only if you have >= J bits in your shift register - mask=(cvsd_pow(2, d_J) - 1); - if ((cvsd_bitwise_sum(d_runner & mask) >= d_J) || (cvsd_bitwise_sum((~d_runner) & mask) >= d_J)) { - // Runs of 1s and 0s - d_stepsize = std::min( (short)(d_stepsize + d_min_step), d_max_step); - } - else { - // No runs of 1s and 0s - d_stepsize = std::max( (short)cvsd_round(d_stepsize*d_step_decay), d_min_step); - } - } - - // Runner is a shift-register; shift left, add on newest output bit - d_runner = (d_runner<<1) | ((unsigned int) output_bit); - - // Update the ouput type; shift left, add on newest output bit - // If you have put in 8 bits, output it as a byte - output_byte = (output_byte<<1) | output_bit; - bit_count++; - - if (d_loop_counter <= d_K) { - d_loop_counter++; - } - - // If you have put 8 bits, output and clear. - if (bit_count==8) { - // Read in short from the file - *(out++) = output_byte; - - // Reset the bit_count - bit_count=0; - output_byte=0; - } - } // While - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g721_decode_bs.cc b/gr-vocoder/lib/vocoder_g721_decode_bs.cc deleted file mode 100644 index d5b737d1ce..0000000000 --- a/gr-vocoder/lib/vocoder_g721_decode_bs.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_g721_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g721_decode_bs_impl : public vocoder_g721_decode_bs -{ -public: - - vocoder_g721_decode_bs_impl(); - ~vocoder_g721_decode_bs_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_g721_decode_bs_impl()); -} - -vocoder_g721_decode_bs_impl::vocoder_g721_decode_bs_impl() - : gr_sync_block("vocoder_g721_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ - g72x_init_state(&d_state); -} - -vocoder_g721_decode_bs_impl::~vocoder_g721_decode_bs_impl() -{ -} - -int -vocoder_g721_decode_bs_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g721_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g721_encode_sb.cc b/gr-vocoder/lib/vocoder_g721_encode_sb.cc deleted file mode 100644 index 1e33613a58..0000000000 --- a/gr-vocoder/lib/vocoder_g721_encode_sb.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_g721_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g721_encode_sb_impl : public vocoder_g721_encode_sb -{ -public: - - vocoder_g721_encode_sb_impl(); - ~vocoder_g721_encode_sb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_g721_encode_sb_impl()); -} - -vocoder_g721_encode_sb_impl::vocoder_g721_encode_sb_impl() - : gr_sync_block("vocoder_g721_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - g72x_init_state(&d_state); -} - -vocoder_g721_encode_sb_impl::~vocoder_g721_encode_sb_impl() -{ -} - -int -vocoder_g721_encode_sb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g721_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc deleted file mode 100644 index 0bedfe4ca1..0000000000 --- a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_g723_24_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_24_decode_bs_impl : public vocoder_g723_24_decode_bs -{ -public: - - vocoder_g723_24_decode_bs_impl(); - ~vocoder_g723_24_decode_bs_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_24_decode_bs_impl()); -} - -vocoder_g723_24_decode_bs_impl::vocoder_g723_24_decode_bs_impl() - : gr_sync_block("vocoder_g723_24_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_24_decode_bs_impl::~vocoder_g723_24_decode_bs_impl() -{ -} - -int -vocoder_g723_24_decode_bs_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_24_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc deleted file mode 100644 index 1b61de79ff..0000000000 --- a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_g723_24_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_24_encode_sb_impl : public vocoder_g723_24_encode_sb -{ -public: - - vocoder_g723_24_encode_sb_impl(); - ~vocoder_g723_24_encode_sb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_24_encode_sb_impl()); -} - -vocoder_g723_24_encode_sb_impl::vocoder_g723_24_encode_sb_impl() - : gr_sync_block("vocoder_g723_24_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_24_encode_sb_impl::~vocoder_g723_24_encode_sb_impl() -{ -} - -int -vocoder_g723_24_encode_sb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_24_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc deleted file mode 100644 index cdc1528967..0000000000 --- a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_g723_40_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_40_decode_bs_impl : public vocoder_g723_40_decode_bs -{ -public: - - vocoder_g723_40_decode_bs_impl(); - ~vocoder_g723_40_decode_bs_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_40_decode_bs_impl()); -} - -vocoder_g723_40_decode_bs_impl::vocoder_g723_40_decode_bs_impl() - : gr_sync_block("vocoder_g723_40_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_40_decode_bs_impl::~vocoder_g723_40_decode_bs_impl() -{ -} - -int -vocoder_g723_40_decode_bs_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_40_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc deleted file mode 100644 index 083aaf97af..0000000000 --- a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_g723_40_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_40_encode_sb_impl : public vocoder_g723_40_encode_sb -{ -public: - - vocoder_g723_40_encode_sb_impl(); - ~vocoder_g723_40_encode_sb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_40_encode_sb_impl()); -} - -vocoder_g723_40_encode_sb_impl::vocoder_g723_40_encode_sb_impl() - : gr_sync_block("vocoder_g723_40_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_40_encode_sb_impl::~vocoder_g723_40_encode_sb_impl() -{ -} - -int -vocoder_g723_40_encode_sb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_40_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc b/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc deleted file mode 100644 index 146ddf63c8..0000000000 --- a/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "vocoder_gsm_fr_decode_ps.h" -extern "C"{ -#include "gsm/gsm.h" -} -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> - -vocoder_gsm_fr_decode_ps_sptr -vocoder_make_gsm_fr_decode_ps () -{ - return gnuradio::get_initial_sptr(new vocoder_gsm_fr_decode_ps ()); -} - -vocoder_gsm_fr_decode_ps::vocoder_gsm_fr_decode_ps () - : gr_sync_interpolator ("vocoder_gsm_fr_decode_ps", - gr_make_io_signature (1, 1, sizeof (gsm_frame)), - gr_make_io_signature (1, 1, sizeof (short)), - GSM_SAMPLES_PER_FRAME) -{ - if ((d_gsm = gsm_create ()) == 0) - throw std::runtime_error ("vocoder_gsm_fr_decode_ps: gsm_create failed"); -} - -vocoder_gsm_fr_decode_ps::~vocoder_gsm_fr_decode_ps () -{ - gsm_destroy (d_gsm); -} - -int -vocoder_gsm_fr_decode_ps::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - short *out = (short *) output_items[0]; - - assert ((noutput_items % GSM_SAMPLES_PER_FRAME) == 0); - - for (int i = 0; i < noutput_items; i += GSM_SAMPLES_PER_FRAME){ - gsm_decode (d_gsm, const_cast<unsigned char*>(in), out); - in += sizeof (gsm_frame); - out += GSM_SAMPLES_PER_FRAME; - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc b/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc deleted file mode 100644 index 5abb3a4576..0000000000 --- a/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "vocoder_gsm_fr_encode_sp.h" -extern "C"{ -#include "gsm/gsm.h" -} -#include <gr_io_signature.h> -#include <stdexcept> - -vocoder_gsm_fr_encode_sp_sptr -vocoder_make_gsm_fr_encode_sp () -{ - return gnuradio::get_initial_sptr(new vocoder_gsm_fr_encode_sp ()); -} - -vocoder_gsm_fr_encode_sp::vocoder_gsm_fr_encode_sp () - : gr_sync_decimator ("vocoder_gsm_fr_encode_sp", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (gsm_frame)), - GSM_SAMPLES_PER_FRAME) -{ - if ((d_gsm = gsm_create ()) == 0) - throw std::runtime_error ("vocoder_gsm_fr_encode_sp: gsm_create failed"); -} - -vocoder_gsm_fr_encode_sp::~vocoder_gsm_fr_encode_sp () -{ - gsm_destroy (d_gsm); -} - -int -vocoder_gsm_fr_encode_sp::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - gsm_encode (d_gsm, const_cast<short*>(in), out); - in += GSM_SAMPLES_PER_FRAME; - out += sizeof (gsm_frame); - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc deleted file mode 100644 index 5abec77f82..0000000000 --- a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_ulaw_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_ulaw_decode_bs()); -} - -vocoder_ulaw_decode_bs::vocoder_ulaw_decode_bs() - : gr_sync_block("vocoder_ulaw_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ -} - -vocoder_ulaw_decode_bs::~vocoder_ulaw_decode_bs() -{ -} - - - -int -vocoder_ulaw_decode_bs::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = ulaw2linear(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc deleted file mode 100644 index 3fabd7ad8a..0000000000 --- a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_ulaw_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_ulaw_encode_sb()); -} - -vocoder_ulaw_encode_sb::vocoder_ulaw_encode_sb() - : gr_sync_block("vocoder_ulaw_encode_sb", - gr_make_io_signature (1, 1, sizeof(short)), - gr_make_io_signature (1, 1, sizeof(unsigned char))) -{ -} - -vocoder_ulaw_encode_sb::~vocoder_ulaw_encode_sb() -{ -} - -int -vocoder_ulaw_encode_sb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = linear2ulaw(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt index 8417823c43..3a60cdf7bb 100644 --- a/gr-vocoder/swig/CMakeLists.txt +++ b/gr-vocoder/swig/CMakeLists.txt @@ -46,22 +46,6 @@ GR_SWIG_INSTALL( install( FILES vocoder_swig.i - vocoder_alaw_decode_bs.i - vocoder_alaw_encode_sb.i - vocoder_codec2_decode_ps.i - vocoder_codec2_encode_sp.i - vocoder_cvsd_decode_bs.i - vocoder_cvsd_encode_sb.i - vocoder_g721_decode_bs.i - vocoder_g721_encode_sb.i - vocoder_g723_24_decode_bs.i - vocoder_g723_24_encode_sb.i - vocoder_g723_40_decode_bs.i - vocoder_g723_40_encode_sb.i - vocoder_gsm_fr_encode_sp.i - vocoder_gsm_fr_decode_ps.i - vocoder_ulaw_decode_bs.i - vocoder_ulaw_encode_sb.i ${CMAKE_CURRENT_BINARY_DIR}/vocoder_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "vocoder_swig" diff --git a/gr-vocoder/swig/vocoder_alaw_decode_bs.i b/gr-vocoder/swig/vocoder_alaw_decode_bs.i deleted file mode 100644 index 6c51f5edd2..0000000000 --- a/gr-vocoder/swig/vocoder_alaw_decode_bs.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_alaw_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,alaw_decode_bs); - -vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); - -class vocoder_alaw_decode_bs : public gr_sync_block -{ -private: - vocoder_alaw_decode_bs(); -}; diff --git a/gr-vocoder/swig/vocoder_alaw_encode_sb.i b/gr-vocoder/swig/vocoder_alaw_encode_sb.i deleted file mode 100644 index 0769829a02..0000000000 --- a/gr-vocoder/swig/vocoder_alaw_encode_sb.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_alaw_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,alaw_encode_sb); - -vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); - -class vocoder_alaw_encode_sb : public gr_sync_block -{ -private: - vocoder_alaw_encode_sb(); -}; diff --git a/gr-vocoder/swig/vocoder_codec2_decode_ps.i b/gr-vocoder/swig/vocoder_codec2_decode_ps.i deleted file mode 100644 index a2035febef..0000000000 --- a/gr-vocoder/swig/vocoder_codec2_decode_ps.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_codec2_decode_ps.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,codec2_decode_ps); - -vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); - -class vocoder_codec2_decode_ps : public gr_sync_interpolator { -public: - ~vocoder_codec2_decode_ps (); -}; diff --git a/gr-vocoder/swig/vocoder_codec2_encode_sp.i b/gr-vocoder/swig/vocoder_codec2_encode_sp.i deleted file mode 100644 index 07acfdfa43..0000000000 --- a/gr-vocoder/swig/vocoder_codec2_encode_sp.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_codec2_encode_sp.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,codec2_encode_sp); - -vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); - -class vocoder_codec2_encode_sp : public gr_sync_decimator { -public: - ~vocoder_codec2_encode_sp (); -}; diff --git a/gr-vocoder/swig/vocoder_cvsd_decode_bs.i b/gr-vocoder/swig/vocoder_cvsd_decode_bs.i deleted file mode 100644 index ff2c89e5d7..0000000000 --- a/gr-vocoder/swig/vocoder_cvsd_decode_bs.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2011 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 "vocoder_cvsd_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,cvsd_decode_bs); - -vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -class vocoder_cvsd_decode_bs : public gr_sync_interpolator -{ -private: - vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); -}; diff --git a/gr-vocoder/swig/vocoder_cvsd_encode_sb.i b/gr-vocoder/swig/vocoder_cvsd_encode_sb.i deleted file mode 100644 index e0a7db5df2..0000000000 --- a/gr-vocoder/swig/vocoder_cvsd_encode_sb.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2011 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 "vocoder_cvsd_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,cvsd_encode_sb); - -vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -class vocoder_cvsd_encode_sb : public gr_sync_decimator -{ -private: - vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); -}; diff --git a/gr-vocoder/swig/vocoder_g721_decode_bs.i b/gr-vocoder/swig/vocoder_g721_decode_bs.i deleted file mode 100644 index beefd375e7..0000000000 --- a/gr-vocoder/swig/vocoder_g721_decode_bs.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_g721_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g721_decode_bs); - -vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs(); - -class vocoder_g721_decode_bs : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g721_encode_sb.i b/gr-vocoder/swig/vocoder_g721_encode_sb.i deleted file mode 100644 index 38c231e8d6..0000000000 --- a/gr-vocoder/swig/vocoder_g721_encode_sb.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_g721_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g721_encode_sb); - -vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb(); - -class vocoder_g721_encode_sb : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g723_40_decode_bs.i b/gr-vocoder/swig/vocoder_g723_40_decode_bs.i deleted file mode 100644 index a23b1c0e4e..0000000000 --- a/gr-vocoder/swig/vocoder_g723_40_decode_bs.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_g723_40_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g723_40_decode_bs); - -vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs(); - -class vocoder_g723_40_decode_bs : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g723_40_encode_sb.i b/gr-vocoder/swig/vocoder_g723_40_encode_sb.i deleted file mode 100644 index 8fd438c663..0000000000 --- a/gr-vocoder/swig/vocoder_g723_40_encode_sb.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_g723_40_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g723_40_encode_sb); - -vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb(); - -class vocoder_g723_40_encode_sb : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i b/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i deleted file mode 100644 index 3ad4e45fab..0000000000 --- a/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_gsm_fr_decode_ps.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,gsm_fr_decode_ps); - -vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps(); - -class vocoder_gsm_fr_decode_ps : public gr_sync_interpolator -{ -public: - ~vocoder_gsm_fr_decode_ps(); -}; diff --git a/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i b/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i deleted file mode 100644 index 348f8d15d6..0000000000 --- a/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_gsm_fr_encode_sp.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,gsm_fr_encode_sp); - -vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp(); - -class vocoder_gsm_fr_encode_sp : public gr_sync_decimator -{ -public: - ~vocoder_gsm_fr_encode_sp(); -}; diff --git a/gr-vocoder/swig/vocoder_swig.i b/gr-vocoder/swig/vocoder_swig.i index 524e035ce2..6c3f3fe422 100644 --- a/gr-vocoder/swig/vocoder_swig.i +++ b/gr-vocoder/swig/vocoder_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,24 +20,62 @@ * Boston, MA 02110-1301, USA. */ +#define VOCODER_API + %include "gnuradio.i" //load generated python docstrings %include "vocoder_swig_doc.i" -%include "vocoder_alaw_decode_bs.i" -%include "vocoder_alaw_encode_sb.i" -%include "vocoder_codec2_decode_ps.i" -%include "vocoder_codec2_encode_sp.i" -%include "vocoder_cvsd_decode_bs.i" -%include "vocoder_cvsd_encode_sb.i" -%include "vocoder_g721_decode_bs.i" -%include "vocoder_g721_encode_sb.i" -%include "vocoder_g723_24_decode_bs.i" -%include "vocoder_g723_24_encode_sb.i" -%include "vocoder_g723_40_decode_bs.i" -%include "vocoder_g723_40_encode_sb.i" -%include "vocoder_gsm_fr_decode_ps.i" -%include "vocoder_gsm_fr_encode_sp.i" -%include "vocoder_ulaw_decode_bs.i" -%include "vocoder_ulaw_encode_sb.i" +%{ +#include "vocoder/alaw_decode_bs.h" +#include "vocoder/alaw_encode_sb.h" +#include "vocoder/codec2_decode_ps.h" +#include "vocoder/codec2_encode_sp.h" +#include "vocoder/cvsd_decode_bs.h" +#include "vocoder/cvsd_encode_sb.h" +#include "vocoder/g721_decode_bs.h" +#include "vocoder/g721_encode_sb.h" +#include "vocoder/g723_24_decode_bs.h" +#include "vocoder/g723_24_encode_sb.h" +#include "vocoder/g723_40_decode_bs.h" +#include "vocoder/g723_40_encode_sb.h" +#include "vocoder/gsm_fr_decode_ps.h" +#include "vocoder/gsm_fr_encode_sp.h" +#include "vocoder/ulaw_decode_bs.h" +#include "vocoder/ulaw_encode_sb.h" +%} + +%include "vocoder/alaw_decode_bs.h" +%include "vocoder/alaw_encode_sb.h" +%include "vocoder/codec2_decode_ps.h" +%include "vocoder/codec2_encode_sp.h" +%include "vocoder/cvsd_decode_bs.h" +%include "vocoder/cvsd_encode_sb.h" +%include "vocoder/g721_decode_bs.h" +%include "vocoder/g721_encode_sb.h" +%include "vocoder/g723_24_decode_bs.h" +%include "vocoder/g723_24_encode_sb.h" +%include "vocoder/g723_40_decode_bs.h" +%include "vocoder/g723_40_encode_sb.h" +%include "vocoder/gsm_fr_decode_ps.h" +%include "vocoder/gsm_fr_encode_sp.h" +%include "vocoder/ulaw_decode_bs.h" +%include "vocoder/ulaw_encode_sb.h" + +GR_SWIG_BLOCK_MAGIC2(vocoder, alaw_decode_bs); +GR_SWIG_BLOCK_MAGIC2(vocoder, alaw_encode_sb); +GR_SWIG_BLOCK_MAGIC2(vocoder, codec2_decode_ps); +GR_SWIG_BLOCK_MAGIC2(vocoder, codec2_encode_sp); +GR_SWIG_BLOCK_MAGIC2(vocoder, cvsd_decode_bs); +GR_SWIG_BLOCK_MAGIC2(vocoder, cvsd_encode_sb); +GR_SWIG_BLOCK_MAGIC2(vocoder, g721_decode_bs); +GR_SWIG_BLOCK_MAGIC2(vocoder, g721_encode_sb); +GR_SWIG_BLOCK_MAGIC2(vocoder, g723_24_decode_bs); +GR_SWIG_BLOCK_MAGIC2(vocoder, g723_24_encode_sb); +GR_SWIG_BLOCK_MAGIC2(vocoder, g723_40_decode_bs); +GR_SWIG_BLOCK_MAGIC2(vocoder, g723_40_encode_sb); +GR_SWIG_BLOCK_MAGIC2(vocoder, gsm_fr_decode_ps); +GR_SWIG_BLOCK_MAGIC2(vocoder, gsm_fr_encode_sp); +GR_SWIG_BLOCK_MAGIC2(vocoder, ulaw_decode_bs); +GR_SWIG_BLOCK_MAGIC2(vocoder, ulaw_encode_sb); diff --git a/gr-vocoder/swig/vocoder_ulaw_decode_bs.i b/gr-vocoder/swig/vocoder_ulaw_decode_bs.i deleted file mode 100644 index 23363ca5c6..0000000000 --- a/gr-vocoder/swig/vocoder_ulaw_decode_bs.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_ulaw_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_decode_bs); - -vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); - -class vocoder_ulaw_decode_bs : public gr_sync_block -{ -private: - vocoder_ulaw_decode_bs(); -}; diff --git a/gr-vocoder/swig/vocoder_ulaw_encode_sb.i b/gr-vocoder/swig/vocoder_ulaw_encode_sb.i deleted file mode 100644 index 393b8ff3f0..0000000000 --- a/gr-vocoder/swig/vocoder_ulaw_encode_sb.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 "vocoder_ulaw_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_encode_sb); - -vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); - -class vocoder_ulaw_encode_sb : public gr_sync_block -{ -private: - vocoder_ulaw_encode_sb(); -}; |