Commit Graph

30 Commits

Author SHA1 Message Date
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann 4ce1dae673 pcm/*: use std::span instead of ConstBuffer 2022-07-04 18:11:21 +02:00
Max Kellermann 8c51440057 test/test_mixramp: workaround for -Wdouble-promotion 2021-04-28 13:00:42 +02:00
Max Kellermann 5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann faa04966af test/test_pcm_*: use `using` instead of `typedef` 2020-02-01 13:38:55 +01:00
Max Kellermann 2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01: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 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 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 01b6e1cbf2 test: use GTest instead of cppunit 2018-10-16 21:26:04 +02:00
Max Kellermann 5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann ae1eb9ccde pcm/Convert: migrate from class Error to C++ exceptions 2016-09-09 14:44:13 +02: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 3932e62fc7 test/test_pcm: replace 256 with prime number
Use some odd number that will expose problems with remaining samples
after optimized vector operations.
2014-03-15 10:53:13 +01:00
Max Kellermann 4ba7427fa0 util/{Const,Writable}Buffer: add operator[] 2014-03-01 07:49:13 +01:00
Max Kellermann 4f83c60296 copyright year 2014 2014-01-13 22:31:55 +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 8edde7a4b3 pcm/Volume: convert to class
Prepare for adding state.
2013-12-23 10:58:37 +01:00
Max Kellermann 6d21b9448a pcm/PcmVolume: rename to Volume.cxx 2013-12-23 10:35:21 +01:00
Max Kellermann 7cb803ad5c test/test_pcm: use C++11 random instead of GLib 2013-10-19 15:05:48 +02:00
Max Kellermann 401a799a1b test: use the CPPUNIT framework for unit tests 2013-10-16 23:36:36 +02:00
Max Kellermann d1e7b4e381 audio_format: convert to C++ 2013-08-03 21:37:56 +02:00
Max Kellermann c654c7630a pcm_*: move to src/pcm/ 2013-04-09 01:24:52 +02:00
Max Kellermann e42734c3f3 test/test_pcm: merge source buffer generator 2013-01-31 22:58:27 +01:00
Max Kellermann 1b175025fe pcm_*: convert to C++ 2013-01-31 21:11:06 +01:00
Max Kellermann 0307801d51 test/test_pcm: convert to C++ 2013-01-31 21:11:06 +01:00