FFmpeg
Macros | Functions
ops_chain.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/rational.h"
#include "ops_chain.h"

Go to the source code of this file.

Macros

#define Q(N)   ((AVRational) { N, 1 })
 Copyright (C) 2025 Niklas Haas. More...
 
#define q2pixel(type, q)   ((q).den ? (type) (q).num / (q).den : 0)
 

Functions

SwsOpChainff_sws_op_chain_alloc (void)
 
void ff_sws_op_chain_free_cb (void *ptr)
 
int ff_sws_op_chain_append (SwsOpChain *chain, SwsFuncPtr func, void(*free)(void *), const SwsOpPriv *priv)
 
static int op_match (const SwsOp *op, const SwsOpEntry *entry, const SwsComps next)
 Match an operation against a reference operation. More...
 
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. More...
 
int ff_sws_setup_u8 (const SwsOp *op, SwsOpPriv *out)
 
int ff_sws_setup_u (const SwsOp *op, SwsOpPriv *out)
 
int ff_sws_setup_q (const SwsOp *op, SwsOpPriv *out)
 
int ff_sws_setup_q4 (const SwsOp *op, SwsOpPriv *out)
 

Macro Definition Documentation

◆ Q

#define Q (   N)    ((AVRational) { N, 1 })

Copyright (C) 2025 Niklas Haas.

This file is part of FFmpeg.

FFmpeg is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

FFmpeg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with FFmpeg; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Definition at line 27 of file ops_chain.c.

◆ q2pixel

#define q2pixel (   type,
 
)    ((q).den ? (type) (q).num / (q).den : 0)

Definition at line 247 of file ops_chain.c.

Function Documentation

◆ ff_sws_op_chain_alloc()

SwsOpChain* ff_sws_op_chain_alloc ( void  )

Definition at line 29 of file ops_chain.c.

Referenced by compile().

◆ ff_sws_op_chain_free_cb()

void ff_sws_op_chain_free_cb ( void *  ptr)

Definition at line 34 of file ops_chain.c.

Referenced by compile(), and ff_sws_op_chain_free().

◆ ff_sws_op_chain_append()

int ff_sws_op_chain_append ( SwsOpChain chain,
SwsFuncPtr  func,
void(*)(void *)  free,
const SwsOpPriv priv 
)

Definition at line 48 of file ops_chain.c.

Referenced by ff_sws_op_compile_tables().

◆ op_match()

static int op_match ( const SwsOp op,
const SwsOpEntry entry,
const SwsComps  next 
)
static

Match an operation against a reference operation.

Returns a score for how well the reference matches the operation, or 0 if there is no match.

If ref->comps has any flags set, they must be set in op as well. Likewise, if ref->comps has any components marked as unused, they must be marked as as unused in ops as well.

For SWS_OP_LINEAR, ref->linear.mask must be a strict superset of op->linear.mask, but may not contain any columns explicitly ignored by op->comps.unused.

For SWS_OP_READ, SWS_OP_WRITE, SWS_OP_SWAP_BYTES and SWS_OP_SWIZZLE, the exact type is not checked, just the size.

Components set in next.unused are ignored when matching. If flexible is true, the op body is ignored - only the operation, pixel type, and component masks are checked.

Definition at line 82 of file ops_chain.c.

Referenced by ff_sws_op_compile_tables().

◆ ff_sws_op_compile_tables()

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.

See op_match in ops.c for details on how the matching works.

Returns 0, AVERROR(EAGAIN), or a negative error code.

Definition at line 196 of file ops_chain.c.

Referenced by compile().

◆ ff_sws_setup_u8()

int ff_sws_setup_u8 ( const SwsOp op,
SwsOpPriv out 
)

Definition at line 249 of file ops_chain.c.

◆ ff_sws_setup_u()

int ff_sws_setup_u ( const SwsOp op,
SwsOpPriv out 
)

Definition at line 255 of file ops_chain.c.

◆ ff_sws_setup_q()

int ff_sws_setup_q ( const SwsOp op,
SwsOpPriv out 
)

Definition at line 266 of file ops_chain.c.

◆ ff_sws_setup_q4()

int ff_sws_setup_q4 ( const SwsOp op,
SwsOpPriv out 
)

Definition at line 279 of file ops_chain.c.

Referenced by normalize_clear().