Lines Matching refs:st
65 #define SUBMODE(x) st->submodes[st->submodeID]->x
116 EncState *st; in nb_encoder_init() local
121 st = (EncState*)speex_alloc(sizeof(EncState)); in nb_encoder_init()
122 if (!st) in nb_encoder_init()
125 st->stack = NULL; in nb_encoder_init()
127 st->stack = (char*)speex_alloc_scratch(NB_ENC_STACK); in nb_encoder_init()
130 st->mode=m; in nb_encoder_init()
132 st->frameSize = mode->frameSize; in nb_encoder_init()
133 st->nbSubframes=mode->frameSize/mode->subframeSize; in nb_encoder_init()
134 st->subframeSize=mode->subframeSize; in nb_encoder_init()
135 st->windowSize = st->frameSize+st->subframeSize; in nb_encoder_init()
136 st->lpcSize = mode->lpcSize; in nb_encoder_init()
137 st->gamma1=mode->gamma1; in nb_encoder_init()
138 st->gamma2=mode->gamma2; in nb_encoder_init()
139 st->min_pitch=mode->pitchStart; in nb_encoder_init()
140 st->max_pitch=mode->pitchEnd; in nb_encoder_init()
141 st->lpc_floor = mode->lpc_floor; in nb_encoder_init()
143 st->submodes=mode->submodes; in nb_encoder_init()
144 st->submodeID=st->submodeSelect=mode->defaultSubmode; in nb_encoder_init()
145 st->bounded_pitch = 1; in nb_encoder_init()
147 st->encode_submode = 1; in nb_encoder_init()
150 st->psy = vorbis_psy_init(8000, 256); in nb_encoder_init()
151 st->curve = (float*)speex_alloc(128*sizeof(float)); in nb_encoder_init()
152 st->old_curve = (float*)speex_alloc(128*sizeof(float)); in nb_encoder_init()
153 st->psy_window = (float*)speex_alloc(256*sizeof(float)); in nb_encoder_init()
156 st->cumul_gain = 1024; in nb_encoder_init()
159 st->winBuf = (spx_word16_t*)speex_alloc((st->windowSize-st->frameSize)*sizeof(spx_word16_t)); in nb_encoder_init()
161 st->excBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t)); in nb_encoder_init()
162 st->exc = st->excBuf + mode->pitchEnd + 2; in nb_encoder_init()
163 st->swBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t)); in nb_encoder_init()
164 st->sw = st->swBuf + mode->pitchEnd + 2; in nb_encoder_init()
166 st->window= lpc_window; in nb_encoder_init()
169 st->lagWindow = lag_window; in nb_encoder_init()
171 st->old_lsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); in nb_encoder_init()
172 st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); in nb_encoder_init()
173 st->first = 1; in nb_encoder_init()
174 for (i=0;i<st->lpcSize;i++) in nb_encoder_init()
175 st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1); in nb_encoder_init()
177 st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); in nb_encoder_init()
178 st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); in nb_encoder_init()
179 st->mem_sw_whole = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); in nb_encoder_init()
180 st->mem_exc = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); in nb_encoder_init()
181 st->mem_exc2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); in nb_encoder_init()
183 st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); in nb_encoder_init()
184 st->innov_rms_save = NULL; in nb_encoder_init()
186 st->pitch = (int*)speex_alloc((st->nbSubframes)*sizeof(int)); in nb_encoder_init()
189 st->vbr = (VBRState*)speex_alloc(sizeof(VBRState)); in nb_encoder_init()
190 vbr_init(st->vbr); in nb_encoder_init()
191 st->vbr_quality = 8; in nb_encoder_init()
192 st->vbr_enabled = 0; in nb_encoder_init()
193 st->vbr_max = 0; in nb_encoder_init()
194 st->vad_enabled = 0; in nb_encoder_init()
195 st->dtx_enabled = 0; in nb_encoder_init()
196 st->dtx_count=0; in nb_encoder_init()
197 st->abr_enabled = 0; in nb_encoder_init()
198 st->abr_drift = 0; in nb_encoder_init()
199 st->abr_drift2 = 0; in nb_encoder_init()
202 st->plc_tuning = 2; in nb_encoder_init()
203 st->complexity=2; in nb_encoder_init()
204 st->sampling_rate=8000; in nb_encoder_init()
205 st->isWideband = 0; in nb_encoder_init()
206 st->highpass_enabled = 1; in nb_encoder_init()
209 VALGRIND_MAKE_READABLE(st, NB_ENC_STACK); in nb_encoder_init()
211 return st; in nb_encoder_init()
216 EncState *st=(EncState *)state; in nb_encoder_destroy() local
219 speex_free_scratch(st->stack); in nb_encoder_destroy()
222 speex_free (st->winBuf); in nb_encoder_destroy()
223 speex_free (st->excBuf); in nb_encoder_destroy()
224 speex_free (st->old_qlsp); in nb_encoder_destroy()
225 speex_free (st->swBuf); in nb_encoder_destroy()
227 speex_free (st->old_lsp); in nb_encoder_destroy()
228 speex_free (st->mem_sp); in nb_encoder_destroy()
229 speex_free (st->mem_sw); in nb_encoder_destroy()
230 speex_free (st->mem_sw_whole); in nb_encoder_destroy()
231 speex_free (st->mem_exc); in nb_encoder_destroy()
232 speex_free (st->mem_exc2); in nb_encoder_destroy()
233 speex_free (st->pi_gain); in nb_encoder_destroy()
234 speex_free (st->pitch); in nb_encoder_destroy()
237 vbr_destroy(st->vbr); in nb_encoder_destroy()
238 speex_free (st->vbr); in nb_encoder_destroy()
242 vorbis_psy_destroy(st->psy); in nb_encoder_destroy()
243 speex_free (st->curve); in nb_encoder_destroy()
244 speex_free (st->old_curve); in nb_encoder_destroy()
245 speex_free (st->psy_window); in nb_encoder_destroy()
249 speex_free(st); in nb_encoder_destroy()
254 EncState *st; in nb_encode() local
281 st=(EncState *)state; in nb_encode()
282 stack=st->stack; in nb_encode()
284 ALLOC(lpc, st->lpcSize, spx_coef_t); in nb_encode()
285 ALLOC(bw_lpc1, st->lpcSize, spx_coef_t); in nb_encode()
286 ALLOC(bw_lpc2, st->lpcSize, spx_coef_t); in nb_encode()
287 ALLOC(lsp, st->lpcSize, spx_lsp_t); in nb_encode()
288 ALLOC(qlsp, st->lpcSize, spx_lsp_t); in nb_encode()
289 ALLOC(interp_lsp, st->lpcSize, spx_lsp_t); in nb_encode()
290 ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t); in nb_encode()
291 ALLOC(interp_lpc, st->lpcSize, spx_coef_t); in nb_encode()
292 ALLOC(interp_qlpc, st->lpcSize, spx_coef_t); in nb_encode()
295 SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, st->max_pitch+2); in nb_encode()
296 SPEEX_MOVE(st->swBuf, st->swBuf+st->frameSize, st->max_pitch+2); in nb_encode()
298 if (st->highpass_enabled) in nb_encode()
299 …highpass(in, in, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_IN… in nb_encode()
304 ALLOC(w_sig, st->windowSize, spx_word16_t); in nb_encode()
305 ALLOC(autocorr, st->lpcSize+1, spx_word16_t); in nb_encode()
307 for (i=0;i<st->windowSize-st->frameSize;i++) in nb_encode()
308 w_sig[i] = EXTRACT16(SHR32(MULT16_16(st->winBuf[i],st->window[i]),SIG_SHIFT)); in nb_encode()
309 for (;i<st->windowSize;i++) in nb_encode()
310 …w_sig[i] = EXTRACT16(SHR32(MULT16_16(in[i-st->windowSize+st->frameSize],st->window[i]),SIG_SHIFT)); in nb_encode()
312 _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize); in nb_encode()
313 …autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-… in nb_encode()
316 for (i=0;i<st->lpcSize+1;i++) in nb_encode()
317 autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]); in nb_encode()
320 _spx_lpc(lpc, autocorr, st->lpcSize); in nb_encode()
322 roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack); in nb_encode()
324 if (roots!=st->lpcSize) in nb_encode()
327 for (i=0;i<st->lpcSize;i++) in nb_encode()
329 lsp[i]=st->old_lsp[i]; in nb_encode()
339 int diff = st->windowSize-st->frameSize; in nb_encode()
340 if (st->first) in nb_encode()
341 for (i=0;i<st->lpcSize;i++) in nb_encode()
344 … lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, st->nbSubframes, st->nbSubframes<<1); in nb_encode()
346 lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN); in nb_encode()
349 lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack); in nb_encode()
353 …if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE… in nb_encode()
355 || st->vbr_enabled || st->vad_enabled in nb_encode()
362 bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize); in nb_encode()
363 bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize); in nb_encode()
365 SPEEX_COPY(st->sw, st->winBuf, diff); in nb_encode()
366 SPEEX_COPY(st->sw+diff, in, st->frameSize-diff); in nb_encode()
367 …filter_mem16(st->sw, bw_lpc1, bw_lpc2, st->sw, st->frameSize, st->lpcSize, st->mem_sw_whole, stack… in nb_encode()
369 open_loop_nbest_pitch(st->sw, st->min_pitch, st->max_pitch, st->frameSize, in nb_encode()
398 SPEEX_COPY(st->exc, st->winBuf, diff); in nb_encode()
399 SPEEX_COPY(st->exc+diff, in, st->frameSize-diff); in nb_encode()
400 fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack); in nb_encode()
404 spx_word16_t g = compute_rms16(st->exc, st->frameSize); in nb_encode()
405 if (st->submodeID!=1 && ol_pitch>0) in nb_encode()
414 SPEEX_MOVE(st->psy_window, st->psy_window+st->frameSize, 256-st->frameSize); in nb_encode()
415 SPEEX_COPY(&st->psy_window[256-st->frameSize], in, st->frameSize); in nb_encode()
416 compute_curve(st->psy, st->psy_window, st->curve); in nb_encode()
418 if (st->first) in nb_encode()
419 SPEEX_COPY(st->old_curve, st->curve, 128); in nb_encode()
424 if (st->vbr && (st->vbr_enabled||st->vad_enabled)) in nb_encode()
427 for (i=0;i<st->lpcSize;i++) in nb_encode()
428 lsp_dist += (st->old_lsp[i] - lsp[i])*(st->old_lsp[i] - lsp[i]); in nb_encode()
431 if (st->abr_enabled) in nb_encode()
434 if (st->abr_drift2 * st->abr_drift > 0) in nb_encode()
437 qual_change = -.00001*st->abr_drift/(1+st->abr_count); in nb_encode()
443 st->vbr_quality += qual_change; in nb_encode()
444 if (st->vbr_quality>10) in nb_encode()
445 st->vbr_quality=10; in nb_encode()
446 if (st->vbr_quality<0) in nb_encode()
447 st->vbr_quality=0; in nb_encode()
450 …st->relative_quality = vbr_analysis(st->vbr, in, st->frameSize, ol_pitch, GAIN_SCALING_1*ol_pitch_… in nb_encode()
453 if (st->vbr_enabled) in nb_encode()
463 v1=(int)floor(st->vbr_quality); in nb_encode()
467 …thresh = (st->vbr_quality-v1)*vbr_nb_thresh[mode][v1+1] + (1+v1-st->vbr_quality)*vbr_nb_thresh[mod… in nb_encode()
468 if (st->relative_quality > thresh && in nb_encode()
469 st->relative_quality-thresh<min_diff) in nb_encode()
472 min_diff = st->relative_quality-thresh; in nb_encode()
479 if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20) in nb_encode()
482 st->dtx_count=1; in nb_encode()
485 st->dtx_count++; in nb_encode()
488 st->dtx_count=0; in nb_encode()
492 if (st->vbr_max>0) in nb_encode()
496 if (rate > st->vbr_max) in nb_encode()
498 rate = st->vbr_max; in nb_encode()
503 if (st->abr_enabled) in nb_encode()
507 st->abr_drift+=(bitrate-st->abr_enabled); in nb_encode()
508 st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled); in nb_encode()
509 st->abr_count += 1.0; in nb_encode()
515 if (st->relative_quality<2) in nb_encode()
517 if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20) in nb_encode()
519 st->dtx_count=1; in nb_encode()
523 st->dtx_count++; in nb_encode()
526 st->dtx_count = 0; in nb_encode()
527 mode=st->submodeSelect; in nb_encode()
530 st->submodeID=mode; in nb_encode()
533 st->relative_quality = -1; in nb_encode()
537 if (st->encode_submode) in nb_encode()
543 speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS); in nb_encode()
548 if (st->submodes[st->submodeID] == NULL) in nb_encode()
550 for (i=0;i<st->frameSize;i++) in nb_encode()
551 st->exc[i]=st->sw[i]=VERY_SMALL; in nb_encode()
553 for (i=0;i<st->lpcSize;i++) in nb_encode()
554 st->mem_sw[i]=0; in nb_encode()
555 st->first=1; in nb_encode()
556 st->bounded_pitch = 1; in nb_encode()
558 SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize); in nb_encode()
561 for (i=0;i<st->lpcSize;i++) in nb_encode()
562 st->mem_sp[i] = 0; in nb_encode()
568 if (st->first) in nb_encode()
570 for (i=0;i<st->lpcSize;i++) in nb_encode()
571 st->old_lsp[i] = lsp[i]; in nb_encode()
577 SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits); in nb_encode()
579 for (i=0;i<st->lpcSize;i++) in nb_encode()
586 speex_bits_pack(bits, ol_pitch-st->min_pitch, 7); in nb_encode()
631 if (st->first) in nb_encode()
633 for (i=0;i<st->lpcSize;i++) in nb_encode()
634 st->old_qlsp[i] = qlsp[i]; in nb_encode()
638 ALLOC(target, st->subframeSize, spx_word16_t); in nb_encode()
639 ALLOC(innov, st->subframeSize, spx_sig_t); in nb_encode()
640 ALLOC(exc32, st->subframeSize, spx_word32_t); in nb_encode()
641 ALLOC(ringing, st->subframeSize, spx_word16_t); in nb_encode()
642 ALLOC(syn_resp, st->subframeSize, spx_word16_t); in nb_encode()
643 ALLOC(real_exc, st->subframeSize, spx_word16_t); in nb_encode()
644 ALLOC(mem, st->lpcSize, spx_mem_t); in nb_encode()
647 for (sub=0;sub<st->nbSubframes;sub++) in nb_encode()
653 int response_bound = st->subframeSize; in nb_encode()
656 offset = st->subframeSize*sub; in nb_encode()
658 exc=st->exc+offset; in nb_encode()
660 sw=st->sw+offset; in nb_encode()
663 lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes); in nb_encode()
664 lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); in nb_encode()
667 lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN); in nb_encode()
668 lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN); in nb_encode()
671 lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack); in nb_encode()
673 lsp_to_lpc(interp_qlsp, interp_qlpc, st->lpcSize, stack); in nb_encode()
678 for (i=0;i<st->lpcSize;i+=2) in nb_encode()
683 st->pi_gain[sub] = pi_g; in nb_encode()
689 float fact = ((float)sub+1.0f)/st->nbSubframes; in nb_encode()
691 curr_curve[i] = (1.0f-fact)*st->old_curve[i] + fact*st->curve[i]; in nb_encode()
692 curve_to_lpc(st->psy, curr_curve, bw_lpc1, bw_lpc2, 10); in nb_encode()
696 bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize); in nb_encode()
697 if (st->gamma2>=0) in nb_encode()
698 bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize); in nb_encode()
701 for (i=0;i<st->lpcSize;i++) in nb_encode()
708 speex_assert(st->windowSize-st->frameSize == st->subframeSize); in nb_encode()
711 for (i=0;i<st->subframeSize;i++) in nb_encode()
712 real_exc[i] = sw[i] = st->winBuf[i]; in nb_encode()
714 for (i=0;i<st->subframeSize;i++) in nb_encode()
715 real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)]; in nb_encode()
717 … fir_mem16(real_exc, interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2, stack); in nb_encode()
719 if (st->complexity==0) in nb_encode()
721 …compute_impulse_response(interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, response_bound, st->lpcSize, sta… in nb_encode()
722 for (i=response_bound;i<st->subframeSize;i++) in nb_encode()
726 for (i=0;i<st->lpcSize;i++) in nb_encode()
727 mem[i]=SHL32(st->mem_sp[i],1); in nb_encode()
728 for (i=0;i<st->subframeSize;i++) in nb_encode()
731 iir_mem16(ringing, interp_qlpc, ringing, response_bound, st->lpcSize, mem, stack); in nb_encode()
732 for (i=0;i<st->lpcSize;i++) in nb_encode()
733 mem[i]=SHL32(st->mem_sw[i],1); in nb_encode()
734 … filter_mem16(ringing, st->bw_lpc1, st->bw_lpc2, ringing, response_bound, st->lpcSize, mem, stack); in nb_encode()
735 SPEEX_MEMSET(&ringing[response_bound], 0, st->subframeSize-response_bound); in nb_encode()
737 iir_mem16(ringing, interp_qlpc, ringing, st->subframeSize, st->lpcSize, mem, stack); in nb_encode()
738 for (i=0;i<st->lpcSize;i++) in nb_encode()
739 mem[i]=SHL32(st->mem_sw[i],1); in nb_encode()
740 filter_mem16(ringing, bw_lpc1, bw_lpc2, ringing, st->subframeSize, st->lpcSize, mem, stack); in nb_encode()
744 for (i=0;i<st->lpcSize;i++) in nb_encode()
745 mem[i]=st->mem_sw[i]; in nb_encode()
746 filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack); in nb_encode()
748 if (st->complexity==0) in nb_encode()
749 for (i=0;i<st->lpcSize;i++) in nb_encode()
750 st->mem_sw[i]=mem[i]; in nb_encode()
753 for (i=0;i<st->subframeSize;i++) in nb_encode()
757 SPEEX_MEMSET(exc, 0, st->subframeSize); in nb_encode()
771 if (ol_pitch < st->min_pitch+margin-1) in nb_encode()
772 ol_pitch=st->min_pitch+margin-1; in nb_encode()
773 if (ol_pitch > st->max_pitch-margin) in nb_encode()
774 ol_pitch=st->max_pitch-margin; in nb_encode()
781 pit_min = st->min_pitch; in nb_encode()
782 pit_max = st->max_pitch; in nb_encode()
786 if (st->bounded_pitch && pit_max>offset) in nb_encode()
792 st->lpcSize, st->subframeSize, bits, stack, in nb_encode()
793 … exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain); in nb_encode()
795 st->pitch[sub]=pitch; in nb_encode()
798 SPEEX_MEMSET(innov, 0, st->subframeSize); in nb_encode()
801 for (i=0;i<st->subframeSize;i++) in nb_encode()
804 ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT); in nb_encode()
839 signal_div(target, target, ener, st->subframeSize); in nb_encode()
846 SUBMODE(innovation_params), st->lpcSize, st->subframeSize, in nb_encode()
847 innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook)); in nb_encode()
850 signal_mul(innov, innov, ener, st->subframeSize); in nb_encode()
852 for (i=0;i<st->subframeSize;i++) in nb_encode()
859 ALLOC(innov2, st->subframeSize, spx_sig_t); in nb_encode()
860 SPEEX_MEMSET(innov2, 0, st->subframeSize); in nb_encode()
861 for (i=0;i<st->subframeSize;i++) in nb_encode()
864 SUBMODE(innovation_params), st->lpcSize, st->subframeSize, in nb_encode()
865 innov2, syn_resp, bits, stack, st->complexity, 0); in nb_encode()
866 … signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize); in nb_encode()
867 for (i=0;i<st->subframeSize;i++) in nb_encode()
871 for (i=0;i<st->subframeSize;i++) in nb_encode()
873 if (st->innov_rms_save) in nb_encode()
875 st->innov_rms_save[sub] = compute_rms(innov, st->subframeSize); in nb_encode()
880 iir_mem16(exc, interp_qlpc, sw, st->subframeSize, st->lpcSize, st->mem_sp, stack); in nb_encode()
883 if (st->complexity!=0) in nb_encode()
884 filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack); in nb_encode()
889 if (st->submodeID>=1) in nb_encode()
891 for (i=0;i<st->lpcSize;i++) in nb_encode()
892 st->old_lsp[i] = lsp[i]; in nb_encode()
893 for (i=0;i<st->lpcSize;i++) in nb_encode()
894 st->old_qlsp[i] = qlsp[i]; in nb_encode()
898 if (st->submodeID>=1) in nb_encode()
899 SPEEX_COPY(st->old_curve, st->curve, 128); in nb_encode()
902 if (st->submodeID==1) in nb_encode()
905 if (st->dtx_count) in nb_encode()
913 st->first = 0; in nb_encode()
914 SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize); in nb_encode()
916 if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0) in nb_encode()
917 st->bounded_pitch = 1; in nb_encode()
919 st->bounded_pitch = 0; in nb_encode()
926 DecState *st; in nb_decoder_init() local
931 st = (DecState *)speex_alloc(sizeof(DecState)); in nb_decoder_init()
932 if (!st) in nb_decoder_init()
935 st->stack = NULL; in nb_decoder_init()
937 st->stack = (char*)speex_alloc_scratch(NB_DEC_STACK); in nb_decoder_init()
940 st->mode=m; in nb_decoder_init()
943 st->encode_submode = 1; in nb_decoder_init()
945 st->first=1; in nb_decoder_init()
947 st->frameSize = mode->frameSize; in nb_decoder_init()
948 st->nbSubframes=mode->frameSize/mode->subframeSize; in nb_decoder_init()
949 st->subframeSize=mode->subframeSize; in nb_decoder_init()
950 st->lpcSize = mode->lpcSize; in nb_decoder_init()
951 st->min_pitch=mode->pitchStart; in nb_decoder_init()
952 st->max_pitch=mode->pitchEnd; in nb_decoder_init()
954 st->submodes=mode->submodes; in nb_decoder_init()
955 st->submodeID=mode->defaultSubmode; in nb_decoder_init()
957 st->lpc_enh_enabled=1; in nb_decoder_init()
959 …st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*… in nb_decoder_init()
960 st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6; in nb_decoder_init()
961 SPEEX_MEMSET(st->excBuf, 0, st->frameSize + st->max_pitch); in nb_decoder_init()
963 st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); in nb_decoder_init()
964 st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); in nb_decoder_init()
965 st->mem_sp = (spx_mem_t*)speex_alloc(st->lpcSize*sizeof(spx_mem_t)); in nb_decoder_init()
966 st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); in nb_decoder_init()
967 st->last_pitch = 40; in nb_decoder_init()
968 st->count_lost=0; in nb_decoder_init()
969 st->pitch_gain_buf[0] = st->pitch_gain_buf[1] = st->pitch_gain_buf[2] = 0; in nb_decoder_init()
970 st->pitch_gain_buf_idx = 0; in nb_decoder_init()
971 st->seed = 1000; in nb_decoder_init()
973 st->sampling_rate=8000; in nb_decoder_init()
974 st->last_ol_gain = 0; in nb_decoder_init()
976 st->user_callback.func = &speex_default_user_handler; in nb_decoder_init()
977 st->user_callback.data = NULL; in nb_decoder_init()
979 st->speex_callbacks[i].func = NULL; in nb_decoder_init()
981 st->voc_m1=st->voc_m2=st->voc_mean=0; in nb_decoder_init()
982 st->voc_offset=0; in nb_decoder_init()
983 st->dtx_enabled=0; in nb_decoder_init()
984 st->isWideband = 0; in nb_decoder_init()
985 st->highpass_enabled = 1; in nb_decoder_init()
988 VALGRIND_MAKE_READABLE(st, NB_DEC_STACK); in nb_decoder_init()
990 return st; in nb_decoder_init()
995 DecState *st; in nb_decoder_destroy() local
996 st=(DecState*)state; in nb_decoder_destroy()
999 speex_free_scratch(st->stack); in nb_decoder_destroy()
1002 speex_free (st->excBuf); in nb_decoder_destroy()
1003 speex_free (st->interp_qlpc); in nb_decoder_destroy()
1004 speex_free (st->old_qlsp); in nb_decoder_destroy()
1005 speex_free (st->mem_sp); in nb_decoder_destroy()
1006 speex_free (st->pi_gain); in nb_decoder_destroy()
1020 static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack) in nb_decode_lost() argument
1030 if (st->count_lost<10) in nb_decode_lost()
1031 fact = attenuation[st->count_lost]; in nb_decode_lost()
1035 gain_med = median3(st->pitch_gain_buf[0], st->pitch_gain_buf[1], st->pitch_gain_buf[2]); in nb_decode_lost()
1036 if (gain_med < st->last_pitch_gain) in nb_decode_lost()
1037 st->last_pitch_gain = gain_med; in nb_decode_lost()
1040 pitch_gain = st->last_pitch_gain; in nb_decode_lost()
1045 pitch_gain = GAIN_SCALING_1*st->last_pitch_gain; in nb_decode_lost()
1051 innov_gain = compute_rms16(st->exc, st->frameSize); in nb_decode_lost()
1054 SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12); in nb_decode_lost()
1057 …pitch_val = st->last_pitch + SHR32((spx_int32_t)speex_rand(1+st->count_lost, &st->seed),SIG_SHIFT); in nb_decode_lost()
1058 if (pitch_val > st->max_pitch) in nb_decode_lost()
1059 pitch_val = st->max_pitch; in nb_decode_lost()
1060 if (pitch_val < st->min_pitch) in nb_decode_lost()
1061 pitch_val = st->min_pitch; in nb_decode_lost()
1062 for (i=0;i<st->frameSize;i++) in nb_decode_lost()
1064 st->exc[i]= MULT16_16_Q15(pitch_gain, (st->exc[i-pitch_val]+VERY_SMALL)) + in nb_decode_lost()
1065 speex_rand(noise_gain, &st->seed); in nb_decode_lost()
1068 bw_lpc(QCONST16(.98,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize); in nb_decode_lost()
1069 iir_mem16(&st->exc[-st->subframeSize], st->interp_qlpc, out, st->frameSize, in nb_decode_lost()
1070 st->lpcSize, st->mem_sp, stack); in nb_decode_lost()
1071 highpass(out, out, st->frameSize, HIGHPASS_NARROWBAND|HIGHPASS_OUTPUT, st->mem_hp); in nb_decode_lost()
1073 st->first = 0; in nb_decode_lost()
1074 st->count_lost++; in nb_decode_lost()
1075 st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR16(pitch_gain,9); in nb_decode_lost()
1076 if (st->pitch_gain_buf_idx > 2) /* rollover */ in nb_decode_lost()
1077 st->pitch_gain_buf_idx = 0; in nb_decode_lost()
1085 DecState *st; in nb_decode() local
1106 st=(DecState*)state; in nb_decode()
1107 stack=st->stack; in nb_decode()
1110 if (!bits && st->dtx_enabled) in nb_decode()
1112 st->submodeID=0; in nb_decode()
1118 nb_decode_lost(st, out, stack); in nb_decode()
1122 if (st->encode_submode) in nb_decode()
1178 int ret = speex_inband_handler(bits, st->speex_callbacks, state); in nb_decode()
1183 int ret = st->user_callback.func(bits, state, st->user_callback.data); in nb_decode()
1195 st->submodeID = m; in nb_decode()
1201 SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12); in nb_decode()
1204 if (st->submodes[st->submodeID] == NULL) in nb_decode()
1207 ALLOC(lpc, st->lpcSize, spx_coef_t); in nb_decode()
1208 bw_lpc(QCONST16(0.93f,15), st->interp_qlpc, lpc, st->lpcSize); in nb_decode()
1212 innov_gain = compute_rms16(st->exc, st->frameSize); in nb_decode()
1213 for (i=0;i<st->frameSize;i++) in nb_decode()
1214 st->exc[i]=speex_rand(innov_gain, &st->seed); in nb_decode()
1218 st->first=1; in nb_decode()
1221 iir_mem16(st->exc, lpc, out, st->frameSize, st->lpcSize, st->mem_sp, stack); in nb_decode()
1223 st->count_lost=0; in nb_decode()
1227 ALLOC(qlsp, st->lpcSize, spx_lsp_t); in nb_decode()
1230 SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits); in nb_decode()
1233 if (st->count_lost) in nb_decode()
1237 for (i=0;i<st->lpcSize;i++) in nb_decode()
1238 lsp_dist = ADD32(lsp_dist, EXTEND32(ABS(st->old_qlsp[i] - qlsp[i]))); in nb_decode()
1244 for (i=0;i<st->lpcSize;i++) in nb_decode()
1245 st->mem_sp[i] = MULT16_32_Q15(fact,st->mem_sp[i]); in nb_decode()
1250 if (st->first || st->count_lost) in nb_decode()
1252 for (i=0;i<st->lpcSize;i++) in nb_decode()
1253 st->old_qlsp[i] = qlsp[i]; in nb_decode()
1259 ol_pitch = st->min_pitch+speex_bits_unpack_unsigned(bits, 7); in nb_decode()
1281 ALLOC(ak, st->lpcSize, spx_coef_t); in nb_decode()
1282 ALLOC(innov, st->subframeSize, spx_sig_t); in nb_decode()
1283 ALLOC(exc32, st->subframeSize, spx_word32_t); in nb_decode()
1285 if (st->submodeID==1) in nb_decode()
1291 st->dtx_enabled=1; in nb_decode()
1293 st->dtx_enabled=0; in nb_decode()
1295 if (st->submodeID>1) in nb_decode()
1296 st->dtx_enabled=0; in nb_decode()
1299 for (sub=0;sub<st->nbSubframes;sub++) in nb_decode()
1308 offset = st->subframeSize*sub; in nb_decode()
1310 exc=st->exc+offset; in nb_decode()
1313 if (st->innov_save) in nb_decode()
1314 innov_save = st->innov_save+offset; in nb_decode()
1318 SPEEX_MEMSET(exc, 0, st->subframeSize); in nb_decode()
1340 if (pit_min < st->min_pitch) in nb_decode()
1341 pit_min = st->min_pitch; in nb_decode()
1343 if (pit_max > st->max_pitch) in nb_decode()
1344 pit_max = st->max_pitch; in nb_decode()
1349 pit_min = st->min_pitch; in nb_decode()
1350 pit_max = st->max_pitch; in nb_decode()
1356 st->subframeSize, &pitch, &pitch_gain[0], bits, stack, in nb_decode()
1357 st->count_lost, offset, st->last_pitch_gain, 0); in nb_decode()
1362 …values32(exc32, NEG32(QCONST32(32000,SIG_SHIFT-1)), QCONST32(32000,SIG_SHIFT-1), st->subframeSize); in nb_decode()
1382 SPEEX_MEMSET(innov, 0, st->subframeSize); in nb_decode()
1400 …ODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->see… in nb_decode()
1403 signal_mul(innov, innov, ener, st->subframeSize); in nb_decode()
1410 ALLOC(innov2, st->subframeSize, spx_sig_t); in nb_decode()
1411 SPEEX_MEMSET(innov2, 0, st->subframeSize); in nb_decode()
1412 …DE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->see… in nb_decode()
1413 … signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize); in nb_decode()
1414 for (i=0;i<st->subframeSize;i++) in nb_decode()
1418 for (i=0;i<st->subframeSize;i++) in nb_decode()
1423 for (i=0;i<st->subframeSize;i++) in nb_decode()
1429 if (st->submodeID==1) in nb_decode()
1438 SPEEX_MEMSET(exc, 0, st->subframeSize); in nb_decode()
1439 while (st->voc_offset<st->subframeSize) in nb_decode()
1443 if (st->voc_offset>=0) in nb_decode()
1444 …exc[st->voc_offset]=MULT16_16(spx_sqrt(MULT16_16_16(2,ol_pitch)),EXTRACT16(PSHR32(MULT16_16(g,PSHR… in nb_decode()
1445 st->voc_offset+=ol_pitch; in nb_decode()
1447 st->voc_offset -= st->subframeSize; in nb_decode()
1449 for (i=0;i<st->subframeSize;i++) in nb_decode()
1452 …= ADD16(ADD16(MULT16_16_Q15(QCONST16(.7f,15),exc[i]) , MULT16_16_Q15(QCONST16(.3f,15),st->voc_m1)), in nb_decode()
1454 … MULT16_16_Q15(MULT16_16_16(QCONST16(.15f,9),g),EXTRACT16(PSHR32(st->voc_m2,SIG_SHIFT))) in nb_decode()
1456 st->voc_m1 = exci; in nb_decode()
1457 st->voc_m2=innov[i]; in nb_decode()
1458 …st->voc_mean = EXTRACT16(PSHR32(ADD32(MULT16_16(QCONST16(.8f,15),st->voc_mean), MULT16_16(QCONST16… in nb_decode()
1459 exc[i]-=st->voc_mean; in nb_decode()
1466 ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t); in nb_decode()
1468 if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost) in nb_decode()
1470 …multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pi… in nb_decode()
1471 …multicomb(st->exc+st->subframeSize, out+2*st->subframeSize, st->interp_qlpc, st->lpcSize, 2*st->su… in nb_decode()
1473 SPEEX_COPY(out, &st->exc[-st->subframeSize], st->frameSize); in nb_decode()
1477 if (st->count_lost) in nb_decode()
1482 exc_ener = compute_rms16 (st->exc, st->frameSize); in nb_decode()
1493 for (i=0;i<st->frameSize;i++) in nb_decode()
1495 st->exc[i] = MULT16_16_Q14(gain, st->exc[i]); in nb_decode()
1496 out[i]=st->exc[i-st->subframeSize]; in nb_decode()
1501 for (sub=0;sub<st->nbSubframes;sub++) in nb_decode()
1507 offset = st->subframeSize*sub; in nb_decode()
1511 exc=st->exc+offset; in nb_decode()
1514 lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); in nb_decode()
1517 lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN); in nb_decode()
1520 lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack); in nb_decode()
1525 for (i=0;i<st->lpcSize;i+=2) in nb_decode()
1530 st->pi_gain[sub] = pi_g; in nb_decode()
1533 iir_mem16(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, in nb_decode()
1534 st->mem_sp, stack); in nb_decode()
1536 for (i=0;i<st->lpcSize;i++) in nb_decode()
1537 st->interp_qlpc[i] = ak[i]; in nb_decode()
1541 if (st->highpass_enabled) in nb_decode()
1542 …highpass(out, out, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_… in nb_decode()
1547 st->level = 1+PSHR32(ol_gain,SIG_SHIFT); in nb_decode()
1548 st->max_level = MAX16(MULT16_16_Q15(QCONST16(.99f,15), st->max_level), st->level); in nb_decode()
1549 st->min_level = MIN16(ADD16(1,MULT16_16_Q14(QCONST16(1.01f,14), st->min_level)), st->level); in nb_decode()
1550 if (st->max_level < st->min_level+1) in nb_decode()
1551 st->max_level = st->min_level+1; in nb_decode()
1555 for (i=0;i<st->lpcSize;i++) in nb_decode()
1556 st->old_qlsp[i] = qlsp[i]; in nb_decode()
1559 st->first = 0; in nb_decode()
1560 st->count_lost=0; in nb_decode()
1561 st->last_pitch = best_pitch; in nb_decode()
1563 st->last_pitch_gain = PSHR16(pitch_average,2); in nb_decode()
1565 st->last_pitch_gain = .25*pitch_average; in nb_decode()
1567 st->pitch_gain_buf[st->pitch_gain_buf_idx++] = st->last_pitch_gain; in nb_decode()
1568 if (st->pitch_gain_buf_idx > 2) /* rollover */ in nb_decode()
1569 st->pitch_gain_buf_idx = 0; in nb_decode()
1571 st->last_ol_gain = ol_gain; in nb_decode()
1578 EncState *st; in nb_encoder_ctl() local
1579 st=(EncState*)state; in nb_encoder_ctl()
1583 (*(spx_int32_t*)ptr) = st->frameSize; in nb_encoder_ctl()
1587 st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1591 (*(spx_int32_t*)ptr) = st->submodeID; in nb_encoder_ctl()
1595 st->vbr_enabled = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1598 (*(spx_int32_t*)ptr) = st->vbr_enabled; in nb_encoder_ctl()
1601 st->vad_enabled = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1604 (*(spx_int32_t*)ptr) = st->vad_enabled; in nb_encoder_ctl()
1607 st->dtx_enabled = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1610 (*(spx_int32_t*)ptr) = st->dtx_enabled; in nb_encoder_ctl()
1613 st->abr_enabled = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1614 st->vbr_enabled = st->abr_enabled!=0; in nb_encoder_ctl()
1615 if (st->vbr_enabled) in nb_encoder_ctl()
1623 speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i); in nb_encoder_ctl()
1624 speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate); in nb_encoder_ctl()
1632 speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual); in nb_encoder_ctl()
1633 st->abr_count=0; in nb_encoder_ctl()
1634 st->abr_drift=0; in nb_encoder_ctl()
1635 st->abr_drift2=0; in nb_encoder_ctl()
1640 (*(spx_int32_t*)ptr) = st->abr_enabled; in nb_encoder_ctl()
1645 st->vbr_quality = (*(float*)ptr); in nb_encoder_ctl()
1648 (*(float*)ptr) = st->vbr_quality; in nb_encoder_ctl()
1658 … st->submodeSelect = st->submodeID = ((const SpeexNBMode*)(st->mode->mode))->quality_map[quality]; in nb_encoder_ctl()
1662 st->complexity = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1663 if (st->complexity<0) in nb_encoder_ctl()
1664 st->complexity=0; in nb_encoder_ctl()
1667 (*(spx_int32_t*)ptr) = st->complexity; in nb_encoder_ctl()
1676 speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i); in nb_encoder_ctl()
1677 speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate); in nb_encoder_ctl()
1685 if (st->submodes[st->submodeID]) in nb_encoder_ctl()
1686 (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize; in nb_encoder_ctl()
1688 (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize; in nb_encoder_ctl()
1691 st->sampling_rate = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1694 (*(spx_int32_t*)ptr)=st->sampling_rate; in nb_encoder_ctl()
1699 st->bounded_pitch = 1; in nb_encoder_ctl()
1700 st->first = 1; in nb_encoder_ctl()
1701 for (i=0;i<st->lpcSize;i++) in nb_encoder_ctl()
1702 st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1); in nb_encoder_ctl()
1703 for (i=0;i<st->lpcSize;i++) in nb_encoder_ctl()
1704 st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0; in nb_encoder_ctl()
1705 for (i=0;i<st->frameSize+st->max_pitch+1;i++) in nb_encoder_ctl()
1706 st->excBuf[i]=st->swBuf[i]=0; in nb_encoder_ctl()
1707 for (i=0;i<st->windowSize-st->frameSize;i++) in nb_encoder_ctl()
1708 st->winBuf[i]=0; in nb_encoder_ctl()
1712 st->encode_submode = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1715 (*(spx_int32_t*)ptr) = st->encode_submode; in nb_encoder_ctl()
1718 (*(spx_int32_t*)ptr)=(st->windowSize-st->frameSize); in nb_encoder_ctl()
1721 st->plc_tuning = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1722 if (st->plc_tuning>100) in nb_encoder_ctl()
1723 st->plc_tuning=100; in nb_encoder_ctl()
1726 (*(spx_int32_t*)ptr)=(st->plc_tuning); in nb_encoder_ctl()
1730 st->vbr_max = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1733 (*(spx_int32_t*)ptr) = st->vbr_max; in nb_encoder_ctl()
1737 st->highpass_enabled = (*(spx_int32_t*)ptr); in nb_encoder_ctl()
1740 (*(spx_int32_t*)ptr) = st->highpass_enabled; in nb_encoder_ctl()
1748 for (i=0;i<st->nbSubframes;i++) in nb_encoder_ctl()
1749 g[i]=st->pi_gain[i]; in nb_encoder_ctl()
1755 for (i=0;i<st->nbSubframes;i++) in nb_encoder_ctl()
1756 ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize); in nb_encoder_ctl()
1761 (*(float*)ptr)=st->relative_quality; in nb_encoder_ctl()
1765 st->innov_rms_save = (spx_word16_t*)ptr; in nb_encoder_ctl()
1768 st->isWideband = *((spx_int32_t*)ptr); in nb_encoder_ctl()
1771 *((char**)ptr) = st->stack; in nb_encoder_ctl()
1782 DecState *st; in nb_decoder_ctl() local
1783 st=(DecState*)state; in nb_decoder_ctl()
1788 st->submodeID = (*(spx_int32_t*)ptr); in nb_decoder_ctl()
1792 (*(spx_int32_t*)ptr) = st->submodeID; in nb_decoder_ctl()
1795 st->lpc_enh_enabled = *((spx_int32_t*)ptr); in nb_decoder_ctl()
1798 *((spx_int32_t*)ptr) = st->lpc_enh_enabled; in nb_decoder_ctl()
1801 (*(spx_int32_t*)ptr) = st->frameSize; in nb_decoder_ctl()
1804 if (st->submodes[st->submodeID]) in nb_decoder_ctl()
1805 (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize; in nb_decoder_ctl()
1807 (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize; in nb_decoder_ctl()
1810 st->sampling_rate = (*(spx_int32_t*)ptr); in nb_decoder_ctl()
1813 (*(spx_int32_t*)ptr)=st->sampling_rate; in nb_decoder_ctl()
1818 st->speex_callbacks[c->callback_id].func=c->func; in nb_decoder_ctl()
1819 st->speex_callbacks[c->callback_id].data=c->data; in nb_decoder_ctl()
1820 st->speex_callbacks[c->callback_id].callback_id=c->callback_id; in nb_decoder_ctl()
1826 st->user_callback.func=c->func; in nb_decoder_ctl()
1827 st->user_callback.data=c->data; in nb_decoder_ctl()
1828 st->user_callback.callback_id=c->callback_id; in nb_decoder_ctl()
1834 for (i=0;i<st->lpcSize;i++) in nb_decoder_ctl()
1835 st->mem_sp[i]=0; in nb_decoder_ctl()
1836 for (i=0;i<st->frameSize + st->max_pitch + 1;i++) in nb_decoder_ctl()
1837 st->excBuf[i]=0; in nb_decoder_ctl()
1841 st->encode_submode = (*(spx_int32_t*)ptr); in nb_decoder_ctl()
1844 (*(spx_int32_t*)ptr) = st->encode_submode; in nb_decoder_ctl()
1847 (*(spx_int32_t*)ptr)=st->subframeSize; in nb_decoder_ctl()
1850 st->highpass_enabled = (*(spx_int32_t*)ptr); in nb_decoder_ctl()
1853 (*(spx_int32_t*)ptr) = st->highpass_enabled; in nb_decoder_ctl()
1860 ret = log(st->level/st->min_level)/log(st->max_level/st->min_level); in nb_decoder_ctl()
1875 for (i=0;i<st->nbSubframes;i++) in nb_decoder_ctl()
1876 g[i]=st->pi_gain[i]; in nb_decoder_ctl()
1882 for (i=0;i<st->nbSubframes;i++) in nb_decoder_ctl()
1883 ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize); in nb_decoder_ctl()
1887 *((spx_int32_t*)ptr) = st->dtx_enabled; in nb_decoder_ctl()
1890 st->innov_save = (spx_word16_t*)ptr; in nb_decoder_ctl()
1893 st->isWideband = *((spx_int32_t*)ptr); in nb_decoder_ctl()
1896 *((char**)ptr) = st->stack; in nb_decoder_ctl()