Changeset 823 for pjproject/trunk/pjmedia/src/pjmedia-codec/speex/sb_celp.c
- Timestamp:
- Nov 23, 2006 10:19:46 AM (17 years ago)
- 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 Valin1 /* Copyright (C) 2002-2006 Jean-Marc Valin 2 2 File: sb_celp.c 3 3 … … 132 132 #else 133 133 static 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-05134 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 166 166 }; 167 167 168 168 static 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-05169 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 201 201 }; 202 202 #endif … … 211 211 spx_word32_t tmp; 212 212 #ifdef FIXED_POINT 213 tmp=PSHR (x0[i]-x1[i],SIG_SHIFT-1);213 tmp=PSHR32(SUB32(x0[i],x1[i]),SIG_SHIFT-1); 214 214 #else 215 215 tmp=2*(x0[i]-x1[i]); … … 220 220 out[i] = -32767; 221 221 else 222 out[i] = tmp;222 out[i] = EXTRACT16(tmp); 223 223 } 224 224 } … … 227 227 { 228 228 int i; 229 spx_int32_t tmp; 229 230 SBEncState *st; 230 231 const SpeexSBMode *mode; … … 255 256 st->submodeSelect = st->submodeID=mode->defaultSubmode; 256 257 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); 259 262 260 263 st->lag_factor = mode->lag_factor; … … 264 267 st->first=1; 265 268 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)); 278 281 st->exc = st->excBuf + st->bufSize - st->windowSize; 279 282 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)); 282 285 st->window= lpc_window; 283 286 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)); 285 288 for (i=0;i<st->lpcSize+1;i++) 286 289 st->lagWindow[i]=16384*exp(-.5*sqr(2*M_PI*st->lag_factor*i)); 287 290 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)); 302 305 speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov); 303 306 st->innov_save = NULL; 304 307 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)); 308 311 309 312 st->vbr_quality = 8; … … 385 388 VARDECL(spx_word16_t *low_exc); 386 389 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; 389 392 390 393 st = (SBEncState*)state; … … 500 503 if (st->vbr_enabled) 501 504 { 502 int modeid;505 spx_int32_t modeid; 503 506 modeid = mode->nb_modes-1; 504 507 st->relative_quality+=1.0*(ratio+2); … … 522 525 if (st->abr_enabled) 523 526 { 524 int bitrate;527 spx_int32_t bitrate; 525 528 speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate); 526 529 st->abr_drift+=(bitrate-st->abr_enabled); … … 766 769 SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 767 770 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)); 769 772 /*print_vec(target, st->subframeSize, "after");*/ 770 773 … … 790 793 SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 791 794 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); 793 796 for (i=0;i<st->subframeSize;i++) 794 797 innov2[i]*=scale*(1/2.5)/SIG_SCALING; … … 835 838 void *sb_decoder_init(const SpeexMode *m) 836 839 { 840 spx_int32_t tmp; 837 841 SBDecState *st; 838 842 const SpeexSBMode *mode; … … 861 865 speex_decoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate); 862 866 st->sampling_rate*=2; 867 tmp=1; 868 speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp); 863 869 864 870 st->submodes=mode->submodes; … … 868 874 869 875 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)); 889 895 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)); 891 897 speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov); 892 898 st->innov_save = NULL; … … 925 931 speex_free(st->interp_qlpc); 926 932 speex_free(st->pi_gain); 933 speex_free(st->low_innov); 927 934 speex_free(st->mem_sp); 928 speex_free(st->low_innov);929 935 930 936 speex_free(state); … … 987 993 VARDECL(spx_word16_t *low_exc); 988 994 VARDECL(spx_coef_t *ak); 989 int dtx;995 spx_int32_t dtx; 990 996 const SpeexSBMode *mode; 991 spx_word16_t *out = vout;997 spx_word16_t *out = (spx_word16_t*)vout; 992 998 993 999 st = (SBDecState*)state; … … 1193 1199 1194 1200 SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize, 1195 bits, stack);1201 bits, stack, &st->seed); 1196 1202 1197 1203 signal_mul(exc,exc,scale,st->subframeSize); … … 1204 1210 innov2[i]=0; 1205 1211 SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, 1206 bits, stack);1212 bits, stack, &st->seed); 1207 1213 for (i=0;i<st->subframeSize;i++) 1208 1214 innov2[i]*=scale/(float)SIG_SCALING*(1/2.5); … … 1252 1258 { 1253 1259 case SPEEX_GET_FRAME_SIZE: 1254 (*( int*)ptr) = st->full_frame_size;1260 (*(spx_int32_t*)ptr) = st->full_frame_size; 1255 1261 break; 1256 1262 case SPEEX_SET_HIGH_MODE: 1257 st->submodeSelect = st->submodeID = (*( int*)ptr);1263 st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr); 1258 1264 break; 1259 1265 case SPEEX_SET_LOW_MODE: … … 1273 1279 break; 1274 1280 case SPEEX_SET_VBR: 1275 st->vbr_enabled = (*( int*)ptr);1281 st->vbr_enabled = (*(spx_int32_t*)ptr); 1276 1282 speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr); 1277 1283 break; 1278 1284 case SPEEX_GET_VBR: 1279 (*( int*)ptr) = st->vbr_enabled;1285 (*(spx_int32_t*)ptr) = st->vbr_enabled; 1280 1286 break; 1281 1287 case SPEEX_SET_VAD: 1282 st->vad_enabled = (*( int*)ptr);1288 st->vad_enabled = (*(spx_int32_t*)ptr); 1283 1289 speex_encoder_ctl(st->st_low, SPEEX_SET_VAD, ptr); 1284 1290 break; 1285 1291 case SPEEX_GET_VAD: 1286 (*( int*)ptr) = st->vad_enabled;1292 (*(spx_int32_t*)ptr) = st->vad_enabled; 1287 1293 break; 1288 1294 case SPEEX_SET_VBR_QUALITY: 1289 1295 { 1290 int q;1296 spx_int32_t q; 1291 1297 float qual = (*(float*)ptr)+.6; 1292 1298 st->vbr_quality = (*(float*)ptr); … … 1309 1315 if (st->vbr_enabled) 1310 1316 { 1311 int i=10, rate, target;1317 spx_int32_t i=10, rate, target; 1312 1318 float vbr_qual; 1313 1319 target = (*(spx_int32_t*)ptr); … … 1335 1341 case SPEEX_SET_QUALITY: 1336 1342 { 1337 int nb_qual;1338 int quality = (*( int*)ptr);1343 spx_int32_t nb_qual; 1344 int quality = (*(spx_int32_t*)ptr); 1339 1345 if (quality < 0) 1340 1346 quality = 0; … … 1348 1354 case SPEEX_SET_COMPLEXITY: 1349 1355 speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr); 1350 st->complexity = (*( int*)ptr);1356 st->complexity = (*(spx_int32_t*)ptr); 1351 1357 if (st->complexity<1) 1352 1358 st->complexity=1; 1353 1359 break; 1354 1360 case SPEEX_GET_COMPLEXITY: 1355 (*( int*)ptr) = st->complexity;1361 (*(spx_int32_t*)ptr) = st->complexity; 1356 1362 break; 1357 1363 case SPEEX_SET_BITRATE: 1358 1364 { 1359 int i=10;1365 spx_int32_t i=10; 1360 1366 spx_int32_t rate, target; 1361 1367 target = (*(spx_int32_t*)ptr); … … 1405 1411 break; 1406 1412 case SPEEX_SET_SUBMODE_ENCODING: 1407 st->encode_submode = (*( int*)ptr);1413 st->encode_submode = (*(spx_int32_t*)ptr); 1408 1414 speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr); 1409 1415 break; 1410 1416 case SPEEX_GET_SUBMODE_ENCODING: 1411 (*( int*)ptr) = st->encode_submode;1417 (*(spx_int32_t*)ptr) = st->encode_submode; 1412 1418 break; 1413 1419 case SPEEX_GET_LOOKAHEAD: 1414 1420 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; 1416 1422 break; 1417 1423 case SPEEX_SET_PLC_TUNING: … … 1430 1436 } else { 1431 1437 spx_int32_t low_rate; 1432 /* FIXME: Need to adapt that to ultra-wideband */1433 1438 if (st->vbr_max >= 42200) 1434 1439 { … … 1443 1448 st->vbr_max_high = 1800; 1444 1449 } 1450 if (st->subframeSize==80) 1451 st->vbr_max_high = 1800; 1445 1452 low_rate = st->vbr_max - st->vbr_max_high; 1446 1453 speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &low_rate); … … 1450 1457 case SPEEX_GET_VBR_MAX_BITRATE: 1451 1458 (*(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); 1452 1465 break; 1453 1466 … … 1486 1499 break; 1487 1500 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 1490 1507 default: 1491 1508 speex_warning_int("Unknown nb_ctl request: ", request); … … 1502 1519 { 1503 1520 case SPEEX_SET_HIGH_MODE: 1504 st->submodeID = (*( int*)ptr);1521 st->submodeID = (*(spx_int32_t*)ptr); 1505 1522 break; 1506 1523 case SPEEX_SET_LOW_MODE: … … 1511 1528 break; 1512 1529 case SPEEX_GET_FRAME_SIZE: 1513 (*( int*)ptr) = st->full_frame_size;1530 (*(spx_int32_t*)ptr) = st->full_frame_size; 1514 1531 break; 1515 1532 case SPEEX_SET_ENH: 1516 1533 speex_decoder_ctl(st->st_low, request, ptr); 1517 st->lpc_enh_enabled = *(( int*)ptr);1534 st->lpc_enh_enabled = *((spx_int32_t*)ptr); 1518 1535 break; 1519 1536 case SPEEX_GET_ENH: 1520 *(( int*)ptr) = st->lpc_enh_enabled;1537 *((spx_int32_t*)ptr) = st->lpc_enh_enabled; 1521 1538 break; 1522 1539 case SPEEX_SET_MODE: 1523 1540 case SPEEX_SET_QUALITY: 1524 1541 { 1525 int nb_qual;1526 int quality = (*( int*)ptr);1542 spx_int32_t nb_qual; 1543 int quality = (*(spx_int32_t*)ptr); 1527 1544 if (quality < 0) 1528 1545 quality = 0; … … 1568 1585 break; 1569 1586 case SPEEX_SET_SUBMODE_ENCODING: 1570 st->encode_submode = (*( int*)ptr);1587 st->encode_submode = (*(spx_int32_t*)ptr); 1571 1588 speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr); 1572 1589 break; 1573 1590 case SPEEX_GET_SUBMODE_ENCODING: 1574 (*( int*)ptr) = st->encode_submode;1591 (*(spx_int32_t*)ptr) = st->encode_submode; 1575 1592 break; 1576 1593 case SPEEX_GET_LOOKAHEAD: 1577 1594 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 1580 1604 case SPEEX_GET_PI_GAIN: 1581 1605 { … … 1610 1634 break; 1611 1635 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 1614 1642 default: 1615 1643 speex_warning_int("Unknown nb_ctl request: ", request);
Note: See TracChangeset
for help on using the changeset viewer.