本文整理汇总了C++中shr函数的典型用法代码示例。如果您正苦于以下问题:C++ shr函数的具体用法?C++ shr怎么用?C++ shr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dec3_10
void dec3_10(
Shortword index, /* (i) : indx of 3 pulses (10 bits) */
Shortword cod[], /* (o) Q12: algebraic (fixed) codebook excitation */
Shortword l_subfr /* (i) : lenght of subframe (53 or 54) */
)
{
Shortword i, pos, gsign, sign;
for (i = 0; i < l_subfr; i++)
cod[i] = 0;
if ((index & 0x0200) != 0)
gsign = -1;
else
gsign = 1;
for (i = 4; i >= 0; i -= 2)
{
pos = add(shr(extract_l(L_mult((index & 0x0007), STEP)), 1), i);
if (i == 2)
sign = negate(gsign);
else
sign = gsign;
if (pos < l_subfr)
cod[pos] = sign;
index = shr(index, 3);
}
return;
}
开发者ID:bigrpg,项目名称:evrcc,代码行数:33,代码来源:d3_10pf.c
示例2: decode_4i40_17bits
void decode_4i40_17bits(
Word16 sign, /* i : signs of 4 pulses. */
Word16 index, /* i : Positions of the 4 pulses. */
Word16 cod[] /* o : algebraic (fixed) codebook excitation */
)
{
Word16 i, j;
Word16 pos[NB_PULSE];
/* Decode the positions */
i = index & 7; logic16 ();
i = dgray[i]; move16 ();
pos[0] = add(i, shl(i, 2)); /* pos0 =i*5 */ move16 ();
index = shr(index, 3);
i = index & 7; logic16 ();
i = dgray[i]; move16 ();
i = add(i, shl(i, 2)); /* pos1 =i*5+1 */
pos[1] = add(i, 1); move16 ();
index = shr(index, 3);
i = index & 7; logic16 ();
i = dgray[i]; move16 ();
i = add(i, shl(i, 2)); /* pos2 =i*5+1 */
pos[2] = add(i, 2); move16 ();
index = shr(index, 3);
j = index & 1; logic16 ();
index = shr(index, 1);
i = index & 7; logic16 ();
i = dgray[i]; move16 ();
i = add(i, shl(i, 2)); /* pos3 =i*5+3+j */
i = add(i, 3);
pos[3] = add(i, j); move16 ();
/* decode the signs and build the codeword */
for (i = 0; i < L_SUBFR; i++) {
cod[i] = 0; move16 ();
}
for (j = 0; j < NB_PULSE; j++) {
i = sign & 1; logic16 ();
sign = shr(sign, 1);
test ();
if (i != 0) {
cod[pos[j]] = 8191; move16 ();
} else {
cod[pos[j]] = -8192; move16 ();
}
}
return;
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:60,代码来源:d4_17pf.c
示例3: decode64
int decode64 (unsigned char *dst, int size, char *src)
{
unsigned char *sptr = (unsigned char *) src;
unsigned char *dptr = dst;
unsigned char *end = dst + size;
unsigned char c1, c2, c3, c4;
do
{
c1 = char64(*sptr);
c2 = char64(*(sptr + 1));
if (c1 == 255 || c2 == 255) break;
*dptr++ = shl(c1, 2) | shr((c2 & 0x30), 4);
if (dptr >= end) break;
c3 = char64(*(sptr + 2));
if (c3 == 255) break;
*dptr++ = shl((c2 & 0x0f), 4) | shr((c3 & 0x3c), 2);
if (dptr >= end) break;
c4 = char64(*(sptr + 3));
if (c4 == 255) break;
*dptr++ = shl((c3 & 0x03), 6) | c4;
sptr += 4;
}
while (dptr < end);
return (dptr - dst);
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:33,代码来源:pufferfish_itoa64_plug.c
示例4: 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
示例5: Int_lpc
void Int_lpc(
Word16 lsp_old[], /* input : LSP vector of past frame */
Word16 lsp_new[], /* input : LSP vector of present frame */
Word16 lsf_int[], /* output: interpolated lsf coefficients */
Word16 lsf_new[],
Word16 Az[] /* output: interpolated Az() for the 2 subframes */
)
{
Word16 i;
Word16 lsp[M];
/* lsp[i] = lsp_new[i] * 0.5 + lsp_old[i] * 0.5 */
for (i = 0; i < M; i++) {
lsp[i] = add(shr(lsp_new[i], 1), shr(lsp_old[i], 1));
}
Lsp_Az(lsp, Az);
Lsp_lsf(lsp, lsf_int, M); /* transformation from LSP to LSF (freq.domain) */
Lsp_lsf(lsp_new, lsf_new, M); /* transformation from LSP to LSF (freq.domain) */
return;
}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:25,代码来源:LPCFUNC.C
示例6: Decod_ACELP
void Decod_ACELP(
Word16 sign, /* (i) : signs of 4 pulses. */
Word16 index, /* (i) : Positions of the 4 pulses. */
Word16 cod[] /* (o) Q13 : algebraic (fixed) codebook excitation */
)
{
Word16 i, j;
Word16 pos[4];
/* Decode the positions */
i = index & (Word16)7;
pos[0] = add(i, shl(i, 2)); /* pos0 =i*5 */
index = shr(index, 3);
i = index & (Word16)7;
i = add(i, shl(i, 2)); /* pos1 =i*5+1 */
pos[1] = add(i, 1);
index = shr(index, 3);
i = index & (Word16)7;
i = add(i, shl(i, 2)); /* pos2 =i*5+1 */
pos[2] = add(i, 2);
index = shr(index, 3);
j = index & (Word16)1;
index = shr(index, 1);
i = index & (Word16)7;
i = add(i, shl(i, 2)); /* pos3 =i*5+3+j */
i = add(i, 3);
pos[3] = add(i, j);
/* decode the signs and build the codeword */
for (i=0; i<L_SUBFR; i++) {
cod[i] = 0;
}
for (j=0; j<4; j++)
{
i = sign & (Word16)1;
sign = shr(sign, 1);
if (i != 0) {
cod[pos[j]] = 8191; /* Q13 +1.0 */
}
else {
cod[pos[j]] = -8192; /* Q13 -1.0 */
}
}
return;
}
开发者ID:ChallyCai,项目名称:g729,代码行数:55,代码来源:de_acelp.c
示例7: Bitpack_newu
uint64_t Bitpack_newu(uint64_t word, unsigned width, unsigned lsb,
uint64_t value)
{
unsigned hi = lsb + width; /* one beyond the most significant bit */
assert(hi <= 64);
if (!Bitpack_fitsu(value, width))
RAISE(Bitpack_Overflow);
return shl(shr(word, hi), hi) /* high part */
| shr(shl(word, 64 - lsb), 64 - lsb) /* low part */
| (value << lsb); /* new part */
}
开发者ID:dcroberts,项目名称:tufts,代码行数:11,代码来源:bitpacksoln.c
示例8: gmul
/** Performs a carryless multiplication of two 128bit integers modulo \f$ x^{128} + x^7 + x^2 + x + 1 \f$ */
static __m128i gmul(__m128i v, __m128i h) {
/* multiply */
__m128i z0, z1, z2, tmp;
z0 = _mm_clmulepi64_si128(v, h, 0x11);
z2 = _mm_clmulepi64_si128(v, h, 0x00);
__m128i tmpv = _mm_srli_si128(v, 8);
tmpv = _mm_xor_si128(tmpv, v);
__m128i tmph = _mm_srli_si128(h, 8);
tmph = _mm_xor_si128(tmph, h);
z1 = _mm_clmulepi64_si128(tmpv, tmph, 0x00);
z1 = _mm_xor_si128(z1, z0);
z1 = _mm_xor_si128(z1, z2);
tmp = _mm_srli_si128(z1, 8);
__m128i pl = _mm_xor_si128(z0, tmp);
tmp = _mm_slli_si128(z1, 8);
__m128i ph = _mm_xor_si128(z2, tmp);
tmp = _mm_srli_epi64(ph, 63);
tmp = _mm_srli_si128(tmp, 8);
pl = shl(pl, 1);
pl = _mm_xor_si128(pl, tmp);
ph = shl(ph, 1);
/* reduce */
__m128i b, c;
b = c = _mm_slli_si128(ph, 8);
b = _mm_slli_epi64(b, 62);
c = _mm_slli_epi64(c, 57);
tmp = _mm_xor_si128(b, c);
__m128i d = _mm_xor_si128(ph, tmp);
__m128i e = shr(d, 1);
__m128i f = shr(d, 2);
__m128i g = shr(d, 7);
pl = _mm_xor_si128(pl, d);
pl = _mm_xor_si128(pl, e);
pl = _mm_xor_si128(pl, f);
pl = _mm_xor_si128(pl, g);
return pl;
}
开发者ID:nomaster,项目名称:fastd,代码行数:52,代码来源:ghash_pclmulqdq_impl.c
示例9: WebRtcG729fix_Lsf_lsp2
void WebRtcG729fix_Lsf_lsp2(
int16_t lsf[], /* (i) Q13 : lsf[m] (range: 0.0<=val<PI) */
int16_t lsp[], /* (o) Q15 : lsp[m] (range: -1<=val<1) */
int16_t m /* (i) : LPC order */
)
{
int16_t i, ind;
int16_t offset; /* in Q8 */
int16_t freq; /* normalized frequency in Q15 */
int32_t 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 & (int16_t)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(WebRtcG729fix_slope_cos[ind], offset); /* L_tmp in Q28 */
lsp[i] = WebRtcSpl_AddSatW16(WebRtcG729fix_table2[ind], extract_l(L_shr(L_tmp, 13)));
}
}
开发者ID:sippet,项目名称:g729,代码行数:29,代码来源:lpcfunc.c
示例10: get_pq_polynomials
void get_pq_polynomials(
Word32 *f, /* Q23 */
Word16 *lsp) /* Q15 */
{
Word16 i, n, hi, lo;
Word16 index, offset, coslsp, c;
Word32 a0;
f[0] = L_mult(2048, 2048); // 1.0 Q23
for(i = 1; i <= LPCO ; i++)
f[i]= 0;
for(n=1; n<=(LPCO>>1); n++) {
/* cosine mapping */
index = shr(lsp[2*n-2],9); // Q6
offset = lsp[2*n-2]&(Word16)0x01ff; // Q9
a0 = L_mult(sub(costable[index+1], costable[index]), offset); // Q10
coslsp = add(costable[index], intround(L_shl(a0, 6))); // Q15 cos((double)PI*lsp[2*n-2])
c = coslsp; // Q14 c = 2. * cos((double)PI*lsp[2*n-2])
for(i = 2*n; i >= 2; i--) {
L_Extract(f[i-1], &hi, &lo);
f[i] = L_add(f[i], f[i-2]); // Q23 f[i] += f[i-2]
a0 = Mpy_32_16(hi, lo, c); // Q22
f[i] = L_sub(f[i], L_shl(a0,1)); // Q23 f[i] += f[i-2] - c*f[i-1];
}
f[1] = L_msu(f[1], c, 256); // Q23 f[1] -= c;
}
return;
}
开发者ID:EricChen2013,项目名称:Android-4,代码行数:34,代码来源:lsp2a.c
示例11: ngen_CC_param
void ngen_CC_param(shil_opcode& op, shil_param& prm, CanonicalParamType tp) {
switch (tp)
{
case CPT_u32:
case CPT_ptr:
case CPT_f32:
{
CC_PS t = { tp, &prm };
CC_pars.push_back(t);
}
break;
//store from EAX
case CPT_u64rvL:
case CPT_u32rv:
mov(rcx, rax);
reg_to_sh(prm, ecx);
break;
case CPT_u64rvH:
shr(rcx, 32);
reg_to_sh(prm, ecx);
break;
//Store from ST(0)
case CPT_f32rv:
reg_to_sh_ss(prm, xmm0);
break;
}
}
开发者ID:LpH3,项目名称:reicast-emulator,代码行数:32,代码来源:rec_x64.cpp
示例12: 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
示例13: Code
Code()
{
Xbyak::Label label;
cmpss(xmm0, ptr[rip + label], 0);
test(dword[rip + label], 33);
bt(dword[rip + label ], 3);
vblendpd(xmm0, dword[rip + label], 3);
vpalignr(xmm0, qword[rip + label], 4);
vextractf128(dword[rip + label], ymm3, 12);
vperm2i128(ymm0, ymm1, qword[rip + label], 13);
vcvtps2ph(ptr[rip + label], xmm2, 44);
mov(dword[rip + label], 0x1234);
shl(dword[rip + label], 3);
shr(dword[rip + label], 1);
shld(qword[rip + label], rax, 3);
imul(rax, qword[rip + label], 21);
rorx(rax, qword[rip + label], 21);
test(dword[rip + label], 5);
pextrq(ptr[rip + label], xmm0, 3);
pinsrq(xmm2, ptr[rip + label], 5);
pextrw(ptr[rip + label], xmm1, 4);
adc(dword[rip + label], 0x12345);
bt(byte[rip + label], 0x34);
btc(word[rip + label], 0x34);
btr(dword[rip + label], 0x34);
rcl(dword[rip + label], 4);
shld(qword[rip + label], rax, 4);
palignr(mm0, ptr[rip + label], 4);
aeskeygenassist(xmm3, ptr[rip + label], 4);
vpcmpestrm(xmm2, ptr[rip + label], 7);
ret();
L(label);
dq(0x123456789abcdef0ull);
};
开发者ID:153370771,项目名称:xbyak,代码行数:34,代码来源:rip-label-imm.cpp
示例14: get_op_code
static inline uint32_t get_op_code(uint32_t word)
{
return shr(shl(word, 64 - 32), 64 - 4);
/*Bitpack_getu(word, OP_CODE_LENGTH,
(WORD_LENGTH - OP_CODE_LENGTH));*/
}
开发者ID:dcroberts,项目名称:tufts,代码行数:7,代码来源:one-UM.c
示例15: Int2bin
static void Int2bin (
Word16 value, /* input : value to be converted to binary */
Word16 no_of_bits, /* input : number of bits associated with value */
Word16 *bitstream /* output: address where bits are written */
)
{
Word16 *pt_bitstream, i, bit;
pt_bitstream = &bitstream[no_of_bits];
for (i = 0; i < no_of_bits; i++)
{
bit = value & MASK;
if (bit == 0)
{
*--pt_bitstream = BIT_0;
}
else
{
*--pt_bitstream = BIT_1;
}
value = shr (value, 1);
}
}
开发者ID:2831942318,项目名称:siphon,代码行数:25,代码来源:prm2bits.c
示例16: interpolation_cos129
long interpolation_cos129( short freq )
{
short sin_data,cos_data,count,temp ;
long Ltemp,Lresult;
/* cos(x)=cos(a)+(x-a)sin(a)-pow((a-x),2)*cos(a) */
count=shr(abs_s(freq ),7 );
temp=sub( extract_l(L_mult( count,64)) , freq );
/* (a-x)sin a */
/* Scale factor for (a-x): 3217=pi2/64 */
sin_data=sin129_table [ count];
cos_data=cos129_table [count];
Ltemp=L_mpy_ls(L_mult(3217,temp),sin_data);
/* (a-x) sin(a) - [(a-x)*(a-x)*cos(a)] /2 */
/* Scale factor for (a-x)*(a-x): 20213=pi2*pi2/64 */
Ltemp=L_sub(Ltemp,
L_mpy_ls(L_mult(mult_r(10106,temp),temp),cos_data));
/* Scaled up by 64/2 times */
Ltemp=L_shl( Ltemp ,6 );
Lresult= L_add(L_deposit_h(cos_data), (Ltemp)) ;
return(Lresult);
}
开发者ID:arulk77,项目名称:gpu.evrc,代码行数:31,代码来源:intr_cos.c
示例17: 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 ( sub(ind, 63)>0 ){
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:SibghatullahSheikh,项目名称:codecs,代码行数:30,代码来源:LPCFUNC.C
示例18: compute_raw_pow_categories
/***************************************************************************
Function: compute_raw_pow_categories
Syntax: void compute_raw_pow_categories(Word16 *power_categories,
Word16 *rms_index,
Word16 number_of_regions,
Word16 offset)
inputs: *rms_index
number_of_regions
offset
outputs: *power_categories
Description: This function computes the power categories given the offset
This is kind of redundant since they were already computed
in calc_offset to determine the offset.
WMOPS: | 24kbit | 32kbit
-------|--------------|----------------
AVG | 0.01 | 0.01
-------|--------------|----------------
MAX | 0.01 | 0.01
-------|--------------|----------------
14kHz | 24kbit | 32kbit | 48kbit
-------|--------------|----------------|----------------
AVG | 0.01 | 0.01 | 0.01
-------|--------------|----------------|----------------
MAX | 0.01 | 0.01 | 0.01
-------|--------------|----------------|----------------
***************************************************************************/
void compute_raw_pow_categories(Word16 *power_categories,Word16 *rms_index,Word16 number_of_regions,Word16 offset)
{
Word16 region;
Word16 j;
Word16 temp;
for (region=0; region<number_of_regions; region++)
{
j = sub(offset,rms_index[region]);
j = shr(j,1);
/* make sure j is between 0 and NUM_CAT-1 */
test();
if (j < 0)
{
j = 0;
move16();
}
temp = sub(j,(NUM_CATEGORIES-1));
test();
if (temp > 0)
j = sub(NUM_CATEGORIES,1);
power_categories[region] = j;
move16();
}
}
开发者ID:VVer,项目名称:opal,代码行数:61,代码来源:common.c
示例19: Bitpack
void Bitpack(
INT16 in,
UINT16 *TrWords,
INT16 NoOfBits,
INT16 *ptr
)
{
INT16 temp;
UINT16 *WordPtr;
WordPtr = TrWords + ptr[1];
*ptr = sub(*ptr, NoOfBits);
if (*ptr >= 0)
{
/* NOTE: Creating *WordPtr requires an unsigned shift. There isn't a fixed
* point prototype for an unsigned shift, so I kept the C version. */
*WordPtr = *WordPtr | (in << *ptr);
}
else
{
temp = shr(in, negate(*ptr));
*WordPtr = *WordPtr | temp;
WordPtr++;
*ptr = add(*ptr, 16);
*WordPtr = (INT16) ((INT32) (L_shl((INT32) in, *ptr)) & 0xffff);
ptr[1] += 1;
}
}
开发者ID:bigrpg,项目名称:evrcc,代码行数:28,代码来源:bitpack.c
示例20: Inv_sqrt
Word32 Inv_sqrt( /* (o) Q30 : output value (range: 0<=val<1) */
Word32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */
)
{
Word16 exp, i, a, tmp;
Word32 L_y;
if( L_x <= (Word32)0) return ( (Word32)0x3fffffffL);
exp = norm_l(L_x);
L_x = L_shl(L_x, exp ); /* L_x is normalize */
exp = sub(30, exp);
if( (exp & 1) == 0 ) /* If exponent even -> shift right */
L_x = L_shr(L_x, 1);
exp = shr(exp, 1);
exp = add(exp, 1);
L_x = L_shr(L_x, 9);
i = extract_h(L_x); /* Extract b25-b31 */
L_x = L_shr(L_x, 1);
a = extract_l(L_x); /* Extract b10-b24 */
a = a & (Word16)0x7fff;
i = sub(i, 16);
L_y = L_deposit_h(tabsqr[i]); /* tabsqr[i] << 16 */
tmp = sub(tabsqr[i], tabsqr[i+1]); /* tabsqr[i] - tabsqr[i+1]) */
L_y = L_msu(L_y, tmp, a); /* L_y -= tmp*a*2 */
L_y = L_shr(L_y, exp); /* denormalization */
return(L_y);
}
开发者ID:shahid313,项目名称:MSCourseWork,代码行数:35,代码来源:DSPFUNC.C
注:本文中的shr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论