Commit 74a05a7f authored by Max Kellermann's avatar Max Kellermann

pcm/Neon: explicit rounding

Convert to 31 bit first, then right-shift with rounding to 16 bit.
parent a68acf5c
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment