Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 475266
Collapse All | Expand All

(-)a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp (-15 / +10 lines)
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);
(-)a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp (-2 / +2 lines)
Lines 30-36 using namespace std; Link Here
30
30
31
/* declare the rng seed and initialize it */
31
/* declare the rng seed and initialize it */
32
unsigned int CAEUtil::m_seed = (unsigned int)(CurrentHostCounter() / 1000.0f);
32
unsigned int CAEUtil::m_seed = (unsigned int)(CurrentHostCounter() / 1000.0f);
33
#ifdef __SSE__
33
#ifdef __SSE2__
34
  /* declare the SSE seed and initialize it */
34
  /* declare the SSE seed and initialize it */
35
  MEMALIGN(16, __m128i CAEUtil::m_sseSeed) = _mm_set_epi32(CAEUtil::m_seed, CAEUtil::m_seed+1, CAEUtil::m_seed, CAEUtil::m_seed+1);
35
  MEMALIGN(16, __m128i CAEUtil::m_sseSeed) = _mm_set_epi32(CAEUtil::m_seed, CAEUtil::m_seed+1, CAEUtil::m_seed, CAEUtil::m_seed+1);
36
#endif
36
#endif
Lines 386-392 float CAEUtil::FloatRand1(const float min, const float max) Link Here
386
386
387
void CAEUtil::FloatRand4(const float min, const float max, float result[4], __m128 *sseresult/* = NULL */)
387
void CAEUtil::FloatRand4(const float min, const float max, float result[4], __m128 *sseresult/* = NULL */)
388
{
388
{
389
  #ifdef __SSE__
389
  #ifdef __SSE2__
390
    /*
390
    /*
391
      this method may be called from other SSE code, we need
391
      this method may be called from other SSE code, we need
392
      to calculate the delta & factor using SSE as the FPU
392
      to calculate the delta & factor using SSE as the FPU
(-)a/xbmc/cores/AudioEngine/Utils/AEUtil.h (-2 / +5 lines)
Lines 36-41 Link Here
36
#define __m128 void
36
#define __m128 void
37
#endif
37
#endif
38
38
39
#ifdef __SSE2__
40
#include <emmintrin.h>
41
#endif
42
39
#ifdef __GNUC__
43
#ifdef __GNUC__
40
  #define MEMALIGN(b, x) x __attribute__((aligned(b)))
44
  #define MEMALIGN(b, x) x __attribute__((aligned(b)))
41
#else
45
#else
Lines 46-52 class CAEUtil Link Here
46
{
50
{
47
private:
51
private:
48
  static unsigned int m_seed;
52
  static unsigned int m_seed;
49
  #ifdef __SSE__
53
  #ifdef __SSE2__
50
    static __m128i m_sseSeed;
54
    static __m128i m_sseSeed;
51
  #endif
55
  #endif
52
56
53
- 

Return to bug 475266