Package org.xiph.speex
Class NbCodec
java.lang.Object
org.xiph.speex.NbCodec
- All Implemented Interfaces:
Codebook
Narrowband Codec.
This class contains all the basic structures needed by the Narrowband
encoder and decoder.
- Version:
- $Revision: 1.2 $
- Author:
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected float[]
Gain of LPC filter at theta=pi (fe/2)protected float[]
Gain of LPC filter at theta=pi (fe/2)protected float[]
Gain of LPC filter at theta=pi (fe/2)protected int
LPC orderprotected int
static final float[]
static final float[]
protected float[]
protected int
Excitation bufferprotected Filters
protected int
Activated sub-modeprotected int
Is this the first frame?protected float[]
1-element memory for pre-emphasisprotected int
Input buffer (original signal)protected float
Maximum pitch value allowedprotected float
Perceptual filter: A(z/gamma1)protected float[]
Start of excitation frameprotected float[]
Interpolated quantized LSPsprotected float[]
Quantized LSPs for previous frameprotected float
Perceptual filter: A(z/gamma2)protected float[]
Innovation for the frameprotected float
Lag windowing Gaussian widthprotected int
Analysis (LPC) window lengthprotected Lsp
protected int
Minimum pitch value allowedprotected float[]
Interpolated quantized LPCsprotected int
Buffer sizestatic final int[]
The Narrowband Frame Size gives the size in bits of a Narrowband frame for a given narrowband submode.static final int
The Narrowband Submodes Bits gives the number bits used to encode the Narrowband Submodestatic final int
The Narrowband Submodes gives the number of submodes possible for the Narrowband codec.protected int
Size of sub-framesprotected float[]
Quantized LSPs for current frameprotected float[]
Filter memory for synthesis signalprotected float
Pre-emphasis: P(z) = 1 - a*z^-1protected float
Noise floor multiplier for A[0] in LPC analysisprotected float[]
LPCs for current frameprotected int
Size of framesprotected int
Sub-mode dataprotected SubMode[]
static final float
Very small initial value for some of the buffers.protected float
protected float
protected float
protected int
protected int
Number of sub-framesFields inherited from interface org.xiph.speex.Codebook
cdbk_nb, cdbk_nb_high1, cdbk_nb_high2, cdbk_nb_low1, cdbk_nb_low2, exc_10_16_table, exc_10_32_table, exc_20_32_table, exc_5_256_table, exc_5_64_table, exc_8_128_table, gain_cdbk_lbr, gain_cdbk_nb, h0, h1, hexc_10_32_table, hexc_table, high_lsp_cdbk, high_lsp_cdbk2, NB_CDBK_SIZE, NB_CDBK_SIZE_HIGH1, NB_CDBK_SIZE_HIGH2, NB_CDBK_SIZE_LOW1, NB_CDBK_SIZE_LOW2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static SubMode[]
Build narrowband submodesboolean
getDtx()
Returns whether or not we are using Discontinuous Transmission encoding.float[]
getExc()
Returns the excitation array.int
Returns the size of a frame (ex: 160 samples for a narrowband frame, 320 for wideband and 640 for ultra-wideband).float[]
getInnov()
Returns the innovation array.float[]
Returns the Pitch Gain array.protected void
init
(int frameSize, int subframeSize, int lpcSize, int bufSize) Initialisation.void
nbinit()
Narrowband initialisation.
-
Field Details
-
VERY_SMALL
public static final float VERY_SMALLVery small initial value for some of the buffers.- See Also:
-
NB_FRAME_SIZE
public static final int[] NB_FRAME_SIZEThe Narrowband Frame Size gives the size in bits of a Narrowband frame for a given narrowband submode. -
NB_SUBMODES
public static final int NB_SUBMODESThe Narrowband Submodes gives the number of submodes possible for the Narrowband codec.- See Also:
-
NB_SUBMODE_BITS
public static final int NB_SUBMODE_BITSThe Narrowband Submodes Bits gives the number bits used to encode the Narrowband Submode- See Also:
-
exc_gain_quant_scal1
public static final float[] exc_gain_quant_scal1 -
exc_gain_quant_scal3
public static final float[] exc_gain_quant_scal3 -
m_lsp
-
filters
-
submodes
-
submodeID
protected int submodeIDSub-mode data -
first
protected int firstActivated sub-mode -
frameSize
protected int frameSizeIs this the first frame? -
subframeSize
protected int subframeSizeSize of frames -
nbSubframes
protected int nbSubframesSize of sub-frames -
windowSize
protected int windowSizeNumber of sub-frames -
lpcSize
protected int lpcSizeAnalysis (LPC) window length -
bufSize
protected int bufSizeLPC order -
min_pitch
protected int min_pitchBuffer size -
max_pitch
protected int max_pitchMinimum pitch value allowed -
gamma1
protected float gamma1Maximum pitch value allowed -
gamma2
protected float gamma2Perceptual filter: A(z/gamma1) -
lag_factor
protected float lag_factorPerceptual filter: A(z/gamma2) -
lpc_floor
protected float lpc_floorLag windowing Gaussian width -
preemph
protected float preemphNoise floor multiplier for A[0] in LPC analysis -
pre_mem
protected float pre_memPre-emphasis: P(z) = 1 - a*z^-1 -
frmBuf
protected float[] frmBuf1-element memory for pre-emphasis -
frmIdx
protected int frmIdxInput buffer (original signal) -
excBuf
protected float[] excBuf -
excIdx
protected int excIdxExcitation buffer -
innov
protected float[] innovStart of excitation frame -
lpc
protected float[] lpcInnovation for the frame -
qlsp
protected float[] qlspLPCs for current frame -
old_qlsp
protected float[] old_qlspQuantized LSPs for current frame -
interp_qlsp
protected float[] interp_qlspQuantized LSPs for previous frame -
interp_qlpc
protected float[] interp_qlpcInterpolated quantized LSPs -
mem_sp
protected float[] mem_spInterpolated quantized LPCs -
pi_gain
protected float[] pi_gainFilter memory for synthesis signal -
awk1
protected float[] awk1Gain of LPC filter at theta=pi (fe/2) -
awk2
protected float[] awk2Gain of LPC filter at theta=pi (fe/2) -
awk3
protected float[] awk3Gain of LPC filter at theta=pi (fe/2) -
voc_m1
protected float voc_m1 -
voc_m2
protected float voc_m2 -
voc_mean
protected float voc_mean -
voc_offset
protected int voc_offset -
dtx_enabled
protected int dtx_enabled
-
-
Constructor Details
-
NbCodec
public NbCodec()Constructor.
-
-
Method Details
-
nbinit
public void nbinit()Narrowband initialisation. -
init
protected void init(int frameSize, int subframeSize, int lpcSize, int bufSize) Initialisation.- Parameters:
frameSize
-subframeSize
-lpcSize
-bufSize
-
-
buildNbSubModes
Build narrowband submodes -
getFrameSize
public int getFrameSize()Returns the size of a frame (ex: 160 samples for a narrowband frame, 320 for wideband and 640 for ultra-wideband).- Returns:
- the size of a frame (number of audio samples in a frame).
-
getDtx
public boolean getDtx()Returns whether or not we are using Discontinuous Transmission encoding.- Returns:
- whether or not we are using Discontinuous Transmission encoding.
-
getPiGain
public float[] getPiGain()Returns the Pitch Gain array.- Returns:
- the Pitch Gain array.
-
getExc
public float[] getExc()Returns the excitation array.- Returns:
- the excitation array.
-
getInnov
public float[] getInnov()Returns the innovation array.- Returns:
- the innovation array.
-