]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - amp_filter.c
paraslash 0.7.3
[paraslash.git] / amp_filter.c
index f3d0d87d45f077d901d5f4cb98c20dc9a3099547..be69ad67a8d78d419f3147546785130e42c7b80b 100644 (file)
@@ -1,8 +1,4 @@
-/*
- * Copyright (C) 2009 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2009 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
 /** \file amp_filter.c Paraslash's amplify filter. */
 
@@ -33,21 +29,21 @@ static void amp_close(struct filter_node *fn)
 
 static void amp_open(struct filter_node *fn)
 {
-       struct private_amp_data *pad = para_calloc(sizeof(*pad));
+       struct private_amp_data *pad = zalloc(sizeof(*pad));
        unsigned given = FILTER_CMD_OPT_GIVEN(AMP, AMP, fn->lpr);
        uint32_t amp_arg = FILTER_CMD_OPT_UINT32_VAL(AMP, AMP, fn->lpr);
 
        fn->private_data = pad;
        fn->min_iqs = 2;
-       if (!given && stat_item_values[SI_AMPLIFICATION])
-               sscanf(stat_item_values[SI_AMPLIFICATION], "%u", &pad->amp);
+       if (!given && stat_item_values[SI_amplification])
+               sscanf(stat_item_values[SI_amplification], "%u", &pad->amp);
        else
                pad->amp = amp_arg;
        PARA_INFO_LOG("amplification: %u (scaling factor: %1.2f)\n",
                pad->amp, pad->amp / 64.0 + 1.0);
 }
 
-static int amp_post_select(__a_unused struct sched *s, void *context)
+static int amp_post_monitor(__a_unused struct sched *s, void *context)
 {
        struct filter_node *fn = context;
        struct private_amp_data *pad = fn->private_data;
@@ -71,14 +67,14 @@ next_buffer:
        in_bytes = btr_next_buffer(btrn, (char **)&in);
        len = in_bytes / 2;
        if (len == 0) { /* eof and in_bytes == 1 */
-               ret = -E_AMP_EOF;
+               ret = -E_EOF;
                goto err;
        }
 
        if (inplace)
                out = in;
        else
-               out = para_malloc(len * 2);
+               out = alloc(len * 2);
 
        for (i = 0; i < len; i++) {
                int x = (in[i] * factor) >> 6;
@@ -104,6 +100,6 @@ err:
 const struct filter lsg_filter_cmd_com_amp_user_data = {
        .open = amp_open,
        .close = amp_close,
-       .pre_select = generic_filter_pre_select,
-       .post_select = amp_post_select,
+       .pre_monitor = generic_filter_pre_monitor,
+       .post_monitor = amp_post_monitor,
 };