Go to the documentation of this file.
27 #define Q(N) ((AVRational) { N, 1 })
48 void (*free)(
void *),
const SwsOpPriv *priv)
57 chain->
free[idx + 1] = free;
102 for (
int i = 0;
i < 4;
i++) {
104 if (
op->comps.unused[
i])
113 for (
int i = 0;
i < 4;
i++) {
129 if (
op->rw.elems !=
entry->rw.elems ||
130 op->rw.frac !=
entry->rw.frac ||
131 (
op->rw.elems > 1 &&
op->rw.packed !=
entry->rw.packed))
138 for (
int i = 0;
i < 4 &&
op->pack.pattern[
i];
i++) {
139 if (
op->pack.pattern[
i] !=
entry->pack.pattern[
i])
144 for (
int i = 0;
i < 4;
i++) {
145 if (!
op->c.q4[
i].den)
156 for (
int i = 0;
i < 4;
i++) {
162 if (
op->convert.to !=
entry->convert.to ||
163 op->convert.expand !=
entry->convert.expand)
167 return op->dither.size_log2 ==
entry->dither_size ? score : 0;
174 if (
op->lin.mask & ~
entry->linear_mask)
178 for (
int i = 0;
i < 4;
i++) {
199 static const SwsOp dummy = { .comps.unused = {
true,
true,
true,
true }};
204 int ret, best_score = 0, best_cpu_flags;
207 for (
int n = 0; n < num_tables; n++) {
209 if (
table->block_size &&
table->block_size != block_size ||
213 for (
int i = 0;
table->entries[
i];
i++) {
216 if (score > best_score) {
218 best_cpu_flags =
table->cpu_flags;
246 #define q2pixel(type, q) ((q).den ? (type) (q).num / (q).den : 0)
250 out->u8[0] =
op->c.u;
261 default:
return AVERROR(EINVAL);
272 default:
return AVERROR(EINVAL);
280 for (
int i = 0;
i < 4;
i++) {
286 default:
return AVERROR(EINVAL);
int(* func)(AVBPrint *dst, const char *in, const char *arg)
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
int ff_sws_setup_u(const SwsOp *op, SwsOpPriv *out)
static const uint16_t table[]
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
static atomic_int cpu_flags
int ff_sws_pixel_type_size(SwsPixelType type)
int(* setup)(const SwsOp *op, SwsOpPriv *out)
void(* SwsFuncPtr)(void)
Per-kernel execution context.
Writing a table generator This documentation is preliminary Parts of the API are not good and should be changed Basic concepts A table generator consists of two *_tablegen c and *_tablegen h The h file will provide the variable declarations and initialization code for the tables
SwsOpChain * ff_sws_op_chain_alloc(void)
int ff_sws_setup_q(const SwsOp *op, SwsOpPriv *out)
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.
SwsOpImpl impl[SWS_MAX_OPS+1]
Compiled "chain" of operations, which can be dispatched efficiently.
int ff_sws_op_compile_tables(const SwsOpTable *const tables[], int num_tables, SwsOpList *ops, const int block_size, SwsOpChain *chain)
"Compile" a single op by looking it up in a list of fixed size op tables.
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
#define i(width, name, range_min, range_max)
void(* free[SWS_MAX_OPS+1])(void *)
int ff_sws_setup_q4(const SwsOp *op, SwsOpPriv *out)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
#define Q(N)
Copyright (C) 2025 Niklas Haas.
int ff_sws_setup_u8(const SwsOp *op, SwsOpPriv *out)
int ff_sws_op_chain_append(SwsOpChain *chain, SwsFuncPtr func, void(*free)(void *), const SwsOpPriv *priv)
void ff_sws_op_chain_free(SwsOpChain *chain)
Helper struct for representing a list of operations.
Copyright (C) 2025 Niklas Haas.
static int op_match(const SwsOp *op, const SwsOpEntry *entry, const SwsComps next)
Match an operation against a reference operation.