comparison src/flac-1.2.1/include/share/replaygain_synthesis.h @ 1:05aa0afa9217

Bring in flac, ogg, vorbis
author Chris Cannam
date Tue, 19 Mar 2013 17:37:49 +0000
parents
children
comparison
equal deleted inserted replaced
0:c7265573341e 1:05aa0afa9217
1 /* replaygain_synthesis - Routines for applying ReplayGain to a signal
2 * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
20 #define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
21
22 #include <stdlib.h> /* for size_t */
23 #include "FLAC/ordinals.h"
24
25 #define FLAC_SHARE__MAX_SUPPORTED_CHANNELS 2
26
27 typedef enum {
28 NOISE_SHAPING_NONE = 0,
29 NOISE_SHAPING_LOW = 1,
30 NOISE_SHAPING_MEDIUM = 2,
31 NOISE_SHAPING_HIGH = 3
32 } NoiseShaping;
33
34 typedef struct {
35 const float* FilterCoeff;
36 FLAC__uint64 Mask;
37 double Add;
38 float Dither;
39 float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
40 float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
41 int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
42 unsigned LastHistoryIndex;
43 NoiseShaping ShapingType;
44 } DitherContext;
45
46 void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype);
47
48 /* scale = (float) pow(10., (double)replaygain * 0.05); */
49 size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
50
51 #endif