Commit Graph

358 Commits

Author SHA1 Message Date
Max Kellermann 5628dcf47e pcm/export: add #ifdef ENABLE_DSD to struct Params 2016-02-27 08:02:01 +01:00
Max Kellermann fb4f02cd38 pcm/PcmExport: add flag to export to DSD_U32 2016-02-27 07:42:09 +01:00
Max Kellermann d1be643c0d pcm/PcmDsd: add converter from DSD_U8 to DSD_U32 2016-02-27 07:41:58 +01:00
Max Kellermann f0f3017a76 pcm/export: move Open() parameters to struct Params 2016-02-26 18:55:27 +01:00
Max Kellermann d3f0b62348 pcm/export: another #ifdef ENABLE_DSD fix 2016-02-26 18:55:06 +01:00
Max Kellermann dcaf299864 pcm/export: add #ifdef ENABLE_DSD 2016-02-26 18:44:23 +01:00
Max Kellermann 1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann e56066f721 pcm/dsd: use PcmBuffer::GetT() 2016-02-26 17:41:18 +01:00
Max Kellermann 5e3844ac13 pcm/dsd: use MAX_CHANNELS 2016-02-26 17:41:06 +01:00
Max Kellermann cb4f5d454b pcm/dsd: use std::array 2016-02-26 17:38:46 +01:00
Max Kellermann 15e432204e pcm/Order: new library to convert from FLAC to ALSA channel order
This new library is integrated in the PcmExport class and (if enabled)
converts MPD's channel order (= FLAC channel order) to ALSA channel
order.

This fixes:
 http://bugs.musicpd.org/view.php?id=3147
and
 http://bugs.musicpd.org/view.php?id=3255
2015-10-27 11:44:23 +01:00
Max Kellermann b4fc2e38ab pcm/Interleave: add stereo optimization 2015-06-22 17:27:29 +02:00
Max Kellermann 16639f9d71 pcm/Interleave: instantiate a 16 bit optimization 2015-06-22 17:20:37 +02:00
Max Kellermann 22f2605e25 pcm/Interleave: convert PcmInterleave32() to template 2015-06-22 17:19:42 +02:00
Max Kellermann 69476b4f21 pcm/Interleave: add optimization for 32 bit samples
Move code from the "vorbis" decoder.
2015-06-22 16:32:06 +02:00
Max Kellermann fdf92c5f3b pcm/Interleave: add "restrict" keywords 2015-06-22 16:32:06 +02:00
Max Kellermann eed1a3c239 decoder/ffmpeg: move code to pcm/Interleave.cxx 2015-06-22 14:42:19 +02:00
Max Kellermann 2b0a127fa5 pcm/soxr: fix recipe parser 2015-06-20 15:25:00 +02:00
Max Kellermann b31d171ae8 *: doxygen fixups 2015-03-17 11:21:43 +01:00
Max Kellermann 16944b5397 pcm/SoxrResampler: move quality recipe names to table 2015-01-25 10:01:50 +01:00
Max Kellermann 6cd5d73607 pcm/SoxrResampler: allow multi-threaded resampling 2015-01-22 11:37:18 +01:00
Max Kellermann 80a7e1ea7d pcm/SoxrResampler: add a global soxr_runtime_spec_t variable 2015-01-22 11:37:09 +01:00
Max Kellermann 0d3b26b3aa Config: add section "resampler" 2015-01-22 11:04:28 +01:00
Max Kellermann 1c3f5517fa config/Option: convert to strictly-typed enum 2015-01-21 23:30:00 +01:00
Max Kellermann bcbfa560e9 pcm/SoxrResampler: use a global soxr_quality_spec_t variable 2015-01-21 19:59:50 +01:00
Max Kellermann 8b366f0795 pcm/SoxrResampler: soxr_parse_converter() returns unsigned long 2015-01-21 19:56:57 +01:00
Max Kellermann aa08f9692c pcm/SoxrResampler: add constant SOXR_DEFAULT_QUALITY 2015-01-21 19:56:36 +01:00
Max Kellermann 288ba84939 pcm/SoxrResampler: fix indent 2015-01-21 19:47:14 +01:00
Max Kellermann 712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann 412bedb697 Merge branch 'v0.19.x' 2014-12-26 14:40:32 +01:00
Max Kellermann 163597ef69 db/simple: fix implicit nullptr/bool conversion
Return false on error, not nullptr.
2014-12-26 14:34:03 +01:00
Max Kellermann b3f5b4932c configure.ac: add macro MPD_ENABLE_AUTO_PKG
Simplify the definition of many build options.
2014-11-21 22:19:57 +01:00
Max Kellermann 8d036c4b7c pcm/SoxrResampler: round output buffer size up
The old formula calculates the output buffer size with "regular"
rounding (to the nearest integer), however sometimes, that is
insufficient and the last sample cannot be resampled.  This causes
audible distortions.  By changing the formula to consider the worst
case (always round up), this problem is eliminated.
2014-11-10 22:52:17 +01:00
Max Kellermann 220f957cd8 pcm/ChannelsConverter: fix variable used to generate error message
Use the "_format" parameter instead of the (uninitialized) "format"
attribute.
2014-10-23 22:44:53 +02:00
Max Kellermann 8ce48d83eb pcm/FormatConverter: move check to Open()
Report unsupported format while opening the filter, not later when the
first conversion takes place.
2014-10-23 22:42:08 +02:00
Max Kellermann 200cdb6b0a pcm/PcmConvert: assign {src,dest}_format at the end
Fixes assertion failure in destructor by not assigning
{src,dest}_format when an error occurs.
2014-10-23 22:39:51 +02:00
Max Kellermann d9fb40203a pcm/PcmConvert: make AudioFormat parameters "const" 2014-10-23 22:39:51 +02:00
Max Kellermann 3120958a17 pcm: --disable-dsd also disables the dsd2pcm library 2014-09-26 12:17:47 +02:00
Max Kellermann 052726ed50 PcmConvert: eliminate unused local variable "format" 2014-09-26 12:17:37 +02:00
Max Kellermann e5a28bfd8d output/alsa, pcm: rename "DSD over USB" to "DoP"
The standard has been renamed since the early draft that was
implemented in MPD.
2014-08-31 16:12:26 +02:00
Max Kellermann b373c53ce4 *: add missing Compiler.h includes
Necessary for "final" on gcc 4.6.
2014-08-30 00:46:52 +02:00
Max Kellermann 9e10b75f55 PcmExport: remove obsolete API documentation 2014-08-26 07:10:16 +02:00
Max Kellermann fa82264604 pcm/PcmDsd: remove "lsbfirst" support
Unused.  Bit reversing is done in the decoder.
2014-08-23 14:46:34 +02:00
Max Kellermann ae467aa42e pcm/dsd2pcm: add license headers
Obtained from the Mercurial repository at
https://code.google.com/p/dsd2pcm/
2014-08-23 14:42:23 +02:00
Max Kellermann 2722211ba3 pcm/SoxrResampler: add missing string.h include 2014-08-16 08:25:06 +02:00
Max Kellermann b44957ad91 PcmExport: add missing <iterator> include
For the range-based loop on a ConstBuffer object.
2014-08-13 13:00:37 +02:00
Max Kellermann 069895d26b PcmDsdUsb: use class ConstBuffer 2014-08-12 22:21:24 +02:00
Max Kellermann 0e756e4377 PcmExport: use class ConstBuffer 2014-08-12 22:19:53 +02:00
Max Kellermann 56f61a6d59 PcmConvert: Convert() returns ConstBuffer 2014-08-12 16:36:07 +02:00
Max Kellermann 37d6cc07a7 pcm: use nullptr instead of NULL 2014-07-30 18:44:20 +02:00
Max Kellermann 74a05a7f53 pcm/Neon: explicit rounding
Convert to 31 bit first, then right-shift with rounding to 16 bit.
2014-03-19 06:54:06 +01:00
Max Kellermann b55e1dcb5e pcm/Neon: make neon_x4_b() variadic 2014-03-16 09:30:50 +01:00
Max Kellermann 6f4775a8ee pcm/Neon: apply bit shift during float->int conversion
Avoid multiplication.  This is a speedup of 20%.
2014-03-16 09:05:30 +01:00
Max Kellermann 5696f91a1e pcm/PcmFormat: ARM NEON optimizations for float->s16
This is nearly 4 times faster than the "portable" algorithm.
2014-03-15 11:41:01 +01:00
Max Kellermann bb6ee71f08 pcm/PcmFormat: don't use WritableBuffer
The previous commit eliminated the need for that.
2014-03-14 23:23:16 +01:00
Max Kellermann 0d0642fd67 pcm/PcmFormat: instantiate FloatToInteger<S32>
.. instead of reusing FloatToInteger<S24> and converting from S24 to
S32 in-place.
2014-03-14 23:21:20 +01:00
Max Kellermann 08e6cf3dd2 pcm/PcmFormat: eliminate more duplicate code with templates
Refactor the conversion functions to classes and pass an instance to
the new function AllocateConvert().
2014-03-14 20:54:09 +01:00
Max Kellermann 044134eba0 pcm/PcmFormat: eliminate local variable "bits" 2014-03-14 20:53:22 +01:00
Max Kellermann 9fa6fa522e pcm/PcmFormat: remove obsolete AllocateFromFloat() overload 2014-03-14 20:53:14 +01:00
Max Kellermann 4ba7427fa0 util/{Const,Writable}Buffer: add operator[] 2014-03-01 07:49:13 +01:00
Max Kellermann 327cbf48f5 pcm/FallbackResampler: add missing ConstBuffer<T>::ToVoid() call 2014-02-06 23:48:01 +01:00
Max Kellermann 197b503f3e Config*: move to config/ 2014-01-24 00:20:01 +01:00
Chase Geigle 716bdc36fd pcm/SoxrResampler: Add configurable quality levels 2014-01-21 20:35:26 +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 bd01d80ffc pcm/Utils: remove unused function pcm_end_pointer() 2014-01-07 00:46:47 +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 c75339edcc pcm/Format: change parameters/return values to ConstBuffer 2014-01-06 23:08:49 +01:00
Max Kellermann b0b7244b3a pcm/Format: use number of samples instead of end pointer 2014-01-06 22:42:33 +01:00
Max Kellermann 92aa464edb pcm/Volume: remove unused function pcm_volume_dither() 2013-12-28 18:39:26 +01:00
Max Kellermann da29298d4d pcm/PcmMix: improved dithering
Use the existing PcmDither library.
2013-12-28 18:30:27 +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 394e2815db pcm/PcmDither: inline Dither24To16() and Dither32To16() 2013-12-28 18:30:13 +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 2a3a18a283 pcm/Traits: use 32 bit integer for S8 long_type
16 bit is not enough for volume calculations.
2013-12-25 12:28:18 +01:00
Max Kellermann 431c80f4f0 pcm/Dither: add API documentation 2013-12-24 23:45:38 +01:00
Max Kellermann 9ac18c39a1 pcm/Dither: move shift from DitherConvert() to Dither()
All callers need this shift, so let's move it to the basic method.
2013-12-24 23:39:29 +01:00
Max Kellermann d1b7473418 pcm/Dither: rename DitherShift() to DitherConvert() 2013-12-24 23:38:11 +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
Max Kellermann 2d1a3073f6 pcm/PcmConvert: move the Domain instance to Domain.cxx
Rename pcm_convert_domain to pcm_domain.  Move it out so we can use it
without depending on the whole PcmConvert library.
2013-12-23 10:35:19 +01:00
Max Kellermann 1543e529f1 pcm/Dither: convert remaining methods to templates
Use the SampleTraits template and let the compiler generate a special
case for S32 instead of reusing S24_P32.
2013-12-22 22:18:06 +01:00
Max Kellermann 4043f320fe pcm/Dither: generic sample dithering using template 2013-12-22 22:06:25 +01:00
Max Kellermann 32b834aa04 pcm/Traits: include stddef.h for size_t 2013-12-22 22:06:25 +01:00
Max Kellermann b43ec3d6f0 pcm/Traits: add MIN and MAX
Move from PcmClamp().
2013-12-22 21:32:25 +01:00
Max Kellermann 316a25dead pcm/Volume: add constant PCM_VOLUME_BITS 2013-12-22 21:31:17 +01:00
Max Kellermann bfe020e06c pcm/Volume: make PCM_VOLUME_1 a "constexpr" 2013-12-22 21:20:40 +01:00
Max Kellermann 5aae560683 pcm/Prng: make pcm_prng() inline 2013-12-22 21:20:38 +01:00
Max Kellermann 86e72ffefb util/Clamp: generic Clamp() function 2013-12-22 21:08:06 +01:00
Max Kellermann c6ef0e8887 pcm/Traits: add typedef "sum_type"
Allow 32 bit platforms to use 32 bit instead of 64 bit for summing 24
bit samples.
2013-12-02 11:48:10 +01:00
Max Kellermann f761d583b5 pcm/Traits: use int_leastX_t types 2013-12-02 11:47:17 +01:00
Max Kellermann cee1ac150e pcm/PcmChannels: implement fake N-to-M mapping
This is really just a mono mapper, but the important part is that this
library cannot fail anymore.
2013-12-02 11:42:19 +01:00
Max Kellermann 71b47ae3ef pcm/PcmChannels: use the SampleTraits library 2013-12-02 11:28:54 +01:00
Max Kellermann 36e3fda554 pcm/Traits: add template specialization for FLOAT 2013-12-02 11:26:38 +01:00
Max Kellermann 2b44a2c9bd pcm/PcmChannels: use struct ConstBuffer 2013-12-02 11:21:32 +01:00
Max Kellermann af3b454805 pcm/PcmBuffer: add typed method GetT() 2013-12-02 11:21:32 +01:00
Max Kellermann 3a0f3eaa50 pcm/PcmUtils: use the SampleTraits library 2013-12-02 11:21:32 +01:00
Max Kellermann 80eb8d9e26 pcm/PcmUtils: remove unused function PcmClampN() 2013-12-02 11:21:32 +01:00
Max Kellermann 30c4136c4d pcm/PcmVolume: use the SampleTraits library 2013-12-02 11:21:32 +01:00
Max Kellermann 83e4475021 pcm/PcmFormat: use SampleTraits::long_type in ConvertFromFloat() 2013-12-02 11:21:32 +01:00
Max Kellermann c071d6d9f6 pcm/PcmPrng: add "constexpr" 2013-12-02 11:21:32 +01:00
Max Kellermann 023482406f pcm/PcmMix: use the SampleTraits library for MixRamp 2013-12-01 22:49:50 +01:00
Max Kellermann 04ba40981f pcm/PcmMix: use the SampleTraits library 2013-12-01 22:44:16 +01:00
Max Kellermann fc10bdf24d pcm/SampleTraits: use 64 bit for S24 long_type 2013-12-01 22:44:16 +01:00
Max Kellermann 28ad79c97a pcm/Traits: add typedef long_type 2013-12-01 19:32:48 +01:00
Max Kellermann 7661ad6653 pcm/Traits: add API documentation 2013-12-01 19:32:00 +01:00
Max Kellermann e1436063ff pcm/PcmFormat: move generic definitions to Traits.hxx 2013-12-01 19:24:37 +01:00
Max Kellermann 3e11a28cd9 pcm/SoxrResampler: new resampler option using libsoxr 2013-12-01 19:13:39 +01:00
Max Kellermann 3ed80f3139 pcm/ConfiguredResampler: convert boolean flag to enum
Prepare for adding more resamplers.
2013-12-01 19:13:39 +01:00
Max Kellermann 5ba90cd8ea pcm/PcmResampler: convert to abstract interface
The PcmResampler interface is implemented by the two classes
FallbackPcmResampler and LibsampleratePcmResampler.  This prepares for
adding more resampler libraries.
2013-11-30 16:22:57 +01:00
Max Kellermann e9127523db pcm/PcmConvert: move code to new class GluePcmResampler 2013-11-30 14:10:31 +01:00
Max Kellermann 92004f2e7e pcm/PcmConvert: move code to new class PcmChannelsConverter 2013-11-30 13:22:25 +01:00
Max Kellermann 0eefc7a43c pcm/PcmConvert: move code to new class PcmFormatConverter 2013-11-30 13:08:55 +01:00
Max Kellermann 3a666702af pcm/PcmConvert: add AudioFormat parameters
Don't use src_format.  In the middle of Convert(), the current
AudioFormat has already been modified, it's now something in between
src_format and dest_format.  This simplifies keeping track of what
remains to be done.
2013-11-30 13:00:41 +01:00
Max Kellermann 3c0c939689 pcm/PcmConvert: use struct ConstBuffer internally 2013-11-29 22:48:23 +01:00
Max Kellermann 413f7c64e5 pcm/PcmDsd: use struct ConstBuffer 2013-11-29 22:06:14 +01:00
Max Kellermann abeebfe070 pcm/PcmDsd: make attributes private 2013-11-29 22:05:29 +01:00
Max Kellermann 1a002eb23d PcmConvert: add pcm_convert_global_init()
Wrapper for pcm_resample_global_init(), just in case other PCM
libraries need initialization, too.
2013-11-29 11:00:57 +01:00
Max Kellermann e504913b0f pcm: drop compatibility with libsamplerate older than 0.1.3
Remove compatibility code.
2013-11-28 20:48:02 +01:00
Max Kellermann a788b7e747 PcmConvert: fix src_format corruption when converting from DSD
Method PcmConvert::Convert() modifies the src_format variable.  This
used to be a parameter, however commit d2679f59c made it an attribute
instead.  The modification to src_format persisted, and the next call
would return garbage.
2013-11-28 18:43:33 +01:00
Max Kellermann f90abe9530 include cleanup using iwyu 2013-11-28 11:50:54 +01:00
Max Kellermann 99527051b5 Merge branch 'v0.18.x' 2013-11-23 18:45:02 +01:00
Max Kellermann fc7d5b055d PcmResampleLibsamplerate: clip 24 bit data
Using pcm_resample_lsr_32() for 24 bit samples works, but may cause 24
bit overflows.  This commit makes 24 bit a special case with explicit
clipping.
2013-11-22 23:27:56 +01:00
Max Kellermann 87c8953e8e PcmResample: un-inline Resample24() 2013-11-22 23:24:40 +01:00
Max Kellermann 45d27a52f1 PcmUtils: add function PcmClampN() 2013-11-22 23:24:40 +01:00
Max Kellermann d2679f59c5 PcmConvert: add methods Open(), Close()
Replaces Reset() and eliminates the AudioFormat parameters from the
Convert() method.
2013-11-13 21:06:33 +01:00
Max Kellermann 44ac84767e PcmResampleFallback: use PcmBuffer instead of PcmResampler
Lighter API.
2013-11-13 18:39:15 +01:00
Max Kellermann 8555b65c50 *: update copyright year to 2013 2013-10-30 23:37:06 +01:00
Max Kellermann 50dc98367c PcmMix: use negative value instead of NaN for addition
Avoid NaN to allow -ffast-math.
2013-10-30 17:23:49 +01:00
Max Kellermann 20597b3632 *: use nullptr instead of NULL 2013-10-28 23:58:17 +01:00
Max Kellermann 12e9b7eafa PcmFormat: move definitions to struct SampleTraits 2013-10-28 21:29:36 +01:00
Max Kellermann 222dc8a239 Util/ASCII: add StringEqualsCaseASCII() overload with length
Replaces GLib's g_ascii_strncasecmp().
2013-10-21 08:42:55 +02:00
Max Kellermann 5e26e2ab1d system/ByteOrder: new library for byte ordering / endianess
Replacing GLib macros.
2013-10-16 22:09:44 +02:00
Max Kellermann 6b2b5af344 util/byte_reverse: convert to C++ 2013-10-16 22:07:52 +02:00
Max Kellermann f32fbd9ed1 pcm_pack: convert to C++ 2013-10-16 22:07:43 +02:00
Max Kellermann dbd88e6aef Client, ...: remove unnecessary glib.h include 2013-10-15 22:51:09 +02:00
Max Kellermann 509f8dab89 Util/Macros: replacement for GLib's G_N_ELEMENTS() 2013-10-15 22:47:39 +02:00
Max Kellermann be2951b45f gcc.h: rename to Compiler.h 2013-10-15 09:21:59 +02:00
Max Kellermann 1dd1a705b5 gcc.h: major update
Copy the according file from another project (i.e. XCSoar).  This will
allow copying more code more easily.
2013-10-15 09:13:22 +02:00
Max Kellermann 060814daa8 Log: new logging library API
Prepare to migrate away from GLib.  Currently, we're still using GLib
as a backend.
2013-10-02 08:57:55 +02:00
Max Kellermann 26d92c80ed conf.h: remove obsolete header
Use only ConfigData.hxx in plugin sources to reduce header
dependencies.
2013-09-05 08:47:10 +02:00
Max Kellermann 29030b54c9 util/Error: new error passing library
Replaces GLib's GError.
2013-09-04 18:14:22 +02:00
Max Kellermann 44a0e21795 PcmBuffer: move code to new class ReusableBuffer
ReusableBuffer is more generic.
2013-08-07 18:51:21 +02:00
Max Kellermann 870cc1d928 add missing includes 2013-08-07 18:23:55 +02:00
Max Kellermann 85b77b81ca *: use gcc.h macros instead of GLib 2013-08-04 23:48:01 +02:00
Max Kellermann d1e7b4e381 audio_format: convert to C++ 2013-08-03 21:37:56 +02:00
Max Kellermann 67f591a9ce gcc.h: add macro gcc_unreachable() 2013-08-03 21:34:17 +02:00
Max Kellermann 105b431e4c PcmBuffer: reset size in Clear()
Fix for Mantis #3806.

"PcmBuffer::Clear clears the buffer but does not reset the size. If
Get is called on the same PcmBuffer later on with a size that is the
same as (or less than) it was before the call to Clear, the "else"
branch is taken and the memory of buffer (at the address of nullptr)
is poisoned instead of the necessary allocation being performed. A
memset or memcpy on the returned pointer (nullptr) causes a
segmentation fault."
2013-08-01 08:33:53 +02:00
Max Kellermann 28030d7edb include cleanup 2013-07-30 08:39:21 +02:00
Max Kellermann c75cb67c44 pcm_buffer: convert to C++ 2013-07-30 08:31:02 +02:00
Max Kellermann a9d2dc6144 pcm_resample: convert to C++ 2013-07-30 00:04:16 +02:00
Max Kellermann 46b9388bb0 PcmConvert: don't memset() in the constructor
This destroys data inside PcmDsd and other attributes.  It was once
necessary, but is not anymore.
2013-07-30 00:03:36 +02:00
Max Kellermann cac3c159bc pcm_dsd: convert to C++ 2013-07-29 07:56:40 +02:00
Max Kellermann 1729388634 pcm_export: convert to C++ 2013-04-09 01:31:05 +02:00
Max Kellermann c654c7630a pcm_*: move to src/pcm/ 2013-04-09 01:24:52 +02:00