diff options
author | Max Kellermann <max@duempel.org> | 2014-03-19 06:54:04 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-19 06:54:06 +0100 |
commit | 74a05a7f53878c70d10326d60d75e39fd93d944c (patch) | |
tree | 0426db4006847cbd01a025d250a91515127f26d1 /src/pcm | |
parent | a68acf5c66634444986d2eb5bf96a532c83729d1 (diff) | |
download | mpd-74a05a7f53878c70d10326d60d75e39fd93d944c.tar.gz mpd-74a05a7f53878c70d10326d60d75e39fd93d944c.tar.xz mpd-74a05a7f53878c70d10326d60d75e39fd93d944c.zip |
pcm/Neon: explicit rounding
Convert to 31 bit first, then right-shift with rounding to 16 bit.
Diffstat (limited to '')
-rw-r--r-- | src/pcm/Neon.hxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pcm/Neon.hxx b/src/pcm/Neon.hxx index ba31e55b8..7109778ab 100644 --- a/src/pcm/Neon.hxx +++ b/src/pcm/Neon.hxx @@ -76,11 +76,13 @@ struct NeonFloatTo16 { /* convert to 32 bit integer */ int32x4x4_t ivalue; neon_x4_b(vcvtq_n_s32_f32, ivalue, value, - DstTraits::BITS - 1); + 30); - /* convert to 16 bit integer with saturation */ + /* convert to 16 bit integer with saturation + and rounding */ int16x4x4_t nvalue; - neon_x4_u(vqmovn_s32, nvalue, ivalue); + neon_x4_b(vqrshrn_n_s32, nvalue, ivalue, + 30 - DstTraits::BITS + 1); /* store result */ vst4_s16(dst, nvalue); |