FFmpeg
|
#include "libavutil/avassert.h"
#include <libavutil/bswap.h>
#include "libavutil/rational.h"
#include "ops.h"
#include "ops_internal.h"
Go to the source code of this file.
Macros | |
#define | RET(x) |
Copyright (C) 2025 Niklas Haas. More... | |
Functions | |
static bool | op_type_is_independent (SwsOpType op) |
static unsigned | merge_comp_flags (unsigned a, unsigned b) |
void | ff_sws_op_list_update_comps (SwsOpList *ops) |
Infer + propagate known information about components. More... | |
static int | exact_log2 (const int x) |
static int | exact_log2_q (const AVRational x) |
static bool | extract_scalar (const SwsLinearOp *c, SwsComps prev, SwsComps next, SwsConst *out_scale) |
If a linear operation can be reduced to a scalar multiplication, returns the corresponding scaling factor, or 0 otherwise. More... | |
static bool | extract_constant_rows (SwsLinearOp *c, SwsComps prev, SwsConst *out_clear) |
static bool | extract_swizzle (SwsLinearOp *op, SwsComps prev, SwsSwizzleOp *out_swiz) |
int | ff_sws_op_list_optimize (SwsOpList *ops) |
Fuse compatible and eliminate redundant operations, as well as replacing some operations with more efficient alternatives. More... | |
int | ff_sws_solve_shuffle (const SwsOpList *const ops, uint8_t shuffle[], int size, uint8_t clear_val, int *read_bytes, int *write_bytes) |
"Solve" an op list into a fixed shuffle mask, with an optional ability to also directly clear the output value (for e.g. More... | |
Variables | |
static const unsigned | flags_identity = SWS_COMP_ZERO | SWS_COMP_EXACT |
#define RET | ( | x | ) |
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 28 of file ops_optimizer.c.
|
static |
Definition at line 36 of file ops_optimizer.c.
Referenced by ff_sws_op_list_optimize().
|
static |
Definition at line 67 of file ops_optimizer.c.
Referenced by ff_sws_op_list_update_comps().
void ff_sws_op_list_update_comps | ( | SwsOpList * | ops | ) |
Infer + propagate known information about components.
Called automatically when needed by the optimizer and compiler.
Definition at line 75 of file ops_optimizer.c.
Referenced by ff_sws_op_list_optimize().
|
static |
Definition at line 305 of file ops_optimizer.c.
Referenced by exact_log2_q().
|
static |
Definition at line 314 of file ops_optimizer.c.
Referenced by ff_sws_op_list_optimize().
|
static |
If a linear operation can be reduced to a scalar multiplication, returns the corresponding scaling factor, or 0 otherwise.
Definition at line 328 of file ops_optimizer.c.
Referenced by ff_sws_op_list_optimize().
|
static |
Definition at line 352 of file ops_optimizer.c.
Referenced by ff_sws_op_list_optimize().
|
static |
Definition at line 380 of file ops_optimizer.c.
Referenced by ff_sws_op_list_optimize().
int ff_sws_op_list_optimize | ( | SwsOpList * | ops | ) |
Fuse compatible and eliminate redundant operations, as well as replacing some operations with more efficient alternatives.
Definition at line 412 of file ops_optimizer.c.
int ff_sws_solve_shuffle | ( | const SwsOpList * | ops, |
uint8_t | shuffle[], | ||
int | size, | ||
uint8_t | clear_val, | ||
int * | read_bytes, | ||
int * | write_bytes | ||
) |
"Solve" an op list into a fixed shuffle mask, with an optional ability to also directly clear the output value (for e.g.
rgb24 -> rgb0). This can accept any operation chain that only consists of the following operations:
Basically, any operation that purely consists of moving around and reordering bytes within a single plane, can be turned into a shuffle mask.
ops | The operation list to decompose. |
shuffle | The output shuffle mask. |
size | The size (in bytes) of the output shuffle mask. |
clear_val | If nonzero, this index will be used to clear the output. |
read_bytes | Returns the number of bytes read per shuffle iteration. |
write_bytes | Returns the number of bytes written per shuffle iteration. |
Definition at line 774 of file ops_optimizer.c.
Referenced by solve_shuffle().
|
static |
Definition at line 66 of file ops_optimizer.c.
Referenced by ff_sws_op_list_update_comps().