Lines 33-43
Link Here
|
33 |
#include <math.h> |
33 |
#include <math.h> |
34 |
#include <string.h> |
34 |
#include <string.h> |
35 |
|
35 |
|
36 |
#ifdef __SSE__ |
|
|
37 |
#include <xmmintrin.h> |
38 |
#include <emmintrin.h> |
39 |
#endif |
40 |
|
41 |
#ifdef __ARM_NEON__ |
36 |
#ifdef __ARM_NEON__ |
42 |
#include <arm_neon.h> |
37 |
#include <arm_neon.h> |
43 |
#endif |
38 |
#endif |
Lines 517-523
unsigned int CAEConvert::Float_S8(float *data, const unsigned int samples, uint8
Link Here
|
517 |
unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, uint8_t *dest) |
512 |
unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, uint8_t *dest) |
518 |
{ |
513 |
{ |
519 |
int16_t *dst = (int16_t*)dest; |
514 |
int16_t *dst = (int16_t*)dest; |
520 |
#ifdef __SSE__ |
515 |
#ifdef __SSE2__ |
521 |
|
516 |
|
522 |
unsigned int count = samples; |
517 |
unsigned int count = samples; |
523 |
unsigned int unaligned = (0x10 - ((uintptr_t)data & 0xF)) >> 2; |
518 |
unsigned int unaligned = (0x10 - ((uintptr_t)data & 0xF)) >> 2; |
Lines 623-629
unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, ui
Link Here
|
623 |
/* cleanup */ |
618 |
/* cleanup */ |
624 |
_mm_empty(); |
619 |
_mm_empty(); |
625 |
|
620 |
|
626 |
#else /* no SSE */ |
621 |
#else /* no SSE2 */ |
627 |
|
622 |
|
628 |
uint32_t i = 0; |
623 |
uint32_t i = 0; |
629 |
uint32_t even = samples & ~0x3; |
624 |
uint32_t even = samples & ~0x3; |
Lines 651-657
unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, ui
Link Here
|
651 |
unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, uint8_t *dest) |
646 |
unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, uint8_t *dest) |
652 |
{ |
647 |
{ |
653 |
int16_t *dst = (int16_t*)dest; |
648 |
int16_t *dst = (int16_t*)dest; |
654 |
#ifdef __SSE__ |
649 |
#ifdef __SSE2__ |
655 |
|
650 |
|
656 |
unsigned int count = samples; |
651 |
unsigned int count = samples; |
657 |
unsigned int unaligned = (0x10 - ((uintptr_t)data & 0xF)) >> 2; |
652 |
unsigned int unaligned = (0x10 - ((uintptr_t)data & 0xF)) >> 2; |
Lines 757-763
unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, ui
Link Here
|
757 |
/* cleanup */ |
752 |
/* cleanup */ |
758 |
_mm_empty(); |
753 |
_mm_empty(); |
759 |
|
754 |
|
760 |
#else /* no SSE */ |
755 |
#else /* no SSE2 */ |
761 |
|
756 |
|
762 |
uint32_t i = 0; |
757 |
uint32_t i = 0; |
763 |
uint32_t even = samples & ~0x3; |
758 |
uint32_t even = samples & ~0x3; |
Lines 785-791
unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, ui
Link Here
|
785 |
unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, uint8_t *dest) |
780 |
unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, uint8_t *dest) |
786 |
{ |
781 |
{ |
787 |
int32_t *dst = (int32_t*)dest; |
782 |
int32_t *dst = (int32_t*)dest; |
788 |
#ifdef __SSE__ |
783 |
#ifdef __SSE2__ |
789 |
|
784 |
|
790 |
const __m128 mul = _mm_set_ps1((float)INT24_MAX+.5f); |
785 |
const __m128 mul = _mm_set_ps1((float)INT24_MAX+.5f); |
791 |
unsigned int count = samples; |
786 |
unsigned int count = samples; |
Lines 835-841
unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, u
Link Here
|
835 |
} |
830 |
} |
836 |
} |
831 |
} |
837 |
_mm_empty(); |
832 |
_mm_empty(); |
838 |
#else /* no SSE */ |
833 |
#else /* no SSE2 */ |
839 |
for (uint32_t i = 0; i < samples; ++i) |
834 |
for (uint32_t i = 0; i < samples; ++i) |
840 |
*dst++ = (safeRound(*data++ * ((float)INT24_MAX+.5f)) & 0xFFFFFF) << 8; |
835 |
*dst++ = (safeRound(*data++ * ((float)INT24_MAX+.5f)) & 0xFFFFFF) << 8; |
841 |
#endif |
836 |
#endif |
Lines 925-931
unsigned int CAEConvert::Float_S24NE3(float *data, const unsigned int samples, u
Link Here
|
925 |
unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, uint8_t *dest) |
920 |
unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, uint8_t *dest) |
926 |
{ |
921 |
{ |
927 |
int32_t *dst = (int32_t*)dest; |
922 |
int32_t *dst = (int32_t*)dest; |
928 |
#ifdef __SSE__ |
923 |
#ifdef __SSE2__ |
929 |
const __m128 mul = _mm_set_ps1((float)INT32_MAX); |
924 |
const __m128 mul = _mm_set_ps1((float)INT32_MAX); |
930 |
unsigned int count = samples; |
925 |
unsigned int count = samples; |
931 |
|
926 |
|
Lines 985-991
unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui
Link Here
|
985 |
_mm_empty(); |
980 |
_mm_empty(); |
986 |
#else |
981 |
#else |
987 |
|
982 |
|
988 |
/* no SIMD */ |
983 |
/* no SSE2 */ |
989 |
for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) |
984 |
for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) |
990 |
{ |
985 |
{ |
991 |
dst[0] = safeRound(data[0] * (float)INT32_MAX); |
986 |
dst[0] = safeRound(data[0] * (float)INT32_MAX); |
Lines 1034-1040
unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample
Link Here
|
1034 |
unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, uint8_t *dest) |
1029 |
unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, uint8_t *dest) |
1035 |
{ |
1030 |
{ |
1036 |
int32_t *dst = (int32_t*)dest; |
1031 |
int32_t *dst = (int32_t*)dest; |
1037 |
#ifdef __SSE__ |
1032 |
#ifdef __SSE2__ |
1038 |
const __m128 mul = _mm_set_ps1((float)INT32_MAX); |
1033 |
const __m128 mul = _mm_set_ps1((float)INT32_MAX); |
1039 |
unsigned int count = samples; |
1034 |
unsigned int count = samples; |
1040 |
|
1035 |
|
Lines 1093-1099
unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui
Link Here
|
1093 |
} |
1088 |
} |
1094 |
_mm_empty(); |
1089 |
_mm_empty(); |
1095 |
#else |
1090 |
#else |
1096 |
/* no SIMD */ |
1091 |
/* no SSE2 */ |
1097 |
for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) |
1092 |
for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) |
1098 |
{ |
1093 |
{ |
1099 |
dst[0] = safeRound(data[0] * (float)INT32_MAX); |
1094 |
dst[0] = safeRound(data[0] * (float)INT32_MAX); |