@@ -42,7 +42,6 @@ impl Converter {
4242 const SHIFT_S24 : u8 = 23 ; // 24-bit: 2^23 = 8388608
4343 const SHIFT_S32 : u8 = 31 ; // 32-bit: 2^31 = 2147483648
4444
45-
4645 /// Additional bit shifts needed to scale from 16-bit to higher bit depths.
4746 /// These are the differences between the base shift amounts above.
4847 const SHIFT_16_TO_24 : u8 = Self :: SHIFT_S24 - Self :: SHIFT_S16 ; // 23 - 15 = 8
@@ -52,12 +51,12 @@ impl Converter {
5251 const SCALE_S24 : f64 = ( 1_u64 << Self :: SHIFT_S24 ) as f64 ;
5352
5453 /// Scale audio samples with optimal dithering strategy for Spotify's 16-bit source material.
55- ///
54+ ///
5655 /// Since Spotify audio is always 16-bit depth, this function:
5756 /// 1. When dithering: applies noise at 16-bit level, preserves fractional precision,
5857 /// then scales to target format and rounds once at the end
5958 /// 2. When not dithering: scales directly from normalized float to target format
60- ///
59+ ///
6160 /// The `shift` parameter specifies how many extra bits to shift beyond
6261 /// the base 16-bit scaling (0 for 16-bit, 8 for 24-bit, 16 for 32-bit).
6362 #[ inline]
@@ -85,11 +84,11 @@ impl Converter {
8584 #[ inline]
8685 pub fn clamping_scale_s24 ( & mut self , sample : f64 ) -> f64 {
8786 let int_value = self . scale ( sample, Self :: SHIFT_16_TO_24 ) ;
88-
87+
8988 // In two's complement, there are more negative than positive values.
9089 let min = -Self :: SCALE_S24 ;
9190 let max = Self :: SCALE_S24 - 1.0 ;
92-
91+
9392 int_value. clamp ( min, max)
9493 }
9594
0 commit comments