|
FFmpeg
|
#include <assert.h>#include <stdbool.h>#include <stdalign.h>#include "libavutil/bprint.h"#include "graph.h"#include "filters.h"Go to the source code of this file.
Data Structures | |
| union | SwsConst |
| struct | SwsComps |
| struct | SwsReadWriteOp |
| struct | SwsPackOp |
| struct | SwsSwizzleOp |
| struct | SwsConvertOp |
| struct | SwsDitherOp |
| struct | SwsLinearOp |
| struct | SwsFilterOp |
| struct | SwsOp |
| struct | SwsOpList |
| Helper struct for representing a list of operations. More... | |
Macros | |
| #define | SWS_OP_NEEDED(op, idx) (!((op)->comps.flags[idx] & SWS_COMP_GARBAGE)) |
| #define | SWS_SWIZZLE(X, Y, Z, W) ((SwsSwizzleOp) { .in = {X, Y, Z, W} }) |
| #define | SWS_MASK(I, J) (1 << (5 * (I) + (J))) |
| #define | SWS_MASK_OFF(I) SWS_MASK(I, 4) |
| #define | SWS_MASK_ROW(I) (0x1F << (5 * (I))) |
| #define | SWS_MASK_COL(J) (0x8421 << J) |
Functions | |
| const char * | ff_sws_pixel_type_name (SwsPixelType type) |
| int | ff_sws_pixel_type_size (SwsPixelType type) av_const |
| bool | ff_sws_pixel_type_is_int (SwsPixelType type) av_const |
| const char * | ff_sws_op_type_name (SwsOpType op) |
| uint32_t | ff_sws_linear_mask (SwsLinearOp) |
| void | ff_sws_op_desc (AVBPrint *bp, const SwsOp *op) |
| Describe an operation in human-readable form. More... | |
| void | ff_sws_op_uninit (SwsOp *op) |
| Frees any allocations associated with an SwsOp and sets it to {0}. More... | |
| void | ff_sws_apply_op_q (const SwsOp *op, AVRational x[4]) |
| Apply an operation to an AVRational. More... | |
| SwsOpList * | ff_sws_op_list_alloc (void) |
| void | ff_sws_op_list_free (SwsOpList **ops) |
| SwsOpList * | ff_sws_op_list_duplicate (const SwsOpList *ops) |
Returns a duplicate of ops, or NULL on OOM. More... | |
| const SwsOp * | ff_sws_op_list_input (const SwsOpList *ops) |
| Returns the input operation for a given op list, or NULL if there is none (e.g. More... | |
| const SwsOp * | ff_sws_op_list_output (const SwsOpList *ops) |
| Returns the output operation for a given op list, or NULL if there is none. More... | |
| bool | ff_sws_op_list_is_noop (const SwsOpList *ops) |
| Returns whether an op list represents a true no-op operation, i.e. More... | |
| int | ff_sws_op_list_max_size (const SwsOpList *ops) |
Returns the size of the largest pixel type used in ops. More... | |
| int | ff_sws_op_list_append (SwsOpList *ops, SwsOp *op) |
These will take over ownership of op and set it to {0}, even on failure. More... | |
| int | ff_sws_op_list_insert_at (SwsOpList *ops, int index, SwsOp *op) |
| void | ff_sws_op_list_remove_at (SwsOpList *ops, int index, int count) |
| void | ff_sws_op_list_print (void *log_ctx, int log_level, int log_level_extra, const SwsOpList *ops) |
| Print out the contents of an operation list. More... | |
| void | ff_sws_op_list_update_comps (SwsOpList *ops) |
| Infer + propagate known information about components. More... | |
| 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_compile_pass (SwsGraph *graph, SwsOpList **ops, int flags, SwsPass *input, SwsPass **output) |
| Resolves an operation list to a graph pass. More... | |
| int | ff_sws_enum_op_lists (SwsContext *ctx, void *opaque, enum AVPixelFormat src_fmt, enum AVPixelFormat dst_fmt, int(*cb)(SwsContext *ctx, void *opaque, SwsOpList *ops)) |
Helper function to enumerate over all possible (optimized) operation lists, under the current set of options in ctx, and run the given callback on each list. More... | |
| int | ff_sws_enum_ops (SwsContext *ctx, void *opaque, enum AVPixelFormat src_fmt, enum AVPixelFormat dst_fmt, int(*cb)(SwsContext *ctx, void *opaque, SwsOp *op)) |
Helper function to enumerate over all possible operations, under the current set of options in ctx, and run the given callback on each operation. More... | |
| #define SWS_OP_NEEDED | ( | op, | |
| idx | |||
| ) | (!((op)->comps.flags[idx] & SWS_COMP_GARBAGE)) |
| enum SwsPixelType |
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
| Enumerator | |
|---|---|
| SWS_PIXEL_NONE | |
| SWS_PIXEL_U8 | |
| SWS_PIXEL_U16 | |
| SWS_PIXEL_U32 | |
| SWS_PIXEL_F32 | |
| SWS_PIXEL_TYPE_NB | |
| enum SwsOpType |
| enum SwsCompFlags |
| anonymous enum |
| enum SwsOpCompileFlags |
| const char* ff_sws_pixel_type_name | ( | SwsPixelType | type | ) |
Definition at line 53 of file ops.c.
Referenced by check_clear(), check_convert(), check_dither(), check_filter(), check_linear(), check_min_max(), check_read_write(), check_scale(), check_shift(), check_swizzle(), ff_sws_op_desc(), and ff_sws_op_list_print().
| int ff_sws_pixel_type_size | ( | SwsPixelType | type | ) | const |
Definition at line 68 of file ops.c.
Referenced by check_clear(), check_convert(), check_scale(), compile(), convert_to_aarch64_impl(), ff_sws_apply_op_q(), ff_sws_op_list_max_size(), ff_sws_pixel_expand(), ff_sws_solve_shuffle(), get_planar_fmt(), normalize_clear(), op_match(), rndq(), rw_pixel_bits(), setup_filter_h(), and setup_swap_bytes().
| bool ff_sws_pixel_type_is_int | ( | SwsPixelType | type | ) | const |
Definition at line 83 of file ops.c.
Referenced by check_clear(), check_convert(), check_dither(), check_filter_fma(), check_linear(), check_scale(), check_shift(), ff_sws_apply_op_q(), ff_sws_op_list_optimize(), ff_sws_op_list_update_comps(), and rndq().
| const char* ff_sws_op_type_name | ( | SwsOpType | op | ) |
Definition at line 100 of file ops.c.
Referenced by ff_sws_op_desc().
| uint32_t ff_sws_linear_mask | ( | SwsLinearOp | ) |
Definition at line 719 of file ops.c.
Referenced by extract_swizzle(), and ff_sws_op_list_optimize().
| void ff_sws_op_desc | ( | AVBPrint * | bp, |
| const SwsOp * | op | ||
| ) |
Describe an operation in human-readable form.
Definition at line 817 of file ops.c.
Referenced by ff_sws_op_list_print(), and register_op().
| void ff_sws_op_uninit | ( | SwsOp * | op | ) |
Frees any allocations associated with an SwsOp and sets it to {0}.
| void ff_sws_apply_op_q | ( | const SwsOp * | op, |
| AVRational | x[4] | ||
| ) |
Apply an operation to an AVRational.
No-op for read/write operations.
Definition at line 139 of file ops.c.
Referenced by ff_sws_op_list_update_comps(), and op_commute_clear().
| SwsOpList* ff_sws_op_list_alloc | ( | void | ) |
Definition at line 567 of file ops.c.
Referenced by enum_ops_fmt().
| void ff_sws_op_list_free | ( | SwsOpList ** | ops | ) |
Definition at line 580 of file ops.c.
Referenced by enum_ops_fmt(), ff_sws_compile_pass(), ff_sws_op_list_subpass(), and ff_sws_ops_compile_backend().
Returns a duplicate of ops, or NULL on OOM.
Definition at line 594 of file ops.c.
Referenced by ff_sws_op_list_subpass(), and ff_sws_ops_compile_backend().
Returns the input operation for a given op list, or NULL if there is none (e.g.
for a pure CLEAR-only operation list).
This will always be an op of type SWS_OP_READ.
Definition at line 631 of file ops.c.
Referenced by aarch64_collect_process(), aarch64_compile(), compile(), ff_sws_compile_pass(), ff_sws_op_list_is_noop(), ff_sws_solve_shuffle(), and get_input_size().
Returns the output operation for a given op list, or NULL if there is none.
This will always be an op of type SWS_OP_WRITE.
Definition at line 640 of file ops.c.
Referenced by aarch64_collect_process(), aarch64_compile(), compile(), ff_sws_compile_pass(), and ff_sws_op_list_is_noop().
| bool ff_sws_op_list_is_noop | ( | const SwsOpList * | ops | ) |
Returns whether an op list represents a true no-op operation, i.e.
may be eliminated entirely from an execution graph.
Note that this check is unlikely to ever be hit in practice, since it would imply the existence of planar formats with different plane orders between them, e.g. rgbap <-> gbrap, which doesn't currently exist. However, the check is cheap and lets me sleep at night.
Definition at line 679 of file ops.c.
Referenced by ff_sws_compile_pass(), and print_ops().
| int ff_sws_op_list_max_size | ( | const SwsOpList * | ops | ) |
Returns the size of the largest pixel type used in ops.
Definition at line 708 of file ops.c.
Referenced by aarch64_optimize(), compile(), and register_op().
These will take over ownership of op and set it to {0}, even on failure.
Definition at line 674 of file ops.c.
Referenced by ff_sws_op_list_subpass().
Definition at line 660 of file ops.c.
Referenced by ff_sws_op_list_append(), ff_sws_op_list_optimize(), and ff_sws_op_list_subpass().
| void ff_sws_op_list_remove_at | ( | SwsOpList * | ops, |
| int | index, | ||
| int | count | ||
| ) |
Definition at line 649 of file ops.c.
Referenced by ff_sws_op_list_optimize(), and ff_sws_op_list_subpass().
| void ff_sws_op_list_print | ( | void * | log_ctx, |
| int | log_level, | ||
| int | log_level_extra, | ||
| const SwsOpList * | ops | ||
| ) |
Print out the contents of an operation list.
Definition at line 923 of file ops.c.
Referenced by ff_sws_compile_pass(), ff_sws_ops_compile(), and print_ops().
| 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 297 of file ops.c.
Referenced by ff_sws_op_list_optimize(), and ff_sws_ops_compile_backend().
| 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 333 of file ops_optimizer.c.
Referenced by enum_ops_fmt(), ff_sws_compile_pass(), and ff_sws_op_list_subpass().
| int ff_sws_compile_pass | ( | SwsGraph * | graph, |
| SwsOpList ** | ops, | ||
| int | flags, | ||
| SwsPass * | input, | ||
| SwsPass ** | output | ||
| ) |
Resolves an operation list to a graph pass.
The first and last operations must be a read/write respectively. flags is a list of SwsOpCompileFlags.
Takes over ownership of ops and sets it to NULL, even on failure.
Note: ops may be modified by this function.
Definition at line 471 of file ops_dispatch.c.
| int ff_sws_enum_op_lists | ( | SwsContext * | ctx, |
| void * | opaque, | ||
| enum AVPixelFormat | src_fmt, | ||
| enum AVPixelFormat | dst_fmt, | ||
| int(*)(SwsContext *ctx, void *opaque, SwsOpList *ops) | cb | ||
| ) |
Helper function to enumerate over all possible (optimized) operation lists, under the current set of options in ctx, and run the given callback on each list.
| src_fmt | If set (not AV_PIX_FMT_NONE), constrain the source format |
| dst_fmt | If set (not AV_PIX_FMT_NONE), constrain the destination format |
ops belongs to ff_sws_enum_op_lists(), but may be mutated by cb. Definition at line 1012 of file ops.c.
Referenced by ff_sws_enum_ops(), and main().
| int ff_sws_enum_ops | ( | SwsContext * | ctx, |
| void * | opaque, | ||
| enum AVPixelFormat | src_fmt, | ||
| enum AVPixelFormat | dst_fmt, | ||
| int(*)(SwsContext *ctx, void *opaque, SwsOp *op) | cb | ||
| ) |
Helper function to enumerate over all possible operations, under the current set of options in ctx, and run the given callback on each operation.
| src_fmt | If set (not AV_PIX_FMT_NONE), constrain the source format |
| dst_fmt | If set (not AV_PIX_FMT_NONE), constrain the destination format |
op belongs to ff_sws_enum_ops(), but may be mutated by cb. Definition at line 1057 of file ops.c.
Referenced by main().
1.8.17