FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Variables
qcelpdata.h File Reference

Data tables for the QCELP decoder. More...

#include <stddef.h>
#include <stdint.h>
#include "libavutil/common.h"

Go to the source code of this file.

Data Structures

struct  QCELPFrame
 QCELP unpacked data frame. More...
 
struct  QCELPBitmap
 

Macros

#define QCELP_OF(variable, bit, len)   {offsetof(QCELPFrame, variable), bit, len}
 
#define QCELP_SCALE   8192.
 the final gain scalefactor before clipping into a usable output float
 
#define QCELP_RATE_FULL_CODEBOOK_RATIO   .01
 
#define QCELP_RATE_HALF_CODEBOOK_RATIO   0.5
 
#define QCELP_SQRT1887   1.373681186
 sqrt(1.887) is the maximum of the pseudorandom white sequence used to generate the scaled codebook vector for bitrate 1/4.
 
#define QCELP_LSP_SPREAD_FACTOR   0.02
 This spread factor is used, for bitrate 1/8 and I_F_Q, to force the LSP frequencies to be at least 80 Hz apart.
 
#define QCELP_LSP_OCTAVE_PREDICTOR   29.0/32
 predictor coefficient for the conversion of LSP codes to LSP frequencies for 1/8 and I_F_Q
 
#define QCELP_BANDWIDTH_EXPANSION_COEFF   0.9883
 initial coefficient to perform bandwidth expansion on LPC
 

Typedefs

typedef uint16_t qcelp_vector [2]
 

Variables

static const float qcelp_hammsinc_table [4] = { -0.006822, 0.041249, -0.143459, 0.588863}
 pre-calculated table for hammsinc function Only half of the table is needed because of symmetry.
 
static const QCELPBitmap qcelp_rate_full_bitmap []
 bitmap unpacking tables for RATE_FULL
 
static const QCELPBitmap qcelp_rate_half_bitmap []
 bitmap unpacking tables for RATE_HALF
 
static const QCELPBitmap qcelp_rate_quarter_bitmap []
 bitmap unpacking tables for RATE_QUARTER
 
static const QCELPBitmap qcelp_rate_octave_bitmap []
 bitmap unpacking tables for RATE_OCTAVE
 
static const QCELPBitmap *const qcelp_unpacking_bitmaps_per_rate [5]
 position of the bitmapping data for each packet type in the QCELPContext
 
static const uint16_t qcelp_unpacking_bitmaps_lengths [5]
 
static const qcelp_vector qcelp_lspvq1 [64]
 LSP vector quantization tables in x*10000 form.
 
static const qcelp_vector qcelp_lspvq2 [128]
 
static const qcelp_vector qcelp_lspvq3 [128]
 
static const qcelp_vector qcelp_lspvq4 [64]
 
static const qcelp_vector qcelp_lspvq5 [64]
 
static const qcelp_vector *const qcelp_lspvq [5]
 
static const float qcelp_g12ga [61]
 table for computing Ga (decoded linear codebook gain magnitude)
 
static const int16_t qcelp_rate_full_codebook [128]
 circular codebook for rate 1 frames in x*100 form
 
static const int8_t qcelp_rate_half_codebook [128]
 circular codebook for rate 1/2 frames in x*2 form
 
static const double qcelp_rnd_fir_coefs [11]
 table for impulse response of BPF used to filter the white excitation for bitrate 1/4 synthesis
 

Detailed Description

Data tables for the QCELP decoder.

Author
Reynaldo H. Verdejo Pinochet
Remarks
FFmpeg merging spearheaded by Kenan Gillet
Development mentored by Benjamin Larson

Definition in file qcelpdata.h.

Macro Definition Documentation

#define QCELP_OF (   variable,
  bit,
  len 
)    {offsetof(QCELPFrame, variable), bit, len}

Definition at line 82 of file qcelpdata.h.

#define QCELP_SCALE   8192.

the final gain scalefactor before clipping into a usable output float

Definition at line 425 of file qcelpdata.h.

#define QCELP_RATE_FULL_CODEBOOK_RATIO   .01

Definition at line 477 of file qcelpdata.h.

Referenced by compute_svector().

#define QCELP_RATE_HALF_CODEBOOK_RATIO   0.5

Definition at line 502 of file qcelpdata.h.

Referenced by compute_svector().

#define QCELP_SQRT1887   1.373681186

sqrt(1.887) is the maximum of the pseudorandom white sequence used to generate the scaled codebook vector for bitrate 1/4.

TIA/EIA/IS-733 2.4.8.1.2

Definition at line 511 of file qcelpdata.h.

Referenced by compute_svector().

#define QCELP_LSP_SPREAD_FACTOR   0.02

This spread factor is used, for bitrate 1/8 and I_F_Q, to force the LSP frequencies to be at least 80 Hz apart.

TIA/EIA/IS-733 2.4.3.3.2

Definition at line 533 of file qcelpdata.h.

Referenced by decode_lspf().

#define QCELP_LSP_OCTAVE_PREDICTOR   29.0/32

predictor coefficient for the conversion of LSP codes to LSP frequencies for 1/8 and I_F_Q

TIA/EIA/IS-733 2.4.3.2.7-2

Definition at line 541 of file qcelpdata.h.

Referenced by decode_lspf().

#define QCELP_BANDWIDTH_EXPANSION_COEFF   0.9883

initial coefficient to perform bandwidth expansion on LPC

Note
: 0.9883 looks like an approximation of 253/256.

TIA/EIA/IS-733 2.4.3.3.6 6

Definition at line 550 of file qcelpdata.h.

Referenced by lspf2lpc().

Typedef Documentation

typedef uint16_t qcelp_vector[2]

Definition at line 284 of file qcelpdata.h.

Variable Documentation

const float qcelp_hammsinc_table[4] = { -0.006822, 0.041249, -0.143459, 0.588863}
static

pre-calculated table for hammsinc function Only half of the table is needed because of symmetry.

TIA/EIA/IS-733 2.4.5.2-2/3

Definition at line 74 of file qcelpdata.h.

Referenced by do_pitchfilter().

const QCELPBitmap qcelp_rate_full_bitmap[]
static

bitmap unpacking tables for RATE_FULL

TIA/EIA/IS-733 Table 2.4.7.1-1

Definition at line 89 of file qcelpdata.h.

const QCELPBitmap qcelp_rate_half_bitmap[]
static

bitmap unpacking tables for RATE_HALF

TIA/EIA/IS-733 Table 2.4.7.2-1

Definition at line 176 of file qcelpdata.h.

const QCELPBitmap qcelp_rate_quarter_bitmap[]
static
Initial value:
= {
QCELP_OF(lspv [2], 0, 3),
QCELP_OF(lspv [1], 0, 7),
QCELP_OF(lspv [0], 0, 6),
QCELP_OF(lspv [4], 0, 6),
QCELP_OF(lspv [3], 0, 6),
QCELP_OF(lspv [2], 3, 4),
QCELP_OF(cbgain[3], 0, 4),
QCELP_OF(cbgain[2], 0, 4),
QCELP_OF(cbgain[1], 0, 4),
QCELP_OF(cbgain[0], 0, 4),
QCELP_OF(reserved, 0, 2),
QCELP_OF(cbgain[4], 0, 4)
}

bitmap unpacking tables for RATE_QUARTER

TIA/EIA/IS-733 Table 2.4.7.3-1

Definition at line 218 of file qcelpdata.h.

const QCELPBitmap qcelp_rate_octave_bitmap[]
static
Initial value:
= {
QCELP_OF(cbsign[15], 3, 1),
QCELP_OF(lspv [0], 0, 1),
QCELP_OF(lspv [1], 0, 1),
QCELP_OF(lspv [2], 0, 1),
QCELP_OF(cbsign[15], 2, 1),
QCELP_OF(lspv [3], 0, 1),
QCELP_OF(lspv [4], 0, 1),
QCELP_OF(lspv [5], 0, 1),
QCELP_OF(cbsign[15], 1, 1),
QCELP_OF(lspv [6], 0, 1),
QCELP_OF(lspv [7], 0, 1),
QCELP_OF(lspv [8], 0, 1),
QCELP_OF(cbsign[15], 0, 1),
QCELP_OF(lspv [9], 0, 1),
QCELP_OF(cbgain [0], 0, 2),
QCELP_OF(reserved, 0, 4)
}

bitmap unpacking tables for RATE_OCTAVE

trick: CBSEED is written into QCELPContext.cbsign[15], which is not used for RATE_OCTAVE. CBSEED is only used to ensure the occurrence of random bit patterns in the 16 first bits that are used as the seed.

TIA/EIA/IS-733 Table 2.4.7.4-1

Definition at line 244 of file qcelpdata.h.

const QCELPBitmap* const qcelp_unpacking_bitmaps_per_rate[5]
static
Initial value:

position of the bitmapping data for each packet type in the QCELPContext

Definition at line 268 of file qcelpdata.h.

Referenced by qcelp_decode_frame().

const uint16_t qcelp_unpacking_bitmaps_lengths[5]
static
const qcelp_vector qcelp_lspvq1[64]
static
Initial value:
= {
{ 327, 118},{ 919, 111},{ 427, 440},{1327, 185},
{ 469, 50},{1272, 91},{ 892, 59},{1771, 193},
{ 222, 158},{1100, 127},{ 827, 55},{ 978, 791},
{ 665, 47},{ 700,1401},{ 670, 859},{1913,1048},
{ 471, 215},{1046, 125},{ 645, 298},{1599, 160},
{ 593, 39},{1187, 462},{ 749, 341},{1520, 511},
{ 290, 792},{ 909, 362},{ 753, 81},{1111,1058},
{ 519, 253},{ 828, 839},{ 685, 541},{1421,1258},
{ 386, 130},{ 962, 119},{ 542, 387},{1431, 185},
{ 526, 51},{1175, 260},{ 831, 167},{1728, 510},
{ 273, 437},{1172, 113},{ 771, 144},{1122, 751},
{ 619, 119},{ 492,1276},{ 658, 695},{1882, 615},
{ 415, 200},{1018, 88},{ 681, 339},{1436, 325},
{ 555, 122},{1042, 485},{ 826, 345},{1374, 743},
{ 383,1018},{1005, 358},{ 704, 86},{1301, 586},
{ 597, 241},{ 832, 621},{ 555, 573},{1504, 839}}

LSP vector quantization tables in x*10000 form.

TIA/EIA/IS-733 tables 2.4.3.2.6.3-1 through 2.4.3.2.6.3-5

Definition at line 292 of file qcelpdata.h.

const qcelp_vector qcelp_lspvq2[128]
static

Definition at line 310 of file qcelpdata.h.

const qcelp_vector qcelp_lspvq3[128]
static

Definition at line 344 of file qcelpdata.h.

const qcelp_vector qcelp_lspvq4[64]
static
Initial value:
= {
{ 348, 311},{ 812,1145},{ 552, 461},{1826, 263},
{ 601, 675},{1730, 172},{1523, 193},{2449, 277},
{ 334, 668},{ 805,1441},{1319, 207},{1684, 910},
{ 582,1318},{1403,1098},{ 979, 832},{2700,1359},
{ 624, 228},{1292, 979},{ 800, 195},{2226, 285},
{ 730, 862},{1537, 601},{1115, 509},{2720, 354},
{ 218,1167},{1212,1538},{1074, 247},{1674,1710},
{ 322,2142},{1263, 777},{ 981, 556},{2119,1710},
{ 193, 596},{1035, 957},{ 694, 397},{1997, 253},
{ 743, 603},{1584, 321},{1346, 346},{2221, 708},
{ 451, 732},{1040,1415},{1184, 230},{1853, 919},
{ 310,1661},{1625, 706},{ 856, 843},{2902, 702},
{ 467, 348},{1108,1048},{ 859, 306},{1964, 463},
{ 560,1013},{1425, 533},{1142, 634},{2391, 879},
{ 397,1084},{1345,1700},{ 976, 248},{1887,1189},
{ 644,2087},{1262, 603},{ 877, 550},{2203,1307}}

Definition at line 378 of file qcelpdata.h.

const qcelp_vector qcelp_lspvq5[64]
static
Initial value:
= {
{ 360, 222},{ 820,1097},{ 601, 319},{1656, 198},
{ 604, 513},{1552, 141},{1391, 155},{2474, 261},
{ 269, 785},{1463, 646},{1123, 191},{2015, 223},
{ 785, 844},{1202,1011},{ 980, 807},{3014, 793},
{ 570, 180},{1135,1382},{ 778, 256},{1901, 179},
{ 807, 622},{1461, 458},{1231, 178},{2028, 821},
{ 387, 927},{1496,1004},{ 888, 392},{2246, 341},
{ 295,1462},{1156, 694},{1022, 473},{2226,1364},
{ 210, 478},{1029,1020},{ 722, 181},{1730, 251},
{ 730, 488},{1465, 293},{1303, 326},{2595, 387},
{ 458, 584},{1569, 742},{1029, 173},{1910, 495},
{ 605,1159},{1268, 719},{ 973, 646},{2872, 428},
{ 443, 334},{ 835,1465},{ 912, 138},{1716, 442},
{ 620, 778},{1316, 450},{1186, 335},{1446,1665},
{ 486,1050},{1675,1019},{ 880, 278},{2214, 202},
{ 539,1564},{1142, 533},{ 984, 391},{2130,1089}}

Definition at line 396 of file qcelpdata.h.

const qcelp_vector* const qcelp_lspvq[5]
static
Initial value:

Definition at line 414 of file qcelpdata.h.

Referenced by decode_lspf().

const float qcelp_g12ga[61]
static
Initial value:
= {
1.000/QCELP_SCALE, 1.125/QCELP_SCALE, 1.250/QCELP_SCALE, 1.375/QCELP_SCALE,
1.625/QCELP_SCALE, 1.750/QCELP_SCALE, 2.000/QCELP_SCALE, 2.250/QCELP_SCALE,
2.500/QCELP_SCALE, 2.875/QCELP_SCALE, 3.125/QCELP_SCALE, 3.500/QCELP_SCALE,
4.000/QCELP_SCALE, 4.500/QCELP_SCALE, 5.000/QCELP_SCALE, 5.625/QCELP_SCALE,
6.250/QCELP_SCALE, 7.125/QCELP_SCALE, 8.000/QCELP_SCALE, 8.875/QCELP_SCALE,
10.000/QCELP_SCALE, 11.250/QCELP_SCALE, 12.625/QCELP_SCALE, 14.125/QCELP_SCALE,
15.875/QCELP_SCALE, 17.750/QCELP_SCALE, 20.000/QCELP_SCALE, 22.375/QCELP_SCALE,
25.125/QCELP_SCALE, 28.125/QCELP_SCALE, 31.625/QCELP_SCALE, 35.500/QCELP_SCALE,
39.750/QCELP_SCALE, 44.625/QCELP_SCALE, 50.125/QCELP_SCALE, 56.250/QCELP_SCALE,
63.125/QCELP_SCALE, 70.750/QCELP_SCALE, 79.375/QCELP_SCALE, 89.125/QCELP_SCALE,
100.000/QCELP_SCALE, 112.250/QCELP_SCALE, 125.875/QCELP_SCALE, 141.250/QCELP_SCALE,
158.500/QCELP_SCALE, 177.875/QCELP_SCALE, 199.500/QCELP_SCALE, 223.875/QCELP_SCALE,
251.250/QCELP_SCALE, 281.875/QCELP_SCALE, 316.250/QCELP_SCALE, 354.875/QCELP_SCALE,
398.125/QCELP_SCALE, 446.625/QCELP_SCALE, 501.125/QCELP_SCALE, 562.375/QCELP_SCALE,
631.000/QCELP_SCALE, 708.000/QCELP_SCALE, 794.375/QCELP_SCALE, 891.250/QCELP_SCALE,
1000.000/QCELP_SCALE}

table for computing Ga (decoded linear codebook gain magnitude)

Note
The table could fit in int16_t in x*8 form, but it seems to be slower on x86

TIA/EIA/IS-733 2.4.6.2.1-3

Definition at line 436 of file qcelpdata.h.

Referenced by decode_gain_and_index().

const int16_t qcelp_rate_full_codebook[128]
static
Initial value:
= {
10, -65, -59, 12, 110, 34, -134, 157,
104, -84, -34, -115, 23, -101, 3, 45,
-101, -16, -59, 28, -45, 134, -67, 22,
61, -29, 226, -26, -55, -179, 157, -51,
-220, -93, -37, 60, 118, 74, -48, -95,
-181, 111, 36, -52, -215, 78, -112, 39,
-17, -47, -223, 19, 12, -98, -142, 130,
54, -127, 21, -12, 39, -48, 12, 128,
6, -167, 82, -102, -79, 55, -44, 48,
-20, -53, 8, -61, 11, -70, -157, -168,
20, -56, -74, 78, 33, -63, -173, -2,
-75, -53, -146, 77, 66, -29, 9, -75,
65, 119, -43, 76, 233, 98, 125, -156,
-27, 78, -9, 170, 176, 143, -148, -7,
27, -136, 5, 27, 18, 139, 204, 7,
-184, -197, 52, -3, 78, -189, 8, -65
}

circular codebook for rate 1 frames in x*100 form

TIA/EIA/IS-733 2.4.6.1-2

Definition at line 459 of file qcelpdata.h.

Referenced by compute_svector().

const int8_t qcelp_rate_half_codebook[128]
static
Initial value:
= {
0, -4, 0, -3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, -3, -2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 5,
0, 0, 0, 0, 0, 0, 4, 0,
0, 3, 2, 0, 3, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 0,
-3, 3, 0, 0, -2, 0, 3, 0,
0, 0, 0, 0, 0, 0, -5, 0,
0, 0, 0, 3, 0, 0, 0, 3,
0, 0, 0, 0, 0, 0, 0, 4,
0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 6, -3, -4, 0, -3, -3,
3, -3, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
}

circular codebook for rate 1/2 frames in x*2 form

TIA/EIA/IS-733 2.4.6.1-1

Definition at line 484 of file qcelpdata.h.

Referenced by compute_svector().

const double qcelp_rnd_fir_coefs[11]
static
Initial value:
= {
-1.344519e-1, 1.735384e-2, -6.905826e-2, 2.434368e-2,
-8.210701e-2, 3.041388e-2, -9.251384e-2, 3.501983e-2,
-9.918777e-2, 3.749518e-2, 8.985137e-1
}

table for impulse response of BPF used to filter the white excitation for bitrate 1/4 synthesis

Only half the tables are needed because of symmetry.

TIA/EIA/IS-733 2.4.8.1.2-1.1

Definition at line 521 of file qcelpdata.h.

Referenced by compute_svector().