summaryrefslogtreecommitdiffstats
path: root/audio/filter
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2013-01-02 22:21:26 +0200
committerwm4 <wm4@nowhere>2013-01-13 13:26:07 +0100
commit3f7526d6417f41dd9a1a8640c2a34baf4290cbcc (patch)
treeaf70af6a62b71410156a52e9d77540006ccdf6cc /audio/filter
parente0d9ec60ad02e09d246e8de63f4dde7b11790032 (diff)
downloadmpv-3f7526d6417f41dd9a1a8640c2a34baf4290cbcc.tar.bz2
mpv-3f7526d6417f41dd9a1a8640c2a34baf4290cbcc.tar.xz
af_volnorm: fix output range with float input
af_volnorm can process either int16_t or float audio data. The float version used 0 to INT_MAX as full value range, when it should be 0 to 1. This effectively disabled the filter (due to all input being considered to fall in the silence range). Fix. Reported by Tobias Jacobi <liquid.acid@gmx.net>.
Diffstat (limited to 'audio/filter')
-rw-r--r--audio/filter/af_volnorm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/audio/filter/af_volnorm.c b/audio/filter/af_volnorm.c
index b4c204d305..f49bbc185a 100644
--- a/audio/filter/af_volnorm.c
+++ b/audio/filter/af_volnorm.c
@@ -51,7 +51,7 @@
// Silence level
// FIXME: should be relative to the level of the samples
#define SIL_S16 (SHRT_MAX * 0.01)
-#define SIL_FLOAT (INT_MAX * 0.01) // FIXME
+#define SIL_FLOAT 0.01
// smooth must be in ]0.0, 1.0[
#define SMOOTH_MUL 0.06
@@ -106,7 +106,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
return AF_ERROR;
s->method = i-1;
s->mid_s16 = ((float)SHRT_MAX) * target;
- s->mid_float = ((float)INT_MAX) * target;
+ s->mid_float = target;
return AF_OK;
}
}
@@ -333,7 +333,7 @@ static int af_open(struct af_instance* af){
((af_volnorm_t*)af->setup)->lastavg = ((float)SHRT_MAX) * DEFAULT_TARGET;
((af_volnorm_t*)af->setup)->idx = 0;
((af_volnorm_t*)af->setup)->mid_s16 = ((float)SHRT_MAX) * DEFAULT_TARGET;
- ((af_volnorm_t*)af->setup)->mid_float = ((float)INT_MAX) * DEFAULT_TARGET;
+ ((af_volnorm_t*)af->setup)->mid_float = DEFAULT_TARGET;
for (i = 0; i < NSAMPLES; i++)
{
((af_volnorm_t*)af->setup)->mem[i].len = 0;