ltp.h

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

Generated on Fri Jan 2 13:28:35 2009 for speex by  doxygen 1.4.6