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