这篇教程C++ EXTEND32函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中EXTEND32函数的典型用法代码示例。如果您正苦于以下问题:C++ EXTEND32函数的具体用法?C++ EXTEND32怎么用?C++ EXTEND32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了EXTEND32函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cheb_poly_evastatic inline spx_word32_t cheb_poly_eva( spx_word16_t *coef, /* P or Q coefs in Q13 format */ spx_word16_t x, /* cos of freq (-1.0 to 1.0) in Q14 format */ int m, /* LPC order/2 */ char *stack){ int i; spx_word16_t b0, b1; spx_word32_t sum; /*Prevents overflows*/ if (x>16383) x = 16383; if (x<-16383) x = -16383; /* Initialise values */ b1=16384; b0=x; /* Evaluate Chebyshev series formulation usin g iterative approach */ sum = ADD32(EXTEND32(coef[m]), EXTEND32(MULT16_16_P14(coef[m-1],x))); for(i=2;i<=m;i++) { spx_word16_t tmp=b0; b0 = SUB16(MULT16_16_Q13(x,b0), b1); b1 = tmp; sum = ADD32(sum, EXTEND32(MULT16_16_P14(coef[m-i],b0))); } return sum;}
开发者ID:bahadir89,项目名称:freertos-networked-arm-cortex-m3,代码行数:33,
示例2: logSum/* Computes a rough approximation of log2(2^a + 2^b) */static opus_val16 logSum(opus_val16 a, opus_val16 b){ opus_val16 max; opus_val32 diff; opus_val16 frac; static const opus_val16 diff_table[17] = { QCONST16(0.5000000f, DB_SHIFT), QCONST16(0.2924813f, DB_SHIFT), QCONST16(0.1609640f, DB_SHIFT), QCONST16(0.0849625f, DB_SHIFT), QCONST16(0.0437314f, DB_SHIFT), QCONST16(0.0221971f, DB_SHIFT), QCONST16(0.0111839f, DB_SHIFT), QCONST16(0.0056136f, DB_SHIFT), QCONST16(0.0028123f, DB_SHIFT) }; int low; if (a>b) { max = a; diff = SUB32(EXTEND32(a),EXTEND32(b)); } else { max = b; diff = SUB32(EXTEND32(b),EXTEND32(a)); } if (!(diff < QCONST16(8.f, DB_SHIFT))) /* inverted to catch NaNs */ return max;#ifdef FIXED_POINT low = SHR32(diff, DB_SHIFT-1); frac = SHL16(diff - SHL16(low, DB_SHIFT-1), 16-DB_SHIFT);#else low = (int)floor(2*diff); frac = 2*diff - low;#endif return max + diff_table[low] + MULT16_16_Q15(frac, SUB16(diff_table[low+1], diff_table[low]));}
开发者ID:bear101,项目名称:opus,代码行数:31,
示例3: exp_rotationstatic void exp_rotation(celt_norm *X, int len, int dir, int stride, int K, int spread){ static const int SPREAD_FACTOR[3]= {15,10,5}; int i; opus_val16 c, s; opus_val16 gain, theta; int stride2=0; int factor; if (2*K>=len || spread==SPREAD_NONE) return; factor = SPREAD_FACTOR[spread-1]; gain = celt_div((opus_val32)MULT16_16(Q15_ONE,len),(opus_val32)(len+factor*K)); theta = HALF16(MULT16_16_Q15(gain,gain)); c = celt_cos_norm(EXTEND32(theta)); s = celt_cos_norm(EXTEND32(SUB16(Q15ONE,theta))); /* sin(theta) */ if (len>=8*stride) { stride2 = 1; /* This is just a simple (equivalent) way of computing sqrt(len/stride) with rounding. It's basically incrementing long as (stride2+0.5)^2 < len/stride. */ while ((stride2*stride2+stride2)*stride + (stride>>2) < len) stride2++; }
开发者ID:carriercomm,项目名称:opus,代码行数:27,
示例4: split_cb_shape_sign_unquantvoid split_cb_shape_sign_unquant(spx_sig_t *exc,const void *par, /* non-overlapping codebook */int nsf, /* number of samples in subframe */SpeexBits *bits,char *stack,spx_int32_t *seed){ int i,j; VARDECL(int *ind); VARDECL(int *signs); const signed char *shape_cb; //int shape_cb_size; int subvect_size, nb_subvect; const split_cb_params *params; int have_sign; params = (const split_cb_params *) par; subvect_size = params->subvect_size; nb_subvect = params->nb_subvect; //shape_cb_size = 1<<params->shape_bits; shape_cb = params->shape_cb; have_sign = params->have_sign; ALLOC(ind, nb_subvect, int); ALLOC(signs, nb_subvect, int); /* Decode codewords and gains */ for (i=0;i<nb_subvect;i++) { if (have_sign) signs[i] = speex_bits_unpack_unsigned(bits, 1); else signs[i] = 0; ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits); } /* Compute decoded excitation */ for (i=0;i<nb_subvect;i++) { spx_word16_t s=1; if (signs[i]) s=-1;#ifdef FIXED_POINT if (s==1) { for (j=0;j<subvect_size;j++) exc[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5); } else { for (j=0;j<subvect_size;j++) exc[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5)); }#else for (j=0;j<subvect_size;j++) exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j]; #endif }}
开发者ID:0culus,项目名称:ioq3,代码行数:58,
示例5: speex_echo_ctlEXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr){ switch(request) { case SPEEX_ECHO_GET_FRAME_SIZE: (*(int*)ptr) = st->frame_size; break; case SPEEX_ECHO_SET_SAMPLING_RATE: st->sampling_rate = (*(int*)ptr); st->spec_average = DIV32_16(SHL32(EXTEND32(st->frame_size), 15), st->sampling_rate);#ifdef FIXED_POINT st->beta0 = DIV32_16(SHL32(EXTEND32(st->frame_size), 16), st->sampling_rate); st->beta_max = DIV32_16(SHL32(EXTEND32(st->frame_size), 14), st->sampling_rate);#else st->beta0 = (2.0f*st->frame_size)/st->sampling_rate; st->beta_max = (.5f*st->frame_size)/st->sampling_rate;#endif if (st->sampling_rate<12000) st->notch_radius = QCONST16(.9, 15); else if (st->sampling_rate<24000) st->notch_radius = QCONST16(.982, 15); else st->notch_radius = QCONST16(.992, 15); break; case SPEEX_ECHO_GET_SAMPLING_RATE: (*(int*)ptr) = st->sampling_rate; break; case SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE: /*FIXME: Implement this for multiple channels */ *((spx_int32_t *)ptr) = st->M * st->frame_size; break; case SPEEX_ECHO_GET_IMPULSE_RESPONSE: { int M = st->M, N = st->window_size, n = st->frame_size, i, j; spx_int32_t *filt = (spx_int32_t *) ptr; for(j=0;j<M;j++) { /*FIXME: Implement this for multiple channels */#ifdef FIXED_POINT for (i=0;i<N;i++) st->wtmp2[i] = EXTRACT16(PSHR32(st->W[j*N+i],16+NORMALIZE_SCALEDOWN)); spx_ifft(st->fft_table, st->wtmp2, st->wtmp);#else spx_ifft(st->fft_table, &st->W[j*N], st->wtmp);#endif for(i=0;i<n;i++) filt[j*n+i] = PSHR32(MULT16_16(32767,st->wtmp[i]), WEIGHT_SHIFT-NORMALIZE_SCALEDOWN); } } break; default: speex_warning_int("Unknown speex_echo_ctl request: ", request); return -1; } return 0;}
开发者ID:FreshLeaf8865,项目名称:mumble,代码行数:57,
示例6: kf_bfly2static void kf_bfly2( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m, int N, int mm ){ kiss_fft_cpx * Fout2; kiss_fft_cpx * tw1; kiss_fft_cpx t; if (!st->inverse) { int i,j; kiss_fft_cpx * Fout_beg = Fout; for (i=0;i<N;i++) { Fout = Fout_beg + i*mm; Fout2 = Fout + m; tw1 = st->twiddles; for(j=0;j<m;j++) { /* Almost the same as the code path below, except that we divide the input by two (while keeping the best accuracy possible) */ ms_word32_t tr, ti; tr = SHR32(SUB32(MULT16_16(Fout2->r , tw1->r),MULT16_16(Fout2->i , tw1->i)), 1); ti = SHR32(ADD32(MULT16_16(Fout2->i , tw1->r),MULT16_16(Fout2->r , tw1->i)), 1); tw1 += fstride; Fout2->r = PSHR32(SUB32(SHL32(EXTEND32(Fout->r), 14), tr), 15); Fout2->i = PSHR32(SUB32(SHL32(EXTEND32(Fout->i), 14), ti), 15); Fout->r = PSHR32(ADD32(SHL32(EXTEND32(Fout->r), 14), tr), 15); Fout->i = PSHR32(ADD32(SHL32(EXTEND32(Fout->i), 14), ti), 15); ++Fout2; ++Fout; } } } else { int i,j; kiss_fft_cpx * Fout_beg = Fout; for (i=0;i<N;i++) { Fout = Fout_beg + i*mm; Fout2 = Fout + m; tw1 = st->twiddles; for(j=0;j<m;j++) { C_MUL (t, *Fout2 , *tw1); tw1 += fstride; C_SUB( *Fout2 , *Fout , t ); C_ADDTO( *Fout , t ); ++Fout2; ++Fout; } } }}
开发者ID:Amini-Philips,项目名称:mediastreamer2,代码行数:56,
示例7: forced_pitch_quant/** Forced pitch delay and gain */int forced_pitch_quant(spx_word16_t target[], /* Target vector */ spx_word16_t * sw, spx_coef_t ak[], /* LPCs for this subframe */ spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */ spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */ spx_sig_t exc[], /* Excitation */ const void *par, int start, /* Smallest pitch value allowed */ int end, /* Largest pitch value allowed */ spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ int p, /* Number of LPC coeffs */ int nsf, /* Number of samples in subframe */ SpeexBits * bits, char *stack, spx_word16_t * exc2, spx_word16_t * r, int complexity, int cdbk_offset, int plc_tuning, spx_word32_t * cumul_gain){ (void)sw; (void)par; (void)end; (void)bits; (void)r; (void)complexity; (void)cdbk_offset; (void)plc_tuning; (void)cumul_gain; int i; spx_word16_t res[nsf];#ifdef FIXED_POINT if (pitch_coef > 63) pitch_coef = 63;#else if (pitch_coef > .99) pitch_coef = .99;#endif for (i = 0; i < nsf && i < start; i++) { exc[i] = MULT16_16(SHL16(pitch_coef, 7), exc2[i - start]); } for (; i < nsf; i++) { exc[i] = MULT16_32_Q15(SHL16(pitch_coef, 9), exc[i - start]); } for (i = 0; i < nsf; i++) res[i] = EXTRACT16(PSHR32(exc[i], SIG_SHIFT - 1)); syn_percep_zero16(res, ak, awk1, awk2, res, nsf, p, stack); for (i = 0; i < nsf; i++) target[i] = EXTRACT16(SATURATE (SUB32(EXTEND32(target[i]), EXTEND32(res[i])), 32700)); return start;}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:53,
示例8: exp_rotationstatic void exp_rotation(celt_norm *X, int len, int dir, int stride, int K){ int i, k, iter; celt_word16 c, s; celt_word16 gain, theta; celt_norm *Xptr; gain = celt_div((celt_word32)MULT16_16(Q15_ONE,len),(celt_word32)(3+len+6*K)); /* FIXME: Make that HALF16 instead of HALF32 */ theta = SUB16(Q15ONE, HALF32(MULT16_16_Q15(gain,gain))); /*if (len==30) { for (i=0;i<len;i++) X[i] = 0; X[14] = 1;}*/ c = celt_cos_norm(EXTEND32(theta)); s = dir*celt_cos_norm(EXTEND32(SUB16(Q15ONE,theta))); /* sin(theta) */ if (len > 8*stride) stride *= len/(8*stride); iter = 1; for (k=0;k<iter;k++) { /* We could use MULT16_16_P15 instead of MULT16_16_Q15 for more accuracy, but at this point, I really don't think it's necessary */ Xptr = X; for (i=0;i<len-stride;i++) { celt_norm x1, x2; x1 = Xptr[0]; x2 = Xptr[stride]; Xptr[stride] = MULT16_16_Q15(c,x2) + MULT16_16_Q15(s,x1); *Xptr++ = MULT16_16_Q15(c,x1) - MULT16_16_Q15(s,x2); } Xptr = &X[len-2*stride-1]; for (i=len-2*stride-1;i>=0;i--) { celt_norm x1, x2; x1 = Xptr[0]; x2 = Xptr[stride]; Xptr[stride] = MULT16_16_Q15(c,x2) + MULT16_16_Q15(s,x1); *Xptr-- = MULT16_16_Q15(c,x1) - MULT16_16_Q15(s,x2); } } /*if (len==30) { for (i=0;i<len;i++) printf ("%f ", X[i]); printf ("/n"); exit(0);}*/}
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:51,
示例9: cubic_coefstatic void cubic_coef(spx_word16_t x, spx_word16_t interp[4]){ /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation but I know it's MMSE-optimal on a sinc */ spx_word16_t x2, x3; x2 = MULT16_16_P15(x, x); x3 = MULT16_16_P15(x, x2); interp[0] = PSHR32(MULT16_16(QCONST16(-0.16667f, 15),x) + MULT16_16(QCONST16(0.16667f, 15),x3),15); interp[1] = EXTRACT16(EXTEND32(x) + SHR32(SUB32(EXTEND32(x2),EXTEND32(x3)),1)); interp[3] = PSHR32(MULT16_16(QCONST16(-0.33333f, 15),x) + MULT16_16(QCONST16(.5f,15),x2) - MULT16_16(QCONST16(0.16667f, 15),x3),15); /* Just to make sure we don't have rounding problems */ interp[2] = Q15_ONE-interp[0]-interp[1]-interp[3]; if (interp[2]<32767) interp[2]+=1;}
开发者ID:CharaD7,项目名称:wireshark,代码行数:15,
示例10: noise_codebook_quantvoid noise_codebook_quant(spx_word16_t target[], /* target vector */spx_coef_t ak[], /* LPCs for this subframe */spx_coef_t awk1[], /* Weighted LPCs for this subframe */spx_coef_t awk2[], /* Weighted LPCs for this subframe */const void *par, /* Codebook/search parameters*/int p, /* number of LPC coeffs */int nsf, /* number of samples in subframe */spx_sig_t *exc,spx_word16_t *r,SpeexBits *bits,char *stack,int complexity,int update_target){ int i; VARDECL(spx_word16_t *tmp); ALLOC(tmp, nsf, spx_word16_t); residue_percep_zero16(target, ak, awk1, awk2, tmp, nsf, p, stack); for (i=0;i<nsf;i++) exc[i]+=SHL32(EXTEND32(tmp[i]),8); SPEEX_MEMSET(target, 0, nsf);}
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:25,
示例11: celt_fir5static void celt_fir5(opus_val16 *x, const opus_val16 *num, int N){ int i; opus_val16 num0, num1, num2, num3, num4; opus_val32 mem0, mem1, mem2, mem3, mem4; num0=num[0]; num1=num[1]; num2=num[2]; num3=num[3]; num4=num[4]; mem0=0; mem1=0; mem2=0; mem3=0; mem4=0; for (i=0;i<N;i++) { opus_val32 sum = SHL32(EXTEND32(x[i]), SIG_SHIFT); sum = MAC16_16(sum,num0,mem0); sum = MAC16_16(sum,num1,mem1); sum = MAC16_16(sum,num2,mem2); sum = MAC16_16(sum,num3,mem3); sum = MAC16_16(sum,num4,mem4); mem4 = mem3; mem3 = mem2; mem2 = mem1; mem1 = mem0; mem0 = x[i]; x[i] = ROUND16(sum, SIG_SHIFT); }}
开发者ID:DrKLO,项目名称:Telegram,代码行数:33,
示例12: mdf_adjust_propstatic inline void mdf_adjust_prop(const spx_word32_t *W, int N, int M, int P, spx_word16_t *prop){ int i, j, p; spx_word16_t max_sum = 1; spx_word32_t prop_sum = 1; for (i=0;i<M;i++) { spx_word32_t tmp = 1; for (p=0;p<P;p++) for (j=0;j<N;j++) tmp += MULT16_16(EXTRACT16(SHR32(W[p*N*M + i*N+j],18)), EXTRACT16(SHR32(W[p*N*M + i*N+j],18)));#ifdef FIXED_POINT /* Just a security in case an overflow were to occur */ tmp = MIN32(ABS32(tmp), 536870912);#endif prop[i] = spx_sqrt(tmp); if (prop[i] > max_sum) max_sum = prop[i]; } for (i=0;i<M;i++) { prop[i] += MULT16_16_Q15(QCONST16(.1f,15),max_sum); prop_sum += EXTEND32(prop[i]); } for (i=0;i<M;i++) { prop[i] = DIV32(MULT16_16(QCONST16(.99f,15), prop[i]),prop_sum); /*printf ("%f ", prop[i]);*/ } /*printf ("/n");*/}
开发者ID:FreshLeaf8865,项目名称:mumble,代码行数:31,
示例13: clt_mdct_initvoid clt_mdct_init(mdct_lookup *l,int N){ int i; int N2; l->n = N; N2 = N>>1; l->kfft = cpx32_fft_alloc(N>>2);#ifndef ENABLE_TI_DSPLIB55 if (l->kfft==NULL) return;#endif l->trig = (kiss_twiddle_scalar*)celt_alloc(N2*sizeof(kiss_twiddle_scalar)); if (l->trig==NULL) return; /* We have enough points that sine isn't necessary */#if defined(FIXED_POINT)#if defined(DOUBLE_PRECISION) & !defined(MIXED_PRECISION) for (i=0;i<N2;i++) l->trig[i] = SAMP_MAX*cos(2*M_PI*(i+1./8.)/N);#else for (i=0;i<N2;i++) l->trig[i] = TRIG_UPSCALE*celt_cos_norm(DIV32(ADD32(SHL32(EXTEND32(i),17),16386),N));#endif#else for (i=0;i<N2;i++) l->trig[i] = cos(2*M_PI*(i+1./8.)/N);#endif}
开发者ID:EvolveLabs,项目名称:electron-celt,代码行数:28,
示例14: lsp_interpolatevoid lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes){#ifndef FIXED_LPC_SIZE int i;#endif spx_word16_t tmp = DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes); spx_word16_t tmp2 = 16384-tmp;#ifndef FIXED_LPC_SIZE for (i=0;i<len;i++) { interp_lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]); }#else interp_lsp[0] = MULT16_16_P14(tmp2,old_lsp[0]) + MULT16_16_P14(tmp,new_lsp[0]); interp_lsp[1] = MULT16_16_P14(tmp2,old_lsp[1]) + MULT16_16_P14(tmp,new_lsp[1]); interp_lsp[2] = MULT16_16_P14(tmp2,old_lsp[2]) + MULT16_16_P14(tmp,new_lsp[2]); interp_lsp[3] = MULT16_16_P14(tmp2,old_lsp[3]) + MULT16_16_P14(tmp,new_lsp[3]); interp_lsp[4] = MULT16_16_P14(tmp2,old_lsp[4]) + MULT16_16_P14(tmp,new_lsp[4]); interp_lsp[5] = MULT16_16_P14(tmp2,old_lsp[5]) + MULT16_16_P14(tmp,new_lsp[5]); interp_lsp[6] = MULT16_16_P14(tmp2,old_lsp[6]) + MULT16_16_P14(tmp,new_lsp[6]); interp_lsp[7] = MULT16_16_P14(tmp2,old_lsp[7]) + MULT16_16_P14(tmp,new_lsp[7]); interp_lsp[8] = MULT16_16_P14(tmp2,old_lsp[8]) + MULT16_16_P14(tmp,new_lsp[8]); interp_lsp[9] = MULT16_16_P14(tmp2,old_lsp[9]) + MULT16_16_P14(tmp,new_lsp[9]);#endif}
开发者ID:bahadir89,项目名称:freertos-networked-arm-cortex-m3,代码行数:27,
示例15: compute_band_energies/* Compute the amplitude (sqrt energy) in each of the bands */void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bandE, int end, int C, int M){ int i, c, N; const opus_int16 *eBands = m->eBands; N = M*m->shortMdctSize; c=0; do { for (i=0;i<end;i++) { int j; opus_val32 maxval=0; opus_val32 sum = 0; j=M*eBands[i]; do { maxval = MAX32(maxval, X[j+c*N]); maxval = MAX32(maxval, -X[j+c*N]); } while (++j<M*eBands[i+1]); if (maxval > 0) { int shift = celt_ilog2(maxval)-10; j=M*eBands[i]; do { sum = MAC16_16(sum, EXTRACT16(VSHR32(X[j+c*N],shift)), EXTRACT16(VSHR32(X[j+c*N],shift))); } while (++j<M*eBands[i+1]); /* We're adding one here to make damn sure we never end up with a pitch vector that's larger than unity norm */ bandE[i+c*m->nbEBands] = EPSILON+VSHR32(EXTEND32(celt_sqrt(sum)),-shift); } else { bandE[i+c*m->nbEBands] = EPSILON; } /*printf ("%f ", bandE[i+c*m->nbEBands]);*/ } } while (++c<C); /*printf ("/n");*/}
开发者ID:oneman,项目名称:opus-oneman,代码行数:36,
示例16: lsp_interpolatevoid lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes){ int i; spx_word16_t tmp = DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes); spx_word16_t tmp2 = 16384-tmp; for (i=0;i<len;i++) { interp_lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]); }}
开发者ID:DastanIqbal,项目名称:pfhiaxdroid,代码行数:10,
示例17: mlp_processvoid mlp_process(const MLP * m, const opus_val16 * in, opus_val16 * out){ int j; opus_val16 hidden[MAX_NEURONS]; const opus_val16 *W = m->weights; /* Copy to tmp_in */ for (j = 0; j < m->topo[1]; j++) { int k; opus_val32 sum = SHL32(EXTEND32(*W++), 8); for (k = 0; k < m->topo[0]; k++) sum = MAC16_16(sum, in[k], *W++); hidden[j] = tansig_approx(sum); } for (j = 0; j < m->topo[2]; j++) { int k; opus_val32 sum = SHL32(EXTEND32(*W++), 14); for (k = 0; k < m->topo[1]; k++) sum = MAC16_16(sum, hidden[k], *W++); out[j] = tansig_approx(EXTRACT16(PSHR32(sum, 17))); }}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:21,
示例18: noise_codebook_unquantvoid noise_codebook_unquant(spx_sig_t *exc,const void *par, /* non-overlapping codebook */int nsf, /* number of samples in subframe */SpeexBits *bits,char *stack,spx_int32_t *seed){ int i; /* FIXME: This is bad, but I don't think the function ever gets called anyway */ for (i=0;i<nsf;i++) exc[i]=SHL32(EXTEND32(speex_rand(1, seed)),SIG_SHIFT);}
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:14,
示例19: filter_dc_notch16static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem, int stride){ int i; spx_word16_t den2;#ifdef FIXED_POINT den2 = MULT16_16_Q15(radius,radius) + MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q15(32767-radius,32767-radius));#else den2 = radius*radius + .7*(1-radius)*(1-radius);#endif /*printf ("%d %d %d %d %d %d/n", num[0], num[1], num[2], den[0], den[1], den[2]);*/ for (i=0;i<len;i++) { spx_word16_t vin = in[i*stride]; spx_word32_t vout = mem[0] + SHL32(EXTEND32(vin),15);#ifdef FIXED_POINT mem[0] = mem[1] + SHL32(SHL32(-EXTEND32(vin),15) + MULT16_32_Q15(radius,vout),1);#else mem[0] = mem[1] + 2*(-vin + radius*vout);#endif mem[1] = SHL32(EXTEND32(vin),15) - MULT16_32_Q15(den2,vout); out[i] = SATURATE32(PSHR32(MULT16_32_Q15(radius,vout),15),32767); }}
开发者ID:FreshLeaf8865,项目名称:mumble,代码行数:23,
示例20: celt_fir_cvoid celt_fir_c( const opus_val16 *_x, const opus_val16 *num, opus_val16 *_y, int N, int ord, opus_val16 *mem, int arch){ int i,j; VARDECL(opus_val16, rnum); VARDECL(opus_val16, x); SAVE_STACK; ALLOC(rnum, ord, opus_val16); ALLOC(x, N+ord, opus_val16); for(i=0;i<ord;i++) rnum[i] = num[ord-i-1]; for(i=0;i<ord;i++) x[i] = mem[ord-i-1]; for (i=0;i<N;i++) x[i+ord]=_x[i]; for(i=0;i<ord;i++) mem[i] = _x[N-i-1];#ifdef SMALL_FOOTPRINT (void)arch; for (i=0;i<N;i++) { opus_val32 sum = SHL32(EXTEND32(_x[i]), SIG_SHIFT); for (j=0;j<ord;j++) { sum = MAC16_16(sum,rnum[j],x[i+j]); } _y[i] = SATURATE16(PSHR32(sum, SIG_SHIFT)); }#else for (i=0;i<N-3;i+=4) { opus_val32 sum[4]={0,0,0,0}; xcorr_kernel(rnum, x+i, sum, ord, arch); _y[i ] = SATURATE16(ADD32(EXTEND32(_x[i ]), PSHR32(sum[0], SIG_SHIFT))); _y[i+1] = SATURATE16(ADD32(EXTEND32(_x[i+1]), PSHR32(sum[1], SIG_SHIFT))); _y[i+2] = SATURATE16(ADD32(EXTEND32(_x[i+2]), PSHR32(sum[2], SIG_SHIFT))); _y[i+3] = SATURATE16(ADD32(EXTEND32(_x[i+3]), PSHR32(sum[3], SIG_SHIFT))); } for (;i<N;i++) { opus_val32 sum = 0; for (j=0;j<ord;j++) sum = MAC16_16(sum,rnum[j],x[i+j]); _y[i] = SATURATE16(ADD32(EXTEND32(_x[i]), PSHR32(sum, SIG_SHIFT))); }#endif RESTORE_STACK;}
开发者ID:03050903,项目名称:godot,代码行数:55,
示例21: _spx_lpc/* returns minimum mean square error */spx_word32_t _spx_lpc(spx_coef_t *lpc, /* out: [0...p-1] LPC coefficients */const spx_word16_t *ac, /* in: [0...p] autocorrelation values */int p){ int i, j; spx_word16_t r; spx_word16_t error = ac[0]; if (ac[0] == 0) { for (i = 0; i < p; i++) lpc[i] = 0; return 0; } for (i = 0; i < p; i++) { /* Sum up this iteration's reflection coefficient */ spx_word32_t rr = NEG32(SHL32(EXTEND32(ac[i + 1]),13)); for (j = 0; j < i; j++) rr = SUB32(rr,MULT16_16(lpc[j],ac[i - j]));#ifdef FIXED_POINT r = DIV32_16(rr+PSHR32(error,1),ADD16(error,8));#else r = rr/(error+.003*ac[0]);#endif /* Update LPC coefficients and total error */ lpc[i] = r; for (j = 0; j < i>>1; j++) { spx_word16_t tmp = lpc[j]; lpc[j] = MAC16_16_P13(lpc[j],r,lpc[i-1-j]); lpc[i-1-j] = MAC16_16_P13(lpc[i-1-j],r,tmp); } if (i & 1) lpc[j] = MAC16_16_P13(lpc[j],lpc[j],r); error = SUB16(error,MULT16_16_Q13(r,MULT16_16_Q13(error,r))); } return error;}
开发者ID:03050903,项目名称:godot,代码行数:44,
示例22: lsp_interpolatevoid lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *lsp, int len, int subframe, int nb_subframes, spx_word16_t margin){ int i; spx_word16_t m = margin; spx_word16_t m2 = 25736-margin; spx_word16_t tmp = DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes); spx_word16_t tmp2 = 16384-tmp; for (i=0;i<len;i++) lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]); /* Enforce margin to sure the LSPs are stable*/ if (lsp[0]<m) lsp[0]=m; if (lsp[len-1]>m2) lsp[len-1]=m2; for (i=1;i<len-1;i++) { if (lsp[i]<lsp[i-1]+m) lsp[i]=lsp[i-1]+m; if (lsp[i]>lsp[i+1]-m) lsp[i]= SHR16(lsp[i],1) + SHR16(lsp[i+1]-m,1); }}
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:23,
示例23: compute_band_energies/* Compute the amplitude (sqrt energy) in each of the bands */void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank, int _C){ int i, c, N; const celt_int16 *eBands = m->eBands; const int C = CHANNELS(_C); N = FRAMESIZE(m); for (c=0;c<C;c++) { for (i=0;i<m->nbEBands;i++) { int j; celt_word32 maxval=0; celt_word32 sum = 0; j=eBands[i]; do { maxval = MAX32(maxval, X[j+c*N]); maxval = MAX32(maxval, -X[j+c*N]); } while (++j<eBands[i+1]); if (maxval > 0) { int shift = celt_ilog2(maxval)-10; j=eBands[i]; do { sum = MAC16_16(sum, EXTRACT16(VSHR32(X[j+c*N],shift)), EXTRACT16(VSHR32(X[j+c*N],shift))); } while (++j<eBands[i+1]); /* We're adding one here to make damn sure we never end up with a pitch vector that's larger than unity norm */ bank[i+c*m->nbEBands] = EPSILON+VSHR32(EXTEND32(celt_sqrt(sum)),-shift); } else { bank[i+c*m->nbEBands] = EPSILON; } /*printf ("%f ", bank[i+c*m->nbEBands]);*/ } } /*printf ("/n");*/}
开发者ID:FreshLeaf8865,项目名称:mumble,代码行数:38,
示例24: celt_firvoid celt_fir(const opus_val16 *x, const opus_val16 *num, opus_val16 *y, int N, int ord, opus_val16 *mem){ int i,j; for (i=0;i<N;i++) { opus_val32 sum = SHL32(EXTEND32(x[i]), SIG_SHIFT); for (j=0;j<ord;j++) { sum += MULT16_16(num[j],mem[j]); } for (j=ord-1;j>=1;j--) { mem[j]=mem[j-1]; } mem[0] = x[i]; y[i] = ROUND16(sum, SIG_SHIFT); }}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:24,
示例25: lsp_to_lpcvoid lsp_to_lpc(const spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)/* float *freq array of LSP frequencies in the x domain *//* float *ak array of LPC coefficients *//* int lpcrdr order of LPC coefficients */{ int i,j; spx_word32_t xout1,xout2,xin; spx_word32_t mult, a; VARDECL(spx_word16_t *freqn); VARDECL(spx_word32_t **xp); VARDECL(spx_word32_t *xpmem); VARDECL(spx_word32_t **xq); VARDECL(spx_word32_t *xqmem); int m = lpcrdr>>1; /* Reconstruct P(z) and Q(z) by cascading second order polynomials in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency. In the time domain this is: y(n) = x(n) - 2cos(w)x(n-1) + x(n-2) This is what the ALLOCS below are trying to do: int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP int xq[m+1][lpcrdr+1+2]; // Q matrix in QIMP These matrices store the output of each stage on each row. The final (m-th) row has the output of the final (m-th) cascaded 2nd order filter. The first row is the impulse input to the system (not written as it is known). The version below takes advantage of the fact that a lot of the outputs are zero or known, for example if we put an inpulse into the first section the "clock" it 10 times only the first 3 outputs samples are non-zero (it's an FIR filter). */ ALLOC(xp, (m+1), spx_word32_t*); ALLOC(xpmem, (m+1)*(lpcrdr+1+2), spx_word32_t); ALLOC(xq, (m+1), spx_word32_t*); ALLOC(xqmem, (m+1)*(lpcrdr+1+2), spx_word32_t); for(i=0; i<=m; i++) { xp[i] = xpmem + i*(lpcrdr+1+2); xq[i] = xqmem + i*(lpcrdr+1+2); } /* work out 2cos terms in Q14 */ ALLOC(freqn, lpcrdr, spx_word16_t); for (i=0;i<lpcrdr;i++) freqn[i] = ANGLE2X(freq[i]); #define QIMP 21 /* scaling for impulse */ xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */ /* first col and last non-zero values of each row are trivial */ for(i=0;i<=m;i++) { xp[i][1] = 0; xp[i][2] = xin; xp[i][2+2*i] = xin; xq[i][1] = 0; xq[i][2] = xin; xq[i][2+2*i] = xin; } /* 2nd row (first output row) is trivial */ xp[1][3] = -MULT16_32_Q14(freqn[0],xp[0][2]); xq[1][3] = -MULT16_32_Q14(freqn[1],xq[0][2]); xout1 = xout2 = 0; /* now generate remaining rows */ for(i=1;i<m;i++) { for(j=1;j<2*(i+1)-1;j++) { mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]); xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], mult), xp[i][j]); mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]); xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], mult), xq[i][j]); } /* for last col xp[i][j+2] = xq[i][j+2] = 0 */ mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]); xp[i+1][j+2] = SUB32(xp[i][j], mult); mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]); xq[i+1][j+2] = SUB32(xq[i][j], mult); } /* process last row to extra a{k} */ for(j=1;j<=lpcrdr;j++) {//.........这里部分代码省略.........
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:101,
示例26: lpc_to_lspint lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack)/* float *a lpc coefficients *//* int lpcrdr order of LPC coefficients (10) *//* float *freq LSP frequencies in the x domain *//* int nb number of sub-intervals (4) *//* float delta grid spacing interval (0.02) */{ spx_word16_t temp_xr,xl,xr,xm=0; spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/; int i,j,m,flag,k;#ifndef FIXED_LPC_SIZE VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */ VARDECL(spx_word32_t *P); VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */ VARDECL(spx_word16_t *P16);#else spx_word32_t Q[(FIXED_LPC_SIZE/2)+1]; /* ptrs for memory allocation */ spx_word32_t P[(FIXED_LPC_SIZE/2)+1]; spx_word16_t Q16[(FIXED_LPC_SIZE/2)+1]; /* ptrs for memory allocation */ spx_word16_t P16[(FIXED_LPC_SIZE/2)+1];#endif spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */ spx_word32_t *qx; spx_word32_t *p; spx_word32_t *q; spx_word16_t *pt; /* ptr used for cheb_poly_eval() whether P' or Q' */ int roots=0; /* DR 8/2/94: number of roots found */ flag = 1; /* program is searching for a root when, 1 else has found one */ m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */#ifndef FIXED_LPC_SIZE /* Allocate memory space for polynomials */ ALLOC(Q, (m+1), spx_word32_t); ALLOC(P, (m+1), spx_word32_t);#endif /* determine P'(z)'s and Q'(z)'s coefficients where P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ px = P; /* initialise ptrs */ qx = Q; p = px; q = qx;#ifdef FIXED_POINT *px++ = LPC_SCALING; *qx++ = LPC_SCALING;#ifndef FIXED_LPC_SIZE for(i=0;i<m;i++){ *px++ = SUB32(ADD32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *p++); *qx++ = ADD32(SUB32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *q++); }#else for(i=0;i<(FIXED_LPC_SIZE/2);i++){ *px++ = SUB32(ADD32(EXTEND32(a[i]),EXTEND32(a[FIXED_LPC_SIZE-i-1])), *p++); *qx++ = ADD32(SUB32(EXTEND32(a[i]),EXTEND32(a[FIXED_LPC_SIZE-i-1])), *q++); }#endif px = P; qx = Q; for(i=0;i<m;i++) { /*if (fabs(*px)>=32768) speex_warning_int("px", *px); if (fabs(*qx)>=32768) speex_warning_int("qx", *qx);*/ *px = PSHR32(*px,2); *qx = PSHR32(*qx,2); px++; qx++; } /* The reason for this lies in the way cheb_poly_eva() is implemented for fixed-point */ P[m] = PSHR32(P[m],3); Q[m] = PSHR32(Q[m],3);#else *px++ = LPC_SCALING; *qx++ = LPC_SCALING; for(i=0;i<m;i++){ *px++ = (a[i]+a[lpcrdr-1-i]) - *p++; *qx++ = (a[i]-a[lpcrdr-1-i]) + *q++; } px = P; qx = Q; for(i=0;i<m;i++){ *px = 2**px; *qx = 2**qx; px++; qx++; }#endif px = P; /* re-initialise ptrs */ qx = Q; /* now that we have computed P and Q convert to 16 bits to speed up cheb_poly_eval *///.........这里部分代码省略.........
开发者ID:bahadir89,项目名称:freertos-networked-arm-cortex-m3,代码行数:101,
示例27: lsp_to_lpcvoid lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)/* float *freq array of LSP frequencies in the x domain *//* float *ak array of LPC coefficients *//* int lpcrdr order of LPC coefficients */{ int i,j; spx_word32_t xout1,xout2,xin; spx_word32_t mult, a; VARDECL(spx_word32_t *xpmem); VARDECL(spx_word32_t *xqmem);#ifndef FIXED_LPC_SIZE VARDECL(spx_word16_t *freqn); VARDECL(spx_word32_t **xp); VARDECL(spx_word32_t **xq);#else spx_word16_t freqn[FIXED_LPC_SIZE]; spx_word32_t *xp[(FIXED_LPC_SIZE/2)+1]; spx_word32_t *xq[(FIXED_LPC_SIZE/2)+1];#endif int m = lpcrdr>>1; /* Reconstruct P(z) and Q(z) by cascading second order polynomials in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency. In the time domain this is: y(n) = x(n) - 2cos(w)x(n-1) + x(n-2) This is what the ALLOCS below are trying to do: int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP int xq[m+1][lpcrdr+1+2]; // Q matrix in QIMP These matrices store the output of each stage on each row. The final (m-th) row has the output of the final (m-th) cascaded 2nd order filter. The first row is the impulse input to the system (not written as it is known). The version below takes advantage of the fact that a lot of the outputs are zero or known, for example if we put an inpulse into the first section the "clock" it 10 times only the first 3 outputs samples are non-zero (it's an FIR filter). */#ifndef FIXED_LPC_SIZE ALLOC(xp, (m+1), spx_word32_t*);#endif ALLOC(xpmem, (m+1)*(lpcrdr+1+2), spx_word32_t);#ifndef FIXED_LPC_SIZE ALLOC(xq, (m+1), spx_word32_t*);#endif ALLOC(xqmem, (m+1)*(lpcrdr+1+2), spx_word32_t);#ifndef FIXED_LPC_SIZE for(i=0; i<=m; i++) { xp[i] = xpmem + i*(lpcrdr+1+2); xq[i] = xqmem + i*(lpcrdr+1+2); }#else for(i=0; i<=m; i++) { xp[i] = xpmem + i*(FIXED_LPC_SIZE+1+2); xq[i] = xqmem + i*(FIXED_LPC_SIZE+1+2); }#endif /* work out 2cos terms in Q14 */#ifndef FIXED_LPC_SIZE ALLOC(freqn, lpcrdr, spx_word16_t); for (i=0;i<lpcrdr;i++) freqn[i] = ANGLE2X(freq[i]);#else for (i=0;i<FIXED_LPC_SIZE;i++) freqn[i] = ANGLE2X(freq[i]);#endif #define QIMP 21 /* scaling for impulse */ xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */ /* first col and last non-zero values of each row are trivial */ for(i=0;i<=m;i++) { xp[i][1] = 0; xp[i][2] = xin; xp[i][2+2*i] = xin; xq[i][1] = 0; xq[i][2] = xin; xq[i][2+2*i] = xin; } /* 2nd row (first output row) is trivial */ xp[1][3] = -MULT16_32_Q14(freqn[0],xp[0][2]); xq[1][3] = -MULT16_32_Q14(freqn[1],xq[0][2]); xout1 = xout2 = 0;//.........这里部分代码省略.........
开发者ID:bahadir89,项目名称:freertos-networked-arm-cortex-m3,代码行数:101,
示例28: split_cb_search_shape_sign_N1static void split_cb_search_shape_sign_N1(spx_word16_t target[], /* target vector */spx_coef_t ak[], /* LPCs for this subframe */spx_coef_t awk1[], /* Weighted LPCs for this subframe */spx_coef_t awk2[], /* Weighted LPCs for this subframe */const void *par, /* Codebook/search parameters*/int p, /* number of LPC coeffs */int nsf, /* number of samples in subframe */spx_sig_t *exc,spx_word16_t *r,SpeexBits *bits,char *stack,int update_target){ int i,j,m,q; VARDECL(spx_word16_t *resp);#ifdef _USE_SSE VARDECL(__m128 *resp2); VARDECL(__m128 *E);#else spx_word16_t *resp2; VARDECL(spx_word32_t *E);#endif VARDECL(spx_word16_t *t); VARDECL(spx_sig_t *e); const signed char *shape_cb; int shape_cb_size, subvect_size, nb_subvect; const split_cb_params *params; int best_index; spx_word32_t best_dist; int have_sign; params = (const split_cb_params *) par; subvect_size = params->subvect_size; nb_subvect = params->nb_subvect; shape_cb_size = 1<<params->shape_bits; shape_cb = params->shape_cb; have_sign = params->have_sign; ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t);#ifdef _USE_SSE ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128); ALLOC(E, shape_cb_size>>2, __m128);#else resp2 = resp; ALLOC(E, shape_cb_size, spx_word32_t);#endif ALLOC(t, nsf, spx_word16_t); ALLOC(e, nsf, spx_sig_t); /* FIXME: Do we still need to copy the target? */ SPEEX_COPY(t, target, nsf); compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack); for (i=0;i<nb_subvect;i++) { spx_word16_t *x=t+subvect_size*i; /*Find new n-best based on previous n-best j*/#ifndef DISABLE_WIDEBAND if (have_sign) vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack); else#endif /* DISABLE_WIDEBAND */ vq_nbest(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack); speex_bits_pack(bits,best_index,params->shape_bits+have_sign); { int rind; spx_word16_t *res; spx_word16_t sign=1; rind = best_index; if (rind>=shape_cb_size) { sign=-1; rind-=shape_cb_size; } res = resp+rind*subvect_size; if (sign>0) for (m=0;m<subvect_size;m++) t[subvect_size*i+m] = SUB16(t[subvect_size*i+m], res[m]); else for (m=0;m<subvect_size;m++) t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]);#ifdef FIXED_POINT if (sign==1) { for (j=0;j<subvect_size;j++) e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5); } else { for (j=0;j<subvect_size;j++) e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5)); }#else for (j=0;j<subvect_size;j++) e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];#endif //.........这里部分代码省略.........
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:101,
示例29: split_cb_search_shape_sign//.........这里部分代码省略......... } if (i==0) break; } for (j=0;j<N;j++) { /*previous target (we don't care what happened before*/ for (m=(i+1)*subvect_size;m<nsf;m++) nt[j][m]=ot[best_ntarget[j]][m]; /* New code: update the rest of the target only if it's worth it */ for (m=0;m<subvect_size;m++) { spx_word16_t g; int rind; spx_word16_t sign=1; rind = best_nind[j]; if (rind>=shape_cb_size) { sign=-1; rind-=shape_cb_size; } q=subvect_size-m;#ifdef FIXED_POINT g=sign*shape_cb[rind*subvect_size+m];#else g=sign*0.03125*shape_cb[rind*subvect_size+m];#endif target_update(nt[j]+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1)); } for (q=0;q<nb_subvect;q++) nind[j][q]=oind[best_ntarget[j]][q]; nind[j][i]=best_nind[j]; } /*update old-new data*/ /* just swap pointers instead of a long copy */ { spx_word16_t **tmp2; tmp2=ot; ot=nt; nt=tmp2; } for (j=0;j<N;j++) for (m=0;m<nb_subvect;m++) oind[j][m]=nind[j][m]; for (j=0;j<N;j++) odist[j]=ndist[j]; } /*save indices*/ for (i=0;i<nb_subvect;i++) { ind[i]=nind[0][i]; speex_bits_pack(bits,ind[i],params->shape_bits+have_sign); } /* Put everything back together */ for (i=0;i<nb_subvect;i++) { int rind; spx_word16_t sign=1; rind = ind[i]; if (rind>=shape_cb_size) { sign=-1; rind-=shape_cb_size; }#ifdef FIXED_POINT if (sign==1) { for (j=0;j<subvect_size;j++) e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5); } else { for (j=0;j<subvect_size;j++) e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5)); }#else for (j=0;j<subvect_size;j++) e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];#endif } /* Update excitation */ for (j=0;j<nsf;j++) exc[j]=ADD32(exc[j],e[j]); /* Update target: only update target if necessary */ if (update_target) { VARDECL(spx_word16_t *r2); ALLOC(r2, nsf, spx_word16_t); for (j=0;j<nsf;j++) r2[j] = EXTRACT16(PSHR32(e[j] ,6)); syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack); for (j=0;j<nsf;j++) target[j]=SUB16(target[j],PSHR16(r2[j],2)); }}
开发者ID:TomDataworks,项目名称:whisper_client,代码行数:101,
注:本文中的EXTEND32函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ EXTERNAL_SSE2函数代码示例 C++ EXT4_SB函数代码示例 |