diff options
author | Max Kellermann <max@duempel.org> | 2013-01-31 22:43:28 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-31 22:54:10 +0100 |
commit | f2491c88c86707cc35c7dfc30a1b5a0a29886540 (patch) | |
tree | d7b2079f3122aa486b8717c916b596c421944f82 /src/PcmDither.hxx | |
parent | 1b175025fecb1c10e6719d4ab79c188d473fccc4 (diff) |
PcmDither: convert struct to a class
Diffstat (limited to 'src/PcmDither.hxx')
-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 59affa08..10638230 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 |