summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/codecs/libspeex/SOURCES2
-rw-r--r--apps/codecs/libspeex/modes.c111
-rw-r--r--apps/codecs/libspeex/modes.h5
-rw-r--r--apps/codecs/libspeex/modes_wb.c6
-rw-r--r--apps/codecs/libspeex/nb_celp.c171
-rw-r--r--apps/codecs/libspeex/nb_celp.h8
-rw-r--r--apps/codecs/libspeex/quant_lsp.c64
-rw-r--r--apps/codecs/libspeex/quant_lsp.h9
8 files changed, 9 insertions, 367 deletions
diff --git a/apps/codecs/libspeex/SOURCES b/apps/codecs/libspeex/SOURCES
index 89e3f1db03..f775a7cd9f 100644
--- a/apps/codecs/libspeex/SOURCES
+++ b/apps/codecs/libspeex/SOURCES
@@ -12,8 +12,6 @@ gain_table_lbr.c
hexc_10_32_table.c
hexc_table.c
high_lsp_tables.c
-lbr_48k_tables.c
-lpc.c
lsp.c
lsp_tables_nb.c
ltp.c
diff --git a/apps/codecs/libspeex/modes.c b/apps/codecs/libspeex/modes.c
index 0478f978d1..cf4ef3246c 100644
--- a/apps/codecs/libspeex/modes.c
+++ b/apps/codecs/libspeex/modes.c
@@ -441,9 +441,6 @@ static const SpeexNBMode nb_mode = {
#endif
.012, /*lag_factor*/
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,
&nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
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,
- &ltp_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,
- &ltp_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)
{
diff --git a/apps/codecs/libspeex/modes.h b/apps/codecs/libspeex/modes.h
index 730c80fb07..9ce674a498 100644
--- a/apps/codecs/libspeex/modes.h
+++ b/apps/codecs/libspeex/modes.h
@@ -126,10 +126,6 @@ typedef struct SpeexNBMode {
float lag_factor; /**< Lag-windowing parameter */
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 */
int defaultSubmode; /**< Default sub-mode to use when encoding */
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 subframeSize; /**< Size of sub-frames used for encoding */
int lpcSize; /**< Order of LPC filter */
- int bufSize; /**< Signal buffer size in encoder */
spx_word16_t gamma1; /**< Perceptual filter parameter #1 */
spx_word16_t gamma2; /**< Perceptual filter parameter #1 */
float lag_factor; /**< Lag-windowing parameter */
diff --git a/apps/codecs/libspeex/modes_wb.c b/apps/codecs/libspeex/modes_wb.c
index e4c95a85bc..1684ba6493 100644
--- a/apps/codecs/libspeex/modes_wb.c
+++ b/apps/codecs/libspeex/modes_wb.c
@@ -226,7 +226,6 @@ static const SpeexSBMode sb_wb_mode = {
160, /*frameSize*/
40, /*subframeSize*/
8, /*lpcSize*/
- 640, /*bufSize*/
#ifdef FIXED_POINT
29491, 19661, /* gamma1, gamma2 */
#else
@@ -287,7 +286,6 @@ static const SpeexSBMode sb_uwb_mode = {
320, /*frameSize*/
80, /*subframeSize*/
8, /*lpcSize*/
- 1280, /*bufSize*/
#ifdef FIXED_POINT
29491, 19661, /* gamma1, gamma2 */
#else
@@ -365,10 +363,6 @@ const SpeexMode speex_uwb_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;
return speex_mode_list[mode];
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c
index f3810894e1..3de623a482 100644
--- a/apps/codecs/libspeex/nb_celp.c
+++ b/apps/codecs/libspeex/nb_celp.c
@@ -145,9 +145,6 @@ void *nb_encoder_init(const SpeexMode *m)
st->bounded_pitch = 1;
st->encode_submode = 1;
-#ifdef EPIC_48K
- st->lbr_48k=mode->lbr48k;
-#endif
#ifdef VORBIS_PSYCHO
st->psy = vorbis_psy_init(8000, 256);
@@ -277,10 +274,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
char *stack;
VARDECL(spx_word16_t *syn_resp);
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_word16_t fine_gain;
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_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 {
ol_pitch=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);
/* 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);
if (st->submodeID!=1 && ol_pitch>0)
@@ -576,19 +538,12 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
if (st->encode_submode)
{
-#ifdef EPIC_48K
- if (!st->lbr_48k) {
-#endif
-
- /* First, transmit a zero for narrowband */
- speex_bits_pack(bits, 0, 1);
+ /* First, transmit a zero for narrowband */
+ speex_bits_pack(bits, 0, 1);
- /* Transmit the sub-mode we use for this frame */
- 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*/
@@ -627,35 +582,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
qlsp[i]=lsp[i];
#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 (SUBMODE(lbr_pitch)!=-1)
{
@@ -700,10 +626,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
#endif
-#ifdef EPIC_48K
- }
-#endif
-
/* Special case for first frame */
if (st->first)
@@ -729,15 +651,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
spx_word16_t *exc;
int pitch;
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 = st->subframeSize*sub;
@@ -876,24 +789,11 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
if (st->bounded_pitch && 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 */
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, 0, st->plc_tuning, &st->cumul_gain);
-#ifdef EPIC_48K
- }
-#endif
st->pitch[sub]=pitch;
}
@@ -1054,9 +954,6 @@ void *nb_decoder_init(const SpeexMode *m)
st->encode_submode = 1;
-#ifdef EPIC_48K
- st->lbr_48k=mode->lbr48k;
-#endif
st->first=1;
/* 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_lsp_t *qlsp);
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;
VARDECL(spx_lsp_t *interp_qlsp);
@@ -1247,9 +1141,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
if (st->encode_submode)
{
-#ifdef EPIC_48K
- if (!st->lbr_48k) {
-#endif
/* Search for next narrowband block (handle requests, skip wideband blocks) */
do {
@@ -1322,9 +1213,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
/* Get the sub-mode that was used */
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];
}
-#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 */
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);
#endif
}
-#ifdef EPIC_48K
- }
-#endif
ALLOC(ak, st->lpcSize, spx_coef_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 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 = st->subframeSize*sub;
/* 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),
- st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
- st->count_lost, offset, st->last_pitch_gain, 0);
+ 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, 0);
-#ifdef EPIC_48K
- }
-#endif
/* 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).
We can probably be even more aggressive and limit to 15000 or so. */
diff --git a/apps/codecs/libspeex/nb_celp.h b/apps/codecs/libspeex/nb_celp.h
index 805c43c950..28ee9325a1 100644
--- a/apps/codecs/libspeex/nb_celp.h
+++ b/apps/codecs/libspeex/nb_celp.h
@@ -64,10 +64,6 @@ typedef struct EncState {
int ol_voiced; /**< Open-loop voiced/non-voiced decision */
int *pitch;
-#ifdef EPIC_48K
- int lbr_48k;
-#endif
-
#ifdef VORBIS_PSYCHO
VorbisPsy *psy;
float *psy_window;
@@ -134,10 +130,6 @@ typedef struct DecState {
int max_pitch; /**< Maximum pitch value allowed */
spx_int32_t sampling_rate;
-#ifdef EPIC_48K
- int lbr_48k;
-#endif
-
spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */
char *stack; /**< Pseudo-stack allocation for temporary memory */
diff --git a/apps/codecs/libspeex/quant_lsp.c b/apps/codecs/libspeex/quant_lsp.c
index 9ab55cfcbd..10d5762017 100644
--- a/apps/codecs/libspeex/quant_lsp.c
+++ b/apps/codecs/libspeex/quant_lsp.c
@@ -390,67 +390,3 @@ void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
#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
diff --git a/apps/codecs/libspeex/quant_lsp.h b/apps/codecs/libspeex/quant_lsp.h
index c6d5bb36e1..828dffc4f5 100644
--- a/apps/codecs/libspeex/quant_lsp.h
+++ b/apps/codecs/libspeex/quant_lsp.h
@@ -71,13 +71,4 @@ void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
/* Decodes high-band LSPs */
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