Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -57,6 +57,7 @@ typedef struct AudioIIRContext { · 56 unmodified lines | ||
| 57 | 57 | const AVClass *class; |
| 58 | 58 | char *a_str, *b_str, *g_str; |
| 59 | 59 | double dry_gain, wet_gain; |
| 60 | + double mix; | |
| 60 | 61 | int format; |
| 61 | 62 | int process; |
| 62 | 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 | 125 | AudioIIRContext *s = ctx->priv; \ |
| 125 | 126 | const double ig = s->dry_gain; \ |
| 126 | 127 | const double og = s->wet_gain; \ |
| 128 | + const double mix = s->mix; \ | |
| 127 | 129 | ThreadData *td = arg; \ |
| 128 | 130 | AVFrame *in = td->in, *out = td->out; \ |
| 129 | 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 | 155 | oc[0] = sample; \ |
| 154 | 156 | sample *= og; \ |
| 157 | + sample = sample * mix + ic[0] * (1. - mix); \ | |
| 155 | 158 | if (need_clipping && sample < min) { \ |
| 156 | 159 | (*clippings)++; \ |
| 157 | 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 | 180 | AudioIIRContext *s = ctx->priv; \ |
| 178 | 181 | const double ig = s->dry_gain; \ |
| 179 | 182 | const double og = s->wet_gain; \ |
| 183 | + const double mix = s->mix; \ | |
| 180 | 184 | ThreadData *td = arg; \ |
| 181 | 185 | AVFrame *in = td->in, *out = td->out; \ |
| 182 | 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 | 211 | o1 = o0; \ |
| 208 | 212 | o0 *= og; \ |
| 209 | 213 | \ |
| 214 | + o0 = o0 * mix + (1. - mix) * sample; \ | |
| 210 | 215 | if (need_clipping && o0 < min) { \ |
| 211 | 216 | (*clippings)++; \ |
| 212 | 217 | dst[n] = min; \ |
| @@ -1074,6 +1079,7 @@ static const AVOption aiir_options[] = { · 861 unmodified lines | ||
| 1074 | 1079 | { "flt", "single-precision floating-point", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision" }, |
| 1075 | 1080 | { "i32", "32-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision" }, |
| 1076 | 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 | 1083 | { "response", "show IR frequency response", OFFSET(response), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF }, |
| 1078 | 1084 | { "channel", "set IR channel to display frequency response", OFFSET(ir_channel), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, VF }, |
| 1079 | 1085 | { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "hd720"}, 0, 0, VF }, |