GNU Radio C++ API Reference: cvsd_decode_bs.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
cvsd_decode_bs.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2007,2011,2013 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_H
12#define INCLUDED_VOCODER_CVSD_DECODE_BS_H
13
14#include <gnuradio/sync_interpolator.h>
15#include <gnuradio/vocoder/api.h>
16
17namespace gr {
18namespace vocoder {
19
20/*!
21 * \brief This block performs CVSD audio decoding. Its design and
22 * implementation is modeled after the CVSD encoder/decoder
23 * specifications defined in the Bluetooth standard.
24 * \ingroup audio_blk
25 *
26 * \details
27 * CVSD is a method for encoding speech that seeks to reduce the
28 * bandwidth required for digital voice transmission. CVSD takes
29 * advantage of strong correlation between samples, quantizing the
30 * difference in amplitude between two consecutive samples. This
31 * difference requires fewer quantization levels as compared to
32 * other methods that quantize the actual amplitude level,
33 * reducing the bandwidth. CVSD employs a two level quantizer
34 * (one bit) and an adaptive algorithm that allows for continuous
35 * step size adjustment.
36 *
37 * The coder can represent low amplitude signals with accuracy
38 * without sacrificing performance on large amplitude signals, a
39 * trade off that occurs in some non-adaptive modulations.
40 *
41 * The CVSD decoder effectively provides 1-to-8 decompression.
42 * More specifically, for each incoming input bit, the decoder
43 * outputs one audio sample. If the input is a "1" bit, the
44 * internal reference is increased appropriately and then
45 * outputted as the next estimated audio sample. If the input is
46 * a "0" bit, the internal reference is decreased appropriately
47 * and then likewise outputted as the next estimated audio sample.
48 * Grouping 8 input bits together, the encoder essentially
49 * produces 8 output audio samples for everyone one input byte.
50 *
51 * This decoder requires that output audio samples are 2-byte
52 * short signed integers. The result bandwidth conversion,
53 * therefore, is 1 byte of encoded audio data to 16 output bytes
54 * of raw audio data.
55 *
56 * The CVSD decoder module must be post-fixed by a down-converter
57 * to under-sample the audio data after decoding. The Bluetooth
58 * standard specifically calls for a 8-to-1 decimating
59 * down-converter. This is required so that so that output
60 * sampling rate equals the original input sampling rate present
61 * before the encoder. In all cases, the output down-converter
62 * rate must be the inverse of the input up-converter rate before
63 * the CVSD encoder.
64 *
65 * References:
66 *
67 * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial,
68 * Available:
69 * http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF.
70 *
71 * 2. Specification of The Bluetooth System
72 * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf.
73 *
74 * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002.
75 * Bluetooth Voice Simulink Model, Available:
76 * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html
77 */
78 class VOCODER_API cvsd_decode_bs : virtual public sync_interpolator
79{
80public:
81 // gr::vocoder::cvsd_decode_bs::sptr
82 typedef std::shared_ptr<cvsd_decode_bs> sptr;
83
84 /*!
85 * \brief Constructor parameters to initialize the CVSD decoder.
86 * The default values are modeled after the Bluetooth standard
87 * and should not be changed, except by an advanced user
88 *
89 * \param min_step Minimum step size used to update the internal reference.
90 * Default: "10"
91 * \param max_step Maximum step size used to update the internal reference.
92 * Default: "1280"
93 * \param step_decay Decay factor applied to step size when there is not a run of J
94 * output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024) \param accum_decay Decay
95 * factor applied to the internal reference during every iteration of the codec.
96 * Default: "0.96875" (i.e. 1-1/32)
97 * \param K Size of shift register; the number of output bits remembered
98 * by codec (must be <= to 32). Default: "32" \param J Number of bits in
99 * the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4"
100 * \param pos_accum_max Maximum integer value allowed for the internal reference.
101 * Default: "32767" (2^15 - 1 or MAXSHORT)
102 * \param neg_accum_max Minimum integer value allowed for the internal reference.
103 * Default: "-32767" (-2^15 + 1 or MINSHORT+1)
104 */
105 static sptr make(short min_step = 10,
106 short max_step = 1280,
107 double step_decay = 0.9990234375,
108 double accum_decay = 0.96875,
109 int K = 32,
110 int J = 4,
111 short pos_accum_max = 32767,
112 short neg_accum_max = -32767);
113
114 virtual short min_step() = 0;
115 virtual short max_step() = 0;
116 virtual double step_decay() = 0;
117 virtual double accum_decay() = 0;
118 virtual int K() = 0;
119 virtual int J() = 0;
120 virtual short pos_accum_max() = 0;
121 virtual short neg_accum_max() = 0;
122};
123
124} /* namespace vocoder */
125} /* namespace gr */
126
127#endif /* INCLUDED_VOCODER_CVSD_DECODE_BS_H */
gr::sync_interpolator::sync_interpolator
sync_interpolator(void)
Definition sync_interpolator.h:31
gr::vocoder::cvsd_decode_bs
This block performs CVSD audio decoding. Its design and implementation is modeled after the CVSD enco...
Definition cvsd_decode_bs.h:79
gr::vocoder::cvsd_decode_bs::J
virtual int J()=0
gr::vocoder::cvsd_decode_bs::make
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)
Constructor parameters to initialize the CVSD decoder. The default values are modeled after the Bluet...
gr::vocoder::cvsd_decode_bs::min_step
virtual short min_step()=0
gr::vocoder::cvsd_decode_bs::step_decay
virtual double step_decay()=0
gr::vocoder::cvsd_decode_bs::pos_accum_max
virtual short pos_accum_max()=0
gr::vocoder::cvsd_decode_bs::accum_decay
virtual double accum_decay()=0
gr::vocoder::cvsd_decode_bs::sptr
std::shared_ptr< cvsd_decode_bs > sptr
Definition cvsd_decode_bs.h:82
gr::vocoder::cvsd_decode_bs::K
virtual int K()=0
gr::vocoder::cvsd_decode_bs::neg_accum_max
virtual short neg_accum_max()=0
gr::vocoder::cvsd_decode_bs::max_step
virtual short max_step()=0
api.h
VOCODER_API
#define VOCODER_API
Definition gr-vocoder/include/gnuradio/vocoder/api.h:18
gr::vocoder
Definition alaw_decode_bs.h:18
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
sync_interpolator.h