Go to the documentation of this file.
30 # define PIXEL_TYPE SWS_PIXEL_F32
31 # define PIXEL_MAX FLT_MAX
32 # define PIXEL_MIN FLT_MIN
33 # define pixel_t float
34 # define block_t f32block_t
37 # error Invalid BIT_DEPTH
46 const int size = 1 <<
op->dither.size_log2;
59 for (
int y = 0; y <
size; y++) {
60 for (
int x = 0; x <
size; x++)
72 const int mask = (1 << size_log2) - 1;
73 const int y_line = iter->y;
74 const int row0 = (y_line + 0) &
mask;
75 const int row1 = (y_line + 3) &
mask;
76 const int row2 = (y_line + 2) &
mask;
77 const int row3 = (y_line + 5) &
mask;
78 const int size = 1 << size_log2;
93 #define WRAP_DITHER(N) \
94 DECL_IMPL(dither##N) \
99 DECL_ENTRY(dither##N, \
100 .op = SWS_OP_DITHER, \
102 .setup = fn(setup_dither), \
126 for (
int i = 0;
i < 4;
i++) {
127 for (
int j = 0; j < 4; j++)
143 const fn(LinCoeffs)
c = *(
const fn(LinCoeffs) *) impl->priv.ptr;
180 #define WRAP_LINEAR(NAME, MASK) \
181 DECL_IMPL(linear_##NAME) \
183 CALL(linear_mask, MASK); \
186 DECL_ENTRY(linear_##NAME, \
187 .op = SWS_OP_LINEAR, \
188 .setup = fn(setup_linear), \
190 .linear_mask = (MASK), \
231 &
fn(op_linear_alpha),
232 &
fn(op_linear_lumalpha),
235 &
fn(op_linear_row0a),
236 &
fn(op_linear_diag3),
237 &
fn(op_linear_diag4),
238 &
fn(op_linear_diagoff3),
239 &
fn(op_linear_matrix3),
240 &
fn(op_linear_affine3),
241 &
fn(op_linear_affine3a),
242 &
fn(op_linear_matrix4),
243 &
fn(op_linear_affine4),
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
static int setup_linear(const SwsOp *op, SwsOpPriv *out)
static int setup_dither(const SwsOp *op, SwsOpPriv *out)
#define CONTINUE(TYPE,...)
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
#define SWS_BLOCK_SIZE
Copyright (C) 2025 Niklas Haas.
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
DECL_FUNC(dither, const int size_log2)
static AVRational av_make_q(int num, int den)
Create an AVRational.
#define WRAP_LINEAR(NAME, MASK)
#define i(width, name, range_min, range_max)
#define REF_COMMON_PATTERNS(NAME)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
static const SwsOpTable fn(op_table_float)
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static const int16_t alpha[]
static const uint8_t dither[8][8]