Class NbDecoder

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

public class NbDecoder extends NbCodec implements Decoder
Narrowband Speex Decoder
Version:
$Revision: 1.3 $
Author:
Jim Lawrence, helloNetwork.com, Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
  • Field Details

    • 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 Random random
    • stereo

      protected Stereo stereo
    • inband

      protected Inband inband
    • enhanced

      protected boolean enhanced
  • Constructor Details

    • NbDecoder

      public NbDecoder()
      Constructor
  • Method Details

    • 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 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:
      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.