Asterisk - The Open Source Telephony Project  18.5.0
Macros | Functions
resample_sse.h File Reference

Resampler functions (SSE version) More...

#include <xmmintrin.h>
Include dependency graph for resample_sse.h:

Go to the source code of this file.

Macros

#define OVERRIDE_INNER_PRODUCT_SINGLE
 
#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
 

Functions

static float inner_product_single (const float *a, const float *b, unsigned int len)
 
static float interpolate_product_single (const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac)
 

Detailed Description

Resampler functions (SSE version)

Definition in file resample_sse.h.

Macro Definition Documentation

◆ OVERRIDE_INNER_PRODUCT_SINGLE

#define OVERRIDE_INNER_PRODUCT_SINGLE

Definition at line 39 of file resample_sse.h.

◆ OVERRIDE_INTERPOLATE_PRODUCT_SINGLE

#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE

Definition at line 56 of file resample_sse.h.

Function Documentation

◆ inner_product_single()

static float inner_product_single ( const float *  a,
const float *  b,
unsigned int  len 
)
inlinestatic

Definition at line 40 of file resample_sse.h.

References len().

Referenced by resampler_basic_direct_single().

41 {
42  int i;
43  float ret;
44  __m128 sum = _mm_setzero_ps();
45  for (i=0;i<len;i+=8)
46  {
47  sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)));
48  sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)));
49  }
50  sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
51  sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
52  _mm_store_ss(&ret, sum);
53  return ret;
54 }
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct test_val b
static struct test_val a

◆ interpolate_product_single()

static float interpolate_product_single ( const float *  a,
const float *  b,
unsigned int  len,
const spx_uint32_t  oversample,
float *  frac 
)
inlinestatic

Definition at line 57 of file resample_sse.h.

References a, b, len(), and QualityMapping::oversample.

Referenced by resampler_basic_interpolate_single().

57  {
58  int i;
59  float ret;
60  __m128 sum = _mm_setzero_ps();
61  __m128 f = _mm_loadu_ps(frac);
62  for(i=0;i<len;i+=2)
63  {
64  sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)));
65  sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)));
66  }
67  sum = _mm_mul_ps(f, sum);
68  sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
69  sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
70  _mm_store_ss(&ret, sum);
71  return ret;
72 }
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct test_val b
static struct test_val a