本文整理汇总了C++中L_mac函数的典型用法代码示例。如果您正苦于以下问题:C++ L_mac函数的具体用法?C++ L_mac怎么用?C++ L_mac使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了L_mac函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Pre_Process
void Pre_Process(
PrpStatus *handle,
Word16 signal[], /* input/output signal */
Word16 lg) /* length of signal */
{
Word16 i, x2;
Word32 L_tmp;
for(i=0; i<lg; i++)
{
x2 = handle->x1;
handle->x1 = handle->x0;
handle->x0 = signal[i];
/* y[i] = b[0]*x[i]/2 + b[1]*x[i-1]/2 + b140[2]*x[i-2]/2 */
/* + a[1]*y[i-1] + a[2] * y[i-2]; */
L_tmp = Mpy_32_16(handle->y1_hi, handle->y1_lo, a140[1]);
L_tmp = L_add(L_tmp, Mpy_32_16(handle->y2_hi, handle->y2_lo, a140[2]));
L_tmp = L_mac(L_tmp, handle->x0, b140[0]);
L_tmp = L_mac(L_tmp, handle->x1, b140[1]);
L_tmp = L_mac(L_tmp, x2, b140[2]);
L_tmp = L_shl(L_tmp, 3); /* Q28 --> Q31 (Q12 --> Q15) */
signal[i] = round(L_tmp);
handle->y2_hi = handle->y1_hi;
handle->y2_lo = handle->y1_lo;
L_Extract(L_tmp, &(handle->y1_hi), &(handle->y1_lo));
}
return;
}
开发者ID:huangjingpei,项目名称:webrtc,代码行数:31,代码来源:pre_proc.c
示例2: Post_Process
void Post_Process(
int16_t signal[], /* input/output signal */
int16_t lg) /* length of signal */
{
int16_t i, x2;
int32_t L_tmp;
for(i=0; i<lg; i++)
{
x2 = x1;
x1 = x0;
x0 = signal[i];
/* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2] */
/* + a[1]*y[i-1] + a[2] * y[i-2]; */
L_tmp = Mpy_32_16(y1_hi, y1_lo, a100[1]);
L_tmp = L_add(L_tmp, Mpy_32_16(y2_hi, y2_lo, a100[2]));
L_tmp = L_mac(L_tmp, x0, b100[0]);
L_tmp = L_mac(L_tmp, x1, b100[1]);
L_tmp = L_mac(L_tmp, x2, b100[2]);
L_tmp = L_shl(L_tmp, 2); /* Q29 --> Q31 (Q13 --> Q15) */
/* Multiplication by two of output speech with saturation. */
signal[i] = _round(L_shl(L_tmp, 1));
y2_hi = y1_hi;
y2_lo = y1_lo;
L_Extract(L_tmp, &y1_hi, &y1_lo);
}
return;
}
开发者ID:StevenLOL,项目名称:g729,代码行数:32,代码来源:post_pro.c
示例3: Deemph2_
void Deemph2_(
Word16 x[], /* (i/o) : input signal overwritten by the output */
Word16 mu, /* (i) Q15 : deemphasis factor */
Word16 L, /* (i) : vector size */
Word16 * mem /* (i/o) : memory (y[-1]) */
)
{
Word16 i;
Word32 L_tmp;
/* saturation can occur in L_mac() */
L_tmp = L_mult(x[0], 16384);
L_tmp = L_mac(L_tmp, *mem, mu);
x[0] = round16(L_tmp);
for (i = 1; i < L; i++)
{
L_tmp = L_mult(x[i], 16384);
L_tmp = L_mac(L_tmp, x[i - 1], mu);
x[i] = round16(L_tmp);
}
*mem = x[L - 1];
return;
}
开发者ID:yfang1644,项目名称:DSP55X,代码行数:27,代码来源:deemph.c
示例4: Interpol_3
/*---------------------------------------------------------------------------*
* Procedure Interpol_3() *
* ~~~~~~~~~~~~~~~~~~~~~~ *
* For interpolating the normalized correlation with 1/3 resolution. *
*--------------------------------------------------------------------------*/
Word16 Interpol_3( /* (o) : interpolated value */
Word16 *x, /* (i) : input vector */
Word16 frac /* (i) : fraction */
)
{
Word16 i, k;
Word16 *x1, *x2, *c1, *c2;
Word32 s;
if(frac < 0)
{
frac = add(frac, UP_SAMP);
x--;
}
x1 = &x[0];
x2 = &x[1];
c1 = &inter_3[frac];
c2 = &inter_3[sub(UP_SAMP,frac)];
s = 0;
for(i=0, k=0; i< L_INTER4; i++, k+=UP_SAMP)
{
s = L_mac(s, x1[-i], c1[k]);
s = L_mac(s, x2[i], c2[k]);
}
return round(s);
}
开发者ID:Orange168,项目名称:lumicall_new,代码行数:35,代码来源:pitch.c
示例5: maxeloc
void maxeloc(INT16 *maxloc,
INT32 *maxener,
INT16 *signal,
INT16 dp,
INT16 length,
INT16 ewl)
{
INT32 ener;
register int i;
int tail, front;
ener = 0;
front = add(dp, ewl);
tail = sub(dp, ewl);
for (i = tail; i <= front; i++)
ener = L_mac(ener, signal[i], signal[i]);
*maxloc = 0;
*maxener = ener;
for (i = 1; i < length; i++)
{
front++;
ener = L_msu(ener, signal[tail], signal[tail]);
ener = L_mac(ener, signal[front], signal[front]);
tail++;
if (*maxener < ener)
{
*maxloc = i;
*maxener = ener;
}
}
*maxloc = add(*maxloc,dp);
*maxener = L_shr(*maxener, 1);
}
开发者ID:bigrpg,项目名称:evrcc,代码行数:35,代码来源:maxeloc.c
示例6: sqrts
Word16 sqrts(Word16 x)
{
Word16 xb, y, exp, idx, sub_frac, sub_tab;
Word32 a0;
if(x <= 0){
y = 0;
}
else{
exp = norm_s(x);
/* use 65-entry table */
xb = shl(x, exp); // normalization of x
idx = shr(xb, 9); // for 65 entry table
a0 = L_deposit_h(tabsqrt[idx]); // Q31 table look-up value
sub_frac = shl((Word16)(xb & 0x01FF), 6); // Q15 sub-fraction
sub_tab = sub(tabsqrt[idx+1], tabsqrt[idx]); // Q15 table interval for interpolation
a0 = L_mac(a0, sub_frac, sub_tab); // Q31 linear interpolation between table entries
if(exp & 0x0001){
exp = shr(add(exp, 1), 1); // normalization of sqrt()
a0 = L_shr(a0, exp);
y = intround(a0); // Q15
a0 = L_mac(a0, 13573, y); // Q31 incorporate the missing "/sqrt(2)"
}
else{
exp = shr(exp, 1); // normalization of sqrt()
a0 = L_shr(a0, exp); // Q31
}
y = intround(a0); // Q15
}
return y;
}
开发者ID:Carymax1988,项目名称:Android,代码行数:33,代码来源:mathutil.c
示例7: Pre_Process
void Pre_Process(
Word16 signal[], /* input/output signal */
Word16 lg) /* length of signal */
{
Word16 i, x2;
Word32 L_tmp;
for(i=0; i<lg; i++)
{
x2 = x1;
x1 = x0;
x0 = signal[i];
/* y[i] = b[0]*x[i]/2 + b[1]*x[i-1]/2 + b140[2]*x[i-2]/2 */
/* + a[1]*y[i-1] + a[2] * y[i-2]; */
L_tmp = Mpy_32_16(y1_hi, y1_lo, a140[1]);
L_tmp = L_add(L_tmp, Mpy_32_16(y2_hi, y2_lo, a140[2]));
L_tmp = L_mac(L_tmp, x0, b140[0]);
L_tmp = L_mac(L_tmp, x1, b140[1]);
L_tmp = L_mac(L_tmp, x2, b140[2]);
L_tmp = L_shl(L_tmp, 3); /* Q28 --> Q31 (Q12 --> Q15) */
signal[i] = round(L_tmp);
y2_hi = y1_hi;
y2_lo = y1_lo;
L_Extract(L_tmp, &y1_hi, &y1_lo);
}
return;
}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:30,代码来源:PRE_PROC.C
示例8: Post_Process
void Post_Process(
PopStatus *handle,
Word16 signal[], /* input/output signal */
Word16 lg) /* length of signal */
{
Word16 i, x2;
Word32 L_tmp;
for(i=0; i<lg; i++)
{
x2 = handle->x1;
handle->x1 = handle->x0;
handle->x0 = signal[i];
/* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2] */
/* + a[1]*y[i-1] + a[2] * y[i-2]; */
L_tmp = Mpy_32_16(handle->y1_hi, handle->y1_lo, a100[1]);
L_tmp = L_add(L_tmp, Mpy_32_16(handle->y2_hi, handle->y2_lo, a100[2]));
L_tmp = L_mac(L_tmp, handle->x0, b100[0]);
L_tmp = L_mac(L_tmp, handle->x1, b100[1]);
L_tmp = L_mac(L_tmp, x2, b100[2]);
L_tmp = L_shl(L_tmp, 2); /* Q29 --> Q31 (Q13 --> Q15) */
/* Multiplication by two of output speech with saturation. */
signal[i] = round(L_shl(L_tmp, 1));
handle->y2_hi = handle->y1_hi;
handle->y2_lo = handle->y1_lo;
L_Extract(L_tmp, &(handle->y1_hi), &(handle->y1_lo));
}
return;
}
开发者ID:huangjingpei,项目名称:webrtc,代码行数:33,代码来源:post_pro.c
示例9: Deemph
//==========================================================================
//函数功能:过滤要求的信号,为32位信号将信号一分为二
//函数参数:"x[]"表示输入信号的输出覆盖,既是输入参数又是输出参数;"mu"表示释
// 放因子,作为输入参数;"L"表示向量的大小,作为输入参数;"mem"表示存
// 储器的记忆
//==========================================================================
void Deemph(
Word16 x[], /* (i/o) : input signal overwritten by the output */
Word16 mu, /* (i) Q15 : deemphasis factor */
Word16 L, /* (i) : vector size */
Word16 * mem /* (i/o) : memory (y[-1]) */
)
{
Word32 i;
Word32 L_tmp;
L_tmp = L_deposit_h(x[0]);
L_tmp = L_mac(L_tmp, *mem, mu);
x[0] = vo_round(L_tmp);
for (i = 1; i < L; i++)
{
L_tmp = L_deposit_h(x[i]);
L_tmp = L_mac(L_tmp, x[i - 1], mu);
x[i] = voround(L_tmp);
}
*mem = x[L - 1];
return;
}
开发者ID:liupeng110,项目名称:android-media-codec,代码行数:31,代码来源:deemph.c
示例10: Calc_RCoeff
static void Calc_RCoeff(Word16 *Coeff, Word16 *RCoeff, Word16 *sh_RCoeff)
{
Word16 i, j;
Word16 sh1;
Word32 L_acc;
/* RCoeff[0] = SUM(j=0->M) Coeff[j] ** 2 */
L_acc = 0L;
for(j=0; j <= M; j++) {
L_acc = L_mac(L_acc, Coeff[j], Coeff[j]);
}
/* Compute exponent RCoeff */
sh1 = norm_l(L_acc);
L_acc = L_shl(L_acc, sh1);
RCoeff[0] = round(L_acc);
/* RCoeff[i] = SUM(j=0->M-i) Coeff[j] * Coeff[j+i] */
for(i=1; i<=M; i++) {
L_acc = 0L;
for(j=0; j<=M-i; j++) {
L_acc = L_mac(L_acc, Coeff[j], Coeff[j+i]);
}
L_acc = L_shl(L_acc, sh1);
RCoeff[i] = round(L_acc);
}
*sh_RCoeff = sh1;
return;
}
开发者ID:huangjingpei,项目名称:webrtc,代码行数:29,代码来源:dtx.c
示例11: Pre_Process
void
Pre_Process (CodState *coder,
Word16 signal[], /* input/output signal */
Word16 lg)
{ /* length of signal */
Word16 i, x2;
Word32 L_tmp;
for (i = 0; i < lg; i++) {
x2 = coder->x1;
coder->x1 = coder->x0;
coder->x0 = signal[i];
/* y[i] = b[0]*x[i]/2 + b[1]*x[i-1]/2 + b140[2]*x[i-2]/2 */
/* + a[1]*y[i-1] + a[2] * y[i-2]; */
L_tmp = Mpy_32_16 (coder->y1_hi, coder->y1_lo, a140[1]);
L_tmp = L_add (L_tmp, Mpy_32_16 (coder->y2_hi, coder->y2_lo, a140[2]));
L_tmp = L_mac (L_tmp, coder->x0, b140[0]);
L_tmp = L_mac (L_tmp, coder->x1, b140[1]);
L_tmp = L_mac (L_tmp, x2, b140[2]);
L_tmp = L_shl (L_tmp, 3); /* Q28 --> Q31 (Q12 --> Q15) */
signal[i] = wround (L_tmp);
coder->y2_hi = coder->y1_hi;
coder->y2_lo = coder->y1_lo;
L_Extract (L_tmp, &coder->y1_hi, &coder->y1_lo);
}
return;
}
开发者ID:FreeMCU,项目名称:freemcu,代码行数:30,代码来源:pre_proc.c
示例12: Deemph_32_
void Deemph_32_(
Word16 x_hi[], /* (i) : input signal (bit31..16) */
Word16 x_lo[], /* (i) : input signal (bit15..4) */
Word16 y[], /* (o) : output signal (x16) */
Word16 mu, /* (i) Q15 : deemphasis factor */
Word16 L, /* (i) : vector size */
Word16 * mem /* (i/o) : memory (y[-1]) */
)
{
Word16 i;
Word32 L_tmp;
/* L_tmp = hi<<16 + lo<<4 */
L_tmp = (Word32)x_hi[0] << 16;
L_tmp = L_tmp + ((Word32)x_lo[0] << 4);
L_tmp = L_shl(L_tmp, 4);
L_tmp = L_mac(L_tmp, *mem, mu); /* saturation can occur here */
y[0] = round16(L_tmp);
for (i = 1; i < L; i++)
{
L_tmp = (Word32)x_hi[i] << 16;
L_tmp = L_tmp + ((Word32)x_lo[i] << 4);
L_tmp = L_shl(L_tmp, 4);
L_tmp = L_mac(L_tmp, y[i - 1], mu); /* saturation can occur here */
y[i] = round16(L_tmp);
}
*mem = y[L - 1];
return;
}
开发者ID:yfang1644,项目名称:DSP55X,代码行数:33,代码来源:deemph.c
示例13: Autocorr
/*-----------------------------------------------------*
* Function Autocorr() *
* *
* Compute autocorrelations of signal with windowing *
* *
*-----------------------------------------------------*/
void Autocorr(
Word16 x[], /* (i) : Input signal */
Word16 m, /* (i) : LPC order */
Word16 r_h[], /* (o) : Autocorrelations (msb) */
Word16 r_l[] /* (o) : Autocorrelations (lsb) */
)
{
Word16 i, j, norm;
Word16 y[L_WINDOW];
Word32 sum;
extern Flag Overflow;
/* Windowing of signal */
for(i=0; i<L_WINDOW; i++)
{
y[i] = mult_r(x[i], hamwindow[i]);
}
/* Compute r[0] and test for overflow */
do {
Overflow = 0;
sum = 1; /* Avoid case of all zeros */
for(i=0; i<L_WINDOW; i++)
sum = L_mac(sum, y[i], y[i]);
/* If overflow divide y[] by 4 */
if(Overflow != 0)
{
for(i=0; i<L_WINDOW; i++)
{
y[i] = shr(y[i], 2);
}
}
}while (Overflow != 0);
/* Normalization of r[0] */
norm = norm_l(sum);
sum = L_shl(sum, norm);
L_Extract(sum, &r_h[0], &r_l[0]); /* Put in DPF format (see oper_32b) */
/* r[1] to r[m] */
for (i = 1; i <= m; i++)
{
sum = 0;
for(j=0; j<L_WINDOW-i; j++)
sum = L_mac(sum, y[j], y[j+i]);
sum = L_shl(sum, norm);
L_Extract(sum, &r_h[i], &r_l[i]);
}
return;
}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:64,代码来源:lpce.c
示例14: Lag_max
static Word16 Lag_max( /* output: lag found */
Word16 signal[], /* input : signal used to compute the open loop pitch */
Word16 L_frame, /* input : length of frame to compute pitch */
Word16 lag_max, /* input : maximum lag */
Word16 lag_min, /* input : minimum lag */
Word16 *cor_max) /* output: normalized correlation of selected lag */
{
Word16 i, j;
Word16 *p, *p1;
Word32 max, t0, L_temp;
Word16 max_h, max_l, ener_h, ener_l;
Word16 p_max;
max = MIN_32;
/* initialization used only to suppress Microsoft Visual C++ warnings */
p_max = lag_max;
for (i = lag_max; i >= lag_min; i--)
{
p = signal;
p1 = &signal[-i];
t0 = 0;
for (j=0; j<L_frame; j++, p++, p1++)
t0 = L_mac(t0, *p, *p1);
L_temp = L_sub(t0,max);
if (L_temp >= 0L)
{
max = t0;
p_max = i;
}
}
/* compute energy */
t0 = 0;
p = &signal[-p_max];
for(i=0; i<L_frame; i++, p++)
t0 = L_mac(t0, *p, *p);
/* 1/sqrt(energy), result in Q30 */
t0 = Inv_sqrt(t0);
/* max = max/sqrt(energy) */
/* This result will always be on 16 bits !! */
L_Extract(max, &max_h, &max_l);
L_Extract(t0, &ener_h, &ener_l);
t0 = Mpy_32(max_h, max_l, ener_h, ener_l);
*cor_max = extract_l(t0);
return(p_max);
}
开发者ID:Orange168,项目名称:lumicall_new,代码行数:58,代码来源:pitch.c
示例15: Corr_xy2
void Corr_xy2(
Word16 xn[], /* (i) Q0 :Target vector. */
Word16 y1[], /* (i) Q0 :Adaptive codebook. */
Word16 y2[], /* (i) Q12 :Filtered innovative vector. */
Word16 g_coeff[], /* (o) Q[exp]:Correlations between xn,y1,y2 */
Word16 exp_g_coeff[] /* (o) :Q-format of g_coeff[] */
)
{
Word16 i,exp;
Word16 exp_y2y2,exp_xny2,exp_y1y2;
Word16 y2y2, xny2, y1y2;
Word32 L_acc;
Word16 scaled_y2[L_SUBFR]; /* Q9 */
/*------------------------------------------------------------------*
* Scale down y2[] from Q12 to Q9 to avoid overflow *
*------------------------------------------------------------------*/
for(i=0; i<L_SUBFR; i++) {
scaled_y2[i] = shr(y2[i], 3); }
/* Compute scalar product <y2[],y2[]> */
L_acc = 1; /* Avoid case of all zeros */
for(i=0; i<L_SUBFR; i++)
L_acc = L_mac(L_acc, scaled_y2[i], scaled_y2[i]); /* L_acc:Q19 */
exp = norm_l(L_acc);
y2y2 = round( L_shl(L_acc, exp) );
exp_y2y2 = add(exp, 19-16); /* Q[19+exp-16] */
g_coeff[2] = y2y2;
exp_g_coeff[2] = exp_y2y2;
/* Compute scalar product <xn[],y2[]> */
L_acc = 1; /* Avoid case of all zeros */
for(i=0; i<L_SUBFR; i++)
L_acc = L_mac(L_acc, xn[i], scaled_y2[i]); /* L_acc:Q10 */
exp = norm_l(L_acc);
xny2 = round( L_shl(L_acc, exp) );
exp_xny2 = add(exp, 10-16); /* Q[10+exp-16] */
g_coeff[3] = negate(xny2);
exp_g_coeff[3] = sub(exp_xny2,1); /* -2<xn,y2> */
/* Compute scalar product <y1[],y2[]> */
L_acc = 1; /* Avoid case of all zeros */
for(i=0; i<L_SUBFR; i++)
L_acc = L_mac(L_acc, y1[i], scaled_y2[i]); /* L_acc:Q10 */
exp = norm_l(L_acc);
y1y2 = round( L_shl(L_acc, exp) );
exp_y1y2 = add(exp, 10-16); /* Q[10+exp-16] */
g_coeff[4] = y1y2;
exp_g_coeff[4] = sub(exp_y1y2,1); ; /* 2<y1,y2> */
return;
}
开发者ID:Orange168,项目名称:lumicall_new,代码行数:58,代码来源:cor_func.c
示例16: set_sign
/*-------------------------------------------------------------------*
* Function set_sign() *
* ~~~~~~~~~~~~~~~~~~~~ *
* Set the sign of each pulse position. *
*-------------------------------------------------------------------*/
static void set_sign(
Word16 fac_cn, /* (i) Q15: residual weight for sign determination */
Word16 cn[], /* (i) Q0 : residual after long term prediction */
Word16 dn[], /* (i) Q0 : correlation between target and h[] */
Word16 sign[], /* (o) Q15: sign vector (sign of each position) */
Word16 inv_sign[], /* (o) Q15: inverse of sign[] */
Word16 pos_max[], /* (o) : pos of max of correlation */
Word32 corr[] /* (o) : correlation of each track */
)
{
Word16 i, k, pos, k_cn, k_dn, val;
Word32 s, max;
/* calculate energy for normalization of cn[] and dn[] */
s = 0;
for (i=0; i<L_SUBFR; i++) s = L_mac(s, cn[i], cn[i]);
if (s < 512) s = 512;
s = Inv_sqrt(s);
k_cn = extract_h(L_shl(s, 5)); /* k_cn = 11..23170 */
k_cn = mult(k_cn, fac_cn);
s = 0;
for (i=0; i<L_SUBFR; i++) s = L_mac(s, dn[i], dn[i]);
if (s < 512) s = 512;
s = Inv_sqrt(s);
k_dn = extract_h(L_shl(s, 5)); /* k_dn = 11..23170 */
/* set sign according to en[] = k_cn*cn[] + k_dn*dn[] */
/* find position of maximum of correlation in each track */
for (k=0; k<NB_TRACK; k++) {
max = -1;
for (i=k; i<L_SUBFR; i+=STEP) {
val = dn[i];
s = L_mac(L_mult(k_cn, cn[i]), k_dn, val);
if (s >= 0) {
sign[i] = 32767L; /* sign = +1 (Q15) */
inv_sign[i] = -32768L;
}
else {
sign[i] = -32768L; /* sign = -1 (Q15) */
inv_sign[i] = 32767L;
val = negate(val);
}
dn[i] = val; /* modify dn[] according to the fixed sign */
s = L_abs(s);
if (s > max) {
max = s;
pos = i;
}
}
pos_max[k] = pos;
corr[k] = max;
}
return;
}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:62,代码来源:acelp_e.c
示例17: Mpy_32
Word32 Mpy_32(Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2)
{
Word32 L_32;
L_32 = L_mult(hi1, hi2);
L_32 = L_mac(L_32, mult(hi1, lo2) , 1);
L_32 = L_mac(L_32, mult(lo1, hi2) , 1);
return( L_32 );
}
开发者ID:2831942318,项目名称:siphon,代码行数:10,代码来源:oper_32b.c
示例18: Vq_subvec
static Word16 Vq_subvec (/* o : quantization index, Q0 */
Word16 *lsf_r1, /* i : 1st LSF residual vector, Q15 */
Word16 *lsf_r2, /* i : 2nd LSF residual vector, Q15 */
const Word16 *dico, /* i : quantization codebook, Q15 */
Word16 *wf1, /* i : 1st LSF weighting factors Q13 */
Word16 *wf2, /* i : 2nd LSF weighting factors Q13 */
Word16 dico_size /* i : size of quantization codebook, Q0 */
)
{
Word16 index = 0; /* initialization only needed to keep gcc silent */
Word16 i, temp;
const Word16 *p_dico;
Word32 dist_min, dist;
dist_min = MAX_32; move32 ();
p_dico = dico; move16 ();
for (i = 0; i < dico_size; i++)
{
temp = sub (lsf_r1[0], *p_dico++);
temp = mult (wf1[0], temp);
dist = L_mult (temp, temp);
temp = sub (lsf_r1[1], *p_dico++);
temp = mult (wf1[1], temp);
dist = L_mac (dist, temp, temp);
temp = sub (lsf_r2[0], *p_dico++);
temp = mult (wf2[0], temp);
dist = L_mac (dist, temp, temp);
temp = sub (lsf_r2[1], *p_dico++);
temp = mult (wf2[1], temp);
dist = L_mac (dist, temp, temp);
test ();
if (L_sub (dist, dist_min) < (Word32) 0)
{
dist_min = dist; move32 ();
index = i; move16 ();
}
}
/* Reading the selected vector */
p_dico = &dico[shl (index, 2)]; move16 ();
lsf_r1[0] = *p_dico++; move16 ();
lsf_r1[1] = *p_dico++; move16 ();
lsf_r2[0] = *p_dico++; move16 ();
lsf_r2[1] = *p_dico++; move16 ();
return index;
}
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:54,代码来源:q_plsf_5.c
示例19: Post_Process
void Post_Process(
Word16 signal[], /* input/output signal */
Word16 lg) /* length of signal */
{
Word16 i, x2;
Word32 L_tmp;
Word16 y2_hi, y2_lo, y1_hi, y1_lo, x0, x1;
y2_hi = pg729dec->ppost_pro->y2_hi;
y2_lo = pg729dec->ppost_pro->y2_lo;
y1_hi = pg729dec->ppost_pro->y1_hi;
y1_lo = pg729dec->ppost_pro->y1_lo;
x0 = pg729dec->ppost_pro->x0;
x1 = pg729dec->ppost_pro->x1;
for(i=0; i<lg; i++)
{
x2 = x1;
x1 = x0;
x0 = signal[i];
/* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2] */
/* + a[1]*y[i-1] + a[2] * y[i-2]; */
L_tmp = Mpy_32_16(y1_hi, y1_lo, a100[1]);
L_tmp = L_add(L_tmp, Mpy_32_16(y2_hi, y2_lo, a100[2]));
L_tmp = L_mac(L_tmp, x0, b100[0]);
L_tmp = L_mac(L_tmp, x1, b100[1]);
L_tmp = L_mac(L_tmp, x2, b100[2]);
L_tmp = L_shl(L_tmp, 2); /* Q29 --> Q31 (Q13 --> Q15) */
/* Multiplication by two of output speech with saturation. */
signal[i] = round(L_shl(L_tmp, 1));
y2_hi = y1_hi;
y2_lo = y1_lo;
L_Extract(L_tmp, &y1_hi, &y1_lo);
}
pg729dec->ppost_pro->y2_hi = y2_hi;
pg729dec->ppost_pro->y2_lo = y2_lo;
pg729dec->ppost_pro->y1_hi = y1_hi;
pg729dec->ppost_pro->y1_lo = y1_lo;
pg729dec->ppost_pro->x0 = x0;
pg729dec->ppost_pro->x1 = x1;
return;
}
开发者ID:eager7,项目名称:linux-kernel,代码行数:50,代码来源:post_pro.c
示例20: rmlt_coefs_to_samples
void rmlt_coefs_to_samples(int16_t coefs[],
int16_t old_samples[],
int16_t out_samples[],
int dct_length,
int16_t mag_shift)
{
int i;
int half_dct_length;
int last;
int16_t new_samples[MAX_DCT_LENGTH];
const int16_t *win;
int32_t sum;
half_dct_length = dct_length >> 1;
/* Perform a Type IV (inverse) DCT on the coefficients */
dct_type_iv_s(coefs, new_samples, dct_length);
if (mag_shift > 0)
{
for (i = 0; i < dct_length; i++)
new_samples[i] = shr(new_samples[i], mag_shift);
}
else if (mag_shift < 0)
{
mag_shift = negate(mag_shift);
for (i = 0; i < dct_length; i++)
new_samples[i] = shl(new_samples[i], mag_shift);
}
win = (dct_length == DCT_LENGTH) ? rmlt_to_samples_window : max_rmlt_to_samples_window;
last = half_dct_length - 1;
for (i = 0; i < half_dct_length; i++)
{
/* Get the first half of the windowed samples */
sum = L_mult(win[i], new_samples[last - i]);
sum = L_mac(sum, win[dct_length - i - 1], old_samples[i]);
out_samples[i] = xround(L_shl(sum, 2));
/* Get the second half of the windowed samples */
sum = L_mult(win[half_dct_length + i], new_samples[i]);
sum = L_mac(sum, negate(win[last - i]), old_samples[last - i]);
out_samples[half_dct_length + i] = xround(L_shl(sum, 2));
}
/* Save the second half of the new samples for
next time, when they will be the old samples. */
vec_copyi16(old_samples, &new_samples[half_dct_length], half_dct_length);
}
开发者ID:prudens,项目名称:audioengine,代码行数:48,代码来源:coef2sam.c
注:本文中的L_mac函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论