GNU Radio Manual and C++ API Reference
3.8.1.0
The Free & Open Software Radio Ecosystem
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/sync_interpolator.h
>
27
#include <
gnuradio/vocoder/api.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
*
79
* 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial,
80
* Available:
81
* http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF.
82
*
83
* 2. Specification of The Bluetooth System
84
* Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf.
85
*
86
* 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002.
87
* Bluetooth Voice Simulink Model, Available:
88
* http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html
89
*/
90
class
VOCODER_API
cvsd_decode_bs
:
virtual
public
sync_interpolator
91
{
92
public
:
93
// gr::vocoder::cvsd_decode_bs::sptr
94
typedef
boost::shared_ptr<cvsd_decode_bs>
sptr
;
95
96
/*!
97
* \brief Constructor parameters to initialize the CVSD decoder.
98
* The default values are modeled after the Bluetooth standard
99
* and should not be changed, except by an advanced user
100
*
101
* \param min_step Minimum step size used to update the internal reference.
102
* Default: "10"
103
* \param max_step Maximum step size used to update the internal reference.
104
* Default: "1280"
105
* \param step_decay Decay factor applied to step size when there is not a run of J
106
* output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024) \param accum_decay Decay
107
* factor applied to the internal reference during every iteration of the codec.
108
* Default: "0.96875" (i.e. 1-1/32)
109
* \param K Size of shift register; the number of output bits remembered
110
* by codec (must be <= to 32). Default: "32" \param J Number of bits in
111
* the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4"
112
* \param pos_accum_max Maximum integer value allowed for the internal reference.
113
* Default: "32767" (2^15 - 1 or MAXSHORT)
114
* \param neg_accum_max Minimum integer value allowed for the internal reference.
115
* Default: "-32767" (-2^15 + 1 or MINSHORT+1)
116
*/
117
static
sptr
make(
short
min_step = 10,
118
short
max_step = 1280,
119
double
step_decay = 0.9990234375,
120
double
accum_decay = 0.96875,
121
int
K = 32,
122
int
J = 4,
123
short
pos_accum_max = 32767,
124
short
neg_accum_max = -32767);
125
126
virtual
short
min_step() = 0;
127
virtual
short
max_step() = 0;
128
virtual
double
step_decay() = 0;
129
virtual
double
accum_decay() = 0;
130
virtual
int
K() = 0;
131
virtual
int
J() = 0;
132
virtual
short
pos_accum_max() = 0;
133
virtual
short
neg_accum_max() = 0;
134
};
135
136
}
/* namespace vocoder */
137
}
/* namespace gr */
138
139
#endif
/* INCLUDED_VOCODER_CVSD_DECODE_BS_H */
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:90
api.h
gr::sync_interpolator
synchronous 1:N input to output with history
Definition:
sync_interpolator.h:37
sync_interpolator.h
VOCODER_API
#define VOCODER_API
Definition:
gr-vocoder/include/gnuradio/vocoder/api.h:30
gr::vocoder::cvsd_decode_bs::sptr
boost::shared_ptr< cvsd_decode_bs > sptr
Definition:
cvsd_decode_bs.h:94
gr
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition:
basic_block.h:43
gr-vocoder
include
gnuradio
vocoder
cvsd_decode_bs.h
Generated by
1.8.16