39 "fixed",
"float",
"double"
42 #define OFFSET(x) offsetof(VolumeContext, x)
43 #define A AV_OPT_FLAG_AUDIO_PARAM
44 #define F AV_OPT_FLAG_FILTERING_PARAM
47 {
"volume",
"set volume adjustment",
49 {
"precision",
"select mathematical precision",
123 int nb_samples,
int volume)
126 for (i = 0; i < nb_samples; i++)
127 dst[i] = av_clip_uint8(((((int64_t)src[i] - 128) * volume + 128) >> 8) + 128);
131 int nb_samples,
int volume)
134 for (i = 0; i < nb_samples; i++)
135 dst[i] = av_clip_uint8((((src[i] - 128) * volume + 128) >> 8) + 128);
139 int nb_samples,
int volume)
142 int16_t *smp_dst = (int16_t *)dst;
143 const int16_t *smp_src = (
const int16_t *)src;
144 for (i = 0; i < nb_samples; i++)
145 smp_dst[i] = av_clip_int16(((int64_t)smp_src[i] * volume + 128) >> 8);
149 int nb_samples,
int volume)
152 int16_t *smp_dst = (int16_t *)dst;
153 const int16_t *smp_src = (
const int16_t *)src;
154 for (i = 0; i < nb_samples; i++)
155 smp_dst[i] = av_clip_int16((smp_src[i] * volume + 128) >> 8);
159 int nb_samples,
int volume)
164 for (i = 0; i < nb_samples; i++)
165 smp_dst[i] = av_clipl_int32((((int64_t)smp_src[i] * volume + 128) >> 8));
238 int p, plane_samples;
246 for (p = 0; p < vol->
planes; p++) {
252 for (p = 0; p < vol->
planes; p++) {
255 vol->
volume, plane_samples);
258 for (p = 0; p < vol->
planes; p++) {
261 vol->
volume, plane_samples);
295 .priv_class = &volume_class,
297 .
inputs = avfilter_af_volume_inputs,
298 .
outputs = avfilter_af_volume_outputs,