org.xiph.speex
Class NbDecoder

java.lang.Object
  extended byorg.xiph.speex.NbCodec
      extended byorg.xiph.speex.NbDecoder
All Implemented Interfaces:
Codebook, Decoder

public class NbDecoder
extends NbCodec
implements Decoder

Narrowband Speex Decoder

Version:
$Revision: 1.6 $
Author:
Jim Lawrence, helloNetwork.com, Marc Gimpel, Wimba S.A. (marc@wimba.com)

Field Summary
private  int count_lost
           
protected  boolean enhanced
           
protected  Inband inband
           
private  float[] innov2
           
private  float last_ol_gain
          Tail of the buffer
private  int last_pitch
           
private  float last_pitch_gain
          Pitch of last correctly decoded frame
private  float[] pitch_gain_buf
          Pitch gain of last correctly decoded frame
private  int pitch_gain_buf_idx
          Pitch gain of last decoded frames
protected  java.util.Random random
           
protected  Stereo stereo
           
 
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
NbDecoder()
          Constructor
 
Method Summary
 int decode(Bits bits, float[] out)
          Decode the given input bits.
 int decodeLost(float[] out)
          Decode when packets are lost.
 void decodeStereo(float[] data, int frameSize)
          Decode the given bits to stereo.
 boolean getPerceptualEnhancement()
          Returns whether perceptual enhancement is enabled or disabled.
 void init(int frameSize, int subframeSize, int lpcSize, int bufSize)
          Initialise
 void setPerceptualEnhancement(boolean enhanced)
          Enables or disables perceptual enhancement.
 
Methods inherited from class org.xiph.speex.NbCodec
getDtx, getExc, getFrameSize, getInnov, getPiGain, nbinit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xiph.speex.Decoder
getDtx, getExc, getFrameSize, getInnov, getPiGain
 

Field Detail

innov2

private float[] innov2

count_lost

private int count_lost

last_pitch

private int last_pitch

last_pitch_gain

private float last_pitch_gain
Pitch of last correctly decoded frame


pitch_gain_buf

private float[] pitch_gain_buf
Pitch gain of last correctly decoded frame


pitch_gain_buf_idx

private int pitch_gain_buf_idx
Pitch gain of last decoded frames


last_ol_gain

private float last_ol_gain
Tail of the buffer


random

protected java.util.Random random

stereo

protected Stereo stereo

inband

protected Inband inband

enhanced

protected boolean enhanced
Constructor Detail

NbDecoder

public NbDecoder()
Constructor

Method Detail

init

public void init(int frameSize,
                 int subframeSize,
                 int lpcSize,
                 int bufSize)
Initialise

Overrides:
init in class NbCodec
Parameters:
frameSize -
subframeSize -
lpcSize -
bufSize -

decode

public int decode(Bits bits,
                  float[] out)
           throws java.io.StreamCorruptedException
Decode the given input bits.

Specified by:
decode in interface Decoder
Parameters:
bits - - Speex bits buffer.
out - - the decoded mono audio frame.
Returns:
1 if a terminator was found, 0 if not.
Throws:
java.io.StreamCorruptedException - If there is an error detected in the data stream.

decodeLost

public int decodeLost(float[] out)
Decode when packets are lost.

Parameters:
out - - the generated mono audio frame.
Returns:
0 if successful.

decodeStereo

public void decodeStereo(float[] data,
                         int frameSize)
Decode the given bits to stereo.

Specified by:
decodeStereo in interface Decoder
Parameters:
data - - float array of size 2*frameSize, that contains the mono audio samples in the first half. When the function has completed, the array will contain the interlaced stereo audio samples.
frameSize - - the size of a frame of mono audio samples.

setPerceptualEnhancement

public void setPerceptualEnhancement(boolean enhanced)
Enables or disables perceptual enhancement.

Specified by:
setPerceptualEnhancement in interface Decoder
Parameters:
enhanced -

getPerceptualEnhancement

public boolean getPerceptualEnhancement()
Returns whether perceptual enhancement is enabled or disabled.

Specified by:
getPerceptualEnhancement in interface Decoder
Returns:
whether perceptual enhancement is enabled or disabled.


Copyright © 1999-2004 Wimba S.A. All Rights Reserved.