本文整理汇总了C++中L_mult函数的典型用法代码示例。如果您正苦于以下问题:C++ L_mult函数的具体用法?C++ L_mult怎么用?C++ L_mult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了L_mult函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:sippet,项目名称:g729,代码行数:7,代码来源:util.c
示例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;
}
开发者ID:huangjingpei,项目名称:webrtc,代码行数:27,代码来源:lpcfunc.c
示例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;
}
开发者ID:eager7,项目名称:linux-kernel,代码行数:28,代码来源:lspgetq.c
示例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;
}
开发者ID:thecc4re,项目名称:lumicall,代码行数:29,代码来源:pst.c
示例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;
}
开发者ID:huangjingpei,项目名称:webrtc,代码行数:30,代码来源:lpcfunc.c
示例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;
}
开发者ID:Orange168,项目名称:lumicall_new,代码行数:33,代码来源:lpcfunc.c
示例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;
}
开发者ID:Orange168,项目名称:lumicall_new,代码行数:34,代码来源:lpcfunc.c
示例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;
}
开发者ID:NearZhxiAo,项目名称:3730,代码行数:38,代码来源:build_cn_code.c
示例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);
}
开发者ID:Orange168,项目名称:lumicall_new,代码行数:8,代码来源:util.c
示例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 );
}
开发者ID:2831942318,项目名称:siphon,代码行数:9,代码来源:oper_32b.c
示例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;
}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:62,代码来源:acelp_e.c
示例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) );
}
开发者ID:LeeonYu,项目名称:sipdroid,代码行数:18,代码来源:lpcfunc_equivalent_c.c
示例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) );
}
开发者ID:sippet,项目名称:g729,代码行数:18,代码来源:lpcfunc.c
示例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;
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:19,代码来源:c8_31pf.c
示例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 );
}
开发者ID:2831942318,项目名称:siphon,代码行数:10,代码来源:oper_32b.c
示例16: 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
示例17: fnLog2
Word32 fnLog2(Word32 L_Input)
{
static Word16
swC0 = -0x2b2a, swC1 = 0x7fc5, swC2 = -0x54d0;
Word16 siShiftCnt, swInSqrd, swIn;
Word32 LwIn;
/*_________________________________________________________________________
| |
| Executable Code |
|_________________________________________________________________________|
*/
/* normalize input and store shifts required */
/* ----------------------------------------- */
siShiftCnt = norm_l(L_Input);
LwIn = L_shl(L_Input, siShiftCnt);
siShiftCnt = add(siShiftCnt, 1);
siShiftCnt = negate(siShiftCnt);
/* calculate x*x*c0 */
/* ---------------- */
swIn = extract_h(LwIn);
swInSqrd = mult_r(swIn, swIn);
LwIn = L_mult(swInSqrd, swC0);
/* add x*c1 */
/* --------- */
LwIn = L_mac(LwIn, swIn, swC1);
/* add c2 */
/* ------ */
LwIn = L_add(LwIn, L_deposit_h(swC2));
/* apply *(4/32) */
/* ------------- */
LwIn = L_shr(LwIn, 3);
LwIn = LwIn & 0x03ffffff;
siShiftCnt = shl(siShiftCnt, 10);
LwIn = L_add(LwIn, L_deposit_h(siShiftCnt));
/* return log2 */
/* ----------- */
return (LwIn);
}
开发者ID:RupW,项目名称:celp13k,代码行数:53,代码来源:math_adv.c
示例18: FNevChebP
Word16 FNevChebP(
Word16 x, /* (i) Q15: value */
Word16 *t_man, /* (i) Q7: mantissa of coefficients */
Word16 *t_exp, /* (i): exponent fo cofficients */
Word16 nd2) /* (i): order */
{
Word16 i;
Word16 x2;
Word16 b_man[NAB], b_exp[NAB];
Word16 y;
Word32 a0;
x2 = x; // 2x in Q14
b_man[0] = t_man[nd2];
b_exp[0] = t_exp[nd2]; // b[0] in Q(7+t_exp)
a0 = L_mult(x2, b_man[0]);
a0 = L_shr(a0, sub(b_exp[0], 1)); // t*b[0] in Q23
a0 = L_add(a0, L_shr(L_deposit_h(t_man[nd2-1]), t_exp[nd2-1])); // c[nd2-1] + t*b[0] in Q23
b_exp[1] = norm_l(a0);
b_man[1] = intround(L_shl(a0, b_exp[1])); // b[1] = c[nd2-1] + t * b[0]
for (i=2;i<nd2;i++){
a0 = L_mult(x2, b_man[i-1]);
a0 = L_shr(a0, sub(b_exp[i-1], 1)); // t*b[i-1] in Q23
a0 = L_add(a0, L_shr(L_deposit_h(t_man[nd2-i]), t_exp[nd2-i]));// c[nd2-i] + t*b[i-1] in Q23
a0 = L_sub(a0, L_shr(L_deposit_h(b_man[i-2]), b_exp[i-2])); // c[nd2-i] + t*b[i-1] - b[i-2] in Q23
b_exp[i] = norm_l(a0);
b_man[i] = intround(L_shl(a0, b_exp[i])); // b[i] = c[nd2-i] - b[i-2] + t * b[i-1]
}
a0 = L_mult(x, b_man[nd2-1]);
a0 = L_shr(a0, b_exp[nd2-1]); // x*b[nd2-1] in Q23
a0 = L_add(a0, L_shr(L_deposit_h(t_man[0]), t_exp[0])); // c[0] + x*b[nd2-1] in Q23
a0 = L_sub(a0, L_shr(L_deposit_h(b_man[nd2-2]), b_exp[nd2-2])); // c[0] + x*b[nd2-1] - b[nd2-2] in Q23
y = intround(L_shl(a0, 6)); // Q13
return y; // Q13
}
开发者ID:371816210,项目名称:mysipdroid,代码行数:39,代码来源:a2lsp.c
示例19: MR475_quant_store_results
/*
********************************************************************************
* PRIVATE PROGRAM CODE
********************************************************************************
*/
void MR475_quant_store_results(
gc_predState *pred_st, /* i/o: gain predictor state struct */
const Word16 *p, /* i : pointer to selected quantizer table entry */
Word16 gcode0, /* i : predicted CB gain, Q(14 - exp_gcode0) */
Word16 exp_gcode0, /* i : exponent of predicted CB gain, Q0 */
Word16 *gain_pit, /* o : Pitch gain, Q14 */
Word16 *gain_cod /* o : Code gain, Q1 */
)
{
Word16 g_code, exp, frac, tmp;
Word32 L_tmp;
Word16 qua_ener_MR122; /* o : quantized energy error, MR122 version Q10 */
Word16 qua_ener; /* o : quantized energy error, Q10 */
/* Read the quantized gains */
*gain_pit = *p++;
g_code = *p++;
/*------------------------------------------------------------------*
* calculate final fixed codebook gain: *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
* *
* gc = gc0 * g *
*------------------------------------------------------------------*/
L_tmp = L_mult(g_code, gcode0);
L_tmp = L_shr(L_tmp, sub(10, exp_gcode0));
*gain_cod = extract_h(L_tmp);
/*------------------------------------------------------------------*
* calculate predictor update values and update gain predictor: *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
* *
* qua_ener = log2(g) *
* qua_ener_MR122 = 20*log10(g) *
*------------------------------------------------------------------*/
Log2 (L_deposit_l (g_code), &exp, &frac); /* Log2(x Q12) = log2(x) + 12 */
exp = sub(exp, 12);
tmp = shr_r (frac, 5);
qua_ener_MR122 = add (tmp, shl (exp, 10));
L_tmp = Mpy_32_16(exp, frac, 24660); /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
qua_ener = round (L_shl (L_tmp, 13)); /* Q12 * Q0 = Q13 -> Q10 */
gc_pred_update(pred_st, qua_ener_MR122, qua_ener);
}
开发者ID:NearZhxiAo,项目名称:3730,代码行数:56,代码来源:mr475_quant_store_results.c
示例20: Syn_filte
void Syn_filte(
Word16 m, /* (i) : LPC order */
Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients (m=10) */
Word16 x[], /* (i) : input signal */
Word16 y[], /* (o) : output signal */
Word16 lg, /* (i) : size of filtering */
Word16 mem[], /* (i/o) : memory associated with this filtering. */
Word16 update /* (i) : 0=no update, 1=update of memory. */
)
{
Word16 i, j;
Word32 s;
Word16 tmp[80]; /* This is usually done by memory allocation (lg+M) */
Word16 *yy;
/* Copy mem[] to yy[] */
yy = tmp;
for(i=0; i<m; i++)
{
*yy++ = mem[i];
}
/* Do the filtering. */
for (i = 0; i < lg; i++)
{
s = L_mult(x[i], a[0]);
for (j = 1; j <= m; j++)
s = L_msu(s, a[j], yy[-j]);
s = L_shl(s, 3);
*yy++ = round(s);
}
for(i=0; i<lg; i++)
{
y[i] = tmp[i+m];
}
/* Update of memory if update==1 */
if(update != 0)
for (i = 0; i < m; i++)
{
mem[i] = y[lg-m+i];
}
return;
}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:51,代码来源:filtere.c
注:本文中的L_mult函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论