#include <G726.h>
G726 replaces recomendations G721 and G723.
Note, this implemetation reproduces bugs found in the G191 reference implementation of G726. These bugs can be controlled by the IMPLEMENT_G191_BUGS macro.
2006-05-20
2007-01-13
Definition at line 62 of file G726.h.
Public Types | |
| enum | Law { uLaw = 0, ALaw = 1, PCM16 = 2 } |
| enum | Rate { Rate16kBits = 2, Rate24kBits = 3, Rate32kBits = 4, Rate40kBits = 5 } |
Public Member Functions | |
| G726 () | |
| IMPORT void | Reset () |
| IMPORT void | SetLaw (Law law) |
| IMPORT void | SetRate (Rate rate) |
| IMPORT unsigned | Encode (unsigned pcm) |
| IMPORT unsigned | Decode (unsigned adpcm) |
| IMPORT unsigned | Encode (void *dst, int dstOffset, const void *src, size_t srcSize) |
| IMPORT unsigned | Decode (void *dst, const void *src, int srcOffset, unsigned srcSize) |
Private Member Functions | |
| void | InputPCMFormatConversionAndDifferenceSignalComputation (unsigned S, int SE, int &D) |
| FIGURE 4/G.726 from Section 4.2.1 - Input PCM format conversion and difference signal computation. | |
| void | AdaptiveQuantizer (int D, unsigned Y, unsigned &I) |
| FIGURE 5/G.726 from Section 4.2.2 - Adaptive quantizer. | |
| void | InverseAdaptiveQuantizer (unsigned I, unsigned Y, unsigned &DQ) |
| FIGURE 6/G.726 from Section 4.2.3 - Inverse adaptive quantizer. | |
| void | QuantizerScaleFactorAdaptation1 (unsigned AL, unsigned &Y) |
| FIGURE 7/G.726 (Part 1) from Section 4.2.4 - Quantizer scale factor adaptation. | |
| void | QuantizerScaleFactorAdaptation2 (unsigned I, unsigned Y) |
| FIGURE 7/G.726 (Part 2) from Section 4.2.4 - Quantizer scale factor adaptation. | |
| void | AdaptationSpeedControl1 (unsigned &AL) |
| FIGURE 8/G.726 (Part 1) from Section 4.2.5 - Adaptation speed control. | |
| void | AdaptationSpeedControl2 (unsigned I, unsigned y, unsigned TDP, unsigned TR) |
| FIGURE 8/G.726 (Part 2) from Section 4.2.5 - Adaptation speed control. | |
| void | AdaptativePredictorAndReconstructedSignalCalculator1 (int &SE, int &SEZ) |
| FIGURE 9/G.726 (Part1) from Section 4.2.6 - Adaptative predictor and reconstructed signal calculator. | |
| void | AdaptativePredictorAndReconstructedSignalCalculator2 (unsigned DQ, unsigned TR, int SE, int SEZ, int &SR, int &A2P) |
| FIGURE 9/G.726 (Part2) from Section 4.2.6 - Adaptative predictor and reconstructed signal calculator. | |
| void | ToneAndTransitionDetector1 (unsigned DQ, unsigned &TR) |
| FIGURE 10/G.726 (Part 1) from Section 4.2.7 - Tone and transition detector. | |
| void | ToneAndTransitionDetector2 (int A2P, unsigned TR, unsigned &TDP) |
| FIGURE 10/G.726 (Part 2) from Section 4.2.7 - Tone and transition detector. | |
| void | OutputPCMFormatConversionAndSynchronousCodingAdjustment (int SR, int SE, unsigned Y, unsigned I, unsigned &SD) |
| FIGURE 11/G.726 from Section 4.2.8 - Output PCM format conversion and synchronous coding adjustment. | |
| void | DifferenceSignalComputation (int SL, int SE, int &D) |
| FIGURE A.4/G.726 from Section A.3.3 - Difference signal computation. | |
| void | OutputLimiting (int SR, int &S0) |
| FIGURE A.5/G.726 from Section A.3.5 - Output limiting (decoder only). | |
| unsigned | EncodeDecode (unsigned input, bool encode) |
| The top level method which implements the complete algorithm for both encoding and decoding. | |
Private Attributes | |
| Law | LAW |
| Rate | RATE |
| int | A1 |
| int | A2 |
| unsigned | AP |
| int | Bn [6] |
| unsigned | DML |
| unsigned | DMS |
| unsigned | DQn [6] |
| int | PK1 |
| int | PK2 |
| unsigned | SR1 |
| unsigned | SR2 |
| unsigned | TD |
| unsigned | YL |
| unsigned | YU |
Friends | |
| class | G726Test |
|
|
Enumeration used to specify the coding law used for encoder input and decoder output. |
|
|
Enumeration used to specify the ADPCM bit-rate. |
|
|
Contructor which initialises the object to the reset state.
|
|
|
Clears the internal state variables to their 'reset' values. Call this function before starting to decode/encode a new audio stream. |
|
|
Set the encoding law used for encoder input and decoder output.
|
|
|
Set the ADPCM bit-rate used for encoder output and decoder intput.
|
|
|
Encodes a single PCM value as an ADPCM value.
|
|
|
Decodes a single ADPCM value into a PCM value.
|
|
||||||||||||||||||||
|
Encode a buffer of uniform PCM values into ADPCM values. Each ADPCM value only occupies the minimum number of bits required and successive values occupy adjacent bit positions. E.g. Four 3 bit ADPCM values (A,B,C,D) are stored in two successive bytes like this: 1st byte: ccbbbaaa 2nd byte: ----dddc. Note that any unused bits in the last byte are set to zero.
|
|
||||||||||||||||||||
|
Decode a buffer of ADPCM values into uniform PCM values. Each ADPCM value only occupies the minimum number of bits required and successive values occupy adjacent bit positions. E.g. Four 3 bit ADPCM values (A,B,C,D) are stored in two successive bytes like this: 1st byte: ccbbbaaa 2nd byte: ----dddc.
|
|
||||||||||||
|
The top level method which implements the complete algorithm for both encoding and decoding.
|
1.4.4