Go to the documentation of this file.
33 if (
a->type !=
b->type)
34 return (
int)
a->type -
b->type;
36 return (
int)
a->uop -
b->uop;
37 if (
a->mask !=
b->mask)
38 return (
int)
a->mask -
b->mask;
39 return memcmp(&
a->par, &
b->par,
sizeof(
a->par));
45 #define UOP_NAME(OP, ABBR) [OP] = { ABBR },
66 #define Q2PIXEL(val) pixel_from_q64(op->type, val)
71 case 1:
return val.u8 == UINT8_MAX;
72 case 2:
return val.u16 == UINT16_MAX;
73 case 4:
return val.u32 == UINT32_MAX;
106 for (
int i = 0;
i < 4;
i++)
111 for (
int i = 0;
i < 4;
i++) {
132 for (
int i = 0;
i < 4;
i++) {
145 for (
int i = 0;
i < 4;
i++) {
149 for (
int j = 0; j < 5; j++) {
162 for (
int i = 0;
i < 4;
i++) {
212 sizeof(*uop), (uint8_t *) uop))
225 for (
int i = 0;
i < 4;
i++)
227 return (1 <<
dither->size_log2) + max_offset;
245 volatile float prod =
a *
b;
246 volatile float result =
b ? prod /
b : 0.0f;
257 else if (!minq.
den || !maxq.
den)
282 const uint64_t max_val = UINT64_MAX >> (64 -
bits);
296 op->rw.elems > 2,
op->rw.elems > 3),
300 if (!
op->rw.filter.op)
304 if (
op->rw.filter.op) {
321 if (
op->rw.frac || !is_read)
324 }
else if (
op->rw.frac == 3) {
326 }
else if (
op->rw.frac == 1) {
339 for (
size_t i = 0;
i <
size;
i++) {
357 for (
int i = 0;
i < 4;
i++) {
358 if (
op->swizzle.in[
i] ==
i)
364 for (
int i = 0;
i < 4;
i++) {
370 int idx[4 + 1] = { 0, 1, 2, 3, -1 };
380 const int cur = idx[
dst];
384 if (idx[
src] ==
op->swizzle.in[
dst]) {
426 .par.swizzle.in = {0, 1, 2, 3},
431 for (
int i = 0;
i < 4;
i++) {
434 const int src =
op->swizzle.in[
i];
443 for (
int i = 0;
i < 4;
i++) {
450 for (
int j = 0; j < 4; j++) {
465 for (
int i = 0;
i < 4;
i++) {
481 .par.dither.size_log2 =
op->dither.size_log2,
484 if (
op->dither.size_log2 == 0) {
488 for (
int i = 0;
i < 4;
i++) {
498 const int size = 1 <<
op->dither.size_log2;
499 for (
int i = 0;
i < 4;
i++) {
502 const uint8_t off =
op->dither.y_offset[
i] & (
size - 1);
536 for (
int i = 0;
i < 4;
i++) {
539 bool nonzero = (
op->lin.m[
i][4].num != 0);
540 for (
int j = 0; j < 5; j++) {
546 else if (j < 4 && k.
num == k.
den)
611 if (
op->convert.expand) {
613 switch (
op->convert.to) {
618 switch (
op->convert.to) {
630 for (
int i = 0;
i < 4 &&
op->pack.pattern[
i];
i++) {
643 uop.
mask &=
op->clear.mask;
644 for (
int i = 0;
i < 4;
i++) {
668 for (
int i = 0;
i < 4;
i++) {
static const int factor[16]
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
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
@ SWS_FILTER_SCALE
14-bit coefficients are picked to fit comfortably within int16_t for efficient SIMD processing (e....
@ SWS_RW_PLANAR
Note: 1-component reads are either SWS_RW_PLANAR or SWS_RW_PACKED, depending on the underlying interp...
SwsComps comps_src
Source component metadata associated with pixel values from each corresponding component (in plane/me...
SwsCompMask ff_sws_comp_mask_q4(const AVRational64 q[4])
#define u(width, name, range_min, range_max)
void * av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data)
Add an element of size elem_size to a dynamic array.
static int translate_rw_op(SwsContext *ctx, SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op)
int ff_sws_uop_cmp(const SwsUOp *a, const SwsUOp *b)
Copyright (C) 2026 Niklas Haas.
#define SWS_COMP_MASK(X, Y, Z, W)
#define SWS_UOP_NAME_MAX
Generate a unique name for a SwsUOp.
int ff_sws_pixel_type_size(SwsPixelType type)
static bool check_filter_fma(SwsContext *ctx, SwsUOpFlags flags, const SwsOp *op)
SwsCompMask ff_sws_comp_mask_needed(const SwsOp *op)
#define SWS_COMP_TEST(mask, X)
void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size)
Init a print buffer using a pre-existing buffer.
static int translate_move(SwsUOpList *ops, const SwsOp *op)
#define UOP_NAME(OP, ABBR)
bool ff_sws_pixel_type_is_int(SwsPixelType type)
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
#define FF_ARRAY_ELEMS(a)
#define SWS_OP_NEEDED(op, idx)
SwsFilterWeights * kernel
static const uint16_t dither[8][8]
#define UOPS_LIST(ENTRY)
This file is part of FFmpeg.
int flags
Flags modifying the (de)muxer behaviour.
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 av_assert0(cond)
assert() equivalent, that is always enabled.
static AVFormatContext * ctx
uint8_t SwsCompMask
Bit-mask of components.
static int count_idx(const int *arr, size_t size, int val)
and forward the result(frame or status change) to the corresponding input. If nothing is possible
static int translate_swizzle(SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op)
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
int8_t dst[SWS_UOP_MOVE_MAX]
static int translate_dither_op(SwsUOpList *ops, const SwsOp *op)
static bool pixel_is_1s(SwsPixelType type, SwsPixel val)
static bool exact_prod(SwsPixelType type, SwsPixel coef, const SwsComps *comps, int idx)
static void uop_uninit(SwsUOp *uop)
@ SWS_UOP_READ_PLANAR_FV_FMA
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define i(width, name, range_min, range_max)
64-bit Rational number (pair of numerator and denominator).
void * av_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
SwsComps comps
Metadata about the operation's input/output components.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
SwsUOpList * ff_sws_uop_list_alloc(void)
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static bool exact_product_f32(float a, float b)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
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 needed
static SwsPixelType pixel_type_to_int(const SwsPixelType type)
int ff_sws_ops_translate(SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags, SwsUOpList *uops)
Translate a list of operations down to micro-ops, which can be further optimized and then directly ex...
static bool is_expand_bit(SwsPixelType type, AVRational64 factor)
void ff_sws_uop_list_free(SwsUOpList **p_ops)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
static const struct @587 uop_names[SWS_UOP_TYPE_NB]
const char * ff_sws_pixel_type_name(SwsPixelType type)
void ff_sws_uop_name(const SwsUOp *op, char buf[SWS_UOP_NAME_MAX])
int ff_sws_uop_list_append(SwsUOpList *uops, SwsUOp *uop)
int8_t src[SWS_UOP_MOVE_MAX]
static int translate_linear_op(SwsContext *ctx, SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op, const SwsComps *input)
int ff_sws_dither_height(const SwsDitherUOp *dither)
Computes (1 << size_log2) + MAX(y_offset).
static int translate_op(SwsContext *ctx, SwsUOpList *uops, SwsUOpFlags flags, const SwsOp *op, const SwsComps *input)
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
Helper struct for representing a list of operations.
Main external API structure.
static SwsPixel pixel_from_q64(SwsPixelType type, AVRational64 val)
#define ff_sws_comp_mask_str(mask)