.h file class tom { . . . protected: static const int Adjust[6]; protected: int _mode; int _q; int _qm; int _qe; int _f; int _scale }; .cpp file const int tom::Adjust[6] = { 107, 916, 182, 362, 192, 282 }; tom::tom() { _q = 1; _qm =_q % 6; _qe = _q/6; _f = (1 << (15+_qe))/6; _scale = 15+_qe; } void tom::calculate(void* ptr) { short* block = (short *)ptr; int j; __m64*block1 = (__m64*)block; __m64 s0,s1,s2,s3,x0,x1,x2,x3; j=0; //step 1 s0 =_mm_add_pi16(block1[j],block1[j+3]); s3 =_mm_sub_pi16(block1[j],block1[j+3]); s1 =_mm_add_pi16(block1[j+1],block1[j+2]); s2 =_mm_sub_pi16(block1[j+1],block1[j+2]); // step 2 x0 =_mm_add_pi16(s0,s1); if(x0 < 0) block[j] = (short)(-( (((-x0) * Adjust[_qm]) + _f) >> _scale )); else block[j] = (short)( ((x0 * Adjust[_qm]) + _f) >> _scale ); . . . . _mm_empty(); }
x0
_m64
if
else
short s = 1 - (n >> 15) * 2
n
short
s
n >= 0
n < 0
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)