Commit e6690ce0 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_biquads: pass filter ctx to av_log calls

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent bd5c860f
...@@ -111,7 +111,7 @@ typedef struct { ...@@ -111,7 +111,7 @@ typedef struct {
ChanCache *cache; 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 *i1, double *i2, double *o1, double *o2,
double b0, double b1, double b2, double a1, double a2); double b0, double b1, double b2, double a1, double a2);
} BiquadsContext; } BiquadsContext;
...@@ -165,7 +165,8 @@ static int query_formats(AVFilterContext *ctx) ...@@ -165,7 +165,8 @@ static int query_formats(AVFilterContext *ctx)
} }
#define BIQUAD_FILTER(name, type, min, max, need_clipping) \ #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 *in1, double *in2, \
double *out1, double *out2, \ double *out1, double *out2, \
double b0, double b1, double b2, \ double b0, double b1, double b2, \
...@@ -185,10 +186,10 @@ static void biquad_## name (const void *input, void *output, int len, \ ...@@ -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; \ o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
i2 = ibuf[i]; \ i2 = ibuf[i]; \
if (need_clipping && o2 < min) { \ if (need_clipping && o2 < min) { \
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ av_log(ctx, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = min; \ obuf[i] = min; \
} else if (need_clipping && o2 > max) { \ } 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; \ obuf[i] = max; \
} else { \ } else { \
obuf[i] = o2; \ obuf[i] = o2; \
...@@ -197,10 +198,10 @@ static void biquad_## name (const void *input, void *output, int len, \ ...@@ -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; \ o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
i1 = ibuf[i]; \ i1 = ibuf[i]; \
if (need_clipping && o1 < min) { \ if (need_clipping && o1 < min) { \
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ av_log(ctx, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = min; \ obuf[i] = min; \
} else if (need_clipping && o1 > max) { \ } 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; \ obuf[i] = max; \
} else { \ } else { \
obuf[i] = o1; \ obuf[i] = o1; \
...@@ -213,10 +214,10 @@ static void biquad_## name (const void *input, void *output, int len, \ ...@@ -213,10 +214,10 @@ static void biquad_## name (const void *input, void *output, int len, \
o2 = o1; \ o2 = o1; \
o1 = o0; \ o1 = o0; \
if (need_clipping && o0 < min) { \ if (need_clipping && o0 < min) { \
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ av_log(ctx, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = min; \ obuf[i] = min; \
} else if (need_clipping && o0 > max) { \ } 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; \ obuf[i] = max; \
} else { \ } else { \
obuf[i] = o0; \ obuf[i] = o0; \
...@@ -391,8 +392,9 @@ static int config_output(AVFilterLink *outlink) ...@@ -391,8 +392,9 @@ static int config_output(AVFilterLink *outlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *buf) static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
{ {
BiquadsContext *s = inlink->dst->priv; AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = inlink->dst->outputs[0]; BiquadsContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
AVFrame *out_buf; AVFrame *out_buf;
int nb_samples = buf->nb_samples; int nb_samples = buf->nb_samples;
int ch; int ch;
...@@ -409,7 +411,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) ...@@ -409,7 +411,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
} }
for (ch = 0; ch < av_frame_get_channels(buf); ch++) 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, out_buf->extended_data[ch], nb_samples,
&s->cache[ch].i1, &s->cache[ch].i2, &s->cache[ch].i1, &s->cache[ch].i2,
&s->cache[ch].o1, &s->cache[ch].o2, &s->cache[ch].o1, &s->cache[ch].o2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment