本文整理汇总了C++中L_mult函数的典型用法代码示例。如果您正苦于以下问题:C++ L_mult函数的具体用法?C++ L_mult怎么用?C++ L_mult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了L_mult函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WebRtcG729fix_Random
int16_t WebRtcG729fix_Random(int16_t *seed)
{
/* seed = seed*31821 + 13849; */
*seed = extract_l(WebRtcSpl_AddSatW32(L_shr(L_mult(*seed, 31821), 1), 13849L));
return(*seed);
}
示例2: Lsp_lsf
void Lsp_lsf(
Word16 lsp[], /* (i) Q15 : lsp[m] (range: -1<=val<1) */
Word16 lsf[], /* (o) Q15 : lsf[m] normalized (range: 0.0<=val<=0.5) */
Word16 m /* (i) : LPC order */
)
{
Word16 i, ind, tmp;
Word32 L_tmp;
ind = 63; /* begin at end of table -1 */
for(i= m-(Word16)1; i >= 0; i--)
{
/* find value in table that is just greater than lsp[i] */
while(table[ind] < lsp[i])
{
ind = sub(ind,1);
}
/* acos(lsp[i])= ind*256 + ( ( lsp[i]-table[ind] ) * slope[ind] )/4096 */
L_tmp = L_mult( sub(lsp[i], table[ind]) , slope[ind] );
tmp = round(L_shl(L_tmp, 3)); /*(lsp[i]-table[ind])*slope[ind])>>12*/
lsf[i] = add(tmp, shl(ind, 8));
}
return;
}
示例3: Lsp_prev_extract
/*
extract elementary LSP from composed LSP with previous LSP
*/
void Lsp_prev_extract(
Word16 lsp[M], /* (i) Q13 : unquantized LSP parameters */
Word16 lsp_ele[M], /* (o) Q13 : target vector */
Word16 fg[MA_NP][M], /* (i) Q15 : MA prediction coef. */
Word16 freq_prev[MA_NP][M], /* (i) Q13 : previous LSP vector */
Word16 fg_sum_inv[M] /* (i) Q12 : inverse previous LSP vector */
)
{
Word16 j, k;
Word32 L_temp; /* Q19 */
Word16 temp; /* Q13 */
for ( j = 0 ; j < M ; j++ ) {
L_temp = L_deposit_h(lsp[j]);
for ( k = 0 ; k < MA_NP ; k++ )
L_temp = L_msu( L_temp, freq_prev[k][j], fg[k][j] );
temp = extract_h(L_temp);
L_temp = L_mult( temp, fg_sum_inv[j] );
lsp_ele[j] = extract_h( L_shl( L_temp, 3 ) );
}
return;
}
示例4: filt_plt
/*----------------------------------------------------------------------------
* filt_plt - ltp postfilter
*----------------------------------------------------------------------------
*/
static void filt_plt(
Word16 *s_in, /* input : input signal with past*/
Word16 *s_ltp, /* input : filtered signal with gain 1 */
Word16 *s_out, /* output: output signal */
Word16 gain_plt /* input : filter gain */
)
{
/* Local variables */
int n;
Word32 L_acc;
Word16 gain_plt_1;
gain_plt_1 = sub(32767, gain_plt);
gain_plt_1 = add(gain_plt_1, 1); /* 2**15 (1 - g) */
for(n=0; n<L_SUBFR; n++) {
/* s_out(n) = gain_plt x s_in(n) + gain_plt_1 x s_ltp(n) */
L_acc = L_mult(gain_plt, s_in[n]);
L_acc = L_mac(L_acc, gain_plt_1, s_ltp[n]); /* no overflow */
s_out[n] = round(L_acc);
}
return;
}
示例5: Lsf_lsp2
void Lsf_lsp2(
Word16 lsf[], /* (i) Q13 : lsf[m] (range: 0.0<=val<PI) */
Word16 lsp[], /* (o) Q15 : lsp[m] (range: -1<=val<1) */
Word16 m /* (i) : LPC order */
)
{
Word16 i, ind;
Word16 offset; /* in Q8 */
Word16 freq; /* normalized frequency in Q15 */
Word32 L_tmp;
for(i=0; i<m; i++)
{
/* freq = abs_s(freq);*/
freq = mult(lsf[i], 20861); /* 20861: 1.0/(2.0*PI) in Q17 */
ind = shr(freq, 8); /* ind = b8-b15 of freq */
offset = freq & (Word16)0x00ff; /* offset = b0-b7 of freq */
if (ind > 63){
ind = 63; /* 0 <= ind <= 63 */
}
/* lsp[i] = table2[ind]+ (slope_cos[ind]*offset >> 12) */
L_tmp = L_mult(slope_cos[ind], offset); /* L_tmp in Q28 */
lsp[i] = add(table2[ind], extract_l(L_shr(L_tmp, 13)));
}
return;
}
示例6: Get_lsp_pol
static void Get_lsp_pol(Word16 *lsp, Word32 *f)
{
Word16 i,j, hi, lo;
Word32 t0;
/* All computation in Q24 */
*f = L_mult(4096, 2048); /* f[0] = 1.0; in Q24 */
f++;
*f = L_msu((Word32)0, *lsp, 512); /* f[1] = -2.0 * lsp[0]; in Q24 */
f++;
lsp += 2; /* Advance lsp pointer */
for(i=2; i<=5; i++)
{
*f = f[-2];
for(j=1; j<i; j++, f--)
{
L_Extract(f[-1] ,&hi, &lo);
t0 = Mpy_32_16(hi, lo, *lsp); /* t0 = f[-1] * lsp */
t0 = L_shl(t0, 1);
*f = L_add(*f, f[-2]); /* *f += f[-2] */
*f = L_sub(*f, t0); /* *f -= t0 */
}
*f = L_msu(*f, *lsp, 512); /* *f -= lsp<<9 */
f += i; /* Advance f pointer */
lsp += 2; /* Advance lsp pointer */
}
return;
}
示例7: Lsp_lsf2
void Lsp_lsf2(
Word16 lsp[], /* (i) Q15 : lsp[m] (range: -1<=val<1) */
Word16 lsf[], /* (o) Q13 : lsf[m] (range: 0.0<=val<PI) */
Word16 m /* (i) : LPC order */
)
{
Word16 i, ind;
Word16 offset; /* in Q15 */
Word16 freq; /* normalized frequency in Q16 */
Word32 L_tmp;
ind = 63; /* begin at end of table2 -1 */
for(i= m-(Word16)1; i >= 0; i--)
{
/* find value in table2 that is just greater than lsp[i] */
while( sub(table2[ind], lsp[i]) < 0 )
{
ind = sub(ind,1);
if ( ind <= 0 )
break;
}
offset = sub(lsp[i], table2[ind]);
/* acos(lsp[i])= ind*512 + (slope_acos[ind]*offset >> 11) */
L_tmp = L_mult( slope_acos[ind], offset ); /* L_tmp in Q28 */
freq = add(shl(ind, 9), extract_l(L_shr(L_tmp, 12)));
lsf[i] = mult(freq, 25736); /* 25736: 2.0*PI in Q12 */
}
return;
}
示例8: build_CN_code
/***************************************************************************
*
* Function : build_CN_code
*
***************************************************************************/
void build_CN_code (
Word32 *seed, /* i/o : Old CN generator shift register state */
Word16 cod[] /* o : Generated CN fixed codebook vector */
)
{
Word16 i, j, k;
for (i = 0; i < L_SUBFR; i++)
{
cod[i] = 0;
}
for (k = 0; k < NB_PULSE10; k++)
{
i = pseudonoise (seed, 2); /* generate pulse position */
i = shr (extract_l (L_mult (i, 10)), 1);
i = i + k;
j = pseudonoise (seed, 1); /* generate sign */
if (j > 0)
{
cod[i] = 4096;
}
else
{
cod[i] = -4096;
}
}
return;
}
示例9: Random
Word16 Random(Word16 *seed)
{
/* seed = seed*31821 + 13849; */
*seed = extract_l(L_add(L_shr(L_mult(*seed, 31821), 1), 13849L));
return(*seed);
}
示例10: Mpy_32_16
Word32 Mpy_32_16(Word16 hi, Word16 lo, Word16 n)
{
Word32 L_32;
L_32 = L_mult(hi, n);
L_32 = L_mac(L_32, mult(lo, n) , 1);
return( L_32 );
}
示例11: 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;
}
示例12: Weight_Az
void Weight_Az(
Word16 a[], /* (i) Q12 : a[m+1] LPC coefficients */
Word16 gamma, /* (i) Q15 : Spectral expansion factor. */
Word16 m, /* (i) : LPC order. */
Word16 ap[] /* (o) Q12 : Spectral expanded LPC coefficients */
)
{
Word16 i, fac;
ap[0] = a[0];
fac = gamma;
for(i=1; i<m; i++)
{
ap[i] = round( L_mult(a[i], fac) );
fac = round( L_mult(fac, gamma) );
}
ap[m] = round( L_mult(a[m], fac) );
}
示例13: WebRtcG729fix_Weight_Az
void WebRtcG729fix_Weight_Az(
int16_t a[], /* (i) Q12 : a[m+1] LPC coefficients */
int16_t gamma, /* (i) Q15 : Spectral expansion factor. */
int16_t m, /* (i) : LPC order. */
int16_t ap[] /* (o) Q12 : Spectral expanded LPC coefficients */
)
{
int16_t i, fac;
ap[0] = a[0];
fac = gamma;
for(i=1; i<m; i++)
{
ap[i] = L_round( L_mult(a[i], fac) );
fac = L_round( L_mult(fac, gamma) );
}
ap[m] = L_round( L_mult(a[m], fac) );
}
示例14: compress10
static Word16 compress10 (
Word16 pos_indxA, /* i : signs of 4 pulses (signs only) */
Word16 pos_indxB, /* i : position index of 8 pulses (pos only) */
Word16 pos_indxC) /* i : position and sign of 8 pulses (compressed) */
{
Word16 indx, ia,ib,ic;
ia = shr(pos_indxA, 1);
ib = extract_l(L_shr(L_mult(shr(pos_indxB, 1), 5), 1));
ic = extract_l(L_shr(L_mult(shr(pos_indxC, 1), 25), 1));
indx = shl(add(ia, add(ib, ic)), 3);
ia = pos_indxA & 1; logic16 ();
ib = shl((pos_indxB & 1), 1); logic16 ();
ic = shl((pos_indxC & 1), 2); logic16 ();
indx = add(indx , add(ia, add(ib, ic)));
return indx;
}
示例15: 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 );
}