Lines Matching refs:st

77 			Coder_State * st                      /* (i/o) : State structure            */
81 void Reset_encoder(void *st, Word16 reset_all)
85 cod_state = (Coder_State *) st;
161 Coder_State *st;
215 st = (Coder_State *) spe_state;
244 Copy(st->old_speech, old_speech, L_TOTAL - L_FRAME);
245 Copy(st->old_wsp, old_wsp, PIT_MAX / OPL_DECIM);
246 Copy(st->old_exc, old_exc, PIT_MAX + L_INTERPOL);
256 Decim_12k8(speech16k, L_FRAME16k, new_speech, st->mem_decim);
259 Copy(st->mem_decim, code, 2 * L_FILT16k);
267 HP50_12k8(new_speech, L_FRAME, st->mem_sig_in);
270 Copy(st->mem_sig_in, code, 6);
282 L_tmp -= (st->mem_preemph * mu)<<1;
316 if (Q_new > st->Q_max[0])
318 Q_new = st->Q_max[0];
320 if (Q_new > st->Q_max[1])
322 Q_new = st->Q_max[1];
324 exp = (Q_new - st->Q_old);
325 st->Q_old = Q_new;
326 st->Q_max[1] = st->Q_max[0];
327 st->Q_max[0] = shift;
341 L_tmp -= (st->mem_preemph * mu)<<1;
345 st->mem_preemph = tmp;
351 Scale_sig(st->mem_syn, M, exp);
352 Scale_sig(st->mem_decim2, 3, exp);
353 Scale_sig(&(st->mem_wsp), 1, exp);
354 Scale_sig(&(st->mem_w0), 1, exp);
369 vad_flag = wb_vad(st->vadSt, buf); /* Voice Activity Detection */
372 st->vad_hist = (st->vad_hist + 1);
375 st->vad_hist = 0;
382 tx_dtx_handler(st->dtx_encSt, vad_flag, mode);
405 Levinson(r_h, r_l, A, rc, st->mem_levinson); /* Levinson Durbin */
406 Az_isp(A, ispnew, st->ispold); /* From A(z) to ISP */
409 Int_isp(st->ispold, ispnew, interpol_frac, A);
412 Copy(ispnew, st->ispold, M);
418 Gp_clip_test_isf(isf, st->gp_clip);
443 Deemph2(wsp, TILT_FAC, L_FRAME, &(st->mem_wsp));
455 tmp = st->old_wsp_max;
460 st->old_wsp_max = max;
468 LP_Decim2(wsp, L_FRAME, st->mem_decim2);
477 exp = exp + (shift - st->old_wsp_shift);
478 st->old_wsp_shift = shift;
481 Scale_sig(st->old_hp_wsp, PIT_MAX / OPL_DECIM, exp);
483 scale_mem_Hp_wsp(st->hp_wsp_mem, exp);
490 T_op = Pitch_med_ol(wsp, st, L_FRAME / OPL_DECIM);
494 T_op = Pitch_med_ol(wsp, st, (L_FRAME/2) / OPL_DECIM);
497 if(st->ol_gain > 19661) /* 0.6 in Q15 */
499 st->old_T0_med = Med_olag(T_op, st->old_ol_lag);
500 st->ada_w = 32767;
503 st->ada_w = vo_mult(st->ada_w, 29491);
506 if(st->ada_w < 26214)
507 st->ol_wght_flg = 0;
509 st->ol_wght_flg = 1;
511 wb_vad_tone_detection(st->vadSt, st->ol_gain);
517 T_op2 = Pitch_med_ol(wsp + ((L_FRAME / 2) / OPL_DECIM), st, (L_FRAME/2) / OPL_DECIM);
519 if(st->ol_gain > 19661) /* 0.6 in Q15 */
521 st->old_T0_med = Med_olag(T_op2, st->old_ol_lag);
522 st->ada_w = 32767;
525 st->ada_w = mult(st->ada_w, 29491);
528 if(st->ada_w < 26214)
529 st->ol_wght_flg = 0;
531 st->ol_wght_flg = 1;
533 wb_vad_tone_detection(st->vadSt, st->ol_gain);
564 dtx_buffer(st->dtx_encSt, isf, L_tmp, codec_mode);
567 dtx_enc(st->dtx_encSt, isf, exc2, &prms);
575 corr_gain = synthesis(Aq, &exc2[i_subfr], 0, &speech16k[i_subfr * 5 / 4], st);
577 Copy(isf, st->isfold, M);
580 Reset_encoder(st, 0);
587 Copy(&old_speech[L_FRAME], st->old_speech, L_TOTAL - L_FRAME);
588 Copy(&old_wsp[L_FRAME / OPL_DECIM], st->old_wsp, PIT_MAX / OPL_DECIM);
600 Qpisf_2s_36b(isf, isf, st->past_isfq, indice, 4);
609 Qpisf_2s_46b(isf, isf, st->past_isfq, indice, 4);
625 tmp = vo_sub(isf[i], st->isfold[i]);
640 Copy(isf, st->isfold, M);
645 if (st->first_frame != 0)
647 st->first_frame = 0;
648 Copy(ispnew_q, st->ispold_q, M);
652 Int_isp(st->ispold_q, ispnew_q, interpol_frac, Aq);
655 Copy(ispnew_q, st->ispold_q, M);
680 dtx_buffer(st->dtx_encSt, isf, L_tmp, codec_mode);
682 /* range for closed loop pitch search in 1st subframe */
757 error[i] = vo_sub(speech[i + i_subfr - M], st->mem_syn[i]);
773 Deemph2(xn, TILT_FAC, L_SUBFR, &(st->mem_w0));
847 if (pit_flag == 0) /* if 1st/3rd subframe */
850 * The pitch range for the 1st/3rd subframe is encoded with *
894 if (pit_flag == 0) /* if 1st/3rd subframe */
897 * The pitch range for the 1st/3rd subframe is encoded with *
948 if((st->gp_clip[0] < 154) && (st->gp_clip[1] > 14746))
983 * - find pitch excitation filtered by 1st order LP filter. *
1072 Preemph(h2, st->tilt_code, L_SUBFR, &tmp);
1160 Preemph(code, st->tilt_code, L_SUBFR, &tmp);
1169 &gain_pit, &L_gain_code, clip_gain, st->qua_gain);
1174 &gain_pit, &L_gain_code, clip_gain, st->qua_gain);
1178 Gp_clip_test_gain_pit(gain_pit, st->gp_clip);
1197 st->tilt_code = ((voice_fac >> 2) + 8192);
1212 st->mem_w0 = extract_h(L_add(L_tmp, 0x8000));
1227 Syn_filt(p_Aq,&exc[i_subfr], synth, L_SUBFR, st->mem_syn, 1);
1248 if(L_tmp < st->L_gc_thres)
1251 if(L_tmp > st->L_gc_thres)
1253 L_tmp = st->L_gc_thres;
1258 if(L_tmp < st->L_gc_thres)
1260 L_tmp = st->L_gc_thres;
1263 st->L_gc_thres = L_tmp;
1307 corr_gain = synthesis(p_Aq, exc2, Q_new, &speech16k[i_subfr * 5 / 4], st);
1318 Copy(&old_speech[L_FRAME], st->old_speech, L_TOTAL - L_FRAME);
1319 Copy(&old_wsp[L_FRAME / OPL_DECIM], st->old_wsp, PIT_MAX / OPL_DECIM);
1320 Copy(&old_exc[L_FRAME], st->old_exc, PIT_MAX + L_INTERPOL);
1336 Coder_State * st /* (i/o) : State structure */
1363 Copy(st->mem_syn_hi, synth_hi, M);
1364 Copy(st->mem_syn_lo, synth_lo, M);
1372 Copy(synth_hi + L_SUBFR, st->mem_syn_hi, M);
1373 Copy(synth_lo + L_SUBFR, st->mem_syn_lo, M);
1376 Deemph_32_asm(synth_hi + M, synth_lo + M, synth, &(st->mem_deemph));
1378 Deemph_32(synth_hi + M, synth_lo + M, synth, PREEMPH_FAC, L_SUBFR, &(st->mem_deemph));
1381 HP50_12k8(synth, L_SUBFR, st->mem_sig_out);
1401 HF[i] = Random(&(st->seed2))>>3;
1439 HP400_12k8(synth, L_SUBFR, st->mem_hp400);
1467 if (st->vad_hist > 0)
1493 Syn_filt_asm(Ap, HF, HF, st->mem_syn_hf);
1495 Filt_6k_7k_asm(HF, L_SUBFR16k, st->mem_hf);
1497 Filt_6k_7k_asm(HF_SP, L_SUBFR16k, st->mem_hf2);
1505 Syn_filt(Ap, HF, HF, L_SUBFR16k, st->mem_syn_hf, 1);
1507 Filt_6k_7k(HF, L_SUBFR16k, st->mem_hf);
1509 Filt_6k_7k(HF_SP, L_SUBFR16k, st->mem_hf2);
1528 /* st->gain_alpha *= st->dtx_encSt->dtxHangoverCount/7 */
1529 L_tmp = (vo_L_mult(st->dtx_encSt->dtxHangoverCount, 4681) << 15);
1530 st->gain_alpha = vo_mult(st->gain_alpha, extract_h(L_tmp));
1532 if(st->dtx_encSt->dtxHangoverCount > 6)
1533 st->gain_alpha = 32767;
1535 HP_corr_gain = add1(vo_mult(HP_calc_gain, st->gain_alpha), vo_mult((32767 - st->gain_alpha), HP_est_gain));
1601 Coder_State *st;
1633 if ((st = (Coder_State *)mem_malloc(pMemOP, sizeof(Coder_State), 32, VO_INDEX_ENC_AMRWB)) == NULL)
1638 st->vadSt = NULL;
1639 st->dtx_encSt = NULL;
1640 st->sid_update_counter = 3;
1641 st->sid_handover_debt = 0;
1642 st->prev_ft = TX_SPEECH;
1643 st->inputStream = NULL;
1644 st->inputSize = 0;
1647 st->mode = VOAMRWB_MD2385; /* bit rate 23.85kbps */
1648 st->frameType = VOAMRWB_RFC3267; /* frame type: RFC3267 */
1649 st->allow_dtx = 0; /* disable DTX mode */
1651 st->outputStream = NULL;
1652 st->outputSize = 0;
1654 st->stream = (FrameStream *)mem_malloc(pMemOP, sizeof(FrameStream), 32, VO_INDEX_ENC_AMRWB);
1655 if(st->stream == NULL)
1658 st->stream->frame_ptr = (unsigned char *)mem_malloc(pMemOP, Frame_Maxsize, 32, VO_INDEX_ENC_AMRWB);
1659 if(st->stream->frame_ptr == NULL)
1662 stream = st->stream;
1665 wb_vad_init(&(st->vadSt), pMemOP);
1666 dtx_enc_init(&(st->dtx_encSt), isf_init, pMemOP);
1668 Reset_encoder((void *) st, 1);
1672 st->voMemoprator.Alloc = cmnMemAlloc;
1673 st->voMemoprator.Copy = cmnMemCopy;
1674 st->voMemoprator.Free = cmnMemFree;
1675 st->voMemoprator.Set = cmnMemSet;
1676 st->voMemoprator.Check = cmnMemCheck;
1677 pMemOP = &st->voMemoprator;
1680 st->pvoMemop = pMemOP;
1682 *phCodec = (void *) st;