Commit 0554a4ae authored by Earl Chew's avatar Earl Chew Committed by Erik de Castro Lopo
Browse files

Support 56kHz to 19.2kHz gain analysis (Patch v4)

This implementation uses decimation to generate an estimate of the
required ReplayGain adjustment for tracks sampled at high rates.

This approach avoids having to generate filters with commensurately more taps,
and also the subsequent effect on performance as these additional
taps are evaluated for high sample rate tracks.

Filter table entries with coefficients that are unchanged are
marked /* ORIGINAL */.

The remaining entries are new and have coefficient values obtained
from src/utils/loudness/loudness.sci. See:

Because these filter coefficients can be generated from a known source,
they are preferred to the FooBar2000 coefficients whose provenance is
Signed-off-by: default avatarEarl Chew <>
parent 774e0776
......@@ -47,8 +47,8 @@ typedef float Float_t; /* Type used for filtering */
extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
int InitGainAnalysis ( long samplefreq );
int ValidGainFrequency ( long samplefreq );
int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
int ResetSampleFrequency ( long samplefreq );
Float_t GetTitleGain ( void );
Float_t GetAlbumGain ( void );
......@@ -118,25 +118,7 @@ static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, c
FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency)
static const unsigned valid_sample_rates[] = {
static const unsigned n_valid_sample_rates = sizeof(valid_sample_rates) / sizeof(valid_sample_rates[0]);
unsigned i;
for(i = 0; i < n_valid_sample_rates; i++)
if(sample_frequency == valid_sample_rates[i])
return true;
return false;
return ValidGainFrequency( sample_frequency );
FLAC__bool grabbag__replaygain_init(unsigned sample_frequency)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment