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,
const float *in, size_t samples)
{
int16_t *out_ptr = NULL;
const float *in_ptr = NULL;
size_t i = 0;
size_t i = 0;
#if defined(__SSE2__)
__m128 factor = _mm_set1_ps((float)0x8000);
@ -137,13 +135,10 @@ void convert_float_to_s16(int16_t *out,
#endif
for (
out_ptr = &out[i], in_ptr = &in[i]
; i < samples
; out_ptr++, in_ptr++, i++)
for (; i < samples; i++)
{
int32_t val = (int32_t)(*in_ptr * 0x8000);
*out_ptr = (val > 0x7FFF) ? 0x7FFF :
int32_t val = (int32_t)(in[i] * 0x8000);
out[i] = (val > 0x7FFF) ? 0x7FFF :
(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,
const int16_t *in, size_t samples, float gain)
{
float *out_ptr = NULL;
const int16_t *in_ptr = NULL;
unsigned i = 0;
unsigned i = 0;
#if defined(__SSE2__)
float fgain = gain / UINT32_C(0x80000000);
@ -171,11 +169,8 @@ void convert_s16_to_float(float *out,
#endif
for (
out_ptr = &out[i], in_ptr = &in[i]
; i < samples
; out_ptr++, in_ptr++, i++)
*out_ptr = (float)*in_ptr * gain;
for (; i < samples; i++)
out[i] = (float)in[i] * gain;
}
/**