mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
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:
http://lists.xiph.org/pipermail/flac-dev/2012-February/003220.html
Because these filter coefficients can be generated from a known source,
they are preferred to the FooBar2000 coefficients whose provenance is
unknown.
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
/*
|
|
* ReplayGainAnalysis - analyzes input samples and give the recommended dB change
|
|
* Copyright (C) 2001 David Robinson and Glen Sawyer
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* concept and filter values by David Robinson (David@Robinson.org)
|
|
* -- blame him if you think the idea is flawed
|
|
* coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
|
|
* -- blame him if you think this runs too slowly, or the coding is otherwise flawed
|
|
* minor cosmetic tweaks to integrate with FLAC by Josh Coalson
|
|
*
|
|
* For an explanation of the concepts and the basic algorithms involved, go to:
|
|
* http://www.replaygain.org/
|
|
*/
|
|
|
|
#ifndef GAIN_ANALYSIS_H
|
|
#define GAIN_ANALYSIS_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#define GAIN_NOT_ENOUGH_SAMPLES -24601
|
|
#define GAIN_ANALYSIS_ERROR 0
|
|
#define GAIN_ANALYSIS_OK 1
|
|
|
|
#define INIT_GAIN_ANALYSIS_ERROR 0
|
|
#define INIT_GAIN_ANALYSIS_OK 1
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
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 );
|
|
Float_t GetTitleGain ( void );
|
|
Float_t GetAlbumGain ( void );
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* GAIN_ANALYSIS_H */
|