Package org.xiph.speex
Class SbEncoder
java.lang.Object
org.xiph.speex.NbCodec
org.xiph.speex.SbCodec
org.xiph.speex.SbEncoder
Wideband Speex Encoder
- Version:
- $Revision: 1.2 $
- Author:
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected float
protected float
Relative quality that will be needed by VBRprotected float
protected int
1 for enabling VAD, 0 otherwiseprivate float[]
Reflection coefficientsprivate float[]
private float[]
Interpolated LPCsprivate float[]
LPCs after bandwidth expansion by gamma1 for perceptual weightingprotected int
private float[]
private float[]
Interpolated LSPsprivate float[]
LSPs for previous frameprivate float[]
protected Encoder
The encoder for the lower half of the Spectrum.private float[]
auto-correlationprivate float[]
LPCs after bandwidth expansion by gamma2 for perceptual weightingprivate float[]
protected int
static final int[]
The Narrowband Quality map indicates which narrowband submode to use for the given wideband/ultra-wideband quality settingprivate float[]
LSPs for current frameprivate float[]
protected float
Quality setting for VBR encodingprivate float[]
Weighted signal bufferprotected int
protected int
private float[]
private float[]
private boolean
static final int[]
The Ultra-wideband Quality map indicates which sideband submode to use for the given ultra-wideband quality settingprotected int
1 for enabling VBR, 0 otherwiseprotected int
Complexity setting (0-10 from least complex to most complex)protected float
ABR setting (in bps), 0 if offstatic final int[]
The Wideband Quality map indicates which sideband submode to use for the given wideband/ultra-wideband quality settingprivate float[]
private float[]
Fields inherited from class org.xiph.speex.SbCodec
foldingGain, fullFrameSize, g0_mem, g1_mem, high, QMF_ORDER, SB_FRAME_SIZE, SB_SUBMODE_BITS, SB_SUBMODES, x0d, y0, y1
Fields 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, windowSize
Fields 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 TypeMethodDescriptionint
Encode the given input signal.int
getAbr()
Returns the Average Bit Rate used (0 if ABR is not turned on).int
Returns the bitrate.int
Returns the algorthmic complexity.int
Returns the size in bits of an audio frame encoded with the current mode.int
Return LookAhead.int
getMode()
Returns the encoding submode currently in use.float
Returns the relative quality.int
Returns the sampling rate.boolean
getVad()
Returns whether or not we are using Voice Activity Detection encoding.boolean
getVbr()
Returns whether or not we are using Variable Bit Rate encoding.float
Returns the Varible Bit Rate Quality.void
init
(int frameSize, int subframeSize, int lpcSize, int bufSize, float foldingGain) Initialisationvoid
setAbr
(int abr) Sets the Average Bit Rate.void
setBitRate
(int bitrate) Sets the bitrate.void
setComplexity
(int complexity) Sets the algorthmic complexity.void
setDtx
(boolean dtx) Sets whether or not to use Discontinuous Transmission encoding.void
setMode
(int mode) Sets the encoding submode.void
setQuality
(int quality) Sets the Quality.void
setSamplingRate
(int rate) Sets the sampling rate.void
setVad
(boolean vad) Sets whether or not to use Voice Activity Detection encoding.void
setVbr
(boolean vbr) Sets whether or not to use Variable Bit Rate encoding.void
setVbrQuality
(float quality) Sets the Varible Bit Rate Quality.void
uwbinit()
Ultra-wideband initialisationvoid
wbinit()
Wideband initialisationMethods inherited from class org.xiph.speex.SbCodec
buildUwbSubModes, buildWbSubModes, getDtx, getExc, getFrameSize, getInnov
-
Field Details
-
NB_QUALITY_MAP
public static final int[] NB_QUALITY_MAPThe Narrowband Quality map indicates which narrowband submode to use for the given wideband/ultra-wideband quality setting -
WB_QUALITY_MAP
public static final int[] WB_QUALITY_MAPThe Wideband Quality map indicates which sideband submode to use for the given wideband/ultra-wideband quality setting -
UWB_QUALITY_MAP
public static final int[] UWB_QUALITY_MAPThe Ultra-wideband Quality map indicates which sideband submode to use for the given ultra-wideband quality setting -
lowenc
The encoder for the lower half of the Spectrum. -
x1d
private float[] x1d -
h0_mem
private float[] h0_mem -
buf
private float[] buf -
swBuf
private float[] swBuf -
res
private float[] resWeighted signal buffer -
target
private float[] target -
window
private float[] window -
lagWindow
private float[] lagWindow -
rc
private float[] rc -
autocorr
private float[] autocorrReflection coefficients -
lsp
private float[] lspauto-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 -
mem_sp2
private float[] mem_sp2LPCs after bandwidth expansion by gamma2 for perceptual weighting -
mem_sw
private float[] mem_sw -
nb_modes
protected int nb_modes -
uwb
private boolean uwb -
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
-
SbEncoder
public SbEncoder()
-
-
Method Details
-
wbinit
public void wbinit()Wideband initialisation -
uwbinit
public void uwbinit()Ultra-wideband initialisation -
init
public void init(int frameSize, int subframeSize, int lpcSize, int bufSize, float foldingGain) 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:
getEncodedFrameSize
in 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:
setQuality
in interfaceEncoder
- Parameters:
quality
-
-
setVbrQuality
public void setVbrQuality(float quality) Sets the Varible Bit Rate Quality.- Specified by:
setVbrQuality
in interfaceEncoder
- Parameters:
quality
-
-
setVbr
public void setVbr(boolean vbr) Sets whether or not to use Variable Bit Rate encoding. -
setAbr
public void setAbr(int abr) Sets the Average Bit Rate. -
getBitRate
public int getBitRate()Returns the bitrate.- Specified by:
getBitRate
in interfaceEncoder
- Returns:
- the bitrate.
-
setSamplingRate
public void setSamplingRate(int rate) Sets the sampling rate.- Specified by:
setSamplingRate
in interfaceEncoder
- Parameters:
rate
-
-
getLookAhead
public int getLookAhead()Return LookAhead.- Specified by:
getLookAhead
in interfaceEncoder
- Returns:
- LookAhead.
-
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:
setBitRate
in interfaceEncoder
- Parameters:
bitrate
-
-
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). -
getVbrQuality
public float getVbrQuality()Returns the Varible Bit Rate Quality.- Specified by:
getVbrQuality
in interfaceEncoder
- Returns:
- the Varible Bit Rate Quality.
-
setComplexity
public void setComplexity(int complexity) Sets the algorthmic complexity.- Specified by:
setComplexity
in interfaceEncoder
- Parameters:
complexity
-
-
getComplexity
public int getComplexity()Returns the algorthmic complexity.- Specified by:
getComplexity
in interfaceEncoder
- Returns:
- the algorthmic complexity.
-
getSamplingRate
public int getSamplingRate()Returns the sampling rate.- Specified by:
getSamplingRate
in interfaceEncoder
- Returns:
- the sampling rate.
-
getRelativeQuality
public float getRelativeQuality()Returns the relative quality.- Specified by:
getRelativeQuality
in interfaceEncoder
- Returns:
- the relative quality.
-