Xeno-rat
|
SpanDSP - a series of DSP components for telephony. More...
Public Member Functions | |
int | Decode (G722CodecState state, short[] outputBuffer, byte[] inputG722Data, int inputLength) |
Decodes the input G722 data and returns the decoded output in the output buffer. | |
int | Encode (G722CodecState state, byte[] outputBuffer, short[] inputBuffer, int inputBufferCount) |
Encodes the input PCM samples using the G.722 algorithm and stores the result in the output buffer. | |
Static Private Member Functions | |
static short | Saturate (int amp) |
Converts an integer amplitude to a 16-bit signed integer, saturating the result if necessary. | |
static void | Block4 (G722CodecState s, int band, int d) |
Performs various operations related to G722 codec state for a specific band and input value. | |
Static Private Attributes | |
static readonly int[] | wl = { -60, -30, 58, 172, 334, 538, 1198, 3042 } |
static readonly int[] | rl42 = { 0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0 } |
static readonly int[] | ilb = { 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383, 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834, 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371, 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008 } |
static readonly int[] | wh = { 0, -214, 798 } |
static readonly int[] | rh2 = { 2, 1, 2, 1 } |
static readonly int[] | qm2 = { -7408, -1616, 7408, 1616 } |
static readonly int[] | qm4 = { 0, -20456, -12896, -8968, -6288, -4240, -2584, -1200, 20456, 12896, 8968, 6288, 4240, 2584, 1200, 0 } |
static readonly int[] | qm5 = { -280, -280, -23352, -17560, -14120, -11664, -9752, -8184, -6864, -5712, -4696, -3784, -2960, -2208, -1520, -880, 23352, 17560, 14120, 11664, 9752, 8184, 6864, 5712, 4696, 3784, 2960, 2208, 1520, 880, 280, -280 } |
static readonly int[] | qm6 = { -136, -136, -136, -136, -24808, -21904, -19008, -16704, -14984, -13512, -12280, -11192, -10232, -9360, -8576, -7856, -7192, -6576, -6000, -5456, -4944, -4464, -4008, -3576, -3168, -2776, -2400, -2032, -1688, -1360, -1040, -728, 24808, 21904, 19008, 16704, 14984, 13512, 12280, 11192, 10232, 9360, 8576, 7856, 7192, 6576, 6000, 5456, 4944, 4464, 4008, 3576, 3168, 2776, 2400, 2032, 1688, 1360, 1040, 728, 432, 136, -432, -136 } |
static readonly int[] | qmf_coeffs = { 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, } |
static readonly int[] | q6 = { 0, 35, 72, 110, 150, 190, 233, 276, 323, 370, 422, 473, 530, 587, 650, 714, 786, 858, 940, 1023, 1121, 1219, 1339, 1458, 1612, 1765, 1980, 2195, 2557, 2919, 0, 0 } |
static readonly int[] | iln = { 0, 63, 62, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 0 } |
static readonly int[] | ilp = { 0, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 0 } |
static readonly int[] | ihn = { 0, 1, 0 } |
static readonly int[] | ihp = { 0, 3, 2 } |
SpanDSP - a series of DSP components for telephony.
g722_decode.c - The ITU G.722 codec, decode part.
Written by Steve Underwood <steve.nosp@m.u@co.nosp@m.ppice.nosp@m..org>
Copyright (C) 2005 Steve Underwood Ported to C# by Mark Heath 2011
Despite my general liking of the GPL, I place my own contributions to this code in the public domain for the benefit of all mankind - even the slimy ones who might try to proprietize my work and use it to my detriment.
Based in part on a single channel G.722 codec which is: Copyright (c) CMU 1993 Computer Science, Speech Group Chengxiang Lu and Alex Hauptmann
|
inlinestaticprivate |
Performs various operations related to G722 codec state for a specific band and input value.
s | The G722 codec state. |
band | The specific band for which the operations are performed. |
d | The input value for the operations. |
This method performs multiple operations related to the G722 codec state for a specific band and input value. It includes operations such as RECONS, PARREC, UPPOL2, UPPOL1, UPZERO, DELAYA, FILTEP, FILTEZ, and PREDIC. The method modifies the G722 codec state s in place.
|
inline |
Decodes the input G722 data and returns the decoded output in the output buffer.
state | The G722 codec state. |
outputBuffer | The buffer to store the decoded output. |
inputG722Data | The input G722 data to be decoded. |
inputLength | The length of the input G722 data. |
This method decodes the input G722 data using the G722 codec state and stores the decoded output in the output buffer. It iterates through the input G722 data, unpacks the code bits, and performs decoding operations based on the bits per sample. The decoded output is stored in the output buffer, and the length of the decoded output is returned.
|
inline |
Encodes the input PCM samples using the G.722 algorithm and stores the result in the output buffer.
state | The G722CodecState object containing the codec state information. |
outputBuffer | The byte array to store the encoded output. |
inputBuffer | The short array containing the input PCM samples. |
inputBufferCount | The number of input PCM samples in the input buffer. |
This method encodes the input PCM samples using the G.722 algorithm. It processes the input samples, applies quantization, and packs the encoded bits into the output buffer. The encoding process involves various steps such as applying the QMF (Quadrature Mirror Filter), quantization, scaling, and packing the encoded bits. The method modifies the output buffer in place and returns the number of bytes written to the buffer.
|
inlinestaticprivate |
Converts an integer amplitude to a 16-bit signed integer, saturating the result if necessary.
amp | The integer amplitude to be converted. |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |