diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-12-07 11:14:59 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-12-07 11:47:43 +0100 |
commit | e6690ce02f4aa8cf4abdf93f480f7b980a6e4b7a (patch) | |
tree | 5a5c7e8e2df5d7e1983d439dbf9a48eb84b31308 | |
parent | bd5c860fdbc33d19d2ff0f6d1f06de07c17560dd (diff) | |
download | ffmpeg-e6690ce02f4aa8cf4abdf93f480f7b980a6e4b7a.tar.gz |
avfilter/af_biquads: pass filter ctx to av_log calls
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavfilter/af_biquads.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index a6f9fbca0c..a6e34fd011 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -111,7 +111,7 @@ typedef struct { ChanCache *cache; - void (*filter)(const void *ibuf, void *obuf, int len, + void (*filter)(AVFilterContext *ctx, const void *ibuf, void *obuf, int len, double *i1, double *i2, double *o1, double *o2, double b0, double b1, double b2, double a1, double a2); } BiquadsContext; @@ -165,7 +165,8 @@ static int query_formats(AVFilterContext *ctx) } #define BIQUAD_FILTER(name, type, min, max, need_clipping) \ -static void biquad_## name (const void *input, void *output, int len, \ +static void biquad_## name (AVFilterContext *ctx, \ + const void *input, void *output, int len, \ double *in1, double *in2, \ double *out1, double *out2, \ double b0, double b1, double b2, \ @@ -185,10 +186,10 @@ static void biquad_## name (const void *input, void *output, int len, \ o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \ i2 = ibuf[i]; \ if (need_clipping && o2 < min) { \ - av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + av_log(ctx, AV_LOG_WARNING, "clipping\n"); \ obuf[i] = min; \ } else if (need_clipping && o2 > max) { \ - av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + av_log(ctx, AV_LOG_WARNING, "clipping\n"); \ obuf[i] = max; \ } else { \ obuf[i] = o2; \ @@ -197,10 +198,10 @@ static void biquad_## name (const void *input, void *output, int len, \ o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \ i1 = ibuf[i]; \ if (need_clipping && o1 < min) { \ - av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + av_log(ctx, AV_LOG_WARNING, "clipping\n"); \ obuf[i] = min; \ } else if (need_clipping && o1 > max) { \ - av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + av_log(ctx, AV_LOG_WARNING, "clipping\n"); \ obuf[i] = max; \ } else { \ obuf[i] = o1; \ @@ -213,10 +214,10 @@ static void biquad_## name (const void *input, void *output, int len, \ o2 = o1; \ o1 = o0; \ if (need_clipping && o0 < min) { \ - av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + av_log(ctx, AV_LOG_WARNING, "clipping\n"); \ obuf[i] = min; \ } else if (need_clipping && o0 > max) { \ - av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + av_log(ctx, AV_LOG_WARNING, "clipping\n"); \ obuf[i] = max; \ } else { \ obuf[i] = o0; \ @@ -391,8 +392,9 @@ static int config_output(AVFilterLink *outlink) static int filter_frame(AVFilterLink *inlink, AVFrame *buf) { - BiquadsContext *s = inlink->dst->priv; - AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterContext *ctx = inlink->dst; + BiquadsContext *s = ctx->priv; + AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out_buf; int nb_samples = buf->nb_samples; int ch; @@ -409,7 +411,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) } for (ch = 0; ch < av_frame_get_channels(buf); ch++) - s->filter(buf->extended_data[ch], + s->filter(ctx, buf->extended_data[ch], out_buf->extended_data[ch], nb_samples, &s->cache[ch].i1, &s->cache[ch].i2, &s->cache[ch].o1, &s->cache[ch].o2, |