FFmpeg
af_acrusher.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) Markus Schmidt and Christian Holschuh
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/mem.h"
22 #include "libavutil/opt.h"
23 #include "avfilter.h"
24 #include "filters.h"
25 #include "audio.h"
26 
27 typedef struct LFOContext {
28  double freq;
29  double offset;
30  int srate;
31  double amount;
32  double pwidth;
33  double phase;
34 } LFOContext;
35 
36 typedef struct SRContext {
37  double target;
38  double real;
39  double samples;
40  double last;
41 } SRContext;
42 
43 typedef struct ACrusherContext {
44  const AVClass *class;
45 
46  double level_in;
47  double level_out;
48  double bits;
49  double mix;
50  int mode;
51  double dc;
52  double idc;
53  double aa;
54  double samples;
55  int is_lfo;
56  double lforange;
57  double lforate;
58 
59  double sqr;
60  double aa1;
61  double coeff;
62  int round;
63  double sov;
64  double smin;
65  double sdiff;
66 
70 
71 #define OFFSET(x) offsetof(ACrusherContext, x)
72 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
73 
74 static const AVOption acrusher_options[] = {
75  { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
76  { "level_out","set level out", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
77  { "bits", "set bit reduction", OFFSET(bits), AV_OPT_TYPE_DOUBLE, {.dbl=8}, 1, 64, A },
78  { "mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, A },
79  { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, .unit = "mode" },
80  { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, .unit = "mode" },
81  { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, .unit = "mode" },
82  { "dc", "set DC", OFFSET(dc), AV_OPT_TYPE_DOUBLE, {.dbl=1}, .25, 4, A },
83  { "aa", "set anti-aliasing", OFFSET(aa), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, A },
84  { "samples", "set sample reduction", OFFSET(samples), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 250, A },
85  { "lfo", "enable LFO", OFFSET(is_lfo), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
86  { "lforange", "set LFO depth", OFFSET(lforange), AV_OPT_TYPE_DOUBLE, {.dbl=20}, 1, 250, A },
87  { "lforate", "set LFO rate", OFFSET(lforate), AV_OPT_TYPE_DOUBLE, {.dbl=.3}, .01, 200, A },
88  { NULL }
89 };
90 
91 AVFILTER_DEFINE_CLASS(acrusher);
92 
93 static double samplereduction(ACrusherContext *s, SRContext *sr, double in)
94 {
95  sr->samples++;
96  if (sr->samples >= s->round) {
97  sr->target += s->samples;
98  sr->real += s->round;
99  if (sr->target + s->samples >= sr->real + 1) {
100  sr->last = in;
101  sr->target = 0;
102  sr->real = 0;
103  }
104  sr->samples = 0;
105  }
106  return sr->last;
107 }
108 
109 static double add_dc(double s, double dc, double idc)
110 {
111  return s > 0 ? s * dc : s * idc;
112 }
113 
114 static double remove_dc(double s, double dc, double idc)
115 {
116  return s > 0 ? s * idc : s * dc;
117 }
118 
119 static inline double factor(double y, double k, double aa1, double aa)
120 {
121  return 0.5 * (sin(M_PI * (fabs(y - k) - aa1) / aa - M_PI_2) + 1);
122 }
123 
124 static double bitreduction(ACrusherContext *s, double in)
125 {
126  const double sqr = s->sqr;
127  const double coeff = s->coeff;
128  const double aa = s->aa;
129  const double aa1 = s->aa1;
130  double y, k;
131 
132  // add dc
133  in = add_dc(in, s->dc, s->idc);
134 
135  // main rounding calculation depending on mode
136 
137  // the idea for anti-aliasing:
138  // you need a function f which brings you to the scale, where
139  // you want to round and the function f_b (with f(f_b)=id) which
140  // brings you back to your original scale.
141  //
142  // then you can use the logic below in the following way:
143  // y = f(in) and k = roundf(y)
144  // if (y > k + aa1)
145  // k = f_b(k) + ( f_b(k+1) - f_b(k) ) * 0.5 * (sin(x - PI/2) + 1)
146  // if (y < k + aa1)
147  // k = f_b(k) - ( f_b(k+1) - f_b(k) ) * 0.5 * (sin(x - PI/2) + 1)
148  //
149  // whereas x = (fabs(f(in) - k) - aa1) * PI / aa
150  // for both cases.
151 
152  switch (s->mode) {
153  case 0:
154  default:
155  // linear
156  y = in * coeff;
157  k = roundf(y);
158  if (k - aa1 <= y && y <= k + aa1) {
159  k /= coeff;
160  } else if (y > k + aa1) {
161  k = k / coeff + ((k + 1) / coeff - k / coeff) *
162  factor(y, k, aa1, aa);
163  } else {
164  k = k / coeff - (k / coeff - (k - 1) / coeff) *
165  factor(y, k, aa1, aa);
166  }
167  break;
168  case 1:
169  // logarithmic
170  y = sqr * log(fabs(in)) + sqr * sqr;
171  k = roundf(y);
172  if(!in) {
173  k = 0;
174  } else if (k - aa1 <= y && y <= k + aa1) {
175  k = in / fabs(in) * exp(k / sqr - sqr);
176  } else if (y > k + aa1) {
177  double x = exp(k / sqr - sqr);
178  k = FFSIGN(in) * (x + (exp((k + 1) / sqr - sqr) - x) *
179  factor(y, k, aa1, aa));
180  } else {
181  double x = exp(k / sqr - sqr);
182  k = in / fabs(in) * (x - (x - exp((k - 1) / sqr - sqr)) *
183  factor(y, k, aa1, aa));
184  }
185  break;
186  }
187 
188  // mix between dry and wet signal
189  k += (in - k) * s->mix;
190 
191  // remove dc
192  k = remove_dc(k, s->dc, s->idc);
193 
194  return k;
195 }
196 
197 static double lfo_get(LFOContext *lfo)
198 {
199  double phs = FFMIN(100., lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset);
200  double val;
201 
202  if (phs > 1)
203  phs = fmod(phs, 1.);
204 
205  val = sin((phs * 360.) * M_PI / 180);
206 
207  return val * lfo->amount;
208 }
209 
210 static void lfo_advance(LFOContext *lfo, unsigned count)
211 {
212  lfo->phase = fabs(lfo->phase + count * lfo->freq * (1. / lfo->srate));
213  if (lfo->phase >= 1.)
214  lfo->phase = fmod(lfo->phase, 1.);
215 }
216 
218 {
219  AVFilterContext *ctx = inlink->dst;
220  ACrusherContext *s = ctx->priv;
221  AVFilterLink *outlink = ctx->outputs[0];
222  AVFrame *out;
223  const double *src = (const double *)in->data[0];
224  double *dst;
225  const double level_in = s->level_in;
226  const double level_out = s->level_out;
227  const double mix = s->mix;
228  int n, c;
229 
230  if (av_frame_is_writable(in)) {
231  out = in;
232  } else {
234  if (!out) {
235  av_frame_free(&in);
236  return AVERROR(ENOMEM);
237  }
239  }
240 
241  dst = (double *)out->data[0];
242  for (n = 0; n < in->nb_samples; n++) {
243  if (s->is_lfo) {
244  s->samples = s->smin + s->sdiff * (lfo_get(&s->lfo) + 0.5);
245  s->round = round(s->samples);
246  }
247 
248  for (c = 0; c < inlink->ch_layout.nb_channels; c++) {
249  double sample = src[c] * level_in;
250 
251  sample = mix * samplereduction(s, &s->sr[c], sample) + src[c] * (1. - mix) * level_in;
252  dst[c] = ctx->is_disabled ? src[c] : bitreduction(s, sample) * level_out;
253  }
254  src += c;
255  dst += c;
256 
257  if (s->is_lfo)
258  lfo_advance(&s->lfo, 1);
259  }
260 
261  if (in != out)
262  av_frame_free(&in);
263 
264  return ff_filter_frame(outlink, out);
265 }
266 
268 {
269  ACrusherContext *s = ctx->priv;
270 
271  av_freep(&s->sr);
272 }
273 
275 {
276  AVFilterContext *ctx = inlink->dst;
277  ACrusherContext *s = ctx->priv;
278  double rad, sunder, smax, sover;
279 
280  s->idc = 1. / s->dc;
281  s->coeff = exp2(s->bits) - 1;
282  s->sqr = sqrt(s->coeff / 2);
283  s->aa1 = (1. - s->aa) / 2.;
284  s->round = round(s->samples);
285  rad = s->lforange / 2.;
286  s->smin = FFMAX(s->samples - rad, 1.);
287  sunder = s->samples - rad - s->smin;
288  smax = FFMIN(s->samples + rad, 250.);
289  sover = s->samples + rad - smax;
290  smax -= sunder;
291  s->smin -= sover;
292  s->sdiff = smax - s->smin;
293 
294  s->lfo.freq = s->lforate;
295  s->lfo.pwidth = 1.;
296  s->lfo.srate = inlink->sample_rate;
297  s->lfo.amount = .5;
298 
299  if (!s->sr)
300  s->sr = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->sr));
301  if (!s->sr)
302  return AVERROR(ENOMEM);
303 
304  return 0;
305 }
306 
307 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
308  char *res, int res_len, int flags)
309 {
310  AVFilterLink *inlink = ctx->inputs[0];
311  int ret;
312 
313  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
314  if (ret < 0)
315  return ret;
316 
317  return config_input(inlink);
318 }
319 
321  {
322  .name = "default",
323  .type = AVMEDIA_TYPE_AUDIO,
324  .config_props = config_input,
325  .filter_frame = filter_frame,
326  },
327 };
328 
330  .name = "acrusher",
331  .description = NULL_IF_CONFIG_SMALL("Reduce audio bit resolution."),
332  .priv_size = sizeof(ACrusherContext),
333  .priv_class = &acrusher_class,
334  .uninit = uninit,
338  .process_command = process_command,
340 };
ff_get_audio_buffer
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:98
mix
static int mix(int c0, int c1)
Definition: 4xm.c:716
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
out
FILE * out
Definition: movenc.c:55
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1062
factor
static double factor(double y, double k, double aa1, double aa)
Definition: af_acrusher.c:119
ACrusherContext::sov
double sov
Definition: af_acrusher.c:63
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
lfo_get
static double lfo_get(LFOContext *lfo)
Definition: af_acrusher.c:197
normalize.log
log
Definition: normalize.py:21
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:162
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
M_PI_2
#define M_PI_2
Definition: mathematics.h:73
AVOption
AVOption.
Definition: opt.h:429
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_acrusher.c:217
ACrusherContext::lforange
double lforange
Definition: af_acrusher.c:56
LFOContext::phase
double phase
Definition: af_acrusher.c:33
LFOContext::freq
double freq
Definition: af_acrusher.c:28
sqr
static double sqr(double in)
Definition: af_afwtdn.c:872
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
SRContext
Definition: af_acrusher.c:36
ACrusherContext::coeff
double coeff
Definition: af_acrusher.c:61
roundf
static av_always_inline av_const float roundf(float x)
Definition: libm.h:451
ACrusherContext::bits
double bits
Definition: af_acrusher.c:48
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
ACrusherContext::mix
double mix
Definition: af_acrusher.c:49
LFOContext::amount
double amount
Definition: af_acrusher.c:31
samplereduction
static double samplereduction(ACrusherContext *s, SRContext *sr, double in)
Definition: af_acrusher.c:93
FFSIGN
#define FFSIGN(a)
Definition: common.h:75
val
static double val(void *priv, double ch)
Definition: aeval.c:77
OFFSET
#define OFFSET(x)
Definition: af_acrusher.c:71
LFOContext::srate
int srate
Definition: af_acrusher.c:30
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
ff_af_acrusher
const AVFilter ff_af_acrusher
Definition: af_acrusher.c:329
av_cold
#define av_cold
Definition: attributes.h:90
ACrusherContext::sdiff
double sdiff
Definition: af_acrusher.c:65
ACrusherContext::mode
int mode
Definition: af_acrusher.c:50
s
#define s(width, name)
Definition: cbs_vp9.c:198
ACrusherContext::round
int round
Definition: af_acrusher.c:62
ACrusherContext
Definition: af_acrusher.c:43
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
lfo_advance
static void lfo_advance(LFOContext *lfo, unsigned count)
Definition: af_acrusher.c:210
bits
uint8_t bits
Definition: vp3data.h:128
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:49
ACrusherContext::lfo
LFOContext lfo
Definition: af_acrusher.c:67
LFOContext
Definition: af_acrusher.c:27
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
if
if(ret)
Definition: filter_design.txt:179
ACrusherContext::level_out
double level_out
Definition: af_acrusher.c:47
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
NULL
#define NULL
Definition: coverity.c:32
ACrusherContext::dc
double dc
Definition: af_acrusher.c:51
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:713
add_dc
static double add_dc(double s, double dc, double idc)
Definition: af_acrusher.c:109
SRContext::target
double target
Definition: af_acrusher.c:37
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:34
exp
int8_t exp
Definition: eval.c:73
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: filters.h:255
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_acrusher.c:267
dc
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff) *mv_scale Intra DC Prediction block[y][x] dc[1]
Definition: snow.txt:400
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:307
avfilter_af_acrusher_inputs
static const AVFilterPad avfilter_af_acrusher_inputs[]
Definition: af_acrusher.c:320
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
sample
#define sample
Definition: flacdsp_template.c:44
SRContext::last
double last
Definition: af_acrusher.c:40
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:649
ACrusherContext::smin
double smin
Definition: af_acrusher.c:64
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:901
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(acrusher)
ACrusherContext::lforate
double lforate
Definition: af_acrusher.c:57
M_PI
#define M_PI
Definition: mathematics.h:67
ACrusherContext::samples
double samples
Definition: af_acrusher.c:54
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:469
ACrusherContext::sqr
double sqr
Definition: af_acrusher.c:59
round
static av_always_inline av_const double round(double x)
Definition: libm.h:444
LFOContext::offset
double offset
Definition: af_acrusher.c:29
exp2
#define exp2(x)
Definition: libm.h:288
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_acrusher.c:274
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
A
#define A
Definition: af_acrusher.c:72
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:264
AVFilter
Filter definition.
Definition: avfilter.h:201
ACrusherContext::aa1
double aa1
Definition: af_acrusher.c:60
ret
ret
Definition: filter_design.txt:187
acrusher_options
static const AVOption acrusher_options[]
Definition: af_acrusher.c:74
ACrusherContext::idc
double idc
Definition: af_acrusher.c:52
ACrusherContext::aa
double aa
Definition: af_acrusher.c:53
mode
mode
Definition: ebur128.h:83
ACrusherContext::is_lfo
int is_lfo
Definition: af_acrusher.c:55
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
mem.h
audio.h
bitreduction
static double bitreduction(ACrusherContext *s, double in)
Definition: af_acrusher.c:124
LFOContext::pwidth
double pwidth
Definition: af_acrusher.c:32
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
remove_dc
static double remove_dc(double s, double dc, double idc)
Definition: af_acrusher.c:114
ACrusherContext::sr
SRContext * sr
Definition: af_acrusher.c:68
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:190
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:80
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
SRContext::samples
double samples
Definition: af_acrusher.c:39
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
src
#define src
Definition: vp8dsp.c:248
ACrusherContext::level_in
double level_in
Definition: af_acrusher.c:46
SRContext::real
double real
Definition: af_acrusher.c:38