30#pragma STDC FP_CONTRACT OFF
31#elif AV_GCC_VERSION_AT_LEAST(4, 8)
32#pragma GCC optimize ("fp-contract=off")
33#elif defined(_MSC_VER)
34#pragma fp_contract (off)
37#if AV_GCC_VERSION_AT_LEAST(4, 4)
38#pragma GCC optimize ("finite-math-only")
62#define REF_ALL_UOPS(TYPE) \
63 SWS_FOR(TYPE, READ_PLANAR, REF_ENTRY) \
64 SWS_FOR(TYPE, READ_PLANAR_FV, REF_ENTRY) \
65 SWS_FOR(TYPE, READ_PLANAR_FH, REF_ENTRY) \
66 SWS_FOR(TYPE, READ_PACKED, REF_ENTRY) \
67 SWS_FOR(TYPE, READ_NIBBLE, REF_ENTRY) \
68 SWS_FOR(TYPE, READ_BIT, REF_ENTRY) \
69 SWS_FOR(TYPE, READ_PALETTE, REF_ENTRY) \
70 SWS_FOR(TYPE, PERMUTE, REF_ENTRY) \
71 SWS_FOR(TYPE, COPY, REF_ENTRY) \
72 SWS_FOR(TYPE, WRITE_PLANAR, REF_ENTRY) \
73 SWS_FOR(TYPE, WRITE_PACKED, REF_ENTRY) \
74 SWS_FOR(TYPE, WRITE_NIBBLE, REF_ENTRY) \
75 SWS_FOR(TYPE, WRITE_BIT, REF_ENTRY) \
76 SWS_FOR(TYPE, SWAP_BYTES, REF_ENTRY) \
77 SWS_FOR(TYPE, EXPAND_BIT, REF_ENTRY) \
78 SWS_FOR(TYPE, EXPAND_PAIR, REF_ENTRY) \
79 SWS_FOR(TYPE, EXPAND_QUAD, REF_ENTRY) \
80 SWS_FOR(TYPE, TO_U8, REF_ENTRY) \
81 SWS_FOR(TYPE, TO_U16, REF_ENTRY) \
82 SWS_FOR(TYPE, TO_U32, REF_ENTRY) \
83 SWS_FOR(TYPE, TO_F32, REF_ENTRY) \
84 SWS_FOR(TYPE, SCALE, REF_ENTRY) \
85 SWS_FOR(TYPE, ADD, REF_ENTRY) \
86 SWS_FOR(TYPE, MIN, REF_ENTRY) \
87 SWS_FOR(TYPE, MAX, REF_ENTRY) \
88 SWS_FOR(TYPE, UNPACK, REF_ENTRY) \
89 SWS_FOR(TYPE, PACK, REF_ENTRY) \
90 SWS_FOR(TYPE, LSHIFT, REF_ENTRY) \
91 SWS_FOR(TYPE, RSHIFT, REF_ENTRY) \
92 SWS_FOR(TYPE, CLEAR, REF_ENTRY) \
93 SWS_FOR(TYPE, LINEAR, REF_ENTRY) \
94 SWS_FOR(TYPE, DITHER, REF_ENTRY) \
95 SWS_FOR(TYPE, LUT_3D, REF_ENTRY) \
110 const int bx_start,
const int y_start,
111 int bx_end,
int y_end)
120 for (
int i = 0;
i < 4;
i++) {
121 iter->
in[
i] = (uintptr_t) exec->
in[
i];
122 iter->
out[
i] = (uintptr_t) exec->
out[
i];
125 for (iter->
y = y_start; iter->
y < y_end; iter->
y++) {
132 for (
int i = 0;
i < 4;
i++) {
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define i(width, name, range_min, range_max)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
@ SWS_BACKEND_C
Template-based C reference implementation.
const SwsOpBackend backend_c
Copyright (C) 2025 Niklas Haas.
SwsOpChain * ff_sws_op_chain_alloc(void)
Copyright (C) 2025 Niklas Haas.
int ff_sws_uop_lookup(SwsContext *ctx, const SwsUOpTable *const tables[], int num_tables, const SwsUOp *uop, const int block_size, SwsOpChain *chain)
"Compile" a single uop by looking it up in a list of fixed size uop tables, in decreasing order of pr...
void ff_sws_op_chain_free_cb(void *ptr)
static void ff_sws_op_chain_free(SwsOpChain *chain)
static const uint16_t table[]
Main external API structure.
Compiled "chain" of operations, which can be dispatched efficiently.
SwsOpImpl impl[SWS_MAX_OPS+1]
void(* free[SWS_MAX_OPS+1])(SwsOpPriv *)
Copyright (C) 2026 Niklas Haas.
ptrdiff_t in_bump[4]
Pointer bump, difference between stride and processed line size.
int32_t * in_bump_y
Line bump; determines how many additional lines to advance (after incrementing normally to the next l...
Internal context holding per-iter execution data.
Helper struct for representing a list of operations.
Copyright (C) 2025 Niklas Haas.
static AVFormatContext * ctx
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...
void ff_sws_uop_name(const SwsUOp *op, char buf[SWS_UOP_NAME_MAX])
SwsUOpList * ff_sws_uop_list_alloc(void)
void ff_sws_uop_list_free(SwsUOpList **p_ops)
#define SWS_UOP_NAME_MAX
Generate a unique name for a SwsUOp.
#define REF_ALL_UOPS(TYPE)
static int compile_c(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
static const SwsUOpTable uop_table
static int compile_uops_c(SwsContext *ctx, const SwsUOpList *uops, SwsCompiledOp *out)
static void process(const SwsOpExec *exec, const void *priv, const int bx_start, const int y_start, int bx_end, int y_end)
#define SWS_BLOCK_SIZE
Copyright (C) 2026 Niklas Haas.
static void process(NormalizeContext *s, AVFrame *in, AVFrame *out)