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/opt.h"
22 #include "avfilter.h"
23 #include "internal.h"
24 #include "audio.h"
25 
26 typedef struct LFOContext {
27  double freq;
28  double offset;
29  int srate;
30  double amount;
31  double pwidth;
32  double phase;
33 } LFOContext;
34 
35 typedef struct SRContext {
36  double target;
37  double real;
38  double samples;
39  double last;
40 } SRContext;
41 
42 typedef struct ACrusherContext {
43  const AVClass *class;
44 
45  double level_in;
46  double level_out;
47  double bits;
48  double mix;
49  int mode;
50  double dc;
51  double idc;
52  double aa;
53  double samples;
54  int is_lfo;
55  double lforange;
56  double lforate;
57 
58  double sqr;
59  double aa1;
60  double coeff;
61  int round;
62  double sov;
63  double smin;
64  double sdiff;
65 
69 
70 #define OFFSET(x) offsetof(ACrusherContext, x)
71 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
72 
73 static const AVOption acrusher_options[] = {
74  { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
75  { "level_out","set level out", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
76  { "bits", "set bit reduction", OFFSET(bits), AV_OPT_TYPE_DOUBLE, {.dbl=8}, 1, 64, A },
77  { "mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, A },
78  { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, "mode" },
79  { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "mode" },
80  { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "mode" },
81  { "dc", "set DC", OFFSET(dc), AV_OPT_TYPE_DOUBLE, {.dbl=1}, .25, 4, A },
82  { "aa", "set anti-aliasing", OFFSET(aa), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, A },
83  { "samples", "set sample reduction", OFFSET(samples), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 250, A },
84  { "lfo", "enable LFO", OFFSET(is_lfo), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
85  { "lforange", "set LFO depth", OFFSET(lforange), AV_OPT_TYPE_DOUBLE, {.dbl=20}, 1, 250, A },
86  { "lforate", "set LFO rate", OFFSET(lforate), AV_OPT_TYPE_DOUBLE, {.dbl=.3}, .01, 200, A },
87  { NULL }
88 };
89 
90 AVFILTER_DEFINE_CLASS(acrusher);
91 
92 static double samplereduction(ACrusherContext *s, SRContext *sr, double in)
93 {
94  sr->samples++;
95  if (sr->samples >= s->round) {
96  sr->target += s->samples;
97  sr->real += s->round;
98  if (sr->target + s->samples >= sr->real + 1) {
99  sr->last = in;
100  sr->target = 0;
101  sr->real = 0;
102  }
103  sr->samples = 0;
104  }
105  return sr->last;
106 }
107 
108 static double add_dc(double s, double dc, double idc)
109 {
110  return s > 0 ? s * dc : s * idc;
111 }
112 
113 static double remove_dc(double s, double dc, double idc)
114 {
115  return s > 0 ? s * idc : s * dc;
116 }
117 
118 static inline double factor(double y, double k, double aa1, double aa)
119 {
120  return 0.5 * (sin(M_PI * (fabs(y - k) - aa1) / aa - M_PI_2) + 1);
121 }
122 
123 static double bitreduction(ACrusherContext *s, double in)
124 {
125  const double sqr = s->sqr;
126  const double coeff = s->coeff;
127  const double aa = s->aa;
128  const double aa1 = s->aa1;
129  double y, k;
130 
131  // add dc
132  in = add_dc(in, s->dc, s->idc);
133 
134  // main rounding calculation depending on mode
135 
136  // the idea for anti-aliasing:
137  // you need a function f which brings you to the scale, where
138  // you want to round and the function f_b (with f(f_b)=id) which
139  // brings you back to your original scale.
140  //
141  // then you can use the logic below in the following way:
142  // y = f(in) and k = roundf(y)
143  // if (y > k + aa1)
144  // k = f_b(k) + ( f_b(k+1) - f_b(k) ) * 0.5 * (sin(x - PI/2) + 1)
145  // if (y < k + aa1)
146  // k = f_b(k) - ( f_b(k+1) - f_b(k) ) * 0.5 * (sin(x - PI/2) + 1)
147  //
148  // whereas x = (fabs(f(in) - k) - aa1) * PI / aa
149  // for both cases.
150 
151  switch (s->mode) {
152  case 0:
153  default:
154  // linear
155  y = in * coeff;
156  k = roundf(y);
157  if (k - aa1 <= y && y <= k + aa1) {
158  k /= coeff;
159  } else if (y > k + aa1) {
160  k = k / coeff + ((k + 1) / coeff - k / coeff) *
161  factor(y, k, aa1, aa);
162  } else {
163  k = k / coeff - (k / coeff - (k - 1) / coeff) *
164  factor(y, k, aa1, aa);
165  }
166  break;
167  case 1:
168  // logarithmic
169  y = sqr * log(fabs(in)) + sqr * sqr;
170  k = roundf(y);
171  if(!in) {
172  k = 0;
173  } else if (k - aa1 <= y && y <= k + aa1) {
174  k = in / fabs(in) * exp(k / sqr - sqr);
175  } else if (y > k + aa1) {
176  double x = exp(k / sqr - sqr);
177  k = FFSIGN(in) * (x + (exp((k + 1) / sqr - sqr) - x) *
178  factor(y, k, aa1, aa));
179  } else {
180  double x = exp(k / sqr - sqr);
181  k = in / fabs(in) * (x - (x - exp((k - 1) / sqr - sqr)) *
182  factor(y, k, aa1, aa));
183  }
184  break;
185  }
186 
187  // mix between dry and wet signal
188  k += (in - k) * s->mix;
189 
190  // remove dc
191  k = remove_dc(k, s->dc, s->idc);
192 
193  return k;
194 }
195 
196 static double lfo_get(LFOContext *lfo)
197 {
198  double phs = FFMIN(100., lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset);
199  double val;
200 
201  if (phs > 1)
202  phs = fmod(phs, 1.);
203 
204  val = sin((phs * 360.) * M_PI / 180);
205 
206  return val * lfo->amount;
207 }
208 
209 static void lfo_advance(LFOContext *lfo, unsigned count)
210 {
211  lfo->phase = fabs(lfo->phase + count * lfo->freq * (1. / lfo->srate));
212  if (lfo->phase >= 1.)
213  lfo->phase = fmod(lfo->phase, 1.);
214 }
215 
217 {
218  AVFilterContext *ctx = inlink->dst;
219  ACrusherContext *s = ctx->priv;
220  AVFilterLink *outlink = ctx->outputs[0];
221  AVFrame *out;
222  const double *src = (const double *)in->data[0];
223  double *dst;
224  const double level_in = s->level_in;
225  const double level_out = s->level_out;
226  const double mix = s->mix;
227  int n, c;
228 
229  if (av_frame_is_writable(in)) {
230  out = in;
231  } else {
233  if (!out) {
234  av_frame_free(&in);
235  return AVERROR(ENOMEM);
236  }
238  }
239 
240  dst = (double *)out->data[0];
241  for (n = 0; n < in->nb_samples; n++) {
242  if (s->is_lfo) {
243  s->samples = s->smin + s->sdiff * (lfo_get(&s->lfo) + 0.5);
244  s->round = round(s->samples);
245  }
246 
247  for (c = 0; c < inlink->channels; c++) {
248  double sample = src[c] * level_in;
249 
250  sample = mix * samplereduction(s, &s->sr[c], sample) + src[c] * (1. - mix) * level_in;
251  dst[c] = bitreduction(s, sample) * level_out;
252  }
253  src += c;
254  dst += c;
255 
256  if (s->is_lfo)
257  lfo_advance(&s->lfo, 1);
258  }
259 
260  if (in != out)
261  av_frame_free(&in);
262 
263  return ff_filter_frame(outlink, out);
264 }
265 
267 {
268  static const enum AVSampleFormat sample_fmts[] = {
271  };
272  int ret;
273 
275  if (ret < 0)
276  return ret;
277 
279  if (ret < 0)
280  return ret;
281 
283 }
284 
286 {
287  ACrusherContext *s = ctx->priv;
288 
289  av_freep(&s->sr);
290 }
291 
293 {
294  AVFilterContext *ctx = inlink->dst;
295  ACrusherContext *s = ctx->priv;
296  double rad, sunder, smax, sover;
297 
298  s->idc = 1. / s->dc;
299  s->coeff = exp2(s->bits) - 1;
300  s->sqr = sqrt(s->coeff / 2);
301  s->aa1 = (1. - s->aa) / 2.;
302  s->round = round(s->samples);
303  rad = s->lforange / 2.;
304  s->smin = FFMAX(s->samples - rad, 1.);
305  sunder = s->samples - rad - s->smin;
306  smax = FFMIN(s->samples + rad, 250.);
307  sover = s->samples + rad - smax;
308  smax -= sunder;
309  s->smin -= sover;
310  s->sdiff = smax - s->smin;
311 
312  s->lfo.freq = s->lforate;
313  s->lfo.pwidth = 1.;
314  s->lfo.srate = inlink->sample_rate;
315  s->lfo.amount = .5;
316 
317  if (!s->sr)
318  s->sr = av_calloc(inlink->channels, sizeof(*s->sr));
319  if (!s->sr)
320  return AVERROR(ENOMEM);
321 
322  return 0;
323 }
324 
325 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
326  char *res, int res_len, int flags)
327 {
328  AVFilterLink *inlink = ctx->inputs[0];
329  int ret;
330 
331  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
332  if (ret < 0)
333  return ret;
334 
335  return config_input(inlink);
336 }
337 
339  {
340  .name = "default",
341  .type = AVMEDIA_TYPE_AUDIO,
342  .config_props = config_input,
343  .filter_frame = filter_frame,
344  },
345 };
346 
348  {
349  .name = "default",
350  .type = AVMEDIA_TYPE_AUDIO,
351  },
352 };
353 
355  .name = "acrusher",
356  .description = NULL_IF_CONFIG_SMALL("Reduce audio bit resolution."),
357  .priv_size = sizeof(ACrusherContext),
358  .priv_class = &acrusher_class,
359  .uninit = uninit,
363  .process_command = process_command,
364 };
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:88
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:54
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_acrusher.c:266
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1019
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
factor
static double factor(double y, double k, double aa1, double aa)
Definition: af_acrusher.c:118
ACrusherContext::sov
double sov
Definition: af_acrusher.c:62
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:196
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:112
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
M_PI_2
#define M_PI_2
Definition: mathematics.h:55
AVOption
AVOption.
Definition: opt.h:247
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_acrusher.c:216
ACrusherContext::lforange
double lforange
Definition: af_acrusher.c:55
ff_set_common_all_samplerates
int ff_set_common_all_samplerates(AVFilterContext *ctx)
Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
Definition: formats.c:687
LFOContext::phase
double phase
Definition: af_acrusher.c:32
LFOContext::freq
double freq
Definition: af_acrusher.c:27
sqr
static double sqr(double in)
Definition: af_afwtdn.c:889
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
SRContext
Definition: af_acrusher.c:35
ACrusherContext::coeff
double coeff
Definition: af_acrusher.c:60
roundf
static av_always_inline av_const float roundf(float x)
Definition: libm.h:451
ACrusherContext::bits
double bits
Definition: af_acrusher.c:47
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:317
ACrusherContext::mix
double mix
Definition: af_acrusher.c:48
LFOContext::amount
double amount
Definition: af_acrusher.c:30
samplereduction
static double samplereduction(ACrusherContext *s, SRContext *sr, double in)
Definition: af_acrusher.c:92
FFSIGN
#define FFSIGN(a)
Definition: common.h:66
val
static double val(void *priv, double ch)
Definition: aeval.c:76
OFFSET
#define OFFSET(x)
Definition: af_acrusher.c:70
LFOContext::srate
int srate
Definition: af_acrusher.c:29
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
ff_af_acrusher
const AVFilter ff_af_acrusher
Definition: af_acrusher.c:354
av_cold
#define av_cold
Definition: attributes.h:90
ACrusherContext::sdiff
double sdiff
Definition: af_acrusher.c:64
ACrusherContext::mode
int mode
Definition: af_acrusher.c:49
s
#define s(width, name)
Definition: cbs_vp9.c:257
ACrusherContext::round
int round
Definition: af_acrusher.c:61
ACrusherContext
Definition: af_acrusher.c:42
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:226
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
lfo_advance
static void lfo_advance(LFOContext *lfo, unsigned count)
Definition: af_acrusher.c:209
bits
uint8_t bits
Definition: vp3data.h:141
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:703
ctx
AVFormatContext * ctx
Definition: movenc.c:48
ACrusherContext::lfo
LFOContext lfo
Definition: af_acrusher.c:66
LFOContext
Definition: af_acrusher.c:26
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:152
if
if(ret)
Definition: filter_design.txt:179
ACrusherContext::level_out
double level_out
Definition: af_acrusher.c:46
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
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:50
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:537
add_dc
static double add_dc(double s, double dc, double idc)
Definition: af_acrusher.c:108
SRContext::target
double target
Definition: af_acrusher.c:36
src
#define src
Definition: vp8dsp.c:255
ff_set_common_all_channel_counts
int ff_set_common_all_channel_counts(AVFilterContext *ctx)
Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
Definition: formats.c:669
exp
int8_t exp
Definition: eval.c:72
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
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_acrusher.c:285
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:117
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:325
avfilter_af_acrusher_inputs
static const AVFilterPad avfilter_af_acrusher_inputs[]
Definition: af_acrusher.c:338
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
sample
#define sample
Definition: flacdsp_template.c:44
SRContext::last
double last
Definition: af_acrusher.c:39
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:473
ACrusherContext::smin
double smin
Definition: af_acrusher.c:63
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:883
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(acrusher)
ACrusherContext::lforate
double lforate
Definition: af_acrusher.c:56
M_PI
#define M_PI
Definition: mathematics.h:52
internal.h
ACrusherContext::samples
double samples
Definition: af_acrusher.c:53
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:369
ACrusherContext::sqr
double sqr
Definition: af_acrusher.c:58
avfilter_af_acrusher_outputs
static const AVFilterPad avfilter_af_acrusher_outputs[]
Definition: af_acrusher.c:347
round
static av_always_inline av_const double round(double x)
Definition: libm.h:444
LFOContext::offset
double offset
Definition: af_acrusher.c:28
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
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:292
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
A
#define A
Definition: af_acrusher.c:71
AVFilter
Filter definition.
Definition: avfilter.h:149
ACrusherContext::aa1
double aa1
Definition: af_acrusher.c:59
ret
ret
Definition: filter_design.txt:187
acrusher_options
static const AVOption acrusher_options[]
Definition: af_acrusher.c:73
ACrusherContext::idc
double idc
Definition: af_acrusher.c:51
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Equivalent of av_mallocz_array().
Definition: mem.c:269
ACrusherContext::aa
double aa
Definition: af_acrusher.c:52
mode
mode
Definition: ebur128.h:83
ACrusherContext::is_lfo
int is_lfo
Definition: af_acrusher.c:54
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
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:346
audio.h
bitreduction
static double bitreduction(ACrusherContext *s, double in)
Definition: af_acrusher.c:123
LFOContext::pwidth
double pwidth
Definition: af_acrusher.c:31
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:153
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
remove_dc
static double remove_dc(double s, double dc, double idc)
Definition: af_acrusher.c:113
ACrusherContext::sr
SRContext * sr
Definition: af_acrusher.c:67
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:73
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
SRContext::samples
double samples
Definition: af_acrusher.c:38
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
ACrusherContext::level_in
double level_in
Definition: af_acrusher.c:45
SRContext::real
double real
Definition: af_acrusher.c:37