Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool ASIO :: SSEFrom32To24(float *source,void* target,long frames)
- {
- PrepareSSEHelpBuffer(frames);
- unsigned long long jX1 = (unsigned long long )SSEHelpBufferPointerAligned16A1;
- if (jX1 % 16 || jX1 == 0)
- return false;
- unsigned long long jX2 = (unsigned long long )SSEHelpBufferPointerAligned16A2;
- if (jX2 % 16 || jX2 == 0)
- return false;
- memcpy(SSEHelpBufferPointerAligned16A1,source,frames*sizeof(float));
- static const float L = (1 << 31);
- static const __m128 LI = {(float)L, (float)L, (float)L, (float)L};
- __m128* floats = (__m128*)SSEHelpBufferPointerAligned16A1;
- __m128i* ints = (__m128i*)SSEHelpBufferPointerAligned16A2;
- for(int i = 0 ; i < frames/4 ; i ++)
- ints[i] = _mm_cvtps_epi32(_mm_mul_ps(floats[i], LI));
- for(int i = 0 ; i < frames ; i++)
- {
- memcpy(target + i*3,SSEHelpBufferPointerAligned16A2,3); // only the 3 lower bytes
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement