Commit 884010ad authored by jmvalin's avatar jmvalin
Browse files

Cleaned up unused stuff and licensed all codebooks under the BSD license


git-svn-id: http://svn.xiph.org/trunk/speex@3468 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent cfc09c00
## Process this file with automake to produce Makefile.in. -*-Makefile-*-
# $Id: Makefile.am,v 1.35 2002/06/26 06:23:27 jmvalin Exp $
# $Id: Makefile.am,v 1.36 2002/07/02 05:14:28 jmvalin Exp $
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
......@@ -15,7 +15,6 @@ libspeex_la_SOURCES = nb_celp.c \
lsp.c \
quant_lsp.c \
lsp_tables_nb.c \
lsp_tables_wb.c \
gain_table.c \
gain_table_lbr.c \
cb_search.c \
......
/* Original copyright */
/*-----------------------------------------------------------------------*\
FILE........: GAINSHAPE.C
TYPE........: C Module
AUTHOR......: David Rowe
COMPANY.....: Voicetronix
DATE CREATED: 19/2/02
General gain-shape codebook search.
\*-----------------------------------------------------------------------*/
/* Modified by Jean-Marc Valin 2002
/* Copyright (C) 2002 Jean-Marc Valin
File: cb_search.c
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -55,97 +42,6 @@ static float scal_gains4[16] = {
};
/*---------------------------------------------------------------------------*\
void overlap_cb_search()
Searches a gain/shape codebook consisting of overlapping entries for the
closest vector to the target. Gives identical results to search() above
buts uses fast end correction algorithm for the synthesis of response
vectors.
\*---------------------------------------------------------------------------*/
float overlap_cb_search(
float target[], /* target vector */
float ak[], /* LPCs for this subframe */
float awk1[], /* Weighted LPCs for this subframe */
float awk2[], /* Weighted LPCs for this subframe */
float codebook[], /* overlapping codebook */
int entries, /* number of overlapping entries to search */
float *gain, /* gain of optimum entry */
int *index, /* index of optimum entry */
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
float *stack
)
{
float *resp; /* zero state response to current entry */
float *h; /* impulse response of synthesis filter */
float *impulse; /* excitation vector containing one impulse */
float d,e,g,score; /* codebook searching variables */
float bscore; /* score of "best" vector so far */
int i,k; /* loop variables */
/* Initialise */
resp=PUSH(stack, nsf);
h=PUSH(stack, nsf);
impulse=PUSH(stack, nsf);
for(i=0; i<nsf; i++)
impulse[i] = 0.0;
*gain = 0.0;
*index = 0;
bscore = 0.0;
impulse[0] = 1.0;
/* Calculate impulse response of A(z/g1) / ( A(z)*(z/g2) ) */
residue_zero(impulse, awk1, h, nsf, p);
syn_filt_zero(h, ak, h, nsf, p);
syn_filt_zero(h, awk2, h, nsf,p);
/* Calculate codebook zero-response */
residue_zero(&codebook[entries-1],awk1,resp,nsf,p);
syn_filt_zero(resp,ak,resp,nsf,p);
syn_filt_zero(resp,awk2,resp,nsf,p);
/* Search codebook backwards using end correction for synthesis */
for(k=entries-1; k>=0; k--) {
d = 0.0; e = 0.0;
for(i=0; i<nsf; i++) {
d += target[i]*resp[i];
e += resp[i]*resp[i];
}
g = d/(e+.0001);
score = g*d;
/*printf ("score: %f %f %f %f\n", target[0],d,e,score);*/
if (score >= bscore) {
bscore = score;
*gain = g;
*index = k;
}
/* Synthesise next entry */
if (k) {
for(i=nsf-1; i>=1; i--)
resp[i] = resp[i-1] + codebook[k-1]*h[i];
resp[0] = codebook[k-1]*h[0];
}
}
POP(stack);
POP(stack);
POP(stack);
return bscore;
}
void split_cb_search(
float target[], /* target vector */
float ak[], /* LPCs for this subframe */
......
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_32_table.c
Codebook for excitation in narrowband CELP mode (4000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float exc_10_32_table[32][10]={
{0.222614,0.519906,0.537807,0.834900,0.768574,0.698440,0.362245,0.125146,-0.104380,0.003991},
{0.867091,-1.114772,1.210990,-0.744193,-0.478554,0.081265,-0.273419,0.480983,-0.147815,0.319687},
......
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_5_256_table.c
Codebook for excitation in narrowband CELP mode (12800 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float exc_5_256_table[256][5]={
{-0.237490,-1.143185,0.169593,-1.347293,0.145853},
{2.282029,1.907869,1.214155,0.365887,-0.083613},
......
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_5_64_table.c
Codebook for excitation in narrowband CELP mode (9600 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float exc_5_64_table[64][5]={
{0.016425,0.164821,-0.455056,1.521999,-2.059523},
{-1.497349,-0.115601,1.570538,-1.361093,0.205962},
......
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_8_128_table.c
Codebook for excitation in narrowband CELP mode (7000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float exc_8_128_table[128][8]={
{-0.331492,0.203871,0.386807,-0.954330,0.139839,-0.393049,0.964879,-0.438279},
{-0.125630,-0.262089,0.212513,-0.197138,-0.132923,0.463029,-2.191379,1.183216},
......
/* Copyright (C) 2002 Jean-Marc Valin
File: gain_table.c
Codebook for 3-tap pitch prediction gain (128 entries)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float gain_cdbk_nb[] = {
-0.038078, -0.342320, 0.349935, -0.076156, -0.68464, 0.69987, -0.0260697, 0.239579, 0.0266496, -0.00144993, -0.117183, -0.122455,
-0.081150, 0.099494, -0.074781, -0.1623, 0.198988, -0.149562, 0.0161479, 0.0148805, -0.012137, -0.00658532, -0.00989906, -0.0055922,
......
/* Copyright (C) 2002 Jean-Marc Valin
File: gain_table_lbr.c
Codebook for 3-tap pitch prediction gain (32 entries)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float gain_cdbk_lbr[] = {
-0.076653, -0.400029, 0.248728, -0.153306, -0.800058, 0.497456, -0.0613268, 0.198997, 0.0381315, -0.00587568, -0.160023, -0.0618656,
-0.077132, 0.091150, -0.146274, -0.154264, 0.1823, -0.292548, 0.0140612, 0.0266658, -0.0225648, -0.00594935, -0.00830832, -0.0213961,
......
/* Copyright (C) 2002 Jean-Marc Valin
File: hexc_10_32_table.c
Codebook for high-band excitation in SB-CELP mode (4000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float hexc_10_32_table[32][10]={
{0.051364,0.004356,-0.004322,0.001384,0.120476,0.357375,0.785727,-1.508356,-0.450928,0.454636},
{-1.752247,-0.954283,-1.560063,-0.008506,-0.295434,0.296760,0.194227,0.395801,0.055508,-0.033656},
......
/* Copyright (C) 2002 Jean-Marc Valin
File: hexc_8_128_table.c
Codebook for high-band excitation in SB-CELP mode (8000 bps with sign)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float hexc_table[128][8]={
{-0.832280,0.602346,-0.560115,0.167680,-0.314430,-0.214323,0.482515,-0.353925},
{0.223509,-0.620498,0.624377,-0.595327,0.053103,-0.994383,0.742378,0.465689},
......
/* Copyright (C) 2002 Jean-Marc Valin
File: high_lsp_tables.c
Codebooks for high-band LSPs in SB-CELP mode
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float high_lsp_cdbk[]={ 0.900897, 1.10787, 1.32056, 1.60977, 1.88662, 2.07497, 2.36135, 2.64174 ,
0.625515, 0.786019, 1.11138, 1.95421, 2.30258, 2.4915, 2.75879, 2.95663 ,
......
/* Copyright (C) 2002 Jean-Marc Valin
File: lsp_tables_nb.c
Codebooks for LSPs in narrowband CELP mode
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
float cdbk_nb[]={ 0.367035, 0.575953, 0.898663, 1.13373, 1.40566, 1.62544, 1.92849, 2.16854, 2.47686, 2.66605 ,
......
This diff is collapsed.
......@@ -69,103 +69,6 @@ void open_loop_nbest_pitch(float *sw, int start, int end, int len, int *pitch, i
int pitch_search_3tap_unquant(
float target[], /* Target vector */
float *sw,
float ak[], /* LPCs for this subframe */
float awk1[], /* Weighted LPCs #1 for this subframe */
float awk2[], /* Weighted LPCs #2 for this subframe */
float exc[], /* Excitation */
void *par,
int start, /* Smallest pitch value allowed */
int end, /* Largest pitch value allowed */
int p, /* Number of LPC coeffs */
int nsf, /* Number of samples in subframe */
SpeexBits *bits,
float *stack,
float *exc2
)
{
int i,j;
float *tmp;
float *x[3];
float corr[3];
float A[3][3];
int pitch;
float gain[3];
tmp = PUSH(stack, 3*nsf);
x[0]=tmp;
x[1]=tmp+nsf;
x[2]=tmp+2*nsf;
/* Perform closed-loop 1-tap search*/
overlap_cb_search(target, ak, awk1, awk2,
&exc[-end], end-start+1, gain, &pitch, p,
nsf, stack);
/* Real pitch value */
pitch=end-pitch;
for (i=0;i<3;i++)
{
residue_zero(&exc[-pitch-1+i],awk1,x[i],nsf,p);
syn_filt_zero(x[i],ak,x[i],nsf,p);
syn_filt_zero(x[i],awk2,x[i],nsf,p);
}
for (i=0;i<3;i++)
corr[i]=xcorr(x[i],target,nsf);
for (i=0;i<3;i++)
for (j=0;j<=i;j++)
A[i][j]=A[j][i]=xcorr(x[i],x[j],nsf);
A[0][0]+=1;
A[1][1]+=1;
A[2][2]+=1;
{
float tmp=A[1][0]/A[0][0];
for (i=0;i<3;i++)
A[1][i] -= tmp*A[0][i];
corr[1] -= tmp*corr[0];
tmp=A[2][0]/A[0][0];
for (i=0;i<3;i++)
A[2][i] -= tmp*A[0][i];
corr[2] -= tmp*corr[0];
tmp=A[2][1]/A[1][1];
A[2][2] -= tmp*A[1][2];
corr[2] -= tmp*corr[1];
corr[2] /= A[2][2];
corr[1] = (corr[1] - A[1][2]*corr[2])/A[1][1];
corr[0] = (corr[0] - A[0][2]*corr[2] - A[0][1]*corr[1])/A[0][0];
/*printf ("\n%f %f %f\n", best_corr[0], best_corr[1], best_corr[2]);*/
}
/* Put gains in right order */
gain[0]=corr[2];gain[1]=corr[1];gain[2]=corr[0];
for (i=nsf-1;i>=0;i--)
exc[i]=gain[0]*exc[i-pitch+1]+gain[1]*exc[i-pitch]+gain[2]*exc[i-pitch-1];
#if 0
if (0){
float tmp1=0,tmp2=0;
for (i=0;i<nsf;i++)
tmp1+=target[i]*target[i];
for (i=0;i<nsf;i++)
tmp2+=(target[i]-gain[2]*x[0][i]-gain[1]*x[1][i]-gain[0]*x[2][i])
* (target[i]-gain[2]*x[0][i]-gain[1]*x[1][i]-gain[0]*x[2][i]);
#ifdef DEBUG
printf ("prediction gain = %f\n",tmp1/(tmp2+1));
#endif
return tmp1/(tmp2+1);
}
#endif
POP(stack);
return pitch;
}
/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
float pitch_gain_search_3tap(
......
......@@ -48,24 +48,6 @@ float *stack,
float *exc2
);
/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
int pitch_search_3tap_unquant(
float target[], /* Target vector */
float *sw,
float ak[], /* LPCs for this subframe */
float awk1[], /* Weighted LPCs #1 for this subframe */