Revert "(audio conversion) Optimize array accesses"

This reverts commit 8613ece7f55ba7528e9ebc9b30791a40f5c431be.
This commit is contained in:
twinaphex 2020-08-19 18:18:02 +02:00
parent c4be485baf
commit dff52d8688
2 changed files with 7 additions and 17 deletions

View File

@ -50,9 +50,7 @@ void convert_float_s16_asm(int16_t *out, const float *in, size_t samples);
void convert_float_to_s16(int16_t *out, void convert_float_to_s16(int16_t *out,
const float *in, size_t samples) const float *in, size_t samples)
{ {
int16_t *out_ptr = NULL; size_t i = 0;
const float *in_ptr = NULL;
size_t i = 0;
#if defined(__SSE2__) #if defined(__SSE2__)
__m128 factor = _mm_set1_ps((float)0x8000); __m128 factor = _mm_set1_ps((float)0x8000);
@ -137,13 +135,10 @@ void convert_float_to_s16(int16_t *out,
#endif #endif
for ( for (; i < samples; i++)
out_ptr = &out[i], in_ptr = &in[i]
; i < samples
; out_ptr++, in_ptr++, i++)
{ {
int32_t val = (int32_t)(*in_ptr * 0x8000); int32_t val = (int32_t)(in[i] * 0x8000);
*out_ptr = (val > 0x7FFF) ? 0x7FFF : out[i] = (val > 0x7FFF) ? 0x7FFF :
(val < -0x8000 ? -0x8000 : (int16_t)val); (val < -0x8000 ? -0x8000 : (int16_t)val);
} }
} }

View File

@ -50,9 +50,7 @@ void convert_s16_float_asm(float *out, const int16_t *in,
void convert_s16_to_float(float *out, void convert_s16_to_float(float *out,
const int16_t *in, size_t samples, float gain) const int16_t *in, size_t samples, float gain)
{ {
float *out_ptr = NULL; unsigned i = 0;
const int16_t *in_ptr = NULL;
unsigned i = 0;
#if defined(__SSE2__) #if defined(__SSE2__)
float fgain = gain / UINT32_C(0x80000000); float fgain = gain / UINT32_C(0x80000000);
@ -171,11 +169,8 @@ void convert_s16_to_float(float *out,
#endif #endif
for ( for (; i < samples; i++)
out_ptr = &out[i], in_ptr = &in[i] out[i] = (float)in[i] * gain;
; i < samples
; out_ptr++, in_ptr++, i++)
*out_ptr = (float)*in_ptr * gain;
} }
/** /**