本文整理汇总了C++中shl函数的典型用法代码示例。如果您正苦于以下问题:C++ shl函数的具体用法?C++ shl怎么用?C++ shl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Update_Err
void Update_Err(Word16 Olp, Word16 AcLg, Word16 AcGn,ENC_HANDLE *handle)
{
Word16 *ptr_tab;
Word16 i, iz, temp1, temp2;
Word16 Lag;
Word32 Worst1, Worst0, L_temp;
Word16 beta;
Lag = Olp - (Word16)Pstep + AcLg;
/* Select Quantization tables */
i = 0 ;
ptr_tab = tabgain85;
if ( handle->mode == G723_63 ) {
if ( Olp >= (Word16) (SubFrLen-2) ) ptr_tab = tabgain170;
}
else {
ptr_tab = tabgain170;
}
beta = ptr_tab[(int)AcGn]; /* beta = gain * 8192 */
if(Lag <= (SubFrLen/2)) {
Worst0 = L_mls(handle->CodStat.Err[0], beta);
Worst0 = L_shl(Worst0, 2);
Worst0 = L_add(Err0, Worst0);
Worst1 = Worst0;
}
else {
iz = mult(Lag, 1092); /* Lag / 30 */
temp1 = add(iz, 1);
temp2 = sub(shl(temp1, 5), shl(temp1, 1)); /* 30 (iz+1) */
if(temp2 != Lag) {
if(iz == 1) {
Worst0 = L_mls(handle->CodStat.Err[0], beta);
Worst0 = L_shl(Worst0, 2);
Worst0 = L_add(Err0, Worst0);
Worst1 = L_mls(handle->CodStat.Err[1], beta);
Worst1 = L_shl(Worst1, 2);
Worst1 = L_add(Err0, Worst1);
if(Worst0 > Worst1) Worst1 = Worst0;
else Worst0 = Worst1;
}
else {
Worst0 = L_mls(handle->CodStat.Err[iz-2], beta);
Worst0 = L_shl(Worst0, 2);
Worst0 = L_add(Err0, Worst0);
L_temp = L_mls(handle->CodStat.Err[iz-1], beta);
L_temp = L_shl(L_temp, 2);
L_temp = L_add(Err0, L_temp);
if(L_temp > Worst0) Worst0 = L_temp;
Worst1 = L_mls(handle->CodStat.Err[iz], beta);
Worst1 = L_shl(Worst1, 2);
Worst1 = L_add(Err0, Worst1);
if(L_temp > Worst1) Worst1 = L_temp;
}
}
else { /* Lag % SubFrLen = 0 */
Worst0 = L_mls(handle->CodStat.Err[iz-1], beta);
Worst0 = L_shl(Worst0, 2);
Worst0 = L_add(Err0, Worst0);
Worst1 = L_mls(handle->CodStat.Err[iz], beta);
Worst1 = L_shl(Worst1, 2);
Worst1 = L_add(Err0, Worst1);
}
}
for(i=4; i>=2; i--) {
handle->CodStat.Err[i] = handle->CodStat.Err[i-2];
}
handle->CodStat.Err[0] = Worst0;
handle->CodStat.Err[1] = Worst1;
return;
}
开发者ID:crashatom,项目名称:phoebemail,代码行数:78,代码来源:Tame.c
示例2: Coder_ld8g
//.........这里部分代码省略.........
/* update previous filter for next frame */
Copy(&Aq[M_BWDP1], prev_filter, M_BWDP1);
}
if(dtx_enable == 1) {
seed = INIT_SEED;
ppastVad = pastVad;
pastVad = Vad;
}
if (rate == G729E) *ana++ = lp_mode;
/*----------------------------------------------------------------------*
* - Find the weighted input speech w_sp[] for the whole speech frame *
* - Find the open-loop pitch delay *
*----------------------------------------------------------------------*/
if( lp_mode == 0) {
Copy(lsp_new_q, lsp_old_q, M);
Lsp_prev_update(freq_cur, freq_prev);
*ana++ = code_lsp[0];
*ana++ = code_lsp[1];
}
/* Find open loop pitch lag */
T_op = Pitch_ol(wsp, PIT_MIN, PIT_MAX, L_FRAME);
for (i= 0; i< 4; i++)
lag_buf[i] = lag_buf[i+1];
avg_lag = add(lag_buf[0],lag_buf[1]);
avg_lag = add(avg_lag,lag_buf[2]);
avg_lag = add(avg_lag,lag_buf[3]);
avg_lag = mult_r(avg_lag,8192);
tmp1 = sub(T_op,shl(avg_lag,1));
tmp2 = sub(T_op,add(shl(avg_lag,1),avg_lag));
if( sub(abs_s(tmp1), 4)<0){
lag_buf[4] = shr(T_op,1);
}
else if( sub(abs_s(tmp2),6)<0){
lag_buf[4] = mult(T_op,10923);
}
else{
lag_buf[4] = T_op;
}
/* Range for closed loop pitch search in 1st subframe */
T0_min = sub(T_op, 3);
if (sub(T0_min,PIT_MIN)<0) {
T0_min = PIT_MIN;
}
T0_max = add(T0_min, 6);
if (sub(T0_max ,PIT_MAX)>0)
{
T0_max = PIT_MAX;
T0_min = sub(T0_max, 6);
}
/*------------------------------------------------------------------------*
* Loop for every subframe in the analysis frame *
*------------------------------------------------------------------------*
* To find the pitch and innovation parameters. The subframe size is *
* L_SUBFR and the loop is repeated 2 times. *
* - find the weighted LPC coefficients *
* - find the LPC residual signal res[] *
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:67,代码来源:cod_ld8g.c
示例3: hp_max
/*----------------------------------------------------------------------------
; FUNCTION CODE
----------------------------------------------------------------------------*/
Word16 hp_max(
Word32 corr[], /* i : correlation vector. */
Word16 scal_sig[], /* i : scaled signal. */
Word16 L_frame, /* i : length of frame to compute pitch */
Word16 lag_max, /* i : maximum lag */
Word16 lag_min, /* i : minimum lag */
Word16 *cor_hp_max, /* o : max high-pass filtered norm. correlation */
Flag *pOverflow /* i/o : overflow Flag */
)
{
Word16 i;
Word16 *p, *p1;
Word32 max, t0, t1;
Word16 max16, t016, cor_max;
Word16 shift, shift1, shift2;
Word32 L_temp;
max = MIN_32;
t0 = 0L;
for (i = lag_max - 1; i > lag_min; i--)
{
/* high-pass filtering */
t0 = L_shl(corr[-i], 1, pOverflow);
L_temp = L_sub(t0, corr[-i-1], pOverflow);
t0 = L_sub(L_temp, corr[-i+1], pOverflow);
t0 = L_abs(t0);
if (t0 >= max)
{
max = t0;
}
}
/* compute energy */
p = scal_sig;
p1 = &scal_sig[0];
t0 = 0L;
for (i = 0; i < L_frame; i++, p++, p1++)
{
t0 = L_mac(t0, *p, *p1, pOverflow);
}
p = scal_sig;
p1 = &scal_sig[-1];
t1 = 0L;
for (i = 0; i < L_frame; i++, p++, p1++)
{
t1 = L_mac(t1, *p, *p1, pOverflow);
}
/* high-pass filtering */
L_temp = L_shl(t0, 1, pOverflow);
t1 = L_shl(t1, 1, pOverflow);
t0 = L_sub(L_temp, t1, pOverflow);
t0 = L_abs(t0);
/* max/t0 */
/* shift1 = sub(norm_l(max), 1);
max16 = extract_h(L_shl(max, shift1));
shift2 = norm_l(t0);
t016 = extract_h(L_shl(t0, shift2)); */
t016 = norm_l(max);
shift1 = sub(t016, 1, pOverflow);
L_temp = L_shl(max, shift1, pOverflow);
max16 = (Word16)(L_temp >> 16);
shift2 = norm_l(t0);
L_temp = L_shl(t0, shift2, pOverflow);
t016 = (Word16)(L_temp >> 16);
if (t016 != 0)
{
cor_max = div_s(max16, t016);
}
else
{
cor_max = 0;
}
shift = sub(shift1, shift2, pOverflow);
if (shift >= 0)
{
*cor_hp_max = shr(cor_max, shift, pOverflow); /* Q15 */
}
else
{
*cor_hp_max = shl(cor_max, negate(shift), pOverflow); /* Q15 */
}
return 0;
}
开发者ID:0omega,项目名称:platform_external_opencore,代码行数:98,代码来源:hp_max.cpp
示例4: Pitch_ol
Word16 Pitch_ol( /* output: open loop pitch lag */
Word16 signal[], /* input : signal used to compute the open loop pitch */
/* signal[-pit_max] to signal[-1] should be known */
Word16 pit_min, /* input : minimum pitch lag */
Word16 pit_max, /* input : maximum pitch lag */
Word16 L_frame /* input : length of frame to compute pitch */
)
{
Word16 i, j;
Word16 max1, max2, max3;
Word16 p_max1, p_max2, p_max3;
Word32 t0, L_temp;
/* Scaled signal */
Word16 scaled_signal[L_FRAME+PIT_MAX];
Word16 *scal_sig;
scal_sig = &scaled_signal[pit_max];
/*--------------------------------------------------------*
* Verification for risk of overflow. *
*--------------------------------------------------------*/
Overflow = 0;
t0 = 0;
for(i= -pit_max; i< L_frame; i++)
t0 = L_mac(t0, signal[i], signal[i]);
/*--------------------------------------------------------*
* Scaling of input signal. *
* *
* if Overflow -> scal_sig[i] = signal[i]>>3 *
* else if t0 < 1^20 -> scal_sig[i] = signal[i]<<3 *
* else -> scal_sig[i] = signal[i] *
*--------------------------------------------------------*/
if(Overflow == 1)
{
for(i=-pit_max; i<L_frame; i++)
scal_sig[i] = shr(signal[i], 3);
}
else {
L_temp = L_sub(t0, (Word32)1048576L);
if ( L_temp < (Word32)0 ) /* if (t0 < 2^20) */
{
for(i=-pit_max; i<L_frame; i++)
scal_sig[i] = shl(signal[i], 3);
}
else
{
for(i=-pit_max; i<L_frame; i++)
scal_sig[i] = signal[i];
}
}
/*--------------------------------------------------------------------*
* The pitch lag search is divided in three sections. *
* Each section cannot have a pitch multiple. *
* We find a maximum for each section. *
* We compare the maximum of each section by favoring small lag. *
* *
* First section: lag delay = pit_max downto 4*pit_min *
* Second section: lag delay = 4*pit_min-1 downto 2*pit_min *
* Third section: lag delay = 2*pit_min-1 downto pit_min *
*--------------------------------------------------------------------*/
j = shl(pit_min, 2);
p_max1 = Lag_max(scal_sig, L_frame, pit_max, j, &max1);
i = sub(j, 1); j = shl(pit_min, 1);
p_max2 = Lag_max(scal_sig, L_frame, i, j, &max2);
i = sub(j, 1);
p_max3 = Lag_max(scal_sig, L_frame, i, pit_min , &max3);
/*--------------------------------------------------------------------*
* Compare the 3 sections maximum, and favor small lag. *
*--------------------------------------------------------------------*/
if( sub(mult(max1, THRESHPIT), max2) < 0)
{
max1 = max2;
p_max1 = p_max2;
}
if( sub(mult(max1, THRESHPIT), max3) < 0)
{
p_max1 = p_max3;
}
return (p_max1);
}
开发者ID:afxabc,项目名称:resiprocate,代码行数:95,代码来源:pitch.c
示例5: Dec_gain
/*************************************************************************
*
* FUNCTION: Dec_gain()
*
* PURPOSE: Decode the pitch and codebook gains
*
************************************************************************/
void Dec_gain(
gc_predState *pred_state, /* i/o: MA predictor state */
enum Mode mode, /* i : AMR mode */
Word16 index, /* i : index of quantization. */
Word16 code[], /* i : Innovative vector. */
Word16 evenSubfr, /* i : Flag for even subframes */
Word16 * gain_pit, /* o : Pitch gain. */
Word16 * gain_cod /* o : Code gain. */
)
{
const Word16 *p;
Word16 frac, gcode0, exp, qua_ener, qua_ener_MR122;
Word16 g_code;
Word32 L_tmp;
/* Read the quantized gains (table depends on mode) */
index = shl (index, 2);
test(); test(); test();
if ( sub (mode, MR102) == 0
|| sub (mode, MR74) == 0
|| sub (mode, MR67) == 0)
{
p = &table_gain_highrates[index]; move16 ();
*gain_pit = *p++; move16 ();
g_code = *p++; move16 ();
qua_ener_MR122 = *p++; move16 ();
qua_ener = *p; move16 ();
}
else
{
test();
if (sub (mode, MR475) == 0)
{
index = add (index, shl(sub(1, evenSubfr), 1));
p = &table_gain_MR475[index]; move16 ();
*gain_pit = *p++; move16 ();
g_code = *p++; move16 ();
/*---------------------------------------------------------*
* calculate predictor update values (not stored in 4.75 *
* quantizer table to save space): *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
* *
* qua_ener = log2(g) *
* qua_ener_MR122 = 20*log10(g) *
*---------------------------------------------------------*/
/* Log2(x Q12) = log2(x) + 12 */
Log2 (L_deposit_l (g_code), &exp, &frac);
exp = sub(exp, 12);
qua_ener_MR122 = add (shr_r (frac, 5), shl (exp, 10));
/* 24660 Q12 ~= 6.0206 = 20*log10(2) */
L_tmp = Mpy_32_16(exp, frac, 24660);
qua_ener = round (L_shl (L_tmp, 13)); /* Q12 * Q0 = Q13 -> Q10 */
}
else
{
p = &table_gain_lowrates[index]; move16 ();
*gain_pit = *p++; move16 ();
g_code = *p++; move16 ();
qua_ener_MR122 = *p++; move16 ();
qua_ener = *p; move16 ();
}
}
/*-------------------------------------------------------------------*
* predict codebook gain *
* ~~~~~~~~~~~~~~~~~~~~~ *
* gc0 = Pow2(int(d)+frac(d)) *
* = 2^exp + 2^frac *
* *
* gcode0 (Q14) = 2^14*2^frac = gc0 * 2^(14-exp) *
*-------------------------------------------------------------------*/
gc_pred(pred_state, mode, code, &exp, &frac, NULL, NULL);
gcode0 = extract_l(Pow2(14, frac));
/*------------------------------------------------------------------*
* read quantized gains, update table of past quantized energies *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
* st->past_qua_en(Q10) = 20 * Log10(g_fac) / constant *
* = Log2(g_fac) *
* = qua_ener *
* constant = 20*Log10(2) *
*------------------------------------------------------------------*/
//.........这里部分代码省略.........
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:101,代码来源:dec_gain.c
示例6: musdetect
void musdetect(
Word16 rate,
Word16 r_h,
Word16 r_l,
Word16 exp_R0,
Word16 *rc,
Word16 *lags,
Word16 *pgains,
Word16 stat_flg,
Word16 frm_count,
Word16 prev_vad,
Word16 *Vad,
Word16 LLenergy)
{
Word16 i,j;
static Word16 count_music=0;
static Word16 Mcount_music=0;
static Word16 count_consc=0;
Word16 std;
static Word16 MeanPgain =8192;
Word16 PFLAG1, PFLAG2, PFLAG;
static Word16 count_pflag=0;
static Word16 Mcount_pflag=0;
static Word16 count_consc_pflag=0;
static Word16 count_consc_rflag=0;
static Word16 mrc[10]={0,0, 0, 0, 0, 0, 0, 0,0,0};
static Word16 MeanSE =0;
Word16 pderr, Lenergy , SD;
Word16 Thres, Coeff, C_Coeff;
Word32 acc0;
Word16 exp, frac, lagsum;
pderr =32767;
for (i=0; i<4; i++){
j = mult(rc[i], rc[i]);
j = sub(32767, j);
pderr = mult(pderr, j);
}
/* compute the frame energy */
acc0 = Mpy_32_16(r_h, r_l, pderr);
Log2(acc0, &exp, &frac);
acc0 = Mpy_32_16(exp, frac, 9864);
i = sub(exp_R0, 1);
i = sub(i, 1);
acc0 = L_mac(acc0, 9864, i);
acc0 = L_shl(acc0, 11);
Lenergy = extract_h(acc0);
Lenergy = sub(Lenergy, 4875);
acc0 = 0L;
for (i=0; i<10; i++){
j = sub(mrc[i], rc[i]);
acc0 = L_mac(acc0, j, j);
}
SD = extract_h(acc0);
if( *Vad == NOISE ){
for (i=0; i<10; i++){
acc0 = L_mult(29491, mrc[i]);
acc0 = L_mac(acc0, 3277, rc[i]);
mrc[i] = extract_h(acc0);
}
acc0 = L_mult(29491, MeanSE);
acc0 = L_mac(acc0, 3277, Lenergy);
MeanSE = extract_h(acc0);
}
/* determine the PFLAG */
acc0 = 0L;
lagsum = 0;
for (i=0; i<5; i++){
acc0 = L_mac(acc0, pgains[i], 6554); /* 1/5 in Q15 */
lagsum = add(lagsum, lags[i]);
}
acc0 = L_mult(extract_h(acc0), 6554);
acc0 = L_mac(acc0, MeanPgain, 26214);
MeanPgain = extract_h(acc0); /* compute the mean pitch gain */
acc0 = 0L;
for (i=0; i<5; i++){
/* NOTE: the variance of the lag is scaled up by 25 */
j = shl(lags[i], 2);
j = add(j,lags[i]); /* j equals 5*lags[i] */
j = sub(j, lagsum);
acc0 = L_mac(acc0, j, j);
}
acc0 = L_shl(acc0, 22);
/* NOTE: the final variance of the lag is scaled up by 25x128 */
std = extract_h(acc0);
if ( rate == G729D)
Thres = 11960; /* 0.73 in Q14 */
else
Thres = 10322; /* 0.63 in Q14 */
//.........这里部分代码省略.........
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:101,代码来源:mus_dtct.c
示例7: SetAlphaIntoColor
int SetAlphaIntoColor(int col, int alpha)
{
int newCol = and(col,16777215) + shl(alpha,24);
return newCol;
}
开发者ID:ekuznets,项目名称:PKM2,代码行数:5,代码来源:character_boal.c
示例8: mov
void GSDrawScanlineCodeGenerator::Init(int params)
{
const int _top = params + 4;
const int _v = params + 8;
// int skip = left & 3;
mov(ebx, edx);
and(edx, 3);
// left -= skip;
sub(ebx, edx);
// int steps = right - left - 4;
sub(ecx, ebx);
sub(ecx, 4);
// GSVector4i test = m_test[skip] | m_test[7 + (steps & (steps >> 31))];
shl(edx, 4);
movdqa(xmm7, xmmword[edx + (size_t)&m_test[0]]);
mov(eax, ecx);
sar(eax, 31);
and(eax, ecx);
shl(eax, 4);
por(xmm7, xmmword[eax + (size_t)&m_test[7]]);
// GSVector2i* fza_base = &m_env.fzbr[top];
mov(esi, dword[esp + _top]);
lea(esi, ptr[esi * 8]);
add(esi, dword[&m_env.fzbr]);
// GSVector2i* fza_offset = &m_env.fzbc[left >> 2];
lea(edi, ptr[ebx * 2]);
add(edi, dword[&m_env.fzbc]);
if(!m_sel.sprite && (m_sel.fwrite && m_sel.fge || m_sel.zb) || m_sel.fb && (m_sel.edge || m_sel.tfx != TFX_NONE || m_sel.iip))
{
// edx = &m_env.d[skip]
shl(edx, 4);
lea(edx, ptr[edx + (size_t)m_env.d]);
// ebx = &v
mov(ebx, dword[esp + _v]);
}
if(!m_sel.sprite)
{
if(m_sel.fwrite && m_sel.fge || m_sel.zb)
{
movaps(xmm0, xmmword[ebx + 16]); // v.p
if(m_sel.fwrite && m_sel.fge)
{
// f = GSVector4i(vp).zzzzh().zzzz().add16(m_env.d[skip].f);
cvttps2dq(xmm1, xmm0);
pshufhw(xmm1, xmm1, _MM_SHUFFLE(2, 2, 2, 2));
pshufd(xmm1, xmm1, _MM_SHUFFLE(2, 2, 2, 2));
paddw(xmm1, xmmword[edx + 16 * 6]);
movdqa(xmmword[&m_env.temp.f], xmm1);
}
if(m_sel.zb)
{
// z = vp.zzzz() + m_env.d[skip].z;
shufps(xmm0, xmm0, _MM_SHUFFLE(2, 2, 2, 2));
addps(xmm0, xmmword[edx]);
movaps(xmmword[&m_env.temp.z], xmm0);
}
}
}
else
{
if(m_sel.ztest)
{
movdqa(xmm0, xmmword[&m_env.p.z]);
}
}
if(m_sel.fb)
{
if(m_sel.edge || m_sel.tfx != TFX_NONE)
{
movaps(xmm4, xmmword[ebx + 32]); // v.t
}
if(m_sel.edge)
//.........这里部分代码省略.........
开发者ID:mauzus,项目名称:progenitor,代码行数:101,代码来源:GSDrawScanlineCodeGenerator.cpp
示例9: sub
//.........这里部分代码省略.........
}
if(m_sel.fb)
{
if(m_sel.tfx != TFX_NONE)
{
if(m_sel.fst)
{
// GSVector4i st = m_env.d4.st;
// si += st.xxxx();
// if(!sprite) ti += st.yyyy();
movdqa(xmm4, xmmword[&m_env.d4.st]);
pshufd(xmm2, xmm4, _MM_SHUFFLE(0, 0, 0, 0));
paddd(xmm2, xmmword[&m_env.temp.s]);
movdqa(xmmword[&m_env.temp.s], xmm2);
if(!m_sel.sprite)
{
pshufd(xmm3, xmm4, _MM_SHUFFLE(1, 1, 1, 1));
paddd(xmm3, xmmword[&m_env.temp.t]);
movdqa(xmmword[&m_env.temp.t], xmm3);
}
else
{
movdqa(xmm3, xmmword[&m_env.temp.t]);
}
}
else
{
// GSVector4 stq = m_env.d4.stq;
// s += stq.xxxx();
// t += stq.yyyy();
// q += stq.zzzz();
movaps(xmm2, xmmword[&m_env.d4.stq]);
movaps(xmm3, xmm2);
movaps(xmm4, xmm2);
shufps(xmm2, xmm2, _MM_SHUFFLE(0, 0, 0, 0));
shufps(xmm3, xmm3, _MM_SHUFFLE(1, 1, 1, 1));
shufps(xmm4, xmm4, _MM_SHUFFLE(2, 2, 2, 2));
addps(xmm2, xmmword[&m_env.temp.s]);
addps(xmm3, xmmword[&m_env.temp.t]);
addps(xmm4, xmmword[&m_env.temp.q]);
movaps(xmmword[&m_env.temp.s], xmm2);
movaps(xmmword[&m_env.temp.t], xmm3);
movaps(xmmword[&m_env.temp.q], xmm4);
rcpps(xmm4, xmm4);
mulps(xmm2, xmm4);
mulps(xmm3, xmm4);
}
}
if(!(m_sel.tfx == TFX_DECAL && m_sel.tcc))
{
if(m_sel.iip)
{
// GSVector4i c = m_env.d4.c;
// rb = rb.add16(c.xxxx());
// ga = ga.add16(c.yyyy());
movdqa(xmm7, xmmword[&m_env.d4.c]);
pshufd(xmm5, xmm7, _MM_SHUFFLE(0, 0, 0, 0));
pshufd(xmm6, xmm7, _MM_SHUFFLE(1, 1, 1, 1));
paddw(xmm5, xmmword[&m_env.temp.rb]);
paddw(xmm6, xmmword[&m_env.temp.ga]);
movdqa(xmmword[&m_env.temp.rb], xmm5);
movdqa(xmmword[&m_env.temp.ga], xmm6);
}
else
{
if(m_sel.tfx == TFX_NONE)
{
movdqa(xmm5, xmmword[&m_env.c.rb]);
movdqa(xmm6, xmmword[&m_env.c.ga]);
}
}
}
}
// test = m_test[7 + (steps & (steps >> 31))];
mov(edx, ecx);
sar(edx, 31);
and(edx, ecx);
shl(edx, 4);
movdqa(xmm7, xmmword[edx + (size_t)&m_test[7]]);
}
开发者ID:mauzus,项目名称:progenitor,代码行数:101,代码来源:GSDrawScanlineCodeGenerator.cpp
示例10: postfilter
/* Standard Long-Term Postfilter */
void postfilter(
Word16 *s, /* input : quantized speech signal */
Word16 pp, /* input : pitch period */
Word16 *ma_a,
Word16 *b_prv,
Word16 *pp_prv,
Word16 *e) /* output: enhanced speech signal */
{
int n;
Word16 len, t0, t1, t2, t3, shift, aa, R0norm, R0_exp;
Word32 a0, a1, R0, R1, R01, R01max, Rx;
Word16 *fp1;
Word16 ppt, pptmin, pptmax, ppnew;
Word16 bb[2];
Word16 R1max_exp, R1max, R01Sqmax_exp, R01Sqmax, R01Sq_exp, R01Sq, R1_exp, R1n;
Word16 gainn, Rx_exp;
Word16 buf[MAXPP+FRSZ];
Word16 *ps, ww1, ww2;
Word32 step, delta;
Word16 bi0, bi1c, bi1p;
ps = s+XQOFF;
/********************************************************************/
/* pitch search around decoded pitch */
/********************************************************************/
pptmin = sub(pp, DPPQNS);
pptmax = add(pp, DPPQNS);
if (pptmin<MINPP)
{
pptmin = MINPP;
pptmax = add(pptmin, 2*DPPQNS);
}
else if (pptmax>MAXPP)
{
pptmax = MAXPP;
pptmin = sub(pptmax, 2*DPPQNS);
}
fp1 = &s[XQOFF-pptmax];
len = add(FRSZ, pptmax);
a0 = 0;
for (n=0;n<len;n++)
{
t1 = shr(*fp1++, 3);
a0 = L_mac0(a0,t1,t1);
}
shift = norm_l(a0);
if (a0==0) shift=31;
shift = sub(6, shift);
if (shift > 0)
{
ps = buf+pptmax;
fp1 = &s[XQOFF-pptmax];
shift = shr(add(shift, 1), 1);
for (n=0;n<len;n++)
{
buf[n] = shr(fp1[n], shift);
}
}
else shift=0;
R0 = 0;
R1 = 0;
R01 = 0;
for(n=0; n<FRSZ; n++)
{
R0 = L_mac0(R0, ps[n], ps[n]);
R1 = L_mac0(R1, ps[n-pptmin], ps[n-pptmin]);
R01 = L_mac0(R01,ps[n], ps[n-pptmin]);
}
R0_exp = norm_l(R0);
R0norm = extract_h(L_shl(R0, R0_exp));
R0_exp = R0_exp-16;
ppnew = pptmin;
R1max_exp = norm_l(R1);
R1max = extract_h(L_shl(R1, R1max_exp));
R01Sqmax_exp = norm_l(R01);
t1 = extract_h(L_shl(R01, R01Sqmax_exp));
R01Sqmax_exp = shl(R01Sqmax_exp, 1);
R01Sqmax = extract_h(L_mult(t1, t1));
R01max = R01;
for(ppt=pptmin+1; ppt<=pptmax; ppt++)
{
R1 = L_msu0(R1,ps[FRSZ-ppt], ps[FRSZ-ppt]);
R1 = L_mac0(R1,ps[-ppt], ps[-ppt]);
R01= 0;
for(n=0; n<FRSZ; n++)
{
R01 = L_mac0(R01, ps[n], ps[n-ppt]);
}
R01Sq_exp = norm_l(R01);
t1 = extract_h(L_shl(R01, R01Sq_exp));
R01Sq_exp = shl(R01Sq_exp, 1);
R01Sq = extract_h(L_mult(t1, t1));
R1_exp = norm_l(R1);
R1n = extract_h(L_shl(R1, R1_exp));
//.........这里部分代码省略.........
开发者ID:371816210,项目名称:mysipdroid,代码行数:101,代码来源:postfilt.c
示例11: pcmpeqd
void GSDrawScanlineCodeGenerator::WriteFrame(int params)
{
const int _top = params + 4;
if(!m_sel.fwrite)
{
return;
}
if(m_sel.colclamp == 0)
{
// c[0] &= 0x000000ff;
// c[1] &= 0x000000ff;
pcmpeqd(xmm7, xmm7);
psrlw(xmm7, 8);
pand(xmm5, xmm7);
pand(xmm6, xmm7);
}
if(m_sel.fpsm == 2 && m_sel.dthe)
{
mov(eax, dword[esp + _top]);
and(eax, 3);
shl(eax, 5);
paddw(xmm5, xmmword[eax + (size_t)&m_env.dimx[0]]);
paddw(xmm6, xmmword[eax + (size_t)&m_env.dimx[1]]);
}
// GSVector4i fs = c[0].upl16(c[1]).pu16(c[0].uph16(c[1]));
movdqa(xmm7, xmm5);
punpcklwd(xmm5, xmm6);
punpckhwd(xmm7, xmm6);
packuswb(xmm5, xmm7);
if(m_sel.fba && m_sel.fpsm != 1)
{
// fs |= 0x80000000;
pcmpeqd(xmm7, xmm7);
pslld(xmm7, 31);
por(xmm5, xmm7);
}
if(m_sel.fpsm == 2)
{
// GSVector4i rb = fs & 0x00f800f8;
// GSVector4i ga = fs & 0x8000f800;
mov(eax, 0x00f800f8);
movd(xmm6, eax);
pshufd(xmm6, xmm6, _MM_SHUFFLE(0, 0, 0, 0));
mov(eax, 0x8000f800);
movd(xmm7, eax);
pshufd(xmm7, xmm7, _MM_SHUFFLE(0, 0, 0, 0));
movdqa(xmm4, xmm5);
pand(xmm4, xmm6);
pand(xmm5, xmm7);
// fs = (ga >> 16) | (rb >> 9) | (ga >> 6) | (rb >> 3);
movdqa(xmm6, xmm4);
movdqa(xmm7, xmm5);
psrld(xmm4, 3);
psrld(xmm6, 9);
psrld(xmm5, 6);
psrld(xmm7, 16);
por(xmm5, xmm4);
por(xmm7, xmm6);
por(xmm5, xmm7);
}
if(m_sel.rfb)
{
// fs = fs.blend(fd, fm);
blend(xmm5, xmm2, xmm3); // TODO: could be skipped in certain cases, depending on fpsm and fm
}
bool fast = m_sel.rfb && m_sel.fpsm < 2;
WritePixel(xmm5, xmm0, ebx, dl, fast, m_sel.fpsm);
}
开发者ID:mauzus,项目名称:progenitor,代码行数:88,代码来源:GSDrawScanlineCodeGenerator.cpp
示例12: perc_var
void perc_var (
Word16 *gamma1, /* Bandwidth expansion parameter */
Word16 *gamma2, /* Bandwidth expansion parameter */
Word16 *LsfInt, /* Interpolated LSP vector : 1st subframe */
Word16 *LsfNew, /* New LSP vector : 2nd subframe */
Word16 *r_c /* Reflection coefficients */
)
{
Word32 L_temp;
Word16 cur_rc; /* Q11 */
Word16 Lar[4]; /* Q11 */
Word16 *LarNew; /* Q11 */
Word16 *Lsf; /* Q15 */
Word16 CritLar0, CritLar1; /* Q11 */
Word16 temp;
Word16 d_min; /* Q10 */
Word16 i, k;
for (k=0; k<M; k++) {
LsfInt[k] = shl(LsfInt[k], 1);
LsfNew[k] = shl(LsfNew[k], 1);
}
LarNew = &Lar[2];
/* ---------------------------------------- */
/* Reflection coefficients ---> Lar */
/* Lar(i) = log10( (1+rc) / (1-rc) ) */
/* Approximated by */
/* x <= SEG1 y = x */
/* SEG1 < x <= SEG2 y = A1 x - B1_L */
/* SEG2 < x <= SEG3 y = A2 x - B2_L */
/* x > SEG3 y = A3 x - B3_L */
/* ---------------------------------------- */
for (i=0; i<2; i++) {
cur_rc = abs_s(r_c[i]);
cur_rc = shr(cur_rc, 4);
if (sub(cur_rc ,SEG1)<= 0) {
LarNew[i] = cur_rc;
}
else {
if (sub(cur_rc,SEG2)<= 0) {
cur_rc = shr(cur_rc, 1);
L_temp = L_mult(cur_rc, A1);
L_temp = L_sub(L_temp, L_B1);
L_temp = L_shr(L_temp, 11);
LarNew[i] = extract_l(L_temp);
}
else {
if (sub(cur_rc ,SEG3)<= 0) {
cur_rc = shr(cur_rc, 1);
L_temp = L_mult(cur_rc, A2);
L_temp = L_sub(L_temp, L_B2);
L_temp = L_shr(L_temp, 11);
LarNew[i] = extract_l(L_temp);
}
else {
cur_rc = shr(cur_rc, 1);
L_temp = L_mult(cur_rc, A3);
L_temp = L_sub(L_temp, L_B3);
L_temp = L_shr(L_temp, 11);
LarNew[i] = extract_l(L_temp);
}
}
}
if (r_c[i] < 0) {
LarNew[i] = sub(0, LarNew[i]);
}
}
/* Interpolation of Lar for the 1st subframe */
temp = add(LarNew[0], LarOld[0]);
Lar[0] = shr(temp, 1);
LarOld[0] = LarNew[0];
temp = add(LarNew[1], LarOld[1]);
Lar[1] = shr(temp, 1);
LarOld[1] = LarNew[1];
for (k=0; k<2; k++) { /* LOOP : gamma2 for 1st to 2nd subframes */
/* ---------------------------------------------------------- */
/* First criterion based on the first two Lars */
/* smooth == 1 ==> gamma2 can vary from 0.4 to 0.7 */
/* smooth == 0 ==> gamma2 is set to 0.6 */
/* */
/* Double threshold + hysteresis : */
/* if smooth = 1 */
/* if (CritLar0 < THRESH_L1) and (CritLar1 > THRESH_H1) */
/* smooth = 0 */
/* if smooth = 0 */
/* if (CritLar0 > THRESH_L2) or (CritLar1 < THRESH_H2) */
/* smooth = 1 */
/* ---------------------------------------------------------- */
//.........这里部分代码省略.........
开发者ID:Orange168,项目名称:lumicall_new,代码行数:101,代码来源:pwf.c
示例13: vad2
//.........这里部分代码省略.........
for (i = LO_CHAN; i <= HI_CHAN; i++)
{
st->Lch_enrg[i] = L_shr(st->Lch_enrg[i], state_change_shift_r[st->shift_state]); move32();
}
}
/* Estimate the energy in each channel */
test();
if (L_sub(st->Lframe_cnt, 1) == 0)
{
alpha = 32767; move16();
one_m_alpha = 0; move16();
}
else
{
alpha = CEE_SM_FAC; move16();
one_m_alpha = ONE_MINUS_CEE_SM_FAC; move16();
}
for (i = LO_CHAN; i <= HI_CHAN; i++)
{
Lenrg = 0; move16();
j1 = ch_tbl[i][0]; move16();
j2 = ch_tbl[i][1]; move16();
for (j = j1; j <= j2; j++)
{
Lenrg = L_mac(Lenrg, data_buffer[2 * j], data_buffer[2 * j]);
Lenrg = L_mac(Lenrg, data_buffer[2 * j + 1], data_buffer[2 * j + 1]);
}
/* Denorm energy & scale 30,1 according to the state */
Lenrg = L_shr_r(Lenrg, sub(shl(normb_shift, 1), enrg_norm_shift[st->shift_state]));
/* integrate over time: e[i] = (1-alpha)*e[i] + alpha*enrg/num_bins_in_chan */
tmp = mult(alpha, ch_tbl_sh[i]);
L_Extract (Lenrg, &hi1, &lo1);
Ltmp = Mpy_32_16(hi1, lo1, tmp);
L_Extract (st->Lch_enrg[i], &hi1, &lo1);
st->Lch_enrg[i] = L_add(Ltmp, Mpy_32_16(hi1, lo1, one_m_alpha)); move32();
test();
if (L_sub(st->Lch_enrg[i], min_chan_enrg[st->shift_state]) < 0)
{
st->Lch_enrg[i] = min_chan_enrg[st->shift_state]; move32();
}
}
/* Compute the total channel energy estimate (Ltce) */
Ltce = 0; move16();
for (i = LO_CHAN; i <= HI_CHAN; i++)
{
Ltce = L_add(Ltce, st->Lch_enrg[i]);
}
/* Calculate spectral peak-to-average ratio, set flag if p2a > 10 dB */
Lpeak = 0; move32();
for (i = LO_CHAN+2; i <= HI_CHAN; i++) /* Sine waves not valid for low frequencies */
{ test();
if (L_sub(st->Lch_enrg [i], Lpeak) > 0)
{
Lpeak = st->Lch_enrg [i]; move32();
开发者ID:evenmatrix,项目名称:silent-phone-android,代码行数:67,代码来源:vad2.c
示例14: A_Refl
void A_Refl(
Word16 a[], /* i : Directform coefficients */
Word16 refl[], /* o : Reflection coefficients */
Flag *pOverflow
)
{
/* local variables */
Word16 i;
Word16 j;
Word16 aState[M];
Word16 bState[M];
Word16 normShift;
Word16 normProd;
Word32 L_acc;
Word16 scale;
Word32 L_temp;
Word16 temp;
Word16 mult;
/* initialize states */
for (i = 0; i < M; i++)
{
aState[i] = a[i];
}
/* backward Levinson recursion */
for (i = M - 1; i >= 0; i--)
{
if (abs_s(aState[i]) >= 4096)
{
for (i = 0; i < M; i++)
{
refl[i] = 0;
}
break;
}
refl[i] = shl(aState[i], 3, pOverflow);
L_temp = L_mult(refl[i], refl[i], pOverflow);
L_acc = L_sub(MAX_32, L_temp, pOverflow);
normShift = norm_l(L_acc);
scale = sub(15, normShift, pOverflow);
L_acc = L_shl(L_acc, normShift, pOverflow);
normProd = pv_round(L_acc, pOverflow);
mult = div_s(16384, normProd);
for (j = 0; j < i; j++)
{
L_acc = L_deposit_h(aState[j]);
L_acc = L_msu(L_acc, refl[i], aState[i-j-1], pOverflow);
temp = pv_round(L_acc, pOverflow);
L_temp = L_mult(mult, temp, pOverflow);
L_temp = L_shr_r(L_temp, scale, pOverflow);
if (L_abs(L_temp) > 32767)
{
for (i = 0; i < M; i++)
{
refl[i] = 0;
}
break;
}
bState[j] = extract_l(L_temp);
}
for (j = 0; j < i; j++)
{
aState[j] = bState[j];
}
}
return;
}
开发者ID:AliSayed,项目名称:MoSync,代码行数:78,代码来源:a_refl.cpp
示例15: D4i40_17_fast
//.........这里部分代码省略.........
/*------------------------------------------------------------------*
* depth first search 3, phase A: track 2 and 3/4. *
*------------------------------------------------------------------*/
sq = -1;
alp = 1;
/* i0 loop: 2 positions in track 2 */
prev_i0 = -1;
for (i=0; i<2; i++)
{
max = -1;
/* search "dn[]" maximum position in track 2 */
for (j=2; j<L_SUBFR; j+=STEP)
{
if ((sub(dn[j], max) > 0) && (sub(prev_i0,j) != 0))
{
max = dn[j];
i0 = j;
}
}
prev_i0 = i0;
j = mult(i0, 6554); /* j = i0/5 */
p0 = rri2i2 + j;
ps1 = dn[i0];
alp1 = L_mult(*p0, _1_4);
/* i1 loop: 8 positions in track 2 */
p0 = ptr_rri2i3_i4 + shl(j, 3);
p1 = ptr_rri3i3_i4;
for (i1=track; i1<L_SUBFR; i1+=STEP)
{
ps2 = add(ps1, dn[i1]); /* index increment = STEP */
/* alp1 = alp0 + rr[i0][i1] + 1/2*rr[i1][i1]; */
alp2 = L_mac(alp1, *p0++, _1_2);
alp2 = L_mac(alp2, *p1++, _1_4);
sq2 = mult(ps2, ps2);
alp_16 = round(alp2);
s = L_msu(L_mult(alp,sq2),sq,alp_16);
if (s > 0)
{
sq = sq2;
ps = ps2;
alp = alp_16;
ix = i0;
iy = i1;
}
}
}
i0 = ix;
i1 = iy;
i1_offset = shl(mult(i1, 6554), 3); /* j = 8*(i1/5) */
/*------------------------------------------------------------------*
* depth first search 3, phase B: track 0 and 1. *
*------------------------------------------------------------------*/
开发者ID:xyhGit,项目名称:MTNN,代码行数:67,代码来源:acelp_ca.c
示例16: D2i40_11
//.........这里部分代码省略.........
ptr_ri0i0 = rri1i1;
}
else if (i == 6) { /* Search i0,sub1 vs. i1,sub1 */
outPtr_ri1i1 = rri3i3;
p1=3;
ptr_ri0i0 = rri1i1;
}
else if (i == 7) { /* Search i0,sub3 vs. i1,sub0 */
outPtr_ri1i1 = rri4i4;
p1=4;
ptr_ri0i0 = rri1i1;
}
else if (i == 8) { /* Search i0,sub2 vs. i1,sub1 */
outPtr_ri1i1 = rri3i3;
p0=2;
p1=3;
}
for (i0 = p0; i0<40; i0+=STEP) {
ptr_ri1i1 = outPtr_ri1i1;
ps0 = Dn[i0];
alp0 = *ptr_ri0i0++;
for (i1 = p1; i1<40; i1+=STEP) {
ps1 = add(ps0, Dn[i1]);
alp1 = L_mult(alp0, 1);
alp1 = L_mac(alp1, *ptr_ri1i1++, 1);
alp1 = L_mac(alp1, *ptr_ri0i1++, 2);
alp = extract_l(L_shr(alp1, 5));
ps1c = mult(ps1, ps1);
L_temp = L_mult(ps1c, alpha);
L_temp = L_msu(L_temp, psc, alp);
if (L_temp > 0L) {
psc = ps1c;
alpha = alp;
ip0 = i1;
ip1 = i0;
if ( swap ) {
ip0 = i0;
ip1 = i1;
}
}
}
}
}
/* convert from position to table entry index */
for (i0=0; i0<16; i0++)
if (ip0 == trackTable0[i0]) break;
ip0=i0;
for (i1=0; i1<32; i1++)
if (ip1 == trackTable1[i1]) break;
ip1=i1;
m0_bestPos = trackTable0[ip0];
m1_bestPos = trackTable1[ip1];
posIndex[0] = grayEncode[ip0];
posIndex[1] = grayEncode[ip1];
if (p_sign[m0_bestPos] > 0)
signIndex[0] = 1;
else
signIndex[0] = 0;
if (p_sign[m1_bestPos] > 0)
signIndex[1] = 1;
else
signIndex[1] = 0;
/* build innovation vector */
for (i = 0; i < L_SUBFR; i++) code[i] = 0;
code[m0_bestPos] = shr(p_sign[m0_bestPos], 2);
code[m1_bestPos] = add(code[m1_bestPos], shr(p_sign[m1_bestPos], 2));
*sign = add(signIndex[1], signIndex[1]);
*sign = add(*sign, signIndex[0]);
tmp = shl(posIndex[1], 4);
index = add(posIndex[0], tmp);
/* compute filtered cbInnovation */
for (i = 0; i < L_SUBFR; i++) y[i] = 0;
if(signIndex[0] == 0)
for(i=m0_bestPos, j=0; i<L_SUBFR; i++, j++) y[i] = negate(h[j]);
else
for(i=m0_bestPos, j=0; i<L_SUBFR; i++, j++) y[i] = h[j];
if(signIndex[1] == 0)
for(i=m1_bestPos, j=0; i<L_SUBFR; i++, j++) y[i] = sub(y[i], h[j]);
else
for(i=m1_bestPos, j=0; i<L_SUBFR; i++, j++) y[i] = add(y[i], h[j]);
return index;
}
开发者ID:thecc4re,项目名称:lumicall,代码行数:101,代码来源:acelpcod.c
示例17: Cor_h
static void Cor_h(
Word16 *H, /* (i) Q12 :Impulse response of filters */
Word16 *rr /* (o) :Correlations of H[] */
)
{
Word16 *rri0i0, *rri1i1, *rri2i2, *rri3i3, *rri4i4;
Word16 *rri0i1, *rri0i2, *rri0i3, *rri0i4;
Word16 *rri1i2, *rri1i3, *rri1i4;
Word16 *rri2i3, *rri2i4;
Word16 *p0, *p1, *p2, *p3, *p4;
Word16 *ptr_hd, *ptr_hf, *ptr_h1, *ptr_h2;
Word32 cor;
Word16 i, k, ldec, l_fin_sup, l_fin_inf;
Word16 h[L_SUBFR];
/* Scaling h[] for maximum precision */
cor = 0;
for(i=0; i<L_SUBFR; i++)
cor = L_mac(cor, H[i], H[i])
|
请发表评论