From: Andre Noll Date: Sat, 1 Sep 2018 19:07:54 +0000 (+0200) Subject: compress: Overhaul the meaning of --aggressiveness. X-Git-Tag: v0.6.3~42^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=99f21f0b6ecf29f949cdbce285e241a2e3ef3093;hp=e0441a354b25f6fdd97480fe4e1f4f942347611f compress: Overhaul the meaning of --aggressiveness. Large values for the argument to --aggressiveless are next to useless because they correspond to gain factors which are much too large. The default value of four is already too large as it allows for a 16-fold volume amplification. This patch changes the meaning of the argument to be a multiplication rather than a shift. Admissible values are restricted to the range 0..10, which allows for fine-grained control over the maximal gain factor. The maximal gain factor is four, so the inertia argument must not exceed 14 to guarantee that no integer overflow can happen. --- diff --git a/compress_filter.c b/compress_filter.c index 0c76fd78..15bed6df 100644 --- a/compress_filter.c +++ b/compress_filter.c @@ -123,7 +123,7 @@ static void compress_open(struct filter_node *fn) fn->private_data = pcd; fn->min_iqs = 2; /* 16 bit audio */ pcd->current_gain = 1U << inertia; - pcd->max_gain = 1U << (inertia + aggressiveness); + pcd->max_gain = (1U << inertia) * (1.0 + 3.0 * aggressiveness / 10.0); } static void *compress_setup(const struct lls_parse_result *lpr) @@ -136,20 +136,15 @@ static void *compress_setup(const struct lls_parse_result *lpr) exit(EXIT_FAILURE); } val = U32_OPTVAL(AGGRESSIVENESS, lpr); - if (val == 0 || val > 15) { + if (val > 10) { PARA_EMERG_LOG("aggressiveness (%u) out of range\n", val); exit(EXIT_FAILURE); } val = U32_OPTVAL(INERTIA, lpr); - if (val == 0 || val > 15) { + if (val == 0 || val > 14) { PARA_EMERG_LOG("inertia (%u) out of range\n", val); exit(EXIT_FAILURE); } - val = U32_OPTVAL(AGGRESSIVENESS, lpr) + U32_OPTVAL(INERTIA, lpr); - if (val > 16) { - PARA_EMERG_LOG("inertia + aggressiveness (%u) > 16\n", val); - exit(EXIT_FAILURE); - } val = U32_OPTVAL(TARGET_LEVEL, lpr); if (val > 32767) { PARA_EMERG_LOG("target-level (%u) out of range\n", val); diff --git a/m4/lls/filter_cmd.suite.m4 b/m4/lls/filter_cmd.suite.m4 index dece6e6e..c026a628 100644 --- a/m4/lls/filter_cmd.suite.m4 +++ b/m4/lls/filter_cmd.suite.m4 @@ -35,25 +35,25 @@ caption = filters [/help] [option aggressiveness] short_opt = a - summary = controls the maximum amount to amplify by (1-15) + summary = controls the maximum amount to amplify by (0-10) typestr = bits arg_info = required_arg arg_type = uint32 default_val = 4 [help] - This caps the maximal gain factor to 2**bits. The sum of the arguments - to --aggressiveness and --inertia (see below) must not exceed 16. + This controls the maximal gain factor. Zero means to not amplify + at all while the value 10 corresponds to maximal gain factor which + results in a 4-fold increase in volume. [/help] [option inertia] short_opt = i - summary = how much inertia ramping has (1-15) + summary = how much inertia ramping has (1-14) typestr = bits arg_info = required_arg arg_type = uint32 default_val = 6 [help] - Larger values cause smaller volume adjustments. See --aggressiveness - above. + Larger values cause smaller volume adjustments. [/help] [option target-level] short_opt = t