FFmpeg
uops_macros_gen.c
Go to the documentation of this file.
1 /**
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <string.h>
20 
21 #ifdef _WIN32
22 #include <io.h>
23 #include <fcntl.h>
24 #endif
25 
26 #include "libavutil/bprint.h"
27 #include "libavutil/error.h"
28 #include "libavutil/macros.h"
29 #include "libavutil/mem.h"
30 #include "libavutil/pixfmt.h"
31 #include "libavutil/tree.h"
32 #include "ops.h"
33 #include "ops_dispatch.h"
34 #include "op_list_gen_template.c"
35 #include "swscale.h"
36 #include "uops.h"
37 #include "uops_list.h"
38 
39 static const struct {
40  char full[32];
41  char abbr[32];
43 #define UOP_NAME(OP, ABBR) [OP] = { #OP, ABBR },
45 };
46 
47 static const struct {
48  char full[16];
49  char prefix[8];
51  [SWS_PIXEL_NONE] = { "SWS_PIXEL_NONE", "" },
52  [SWS_PIXEL_U8] = { "SWS_PIXEL_U8", "U8_" },
53  [SWS_PIXEL_U16] = { "SWS_PIXEL_U16", "U16_" },
54  [SWS_PIXEL_U32] = { "SWS_PIXEL_U32", "U32_" },
55  [SWS_PIXEL_F32] = { "SWS_PIXEL_F32", "F32_" },
56 };
57 
58 static int generate_entry_struct(void *opaque, void *key)
59 {
60  const SwsUOp *ref = opaque;
61  const SwsUOp *uop = key;
62  AVBPrint *bp = ref->data.opaque;
63  char name[SWS_UOP_NAME_MAX];
64  ff_sws_uop_name(uop, name);
65  av_bprintf(bp, " \\\n MACRO(__VA_ARGS__, %-40s", name);
66  av_bprintf(bp, ", .type = %-13s, .uop = %-24s, .mask = 0x%x",
67  pixel_types[uop->type].full, uop_names[uop->uop].full, uop->mask);
68 
69  const SwsUOpParams *par = &uop->par;
70  switch (uop->uop) {
74  av_bprintf(bp, ", .par.filter.type = %s", pixel_types[par->filter.type].full);
75  break;
76  case SWS_UOP_RW_SHUFFLE:
77  av_bprintf(bp, ", .par.shuffle.clear_value = 0x%x"
78  ", .par.shuffle.read_size = %u"
79  ", .par.shuffle.write_size = %u",
80  par->shuffle.clear_value,
81  par->shuffle.read_size, par->shuffle.write_size);
82  break;
83  case SWS_UOP_LSHIFT:
84  case SWS_UOP_RSHIFT:
85  av_bprintf(bp, ", .par.shift.amount = %u", par->shift.amount);
86  break;
87  case SWS_UOP_PERMUTE:
88  case SWS_UOP_COPY:
89  av_bprintf(bp, ", .par.move.num_moves = %d", par->move.num_moves);
90  av_bprintf(bp, ", .par.move.dst = {%d, %d, %d, %d, %d, %d}",
91  par->move.dst[0], par->move.dst[1], par->move.dst[2],
92  par->move.dst[3], par->move.dst[4], par->move.dst[5]);
93  av_bprintf(bp, ", .par.move.src = {%d, %d, %d, %d, %d, %d}",
94  par->move.src[0], par->move.src[1], par->move.src[2],
95  par->move.src[3], par->move.src[4], par->move.src[5]);
96  break;
97  case SWS_UOP_PACK:
98  case SWS_UOP_UNPACK:
99  av_bprintf(bp, ", .par.pack.pattern = {%d, %d, %d, %d}",
100  par->pack.pattern[0], par->pack.pattern[1],
101  par->pack.pattern[2], par->pack.pattern[3]);
102  break;
103  case SWS_UOP_CLEAR:
104  av_bprintf(bp, ", .par.clear.one = 0x%x, .par.clear.zero = 0x%x",
105  par->clear.one, par->clear.zero);
106  break;
107  case SWS_UOP_LINEAR:
108  case SWS_UOP_LINEAR_FMA:
109  av_bprintf(bp, ", .par.lin.one = 0x%x, .par.lin.zero = 0x%x",
110  par->lin.one, par->lin.zero);
111  if (uop->uop == SWS_UOP_LINEAR_FMA)
112  av_bprintf(bp, ", .par.lin.exact = 0x%x", par->lin.exact);
113  break;
114  case SWS_UOP_DITHER:
115  av_bprintf(bp, ", .par.dither = { .y_offset = {%u, %u, %u, %u}, .size_log2 = %u }",
116  par->dither.y_offset[0], par->dither.y_offset[1],
117  par->dither.y_offset[2], par->dither.y_offset[3],
118  par->dither.size_log2);
119  break;
120  case SWS_UOP_LUT_3D:
121  av_bprintf(bp, ", .par.lut3d.dynamic = %d", par->lut3d.dynamic);
122  break;
123  }
124 
125  av_bprintf(bp, ")");
126  return 0;
127 }
128 
129 static int generate_entry_args(void *opaque, void *key)
130 {
131  const SwsUOp *ref = opaque;
132  const SwsUOp *uop = key;
133  AVBPrint *bp = ref->data.opaque;
134  char name[SWS_UOP_NAME_MAX];
135  ff_sws_uop_name(uop, name);
136  av_bprintf(bp, " \\\n MACRO(__VA_ARGS__, %-40s, %-13s, %-24s, 0x%x",
137  name, pixel_types[uop->type].full, uop_names[uop->uop].full, uop->mask);
138 
139  const SwsUOpParams *par = &uop->par;
140  switch (uop->uop) {
144  av_bprintf(bp, ", %s", pixel_types[par->filter.type].full);
145  break;
146  case SWS_UOP_RW_SHUFFLE:
147  av_bprintf(bp, ", 0x%x, %u, %u", par->shuffle.clear_value,
148  par->shuffle.read_size, par->shuffle.write_size);
149  break;
150  case SWS_UOP_LSHIFT:
151  case SWS_UOP_RSHIFT:
152  av_bprintf(bp, ", %u", par->shift.amount);
153  break;
154  case SWS_UOP_PERMUTE:
155  case SWS_UOP_COPY:
156  av_bprintf(bp, ", %d", par->move.num_moves);
157  av_bprintf(bp, ", %d, %d, %d, %d, %d, %d",
158  par->move.dst[0], par->move.dst[1], par->move.dst[2],
159  par->move.dst[3], par->move.dst[4], par->move.dst[5]);
160  av_bprintf(bp, ", %d, %d, %d, %d, %d, %d",
161  par->move.src[0], par->move.src[1], par->move.src[2],
162  par->move.src[3], par->move.src[4], par->move.src[5]);
163  break;
164  case SWS_UOP_PACK:
165  case SWS_UOP_UNPACK:
166  av_bprintf(bp, ", %d, %d, %d, %d",
167  par->pack.pattern[0], par->pack.pattern[1],
168  par->pack.pattern[2], par->pack.pattern[3]);
169  break;
170  case SWS_UOP_CLEAR:
171  av_bprintf(bp, ", 0x%05x, 0x%05x", par->clear.one, par->clear.zero);
172  break;
173  case SWS_UOP_LINEAR:
174  case SWS_UOP_LINEAR_FMA:
175  av_bprintf(bp, ", 0x%05x, 0x%05x", par->lin.one, par->lin.zero);
176  if (uop->uop == SWS_UOP_LINEAR_FMA)
177  av_bprintf(bp, ", 0x%05x", par->lin.exact);
178  break;
179  case SWS_UOP_DITHER:
180  av_bprintf(bp, ", %u, %u, %u, %u, %u",
181  par->dither.y_offset[0], par->dither.y_offset[1],
182  par->dither.y_offset[2], par->dither.y_offset[3],
183  par->dither.size_log2);
184  break;
185  case SWS_UOP_LUT_3D:
186  av_bprintf(bp, ", %d", par->lut3d.dynamic);
187  break;
188  }
189 
190  av_bprintf(bp, ")");
191  return 0;
192 }
193 
194 static int register_uop(struct AVTreeNode **root, const SwsUOp *uop)
195 {
196  SwsUOp *key = av_memdup(uop, sizeof(*uop));
197  if (!key)
198  return AVERROR(ENOMEM);
199  memset(&key->data, 0, sizeof(key->data));
200 
201  struct AVTreeNode *node = av_tree_node_alloc();
202  if (!node) {
203  av_free(key);
204  return AVERROR(ENOMEM);
205  }
206 
207  av_tree_insert(root, key, ff_sws_uop_cmp_v, &node);
208  if (node) {
209  av_free(node);
210  av_free(key);
211  }
212  return 0;
213 }
214 
216 {
218  if (!uops)
219  return AVERROR(ENOMEM);
220 
221  int ret = ff_sws_ops_translate(ctx, ops, flags, uops);
222  if (ret < 0)
223  goto fail;
224 
225  struct AVTreeNode **root = ctx->opaque;
226  for (int i = 0; i < uops->num_ops; i++) {
227  ret = register_uop(root, &uops->ops[i]);
228  if (ret < 0)
229  goto fail;
230  }
231 
232 fail:
233  ff_sws_uop_list_free(&uops);
234  return ret;
235 }
236 
237 static const SwsUOpFlags uop_flags[] = {
238  0,
239  SWS_UOP_FLAG_PSHUFB | SWS_UOP_FLAG_FMA, /* x86 backend */
240 };
241 
242 static int register_uops(SwsContext *ctx, const SwsOpList *ops,
244 {
245  for (int i = 0; i < FF_ARRAY_ELEMS(uop_flags); i++) {
246  int ret = register_flags(ctx, ops, uop_flags[i]);
247  if (ret < 0)
248  return ret;
249  }
250 
251  *out = (SwsCompiledOp) {0}; /* dummy value, will be immediately freed */
252  return 0;
253 }
254 
255 /* Dummy backend that just registers all seen uops */
256 static const SwsOpBackend backend_uops = {
257  .name = "uops_gen",
258  .compile = register_uops,
259 };
260 
261 static int register_all_uops(SwsContext *ctx, void *graph, SwsOpList *ops)
262 {
263  /* ff_sws_compile_pass() takes over ownership of `ops` */
265  if (!copy)
266  return AVERROR(ENOMEM);
267 
269  return ff_sws_compile_pass(graph, &backend_uops, &copy, flags, NULL, NULL);
270 }
271 
272 static const SwsFlags flags_list[] = {
273  0,
274  SWS_ACCURATE_RND, /* may insert extra 1x1 dither ops (for accurate rounding) */
275  SWS_BITEXACT, /* prevents some FMA optimizations */
277 };
278 
279 /* Limit the range of av_tree_enumerate() to only matching uop and type */
280 static int enum_type(void *opaque, void *elem)
281 {
282  const SwsUOp *a = opaque, *b = elem;
283  if (a->type != b->type)
284  return (int) b->type - a->type;
285  if (a->uop != b->uop)
286  return (int) b->uop - a->uop;
287  return 0;
288 }
289 
290 static int free_uop_key(void *opaque, void *key)
291 {
292  av_free(key);
293  return 0;
294 }
295 
296 /**
297  * Generate a set of boilerplate C preprocessor macros for describing and
298  * programmatically iterating over all possible SwsUOps.
299  *
300  * This function can be quite slow as it iterates over every possible
301  * combination of pixel formats and flags.
302  *
303  * Returns 0 or a negative error code. On success, an allocated string is
304  * returned via `out_str`, and must be av_free()'d by the caller.
305  */
306 static int sws_uops_macros_gen(char **out_str)
307 {
308  int ret;
309  struct AVTreeNode *root = NULL;
310  SwsLut3D *lut3d = NULL;
311 
312  AVBPrint bprint, *const bp = &bprint;
314 
315  /* Allocate dummy graph and context for ff_sws_compile_pass() */
316  SwsGraph *graph = ff_sws_graph_alloc();
317  if (!graph)
318  return AVERROR(ENOMEM);
319 
320  SwsContext *ctx = graph->ctx = sws_alloc_context();
321  if (!ctx) {
322  ret = AVERROR(ENOMEM);
323  goto fail;
324  }
325 
326  /* Use this to plumb the tree state through all the layers of abstraction */
327  ctx->opaque = &root;
328  ctx->scaler = SWS_SCALE_BILINEAR; /* cheaper to generate filter kernels */
329 
330  /* Allocate dummy 3DLUT to force generation of SWS_UOP_LUT_3D */
331  lut3d = ff_sws_lut3d_alloc();
332  if (!lut3d) {
333  ret = AVERROR(ENOMEM);
334  goto fail;
335  }
336  ret = ff_sws_enum_op_lists(ctx, graph, lut3d, AV_PIX_FMT_NONE,
338  if (ret < 0)
339  goto fail;
340 
341  lut3d->dynamic = true;
342  ret = ff_sws_enum_op_lists(ctx, graph, lut3d, AV_PIX_FMT_NONE,
344  if (ret < 0)
345  goto fail;
346 
347  /* Register all unique uops over every relevant combination of flags */
348  for (int i = 0; i < FF_ARRAY_ELEMS(flags_list); i++) {
349  ctx->flags = flags_list[i];
352  if (ret < 0)
353  goto fail;
354  }
355 
356  #define BPRINT_STR(str) av_bprint_append_data(bp, str, strlen(str))
357  BPRINT_STR(
358 "/**\n"
359 " * This file is automatically generated. Do not edit manually.\n"
360 " * To regenerate, run: make fate-sws-uops-macros GEN=1\n"
361 " */\n"
362 "\n"
363 "#ifndef SWSCALE_UOPS_MACROS_H\n"
364 "#define SWSCALE_UOPS_MACROS_H\n"
365 "\n"
366 "/**\n"
367 " * Boilerplate helper macros, for template-based backends. These will be\n"
368 " * instantiated like this, with parameters in struct order:\n"
369 " * MACRO(__VA_ARGS__, NAME, UOP, TYPE, MASK, [PARAMS,])\n"
370 " * The _STRUCT variants pass all arguments in C struct syntax, while the\n"
371 " * plain variants give them as separate C values (e.g. for use in calls)\n"
372 " */\n"
373 "#define SWS_GLUE3(x, y, z) x ## _ ## y ## _ ## z\n"
374 "#define SWS_FOR(TYPE, UOP, MACRO, ...) \\\n"
375 " SWS_GLUE3(SWS_FOR, TYPE, UOP)(MACRO, __VA_ARGS__)\n"
376 "#define SWS_FOR_STRUCT(TYPE, UOP, MACRO, ...) \\\n"
377 " SWS_GLUE3(SWS_FOR_STRUCT, TYPE, UOP)(MACRO, __VA_ARGS__)\n"
378 "\n");
379 
380  SwsUOp key = { .data.opaque = bp };
381  for (key.type = SWS_PIXEL_NONE + 1; key.type < SWS_PIXEL_TYPE_NB; key.type++) {
382  for (key.uop = SWS_UOP_INVALID + 1; key.uop < SWS_UOP_TYPE_NB; key.uop++) {
383  const char *macro = uop_names[key.uop].full + sizeof("SWS_UOP_") - 1;
384  const char *prefix = pixel_types[key.type].prefix;
385  av_bprintf(bp, "#define SWS_FOR_%s%s(MACRO, ...)", prefix, macro);
387  av_bprintf(bp, "\n");
388  av_bprintf(bp, "#define SWS_FOR_STRUCT_%s%s(MACRO, ...)", prefix, macro);
390  av_bprintf(bp, "\n");
391  }
392  }
393 
394  BPRINT_STR("\n#endif /* SWSCALE_UOPS_MACROS_H */");
395  ret = av_bprint_finalize(bp, out_str);
396 
397 fail:
398  av_refstruct_unref(&lut3d);
401  av_tree_destroy(root);
402  ff_sws_graph_free(&graph);
404  return ret;
405 }
406 
407 int main(int argc, char **argv)
408 {
409 #ifdef _WIN32
410  _setmode(_fileno(stdout), _O_BINARY);
411 #endif
412 
413  char *macros = NULL;
414  int ret = sws_uops_macros_gen(&macros);
415  if (ret >= 0)
416  puts(macros);
417  av_free(macros);
418  return ret;
419 }
register_all_uops
static int register_all_uops(SwsContext *ctx, void *graph, SwsOpList *ops)
Definition: uops_macros_gen.c:261
SWS_UOP_RW_SHUFFLE
@ SWS_UOP_RW_SHUFFLE
Definition: uops.h:148
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
uop_flags
static const SwsUOpFlags uop_flags[]
Definition: uops_macros_gen.c:237
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
SwsGraph::ctx
SwsContext * ctx
Definition: graph.h:124
AVERROR
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
SwsLut3D::dynamic
bool dynamic
Definition: lut3d.h:52
SwsUOpParams::move
SwsMoveUOp move
Definition: uops.h:256
ff_sws_op_list_duplicate
SwsOpList * ff_sws_op_list_duplicate(const SwsOpList *ops)
Returns a duplicate of ops, or NULL on OOM.
Definition: ops.c:673
out
static FILE * out
Definition: movenc.c:55
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
ff_sws_uop_cmp_v
static int ff_sws_uop_cmp_v(const void *a, const void *b)
Definition: uops.h:289
SWS_UOP_RSHIFT
@ SWS_UOP_RSHIFT
Definition: uops.h:174
SWS_PIXEL_NONE
@ SWS_PIXEL_NONE
Definition: uops.h:40
av_tree_insert
void * av_tree_insert(AVTreeNode **tp, void *key, int(*cmp)(const void *key, const void *b), AVTreeNode **next)
Insert or remove an element.
Definition: tree.c:59
SWS_SCALE_BILINEAR
@ SWS_SCALE_BILINEAR
bilinear filtering
Definition: swscale.h:98
SwsClearUOp::zero
SwsCompMask zero
Definition: uops.h:220
enum_type
static int enum_type(void *opaque, void *elem)
Definition: uops_macros_gen.c:280
ops.h
AVTreeNode::elem
void * elem
Definition: tree.c:28
SWS_BITEXACT
@ SWS_BITEXACT
Definition: swscale.h:178
uops_list.h
b
#define b
Definition: input.c:43
SWS_UOP_LINEAR_FMA
@ SWS_UOP_LINEAR_FMA
Definition: uops.h:177
register_uop
static int register_uop(struct AVTreeNode **root, const SwsUOp *uop)
Definition: uops_macros_gen.c:194
ops_dispatch.h
av_tree_node_alloc
struct AVTreeNode * av_tree_node_alloc(void)
Allocate an AVTreeNode.
Definition: tree.c:34
ff_sws_enum_op_lists
static int ff_sws_enum_op_lists(SwsContext *ctx, void *opaque, const SwsLut3D *lut3d, 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 ...
Definition: op_list_gen_template.c:89
SWS_UOP_LSHIFT
@ SWS_UOP_LSHIFT
Definition: uops.h:173
SwsLinearUOp::one
uint32_t one
Definition: uops.h:224
key
const char * key
Definition: ffmpeg_mux_init.c:2971
SWS_UOP_TYPE_NB
@ SWS_UOP_TYPE_NB
Definition: uops.h:182
SwsOpBackend::name
const char * name
Definition: ops_dispatch.h:135
SWS_UOP_NAME_MAX
#define SWS_UOP_NAME_MAX
Generate a unique name for a SwsUOp.
Definition: uops.h:297
av_tree_enumerate
void av_tree_enumerate(AVTreeNode *t, void *opaque, int(*cmp)(void *opaque, void *elem), int(*enu)(void *opaque, void *elem))
Apply enu(opaque, &elem) to all the elements in the tree in a given range.
Definition: tree.c:155
ff_sws_graph_alloc
SwsGraph * ff_sws_graph_alloc(void)
Allocate an empty SwsGraph.
Definition: graph.c:815
SwsMoveUOp::num_moves
int num_moves
Definition: uops.h:207
av_memdup
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Definition: mem.c:302
BPRINT_STR
#define BPRINT_STR(str)
macros.h
SWS_UOP_PACK
@ SWS_UOP_PACK
Definition: uops.h:172
SwsShiftUOp::amount
uint8_t amount
Definition: uops.h:201
SWS_UOP_PERMUTE
@ SWS_UOP_PERMUTE
Definition: uops.h:151
SwsUOpParams::pack
SwsPackUOp pack
Definition: uops.h:257
register_flags
static int register_flags(SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags)
Definition: uops_macros_gen.c:215
SwsUOpParams
Definition: uops.h:252
SwsFilterUOp::type
SwsPixelType type
Definition: uops.h:197
SWS_UOP_COPY
@ SWS_UOP_COPY
Definition: uops.h:152
SWS_UOP_INVALID
@ SWS_UOP_INVALID
Definition: uops.h:130
pixel_types
static const struct @599 pixel_types[SWS_PIXEL_TYPE_NB]
register_uops
static int register_uops(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
Definition: uops_macros_gen.c:242
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
backend_uops
static const SwsOpBackend backend_uops
Definition: uops_macros_gen.c:256
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:504
SwsShuffleUOp::write_size
uint8_t write_size
Definition: uops.h:188
SwsFlags
SwsFlags
Definition: swscale.h:131
SwsUOp::uop
SwsUOpType uop
Definition: uops.h:267
SWS_UOP_FLAG_PSHUFB
@ SWS_UOP_FLAG_PSHUFB
Definition: uops.h:126
UOPS_LIST
#define UOPS_LIST(ENTRY)
This file is part of FFmpeg.
Definition: uops_list.h:23
AVFormatContext::flags
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1484
main
int main(int argc, char **argv)
Definition: uops_macros_gen.c:407
prefix
char prefix[8]
Definition: uops_macros_gen.c:49
ff_sws_lut3d_alloc
SwsLut3D * ff_sws_lut3d_alloc(void)
Allocates a refstruct.
Definition: lut3d.c:33
sws_uops_macros_gen
static int sws_uops_macros_gen(char **out_str)
Generate a set of boilerplate C preprocessor macros for describing and programmatically iterating ove...
Definition: uops_macros_gen.c:306
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
AVFormatContext::opaque
void * opaque
User data.
Definition: avformat.h:1897
SwsOpBackend
Definition: ops_dispatch.h:134
generate_entry_struct
static int generate_entry_struct(void *opaque, void *key)
Definition: uops_macros_gen.c:58
fail
#define fail
Definition: test.h:478
NULL
#define NULL
Definition: coverity.c:32
SWS_PIXEL_TYPE_NB
@ SWS_PIXEL_TYPE_NB
Definition: uops.h:45
SwsUOpParams::shift
SwsShiftUOp shift
Definition: uops.h:255
UOP_NAME
#define UOP_NAME(OP, ABBR)
abbr
char abbr[32]
Definition: uops_macros_gen.c:41
SwsShuffleUOp::read_size
uint8_t read_size
Definition: uops.h:187
SwsMoveUOp::dst
int8_t dst[SWS_UOP_MOVE_MAX]
Definition: uops.h:210
free_uop_key
static int free_uop_key(void *opaque, void *key)
Definition: uops_macros_gen.c:290
AVTreeNode
Definition: tree.c:26
SwsClearUOp::one
SwsCompMask one
Definition: uops.h:219
av_tree_destroy
void av_tree_destroy(AVTreeNode *t)
Definition: tree.c:146
SwsUOp::par
SwsUOpParams par
Definition: uops.h:269
error.h
uop_names
static const struct @598 uop_names[SWS_UOP_TYPE_NB]
This file is part of FFmpeg.
ff_sws_graph_free
void ff_sws_graph_free(SwsGraph **pgraph)
Uninitialize any state associate with this filter graph and free it.
Definition: graph.c:890
SwsUOp
Definition: uops.h:264
copy
static void copy(const float *p1, float *p2, const int length)
Definition: vf_vaguedenoiser.c:186
SWS_OP_FLAG_SPLIT_MEMCPY
@ SWS_OP_FLAG_SPLIT_MEMCPY
Definition: ops_dispatch.h:178
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:235
sws_alloc_context
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
Definition: utils.c:1032
SWS_UOP_READ_PLANAR_FV_FMA
@ SWS_UOP_READ_PLANAR_FV_FMA
Definition: uops.h:136
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
SwsLinearUOp::zero
uint32_t zero
Definition: uops.h:225
SwsUOp::mask
SwsCompMask mask
Definition: uops.h:268
SwsDitherUOp::size_log2
uint8_t size_log2
Definition: uops.h:239
SWS_UOP_UNPACK
@ SWS_UOP_UNPACK
Definition: uops.h:171
tree.h
SWS_PIXEL_U32
@ SWS_PIXEL_U32
Definition: uops.h:43
SwsShuffleUOp::clear_value
uint8_t clear_value
Definition: uops.h:186
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
ff_sws_uop_list_alloc
SwsUOpList * ff_sws_uop_list_alloc(void)
Definition: uops.c:203
av_refstruct_unref
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition: refstruct.c:120
SwsLut3D
Append a set of operations for applying a gamut/tone mapping 3D LUT to the pixels.
Definition: lut3d.h:50
bprint.h
flags_list
static const SwsFlags flags_list[]
Definition: uops_macros_gen.c:272
SWS_PIXEL_U8
@ SWS_PIXEL_U8
Definition: uops.h:41
SWS_UOP_LINEAR
@ SWS_UOP_LINEAR
Definition: uops.h:176
SwsUOpParams::lin
SwsLinearUOp lin
Definition: uops.h:259
SWS_UOP_LUT_3D
@ SWS_UOP_LUT_3D
Definition: uops.h:179
SwsPackUOp::pattern
uint8_t pattern[4]
Definition: uops.h:215
op_list_gen_template.c
SwsUOp::type
SwsPixelType type
Definition: uops.h:266
ff_sws_ops_translate
int ff_sws_ops_translate(SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags, SwsUOpList *uops)
Translate a list of operations down to micro-ops, which can be further optimized and then directly ex...
Definition: uops.c:677
ret
ret
Definition: filter_design.txt:187
pixfmt.h
SwsUOpList::num_ops
int num_ops
Definition: uops.h:302
SwsCompiledOp
Definition: ops_dispatch.h:101
ff_sws_uop_list_free
void ff_sws_uop_list_free(SwsUOpList **p_ops)
Definition: uops.c:189
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:122
SwsLut3DUOp::dynamic
int dynamic
Definition: uops.h:243
generate_entry_args
static int generate_entry_args(void *opaque, void *key)
Definition: uops_macros_gen.c:129
full
char full[32]
Definition: uops_macros_gen.c:40
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
SwsLinearUOp::exact
uint32_t exact
Definition: uops.h:228
ff_sws_uop_name
void ff_sws_uop_name(const SwsUOp *op, char buf[SWS_UOP_NAME_MAX])
Definition: uops.c:81
SwsDitherUOp::y_offset
uint8_t y_offset[4]
Definition: uops.h:238
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
SwsUOpList
Definition: uops.h:300
SwsUOpParams::lut3d
SwsLut3DUOp lut3d
Definition: uops.h:261
ff_sws_compile_pass
int ff_sws_compile_pass(SwsGraph *graph, const SwsOpBackend *backend, SwsOpList **pops, int flags, SwsPass *input, SwsPass **output)
Resolves an operation list to a graph pass.
Definition: ops_dispatch.c:751
SWS_UOP_DITHER
@ SWS_UOP_DITHER
Definition: uops.h:178
SwsUOpParams::dither
SwsDitherUOp dither
Definition: uops.h:260
mem.h
SwsGraph
Filter graph, which represents a 'baked' pixel format conversion.
Definition: graph.h:123
SWS_PIXEL_F32
@ SWS_PIXEL_F32
Definition: uops.h:44
SWS_UOP_READ_PLANAR_FV
@ SWS_UOP_READ_PLANAR_FV
Definition: uops.h:135
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
uops.h
SwsUOpFlags
uint32_t SwsUOpFlags
Definition: uops.h:122
SWS_UOP_READ_PLANAR_FH
@ SWS_UOP_READ_PLANAR_FH
Definition: uops.h:134
sws_free_context
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
Definition: utils.c:2323
SwsMoveUOp::src
int8_t src[SWS_UOP_MOVE_MAX]
Definition: uops.h:211
SwsUOpParams::filter
SwsFilterUOp filter
Definition: uops.h:254
SWS_UOP_FLAG_FMA
@ SWS_UOP_FLAG_FMA
Definition: uops.h:125
SWS_ACCURATE_RND
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition: swscale.h:177
SWS_UOP_CLEAR
@ SWS_UOP_CLEAR
Definition: uops.h:175
SwsOpList
Helper struct for representing a list of operations.
Definition: ops.h:293
SwsContext
Main external API structure.
Definition: swscale.h:227
SWS_PIXEL_U16
@ SWS_PIXEL_U16
Definition: uops.h:42
SWS_OP_FLAG_DRY_RUN
@ SWS_OP_FLAG_DRY_RUN
Definition: ops_dispatch.h:175
SwsUOpParams::clear
SwsClearUOp clear
Definition: uops.h:258
SwsUOpList::ops
SwsUOp * ops
Definition: uops.h:301
swscale.h
SwsUOpParams::shuffle
SwsShuffleUOp shuffle
Definition: uops.h:253