|
FFmpeg
|
#include "libavutil/avassert.h"#include "libavutil/cpu.h"#include "libavutil/error.h"#include "libavutil/hwcontext.h"#include "libavutil/imgutils.h"#include "libavutil/macros.h"#include "libavutil/mem.h"#include "libavutil/opt.h"#include "libavutil/pixdesc.h"#include "libavutil/refstruct.h"#include "libavutil/slicethread.h"#include "libswscale/swscale.h"#include "libswscale/format.h"#include "cms.h"#include "lut3d.h"#include "swscale_internal.h"#include "graph.h"#include "ops.h"#include "ops_dispatch.h"Go to the source code of this file.
Macros | |
| #define | add_convert_pass add_legacy_sws_pass |
Functions | |
| int | ff_sws_pass_aligned_width (const SwsPass *pass, int width) |
Align width to the optimal size for pass. More... | |
| static int | frame_alloc_planes (AVFrame *dst) |
| static int | pass_alloc_output (SwsPass *pass) |
| static void | free_buffer (AVRefStructOpaque opaque, void *obj) |
| static void | pass_free (SwsPass *pass) |
| int | ff_sws_graph_add_pass (SwsGraph *graph, enum AVPixelFormat fmt, int width, int height, SwsPass *input, int align, SwsPassFunc run, SwsPassSetup setup, void *priv, void(*free_cb)(void *priv), SwsPass **out_pass) |
| Allocate and add a new pass to the filter graph. More... | |
| static void | frame_shift (const SwsFrame *f, const int y, uint8_t *data[4]) |
| static void | run_copy (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static void | run_rgb0 (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static void | run_xyz2rgb (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static void | run_rgb2xyz (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static void | free_legacy_swscale (void *priv) |
| static int | setup_legacy_swscale (const SwsFrame *out, const SwsFrame *in, const SwsPass *pass) |
| static SwsContext * | slice_ctx (const SwsPass *pass, int y) |
| static void | run_legacy_unscaled (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static void | run_legacy_swscale (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static void | get_chroma_pos (SwsGraph *graph, int *h_chr_pos, int *v_chr_pos, const SwsFormat *fmt) |
| static void | legacy_chr_pos (SwsGraph *graph, int *chr_pos, int override, int *warned) |
| static int | init_legacy_subpass (SwsGraph *graph, SwsContext *sws, SwsPass *input, SwsPass **output) |
| static int | add_legacy_sws_pass (SwsGraph *graph, const SwsFormat *src, const SwsFormat *dst, SwsPass *input, SwsPass **output) |
| static void | free_lut3d (void *priv) |
| static int | setup_lut3d (const SwsFrame *out, const SwsFrame *in, const SwsPass *pass) |
| static void | run_lut3d (const SwsFrame *out, const SwsFrame *in, int y, int h, const SwsPass *pass) |
| static int | adapt_colors (SwsGraph *graph, SwsFormat src, SwsFormat dst, SwsPass *input, SwsPass **output) |
| static int | init_passes (SwsGraph *graph) |
| static void | sws_graph_worker (void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads) |
| SwsGraph * | ff_sws_graph_alloc (void) |
| Allocate an empty SwsGraph. More... | |
| static void | graph_uninit (SwsGraph *graph) |
| int | ff_sws_graph_init (SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, int field) |
| Initialize the filter graph for a given pair of formats. More... | |
| int | ff_sws_graph_create (SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, int field, SwsGraph **out_graph) |
| Allocate and initialize the filter graph. More... | |
| void | ff_sws_graph_rollback (SwsGraph *graph, int since_idx) |
| Remove all passes added since the given index. More... | |
| void | ff_sws_graph_free (SwsGraph **pgraph) |
| Uninitialize any state associate with this filter graph and free it. More... | |
| static int | opts_equal (const SwsContext *c1, const SwsContext *c2) |
| int | ff_sws_graph_reinit (SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, int field) |
| Wrapper around ff_sws_graph_init() that reuses the existing graph if the format is compatible. More... | |
| void | ff_sws_graph_update_metadata (SwsGraph *graph, const SwsColor *color) |
| Update dynamic per-frame HDR metadata without requiring a full reinit. More... | |
| static void | get_field (SwsGraph *graph, const AVFrame *avframe, SwsFrame *frame) |
| int | ff_sws_graph_run (SwsGraph *graph, const AVFrame *dst, const AVFrame *src) |
| Dispatch the filter graph on a single field of the given frames. More... | |
| #define add_convert_pass add_legacy_sws_pass |
| int ff_sws_pass_aligned_width | ( | const SwsPass * | pass, |
| int | width | ||
| ) |
Align width to the optimal size for pass.
Definition at line 46 of file graph.c.
Referenced by sws_frame_setup().
|
static |
Definition at line 58 of file graph.c.
Referenced by pass_alloc_output().
|
static |
Definition at line 118 of file graph.c.
Referenced by ff_sws_graph_init().
|
static |
Definition at line 161 of file graph.c.
Referenced by ff_sws_graph_add_pass().
|
static |
Definition at line 167 of file graph.c.
Referenced by ff_sws_graph_add_pass(), ff_sws_graph_rollback(), and graph_uninit().
| int ff_sws_graph_add_pass | ( | SwsGraph * | graph, |
| enum AVPixelFormat | fmt, | ||
| int | width, | ||
| int | height, | ||
| SwsPass * | input, | ||
| int | align, | ||
| SwsPassFunc | run, | ||
| SwsPassSetup | setup, | ||
| void * | priv, | ||
| void(*)(void *priv) | free, | ||
| SwsPass ** | out_pass | ||
| ) |
Allocate and add a new pass to the filter graph.
Takes over ownership of priv, even on failure.
| graph | Filter graph to add the pass to. |
| fmt | Pixel format of the output image. |
| w | Width of the output image. |
| h | Height of the output image. |
| input | Previous pass to read from, or NULL for the input image. |
| align | Minimum slice alignment for this pass, or 0 for no threading. |
| run | Filter function to run. |
| setup | Optional setup function to run from the main thread. |
| priv | Private state for the filter run function. |
| free | Function to free the private state. |
| out_pass | The newly added pass will be written here on success. |
Definition at line 175 of file graph.c.
Referenced by adapt_colors(), compile(), init_legacy_subpass(), and init_passes().
|
static |
Definition at line 230 of file graph.c.
Referenced by run_copy(), run_legacy_swscale(), run_legacy_unscaled(), and run_lut3d().
|
static |
Definition at line 240 of file graph.c.
Referenced by init_passes(), and palette_subblock_data().
|
static |
Definition at line 266 of file graph.c.
Referenced by init_legacy_subpass().
|
static |
Definition at line 287 of file graph.c.
Referenced by init_legacy_subpass().
|
static |
Definition at line 296 of file graph.c.
Referenced by init_legacy_subpass().
|
static |
Definition at line 311 of file graph.c.
Referenced by init_legacy_subpass().
|
static |
Definition at line 317 of file graph.c.
Referenced by init_legacy_subpass().
|
inlinestatic |
Definition at line 333 of file graph.c.
Referenced by run_legacy_swscale(), and run_legacy_unscaled().
|
static |
Definition at line 352 of file graph.c.
Referenced by init_legacy_subpass().
|
static |
Definition at line 364 of file graph.c.
Referenced by init_legacy_subpass().
|
static |
Definition at line 376 of file graph.c.
Referenced by add_legacy_sws_pass().
|
static |
Definition at line 419 of file graph.c.
Referenced by add_legacy_sws_pass().
|
static |
For slice threading, we need to create sub contexts, similar to how swscale normally handles it internally. The most important difference is that we handle cascaded contexts before threaded contexts; whereas context_init_threaded() does it the other way around.
Definition at line 435 of file graph.c.
Referenced by add_legacy_sws_pass().
|
static |
Definition at line 665 of file graph.c.
Referenced by adapt_colors().
Definition at line 671 of file graph.c.
Referenced by adapt_colors().
|
static |
Definition at line 680 of file graph.c.
Referenced by adapt_colors().
|
static |
Grayspace does not really have primaries, so just force the use of the equivalent other primary set to avoid a conversion. Technically, this does affect the weights used for the Grayscale conversion, but in practise, that should give the expected results more often than not.
Definition at line 692 of file graph.c.
Referenced by init_passes().
|
static |
Definition at line 756 of file graph.c.
Referenced by ff_sws_graph_init().
|
static |
Definition at line 786 of file graph.c.
Referenced by ff_sws_graph_init().
| SwsGraph* ff_sws_graph_alloc | ( | void | ) |
Allocate an empty SwsGraph.
Returns NULL on failure.
Definition at line 797 of file graph.c.
Referenced by ff_sws_graph_create(), main(), and sws_frame_setup().
|
static |
Definition at line 802 of file graph.c.
Referenced by ff_sws_graph_free(), ff_sws_graph_init(), and ff_sws_graph_reinit().
| int ff_sws_graph_init | ( | SwsGraph * | graph, |
| SwsContext * | ctx, | ||
| const SwsFormat * | dst, | ||
| const SwsFormat * | src, | ||
| int | field | ||
| ) |
Initialize the filter graph for a given pair of formats.
Returns 0 or a negative error.
Definition at line 813 of file graph.c.
Referenced by ff_sws_graph_create(), and ff_sws_graph_reinit().
| int ff_sws_graph_create | ( | SwsContext * | ctx, |
| const SwsFormat * | dst, | ||
| const SwsFormat * | src, | ||
| int | field, | ||
| SwsGraph ** | out_graph | ||
| ) |
| void ff_sws_graph_rollback | ( | SwsGraph * | graph, |
| int | since_idx | ||
| ) |
Remove all passes added since the given index.
Definition at line 878 of file graph.c.
Referenced by ff_sws_compile_pass().
| void ff_sws_graph_free | ( | SwsGraph ** | pgraph | ) |
Uninitialize any state associate with this filter graph and free it.
Definition at line 885 of file graph.c.
Referenced by ff_sws_graph_create(), main(), sws_frame_setup(), and sws_freeContext().
|
static |
Definition at line 897 of file graph.c.
Referenced by ff_sws_graph_reinit().
| int ff_sws_graph_reinit | ( | SwsGraph * | graph, |
| SwsContext * | ctx, | ||
| const SwsFormat * | dst, | ||
| const SwsFormat * | src, | ||
| int | field | ||
| ) |
Wrapper around ff_sws_graph_init() that reuses the existing graph if the format is compatible.
This will also update dynamic per-frame metadata.
Must also be called after changing any of the fields in ctx, or else they will have no effect.
Definition at line 915 of file graph.c.
Referenced by sws_frame_setup().
Update dynamic per-frame HDR metadata without requiring a full reinit.
Definition at line 929 of file graph.c.
Referenced by ff_sws_graph_reinit().
Definition at line 937 of file graph.c.
Referenced by ff_sws_graph_run().
1.8.17