Commit b26b4578 authored by jmvalin's avatar jmvalin
Browse files

Improved very low bit-rate (~5.9 kbps) mode


git-svn-id: http://svn.xiph.org/trunk/speex@3664 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent fd61760d
## Process this file with automake to produce Makefile.in. -*-Makefile-*-
# $Id: Makefile.am,v 1.37 2002/07/17 06:35:05 jmvalin Exp $
# $Id: Makefile.am,v 1.38 2002/07/18 22:55:35 jmvalin Exp $
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
......@@ -29,6 +29,7 @@ libspeex_la_SOURCES = nb_celp.c \
exc_5_64_table.c \
exc_8_128_table.c \
exc_10_32_table.c \
exc_10_16_table.c \
hexc_10_32_table.c \
misc.c \
speex_header.c \
......
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_16_table.c
Codebook for excitation in narrowband CELP mode (3200 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_16_table[16][10]={
{0.672920,1.231544,0.429817,1.384486,0.338981,1.107532,-0.060037,0.714487,-0.120983,0.178255},
{1.447673,-0.875039,0.412456,-0.856655,-0.731211,0.387585,0.137510,0.631255,-0.152618,0.274417},
{1.167214,-0.552696,-0.722937,0.719901,-0.002841,0.287706,-0.196612,-0.636736,0.109596,-0.034344},
{-0.544655,-0.150252,-0.118561,0.522666,0.009056,0.023425,0.286494,-0.061322,0.018127,0.076392},
{0.070470,-0.360622,0.253374,-0.774034,1.226684,0.460159,0.287595,0.487105,-1.724375,-0.354565},
{0.273119,0.358771,0.155824,0.321754,-0.052317,-1.864035,0.245028,0.391091,-0.195698,0.335194},
{-0.512702,0.852019,-1.458236,-0.380709,0.339188,0.036204,0.504249,-0.216133,0.265968,-0.079673},
{-0.897480,0.276487,-0.422062,0.796802,-0.580294,1.062758,1.130878,0.376637,1.254328,-0.327360},
{-0.083722,-0.761485,-0.423256,-1.163996,-0.668986,-1.080118,-0.051286,-1.112546,0.104534,-0.176028},
{2.097711,0.861951,0.184816,-0.527173,-0.092463,-0.389416,-0.486964,-0.483164,-0.525122,-0.233066},
{-1.831345,-1.111528,-0.411369,0.033902,0.224034,0.017868,0.073562,0.315528,0.069976,0.343412},
{0.414476,0.308949,0.256880,-0.046960,0.227517,0.086626,0.149760,0.115483,0.073386,0.062901},
{-0.081650,-0.250841,0.124951,-0.163551,0.183490,0.208921,-1.298954,0.472797,1.101948,-0.060043},
{-1.438355,1.183894,0.863996,-0.609935,-0.292002,0.018439,0.206740,-0.082611,-0.005861,-0.062936},
{-0.142826,-0.119908,-0.076033,-0.140005,-0.239610,-0.081487,-0.235004,-0.164567,-0.230740,-0.138510},
{-0.475186,-0.873378,1.637971,0.993813,0.147026,-0.162624,-0.522283,-0.627300,-0.326108,-0.022353}};
......@@ -39,6 +39,7 @@ extern float exc_5_256_table[];
extern float exc_5_64_table[];
extern float exc_8_128_table[];
extern float exc_10_32_table[];
extern float exc_10_16_table[];
extern float hexc_10_32_table[];
/* Post-filter parameters for narrowband */
......@@ -76,6 +77,13 @@ static ltp_params ltp_params_nb = {
7
};
/* Parameters for Long-Term Prediction (LTP)*/
static ltp_params ltp_params_vlbr = {
gain_cdbk_lbr,
5,
0
};
/* Parameters for Long-Term Prediction (LTP)*/
static ltp_params ltp_params_lbr = {
gain_cdbk_lbr,
......@@ -94,7 +102,7 @@ static ltp_params ltp_params_med = {
static split_cb_params split_cb_nb_vlbr = {
10, /*subvect_size*/
4, /*nb_subvect*/
exc_10_32_table, /*shape_cb*/
exc_10_16_table, /*shape_cb*/
4, /*shape_bits*/
};
......@@ -175,15 +183,15 @@ static SpeexSubmode nb_submode2 = {
lsp_quant_lbr,
lsp_unquant_lbr,
/*No pitch quantization*/
NULL,
NULL,
NULL,
pitch_search_3tap,
pitch_unquant_3tap,
&ltp_params_vlbr,
/*Innovation quantization*/
split_cb_search_nogain2,
split_cb_nogain_unquant,
&split_cb_nb_vlbr,
NULL,
NULL
nb_post_filter,
&pf_params_lbr
};
......
......@@ -455,8 +455,13 @@ void nb_encode(void *state, float *in, SpeexBits *bits)
ol_pitch=st->min_pitch+margin-1;
if (ol_pitch > st->max_pitch-margin)
ol_pitch=st->max_pitch-margin;
pit_min = ol_pitch-margin+1;
pit_max = ol_pitch+margin;
if (margin)
{
pit_min = ol_pitch-margin+1;
pit_max = ol_pitch+margin;
} else {
pit_min=pit_max=ol_pitch;
}
pitch = SUBMODE(ltp_quant)(target, sw, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2,
exc, SUBMODE(ltp_params), pit_min, pit_max,
st->lpcSize, st->subframeSize, bits, st->stack, exc2);
......@@ -763,7 +768,6 @@ void nb_decode(void *state, SpeexBits *bits, float *out, int lost)
if (SUBMODE(lbr_pitch)!=-1 && SUBMODE(ltp_params))
{
ol_pitch = st->min_pitch+speex_bits_unpack_unsigned(bits, 7);
speex_bits_pack(bits, ol_pitch-st->min_pitch, 7);
} else if (SUBMODE(lbr_pitch)==0)
{
int quant;
......@@ -834,8 +838,13 @@ void nb_decode(void *state, SpeexBits *bits, float *out, int lost)
ol_pitch=st->min_pitch+margin-1;
if (ol_pitch > st->max_pitch-margin)
ol_pitch=st->max_pitch-margin;
pit_min = ol_pitch-margin+1;
pit_max = ol_pitch+margin;
if (margin)
{
pit_min = ol_pitch-margin+1;
pit_max = ol_pitch+margin;
} else {
pit_min=pit_max=ol_pitch;
}
SUBMODE(ltp_unquant)(exc, pit_min, pit_max, SUBMODE(ltp_params), st->subframeSize, &pitch, &pitch_gain[0], bits, st->stack, 0);
} else {
SUBMODE(ltp_unquant)(exc, st->min_pitch, st->max_pitch, SUBMODE(ltp_params), st->subframeSize, &pitch, &pitch_gain[0], bits, st->stack, 0);
......
......@@ -97,6 +97,7 @@ poly_roots(
/* Copy polynomial coefficients to working storage */
for (j = 0; j <= n; j++)
h[2 + j] = *a++; /* Note reversal of coefficients */
/*JMV: No more reversal of coef*/
t = 1;
K = pow(10.0, (double)(fig)); /* Relative accuracy */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment