forked from len0rd/rockbox
Remove unneeded file from SOURCES and partial SVN sync.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15551 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e35d7abd1a
commit
f32b7748dd
8 changed files with 9 additions and 367 deletions
|
@ -12,8 +12,6 @@ gain_table_lbr.c
|
||||||
hexc_10_32_table.c
|
hexc_10_32_table.c
|
||||||
hexc_table.c
|
hexc_table.c
|
||||||
high_lsp_tables.c
|
high_lsp_tables.c
|
||||||
lbr_48k_tables.c
|
|
||||||
lpc.c
|
|
||||||
lsp.c
|
lsp.c
|
||||||
lsp_tables_nb.c
|
lsp_tables_nb.c
|
||||||
ltp.c
|
ltp.c
|
||||||
|
|
|
@ -441,9 +441,6 @@ static const SpeexNBMode nb_mode = {
|
||||||
#endif
|
#endif
|
||||||
.012, /*lag_factor*/
|
.012, /*lag_factor*/
|
||||||
QCONST16(.0002,15), /*lpc_floor*/
|
QCONST16(.0002,15), /*lpc_floor*/
|
||||||
#ifdef EPIC_48K
|
|
||||||
0,
|
|
||||||
#endif
|
|
||||||
{NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
|
{NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
|
||||||
&nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
|
&nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||||
5,
|
5,
|
||||||
|
@ -480,114 +477,6 @@ const SpeexMode speex_nb_mode = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Wideband part */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
|
|
||||||
extern const signed char gain_cdbk_ulbr[];
|
|
||||||
extern const signed char exc_12_32_table[];
|
|
||||||
|
|
||||||
/* Parameters for Long-Term Prediction (LTP)*/
|
|
||||||
static const ltp_params ltp_params_48k = {
|
|
||||||
gain_cdbk_ulbr,
|
|
||||||
3,
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
static const split_cb_params split_cb_nb_48k = {
|
|
||||||
12, /*subvect_size*/
|
|
||||||
4, /*nb_subvect*/
|
|
||||||
exc_12_32_table, /*shape_cb*/
|
|
||||||
5, /*shape_bits*/
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* 4.8 kbps very low bit-rate mode */
|
|
||||||
static const SpeexSubmode nb_48k_submode = {
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
#ifndef SPEEX_DISABLE_ENCODER
|
|
||||||
/*LSP quantization*/
|
|
||||||
lsp_quant_48k,
|
|
||||||
lsp_unquant_48k,
|
|
||||||
/*No pitch quantization*/
|
|
||||||
pitch_search_3tap,
|
|
||||||
pitch_unquant_3tap,
|
|
||||||
<p_params_48k,
|
|
||||||
/*Innovation quantization*/
|
|
||||||
split_cb_search_shape_sign,
|
|
||||||
split_cb_shape_sign_unquant,
|
|
||||||
&split_cb_nb_48k,
|
|
||||||
#else
|
|
||||||
/*LSP quantization*/
|
|
||||||
NULL,
|
|
||||||
lsp_unquant_48k,
|
|
||||||
/*No pitch quantization*/
|
|
||||||
NULL,
|
|
||||||
pitch_unquant_3tap,
|
|
||||||
<p_params_48k,
|
|
||||||
/*Innovation quantization*/
|
|
||||||
NULL,
|
|
||||||
split_cb_shape_sign_unquant,
|
|
||||||
&split_cb_nb_48k,
|
|
||||||
#endif
|
|
||||||
QCONST16(.7,15),
|
|
||||||
144
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Special, non-standard 4.8 kbps mode */
|
|
||||||
static const SpeexNBMode nb_48k_mode = {
|
|
||||||
240, /*frameSize*/
|
|
||||||
48, /*subframeSize*/
|
|
||||||
10, /*lpcSize*/
|
|
||||||
17, /*pitchStart*/
|
|
||||||
144, /*pitchEnd*/
|
|
||||||
0.9, /*gamma1*/
|
|
||||||
0.6, /*gamma2*/
|
|
||||||
.01, /*lag_factor*/
|
|
||||||
QCONST16(.0003,15), /*lpc_floor*/
|
|
||||||
1,
|
|
||||||
{NULL, NULL, &nb_48k_submode, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
|
|
||||||
2,
|
|
||||||
{2,2,2,2,2,2,2,2,2,2,2}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Default mode for narrowband */
|
|
||||||
const SpeexMode speex_nb_48k_mode = {
|
|
||||||
&nb_48k_mode,
|
|
||||||
nb_mode_query,
|
|
||||||
"narrowband 4.8 kbps",
|
|
||||||
1000,
|
|
||||||
4,
|
|
||||||
#ifndef SPEEX_DISABLE_ENCODER
|
|
||||||
&nb_encoder_init,
|
|
||||||
&nb_encoder_destroy,
|
|
||||||
&nb_encode,
|
|
||||||
&nb_decoder_init,
|
|
||||||
&nb_decoder_destroy,
|
|
||||||
&nb_decode,
|
|
||||||
&nb_encoder_ctl,
|
|
||||||
&nb_decoder_ctl,
|
|
||||||
#else
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&nb_decoder_init,
|
|
||||||
&nb_decoder_destroy,
|
|
||||||
&nb_decode,
|
|
||||||
NULL,
|
|
||||||
&nb_decoder_ctl,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
|
int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,10 +126,6 @@ typedef struct SpeexNBMode {
|
||||||
float lag_factor; /**< Lag-windowing parameter */
|
float lag_factor; /**< Lag-windowing parameter */
|
||||||
spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */
|
spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
int lbr48k; /**< 1 for the special 4.8 kbps mode */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
|
const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
|
||||||
int defaultSubmode; /**< Default sub-mode to use when encoding */
|
int defaultSubmode; /**< Default sub-mode to use when encoding */
|
||||||
int quality_map[11]; /**< Mode corresponding to each quality setting */
|
int quality_map[11]; /**< Mode corresponding to each quality setting */
|
||||||
|
@ -142,7 +138,6 @@ typedef struct SpeexSBMode {
|
||||||
int frameSize; /**< Size of frames used for encoding */
|
int frameSize; /**< Size of frames used for encoding */
|
||||||
int subframeSize; /**< Size of sub-frames used for encoding */
|
int subframeSize; /**< Size of sub-frames used for encoding */
|
||||||
int lpcSize; /**< Order of LPC filter */
|
int lpcSize; /**< Order of LPC filter */
|
||||||
int bufSize; /**< Signal buffer size in encoder */
|
|
||||||
spx_word16_t gamma1; /**< Perceptual filter parameter #1 */
|
spx_word16_t gamma1; /**< Perceptual filter parameter #1 */
|
||||||
spx_word16_t gamma2; /**< Perceptual filter parameter #1 */
|
spx_word16_t gamma2; /**< Perceptual filter parameter #1 */
|
||||||
float lag_factor; /**< Lag-windowing parameter */
|
float lag_factor; /**< Lag-windowing parameter */
|
||||||
|
|
|
@ -226,7 +226,6 @@ static const SpeexSBMode sb_wb_mode = {
|
||||||
160, /*frameSize*/
|
160, /*frameSize*/
|
||||||
40, /*subframeSize*/
|
40, /*subframeSize*/
|
||||||
8, /*lpcSize*/
|
8, /*lpcSize*/
|
||||||
640, /*bufSize*/
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
29491, 19661, /* gamma1, gamma2 */
|
29491, 19661, /* gamma1, gamma2 */
|
||||||
#else
|
#else
|
||||||
|
@ -287,7 +286,6 @@ static const SpeexSBMode sb_uwb_mode = {
|
||||||
320, /*frameSize*/
|
320, /*frameSize*/
|
||||||
80, /*subframeSize*/
|
80, /*subframeSize*/
|
||||||
8, /*lpcSize*/
|
8, /*lpcSize*/
|
||||||
1280, /*bufSize*/
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
29491, 19661, /* gamma1, gamma2 */
|
29491, 19661, /* gamma1, gamma2 */
|
||||||
#else
|
#else
|
||||||
|
@ -365,10 +363,6 @@ const SpeexMode speex_uwb_mode = {
|
||||||
|
|
||||||
const SpeexMode * speex_lib_get_mode (int mode)
|
const SpeexMode * speex_lib_get_mode (int mode)
|
||||||
{
|
{
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
|
if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
|
||||||
|
|
||||||
return speex_mode_list[mode];
|
return speex_mode_list[mode];
|
||||||
|
|
|
@ -145,9 +145,6 @@ void *nb_encoder_init(const SpeexMode *m)
|
||||||
st->bounded_pitch = 1;
|
st->bounded_pitch = 1;
|
||||||
|
|
||||||
st->encode_submode = 1;
|
st->encode_submode = 1;
|
||||||
#ifdef EPIC_48K
|
|
||||||
st->lbr_48k=mode->lbr48k;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VORBIS_PSYCHO
|
#ifdef VORBIS_PSYCHO
|
||||||
st->psy = vorbis_psy_init(8000, 256);
|
st->psy = vorbis_psy_init(8000, 256);
|
||||||
|
@ -277,10 +274,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
char *stack;
|
char *stack;
|
||||||
VARDECL(spx_word16_t *syn_resp);
|
VARDECL(spx_word16_t *syn_resp);
|
||||||
VARDECL(spx_word16_t *real_exc);
|
VARDECL(spx_word16_t *real_exc);
|
||||||
#ifdef EPIC_48K
|
|
||||||
int pitch_half[2];
|
|
||||||
int ol_pitch_id=0;
|
|
||||||
#endif
|
|
||||||
spx_word32_t ener=0;
|
spx_word32_t ener=0;
|
||||||
spx_word16_t fine_gain;
|
spx_word16_t fine_gain;
|
||||||
spx_word16_t *in = (spx_word16_t*)vin;
|
spx_word16_t *in = (spx_word16_t*)vin;
|
||||||
|
@ -394,19 +388,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
ol_pitch/=2;*/
|
ol_pitch/=2;*/
|
||||||
/*ol_pitch_coef = sqrt(ol_pitch_coef);*/
|
/*ol_pitch_coef = sqrt(ol_pitch_coef);*/
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k)
|
|
||||||
{
|
|
||||||
if (ol_pitch < st->min_pitch+2)
|
|
||||||
ol_pitch = st->min_pitch+2;
|
|
||||||
if (ol_pitch > st->max_pitch-2)
|
|
||||||
ol_pitch = st->max_pitch-2;
|
|
||||||
open_loop_nbest_pitch(st->sw, ol_pitch-2, ol_pitch+2, st->frameSize>>1,
|
|
||||||
&pitch_half[0], nol_pitch_coef, 1, stack);
|
|
||||||
open_loop_nbest_pitch(st->sw+(st->frameSize>>1), pitch_half[0]-1, pitch_half[0]+2, st->frameSize>>1,
|
|
||||||
&pitch_half[1], nol_pitch_coef, 1, stack);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
ol_pitch=0;
|
ol_pitch=0;
|
||||||
ol_pitch_coef=0;
|
ol_pitch_coef=0;
|
||||||
|
@ -420,25 +401,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack);
|
fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack);
|
||||||
|
|
||||||
/* Compute open-loop excitation gain */
|
/* Compute open-loop excitation gain */
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k)
|
|
||||||
{
|
|
||||||
float ol1=0,ol2=0;
|
|
||||||
float ol_gain2;
|
|
||||||
ol1 = compute_rms16(st->exc, st->frameSize>>1);
|
|
||||||
ol2 = compute_rms16(st->exc+(st->frameSize>>1), st->frameSize>>1);
|
|
||||||
ol1 *= ol1*(st->frameSize>>1);
|
|
||||||
ol2 *= ol2*(st->frameSize>>1);
|
|
||||||
|
|
||||||
ol_gain2=ol1;
|
|
||||||
if (ol2>ol1)
|
|
||||||
ol_gain2=ol2;
|
|
||||||
ol_gain2 = sqrt(2*ol_gain2*(ol1+ol2))*1.3*(1-.5*GAIN_SCALING_1*GAIN_SCALING_1*ol_pitch_coef*ol_pitch_coef);
|
|
||||||
|
|
||||||
ol_gain=SHR32(sqrt(1+ol_gain2/st->frameSize),SIG_SHIFT);
|
|
||||||
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
spx_word16_t g = compute_rms16(st->exc, st->frameSize);
|
spx_word16_t g = compute_rms16(st->exc, st->frameSize);
|
||||||
if (st->submodeID!=1 && ol_pitch>0)
|
if (st->submodeID!=1 && ol_pitch>0)
|
||||||
|
@ -576,19 +538,12 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
|
|
||||||
if (st->encode_submode)
|
if (st->encode_submode)
|
||||||
{
|
{
|
||||||
#ifdef EPIC_48K
|
/* First, transmit a zero for narrowband */
|
||||||
if (!st->lbr_48k) {
|
speex_bits_pack(bits, 0, 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* First, transmit a zero for narrowband */
|
/* Transmit the sub-mode we use for this frame */
|
||||||
speex_bits_pack(bits, 0, 1);
|
speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
|
||||||
|
|
||||||
/* Transmit the sub-mode we use for this frame */
|
|
||||||
speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
|
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If null mode (no transmission), just set a couple things to zero*/
|
/* If null mode (no transmission), just set a couple things to zero*/
|
||||||
|
@ -627,35 +582,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
qlsp[i]=lsp[i];
|
qlsp[i]=lsp[i];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k) {
|
|
||||||
speex_bits_pack(bits, pitch_half[0]-st->min_pitch, 7);
|
|
||||||
speex_bits_pack(bits, pitch_half[1]-pitch_half[0]+1, 2);
|
|
||||||
|
|
||||||
{
|
|
||||||
int quant = (int)floor(.5+7.4*GAIN_SCALING_1*ol_pitch_coef);
|
|
||||||
if (quant>7)
|
|
||||||
quant=7;
|
|
||||||
if (quant<0)
|
|
||||||
quant=0;
|
|
||||||
ol_pitch_id=quant;
|
|
||||||
speex_bits_pack(bits, quant, 3);
|
|
||||||
ol_pitch_coef=GAIN_SCALING*0.13514*quant;
|
|
||||||
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int qe = (int)(floor(.5+2.1*log(ol_gain*1.0/SIG_SCALING)))-2;
|
|
||||||
if (qe<0)
|
|
||||||
qe=0;
|
|
||||||
if (qe>15)
|
|
||||||
qe=15;
|
|
||||||
ol_gain = exp((qe+2)/2.1)*SIG_SCALING;
|
|
||||||
speex_bits_pack(bits, qe, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*If we use low bit-rate pitch mode, transmit open-loop pitch*/
|
/*If we use low bit-rate pitch mode, transmit open-loop pitch*/
|
||||||
if (SUBMODE(lbr_pitch)!=-1)
|
if (SUBMODE(lbr_pitch)!=-1)
|
||||||
{
|
{
|
||||||
|
@ -700,10 +626,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Special case for first frame */
|
/* Special case for first frame */
|
||||||
if (st->first)
|
if (st->first)
|
||||||
|
@ -729,15 +651,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
spx_word16_t *exc;
|
spx_word16_t *exc;
|
||||||
int pitch;
|
int pitch;
|
||||||
int response_bound = st->subframeSize;
|
int response_bound = st->subframeSize;
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k)
|
|
||||||
{
|
|
||||||
if (sub*2 < st->nbSubframes)
|
|
||||||
ol_pitch = pitch_half[0];
|
|
||||||
else
|
|
||||||
ol_pitch = pitch_half[1];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Offset relative to start of frame */
|
/* Offset relative to start of frame */
|
||||||
offset = st->subframeSize*sub;
|
offset = st->subframeSize*sub;
|
||||||
|
@ -876,24 +789,11 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
|
||||||
if (st->bounded_pitch && pit_max>offset)
|
if (st->bounded_pitch && pit_max>offset)
|
||||||
pit_max=offset;
|
pit_max=offset;
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k)
|
|
||||||
{
|
|
||||||
pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
|
|
||||||
exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
|
|
||||||
st->lpcSize, st->subframeSize, bits, stack,
|
|
||||||
exc, syn_resp, st->complexity, ol_pitch_id, st->plc_tuning, &st->cumul_gain);
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Perform pitch search */
|
/* Perform pitch search */
|
||||||
pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
|
pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
|
||||||
exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
|
exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
|
||||||
st->lpcSize, st->subframeSize, bits, stack,
|
st->lpcSize, st->subframeSize, bits, stack,
|
||||||
exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
|
exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
|
||||||
#ifdef EPIC_48K
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
st->pitch[sub]=pitch;
|
st->pitch[sub]=pitch;
|
||||||
}
|
}
|
||||||
|
@ -1054,9 +954,6 @@ void *nb_decoder_init(const SpeexMode *m)
|
||||||
|
|
||||||
|
|
||||||
st->encode_submode = 1;
|
st->encode_submode = 1;
|
||||||
#ifdef EPIC_48K
|
|
||||||
st->lbr_48k=mode->lbr48k;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
st->first=1;
|
st->first=1;
|
||||||
/* Codec parameters, should eventually have several "modes"*/
|
/* Codec parameters, should eventually have several "modes"*/
|
||||||
|
@ -1222,10 +1119,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
VARDECL(spx_coef_t *ak);
|
VARDECL(spx_coef_t *ak);
|
||||||
VARDECL(spx_lsp_t *qlsp);
|
VARDECL(spx_lsp_t *qlsp);
|
||||||
spx_word16_t pitch_average=0;
|
spx_word16_t pitch_average=0;
|
||||||
#ifdef EPIC_48K
|
|
||||||
int pitch_half[2] = {0, 0};
|
|
||||||
int ol_pitch_id=0;
|
|
||||||
#endif
|
|
||||||
spx_word16_t *out = (spx_word16_t*)vout;
|
spx_word16_t *out = (spx_word16_t*)vout;
|
||||||
VARDECL(spx_lsp_t *interp_qlsp);
|
VARDECL(spx_lsp_t *interp_qlsp);
|
||||||
|
|
||||||
|
@ -1247,9 +1141,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
|
|
||||||
if (st->encode_submode)
|
if (st->encode_submode)
|
||||||
{
|
{
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (!st->lbr_48k) {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Search for next narrowband block (handle requests, skip wideband blocks) */
|
/* Search for next narrowband block (handle requests, skip wideband blocks) */
|
||||||
do {
|
do {
|
||||||
|
@ -1322,9 +1213,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
|
|
||||||
/* Get the sub-mode that was used */
|
/* Get the sub-mode that was used */
|
||||||
st->submodeID = m;
|
st->submodeID = m;
|
||||||
#ifdef EPIC_48K
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1387,23 +1275,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
st->old_qlsp[i] = qlsp[i];
|
st->old_qlsp[i] = qlsp[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k) {
|
|
||||||
pitch_half[0] = st->min_pitch+speex_bits_unpack_unsigned(bits, 7);
|
|
||||||
pitch_half[1] = pitch_half[0]+speex_bits_unpack_unsigned(bits, 2)-1;
|
|
||||||
|
|
||||||
ol_pitch_id = speex_bits_unpack_unsigned(bits, 3);
|
|
||||||
ol_pitch_coef=GAIN_SCALING*0.13514*ol_pitch_id;
|
|
||||||
|
|
||||||
{
|
|
||||||
int qe;
|
|
||||||
qe = speex_bits_unpack_unsigned(bits, 4);
|
|
||||||
ol_gain = SIG_SCALING*exp((qe+2)/2.1),SIG_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get open-loop pitch estimation for low bit-rate pitch coding */
|
/* Get open-loop pitch estimation for low bit-rate pitch coding */
|
||||||
if (SUBMODE(lbr_pitch)!=-1)
|
if (SUBMODE(lbr_pitch)!=-1)
|
||||||
{
|
{
|
||||||
|
@ -1428,9 +1299,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
ol_gain = SIG_SCALING*exp(qe/3.5);
|
ol_gain = SIG_SCALING*exp(qe/3.5);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef EPIC_48K
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ALLOC(ak, st->lpcSize, spx_coef_t);
|
ALLOC(ak, st->lpcSize, spx_coef_t);
|
||||||
ALLOC(innov, st->subframeSize, spx_sig_t);
|
ALLOC(innov, st->subframeSize, spx_sig_t);
|
||||||
|
@ -1458,16 +1326,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
spx_word16_t *innov_save = NULL;
|
spx_word16_t *innov_save = NULL;
|
||||||
spx_word16_t tmp;
|
spx_word16_t tmp;
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k)
|
|
||||||
{
|
|
||||||
if (sub*2 < st->nbSubframes)
|
|
||||||
ol_pitch = pitch_half[0];
|
|
||||||
else
|
|
||||||
ol_pitch = pitch_half[1];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Offset relative to start of frame */
|
/* Offset relative to start of frame */
|
||||||
offset = st->subframeSize*sub;
|
offset = st->subframeSize*sub;
|
||||||
/* Excitation */
|
/* Excitation */
|
||||||
|
@ -1516,22 +1374,11 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (st->lbr_48k)
|
|
||||||
{
|
|
||||||
SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
|
|
||||||
st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
|
|
||||||
st->count_lost, offset, st->last_pitch_gain, ol_pitch_id);
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
|
SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
|
||||||
st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
|
st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
|
||||||
st->count_lost, offset, st->last_pitch_gain, 0);
|
st->count_lost, offset, st->last_pitch_gain, 0);
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Ensuring that things aren't blowing up as would happen if e.g. an encoder is
|
/* Ensuring that things aren't blowing up as would happen if e.g. an encoder is
|
||||||
crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
|
crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
|
||||||
We can probably be even more aggressive and limit to 15000 or so. */
|
We can probably be even more aggressive and limit to 15000 or so. */
|
||||||
|
|
|
@ -64,10 +64,6 @@ typedef struct EncState {
|
||||||
int ol_voiced; /**< Open-loop voiced/non-voiced decision */
|
int ol_voiced; /**< Open-loop voiced/non-voiced decision */
|
||||||
int *pitch;
|
int *pitch;
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
int lbr_48k;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VORBIS_PSYCHO
|
#ifdef VORBIS_PSYCHO
|
||||||
VorbisPsy *psy;
|
VorbisPsy *psy;
|
||||||
float *psy_window;
|
float *psy_window;
|
||||||
|
@ -134,10 +130,6 @@ typedef struct DecState {
|
||||||
int max_pitch; /**< Maximum pitch value allowed */
|
int max_pitch; /**< Maximum pitch value allowed */
|
||||||
spx_int32_t sampling_rate;
|
spx_int32_t sampling_rate;
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
int lbr_48k;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */
|
spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */
|
||||||
|
|
||||||
char *stack; /**< Pseudo-stack allocation for temporary memory */
|
char *stack; /**< Pseudo-stack allocation for temporary memory */
|
||||||
|
|
|
@ -390,67 +390,3 @@ void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
|
|
||||||
extern const signed char cdbk_lsp_vlbr[5120];
|
|
||||||
extern const signed char cdbk_lsp2_vlbr[160];
|
|
||||||
|
|
||||||
#ifndef SPEEX_DISABLE_ENCODER
|
|
||||||
void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int id;
|
|
||||||
spx_word16_t quant_weight[10];
|
|
||||||
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i]=lsp[i];
|
|
||||||
|
|
||||||
compute_quant_weights(qlsp, quant_weight, order);
|
|
||||||
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i]=SUB16(qlsp[i],LSP_SCALING*(.25*i+.3125));
|
|
||||||
#ifndef FIXED_POINT
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i] = qlsp[i]*LSP_SCALE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
id = lsp_quant(qlsp, cdbk_lsp_vlbr, 512, order);
|
|
||||||
speex_bits_pack(bits, id, 9);
|
|
||||||
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i]*=4;
|
|
||||||
|
|
||||||
id = lsp_weight_quant(qlsp, quant_weight, cdbk_lsp2_vlbr, 16, 10);
|
|
||||||
speex_bits_pack(bits, id, 4);
|
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i]=PSHR16(qlsp[i],2);
|
|
||||||
#else
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i]=qlsp[i]*0.00097655;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
qlsp[i]=lsp[i]-qlsp[i];
|
|
||||||
}
|
|
||||||
#endif /* SPEEX_DISABLE_ENCODER */
|
|
||||||
|
|
||||||
void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits)
|
|
||||||
{
|
|
||||||
int i, id;
|
|
||||||
for (i=0;i<order;i++)
|
|
||||||
lsp[i]=LSP_SCALING*(.25*i+.3125);
|
|
||||||
|
|
||||||
|
|
||||||
id=speex_bits_unpack_unsigned(bits, 9);
|
|
||||||
for (i=0;i<10;i++)
|
|
||||||
lsp[i] += LSP_SCALING*0.0039062*cdbk_lsp_vlbr[id*10+i];
|
|
||||||
|
|
||||||
id=speex_bits_unpack_unsigned(bits, 4);
|
|
||||||
for (i=0;i<10;i++)
|
|
||||||
lsp[i] += LSP_SCALING*0.00097655*cdbk_lsp2_vlbr[id*10+i];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -71,13 +71,4 @@ void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
|
||||||
/* Decodes high-band LSPs */
|
/* Decodes high-band LSPs */
|
||||||
void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
|
void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
/* Quantizes narrowband LSPs with 14 bits */
|
|
||||||
void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
|
|
||||||
|
|
||||||
/* Decodes quantized narrowband LSPs (14 bits) */
|
|
||||||
void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue