summaryrefslogtreecommitdiff
path: root/apps/codecs/libspeex/sb_celp.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-11-14 02:15:56 +0000
committerThom Johansen <thomj@rockbox.org>2007-11-14 02:15:56 +0000
commit85b325fdb991a0602a2f16a55fc1df2c303aded1 (patch)
tree6eba0129ce3cc84831b37e2ed64c473d053317ac /apps/codecs/libspeex/sb_celp.c
parent91f618f1ba1e507a9aa1cf7ee87eaf0370272b17 (diff)
downloadrockbox-85b325fdb991a0602a2f16a55fc1df2c303aded1.tar.gz
rockbox-85b325fdb991a0602a2f16a55fc1df2c303aded1.zip
Sync Speex to SVN. Disable stereo compatibility hack since we don't needed it and it produced warnings. Remove unneeded math.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15613 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/sb_celp.c')
-rw-r--r--apps/codecs/libspeex/sb_celp.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/apps/codecs/libspeex/sb_celp.c b/apps/codecs/libspeex/sb_celp.c
index 3314f6b87e..192c873d9e 100644
--- a/apps/codecs/libspeex/sb_celp.c
+++ b/apps/codecs/libspeex/sb_celp.c
@@ -43,7 +43,7 @@
43#include "quant_lsp.h" 43#include "quant_lsp.h"
44#include "vq.h" 44#include "vq.h"
45#include "ltp.h" 45#include "ltp.h"
46#include "misc.h" 46#include "arch.h"
47#include "math_approx.h" 47#include "math_approx.h"
48#include "os_support.h" 48#include "os_support.h"
49 49
@@ -183,6 +183,7 @@ static const float h0[64] = {
183 183
184#endif 184#endif
185 185
186extern const spx_word16_t lag_window[];
186extern const spx_word16_t lpc_window[]; 187extern const spx_word16_t lpc_window[];
187 188
188#ifndef SPEEX_DISABLE_ENCODER 189#ifndef SPEEX_DISABLE_ENCODER
@@ -224,7 +225,6 @@ void *sb_encoder_init(const SpeexMode *m)
224 tmp=1; 225 tmp=1;
225 speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp); 226 speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
226 227
227 st->lag_factor = mode->lag_factor;
228 st->lpc_floor = mode->lpc_floor; 228 st->lpc_floor = mode->lpc_floor;
229 st->gamma1=mode->gamma1; 229 st->gamma1=mode->gamma1;
230 st->gamma2=mode->gamma2; 230 st->gamma2=mode->gamma2;
@@ -237,9 +237,7 @@ void *sb_encoder_init(const SpeexMode *m)
237 237
238 st->window= lpc_window; 238 st->window= lpc_window;
239 239
240 st->lagWindow = (spx_word16_t*)speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t)); 240 st->lagWindow = lag_window;
241 for (i=0;i<st->lpcSize+1;i++)
242 st->lagWindow[i]=16384*exp(-.5*sqr(2*M_PI*st->lag_factor*i));
243 241
244 st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 242 st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
245 st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 243 st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
@@ -253,9 +251,7 @@ void *sb_encoder_init(const SpeexMode *m)
253 st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 251 st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
254 252
255 for (i=0;i<st->lpcSize;i++) 253 for (i=0;i<st->lpcSize;i++)
256 { 254 st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
257 st->old_lsp[i]=LSP_SCALING*(M_PI*((float)(i+1)))/(st->lpcSize+1);
258 }
259 255
260 st->vbr_quality = 8; 256 st->vbr_quality = 8;
261 st->vbr_enabled = 0; 257 st->vbr_enabled = 0;
@@ -288,8 +284,6 @@ void sb_encoder_destroy(void *state)
288 speex_free(st->h0_mem); 284 speex_free(st->h0_mem);
289 speex_free(st->h1_mem); 285 speex_free(st->h1_mem);
290 286
291 speex_free(st->lagWindow);
292
293 speex_free(st->old_lsp); 287 speex_free(st->old_lsp);
294 speex_free(st->old_qlsp); 288 speex_free(st->old_qlsp);
295 speex_free(st->interp_qlpc); 289 speex_free(st->interp_qlpc);
@@ -1271,7 +1265,7 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
1271 int i; 1265 int i;
1272 st->first = 1; 1266 st->first = 1;
1273 for (i=0;i<st->lpcSize;i++) 1267 for (i=0;i<st->lpcSize;i++)
1274 st->old_lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1); 1268 st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
1275 for (i=0;i<st->lpcSize;i++) 1269 for (i=0;i<st->lpcSize;i++)
1276 st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0; 1270 st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0;
1277 for (i=0;i<QMF_ORDER;i++) 1271 for (i=0;i<QMF_ORDER;i++)