History

avfilter/af_aiir: implement mix option

Paul B Mahol committed 7 years ago

Commit 2a801e81 parent 034a9d22 files · +10 −0Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/af_aiir.c+6−0
@@ -57,6 +57,7 @@ typedef struct AudioIIRContext { · 56 unmodified lines
57 const AVClass *class;57 const AVClass *class;
58 char *a_str, *b_str, *g_str;58 char *a_str, *b_str, *g_str;
59 double dry_gain, wet_gain;59 double dry_gain, wet_gain;
60 double mix;
60 int format;61 int format;
61 int process;62 int process;
62 int precision;63 int precision;
@@ -124,6 +125,7 @@ static int iir_ch_## name(AVFilterContext *ctx, void *arg, int ch, int nb_jobs) · 61 unmodified lines
124 AudioIIRContext *s = ctx->priv; \125 AudioIIRContext *s = ctx->priv; \
125 const double ig = s->dry_gain; \126 const double ig = s->dry_gain; \
126 const double og = s->wet_gain; \127 const double og = s->wet_gain; \
128 const double mix = s->mix; \
127 ThreadData *td = arg; \129 ThreadData *td = arg; \
128 AVFrame *in = td->in, *out = td->out; \130 AVFrame *in = td->in, *out = td->out; \
129 const type *src = (const type *)in->extended_data[ch]; \131 const type *src = (const type *)in->extended_data[ch]; \
@@ -152,6 +154,7 @@ static int iir_ch_## name(AVFilterContext *ctx, void *arg, int ch, int nb_jobs) · 22 unmodified lines
152 \154 \
153 oc[0] = sample; \155 oc[0] = sample; \
154 sample *= og; \156 sample *= og; \
157 sample = sample * mix + ic[0] * (1. - mix); \
155 if (need_clipping && sample < min) { \158 if (need_clipping && sample < min) { \
156 (*clippings)++; \159 (*clippings)++; \
157 dst[n] = min; \160 dst[n] = min; \
@@ -177,6 +180,7 @@ static int iir_ch_serial_## name(AVFilterContext *ctx, void *arg, int ch, int nb · 19 unmodified lines
177 AudioIIRContext *s = ctx->priv; \180 AudioIIRContext *s = ctx->priv; \
178 const double ig = s->dry_gain; \181 const double ig = s->dry_gain; \
179 const double og = s->wet_gain; \182 const double og = s->wet_gain; \
183 const double mix = s->mix; \
180 ThreadData *td = arg; \184 ThreadData *td = arg; \
181 AVFrame *in = td->in, *out = td->out; \185 AVFrame *in = td->in, *out = td->out; \
182 const type *src = (const type *)in->extended_data[ch]; \186 const type *src = (const type *)in->extended_data[ch]; \
@@ -207,6 +211,7 @@ static int iir_ch_serial_## name(AVFilterContext *ctx, void *arg, int ch, int nb · 24 unmodified lines
207 o1 = o0; \211 o1 = o0; \
208 o0 *= og; \212 o0 *= og; \
209 \213 \
214 o0 = o0 * mix + (1. - mix) * sample; \
210 if (need_clipping && o0 < min) { \215 if (need_clipping && o0 < min) { \
211 (*clippings)++; \216 (*clippings)++; \
212 dst[n] = min; \217 dst[n] = min; \
@@ -1074,6 +1079,7 @@ static const AVOption aiir_options[] = { · 861 unmodified lines
1074 { "flt", "single-precision floating-point", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision" },1079 { "flt", "single-precision floating-point", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision" },
1075 { "i32", "32-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision" },1080 { "i32", "32-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision" },
1076 { "i16", "16-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision" },1081 { "i16", "16-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision" },
1082 { "mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, AF },
1077 { "response", "show IR frequency response", OFFSET(response), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },1083 { "response", "show IR frequency response", OFFSET(response), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
1078 { "channel", "set IR channel to display frequency response", OFFSET(ir_channel), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, VF },1084 { "channel", "set IR channel to display frequency response", OFFSET(ir_channel), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, VF },
1079 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "hd720"}, 0, 0, VF },1085 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "hd720"}, 0, 0, VF },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t