diff options
Diffstat (limited to '')
-rw-r--r-- | src/PcmDither.hxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/PcmDither.hxx b/src/PcmDither.hxx index 59affa088..106382307 100644 --- a/src/PcmDither.hxx +++ b/src/PcmDither.hxx @@ -22,24 +22,23 @@ #include <stdint.h> -struct pcm_dither { +class PcmDither { int32_t error[3]; int32_t random; -}; -static inline void -pcm_dither_24_init(struct pcm_dither *dither) -{ - dither->error[0] = dither->error[1] = dither->error[2] = 0; - dither->random = 0; -} +public: + constexpr PcmDither() + :error{0, 0, 0}, random(0) {} + + void Dither24To16(int16_t *dest, const int32_t *src, + const int32_t *src_end); -void -pcm_dither_24_to_16(struct pcm_dither *dither, - int16_t *dest, const int32_t *src, const int32_t *src_end); + void Dither32To16(int16_t *dest, const int32_t *src, + const int32_t *src_end); -void -pcm_dither_32_to_16(struct pcm_dither *dither, - int16_t *dest, const int32_t *src, const int32_t *src_end); +private: + int16_t Dither24To16(int_fast32_t sample); + int16_t Dither32To16(int_fast32_t sample); +}; #endif |