aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-03-19 06:54:04 +0100
committerMax Kellermann <max@duempel.org>2014-03-19 06:54:06 +0100
commit74a05a7f53878c70d10326d60d75e39fd93d944c (patch)
tree0426db4006847cbd01a025d250a91515127f26d1 /src
parenta68acf5c66634444986d2eb5bf96a532c83729d1 (diff)
downloadmpd-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 'src')
-rw-r--r--src/pcm/Neon.hxx8
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);