2002-11-01 04:25:09 +00:00
|
|
|
/* plugin_common - Routines common to several plugins
|
2003-01-02 07:03:16 +00:00
|
|
|
* Copyright (C) 2002,2003 Josh Coalson
|
2002-11-01 04:25:09 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef FLAC__PLUGIN_COMMON__REPLAYGAIN_SYNTHESIS_H
|
|
|
|
|
#define FLAC__PLUGIN_COMMON__REPLAYGAIN_SYNTHESIS_H
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "FLAC/ordinals.h"
|
|
|
|
|
|
2003-02-27 06:12:55 +00:00
|
|
|
typedef enum {
|
|
|
|
|
NOISE_SHAPING_NONE = 0,
|
|
|
|
|
NOISE_SHAPING_LOW = 1,
|
|
|
|
|
NOISE_SHAPING_MEDUIM = 2,
|
|
|
|
|
NOISE_SHAPING_HIGH = 3
|
|
|
|
|
} NoiseShaping;
|
|
|
|
|
|
2002-11-01 04:25:09 +00:00
|
|
|
typedef struct {
|
|
|
|
|
const float* FilterCoeff;
|
|
|
|
|
FLAC__uint64 Mask;
|
|
|
|
|
double Add;
|
|
|
|
|
float Dither;
|
|
|
|
|
float ErrorHistory [FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
|
|
|
|
|
float DitherHistory [FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS] [16];
|
|
|
|
|
int LastRandomNumber [FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS];
|
2003-02-27 06:12:55 +00:00
|
|
|
unsigned LastHistoryIndex;
|
|
|
|
|
NoiseShaping ShapingType;
|
2002-11-01 04:25:09 +00:00
|
|
|
} DitherContext;
|
|
|
|
|
|
2002-11-21 09:00:25 +00:00
|
|
|
void FLAC__plugin_common__init_dither_context(DitherContext *dither, int bits, int shapingtype);
|
2002-11-01 04:25:09 +00:00
|
|
|
|
|
|
|
|
/* scale = (float) pow(10., (double)replaygain * 0.05); */
|
2003-09-15 20:28:08 +00:00
|
|
|
int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const float scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
|
2002-11-01 04:25:09 +00:00
|
|
|
|
|
|
|
|
#endif
|