Class SbEncoder

All Implemented Interfaces:
Codebook, Encoder

public class SbEncoder extends SbCodec implements Encoder
Wideband Speex Encoder
Version:
$Revision: 1.2 $
Author:
Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
  • Field Details

    • NB_QUALITY_MAP

      public static final int[] NB_QUALITY_MAP
      The 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_MAP
      The 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_MAP
      The Ultra-wideband Quality map indicates which sideband submode to use for the given ultra-wideband quality setting
    • lowenc

      protected Encoder 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[] res
      Weighted signal buffer
    • target

      private float[] target
    • window

      private float[] window
    • lagWindow

      private float[] lagWindow
    • rc

      private float[] rc
    • autocorr

      private float[] autocorr
      Reflection coefficients
    • lsp

      private float[] lsp
      auto-correlation
    • old_lsp

      private float[] old_lsp
      LSPs for current frame
    • interp_lsp

      private float[] interp_lsp
      LSPs for previous frame
    • interp_lpc

      private float[] interp_lpc
      Interpolated LSPs
    • bw_lpc1

      private float[] bw_lpc1
      Interpolated LPCs
    • bw_lpc2

      private float[] bw_lpc2
      LPCs after bandwidth expansion by gamma1 for perceptual weighting
    • mem_sp2

      private float[] mem_sp2
      LPCs 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_enabled
      Complexity setting (0-10 from least complex to most complex)
    • vad_enabled

      protected int vad_enabled
      1 for enabling VBR, 0 otherwise
    • abr_enabled

      protected int abr_enabled
      1 for enabling VAD, 0 otherwise
    • vbr_quality

      protected float vbr_quality
      ABR setting (in bps), 0 if off
    • relative_quality

      protected float relative_quality
      Quality setting for VBR encoding
    • abr_drift

      protected float abr_drift
      Relative 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
      Overrides:
      wbinit in class SbCodec
    • uwbinit

      public void uwbinit()
      Ultra-wideband initialisation
      Overrides:
      uwbinit in class SbCodec
    • init

      public void init(int frameSize, int subframeSize, int lpcSize, int bufSize, float foldingGain)
      Initialisation
      Overrides:
      init in class SbCodec
      Parameters:
      frameSize -
      subframeSize -
      lpcSize -
      bufSize -
      foldingGain -
    • encode

      public int encode(Bits bits, float[] in)
      Encode the given input signal.
      Specified by:
      encode in interface Encoder
      Parameters:
      bits - - Speex bits buffer.
      in - - the raw mono audio frame to encode.
      Returns:
      1 if successful.
    • getEncodedFrameSize

      public int getEncodedFrameSize()
      Returns the size in bits of an audio frame encoded with the current mode.
      Specified by:
      getEncodedFrameSize in interface Encoder
      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 interface Encoder
      Parameters:
      quality -
    • setVbrQuality

      public void setVbrQuality(float quality)
      Sets the Varible Bit Rate Quality.
      Specified by:
      setVbrQuality in interface Encoder
      Parameters:
      quality -
    • setVbr

      public void setVbr(boolean vbr)
      Sets whether or not to use Variable Bit Rate encoding.
      Specified by:
      setVbr in interface Encoder
      Parameters:
      vbr -
    • setAbr

      public void setAbr(int abr)
      Sets the Average Bit Rate.
      Specified by:
      setAbr in interface Encoder
      Parameters:
      abr -
    • getBitRate

      public int getBitRate()
      Returns the bitrate.
      Specified by:
      getBitRate in interface Encoder
      Returns:
      the bitrate.
    • setSamplingRate

      public void setSamplingRate(int rate)
      Sets the sampling rate.
      Specified by:
      setSamplingRate in interface Encoder
      Parameters:
      rate -
    • getLookAhead

      public int getLookAhead()
      Return LookAhead.
      Specified by:
      getLookAhead in interface Encoder
      Returns:
      LookAhead.
    • setMode

      public void setMode(int mode)
      Sets the encoding submode.
      Specified by:
      setMode in interface Encoder
      Parameters:
      mode -
    • getMode

      public int getMode()
      Returns the encoding submode currently in use.
      Specified by:
      getMode in interface Encoder
      Returns:
      the encoding submode currently in use.
    • setBitRate

      public void setBitRate(int bitrate)
      Sets the bitrate.
      Specified by:
      setBitRate in interface Encoder
      Parameters:
      bitrate -
    • getVbr

      public boolean getVbr()
      Returns whether or not we are using Variable Bit Rate encoding.
      Specified by:
      getVbr in interface Encoder
      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.
      Specified by:
      setVad in interface Encoder
      Parameters:
      vad -
    • getVad

      public boolean getVad()
      Returns whether or not we are using Voice Activity Detection encoding.
      Specified by:
      getVad in interface Encoder
      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.
      Specified by:
      setDtx in interface Encoder
      Parameters:
      dtx -
    • getAbr

      public int getAbr()
      Returns the Average Bit Rate used (0 if ABR is not turned on).
      Specified by:
      getAbr in interface Encoder
      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 interface Encoder
      Returns:
      the Varible Bit Rate Quality.
    • setComplexity

      public void setComplexity(int complexity)
      Sets the algorthmic complexity.
      Specified by:
      setComplexity in interface Encoder
      Parameters:
      complexity -
    • getComplexity

      public int getComplexity()
      Returns the algorthmic complexity.
      Specified by:
      getComplexity in interface Encoder
      Returns:
      the algorthmic complexity.
    • getSamplingRate

      public int getSamplingRate()
      Returns the sampling rate.
      Specified by:
      getSamplingRate in interface Encoder
      Returns:
      the sampling rate.
    • getRelativeQuality

      public float getRelativeQuality()
      Returns the relative quality.
      Specified by:
      getRelativeQuality in interface Encoder
      Returns:
      the relative quality.