Ignore:
Timestamp:
Nov 23, 2006 10:19:46 AM (17 years ago)
Author:
bennylp
Message:

Updated Speex to their latest SVN (1.2-beta). AEC seems
to work much better now and take less CPU, so I increased
default tail length in PJSUA to 800ms.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/speex/sb_celp.c

    r807 r823  
    1 /* Copyright (C) 2002 Jean-Marc Valin  
     1/* Copyright (C) 2002-2006 Jean-Marc Valin  
    22   File: sb_celp.c 
    33 
     
    132132#else 
    133133static const float h0[64] = { 
    134    3.596189e-05, -0.0001123515, 
    135    -0.0001104587, 0.0002790277, 
    136    0.0002298438, -0.0005953563, 
    137    -0.0003823631, 0.00113826, 
    138    0.0005308539, -0.001986177, 
    139    -0.0006243724, 0.003235877, 
    140    0.0005743159, -0.004989147, 
    141    -0.0002584767, 0.007367171, 
    142    -0.0004857935, -0.01050689, 
    143    0.001894714, 0.01459396, 
    144    -0.004313674, -0.01994365, 
    145    0.00828756, 0.02716055, 
    146    -0.01485397, -0.03764973, 
    147    0.026447, 0.05543245, 
    148    -0.05095487, -0.09779096, 
    149    0.1382363, 0.4600981, 
    150    0.4600981, 0.1382363, 
    151    -0.09779096, -0.05095487, 
    152    0.05543245, 0.026447, 
    153    -0.03764973, -0.01485397, 
    154    0.02716055, 0.00828756, 
    155    -0.01994365, -0.004313674, 
    156    0.01459396, 0.001894714, 
    157    -0.01050689, -0.0004857935, 
    158    0.007367171, -0.0002584767, 
    159    -0.004989147, 0.0005743159, 
    160    0.003235877, -0.0006243724, 
    161    -0.001986177, 0.0005308539, 
    162    0.00113826, -0.0003823631, 
    163    -0.0005953563, 0.0002298438, 
    164    0.0002790277, -0.0001104587, 
    165    -0.0001123515, 3.596189e-05 
     134   3.596189e-05f, -0.0001123515f, 
     135   -0.0001104587f, 0.0002790277f, 
     136   0.0002298438f, -0.0005953563f, 
     137   -0.0003823631f, 0.00113826f, 
     138   0.0005308539f, -0.001986177f, 
     139   -0.0006243724f, 0.003235877f, 
     140   0.0005743159f, -0.004989147f, 
     141   -0.0002584767f, 0.007367171f, 
     142   -0.0004857935f, -0.01050689f, 
     143   0.001894714f, 0.01459396f, 
     144   -0.004313674f, -0.01994365f, 
     145   0.00828756f, 0.02716055f, 
     146   -0.01485397f, -0.03764973f, 
     147   0.026447f, 0.05543245f, 
     148   -0.05095487f, -0.09779096f, 
     149   0.1382363f, 0.4600981f, 
     150   0.4600981f, 0.1382363f, 
     151   -0.09779096f, -0.05095487f, 
     152   0.05543245f, 0.026447f, 
     153   -0.03764973f, -0.01485397f, 
     154   0.02716055f, 0.00828756f, 
     155   -0.01994365f, -0.004313674f, 
     156   0.01459396f, 0.001894714f, 
     157   -0.01050689f, -0.0004857935f, 
     158   0.007367171f, -0.0002584767f, 
     159   -0.004989147f, 0.0005743159f, 
     160   0.003235877f, -0.0006243724f, 
     161   -0.001986177f, 0.0005308539f, 
     162   0.00113826f, -0.0003823631f, 
     163   -0.0005953563f, 0.0002298438f, 
     164   0.0002790277f, -0.0001104587f, 
     165   -0.0001123515f, 3.596189e-05f 
    166166}; 
    167167 
    168168static const float h1[64] = { 
    169    3.596189e-05, 0.0001123515, 
    170    -0.0001104587, -0.0002790277, 
    171    0.0002298438, 0.0005953563, 
    172    -0.0003823631, -0.00113826, 
    173    0.0005308539, 0.001986177, 
    174    -0.0006243724, -0.003235877, 
    175    0.0005743159, 0.004989147, 
    176    -0.0002584767, -0.007367171, 
    177    -0.0004857935, 0.01050689, 
    178    0.001894714, -0.01459396, 
    179    -0.004313674, 0.01994365, 
    180    0.00828756, -0.02716055, 
    181    -0.01485397, 0.03764973, 
    182    0.026447, -0.05543245, 
    183    -0.05095487, 0.09779096, 
    184    0.1382363, -0.4600981, 
    185    0.4600981, -0.1382363, 
    186    -0.09779096, 0.05095487, 
    187    0.05543245, -0.026447, 
    188    -0.03764973, 0.01485397, 
    189    0.02716055, -0.00828756, 
    190    -0.01994365, 0.004313674, 
    191    0.01459396, -0.001894714, 
    192    -0.01050689, 0.0004857935, 
    193    0.007367171, 0.0002584767, 
    194    -0.004989147, -0.0005743159, 
    195    0.003235877, 0.0006243724, 
    196    -0.001986177, -0.0005308539, 
    197    0.00113826, 0.0003823631, 
    198    -0.0005953563, -0.0002298438, 
    199    0.0002790277, 0.0001104587, 
    200    -0.0001123515, -3.596189e-05 
     169   3.596189e-05f, 0.0001123515f, 
     170   -0.0001104587f, -0.0002790277f, 
     171   0.0002298438f, 0.0005953563f, 
     172   -0.0003823631f, -0.00113826f, 
     173   0.0005308539f, 0.001986177f, 
     174   -0.0006243724f, -0.003235877f, 
     175   0.0005743159f, 0.004989147f, 
     176   -0.0002584767f, -0.007367171f, 
     177   -0.0004857935f, 0.01050689f, 
     178   0.001894714f, -0.01459396f, 
     179   -0.004313674f, 0.01994365f, 
     180   0.00828756f, -0.02716055f, 
     181   -0.01485397f, 0.03764973f, 
     182   0.026447f, -0.05543245f, 
     183   -0.05095487f, 0.09779096f, 
     184   0.1382363f, -0.4600981f, 
     185   0.4600981f, -0.1382363f, 
     186   -0.09779096f, 0.05095487f, 
     187   0.05543245f, -0.026447f, 
     188   -0.03764973f, 0.01485397f, 
     189   0.02716055f, -0.00828756f, 
     190   -0.01994365f, 0.004313674f, 
     191   0.01459396f, -0.001894714f, 
     192   -0.01050689f, 0.0004857935f, 
     193   0.007367171f, 0.0002584767f, 
     194   -0.004989147f, -0.0005743159f, 
     195   0.003235877f, 0.0006243724f, 
     196   -0.001986177f, -0.0005308539f, 
     197   0.00113826f, 0.0003823631f, 
     198   -0.0005953563f, -0.0002298438f, 
     199   0.0002790277f, 0.0001104587f, 
     200   -0.0001123515f, -3.596189e-05f 
    201201}; 
    202202#endif 
     
    211211      spx_word32_t tmp; 
    212212#ifdef FIXED_POINT 
    213       tmp=PSHR(x0[i]-x1[i],SIG_SHIFT-1); 
     213      tmp=PSHR32(SUB32(x0[i],x1[i]),SIG_SHIFT-1); 
    214214#else 
    215215      tmp=2*(x0[i]-x1[i]); 
     
    220220         out[i] = -32767; 
    221221      else 
    222          out[i] = tmp; 
     222         out[i] = EXTRACT16(tmp); 
    223223   } 
    224224} 
     
    227227{ 
    228228   int i; 
     229   spx_int32_t tmp; 
    229230   SBEncState *st; 
    230231   const SpeexSBMode *mode; 
     
    255256   st->submodeSelect = st->submodeID=mode->defaultSubmode; 
    256257    
    257    i=9; 
    258    speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &i); 
     258   tmp=9; 
     259   speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &tmp); 
     260   tmp=1; 
     261   speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp); 
    259262 
    260263   st->lag_factor = mode->lag_factor; 
     
    264267   st->first=1; 
    265268 
    266    st->x0d=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    267    st->x1d=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    268    st->high=speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
    269    st->y0=speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
    270    st->y1=speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
    271  
    272    st->h0_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); 
    273    st->h1_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); 
    274    st->g0_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
    275    st->g1_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
    276  
    277    st->excBuf=speex_alloc((st->bufSize)*sizeof(spx_sig_t)); 
     269   st->x0d=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     270   st->x1d=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     271   st->high=(spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
     272   st->y0=(spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
     273   st->y1=(spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
     274 
     275   st->h0_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); 
     276   st->h1_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); 
     277   st->g0_mem=(spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
     278   st->g1_mem=(spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
     279 
     280   st->excBuf=(spx_sig_t*)speex_alloc((st->bufSize)*sizeof(spx_sig_t)); 
    278281   st->exc = st->excBuf + st->bufSize - st->windowSize; 
    279282 
    280    st->res=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    281    st->sw=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     283   st->res=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     284   st->sw=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    282285   st->window= lpc_window; 
    283286 
    284    st->lagWindow = speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t)); 
     287   st->lagWindow = (spx_word16_t*)speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t)); 
    285288   for (i=0;i<st->lpcSize+1;i++) 
    286289      st->lagWindow[i]=16384*exp(-.5*sqr(2*M_PI*st->lag_factor*i)); 
    287290 
    288    st->autocorr = speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t)); 
    289    st->lpc = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
    290    st->bw_lpc1 = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
    291    st->bw_lpc2 = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
    292    st->lsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    293    st->qlsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    294    st->old_lsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    295    st->old_qlsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    296    st->interp_lsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    297    st->interp_qlsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    298    st->interp_lpc = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
    299    st->interp_qlpc = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
    300    st->pi_gain = speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); 
    301    st->low_innov = speex_alloc((st->frame_size)*sizeof(spx_word32_t)); 
     291   st->autocorr = (spx_word16_t*)speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t)); 
     292   st->lpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
     293   st->bw_lpc1 = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
     294   st->bw_lpc2 = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
     295   st->lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     296   st->qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     297   st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     298   st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     299   st->interp_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     300   st->interp_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     301   st->interp_lpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
     302   st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
     303   st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); 
     304   st->low_innov = (spx_word32_t*)speex_alloc((st->frame_size)*sizeof(spx_word32_t)); 
    302305   speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov); 
    303306   st->innov_save = NULL; 
    304307    
    305    st->mem_sp = speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 
    306    st->mem_sp2 = speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 
    307    st->mem_sw = speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 
     308   st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 
     309   st->mem_sp2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 
     310   st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 
    308311 
    309312   st->vbr_quality = 8; 
     
    385388   VARDECL(spx_word16_t *low_exc); 
    386389   const SpeexSBMode *mode; 
    387    int dtx; 
    388    spx_word16_t *in = vin; 
     390   spx_int32_t dtx; 
     391   spx_word16_t *in = (spx_word16_t*)vin; 
    389392 
    390393   st = (SBEncState*)state; 
     
    500503      if (st->vbr_enabled)  
    501504      { 
    502          int modeid; 
     505         spx_int32_t modeid; 
    503506         modeid = mode->nb_modes-1; 
    504507         st->relative_quality+=1.0*(ratio+2); 
     
    522525         if (st->abr_enabled) 
    523526         { 
    524             int bitrate; 
     527            spx_int32_t bitrate; 
    525528            speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate); 
    526529            st->abr_drift+=(bitrate-st->abr_enabled); 
     
    766769         SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2,  
    767770                                   SUBMODE(innovation_params), st->lpcSize, st->subframeSize,  
    768                                    innov, syn_resp, bits, stack, (st->complexity+1)>>1, SUBMODE(double_codebook)); 
     771                                   innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook)); 
    769772         /*print_vec(target, st->subframeSize, "after");*/ 
    770773 
     
    790793            SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2,  
    791794                                      SUBMODE(innovation_params), st->lpcSize, st->subframeSize,  
    792                                       innov2, syn_resp, bits, stack, (st->complexity+1)>>1, 0); 
     795                                      innov2, syn_resp, bits, stack, st->complexity, 0); 
    793796            for (i=0;i<st->subframeSize;i++) 
    794797               innov2[i]*=scale*(1/2.5)/SIG_SCALING; 
     
    835838void *sb_decoder_init(const SpeexMode *m) 
    836839{ 
     840   spx_int32_t tmp; 
    837841   SBDecState *st; 
    838842   const SpeexSBMode *mode; 
     
    861865   speex_decoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate); 
    862866   st->sampling_rate*=2; 
     867   tmp=1; 
     868   speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp); 
    863869 
    864870   st->submodes=mode->submodes; 
     
    868874 
    869875 
    870    st->x0d=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    871    st->x1d=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    872    st->high=speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
    873    st->y0=speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
    874    st->y1=speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
    875  
    876    st->g0_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
    877    st->g1_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
    878  
    879    st->exc=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
    880    st->excBuf=speex_alloc((st->subframeSize)*sizeof(spx_sig_t)); 
    881  
    882    st->qlsp = speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); 
    883    st->old_qlsp = speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); 
    884    st->interp_qlsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
    885    st->interp_qlpc = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
    886  
    887    st->pi_gain = speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); 
    888    st->mem_sp = speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t)); 
     876   st->x0d = (spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     877   st->x1d = (spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     878   st->high = (spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
     879   st->y0 = (spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
     880   st->y1 = (spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t)); 
     881 
     882   st->g0_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
     883   st->g1_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); 
     884 
     885   st->exc = (spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 
     886   st->excBuf = (spx_sig_t*)speex_alloc((st->subframeSize)*sizeof(spx_sig_t)); 
     887 
     888   st->qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); 
     889   st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); 
     890   st->interp_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); 
     891   st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 
     892 
     893   st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); 
     894   st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t)); 
    889895    
    890    st->low_innov = speex_alloc((st->frame_size)*sizeof(spx_word32_t)); 
     896   st->low_innov = (spx_word32_t*)speex_alloc((st->frame_size)*sizeof(spx_word32_t)); 
    891897   speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov); 
    892898   st->innov_save = NULL; 
     
    925931   speex_free(st->interp_qlpc); 
    926932   speex_free(st->pi_gain); 
     933   speex_free(st->low_innov); 
    927934   speex_free(st->mem_sp); 
    928    speex_free(st->low_innov); 
    929935 
    930936   speex_free(state); 
     
    987993   VARDECL(spx_word16_t *low_exc); 
    988994   VARDECL(spx_coef_t *ak); 
    989    int dtx; 
     995   spx_int32_t dtx; 
    990996   const SpeexSBMode *mode; 
    991    spx_word16_t *out = vout; 
     997   spx_word16_t *out = (spx_word16_t*)vout; 
    992998    
    993999   st = (SBDecState*)state; 
     
    11931199 
    11941200         SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize,  
    1195                                 bits, stack); 
     1201                                     bits, stack, &st->seed); 
    11961202 
    11971203         signal_mul(exc,exc,scale,st->subframeSize); 
     
    12041210               innov2[i]=0; 
    12051211            SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize,  
    1206                                 bits, stack); 
     1212                                        bits, stack, &st->seed); 
    12071213            for (i=0;i<st->subframeSize;i++) 
    12081214               innov2[i]*=scale/(float)SIG_SCALING*(1/2.5); 
     
    12521258   { 
    12531259   case SPEEX_GET_FRAME_SIZE: 
    1254       (*(int*)ptr) = st->full_frame_size; 
     1260      (*(spx_int32_t*)ptr) = st->full_frame_size; 
    12551261      break; 
    12561262   case SPEEX_SET_HIGH_MODE: 
    1257       st->submodeSelect = st->submodeID = (*(int*)ptr); 
     1263      st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr); 
    12581264      break; 
    12591265   case SPEEX_SET_LOW_MODE: 
     
    12731279      break; 
    12741280   case SPEEX_SET_VBR: 
    1275       st->vbr_enabled = (*(int*)ptr); 
     1281      st->vbr_enabled = (*(spx_int32_t*)ptr); 
    12761282      speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr); 
    12771283      break; 
    12781284   case SPEEX_GET_VBR: 
    1279       (*(int*)ptr) = st->vbr_enabled; 
     1285      (*(spx_int32_t*)ptr) = st->vbr_enabled; 
    12801286      break; 
    12811287   case SPEEX_SET_VAD: 
    1282       st->vad_enabled = (*(int*)ptr); 
     1288      st->vad_enabled = (*(spx_int32_t*)ptr); 
    12831289      speex_encoder_ctl(st->st_low, SPEEX_SET_VAD, ptr); 
    12841290      break; 
    12851291   case SPEEX_GET_VAD: 
    1286       (*(int*)ptr) = st->vad_enabled; 
     1292      (*(spx_int32_t*)ptr) = st->vad_enabled; 
    12871293      break; 
    12881294   case SPEEX_SET_VBR_QUALITY: 
    12891295      { 
    1290          int q; 
     1296         spx_int32_t q; 
    12911297         float qual = (*(float*)ptr)+.6; 
    12921298         st->vbr_quality = (*(float*)ptr); 
     
    13091315      if (st->vbr_enabled)  
    13101316      { 
    1311          int i=10, rate, target; 
     1317         spx_int32_t i=10, rate, target; 
    13121318         float vbr_qual; 
    13131319         target = (*(spx_int32_t*)ptr); 
     
    13351341   case SPEEX_SET_QUALITY: 
    13361342      { 
    1337          int nb_qual; 
    1338          int quality = (*(int*)ptr); 
     1343         spx_int32_t nb_qual; 
     1344         int quality = (*(spx_int32_t*)ptr); 
    13391345         if (quality < 0) 
    13401346            quality = 0; 
     
    13481354   case SPEEX_SET_COMPLEXITY: 
    13491355      speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr); 
    1350       st->complexity = (*(int*)ptr); 
     1356      st->complexity = (*(spx_int32_t*)ptr); 
    13511357      if (st->complexity<1) 
    13521358         st->complexity=1; 
    13531359      break; 
    13541360   case SPEEX_GET_COMPLEXITY: 
    1355       (*(int*)ptr) = st->complexity; 
     1361      (*(spx_int32_t*)ptr) = st->complexity; 
    13561362      break; 
    13571363   case SPEEX_SET_BITRATE: 
    13581364      { 
    1359          int i=10; 
     1365         spx_int32_t i=10; 
    13601366         spx_int32_t rate, target; 
    13611367         target = (*(spx_int32_t*)ptr); 
     
    14051411      break; 
    14061412   case SPEEX_SET_SUBMODE_ENCODING: 
    1407       st->encode_submode = (*(int*)ptr); 
     1413      st->encode_submode = (*(spx_int32_t*)ptr); 
    14081414      speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr); 
    14091415      break; 
    14101416   case SPEEX_GET_SUBMODE_ENCODING: 
    1411       (*(int*)ptr) = st->encode_submode; 
     1417      (*(spx_int32_t*)ptr) = st->encode_submode; 
    14121418      break; 
    14131419   case SPEEX_GET_LOOKAHEAD: 
    14141420      speex_encoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr); 
    1415       (*(int*)ptr) = 2*(*(int*)ptr) + QMF_ORDER - 1; 
     1421      (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr) + QMF_ORDER - 1; 
    14161422      break; 
    14171423   case SPEEX_SET_PLC_TUNING: 
     
    14301436         } else { 
    14311437            spx_int32_t low_rate; 
    1432             /* FIXME: Need to adapt that to ultra-wideband */ 
    14331438            if (st->vbr_max >= 42200) 
    14341439            { 
     
    14431448               st->vbr_max_high = 1800; 
    14441449            } 
     1450            if (st->subframeSize==80) 
     1451               st->vbr_max_high = 1800; 
    14451452            low_rate = st->vbr_max - st->vbr_max_high; 
    14461453            speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &low_rate); 
     
    14501457   case SPEEX_GET_VBR_MAX_BITRATE: 
    14511458      (*(spx_int32_t*)ptr) = st->vbr_max; 
     1459      break; 
     1460   case SPEEX_SET_HIGHPASS: 
     1461      speex_encoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr); 
     1462      break; 
     1463   case SPEEX_GET_HIGHPASS: 
     1464      speex_encoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr); 
    14521465      break; 
    14531466 
     
    14861499      break; 
    14871500   case SPEEX_SET_INNOVATION_SAVE: 
    1488       st->innov_save = ptr; 
    1489       break; 
     1501      st->innov_save = (spx_sig_t*)ptr; 
     1502      break; 
     1503   case SPEEX_SET_WIDEBAND: 
     1504      speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr); 
     1505      break; 
     1506 
    14901507   default: 
    14911508      speex_warning_int("Unknown nb_ctl request: ", request); 
     
    15021519   { 
    15031520   case SPEEX_SET_HIGH_MODE: 
    1504       st->submodeID = (*(int*)ptr); 
     1521      st->submodeID = (*(spx_int32_t*)ptr); 
    15051522      break; 
    15061523   case SPEEX_SET_LOW_MODE: 
     
    15111528      break; 
    15121529   case SPEEX_GET_FRAME_SIZE: 
    1513       (*(int*)ptr) = st->full_frame_size; 
     1530      (*(spx_int32_t*)ptr) = st->full_frame_size; 
    15141531      break; 
    15151532   case SPEEX_SET_ENH: 
    15161533      speex_decoder_ctl(st->st_low, request, ptr); 
    1517       st->lpc_enh_enabled = *((int*)ptr); 
     1534      st->lpc_enh_enabled = *((spx_int32_t*)ptr); 
    15181535      break; 
    15191536   case SPEEX_GET_ENH: 
    1520       *((int*)ptr) = st->lpc_enh_enabled; 
     1537      *((spx_int32_t*)ptr) = st->lpc_enh_enabled; 
    15211538      break; 
    15221539   case SPEEX_SET_MODE: 
    15231540   case SPEEX_SET_QUALITY: 
    15241541      { 
    1525          int nb_qual; 
    1526          int quality = (*(int*)ptr); 
     1542         spx_int32_t nb_qual; 
     1543         int quality = (*(spx_int32_t*)ptr); 
    15271544         if (quality < 0) 
    15281545            quality = 0; 
     
    15681585      break; 
    15691586   case SPEEX_SET_SUBMODE_ENCODING: 
    1570       st->encode_submode = (*(int*)ptr); 
     1587      st->encode_submode = (*(spx_int32_t*)ptr); 
    15711588      speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr); 
    15721589      break; 
    15731590   case SPEEX_GET_SUBMODE_ENCODING: 
    1574       (*(int*)ptr) = st->encode_submode; 
     1591      (*(spx_int32_t*)ptr) = st->encode_submode; 
    15751592      break; 
    15761593   case SPEEX_GET_LOOKAHEAD: 
    15771594      speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr); 
    1578       (*(int*)ptr) = 2*(*(int*)ptr); 
    1579       break; 
     1595      (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr); 
     1596      break; 
     1597   case SPEEX_SET_HIGHPASS: 
     1598      speex_decoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr); 
     1599      break; 
     1600   case SPEEX_GET_HIGHPASS: 
     1601      speex_decoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr); 
     1602      break; 
     1603 
    15801604   case SPEEX_GET_PI_GAIN: 
    15811605      { 
     
    16101634      break; 
    16111635   case SPEEX_SET_INNOVATION_SAVE: 
    1612       st->innov_save = ptr; 
    1613       break; 
     1636      st->innov_save = (spx_sig_t*)ptr; 
     1637      break; 
     1638   case SPEEX_SET_WIDEBAND: 
     1639      speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr); 
     1640      break; 
     1641 
    16141642   default: 
    16151643      speex_warning_int("Unknown nb_ctl request: ", request); 
Note: See TracChangeset for help on using the changeset viewer.