FFmpeg
Loading...
Searching...
No Matches
filters.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Niklas Haas
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 <math.h>
22#include <stdbool.h>
23
25#include <libavutil/avassert.h>
26#include <libavutil/mem.h>
27
28#include "filters.h"
29#include "swscale_internal.h"
30
31#ifdef _WIN32
32# define j1 _j1
33#endif
34
35/* Maximum (pre-stretching) radius (for tunable filters) */
36#define RADIUS_MAX 10.0
37
38/* Defined only on [0, radius]. */
39typedef double (*SwsFilterKernel)(double x, const double *params);
40
41typedef struct SwsFilterFunction {
42 double radius; /* negative means resizable */
44 SwsFilterKernel window; /* optional */
45 double params[SWS_NUM_SCALER_PARAMS]; /* default params */
47
49
50static double scaler_sample(const SwsFilterFunction *f, double x)
51{
52 x = fabs(x);
53 if (x > f->radius)
54 return 0.0;
55
56 double w = f->kernel(x, f->params);
57 if (f->window)
58 w *= f->window(x / f->radius, f->params);
59 return w;
60}
61
62/**
63 * Explanation of the 0.5 offsets: Normally, pixel samples are assumed
64 * to be representative of the center of their containing area; e.g. for
65 * a 2x2 image, the samples are located at {0.5, 1.5}^2. However, with
66 * integer indexing, we round sample positions down (0-based indexing).
67 * So the (0, 0) sample is actually located at (0.5, 0.5) and represents
68 * the entire square from (0,0) to (1,1). When normalizing between different
69 * image sizes, we therefore need to add/subtract off these 0.5 offsets.
70 */
71static double get_src_pos(int dst_pos, double ratio_inv, double offset)
72{
73 return (dst_pos + 0.5) * ratio_inv - 0.5 + offset;
74}
75
77 double radius, double ratio_inv, double stretch_inv,
78 int dst_pos, double *tmp)
79{
80 int *out = &f->weights[dst_pos * f->filter_size];
81 int *pos = &f->offsets[dst_pos];
82
83 const double src_pos = get_src_pos(dst_pos, ratio_inv, f->offset);
84 if (f->filter_size == 1) {
85 *pos = fmin(fmax(round(src_pos), 0.0), f->src_size - 1);
87 return;
88 }
89
90 /* First and last pixels that are actually within the filter envelope */
91 const int start = floor(src_pos - radius) + 1;
92 const int stop = ceil (src_pos + radius) - 1;
93 const int clamped = av_clip(start, 0, f->src_size - f->filter_size);
94 *pos = clamped;
95
96 /**
97 * Generate raw filter weights with maximum precision. Sum the positive
98 * and negative weights separately to avoid catastrophic cancellation. This
99 * summation order should already give the best precision because abs(w)
100 * is monotonically decreasing
101 */
102 const double base = stretch_inv * (clamped - src_pos);
103 double wsum_pos = 0.0, wsum_neg = 0.0;
104 for (int i = 0; i < f->filter_size; i++) {
105 /* Fold extra edge weights into the first/last weight in case the
106 * filter got truncated; loop over all needed samples */
107 int i0 = i, i1 = i;
108 if (i == 0)
109 i0 = start - clamped;
110 if (i == f->filter_size - 1)
111 i1 = stop - clamped;
112
113 double w = 0.0;
114 for (int k = i0; k <= i1; k++)
115 w += scaler_sample(fun, base + stretch_inv * k);
116
117 if (w >= 0)
118 wsum_pos += w;
119 else
120 wsum_neg += w;
121 tmp[i] = w;
122 }
123
124 const double wsum = wsum_pos + wsum_neg;
125 av_assert0(wsum > 0);
126
127 /* Generate correctly rounded filter weights with error diffusion */
128 double error = 0.0;
129 int sum_pos = 0, sum_neg = 0;
130 for (int i = 0; i < f->filter_size; i++) {
131 if (i == f->filter_size - 1) {
132 /* Ensure weights sum to exactly SWS_FILTER_SCALE */
133 out[i] = SWS_FILTER_SCALE - sum_pos - sum_neg;
134 } else {
135 const double w = tmp[i] / wsum + error;
136 out[i] = round(w * SWS_FILTER_SCALE);
138 }
139 if (out[i] >= 0)
140 sum_pos += out[i];
141 else
142 sum_neg += out[i];
143 }
144
145 if (sum_pos > f->sum_positive)
146 f->sum_positive = sum_pos;
147 if (sum_neg < f->sum_negative)
148 f->sum_negative = sum_neg;
149}
150
151static void sws_filter_free(AVRefStructOpaque opaque, void *obj)
152{
154 av_refstruct_unref(&filter->weights);
155 av_refstruct_unref(&filter->offsets);
156}
157
158static bool validate_params(const SwsFilterFunction *fun, SwsScaler scaler)
159{
160 switch (scaler) {
162 return fun->params[0] >= 0.0; /* sigma */
164 return fun->params[0] >= 1.0 && fun->params[0] <= RADIUS_MAX; /* radius */
166 return fun->params[0] >= 0.0 && fun->params[0] <= 1.0 /* B */ &&
167 fun->params[1] >= 0.0 && fun->params[1] <= 1.0 /* C */;
168 default:
169 return true;
170 }
171}
172
173/**
174 * Numerically estimate the last intersection between the function value
175 * and the cutoff domain [-SWS_MAX_REDUCE_CUTOFF, SWS_MAX_REDUCE_CUTOFF].
176 */
177static double est_filter_radius(const SwsFilterFunction *fun)
178{
179 const double bound = fun->radius;
180 const double step = 1e-2;
181
182 double radius = bound;
183 double prev = 0.0, fprev = 1.0; /* f(0) is always 1.0 */
184 double integral = 0.0;
185 for (double x = step; x < bound + step; x += step) {
186 const double fx = scaler_sample(fun, x);
187 integral += (fprev + fx) * step; /* trapezoidal rule (mirrored) */
188 double cutoff = SWS_MAX_REDUCE_CUTOFF * integral;
189 if ((fprev > cutoff && fx <= cutoff) || (fprev < -cutoff && fx >= -cutoff)) {
190 /* estimate crossing with secant method; note that we have to
191 * bias by the cutoff to find the actual cutoff radius */
192 double estimate = fx + (fx > fprev ? cutoff : -cutoff);
193 double root = x - estimate * (x - prev) / (fx - fprev);
194 radius = fmin(root, bound);
195 }
196 prev = x;
197 fprev = fx;
198 }
199
200 return radius;
201}
202
205{
206 SwsScaler scaler = params->scaler;
207 if (scaler >= SWS_SCALE_NB || params->src_size <= 0 || params->dst_size <= 0)
208 return AVERROR(EINVAL);
209
210 if (scaler == SWS_SCALE_AUTO)
211 scaler = SWS_SCALE_BICUBIC;
212
213 double virtual_size = params->virtual_size;
214 if (!virtual_size)
215 virtual_size = params->dst_size;
216
217 const double ratio = virtual_size / params->src_size;
218 const double ratio_inv = 1.0 / ratio;
219 double stretch = 1.0, stretch_inv = 1.0;
220 if (ratio < 1.0 && scaler != SWS_SCALE_POINT) {
221 /* Widen filter for downscaling (anti-aliasing) */
222 stretch = 1.0 / ratio;
223 stretch_inv = ratio;
224 }
225
227 if (!fun.kernel)
228 return AVERROR(EINVAL);
229
230 for (int i = 0; i < SWS_NUM_SCALER_PARAMS; i++) {
231 if (params->scaler_params[i] != SWS_PARAM_DEFAULT)
232 fun.params[i] = params->scaler_params[i];
233 }
234
235 if (!validate_params(&fun, scaler)) {
236 av_log(log, AV_LOG_ERROR, "Invalid parameters for scaler %s: {%f, %f}\n",
237 ff_sws_scaler_name(scaler), fun.params[0], fun.params[1]);
238 return AVERROR(EINVAL);
239 }
240
241 if (fun.radius < 0.0) /* tunable width kernels like lanczos */
242 fun.radius = fun.params[0];
243
244 double radius;
245 switch (scaler) {
246 case SWS_SCALE_POINT:
247 radius = 0.5;
248 break;
250 radius = 1.0 - SWS_MAX_REDUCE_CUTOFF;
251 break;
252 case SWS_SCALE_AREA:
253 /* Above ratio 1.0, this behaves like bilinear */
254 fun.params[0] = fmin(ratio, 1.0);
255 fun.radius = 0.5 + 0.5 * fun.params[0];
256 radius = fun.radius - SWS_MAX_REDUCE_CUTOFF * fun.params[0];
257 break;
258 default:
259 /* Numerically estimate radius of nontrivial or parametric kernels */
260 radius = est_filter_radius(&fun);
261 break;
262 }
263 radius *= stretch;
264
265 /* Compute filter size by checking the number of taps in each row */
266 int filter_size = 0;
267 for (int i = 0; i < params->dst_size; i++) {
268 /* Matches the indexing in compute_row() */
269 const double src_pos = get_src_pos(i, ratio_inv, params->offset);
270 const int start = floor(src_pos - radius) + 1;
271 const int stop = ceil (src_pos + radius) - 1;
272 const int taps = av_clip(stop - start + 1, 1, params->src_size);
273 if (taps > SWS_FILTER_SIZE_MAX) {
274 return AVERROR(ENOTSUP);
275 } else if (taps > filter_size) {
276 filter_size = taps;
277 if (taps == params->src_size)
278 break; /* can't get any bigger */
279 }
280 }
281
284 if (!filter)
285 return AVERROR(ENOMEM);
286 filter->scaler = scaler;
287 filter->src_size = params->src_size;
288 filter->dst_size = params->dst_size;
289 filter->virtual_size = virtual_size;
290 filter->offset = params->offset;
291 filter->filter_size = filter_size;
292 if (filter->filter_size == 1)
293 filter->sum_positive = SWS_FILTER_SCALE;
294
295 av_log(log, AV_LOG_DEBUG, "Generating %s filter with %d taps (radius = %f)\n",
296 ff_sws_scaler_name(scaler), filter->filter_size, radius);
297
298 filter->num_weights = (size_t) params->dst_size * filter->filter_size;
299 const size_t padded = filter->num_weights +
300 (size_t) filter->filter_size * SWS_FILTER_PAD_ROWS;
301 filter->weights = ff_refstruct_calloc(padded, sizeof(*filter->weights));
302 if (!filter->weights) {
304 return AVERROR(ENOMEM);
305 }
306
307 filter->offsets = ff_refstruct_calloc(params->dst_size, sizeof(*filter->offsets));
308 if (!filter->offsets) {
310 return AVERROR(ENOMEM);
311 }
312
313 double *tmp = av_malloc(filter->filter_size * sizeof(*tmp));
314 if (!tmp) {
316 return AVERROR(ENOMEM);
317 }
318
319 for (int i = 0; i < params->dst_size; i++)
320 compute_row(filter, &fun, radius, ratio_inv, stretch_inv, i, tmp);
321 av_free(tmp);
322
323 *out = filter;
324 return 0;
325}
326
327/*
328 * Some of the filter code originally derives (via libplacebo/mpv) from Glumpy:
329 * # Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved.
330 * # Distributed under the (new) BSD License.
331 * (https://github.com/glumpy/glumpy/blob/master/glumpy/library/build-spatial-filters.py)
332 *
333 * The math underlying each filter function was written from scratch, with
334 * some algorithms coming from a number of different sources, including:
335 * - https://en.wikipedia.org/wiki/Window_function
336 * - https://en.wikipedia.org/wiki/Jinc
337 * - http://vector-agg.cvs.sourceforge.net/viewvc/vector-agg/agg-2.5/include/agg_image_filters.h
338 * - Vapoursynth plugin fmtconv (WTFPL Licensed), which is based on
339 * dither plugin for avisynth from the same author:
340 * https://github.com/vapoursynth/fmtconv/tree/master/src/fmtc
341 * - Paul Heckbert's "zoom"
342 * - XBMC: ConvolutionKernels.cpp etc.
343 * - https://github.com/AviSynth/jinc-resize (only used to verify the math)
344 */
345
346av_unused static double box(double x, const double *params)
347{
348 return 1.0;
349}
350
351/**
352 * Overlap between a destination pixel (unit box) and a source pixel of width
353 * params[0] <= 1, i.e. the convolution of two box filters (a trapezoid).
354 */
355static double area(double x, const double *params)
356{
357 const double w = params[0];
358 const double edge = 0.5 - 0.5 * w;
359 if (x <= edge)
360 return 1.0;
361 return fmax(1.0 - (x - edge) / w, 0.0);
362}
363
364av_unused static double triangle(double x, const double *params)
365{
366 return 1.0 - x;
367}
368
369av_unused static double cosine(double x, const double *params)
370{
371 return cos(x);
372}
373
374av_unused static double hann(double x, const double *params)
375{
376 return 0.5 + 0.5 * cos(M_PI * x);
377}
378
379av_unused static double hamming(double x, const double *params)
380{
381 return 0.54 + 0.46 * cos(M_PI * x);
382}
383
384av_unused static double welch(double x, const double *params)
385{
386 return 1.0 - x * x;
387}
388
389av_unused static double bessel_i0(double x)
390{
391 double s = 1.0;
392 double y = x * x / 4.0;
393 double t = y;
394 int i = 2;
395 while (t > 1e-12) {
396 s += t;
397 t *= y / (i * i);
398 i += 1;
399 }
400 return s;
401}
402
403av_unused static double kaiser(double x, const double *params)
404{
405 double alpha = fmax(params[0], 0.0);
406 double scale = bessel_i0(alpha);
407 return bessel_i0(alpha * sqrt(1.0 - x * x)) / scale;
408}
409
410av_unused static double blackman(double x, const double *params)
411{
412 double a = params[0];
413 double a0 = (1 - a) / 2.0, a1 = 1 / 2.0, a2 = a / 2.0;
414 x *= M_PI;
415 return a0 + a1 * cos(x) + a2 * cos(2 * x);
416}
417
418av_unused static double bohman(double x, const double *params)
419{
420 double pix = M_PI * x;
421 return (1.0 - x) * cos(pix) + sin(pix) / M_PI;
422}
423
424av_unused static double gaussian(double x, const double *params)
425{
426 return exp(-params[0] * x * x);
427}
428
429av_unused static double quadratic(double x, const double *params)
430{
431 if (x < 0.5) {
432 return 1.0 - 4.0/3.0 * (x * x);
433 } else {
434 return 2.0 / 3.0 * (x - 1.5) * (x - 1.5);
435 }
436}
437
438av_unused static double sinc(double x, const double *params)
439{
440 if (x < 1e-8)
441 return 1.0;
442 x *= M_PI;
443 return sin(x) / x;
444}
445
446av_unused static double jinc(double x, const double *params)
447{
448 if (x < 1e-8)
449 return 1.0;
450 x *= M_PI;
451 return 2.0 * j1(x) / x;
452}
453
454av_unused static double sphinx(double x, const double *params)
455{
456 if (x < 1e-8)
457 return 1.0;
458 x *= M_PI;
459 return 3.0 * (sin(x) - x * cos(x)) / (x * x * x);
460}
461
462av_unused static double cubic(double x, const double *params)
463{
464 const double b = params[0], c = params[1];
465 double p0 = 6.0 - 2.0 * b,
466 p2 = -18.0 + 12.0 * b + 6.0 * c,
467 p3 = 12.0 - 9.0 * b - 6.0 * c,
468 q0 = 8.0 * b + 24.0 * c,
469 q1 = -12.0 * b - 48.0 * c,
470 q2 = 6.0 * b + 30.0 * c,
471 q3 = -b - 6.0 * c;
472
473 if (x < 1.0) {
474 return (p0 + x * x * (p2 + x * p3)) / p0;
475 } else {
476 return (q0 + x * (q1 + x * (q2 + x * q3))) / p0;
477 }
478}
479
480static double spline_coeff(double a, double b, double c, double d, double x)
481{
482 if (x <= 1.0) {
483 return ((d * x + c) * x + b) * x + a;
484 } else {
485 return spline_coeff(0.0,
486 b + 2.0 * c + 3.0 * d,
487 c + 3.0 * d,
488 -b - 3.0 * c - 6.0 * d,
489 x - 1.0);
490 }
491}
492
493av_unused static double spline(double x, const double *params)
494{
495 const double p = -2.196152422706632;
496 return spline_coeff(1.0, 0.0, p, -p - 1.0, x);
497}
498
500 [SWS_SCALE_BILINEAR] = { 1.0, triangle },
501 [SWS_SCALE_BICUBIC] = { 2.0, cubic, .params = { 0.0, 0.6 } },
502 [SWS_SCALE_POINT] = { 0.5, box },
503 [SWS_SCALE_GAUSSIAN] = { 4.0, gaussian, .params = { 3.0 } },
505 [SWS_SCALE_LANCZOS] = { -1.0, sinc, sinc, .params = { 3.0 } },
507 [SWS_SCALE_AREA] = { 1.0, area },
508};
509
510const char *ff_sws_scaler_name(SwsScaler scaler)
511{
512 switch (scaler) {
513 case SWS_SCALE_AUTO: return "auto";
514 case SWS_SCALE_BILINEAR: return "bilinear";
515 case SWS_SCALE_BICUBIC: return "bicubic";
516 case SWS_SCALE_POINT: return "point";
517 case SWS_SCALE_AREA: return "area";
518 case SWS_SCALE_GAUSSIAN: return "gaussian";
519 case SWS_SCALE_SINC: return "sinc";
520 case SWS_SCALE_LANCZOS: return "lanczos";
521 case SWS_SCALE_SPLINE: return "spline";
522 case SWS_SCALE_NB: break;
523 }
524
525 return NULL;
526}
SwsAArch64OpImplParams params
Definition ops.c:52
static double bound(const double threshold, const double val)
static FILE * out
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
#define av_clip
Definition common.h:100
#define NULL
Definition coverity.c:32
static __device__ float ceil(float a)
static __device__ float fabs(float a)
static __device__ float floor(float a)
double fmin(double, double)
double fmax(double, double)
int8_t exp
Definition eval.c:76
static av_unused double kaiser(double x, const double *params)
Definition filters.c:403
static void compute_row(SwsFilterWeights *f, const SwsFilterFunction *fun, double radius, double ratio_inv, double stretch_inv, int dst_pos, double *tmp)
Definition filters.c:76
static av_unused double hamming(double x, const double *params)
Definition filters.c:379
static av_unused double blackman(double x, const double *params)
Definition filters.c:410
static av_unused double bessel_i0(double x)
Definition filters.c:389
static av_unused double bohman(double x, const double *params)
Definition filters.c:418
static double est_filter_radius(const SwsFilterFunction *fun)
Numerically estimate the last intersection between the function value and the cutoff domain [-SWS_MAX...
Definition filters.c:177
static const SwsFilterFunction filter_functions[SWS_SCALE_NB]
Definition filters.c:48
const char * ff_sws_scaler_name(SwsScaler scaler)
Return the friendly name of a given scaler enum, or NULL if invalid.
Definition filters.c:510
static bool validate_params(const SwsFilterFunction *fun, SwsScaler scaler)
Definition filters.c:158
static av_unused double hann(double x, const double *params)
Definition filters.c:374
static av_unused double gaussian(double x, const double *params)
Definition filters.c:424
static av_unused double sphinx(double x, const double *params)
Definition filters.c:454
static double spline_coeff(double a, double b, double c, double d, double x)
Definition filters.c:480
static double scaler_sample(const SwsFilterFunction *f, double x)
Definition filters.c:50
double(* SwsFilterKernel)(double x, const double *params)
Definition filters.c:39
static av_unused double cubic(double x, const double *params)
Definition filters.c:462
static double area(double x, const double *params)
Overlap between a destination pixel (unit box) and a source pixel of width params[0] <= 1,...
Definition filters.c:355
static av_unused double cosine(double x, const double *params)
Definition filters.c:369
int ff_sws_filter_generate(void *log, const SwsFilterParams *params, SwsFilterWeights **out)
Generate a filter kernel for the given parameters.
Definition filters.c:203
static av_unused double sinc(double x, const double *params)
Definition filters.c:438
static double get_src_pos(int dst_pos, double ratio_inv, double offset)
Explanation of the 0.5 offsets: Normally, pixel samples are assumed to be representative of the cente...
Definition filters.c:71
static av_unused double spline(double x, const double *params)
Definition filters.c:493
static av_unused double welch(double x, const double *params)
Definition filters.c:384
static av_unused double jinc(double x, const double *params)
Definition filters.c:446
static void sws_filter_free(AVRefStructOpaque opaque, void *obj)
Definition filters.c:151
static av_unused double box(double x, const double *params)
Definition filters.c:346
static av_unused double triangle(double x, const double *params)
Definition filters.c:364
static av_unused double quadratic(double x, const double *params)
Definition filters.c:429
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
#define SWS_MAX_REDUCE_CUTOFF
Filter kernel cut-off value.
Definition swscale.h:447
#define SWS_PARAM_DEFAULT
Definition swscale.h:456
SwsScaler
Definition swscale.h:96
@ SWS_SCALE_SPLINE
unwindowned natural cubic spline
Definition swscale.h:105
@ SWS_SCALE_POINT
nearest neighbor (point sampling)
Definition swscale.h:100
@ SWS_SCALE_NB
not part of the ABI
Definition swscale.h:106
@ SWS_SCALE_LANCZOS
3-tap sinc/sinc
Definition swscale.h:104
@ SWS_SCALE_BILINEAR
bilinear filtering
Definition swscale.h:98
@ SWS_SCALE_GAUSSIAN
2-tap gaussian approximation
Definition swscale.h:102
@ SWS_SCALE_BICUBIC
2-tap cubic BC-spline
Definition swscale.h:99
@ SWS_SCALE_AREA
area averaging
Definition swscale.h:101
@ SWS_SCALE_SINC
unwindowed sinc
Definition swscale.h:103
@ SWS_SCALE_AUTO
Definition swscale.h:97
int a
static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2], const int shift)
static const int16_t alpha[]
Definition ilbcdata.h:55
#define b
Definition input.c:43
unsigned offset
Definition libaomenc.c:812
Macro definitions for various function/variable attributes.
#define av_unused
Definition attributes.h:164
@ SWS_FILTER_SIZE_MAX
Definition filters.h:41
@ SWS_FILTER_PAD_ROWS
Definition filters.h:42
@ SWS_FILTER_SCALE
14-bit coefficients are picked to fit comfortably within int16_t for efficient SIMD processing (e....
Definition filters.h:40
uint8_t w
Definition llvidencdsp.c:39
#define M_PI
Definition mathematics.h:67
Memory handling functions.
char * root
Definition mscl.c:248
static const char * obj
Definition mscl.c:57
enum AVPixelFormat pix
Definition ohcodec.c:55
#define av_malloc(s)
Definition ops_static.c:52
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition refstruct.c:121
static void * av_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(AVRefStructOpaque opaque, void *obj))
A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
Definition refstruct.h:94
unsigned int pos
Definition spdifenc.c:431
double params[SWS_NUM_SCALER_PARAMS]
Definition filters.c:45
SwsFilterKernel kernel
Definition filters.c:43
SwsFilterKernel window
Definition filters.c:44
Represents a computed filter kernel.
Definition filters.h:91
#define SWS_NUM_SCALER_PARAMS
Extra parameters for fine-tuning certain scalers.
Definition swscale.h:243
static void * ff_refstruct_calloc(size_t n, size_t size)
#define av_free(p)
#define av_log(a,...)
static void error(const char *err)
static uint8_t tmp[40]
Definition aes_ctr.c:52
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
static const uint8_t q1[256]
Definition twofish.c:100
static const uint8_t q0[256]
Definition twofish.c:81
RefStruct is an API for creating reference-counted objects with minimal overhead.
Definition refstruct.h:58
static float gaussian(float sigma, float x)
#define RADIUS_MAX
Definition vf_sab.c:69
static double a0(void *priv, double x, double y)
Definition vf_xfade.c:2035
static double a2(void *priv, double x, double y)
Definition vf_xfade.c:2037
static double a1(void *priv, double x, double y)
Definition vf_xfade.c:2036
uint8_t base
Definition vp3data.h:128
static double c[64]