summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-12-28 18:45:55 +0100
committerPaul B Mahol <onemda@gmail.com>2018-12-29 08:35:23 +0100
commit30bf54b9f3ac4684470a33014665f98641a33422 (patch)
tree815d399bfcccba6d0ca1d973b49504b0b85b6041 /libavfilter
parent8007e8fc67e3a36ad065415356aa057f01cd83b6 (diff)
avfilter/af_afir: introduce uninit_segment() and use it
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_afir.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index ca0c8811a4..dc32b92dc7 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -593,39 +593,44 @@ static int config_output(AVFilterLink *outlink)
return 0;
}
-static av_cold void uninit(AVFilterContext *ctx)
+static void uninit_segment(AVFilterContext *ctx, AudioFIRSegment *seg)
{
AudioFIRContext *s = ctx->priv;
- int ch;
- if (s->seg.coeff) {
- for (ch = 0; ch < s->nb_coef_channels; ch++) {
- av_freep(&s->seg.coeff[ch]);
+ if (seg->coeff) {
+ for (int ch = 0; ch < s->nb_coef_channels; ch++) {
+ av_freep(&seg->coeff[ch]);
}
}
- av_freep(&s->seg.coeff);
+ av_freep(&seg->coeff);
- if (s->seg.rdft) {
- for (ch = 0; ch < s->nb_channels; ch++) {
- av_rdft_end(s->seg.rdft[ch]);
+ if (seg->rdft) {
+ for (int ch = 0; ch < s->nb_channels; ch++) {
+ av_rdft_end(seg->rdft[ch]);
}
}
- av_freep(&s->seg.rdft);
+ av_freep(&seg->rdft);
- if (s->seg.irdft) {
- for (ch = 0; ch < s->nb_channels; ch++) {
- av_rdft_end(s->seg.irdft[ch]);
+ if (seg->irdft) {
+ for (int ch = 0; ch < s->nb_channels; ch++) {
+ av_rdft_end(seg->irdft[ch]);
}
}
- av_freep(&s->seg.irdft);
+ av_freep(&seg->irdft);
- av_frame_free(&s->in[1]);
+ av_frame_free(&seg->block);
+ av_frame_free(&seg->sum);
+ av_frame_free(&seg->buffer);
+}
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ AudioFIRContext *s = ctx->priv;
- av_frame_free(&s->seg.block);
- av_frame_free(&s->seg.sum);
- av_frame_free(&s->seg.buffer);
+ uninit_segment(ctx, &s->seg);
av_freep(&s->fdsp);
+ av_frame_free(&s->in[1]);
for (int i = 0; i < ctx->nb_outputs; i++)
av_freep(&ctx->output_pads[i].name);