FFmpeg
Loading...
Searching...
No Matches
af_volume.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Stefano Sabatini
3 * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * audio volume filter
25 */
26
28#include "libavutil/common.h"
29#include "libavutil/eval.h"
30#include "libavutil/ffmath.h"
31#include "libavutil/float_dsp.h"
32#include "libavutil/mem.h"
33#include "libavutil/opt.h"
35
36#include "audio.h"
37#include "avfilter.h"
38#include "filters.h"
39#include "formats.h"
40#include "af_volume.h"
41
42static const char * const precision_str[] = {
43 "fixed", "float", "double"
44};
45
46static const char *const var_names[] = {
47 "n", ///< frame number (starting at zero)
48 "nb_channels", ///< number of channels
49 "nb_consumed_samples", ///< number of samples consumed by the filter
50 "nb_samples", ///< number of samples in the current frame
51 "pts", ///< frame presentation timestamp
52 "sample_rate", ///< sample rate
53 "startpts", ///< PTS at start of stream
54 "startt", ///< time at start of stream
55 "t", ///< time in the file of the frame
56 "tb", ///< timebase
57 "volume", ///< last set value
58 NULL
59};
60
61#define OFFSET(x) offsetof(VolumeContext, x)
62#define A AV_OPT_FLAG_AUDIO_PARAM
63#define F AV_OPT_FLAG_FILTERING_PARAM
64#define T AV_OPT_FLAG_RUNTIME_PARAM
65
66static const AVOption volume_options[] = {
67 { "volume", "set volume adjustment expression",
68 OFFSET(volume_expr), AV_OPT_TYPE_STRING, { .str = "1.0" }, .flags = A|F|T },
69 { "precision", "select mathematical precision",
70 OFFSET(precision), AV_OPT_TYPE_INT, { .i64 = PRECISION_FLOAT }, PRECISION_FIXED, PRECISION_DOUBLE, A|F, .unit = "precision" },
71 { "fixed", "select 8-bit fixed-point", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_FIXED }, INT_MIN, INT_MAX, A|F, .unit = "precision" },
72 { "float", "select 32-bit floating-point", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_FLOAT }, INT_MIN, INT_MAX, A|F, .unit = "precision" },
73 { "double", "select 64-bit floating-point", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_DOUBLE }, INT_MIN, INT_MAX, A|F, .unit = "precision" },
74 { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_ONCE}, 0, EVAL_MODE_NB-1, .flags = A|F, .unit = "eval" },
75 { "once", "eval volume expression once", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_ONCE}, .flags = A|F, .unit = "eval" },
76 { "frame", "eval volume expression per-frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = A|F, .unit = "eval" },
77 { "replaygain", "Apply replaygain side data when present",
78 OFFSET(replaygain), AV_OPT_TYPE_INT, { .i64 = REPLAYGAIN_DROP }, REPLAYGAIN_DROP, REPLAYGAIN_ALBUM, A|F, .unit = "replaygain" },
79 { "drop", "replaygain side data is dropped", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_DROP }, 0, 0, A|F, .unit = "replaygain" },
80 { "ignore", "replaygain side data is ignored", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_IGNORE }, 0, 0, A|F, .unit = "replaygain" },
81 { "track", "track gain is preferred", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_TRACK }, 0, 0, A|F, .unit = "replaygain" },
82 { "album", "album gain is preferred", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_ALBUM }, 0, 0, A|F, .unit = "replaygain" },
83 { "replaygain_preamp", "Apply replaygain pre-amplification",
84 OFFSET(replaygain_preamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, -15.0, 15.0, A|F },
85 { "replaygain_noclip", "Apply replaygain clipping prevention",
86 OFFSET(replaygain_noclip), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, A|F },
87 { NULL }
88};
89
91
92static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)
93{
94 int ret;
95 AVExpr *old = NULL;
96
97 if (*pexpr)
98 old = *pexpr;
99 ret = av_expr_parse(pexpr, expr, var_names,
100 NULL, NULL, NULL, NULL, 0, log_ctx);
101 if (ret < 0) {
102 av_log(log_ctx, AV_LOG_ERROR,
103 "Error when evaluating the volume expression '%s'\n", expr);
104 *pexpr = old;
105 return ret;
106 }
107
108 av_expr_free(old);
109 return 0;
110}
111
113{
114 VolumeContext *vol = ctx->priv;
115
117 if (!vol->fdsp)
118 return AVERROR(ENOMEM);
119
120 return set_expr(&vol->volume_pexpr, vol->volume_expr, ctx);
121}
122
124{
125 VolumeContext *vol = ctx->priv;
127 av_freep(&vol->fdsp);
128}
129
131 AVFilterFormatsConfig **cfg_in,
132 AVFilterFormatsConfig **cfg_out)
133{
134 const VolumeContext *vol = ctx->priv;
135 static const enum AVSampleFormat sample_fmts[][7] = {
136 [PRECISION_FIXED] = {
144 },
145 [PRECISION_FLOAT] = {
149 },
150 [PRECISION_DOUBLE] = {
154 }
155 };
156 int ret;
157
158 ret = ff_set_sample_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts[vol->precision]);
159 if (ret < 0)
160 return ret;
161
162 return 0;
163}
164
165static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src,
166 int nb_samples, int volume)
167{
168 int i;
169 for (i = 0; i < nb_samples; i++)
170 dst[i] = av_clip_uint8(((((int64_t)src[i] - 128) * volume + 128) >> 8) + 128);
171}
172
173static inline void scale_samples_u8_small(uint8_t *dst, const uint8_t *src,
174 int nb_samples, int volume)
175{
176 int i;
177 for (i = 0; i < nb_samples; i++)
178 dst[i] = av_clip_uint8((((src[i] - 128) * volume + 128) >> 8) + 128);
179}
180
181static inline void scale_samples_s16(uint8_t *dst, const uint8_t *src,
182 int nb_samples, int volume)
183{
184 int i;
185 int16_t *smp_dst = (int16_t *)dst;
186 const int16_t *smp_src = (const int16_t *)src;
187 for (i = 0; i < nb_samples; i++)
188 smp_dst[i] = av_clip_int16(((int64_t)smp_src[i] * volume + 128) >> 8);
189}
190
191static inline void scale_samples_s16_small(uint8_t *dst, const uint8_t *src,
192 int nb_samples, int volume)
193{
194 int i;
195 int16_t *smp_dst = (int16_t *)dst;
196 const int16_t *smp_src = (const int16_t *)src;
197 for (i = 0; i < nb_samples; i++)
198 smp_dst[i] = av_clip_int16((smp_src[i] * volume + 128) >> 8);
199}
200
201static inline void scale_samples_s32(uint8_t *dst, const uint8_t *src,
202 int nb_samples, int volume)
203{
204 int i;
205 int32_t *smp_dst = (int32_t *)dst;
206 const int32_t *smp_src = (const int32_t *)src;
207 for (i = 0; i < nb_samples; i++)
208 smp_dst[i] = av_clipl_int32((((int64_t)smp_src[i] * volume + 128) >> 8));
209}
210
212{
213 vol->samples_align = 1;
214
215 switch (av_get_packed_sample_fmt(vol->sample_fmt)) {
216 case AV_SAMPLE_FMT_U8:
217 if (vol->volume_i < 0x1000000)
219 else
221 break;
223 if (vol->volume_i < 0x10000)
225 else
227 break;
230 break;
232 vol->samples_align = 4;
233 break;
235 vol->samples_align = 8;
236 break;
237 }
238
239#if ARCH_X86 && HAVE_X86ASM
241#endif
242}
243
245{
246 VolumeContext *vol = ctx->priv;
247
248 vol->volume = av_expr_eval(vol->volume_pexpr, vol->var_values, NULL);
249 if (isnan(vol->volume)) {
250 if (vol->eval_mode == EVAL_MODE_ONCE) {
251 av_log(ctx, AV_LOG_ERROR, "Invalid value NaN for volume\n");
252 return AVERROR(EINVAL);
253 } else {
254 av_log(ctx, AV_LOG_WARNING, "Invalid value NaN for volume, setting to 0\n");
255 vol->volume = 0;
256 }
257 }
258 vol->var_values[VAR_VOLUME] = vol->volume;
259
260 av_log(ctx, AV_LOG_VERBOSE, "n:%f t:%f pts:%f precision:%s ",
263
264 if (vol->precision == PRECISION_FIXED) {
265 vol->volume_i = (int)(vol->volume * 256 + 0.5);
266 vol->volume = vol->volume_i / 256.0;
267 av_log(ctx, AV_LOG_VERBOSE, "volume_i:%d/255 ", vol->volume_i);
268 }
269 av_log(ctx, AV_LOG_VERBOSE, "volume:%f volume_dB:%f\n",
270 vol->volume, 20.0*log10(vol->volume));
271
272 volume_init(vol);
273 return 0;
274}
275
276static int config_output(AVFilterLink *outlink)
277{
278 AVFilterContext *ctx = outlink->src;
279 VolumeContext *vol = ctx->priv;
280 AVFilterLink *inlink = ctx->inputs[0];
281
282 vol->sample_fmt = inlink->format;
283 vol->channels = inlink->ch_layout.nb_channels;
284 vol->planes = av_sample_fmt_is_planar(inlink->format) ? vol->channels : 1;
285
286 vol->var_values[VAR_N] =
289 vol->var_values[VAR_PTS] =
291 vol->var_values[VAR_STARTT] =
292 vol->var_values[VAR_T] =
293 vol->var_values[VAR_VOLUME] = NAN;
294
296 vol->var_values[VAR_TB] = av_q2d(inlink->time_base);
297 vol->var_values[VAR_SAMPLE_RATE] = inlink->sample_rate;
298
299 av_log(inlink->src, AV_LOG_VERBOSE, "tb:%f sample_rate:%f nb_channels:%f\n",
300 vol->var_values[VAR_TB],
303
304 return set_volume(ctx);
305}
306
307static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
308 char *res, int res_len, int flags)
309{
310 VolumeContext *vol = ctx->priv;
311 int ret = AVERROR(ENOSYS);
312
313 if (!strcmp(cmd, "volume")) {
314 if ((ret = set_expr(&vol->volume_pexpr, args, ctx)) < 0)
315 return ret;
316 if (vol->eval_mode == EVAL_MODE_ONCE)
318 }
319
320 return ret;
321}
322
323static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
324{
325 FilterLink *inl = ff_filter_link(inlink);
326 AVFilterContext *ctx = inlink->dst;
327 VolumeContext *vol = inlink->dst->priv;
328 AVFilterLink *outlink = inlink->dst->outputs[0];
329 int nb_samples = buf->nb_samples;
330 AVFrame *out_buf;
332 int ret;
333
334 if (sd && vol->replaygain != REPLAYGAIN_IGNORE) {
335 if (vol->replaygain != REPLAYGAIN_DROP) {
336 AVReplayGain *replaygain = (AVReplayGain*)sd->data;
337 int32_t gain = 100000;
338 uint32_t peak = 100000;
339 float g, p;
340
341 if (vol->replaygain == REPLAYGAIN_TRACK &&
342 replaygain->track_gain != INT32_MIN) {
343 gain = replaygain->track_gain;
344
345 if (replaygain->track_peak != 0)
346 peak = replaygain->track_peak;
347 } else if (replaygain->album_gain != INT32_MIN) {
348 gain = replaygain->album_gain;
349
350 if (replaygain->album_peak != 0)
351 peak = replaygain->album_peak;
352 } else {
353 av_log(inlink->dst, AV_LOG_WARNING, "Both ReplayGain gain "
354 "values are unknown.\n");
355 }
356 g = gain / 100000.0f;
357 p = peak / 100000.0f;
358
359 av_log(inlink->dst, AV_LOG_VERBOSE,
360 "Using gain %f dB from replaygain side data.\n", g);
361
362 vol->volume = ff_exp10((g + vol->replaygain_preamp) / 20);
363 if (vol->replaygain_noclip)
364 vol->volume = FFMIN(vol->volume, 1.0 / p);
365 vol->volume_i = (int)(vol->volume * 256 + 0.5);
366
367 volume_init(vol);
368 }
370 }
371
372 if (isnan(vol->var_values[VAR_STARTPTS])) {
373 vol->var_values[VAR_STARTPTS] = TS2D(buf->pts);
374 vol->var_values[VAR_STARTT ] = TS2T(buf->pts, inlink->time_base);
375 }
376 vol->var_values[VAR_PTS] = TS2D(buf->pts);
377 vol->var_values[VAR_T ] = TS2T(buf->pts, inlink->time_base);
378 vol->var_values[VAR_N ] = inl->frame_count_out;
379
380 if (vol->eval_mode == EVAL_MODE_FRAME)
382
383 if (vol->volume == 1.0 || vol->volume_i == 256) {
384 out_buf = buf;
385 goto end;
386 }
387
388 /* do volume scaling in-place if input buffer is writable */
389 if (av_frame_is_writable(buf)
390 && (vol->precision != PRECISION_FIXED || vol->volume_i > 0)) {
391 out_buf = buf;
392 } else {
393 out_buf = ff_get_audio_buffer(outlink, nb_samples);
394 if (!out_buf) {
395 av_frame_free(&buf);
396 return AVERROR(ENOMEM);
397 }
398 ret = av_frame_copy_props(out_buf, buf);
399 if (ret < 0) {
400 av_frame_free(&out_buf);
401 av_frame_free(&buf);
402 return ret;
403 }
404 }
405
406 if (vol->precision != PRECISION_FIXED || vol->volume_i > 0) {
407 int p, plane_samples;
408
410 plane_samples = FFALIGN(nb_samples, vol->samples_align);
411 else
412 plane_samples = FFALIGN(nb_samples * vol->channels, vol->samples_align);
413
414 if (vol->precision == PRECISION_FIXED) {
415 for (p = 0; p < vol->planes; p++) {
416 vol->scale_samples(out_buf->extended_data[p],
417 buf->extended_data[p], plane_samples,
418 vol->volume_i);
419 }
421 for (p = 0; p < vol->planes; p++) {
422 vol->fdsp->vector_fmul_scalar((float *)out_buf->extended_data[p],
423 (const float *)buf->extended_data[p],
424 vol->volume, plane_samples);
425 }
426 } else {
427 for (p = 0; p < vol->planes; p++) {
428 vol->fdsp->vector_dmul_scalar((double *)out_buf->extended_data[p],
429 (const double *)buf->extended_data[p],
430 vol->volume, plane_samples);
431 }
432 }
433 }
434
435 if (buf != out_buf)
436 av_frame_free(&buf);
437
438end:
440 return ff_filter_frame(outlink, out_buf);
441}
442
444 {
445 .name = "default",
446 .type = AVMEDIA_TYPE_AUDIO,
447 .filter_frame = filter_frame,
448 },
449};
450
452 {
453 .name = "default",
454 .type = AVMEDIA_TYPE_AUDIO,
455 .config_props = config_output,
456 },
457};
458
460 .p.name = "volume",
461 .p.description = NULL_IF_CONFIG_SMALL("Change input volume."),
462 .p.priv_class = &volume_class,
464 .priv_size = sizeof(VolumeContext),
465 .init = init,
466 .uninit = uninit,
470 .process_command = process_command,
471};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static enum AVSampleFormat sample_fmts[]
Definition adpcmenc.c:933
@ VAR_T
Definition aeval.c:53
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
@ VAR_NB_CHANNELS
Definition af_adrc.c:46
@ VAR_SAMPLE_RATE
Definition af_afftfilt.c:57
static void scale_samples_s32(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
Definition af_volume.c:201
static int set_volume(AVFilterContext *ctx)
Definition af_volume.c:244
static void scale_samples_s16(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
Definition af_volume.c:181
static av_cold void volume_init(VolumeContext *vol)
Definition af_volume.c:211
const FFFilter ff_af_volume
Definition af_volume.c:459
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition af_volume.c:323
static void scale_samples_s16_small(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
Definition af_volume.c:191
static void scale_samples_u8_small(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
Definition af_volume.c:173
static const AVFilterPad avfilter_af_volume_inputs[]
Definition af_volume.c:443
static const AVOption volume_options[]
Definition af_volume.c:66
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition af_volume.c:130
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition af_volume.c:307
static av_cold void uninit(AVFilterContext *ctx)
Definition af_volume.c:123
#define OFFSET(x)
Definition af_volume.c:61
static int config_output(AVFilterLink *outlink)
Definition af_volume.c:276
static void scale_samples_u8(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
Definition af_volume.c:165
static const char *const precision_str[]
Definition af_volume.c:42
static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)
Definition af_volume.c:92
static const AVFilterPad avfilter_af_volume_outputs[]
Definition af_volume.c:451
audio volume filter
@ PRECISION_FLOAT
Definition af_volume.h:35
@ PRECISION_FIXED
Definition af_volume.h:34
@ PRECISION_DOUBLE
Definition af_volume.h:36
@ VAR_NB_SAMPLES
Definition af_volume.h:49
@ VAR_NB_CONSUMED_SAMPLES
Definition af_volume.h:48
@ VAR_VOLUME
Definition af_volume.h:56
@ VAR_STARTT
Definition af_volume.h:53
@ EVAL_MODE_NB
Definition af_volume.h:42
@ EVAL_MODE_FRAME
Definition af_volume.h:41
@ EVAL_MODE_ONCE
Definition af_volume.h:40
void ff_volume_init_x86(VolumeContext *vol)
@ REPLAYGAIN_IGNORE
Definition af_volume.h:62
@ REPLAYGAIN_TRACK
Definition af_volume.h:63
@ REPLAYGAIN_DROP
Definition af_volume.h:61
@ REPLAYGAIN_ALBUM
Definition af_volume.h:64
static AVFormatContext * ctx
#define T(x)
Definition vpx_arith.h:29
#define A(x)
Definition vpx_arith.h:28
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition audio.c:74
int32_t
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
Main libavfilter public API header.
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
Public libavutil channel layout APIs header.
common internal and external API header
#define av_clipl_int32
Definition common.h:118
#define av_clip_int16
Definition common.h:115
#define av_clip_uint8
Definition common.h:106
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
#define F(x)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition eval.c:368
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition eval.c:824
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition eval.c:735
simple arithmetic expression evaluator
internal math functions header
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
Definition ffmath.h:42
int ff_set_sample_formats_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const enum AVSampleFormat *fmts)
Definition formats.c:1154
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition avfilter.h:196
#define AVERROR(e)
Definition error.h:45
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition frame.c:659
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
Definition frame.c:725
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition frame.c:535
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
@ AV_FRAME_DATA_REPLAYGAIN
ReplayGain information in the form of the AVReplayGain struct.
Definition frame.h:77
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition samplefmt.c:114
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
Definition samplefmt.c:77
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition samplefmt.h:64
@ AV_SAMPLE_FMT_FLT
float
Definition samplefmt.h:60
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition samplefmt.h:63
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition samplefmt.h:65
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition samplefmt.h:59
@ AV_SAMPLE_FMT_NONE
Definition samplefmt.h:56
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition samplefmt.h:57
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition samplefmt.h:67
@ AV_SAMPLE_FMT_DBL
double
Definition samplefmt.h:61
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define TS2D(ts)
Definition filters.h:482
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define TS2T(ts, tb)
Definition filters.h:483
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define av_cold
Definition attributes.h:117
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
Definition float_dsp.c:135
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define isnan(x)
Definition libm.h:342
#define FFMIN(a, b)
Definition macros.h:49
#define FFALIGN(x, a)
Definition macros.h:78
#define NAN
Memory handling functions.
@ VAR_STARTPTS
Definition noise.c:52
@ VAR_PTS
Definition noise.c:49
@ VAR_TB
Definition noise.c:48
@ VAR_N
Definition noise.c:47
static const char *const var_names[]
Definition noise.c:30
AVOptions.
int nb_channels
Number of channels in this layout.
Definition eval.c:171
An instance of a filter.
Definition avfilter.h:273
void * priv
private data for use by the filter
Definition avfilter.h:288
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:285
Lists of formats / etc.
Definition avfilter.h:120
A filter pad used for either input or output.
Definition filters.h:40
void(* vector_dmul_scalar)(double *dst, const double *src, double mul, int len)
Multiply a vector of double by a scalar double.
Definition float_dsp.h:100
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
Definition float_dsp.h:85
Structure to hold side data for an AVFrame.
Definition frame.h:327
uint8_t * data
Definition frame.h:329
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int nb_samples
number of audio samples (per channel) described by this frame
Definition frame.h:552
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition frame.h:559
uint8_t ** extended_data
pointers to the data planes/channels.
Definition frame.h:533
AVOption.
Definition opt.h:428
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1....
Definition replaygain.h:29
uint32_t track_peak
Peak track amplitude, with 100000 representing full scale (but values may overflow).
Definition replaygain.h:39
uint32_t album_peak
Same as track_peak, but for the whole album,.
Definition replaygain.h:47
int32_t track_gain
Track replay gain in microbels (divide by 100000 to get the value in dB).
Definition replaygain.h:34
int32_t album_gain
Same as track_gain, but for the whole album.
Definition replaygain.h:43
int samples_align
Definition af_volume.h:87
enum AVSampleFormat sample_fmt
Definition af_volume.h:83
const char * volume_expr
Definition af_volume.h:72
double volume
Definition af_volume.h:79
AVFloatDSPContext * fdsp
Definition af_volume.h:69
double replaygain_preamp
Definition af_volume.h:77
double var_values[VAR_VARS_NB]
Definition af_volume.h:74
int replaygain_noclip
Definition af_volume.h:78
AVExpr * volume_pexpr
Definition af_volume.h:73
void(* scale_samples)(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
Definition af_volume.h:85
#define av_freep(p)
#define av_log(a,...)
#define src
Definition vp8dsp.c:248
const char * g
Definition vf_curves.c:128