SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media.codec.audio.g729
Class Pitch

java.lang.Object
  extended by net.java.sip.communicator.impl.media.codec.audio.g729.Pitch

 class Pitch
extends Object

Long Term Prediction Routines

Author:
Lubomir Marinov (translation of ITU-T C source code to Java)

Constructor Summary
Pitch()
           
 
Method Summary
(package private) static int enc_lag3(int T0, int T0_frac, IntReference T0_min, IntReference T0_max, int pit_min, int pit_max, int pit_flag)
          Function enc_lag3() Encoding of fractional pitch lag with 1/3 resolution.
(package private) static float g_pitch(float[] xn, float[] y1, float[] g_coeff, int l_subfr)
          Compute adaptive codebook gain and compute , -2
(package private) static int pitch_fr3(float[] exc, int exc_offset, float[] xn, float[] h, int l_subfr, int t0_min, int t0_max, int i_subfr, IntReference pit_frac)
          Find the pitch period with 1/3 subsample resolution
(package private) static int pitch_ol(float[] signal, int signal_offset, int pit_min, int pit_max, int l_frame)
          Compute the open loop pitch lag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pitch

Pitch()
Method Detail

pitch_ol

static int pitch_ol(float[] signal,
                    int signal_offset,
                    int pit_min,
                    int pit_max,
                    int l_frame)
Compute the open loop pitch lag.

Parameters:
signal - input : signal to compute pitch s[-PIT_MAX : l_frame-1]
signal_offset - input : signal offset
pit_min - input : minimum pitch lag
pit_max - input : maximum pitch lag
l_frame - input : error minimization window
Returns:
open-loop pitch lag

pitch_fr3

static int pitch_fr3(float[] exc,
                     int exc_offset,
                     float[] xn,
                     float[] h,
                     int l_subfr,
                     int t0_min,
                     int t0_max,
                     int i_subfr,
                     IntReference pit_frac)
Find the pitch period with 1/3 subsample resolution

Parameters:
exc - input : excitation buffer
exc_offset - input : excitation buffer offset
xn - input : target vector
h - input : impulse response of filters.
l_subfr - input : Length of frame to compute pitch
t0_min - input : minimum value in the searched range
t0_max - input : maximum value in the searched range
i_subfr - input : indicator for first subframe
pit_frac - output: chosen fraction
Returns:
integer part of pitch period

g_pitch

static float g_pitch(float[] xn,
                     float[] y1,
                     float[] g_coeff,
                     int l_subfr)
Compute adaptive codebook gain and compute , -2

Parameters:
xn - input : target vector
y1 - input : filtered adaptive codebook vector
g_coeff - output: and -2
l_subfr - input : vector dimension
Returns:
pitch gain

enc_lag3

static int enc_lag3(int T0,
                    int T0_frac,
                    IntReference T0_min,
                    IntReference T0_max,
                    int pit_min,
                    int pit_max,
                    int pit_flag)
Function enc_lag3() Encoding of fractional pitch lag with 1/3 resolution.
 The pitch range for the first subframe is divided as follows:
   19 1/3  to   84 2/3   resolution 1/3
   85      to   143      resolution 1

 The period in the first subframe is encoded with 8 bits.
 For the range with fractions:
   index = (T-19)*3 + frac - 1;   where T=[19..85] and frac=[-1,0,1]
 and for the integer only range
   index = (T - 85) + 197;        where T=[86..143]
----------------------------------------------------------------------
 For the second subframe a resolution of 1/3 is always used, and the
 search range is relative to the lag in the first subframe.
 If t0 is the lag in the first subframe then
  t_min=t0-5   and  t_max=t0+4   and  the range is given by
       t_min - 2/3   to  t_max + 2/3

 The period in the 2nd subframe is encoded with 5 bits:
   index = (T-(t_min-1))*3 + frac - 1;    where T[t_min-1 .. t_max+1]
 

Parameters:
T0 - input : Pitch delay
T0_frac - input : Fractional pitch delay
T0_min - in/out: Minimum search delay
T0_max - in/out: Maximum search delay
pit_min - input : Minimum pitch delay
pit_max - input : Maximum pitch delay
pit_flag - input : Flag for 1st subframe
Returns:
Return index of encoding

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.