Commit Graph

36 Commits

Author SHA1 Message Date
Max Kellermann 423f2df5e0 pcm/Volume: drop support for GCC older than 8 2021-04-20 20:01:43 +02:00
Max Kellermann 5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Rosen Penev a2f5a63bbc replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Rosen Penev ab9f5d2067 replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Max Kellermann 2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann 44d7a1d8d2 pcm/Traits: drop "_type" from type names 2020-01-03 16:01:44 +01:00
Max Kellermann f357f743a3 pcm/Volume: use transform_n() 2019-08-10 12:05:37 +02:00
Max Kellermann af99f9fc90 pcm/Volume: convert S16 to S24 to preserve quality and reduce noise
Applying software volume to S16 samples means several bits of
precision are lost; at 25% volume, two bits are lost.  Additionally,
dithering adds some noise.

The problem gets worse when you apply the software volume code twice:
for the software mixer volume, and again for the replay gain.  This
loses some more precision and adds even more dithering noise, which
can become audible (see
https://github.com/MusicPlayerDaemon/MPD/issues/542).

By converting everything to 24 bit, we need to shift only two bits to
the right instead of ten, losing nearly no precision, and dithering is
not needed.  Even if the output device is unable to play S24 directly,
we can convert back to S16 with only one stage of dithering.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/542
2019-07-30 20:03:37 +02:00
Max Kellermann 326c6ae615 pcm/Volume: add variable "dest_size" 2019-07-05 21:01:09 +02:00
Max Kellermann 5fa7610264 pcm/Volume: Open() returns output sample format
Prepare for a new mode which may convert to a different sample format
when applying volume, to reduce dithering.
2019-07-05 19:03:00 +02:00
Max Kellermann e87f0ca771 pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Max Kellermann a139279575 Copyright year 2019 2019-06-17 11:17:30 +02:00
Max Kellermann ce49d99c2f check.h: remove obsolete header
Since we switched from autotools to Meson in commit
94592c1406, we don't need to include
`config.h` early to properly enable large file support.  Meson passes
the required macros on the compiler command line instead of defining
them in `config.h`.

This means we can include `config.h` at any time, whenever we want to
check its macros, and there are no ordering constraints.
2018-11-19 16:33:49 +01:00
Max Kellermann f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann 3bb9c704de pcm/*: add "noexcept" 2018-01-01 19:07:33 +01:00
Max Kellermann 71f0ed8b74 *: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
2017-05-08 14:44:49 +02:00
Max Kellermann 3f321ae9a0 pcm/SampleFormat: make the two inline functions "constexpr" 2017-01-17 22:52:09 +01:00
Max Kellermann 5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann 98a12c49dd pcm/Domain: remove obsolete source 2016-11-09 12:15:35 +01:00
Max Kellermann ae1eb9ccde pcm/Convert: migrate from class Error to C++ exceptions 2016-09-09 14:44:13 +02:00
Max Kellermann b67e7df38e Merge tag 'v0.19.17'
release v0.19.17
2016-07-09 00:46:09 +02:00
Max Kellermann b8097eaf2e pcm/Volume: move silence pattern to Silence.cxx 2016-07-05 17:52:53 +02:00
Max Kellermann ba8e579e9b pcm/Volume: use 0x69 to generate DSD silence 2016-07-01 21:22:21 +02:00
Max Kellermann 1aee89f5ea *: include cleanup (using iwyu) 2016-03-01 22:08:13 +01:00
Max Kellermann 1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann 712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann a52cae1dba pcm/Volume: make DSD a no-op
Kludge to work around DSD playback failure because the
ReplayGainFilterPlugin is always in the filter chain.
2014-01-17 23:57:30 +01:00
Max Kellermann 4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann 7eda72d440 pcm/Volume: use number of samples instead of end pointer 2014-01-07 00:42:02 +01:00
Max Kellermann afcf0795c4 pcm/Volume: improved dithering
Instead of just adding a rectangular random value before shifting back
to the normal scale, use the existing PcmDither library.
2013-12-28 18:30:24 +01:00
Max Kellermann f3bbe4bb1f pcm/Volume: remove optimized i386 assembly
This code is unable to dither.  Until we implement that, let's remove
the code for now.  i386 isn't relevant anymore anyway.
2013-12-28 17:24:54 +01:00
Max Kellermann 8edde7a4b3 pcm/Volume: convert to class
Prepare for adding state.
2013-12-23 10:58:37 +01:00
Max Kellermann d11a0c9f14 pcm/Volume: apply volume into destination buffer 2013-12-23 10:55:29 +01:00
Max Kellermann 7be2abe6b5 pcm/Volume: convert i386 code to template specialization 2013-12-23 10:35:35 +01:00
Max Kellermann 4a62cd4ad8 pcm/Volume: move code to template pcm_volume_sample() 2013-12-23 10:35:23 +01:00
Max Kellermann 6d21b9448a pcm/PcmVolume: rename to Volume.cxx 2013-12-23 10:35:21 +01:00