summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorDana Conrad <dconrad@fastmail.com>2021-07-31 21:05:40 -0500
committerSolomon Peachy <pizza@shaftnet.org>2021-08-01 02:20:00 +0000
commita2fd00cf38d991eed23efd8f780edf9c39c1d05f (patch)
tree5b06ef8f84f69ddb9ec3f7aad8f716b99aec48be /firmware
parentecf0d631e7e06db2ee1a0de98436ae1eb20c822c (diff)
downloadrockbox-a2fd00cf38d991eed23efd8f780edf9c39c1d05f.tar.gz
rockbox-a2fd00cf38d991eed23efd8f780edf9c39c1d05f.zip
Software Volume: Remove sample rounding
Change-Id: I630139333d64b4c8cae86939ecfc52c44a34ffea
Diffstat (limited to 'firmware')
-rw-r--r--firmware/pcm_sw_volume.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/pcm_sw_volume.c b/firmware/pcm_sw_volume.c
index 29049059e6..7322269f44 100644
--- a/firmware/pcm_sw_volume.c
+++ b/firmware/pcm_sw_volume.c
@@ -51,10 +51,10 @@ static typeof (memcpy) *pcm_scaling_fn = NULL;
51#define PCM_F_T int64_t /* Requires large integer math */ 51#define PCM_F_T int64_t /* Requires large integer math */
52#endif /* PCM_SW_VOLUME_FRACBITS */ 52#endif /* PCM_SW_VOLUME_FRACBITS */
53 53
54/* Scale and round sample by PCM factor */ 54/* Scale sample by PCM factor */
55static inline int32_t pcm_scale_sample(PCM_F_T f, int32_t s) 55static inline int32_t pcm_scale_sample(PCM_F_T f, int32_t s)
56{ 56{
57 return (f * s + (PCM_F_T)PCM_FACTOR_UNITY/2) >> PCM_SW_VOLUME_FRACBITS; 57 return (f * s) >> PCM_SW_VOLUME_FRACBITS;
58} 58}
59 59
60/* Both UNITY, use direct copy */ 60/* Both UNITY, use direct copy */