From 37b5476037b14134c3335b101d38c8d4b16cd6bd Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Tue, 23 Aug 2022 11:19:18 +0200 Subject: [PATCH] Restore ExtendedChannelMap documentation --- decoder/LAVAudio/PostProcessor.cpp | 24 +++++++++++++++++++++++- decoder/LAVAudio/PostProcessor.h | 2 -- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/decoder/LAVAudio/PostProcessor.cpp b/decoder/LAVAudio/PostProcessor.cpp index 7aba0ae06..e57399ecf 100644 --- a/decoder/LAVAudio/PostProcessor.cpp +++ b/decoder/LAVAudio/PostProcessor.cpp @@ -126,7 +126,29 @@ static inline void Silence(BYTE *pBuffer, LAVAudioSampleFormat sfSampleFormat) // // Extended Channel Remapping Processor -// Same functionality as ChannelMapping, except that a factor can be applied to all PCM samples. +// +// This function can process a PCM buffer of any sample format, and remap the channels +// into any arbitrary layout and channel count. +// +// The samples are copied byte-by-byte, without any conversion or loss. +// +// The ExtendedChannelMap is assumed to always have at least uOutChannels valid entries. +// Its layout is in output format: +// Map[0] is the first output channel, and should contain the index in the source stream (or -1 for silence) +// Map[1] is the second output channel +// +// Source channels can be applied multiple times to the Destination, but multiple Source channels cannot be merged into one channel. +// Note that when copying one source channel into multiple destinations, you always want to reduce its volume. +// You can either do this in a second step, or use the factor documented below +// +// Examples: +// 5.1 Input Buffer, following map will extract the Center channel, and return it as Mono: +// uOutChannels == 1; map = {2} +// +// Mono Input Buffer, Convert to Stereo +// uOutChannels == 2; map = {0, 0} +// +// Additionally, a factor can be applied to all PCM samples // // For optimization, the factor cannot be freely specified. // Factors -1, 0, 1 are ignored. diff --git a/decoder/LAVAudio/PostProcessor.h b/decoder/LAVAudio/PostProcessor.h index 9b9a85125..c9d20ff71 100644 --- a/decoder/LAVAudio/PostProcessor.h +++ b/decoder/LAVAudio/PostProcessor.h @@ -21,8 +21,6 @@ struct BufferDetails; -typedef int ChannelMap[8]; - typedef struct ExtendedChannelMap_s { int idx;