1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/af_biquads: pass filter ctx to av_log calls

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2015-12-07 11:14:59 +01:00
parent bd5c860fdb
commit e6690ce02f

View File

@ -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,