Xeno-rat
Loading...
Searching...
No Matches
NAudio.Codecs.G722Codec Class Reference

SpanDSP - a series of DSP components for telephony. More...

Collaboration diagram for NAudio.Codecs.G722Codec:

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 }
 

Detailed Description

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

Member Function Documentation

◆ Block4()

static void NAudio.Codecs.G722Codec.Block4 ( G722CodecState s,
int band,
int d )
inlinestaticprivate

Performs various operations related to G722 codec state for a specific band and input value.

Parameters
sThe G722 codec state.
bandThe specific band for which the operations are performed.
dThe 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Decode()

int NAudio.Codecs.G722Codec.Decode ( G722CodecState state,
short[] outputBuffer,
byte[] inputG722Data,
int inputLength )
inline

Decodes the input G722 data and returns the decoded output in the output buffer.

Parameters
stateThe G722 codec state.
outputBufferThe buffer to store the decoded output.
inputG722DataThe input G722 data to be decoded.
inputLengthThe length of the input G722 data.
Returns
The length of the decoded output.

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.

Here is the call graph for this function:

◆ Encode()

int NAudio.Codecs.G722Codec.Encode ( G722CodecState state,
byte[] outputBuffer,
short[] inputBuffer,
int inputBufferCount )
inline

Encodes the input PCM samples using the G.722 algorithm and stores the result in the output buffer.

Parameters
stateThe G722CodecState object containing the codec state information.
outputBufferThe byte array to store the encoded output.
inputBufferThe short array containing the input PCM samples.
inputBufferCountThe number of input PCM samples in the input buffer.
Returns
The number of bytes written to the output 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.

Here is the call graph for this function:

◆ Saturate()

static short NAudio.Codecs.G722Codec.Saturate ( int amp)
inlinestaticprivate

Converts an integer amplitude to a 16-bit signed integer, saturating the result if necessary.

Parameters
ampThe integer amplitude to be converted.
Returns
The 16-bit signed integer equivalent of amp . If amp is within the range of a 16-bit signed integer, the return value is equal to amp . If amp is greater than the maximum value of a 16-bit signed integer, the return value is Int16.MaxValue. If amp is less than the minimum value of a 16-bit signed integer, the return value is Int16.MinValue.
Here is the caller graph for this function:

Member Data Documentation

◆ ihn

readonly int [] NAudio.Codecs.G722Codec.ihn = { 0, 1, 0 }
staticprivate

◆ ihp

readonly int [] NAudio.Codecs.G722Codec.ihp = { 0, 3, 2 }
staticprivate

◆ ilb

readonly int [] NAudio.Codecs.G722Codec.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 }
staticprivate

◆ iln

readonly int [] NAudio.Codecs.G722Codec.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 }
staticprivate

◆ ilp

readonly int [] NAudio.Codecs.G722Codec.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 }
staticprivate

◆ q6

readonly int [] NAudio.Codecs.G722Codec.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 }
staticprivate

◆ qm2

readonly int [] NAudio.Codecs.G722Codec.qm2 = { -7408, -1616, 7408, 1616 }
staticprivate

◆ qm4

readonly int [] NAudio.Codecs.G722Codec.qm4 = { 0, -20456, -12896, -8968, -6288, -4240, -2584, -1200, 20456, 12896, 8968, 6288, 4240, 2584, 1200, 0 }
staticprivate

◆ qm5

readonly int [] NAudio.Codecs.G722Codec.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 }
staticprivate

◆ qm6

readonly int [] NAudio.Codecs.G722Codec.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 }
staticprivate

◆ qmf_coeffs

readonly int [] NAudio.Codecs.G722Codec.qmf_coeffs = { 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, }
staticprivate

◆ rh2

readonly int [] NAudio.Codecs.G722Codec.rh2 = { 2, 1, 2, 1 }
staticprivate

◆ rl42

readonly int [] NAudio.Codecs.G722Codec.rl42 = { 0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0 }
staticprivate

◆ wh

readonly int [] NAudio.Codecs.G722Codec.wh = { 0, -214, 798 }
staticprivate

◆ wl

readonly int [] NAudio.Codecs.G722Codec.wl = { -60, -30, 58, 172, 334, 538, 1198, 3042 }
staticprivate

The documentation for this class was generated from the following file: