Changeset 628 for pjproject/trunk/pjmedia/src/pjmedia-codec/speex/sb_celp.c
- Timestamp:
- Jul 26, 2006 5:04:54 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/speex/sb_celp.c
r278 r628 202 202 #endif 203 203 204 extern const spx_word16_t lpc_window[]; 205 204 206 static void mix_and_saturate(spx_word32_t *x0, spx_word32_t *x1, spx_word16_t *out, int len) 205 207 { … … 245 247 st->subframeSize = mode->subframeSize; 246 248 st->nbSubframes = mode->frameSize/mode->subframeSize; 247 st->windowSize = st->frame_size *3/2;249 st->windowSize = st->frame_size+st->subframeSize; 248 250 st->lpcSize=mode->lpcSize; 249 251 st->bufSize=mode->bufSize; … … 278 280 st->res=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 279 281 st->sw=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 280 st->target=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 281 /*Asymmetric "pseudo-Hamming" window*/ 282 { 283 int part1, part2; 284 part1 = st->subframeSize*7/2; 285 part2 = st->subframeSize*5/2; 286 st->window = speex_alloc((st->windowSize)*sizeof(spx_word16_t)); 287 for (i=0;i<part1;i++) 288 st->window[i]=(spx_word16_t)(SIG_SCALING*(.54-.46*cos(M_PI*i/part1))); 289 for (i=0;i<part2;i++) 290 st->window[part1+i]=(spx_word16_t)(SIG_SCALING*(.54+.46*cos(M_PI*i/part2))); 291 } 282 st->window= lpc_window; 292 283 293 284 st->lagWindow = speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t)); … … 308 299 st->interp_qlpc = speex_alloc(st->lpcSize*sizeof(spx_coef_t)); 309 300 st->pi_gain = speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); 310 301 st->low_innov = speex_alloc((st->frame_size)*sizeof(spx_word32_t)); 302 speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov); 303 st->innov_save = NULL; 304 311 305 st->mem_sp = speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); 312 306 st->mem_sp2 = speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); … … 315 309 st->vbr_quality = 8; 316 310 st->vbr_enabled = 0; 311 st->vbr_max = 0; 312 st->vbr_max_high = 20000; /* We just need a big value here */ 317 313 st->vad_enabled = 0; 318 314 st->abr_enabled = 0; … … 351 347 speex_free(st->res); 352 348 speex_free(st->sw); 353 speex_free(st->target);354 speex_free(st->window);355 349 speex_free(st->lagWindow); 356 350 … … 385 379 VARDECL(spx_mem_t *mem); 386 380 VARDECL(spx_sig_t *innov); 381 VARDECL(spx_word16_t *target); 387 382 VARDECL(spx_word16_t *syn_resp); 388 383 VARDECL(spx_word32_t *low_pi_gain); 389 VARDECL(spx_sig_t *low_exc); 390 VARDECL(spx_sig_t *low_innov); 384 VARDECL(spx_word16_t *low_exc); 391 385 const SpeexSBMode *mode; 392 386 int dtx; … … 423 417 424 418 ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t); 425 ALLOC(low_exc, st->frame_size, spx_sig_t); 426 ALLOC(low_innov, st->frame_size, spx_sig_t); 419 ALLOC(low_exc, st->frame_size, spx_word16_t); 427 420 speex_encoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain); 428 421 speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc); 429 speex_encoder_ctl(st->st_low, SPEEX_GET_INNOV, low_innov);430 422 431 423 speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, &dtx); … … 456 448 457 449 /* LPC to LSPs (x-domain) transform */ 458 roots=lpc_to_lsp (st->lpc, st->lpcSize, st->lsp, 1 5, LSP_DELTA1, stack);450 roots=lpc_to_lsp (st->lpc, st->lpcSize, st->lsp, 10, LSP_DELTA1, stack); 459 451 if (roots!=st->lpcSize) 460 452 { 461 roots = lpc_to_lsp (st->lpc, st->lpcSize, st->lsp, 1 1, LSP_DELTA2, stack);453 roots = lpc_to_lsp (st->lpc, st->lpcSize, st->lsp, 10, LSP_DELTA2, stack); 462 454 if (roots!=st->lpcSize) { 463 455 /*If we can't find all LSP's, do some damage control and use a flat filter*/ 464 456 for (i=0;i<st->lpcSize;i++) 465 457 { 466 st->lsp[i]= M_PI*((float)(i+1))/(st->lpcSize+1);458 st->lsp[i]=LSP_SCALING*M_PI*((float)(i+1))/(st->lpcSize+1); 467 459 } 468 460 } … … 522 514 thresh = (st->vbr_quality-v1) * mode->vbr_thresh[modeid][v1+1] + 523 515 (1+v1-st->vbr_quality) * mode->vbr_thresh[modeid][v1]; 524 if (st->relative_quality >= thresh )516 if (st->relative_quality >= thresh && st->sampling_rate*st->submodes[modeid]->bits_per_frame/st->full_frame_size <= st->vbr_max_high) 525 517 break; 526 518 modeid--; … … 602 594 ALLOC(syn_resp, st->subframeSize, spx_word16_t); 603 595 ALLOC(innov, st->subframeSize, spx_sig_t); 596 ALLOC(target, st->subframeSize, spx_word16_t); 604 597 605 598 for (sub=0;sub<st->nbSubframes;sub++) 606 599 { 607 spx_sig_t *exc, *sp, *res, * target, *sw;600 spx_sig_t *exc, *sp, *res, *sw, *innov_save=NULL; 608 601 spx_word16_t filter_ratio; 609 602 int offset; … … 615 608 exc=st->exc+offset; 616 609 res=st->res+offset; 617 target=st->target+offset;618 610 sw=st->sw+offset; 611 /* Pointer for saving innovation */ 612 if (st->innov_save) 613 { 614 innov_save = st->innov_save+2*offset; 615 for (i=0;i<2*st->subframeSize;i++) 616 innov_save[i]=0; 617 } 619 618 620 619 /* LSP interpolation (quantized and unquantized) */ … … 643 642 rl = low_pi_gain[sub]; 644 643 #ifdef FIXED_POINT 645 filter_ratio= DIV32_16(SHL(rl+82,2),SHR(82+rh,5));644 filter_ratio=PDIV32_16(SHL(rl+82,2),SHR(82+rh,5)); 646 645 #else 647 646 filter_ratio=(rl+.01)/(rh+.01); … … 657 656 float g; 658 657 spx_word16_t el; 659 el = compute_rms( low_innov+offset, st->subframeSize);658 el = compute_rms(st->low_innov+offset, st->subframeSize); 660 659 661 660 /* Gain to use if we want to use the low-band excitation for high-band */ 662 g=eh/( .01+el);661 g=eh/(1.+el); 663 662 664 663 #if 0 … … 670 669 for (i=0;i<st->lpcSize;i++) 671 670 mem[i]=st->mem_sp[i]; 672 iir_mem2( low_innov+offset, st->interp_qlpc, tmp_sig, st->subframeSize, st->lpcSize, mem);671 iir_mem2(st->low_innov+offset, st->interp_qlpc, tmp_sig, st->subframeSize, st->lpcSize, mem); 673 672 g2 = compute_rms(sp, st->subframeSize)/(.01+compute_rms(tmp_sig, st->subframeSize)); 674 673 /*fprintf (stderr, "gains: %f %f\n", g, g2);*/ … … 699 698 spx_word32_t scale; 700 699 spx_word16_t el; 701 el = compute_rms (low_exc+offset, st->subframeSize);702 703 gc = DIV32_16(MULT16_16(filter_ratio,1+eh),1+el);700 el = compute_rms16(low_exc+offset, st->subframeSize); 701 702 gc = PDIV32_16(MULT16_16(filter_ratio,1+eh),1+el); 704 703 705 704 /* This is a kludge that cleans up a historical bug */ … … 727 726 gc *= 1.4142; 728 727 729 scale = SHL (MULT16_16(DIV32_16(SHL(gc,SIG_SHIFT-4),filter_ratio),(1+el)),4);728 scale = SHL32(MULT16_16(PDIV32_16(SHL32(EXTEND32(gc),SIG_SHIFT-6),filter_ratio),(1+el)),6); 730 729 731 730 compute_impulse_response(st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack); … … 752 751 /* Compute target signal */ 753 752 for (i=0;i<st->subframeSize;i++) 754 target[i]= sw[i]-res[i];753 target[i]=PSHR32(sw[i]-res[i],SIG_SHIFT); 755 754 756 755 for (i=0;i<st->subframeSize;i++) … … 774 773 exc[i] = ADD32(exc[i], innov[i]); 775 774 775 if (st->innov_save) 776 { 777 for (i=0;i<st->subframeSize;i++) 778 innov_save[2*i]=innov[i]; 779 } 780 776 781 if (SUBMODE(double_codebook)) { 777 782 char *tmp_stack=stack; … … 872 877 873 878 st->exc=speex_alloc((st->frame_size)*sizeof(spx_sig_t)); 879 st->excBuf=speex_alloc((st->subframeSize)*sizeof(spx_sig_t)); 874 880 875 881 st->qlsp = speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); … … 881 887 st->mem_sp = speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t)); 882 888 889 st->low_innov = speex_alloc((st->frame_size)*sizeof(spx_word32_t)); 890 speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov); 891 st->innov_save = NULL; 892 893 883 894 st->lpc_enh_enabled=0; 884 895 st->seed = 1000; … … 907 918 speex_free(st->g1_mem); 908 919 speex_free(st->exc); 920 speex_free(st->excBuf); 909 921 speex_free(st->qlsp); 910 922 speex_free(st->old_qlsp); … … 920 932 { 921 933 int i; 922 VARDECL(spx_coef_t *awk1);923 VARDECL(spx_coef_t *awk2);924 VARDECL(spx_coef_t *awk3);925 934 int saved_modeid=0; 926 935 … … 935 944 st->first=1; 936 945 937 ALLOC(awk1, st->lpcSize+1, spx_coef_t);938 ALLOC(awk2, st->lpcSize+1, spx_coef_t);939 ALLOC(awk3, st->lpcSize+1, spx_coef_t);940 941 if (st->lpc_enh_enabled)942 {943 spx_word16_t k1,k2,k3;944 if (st->submodes[st->submodeID] != NULL)945 {946 k1=SUBMODE(lpc_enh_k1);947 k2=SUBMODE(lpc_enh_k2);948 k3=SUBMODE(lpc_enh_k3);949 } else {950 k1=k2=.7*GAMMA_SCALING;951 k3 = 0;952 }953 bw_lpc(k1, st->interp_qlpc, awk1, st->lpcSize);954 bw_lpc(k2, st->interp_qlpc, awk2, st->lpcSize);955 bw_lpc(k3, st->interp_qlpc, awk3, st->lpcSize);956 /*fprintf (stderr, "%f %f %f\n", k1, k2, k3);*/957 }958 959 946 960 947 /* Final signal synthesis from excitation */ … … 970 957 st->high[i]=st->exc[i]; 971 958 972 if (st->lpc_enh_enabled) 973 { 974 /* Use enhanced LPC filter */ 975 filter_mem2(st->high, awk2, awk1, st->high, st->frame_size, st->lpcSize, 976 st->mem_sp+st->lpcSize); 977 filter_mem2(st->high, awk3, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, 978 st->mem_sp); 979 } else { 980 /* Use regular filter */ 981 for (i=0;i<st->lpcSize;i++) 982 st->mem_sp[st->lpcSize+i] = 0; 983 iir_mem2(st->high, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, 984 st->mem_sp); 985 } 959 iir_mem2(st->high, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, 960 st->mem_sp); 986 961 987 /*iir_mem2(st->exc, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, st->mem_sp);*/988 962 989 963 /* Reconstruct the original */ … … 1009 983 char *stack; 1010 984 VARDECL(spx_word32_t *low_pi_gain); 1011 VARDECL(spx_sig_t *low_exc); 1012 VARDECL(spx_sig_t *low_innov); 1013 VARDECL(spx_coef_t *awk1); 1014 VARDECL(spx_coef_t *awk2); 1015 VARDECL(spx_coef_t *awk3); 985 VARDECL(spx_word16_t *low_exc); 986 VARDECL(spx_coef_t *ak); 1016 987 int dtx; 1017 988 const SpeexSBMode *mode; … … 1102 1073 1103 1074 ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t); 1104 ALLOC(low_exc, st->frame_size, spx_sig_t); 1105 ALLOC(low_innov, st->frame_size, spx_sig_t); 1075 ALLOC(low_exc, st->frame_size, spx_word16_t); 1106 1076 speex_decoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain); 1107 1077 speex_decoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc); 1108 speex_decoder_ctl(st->st_low, SPEEX_GET_INNOV, low_innov);1109 1078 1110 1079 SUBMODE(lsp_unquant)(st->qlsp, st->lpcSize, bits); … … 1116 1085 } 1117 1086 1118 ALLOC(awk1, st->lpcSize+1, spx_coef_t); 1119 ALLOC(awk2, st->lpcSize+1, spx_coef_t); 1120 ALLOC(awk3, st->lpcSize+1, spx_coef_t); 1087 ALLOC(ak, st->lpcSize, spx_coef_t); 1121 1088 1122 1089 for (sub=0;sub<st->nbSubframes;sub++) 1123 1090 { 1124 spx_sig_t *exc, *sp ;1091 spx_sig_t *exc, *sp, *innov_save=NULL; 1125 1092 spx_word16_t filter_ratio; 1126 1093 spx_word16_t el=0; … … 1131 1098 sp=st->high+offset; 1132 1099 exc=st->exc+offset; 1100 /* Pointer for saving innovation */ 1101 if (st->innov_save) 1102 { 1103 innov_save = st->innov_save+2*offset; 1104 for (i=0;i<2*st->subframeSize;i++) 1105 innov_save[i]=0; 1106 } 1133 1107 1134 1108 /* LSP interpolation */ … … 1138 1112 1139 1113 /* LSP to LPC */ 1140 lsp_to_lpc(st->interp_qlsp, st->interp_qlpc, st->lpcSize, stack); 1141 1142 1143 if (st->lpc_enh_enabled) 1144 { 1145 spx_word16_t k1,k2,k3; 1146 k1=SUBMODE(lpc_enh_k1); 1147 k2=SUBMODE(lpc_enh_k2); 1148 k3=SUBMODE(lpc_enh_k3); 1149 bw_lpc(k1, st->interp_qlpc, awk1, st->lpcSize); 1150 bw_lpc(k2, st->interp_qlpc, awk2, st->lpcSize); 1151 bw_lpc(k3, st->interp_qlpc, awk3, st->lpcSize); 1152 /*fprintf (stderr, "%f %f %f\n", k1, k2, k3);*/ 1153 } 1154 1114 lsp_to_lpc(st->interp_qlsp, ak, st->lpcSize, stack); 1155 1115 1156 1116 /* Calculate reponse ratio between the low and high filter in the middle … … 1167 1127 rl = low_pi_gain[sub]; 1168 1128 #ifdef FIXED_POINT 1169 filter_ratio= DIV32_16(SHL(rl+82,2),SHR(82+rh,5));1129 filter_ratio=PDIV32_16(SHL(rl+82,2),SHR(82+rh,5)); 1170 1130 #else 1171 1131 filter_ratio=(rl+.01)/(rh+.01); … … 1191 1151 #if 0 1192 1152 for (i=0;i<st->subframeSize;i++) 1193 exc[i]=mode->folding_gain*g* low_innov[offset+i];1153 exc[i]=mode->folding_gain*g*st->low_innov[offset+i]; 1194 1154 #else 1195 1155 { … … 1200 1160 for (i=0;i<st->subframeSize;i++) 1201 1161 { 1202 float e=tmp*g*mode->folding_gain* low_innov[offset+i];1162 float e=tmp*g*mode->folding_gain*st->low_innov[offset+i]; 1203 1163 tmp *= -1; 1204 1164 exc[i] = e; … … 1211 1171 } 1212 1172 1213 /*speex_rand_vec(mode->folding_gain*g*el, exc, st->subframeSize);*/1214 1173 #endif 1215 1174 } else { … … 1218 1177 int qgc = speex_bits_unpack_unsigned(bits, 4); 1219 1178 1220 el = compute_rms (low_exc+offset, st->subframeSize);1179 el = compute_rms16(low_exc+offset, st->subframeSize); 1221 1180 1222 1181 #ifdef FIXED_POINT … … 1229 1188 gc *= 1.4142; 1230 1189 1231 scale = SHL(MULT16_16( DIV32_16(SHL(gc,SIG_SHIFT-4),filter_ratio),(1+el)),4);1190 scale = SHL(MULT16_16(PDIV32_16(SHL(gc,SIG_SHIFT-6),filter_ratio),(1+el)),6); 1232 1191 1233 1192 SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize, … … 1252 1211 1253 1212 } 1254 1213 1214 if (st->innov_save) 1215 { 1216 for (i=0;i<st->subframeSize;i++) 1217 innov_save[2*i]=exc[i]; 1218 } 1219 1255 1220 for (i=0;i<st->subframeSize;i++) 1256 sp[i]=exc[i]; 1257 if (st->lpc_enh_enabled) 1258 { 1259 /* Use enhanced LPC filter */ 1260 filter_mem2(sp, awk2, awk1, sp, st->subframeSize, st->lpcSize, 1261 st->mem_sp+st->lpcSize); 1262 filter_mem2(sp, awk3, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 1263 st->mem_sp); 1264 } else { 1265 /* Use regular filter */ 1266 for (i=0;i<st->lpcSize;i++) 1267 st->mem_sp[st->lpcSize+i] = 0; 1268 iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 1269 st->mem_sp); 1270 } 1271 /*iir_mem2(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp);*/ 1221 sp[i]=st->excBuf[i]; 1222 iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 1223 st->mem_sp); 1224 for (i=0;i<st->subframeSize;i++) 1225 st->excBuf[i]=exc[i]; 1226 for (i=0;i<st->lpcSize;i++) 1227 st->interp_qlpc[i] = ak[i]; 1272 1228 1273 1229 } … … 1346 1302 break; 1347 1303 case SPEEX_SET_ABR: 1348 st->abr_enabled = (*( int*)ptr);1349 st->vbr_enabled = 1;1304 st->abr_enabled = (*(spx_int32_t*)ptr); 1305 st->vbr_enabled = st->abr_enabled!=0; 1350 1306 speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled); 1307 if (st->vbr_enabled) 1351 1308 { 1352 1309 int i=10, rate, target; 1353 1310 float vbr_qual; 1354 target = (*( int*)ptr);1311 target = (*(spx_int32_t*)ptr); 1355 1312 while (i>=0) 1356 1313 { … … 1372 1329 break; 1373 1330 case SPEEX_GET_ABR: 1374 (*( int*)ptr) = st->abr_enabled;1331 (*(spx_int32_t*)ptr) = st->abr_enabled; 1375 1332 break; 1376 1333 case SPEEX_SET_QUALITY: … … 1398 1355 case SPEEX_SET_BITRATE: 1399 1356 { 1400 int i=10, rate, target; 1401 target = (*(int*)ptr); 1357 int i=10; 1358 spx_int32_t rate, target; 1359 target = (*(spx_int32_t*)ptr); 1402 1360 while (i>=0) 1403 1361 { … … 1414 1372 /*fprintf (stderr, "before: %d\n", (*(int*)ptr));*/ 1415 1373 if (st->submodes[st->submodeID]) 1416 (*( int*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;1374 (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size; 1417 1375 else 1418 (*( int*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;1376 (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size; 1419 1377 /*fprintf (stderr, "after: %d\n", (*(int*)ptr));*/ 1420 1378 break; 1421 1379 case SPEEX_SET_SAMPLING_RATE: 1422 1380 { 1423 int tmp=(*(int*)ptr);1381 spx_int32_t tmp=(*(spx_int32_t*)ptr); 1424 1382 st->sampling_rate = tmp; 1425 1383 tmp>>=1; … … 1428 1386 break; 1429 1387 case SPEEX_GET_SAMPLING_RATE: 1430 (*( int*)ptr)=st->sampling_rate;1388 (*(spx_int32_t*)ptr)=st->sampling_rate; 1431 1389 break; 1432 1390 case SPEEX_RESET_STATE: … … 1455 1413 (*(int*)ptr) = 2*(*(int*)ptr) + QMF_ORDER - 1; 1456 1414 break; 1415 case SPEEX_SET_PLC_TUNING: 1416 speex_encoder_ctl(st->st_low, SPEEX_SET_PLC_TUNING, ptr); 1417 break; 1418 case SPEEX_GET_PLC_TUNING: 1419 speex_encoder_ctl(st->st_low, SPEEX_GET_PLC_TUNING, ptr); 1420 break; 1421 case SPEEX_SET_VBR_MAX_BITRATE: 1422 { 1423 st->vbr_max = (*(spx_int32_t*)ptr); 1424 if (SPEEX_SET_VBR_MAX_BITRATE<1) 1425 { 1426 speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &st->vbr_max); 1427 st->vbr_max_high = 17600; 1428 } else { 1429 spx_int32_t low_rate; 1430 /* FIXME: Need to adapt that to ultra-wideband */ 1431 if (st->vbr_max >= 42200) 1432 { 1433 st->vbr_max_high = 17600; 1434 } else if (st->vbr_max >= 27800) 1435 { 1436 st->vbr_max_high = 9600; 1437 } else if (st->vbr_max > 20600) 1438 { 1439 st->vbr_max_high = 5600; 1440 } else { 1441 st->vbr_max_high = 1800; 1442 } 1443 low_rate = st->vbr_max - st->vbr_max_high; 1444 speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &low_rate); 1445 } 1446 } 1447 break; 1448 case SPEEX_GET_VBR_MAX_BITRATE: 1449 (*(spx_int32_t*)ptr) = st->vbr_max; 1450 break; 1451 1452 1453 /* This is all internal stuff past this point */ 1457 1454 case SPEEX_GET_PI_GAIN: 1458 1455 { … … 1485 1482 case SPEEX_GET_RELATIVE_QUALITY: 1486 1483 (*(float*)ptr)=st->relative_quality; 1484 break; 1485 case SPEEX_SET_INNOVATION_SAVE: 1486 st->innov_save = ptr; 1487 1487 break; 1488 1488 default: … … 1535 1535 speex_decoder_ctl(st->st_low, request, ptr); 1536 1536 if (st->submodes[st->submodeID]) 1537 (*( int*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;1537 (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size; 1538 1538 else 1539 (*( int*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;1539 (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size; 1540 1540 break; 1541 1541 case SPEEX_SET_SAMPLING_RATE: 1542 1542 { 1543 int tmp=(*(int*)ptr);1543 spx_int32_t tmp=(*(spx_int32_t*)ptr); 1544 1544 st->sampling_rate = tmp; 1545 1545 tmp>>=1; … … 1548 1548 break; 1549 1549 case SPEEX_GET_SAMPLING_RATE: 1550 (*( int*)ptr)=st->sampling_rate;1550 (*(spx_int32_t*)ptr)=st->sampling_rate; 1551 1551 break; 1552 1552 case SPEEX_SET_HANDLER: … … 1571 1571 case SPEEX_GET_SUBMODE_ENCODING: 1572 1572 (*(int*)ptr) = st->encode_submode; 1573 break; 1574 case SPEEX_GET_LOOKAHEAD: 1575 speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr); 1576 (*(int*)ptr) = 2*(*(int*)ptr); 1573 1577 break; 1574 1578 case SPEEX_GET_PI_GAIN: … … 1603 1607 speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, ptr); 1604 1608 break; 1609 case SPEEX_SET_INNOVATION_SAVE: 1610 st->innov_save = ptr; 1611 break; 1605 1612 default: 1606 1613 speex_warning_int("Unknown nb_ctl request: ", request);
Note: See TracChangeset
for help on using the changeset viewer.