org.xiph.speex
Class NbCodec

java.lang.Object
  extended byorg.xiph.speex.NbCodec
All Implemented Interfaces:
Codebook
Direct Known Subclasses:
NbDecoder, NbEncoder, SbCodec

public class NbCodec
extends java.lang.Object
implements Codebook

Narrowband Codec. This class contains all the basic structures needed by the Narrowband encoder and decoder.

Version:
$Revision: 1.5 $
Author:
Marc Gimpel, Wimba S.A. (marc@wimba.com)

Field Summary
protected  float[] awk1
          Gain of LPC filter at theta=pi (fe/2)
protected  float[] awk2
          Gain of LPC filter at theta=pi (fe/2)
protected  float[] awk3
          Gain of LPC filter at theta=pi (fe/2)
protected  int bufSize
          LPC order
protected  int dtx_enabled
           
static float[] exc_gain_quant_scal1
           
static float[] exc_gain_quant_scal3
           
protected  float[] excBuf
           
protected  int excIdx
          Excitation buffer
protected  Filters filters
           
protected  int first
          Activated sub-mode
protected  int frameSize
          Is this the first frame?
protected  float[] frmBuf
          1-element memory for pre-emphasis
protected  int frmIdx
          Input buffer (original signal)
protected  float gamma1
          Maximum pitch value allowed
protected  float gamma2
          Perceptual filter: A(z/gamma1)
protected  float[] innov
          Start of excitation frame
protected  float[] interp_qlpc
          Interpolated quantized LSPs
protected  float[] interp_qlsp
          Quantized LSPs for previous frame
protected  float lag_factor
          Perceptual filter: A(z/gamma2)
protected  float[] lpc
          Innovation for the frame
protected  float lpc_floor
          Lag windowing Gaussian width
protected  int lpcSize
          Analysis (LPC) window length
protected  Lsp m_lsp
           
protected  int max_pitch
          Minimum pitch value allowed
protected  float[] mem_sp
          Interpolated quantized LPCs
protected  int min_pitch
          Buffer size
static int[] NB_FRAME_SIZE
          The Narrowband Frame Size gives the size in bits of a Narrowband frame for a given narrowband submode.
static int NB_SUBMODE_BITS
          The Narrowband Submodes Bits gives the number bits used to encode the Narrowband Submode
static int NB_SUBMODES
          The Narrowband Submodes gives the number of submodes possible for the Narrowband codec.
protected  int nbSubframes
          Size of sub-frames
protected  float[] old_qlsp
          Quantized LSPs for current frame
protected  float[] pi_gain
          Filter memory for synthesis signal
protected  float pre_mem
          Pre-emphasis: P(z) = 1 - a*z^-1
protected  float preemph
          Noise floor multiplier for A[0] in LPC analysis
protected  float[] qlsp
          LPCs for current frame
protected  int subframeSize
          Size of frames
protected  int submodeID
          Sub-mode data
protected  SubMode[] submodes
           
static float VERY_SMALL
          Very small initial value for some of the buffers.
protected  float voc_m1
           
protected  float voc_m2
           
protected  float voc_mean
           
protected  int voc_offset
           
protected  int windowSize
          Number of sub-frames
 
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
NbCodec()
          Constructor.
 
Method Summary
private static SubMode[] buildNbSubModes()
          Build narrowband submodes
 boolean getDtx()
          Returns whether or not we are using Discontinuous Transmission encoding.
 float[] getExc()
          Returns the excitation array.
 int getFrameSize()
          Returns the size of a frame (ex: 160 samples for a narrowband frame, 320 for wideband and 640 for ultra-wideband).
 float[] getInnov()
          Returns the innovation array.
 float[] getPiGain()
          Returns the Pitch Gain array.
protected  void init(int frameSize, int subframeSize, int lpcSize, int bufSize)
          Initialisation.
 void nbinit()
          Narrowband initialisation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERY_SMALL

public static final float VERY_SMALL
Very small initial value for some of the buffers.

See Also:
Constant Field Values

NB_FRAME_SIZE

public static final int[] NB_FRAME_SIZE
The Narrowband Frame Size gives the size in bits of a Narrowband frame for a given narrowband submode.


NB_SUBMODES

public static final int NB_SUBMODES
The Narrowband Submodes gives the number of submodes possible for the Narrowband codec.

See Also:
Constant Field Values

NB_SUBMODE_BITS

public static final int NB_SUBMODE_BITS
The Narrowband Submodes Bits gives the number bits used to encode the Narrowband Submode

See Also:
Constant Field Values

exc_gain_quant_scal1

public static final float[] exc_gain_quant_scal1

exc_gain_quant_scal3

public static final float[] exc_gain_quant_scal3

m_lsp

protected Lsp m_lsp

filters

protected Filters filters

submodes

protected SubMode[] submodes

submodeID

protected int submodeID
Sub-mode data


first

protected int first
Activated sub-mode


frameSize

protected int frameSize
Is this the first frame?


subframeSize

protected int subframeSize
Size of frames


nbSubframes

protected int nbSubframes
Size of sub-frames


windowSize

protected int windowSize
Number of sub-frames


lpcSize

protected int lpcSize
Analysis (LPC) window length


bufSize

protected int bufSize
LPC order


min_pitch

protected int min_pitch
Buffer size


max_pitch

protected int max_pitch
Minimum pitch value allowed


gamma1

protected float gamma1
Maximum pitch value allowed


gamma2

protected float gamma2
Perceptual filter: A(z/gamma1)


lag_factor

protected float lag_factor
Perceptual filter: A(z/gamma2)


lpc_floor

protected float lpc_floor
Lag windowing Gaussian width


preemph

protected float preemph
Noise floor multiplier for A[0] in LPC analysis


pre_mem

protected float pre_mem
Pre-emphasis: P(z) = 1 - a*z^-1


frmBuf

protected float[] frmBuf
1-element memory for pre-emphasis


frmIdx

protected int frmIdx
Input buffer (original signal)


excBuf

protected float[] excBuf

excIdx

protected int excIdx
Excitation buffer


innov

protected float[] innov
Start of excitation frame


lpc

protected float[] lpc
Innovation for the frame


qlsp

protected float[] qlsp
LPCs for current frame


old_qlsp

protected float[] old_qlsp
Quantized LSPs for current frame


interp_qlsp

protected float[] interp_qlsp
Quantized LSPs for previous frame


interp_qlpc

protected float[] interp_qlpc
Interpolated quantized LSPs


mem_sp

protected float[] mem_sp
Interpolated quantized LPCs


pi_gain

protected float[] pi_gain
Filter memory for synthesis signal


awk1

protected float[] awk1
Gain of LPC filter at theta=pi (fe/2)


awk2

protected float[] awk2
Gain of LPC filter at theta=pi (fe/2)


awk3

protected float[] awk3
Gain of LPC filter at theta=pi (fe/2)


voc_m1

protected float voc_m1

voc_m2

protected float voc_m2

voc_mean

protected float voc_mean

voc_offset

protected int voc_offset

dtx_enabled

protected int dtx_enabled
Constructor Detail

NbCodec

public NbCodec()
Constructor.

Method Detail

nbinit

public void nbinit()
Narrowband initialisation.


init

protected void init(int frameSize,
                    int subframeSize,
                    int lpcSize,
                    int bufSize)
Initialisation.

Parameters:
frameSize -
subframeSize -
lpcSize -
bufSize -

buildNbSubModes

private static SubMode[] buildNbSubModes()
Build narrowband submodes


getFrameSize

public int getFrameSize()
Returns the size of a frame (ex: 160 samples for a narrowband frame, 320 for wideband and 640 for ultra-wideband).

Returns:
the size of a frame (number of audio samples in a frame).

getDtx

public boolean getDtx()
Returns whether or not we are using Discontinuous Transmission encoding.

Returns:
whether or not we are using Discontinuous Transmission encoding.

getPiGain

public float[] getPiGain()
Returns the Pitch Gain array.

Returns:
the Pitch Gain array.

getExc

public float[] getExc()
Returns the excitation array.

Returns:
the excitation array.

getInnov

public float[] getInnov()
Returns the innovation array.

Returns:
the innovation array.


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