avfilter/af_compand: whitespace changes from af_compand_fork

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-02-26 11:41:36 +01:00
parent 5d166de258
commit 22307f170f

View File

@ -137,7 +137,6 @@ static void count_items(char *item_str, int *nb_items)
if (*p == ' ') if (*p == ' ')
(*nb_items)++; (*nb_items)++;
} }
} }
static void update_volume(ChanParam *cp, double in) static void update_volume(ChanParam *cp, double in)
@ -164,7 +163,6 @@ static double get_volume(CompandContext *s, double in_lin)
for (i = 1; i < s->nb_segments; i++) for (i = 1; i < s->nb_segments; i++)
if (in_log <= s->segments[i].x) if (in_log <= s->segments[i].x)
break; break;
cs = &s->segments[i - 1]; cs = &s->segments[i - 1];
in_log -= cs->x; in_log -= cs->x;
out_log = cs->y + in_log * (cs->a * in_log + cs->b); out_log = cs->y + in_log * (cs->a * in_log + cs->b);
@ -244,11 +242,14 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
} }
av_frame_copy_props(out_frame, frame); av_frame_copy_props(out_frame, frame);
out_frame->pts = s->pts; out_frame->pts = s->pts;
s->pts += av_rescale_q(nb_samples - i, (AVRational){1, inlink->sample_rate}, inlink->time_base); s->pts += av_rescale_q(nb_samples - i,
(AVRational){ 1, inlink->sample_rate },
inlink->time_base);
} }
dst = (double *)out_frame->extended_data[chan]; dst = (double *)out_frame->extended_data[chan];
dst[oindex++] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume), -1, 1); dst[oindex++] = av_clipd(dbuf[dindex] *
get_volume(s, cp->volume), -1, 1);
} else { } else {
count++; count++;
} }
@ -277,7 +278,8 @@ static int compand_drain(AVFilterLink *outlink)
if (!frame) if (!frame)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
frame->pts = s->pts; frame->pts = s->pts;
s->pts += av_rescale_q(frame->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base); s->pts += av_rescale_q(frame->nb_samples,
(AVRational){ 1, outlink->sample_rate }, outlink->time_base);
for (chan = 0; chan < channels; chan++) { for (chan = 0; chan < channels; chan++) {
double *dbuf = (double *)s->delayptrs[chan]; double *dbuf = (double *)s->delayptrs[chan];
@ -346,7 +348,9 @@ static int config_output(AVFilterLink *outlink)
nb_decays = new_nb_items; nb_decays = new_nb_items;
if (nb_attacks != nb_decays) { if (nb_attacks != nb_decays) {
av_log(ctx, AV_LOG_ERROR, "Number of attacks %d differs from number of decays %d.\n", nb_attacks, nb_decays); av_log(ctx, AV_LOG_ERROR,
"Number of attacks %d differs from number of decays %d.\n",
nb_attacks, nb_decays);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
@ -356,11 +360,13 @@ static int config_output(AVFilterLink *outlink)
char *tstr = av_strtok(p, " ", &saveptr); char *tstr = av_strtok(p, " ", &saveptr);
p = NULL; p = NULL;
if (sscanf(tstr, "%lf/%lf", &S(i).x, &S(i).y) != 2) { if (sscanf(tstr, "%lf/%lf", &S(i).x, &S(i).y) != 2) {
av_log(ctx, AV_LOG_ERROR, "Invalid and/or missing input/output value.\n"); av_log(ctx, AV_LOG_ERROR,
"Invalid and/or missing input/output value.\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (i && S(i - 1).x > S(i).x) { if (i && S(i - 1).x > S(i).x) {
av_log(ctx, AV_LOG_ERROR, "Transfer function input values must be increasing.\n"); av_log(ctx, AV_LOG_ERROR,
"Transfer function input values must be increasing.\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
S(i).y -= S(i).x; S(i).y -= S(i).x;
@ -511,9 +517,11 @@ static const AVFilterPad compand_outputs[] = {
{ NULL } { NULL }
}; };
AVFilter ff_af_compand = { AVFilter ff_af_compand = {
.name = "compand", .name = "compand",
.description = NULL_IF_CONFIG_SMALL("Compress or expand audio dynamic range."), .description = NULL_IF_CONFIG_SMALL(
"Compress or expand audio dynamic range."),
.query_formats = query_formats, .query_formats = query_formats,
.priv_size = sizeof(CompandContext), .priv_size = sizeof(CompandContext),
.priv_class = &compand_class, .priv_class = &compand_class,