Package org.xiph.speex
Class NbEncoder
java.lang.Object
org.xiph.speex.NbCodec
org.xiph.speex.NbEncoder
Narrowband Speex Encoder
- Version:
- $Revision: 1.2 $
- Author:
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatprotected floatRelative quality that will be needed by VBRprotected floatprotected int1 for enabling VAD, 0 otherwiseprivate float[]2nd temporary bufferprivate intprivate float[]Temporary (Hanning) windowprivate float[]Interpolated LPCsprivate float[]LPCs after bandwidth expansion by gamma1 for perceptual weightingprotected intprivate intState of the VBR dataprivate float[]1-element memory for pre-emphasisprivate int"Pitch enhanced" excitationprivate float[]Number of consecutive DTX framesprivate float[]Interpolated LSPsprivate float[]LSPs for previous frameprivate float[]auto-correlationprivate float[]Window applied to auto-correlationprivate float[]Filter memory for perceptually-weighted signal (whole frame)private float[]Reflection coefficientsprivate float[]Filter memory for perceptually-weighted signalstatic final int[]The Narrowband Quality map indicates which narrowband submode to use for the given narrowband quality settingprivate float[]LSPs for current frameprivate int[]Next frame should not rely on previous frames for pitchprivate floatprivate float[]LPCs after bandwidth expansion by gamma2 for perceptual weightingprotected floatQuality setting for VBR encodingprotected intprotected intprivate float[]"Pitch enhanced" excitationprivate intWeighted signal bufferprotected int1 for enabling VBR, 0 otherwiseprivate VbrFilter memory for excitation (whole frame)protected intComplexity setting (0-10 from least complex to most complex)protected floatABR setting (in bps), 0 if offprivate float[]Start of weighted signal frameFields inherited from class org.xiph.speex.NbCodec
awk1, awk2, awk3, bufSize, dtx_enabled, exc_gain_quant_scal1, exc_gain_quant_scal3, excBuf, excIdx, filters, first, frameSize, frmBuf, frmIdx, gamma1, gamma2, innov, interp_qlpc, interp_qlsp, lag_factor, lpc, lpc_floor, lpcSize, m_lsp, max_pitch, mem_sp, min_pitch, NB_FRAME_SIZE, NB_SUBMODE_BITS, NB_SUBMODES, nbSubframes, old_qlsp, pi_gain, pre_mem, preemph, qlsp, subframeSize, submodeID, submodes, VERY_SMALL, voc_m1, voc_m2, voc_mean, voc_offset, windowSizeFields 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 TypeMethodDescriptionintEncode the given input signal.intgetAbr()Returns the Average Bit Rate used (0 if ABR is not turned on).intGets the bitrate.intReturns the algorthmic complexity.intReturns the size in bits of an audio frame encoded with the current mode.intReturn LookAhead.intgetMode()Returns the encoding submode currently in use.floatReturns the relative quality.intReturns the sampling rate.booleangetVad()Returns whether or not we are using Voice Activity Detection encoding.booleangetVbr()Returns whether or not we are using Variable Bit Rate encoding.floatReturns the Varible Bit Rate Quality.voidinit(int frameSize, int subframeSize, int lpcSize, int bufSize) InitialisationvoidsetAbr(int abr) Sets the Average Bit Rate.voidsetBitRate(int bitrate) Sets the bitrate.voidsetComplexity(int complexity) Sets the algorthmic complexity.voidsetDtx(boolean dtx) Sets whether or not to use Discontinuous Transmission encoding.voidsetMode(int mode) Sets the encoding submode.voidsetQuality(int quality) Sets the QualityvoidsetSamplingRate(int rate) Sets the sampling rate.voidsetVad(boolean vad) Sets whether or not to use Voice Activity Detection encoding.voidsetVbr(boolean vbr) Sets whether or not to use Variable Bit Rate encoding.voidsetVbrQuality(float quality) Sets the Varible Bit Rate Quality.Methods inherited from class org.xiph.speex.NbCodec
getDtx, getExc, getFrameSize, getInnov, getPiGain, nbinit
-
Field Details
-
NB_QUALITY_MAP
public static final int[] NB_QUALITY_MAPThe Narrowband Quality map indicates which narrowband submode to use for the given narrowband quality setting -
bounded_pitch
private int bounded_pitch -
pitch
private int[] pitchNext frame should not rely on previous frames for pitch -
pre_mem2
private float pre_mem2 -
exc2Buf
private float[] exc2Buf1-element memory for pre-emphasis -
exc2Idx
private int exc2Idx"Pitch enhanced" excitation -
swBuf
private float[] swBuf"Pitch enhanced" excitation -
swIdx
private int swIdxWeighted signal buffer -
window
private float[] windowStart of weighted signal frame -
buf2
private float[] buf2Temporary (Hanning) window -
autocorr
private float[] autocorr2nd temporary buffer -
lagWindow
private float[] lagWindowauto-correlation -
lsp
private float[] lspWindow applied to auto-correlation -
old_lsp
private float[] old_lspLSPs for current frame -
interp_lsp
private float[] interp_lspLSPs for previous frame -
interp_lpc
private float[] interp_lpcInterpolated LSPs -
bw_lpc1
private float[] bw_lpc1Interpolated LPCs -
bw_lpc2
private float[] bw_lpc2LPCs after bandwidth expansion by gamma1 for perceptual weighting -
rc
private float[] rcLPCs after bandwidth expansion by gamma2 for perceptual weighting -
mem_sw
private float[] mem_swReflection coefficients -
mem_sw_whole
private float[] mem_sw_wholeFilter memory for perceptually-weighted signal -
mem_exc
private float[] mem_excFilter memory for perceptually-weighted signal (whole frame) -
vbr
Filter memory for excitation (whole frame) -
dtx_count
private int dtx_countState of the VBR data -
innov2
private float[] innov2Number of consecutive DTX frames -
complexity
protected int complexity -
vbr_enabled
protected int vbr_enabledComplexity setting (0-10 from least complex to most complex) -
vad_enabled
protected int vad_enabled1 for enabling VBR, 0 otherwise -
abr_enabled
protected int abr_enabled1 for enabling VAD, 0 otherwise -
vbr_quality
protected float vbr_qualityABR setting (in bps), 0 if off -
relative_quality
protected float relative_qualityQuality setting for VBR encoding -
abr_drift
protected float abr_driftRelative quality that will be needed by VBR -
abr_drift2
protected float abr_drift2 -
abr_count
protected float abr_count -
sampling_rate
protected int sampling_rate -
submodeSelect
protected int submodeSelect
-
-
Constructor Details
-
NbEncoder
public NbEncoder()
-
-
Method Details
-
init
public void init(int frameSize, int subframeSize, int lpcSize, int bufSize) Initialisation -
encode
Encode the given input signal. -
getEncodedFrameSize
public int getEncodedFrameSize()Returns the size in bits of an audio frame encoded with the current mode.- Specified by:
getEncodedFrameSizein interfaceEncoder- Returns:
- the size in bits of an audio frame encoded with the current mode.
-
setQuality
public void setQuality(int quality) Sets the Quality- Specified by:
setQualityin interfaceEncoder- Parameters:
quality-
-
getBitRate
public int getBitRate()Gets the bitrate.- Specified by:
getBitRatein interfaceEncoder- Returns:
- the bitrate.
-
setMode
public void setMode(int mode) Sets the encoding submode. -
getMode
public int getMode()Returns the encoding submode currently in use. -
setBitRate
public void setBitRate(int bitrate) Sets the bitrate.- Specified by:
setBitRatein interfaceEncoder- Parameters:
bitrate-
-
setVbr
public void setVbr(boolean vbr) Sets whether or not to use Variable Bit Rate encoding. -
getVbr
public boolean getVbr()Returns whether or not we are using Variable Bit Rate encoding. -
setVad
public void setVad(boolean vad) Sets whether or not to use Voice Activity Detection encoding. -
getVad
public boolean getVad()Returns whether or not we are using Voice Activity Detection encoding. -
setDtx
public void setDtx(boolean dtx) Sets whether or not to use Discontinuous Transmission encoding. -
getAbr
public int getAbr()Returns the Average Bit Rate used (0 if ABR is not turned on). -
setAbr
public void setAbr(int abr) Sets the Average Bit Rate. -
setVbrQuality
public void setVbrQuality(float quality) Sets the Varible Bit Rate Quality.- Specified by:
setVbrQualityin interfaceEncoder- Parameters:
quality-
-
getVbrQuality
public float getVbrQuality()Returns the Varible Bit Rate Quality.- Specified by:
getVbrQualityin interfaceEncoder- Returns:
- the Varible Bit Rate Quality.
-
setComplexity
public void setComplexity(int complexity) Sets the algorthmic complexity.- Specified by:
setComplexityin interfaceEncoder- Parameters:
complexity-
-
getComplexity
public int getComplexity()Returns the algorthmic complexity.- Specified by:
getComplexityin interfaceEncoder- Returns:
- the algorthmic complexity.
-
setSamplingRate
public void setSamplingRate(int rate) Sets the sampling rate.- Specified by:
setSamplingRatein interfaceEncoder- Parameters:
rate-
-
getSamplingRate
public int getSamplingRate()Returns the sampling rate.- Specified by:
getSamplingRatein interfaceEncoder- Returns:
- the sampling rate.
-
getLookAhead
public int getLookAhead()Return LookAhead.- Specified by:
getLookAheadin interfaceEncoder- Returns:
- LookAhead.
-
getRelativeQuality
public float getRelativeQuality()Returns the relative quality.- Specified by:
getRelativeQualityin interfaceEncoder- Returns:
- the relative quality.
-