summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/af.rst8
-rw-r--r--Makefile2
-rw-r--r--audio/filter/af.c4
-rw-r--r--audio/filter/af_drc.c (renamed from audio/filter/af_volnorm.c)36
4 files changed, 27 insertions, 23 deletions
diff --git a/DOCS/man/en/af.rst b/DOCS/man/en/af.rst
index aff84114d0..a47a63b8e2 100644
--- a/DOCS/man/en/af.rst
+++ b/DOCS/man/en/af.rst
@@ -428,8 +428,9 @@ extrastereo[=mul]
(average of both channels), with 1.0 sound will be unchanged, with
-1.0 left and right channels will be swapped.
-volnorm[=method:target]
- Maximizes the volume without distorting the sound.
+drc[=method:target]
+ Applies dynamic range compression. This maximizes the volume by compressing
+ the audio signal's dynamic range.
<method>
Sets the used method.
@@ -445,6 +446,9 @@ volnorm[=method:target]
Sets the target amplitude as a fraction of the maximum for the sample
type (default: 0.25).
+ *NOTE*: This filter can cause distortion with audio signals that have a
+ very large dynamic range.
+
ladspa=file:label[:controls...]
Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin. This
filter is reentrant, so multiple LADSPA plugins can be used at once.
diff --git a/Makefile b/Makefile
index 53f97951a1..91eda102b6 100644
--- a/Makefile
+++ b/Makefile
@@ -143,7 +143,7 @@ SOURCES = talloc.c \
audio/filter/af_surround.c \
audio/filter/af_sweep.c \
audio/filter/af_tools.c \
- audio/filter/af_volnorm.c \
+ audio/filter/af_drc.c \
audio/filter/af_volume.c \
audio/filter/filter.c \
audio/filter/window.c \
diff --git a/audio/filter/af.c b/audio/filter/af.c
index 8afedbcfe5..71f4c67b51 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -35,7 +35,7 @@ extern struct af_info af_info_pan;
extern struct af_info af_info_surround;
extern struct af_info af_info_sub;
extern struct af_info af_info_export;
-extern struct af_info af_info_volnorm;
+extern struct af_info af_info_drc;
extern struct af_info af_info_extrastereo;
extern struct af_info af_info_lavcac3enc;
extern struct af_info af_info_lavcresample;
@@ -62,7 +62,7 @@ static struct af_info* filter_list[]={
#ifdef HAVE_SYS_MMAN_H
&af_info_export,
#endif
- &af_info_volnorm,
+ &af_info_drc,
&af_info_extrastereo,
&af_info_lavcac3enc,
&af_info_lavcresample,
diff --git a/audio/filter/af_volnorm.c b/audio/filter/af_drc.c
index f49bbc185a..ba1e10c0a7 100644
--- a/audio/filter/af_volnorm.c
+++ b/audio/filter/af_drc.c
@@ -75,12 +75,12 @@ typedef struct af_volume_s
// "Ideal" level
float mid_s16;
float mid_float;
-}af_volnorm_t;
+}af_drc_t;
// Initialization and runtime control
static int control(struct af_instance* af, int cmd, void* arg)
{
- af_volnorm_t* s = (af_volnorm_t*)af->setup;
+ af_drc_t* s = (af_drc_t*)af->setup;
switch(cmd){
case AF_CONTROL_REINIT:
@@ -120,7 +120,7 @@ static void uninit(struct af_instance* af)
free(af->setup);
}
-static void method1_int16(af_volnorm_t *s, struct mp_audio *c)
+static void method1_int16(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
int16_t *data = (int16_t*)c->audio; // Audio data
@@ -162,7 +162,7 @@ static void method1_int16(af_volnorm_t *s, struct mp_audio *c)
s->lastavg = (1.0 - SMOOTH_LASTAVG) * s->lastavg + SMOOTH_LASTAVG * newavg;
}
-static void method1_float(af_volnorm_t *s, struct mp_audio *c)
+static void method1_float(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
float *data = (float*)c->audio; // Audio data
@@ -199,7 +199,7 @@ static void method1_float(af_volnorm_t *s, struct mp_audio *c)
s->lastavg = (1.0 - SMOOTH_LASTAVG) * s->lastavg + SMOOTH_LASTAVG * newavg;
}
-static void method2_int16(af_volnorm_t *s, struct mp_audio *c)
+static void method2_int16(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
int16_t *data = (int16_t*)c->audio; // Audio data
@@ -249,7 +249,7 @@ static void method2_int16(af_volnorm_t *s, struct mp_audio *c)
s->idx = (s->idx + 1) % NSAMPLES;
}
-static void method2_float(af_volnorm_t *s, struct mp_audio *c)
+static void method2_float(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
float *data = (float*)c->audio; // Audio data
@@ -298,7 +298,7 @@ static void method2_float(af_volnorm_t *s, struct mp_audio *c)
// Filter data through filter
static struct mp_audio* play(struct af_instance* af, struct mp_audio* data)
{
- af_volnorm_t *s = af->setup;
+ af_drc_t *s = af->setup;
if(af->data->format == (AF_FORMAT_S16_NE))
{
@@ -325,27 +325,27 @@ static int af_open(struct af_instance* af){
af->play=play;
af->mul=1;
af->data=calloc(1,sizeof(struct mp_audio));
- af->setup=calloc(1,sizeof(af_volnorm_t));
+ af->setup=calloc(1,sizeof(af_drc_t));
if(af->data == NULL || af->setup == NULL)
return AF_ERROR;
- ((af_volnorm_t*)af->setup)->mul = MUL_INIT;
- ((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 = DEFAULT_TARGET;
+ ((af_drc_t*)af->setup)->mul = MUL_INIT;
+ ((af_drc_t*)af->setup)->lastavg = ((float)SHRT_MAX) * DEFAULT_TARGET;
+ ((af_drc_t*)af->setup)->idx = 0;
+ ((af_drc_t*)af->setup)->mid_s16 = ((float)SHRT_MAX) * DEFAULT_TARGET;
+ ((af_drc_t*)af->setup)->mid_float = DEFAULT_TARGET;
for (i = 0; i < NSAMPLES; i++)
{
- ((af_volnorm_t*)af->setup)->mem[i].len = 0;
- ((af_volnorm_t*)af->setup)->mem[i].avg = 0;
+ ((af_drc_t*)af->setup)->mem[i].len = 0;
+ ((af_drc_t*)af->setup)->mem[i].avg = 0;
}
return AF_OK;
}
// Description of this filter
-struct af_info af_info_volnorm = {
- "Volume normalizer filter",
- "volnorm",
+struct af_info af_info_drc = {
+ "Dynamic range compression filter",
+ "drc",
"Alex Beregszaszi & Pierre Lombard",
"",
AF_FLAGS_NOT_REENTRANT,