mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Fix 16 bit audio mode
Pointed by @ruipin, some backends may be affected Reuse float buffer for conversion result
This commit is contained in:
parent
4baa159523
commit
7f1cbb1136
1 changed files with 4 additions and 10 deletions
|
@ -267,22 +267,16 @@ void audio_thread::operator()()
|
||||||
// 2x CVTPS2DQ (converts float to s32)
|
// 2x CVTPS2DQ (converts float to s32)
|
||||||
// PACKSSDW (converts s32 to s16 with signed saturation)
|
// PACKSSDW (converts s32 to s16 with signed saturation)
|
||||||
|
|
||||||
__m128i buf_u16[BUFFER_SIZE];
|
|
||||||
|
|
||||||
for (size_t i = 0; i < 8 * BUFFER_SIZE; i += 8)
|
for (size_t i = 0; i < 8 * BUFFER_SIZE; i += 8)
|
||||||
{
|
{
|
||||||
const auto scale = _mm_set1_ps(0x8000);
|
const auto scale = _mm_set1_ps(0x8000);
|
||||||
buf_u16[i / 8] = _mm_packs_epi32(
|
_mm_store_ps(out_buffer[out_pos].get() + i / 2, _mm_castsi128_ps(_mm_packs_epi32(
|
||||||
_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(out_buffer[out_pos].get() + i), scale)),
|
_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(out_buffer[out_pos].get() + i), scale)),
|
||||||
_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(out_buffer[out_pos].get() + i + 4), scale)));
|
_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(out_buffer[out_pos].get() + i + 4), scale)))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
audio->AddData(buf_u16, buf_sz);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
audio->AddData(out_buffer[out_pos].get(), buf_sz);
|
audio->AddData(out_buffer[out_pos].get(), buf_sz);
|
||||||
}
|
|
||||||
|
|
||||||
const u64 stamp2 = get_system_time();
|
const u64 stamp2 = get_system_time();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue