Main Page | Class List | Directories | File List | Class Members | File Members

ltp.h

Go to the documentation of this file.
00001 /* Copyright (C) 2002 Jean-Marc Valin 
00002    File: ltp.h
00003    Long-Term Prediction functions
00004 
00005    Redistribution and use in source and binary forms, with or without
00006    modification, are permitted provided that the following conditions
00007    are met:
00008    
00009    - Redistributions of source code must retain the above copyright
00010    notice, this list of conditions and the following disclaimer.
00011    
00012    - Redistributions in binary form must reproduce the above copyright
00013    notice, this list of conditions and the following disclaimer in the
00014    documentation and/or other materials provided with the distribution.
00015    
00016    - Neither the name of the Xiph.org Foundation nor the names of its
00017    contributors may be used to endorse or promote products derived from
00018    this software without specific prior written permission.
00019    
00020    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00023    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00024    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00027    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00029    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 */
00032 
00033 #include <speex/speex_bits.h>
00034 #include "misc.h"
00035 
00036 typedef struct ltp_params {
00037    const signed char *gain_cdbk;
00038    int     gain_bits;
00039    int     pitch_bits;
00040 } ltp_params;
00041 
00042 #ifdef FIXED_POINT
00043 #define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -SHR(g[0],1)) + (g[2]>0 ? g[2] : -SHR(g[2],1)))
00044 #else
00045 #define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -.5*g[0]) + (g[2]>0 ? g[2] : -.5*g[2]))
00046 #endif
00047 
00048 void open_loop_nbest_pitch(spx_sig_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack);
00049 
00050 
00052 int pitch_search_3tap(
00053 spx_sig_t target[],                 /* Target vector */
00054 spx_sig_t *sw,
00055 spx_coef_t ak[],                     /* LPCs for this subframe */
00056 spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
00057 spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
00058 spx_sig_t exc[],                    /* Overlapping codebook */
00059 const void *par,
00060 int   start,                    /* Smallest pitch value allowed */
00061 int   end,                      /* Largest pitch value allowed */
00062 spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
00063 int   p,                        /* Number of LPC coeffs */
00064 int   nsf,                      /* Number of samples in subframe */
00065 SpeexBits *bits,
00066 char *stack,
00067 spx_sig_t *exc2,
00068 spx_sig_t *r,
00069 int   complexity,
00070 int   cdbk_offset
00071 );
00072 
00073 /*Unquantize adaptive codebook and update pitch contribution*/
00074 void pitch_unquant_3tap(
00075 spx_sig_t exc[],                    /* Excitation */
00076 int   start,                    /* Smallest pitch value allowed */
00077 int   end,                      /* Largest pitch value allowed */
00078 spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
00079 const void *par,
00080 int   nsf,                      /* Number of samples in subframe */
00081 int *pitch_val,
00082 spx_word16_t *gain_val,
00083 SpeexBits *bits,
00084 char *stack,
00085 int lost,
00086 int subframe_offset,
00087 spx_word16_t last_pitch_gain,
00088 int cdbk_offset
00089 );
00090 
00092 int forced_pitch_quant(
00093 spx_sig_t target[],                 /* Target vector */
00094 spx_sig_t *sw,
00095 spx_coef_t ak[],                     /* LPCs for this subframe */
00096 spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
00097 spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
00098 spx_sig_t exc[],                    /* Excitation */
00099 const void *par,
00100 int   start,                    /* Smallest pitch value allowed */
00101 int   end,                      /* Largest pitch value allowed */
00102 spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
00103 int   p,                        /* Number of LPC coeffs */
00104 int   nsf,                      /* Number of samples in subframe */
00105 SpeexBits *bits,
00106 char *stack,
00107 spx_sig_t *exc2,
00108 spx_sig_t *r,
00109 int complexity,
00110 int cdbk_offset
00111 );
00112 
00114 void forced_pitch_unquant(
00115 spx_sig_t exc[],                    /* Excitation */
00116 int   start,                    /* Smallest pitch value allowed */
00117 int   end,                      /* Largest pitch value allowed */
00118 spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
00119 const void *par,
00120 int   nsf,                      /* Number of samples in subframe */
00121 int *pitch_val,
00122 spx_word16_t *gain_val,
00123 SpeexBits *bits,
00124 char *stack,
00125 int lost,
00126 int subframe_offset,
00127 spx_word16_t last_pitch_gain,
00128 int cdbk_offset
00129 );

Generated on Tue May 17 12:46:54 2005 for speex by  doxygen 1.4.2