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_LSHIFT:
77  case SWS_UOP_RSHIFT:
78  av_bprintf(bp, ", .par.shift.amount = %u", par->shift.amount);
79  break;
80  case SWS_UOP_PERMUTE:
81  case SWS_UOP_COPY:
82  av_bprintf(bp, ", .par.swizzle.in = {%d, %d, %d, %d}",
83  par->swizzle.in[0], par->swizzle.in[1],
84  par->swizzle.in[2], par->swizzle.in[3]);
85  break;
86  case SWS_UOP_MOVE:
87  av_bprintf(bp, ", .par.move.num_moves = %d", par->move.num_moves);
88  av_bprintf(bp, ", .par.move.dst = {%d, %d, %d, %d, %d, %d}",
89  par->move.dst[0], par->move.dst[1], par->move.dst[2],
90  par->move.dst[3], par->move.dst[4], par->move.dst[5]);
91  av_bprintf(bp, ", .par.move.src = {%d, %d, %d, %d, %d, %d}",
92  par->move.src[0], par->move.src[1], par->move.src[2],
93  par->move.src[3], par->move.src[4], par->move.src[5]);
94  break;
95  case SWS_UOP_PACK:
96  case SWS_UOP_UNPACK:
97  av_bprintf(bp, ", .par.pack.pattern = {%d, %d, %d, %d}",
98  par->pack.pattern[0], par->pack.pattern[1],
99  par->pack.pattern[2], par->pack.pattern[3]);
100  break;
101  case SWS_UOP_CLEAR:
102  av_bprintf(bp, ", .par.clear.one = 0x%x, .par.clear.zero = 0x%x",
103  par->clear.one, par->clear.zero);
104  break;
105  case SWS_UOP_LINEAR:
106  case SWS_UOP_LINEAR_FMA:
107  av_bprintf(bp, ", .par.lin.one = 0x%x, .par.lin.zero = 0x%x",
108  par->lin.one, par->lin.zero);
109  if (uop->uop == SWS_UOP_LINEAR_FMA)
110  av_bprintf(bp, ", .par.lin.exact = 0x%x", par->lin.exact);
111  break;
112  case SWS_UOP_DITHER:
113  av_bprintf(bp, ", .par.dither = { .y_offset = {%u, %u, %u, %u}, .size_log2 = %u }",
114  par->dither.y_offset[0], par->dither.y_offset[1],
115  par->dither.y_offset[2], par->dither.y_offset[3],
116  par->dither.size_log2);
117  break;
118  }
119 
120  av_bprintf(bp, ")");
121  return 0;
122 }
123 
124 static int generate_entry_args(void *opaque, void *key)
125 {
126  const SwsUOp *ref = opaque;
127  const SwsUOp *uop = key;
128  AVBPrint *bp = ref->data.opaque;
129  char name[SWS_UOP_NAME_MAX];
130  ff_sws_uop_name(uop, name);
131  av_bprintf(bp, " \\\n MACRO(__VA_ARGS__, %-40s, %-13s, %-24s, 0x%x",
132  name, pixel_types[uop->type].full, uop_names[uop->uop].full, uop->mask);
133 
134  const SwsUOpParams *par = &uop->par;
135  switch (uop->uop) {
139  av_bprintf(bp, ", %s", pixel_types[par->filter.type].full);
140  break;
141  case SWS_UOP_LSHIFT:
142  case SWS_UOP_RSHIFT:
143  av_bprintf(bp, ", %u", par->shift.amount);
144  break;
145  case SWS_UOP_PERMUTE:
146  case SWS_UOP_COPY:
147  av_bprintf(bp, ", %d, %d, %d, %d",
148  par->swizzle.in[0], par->swizzle.in[1],
149  par->swizzle.in[2], par->swizzle.in[3]);
150  break;
151  case SWS_UOP_MOVE:
152  av_bprintf(bp, ", %d", par->move.num_moves);
153  av_bprintf(bp, ", %d, %d, %d, %d, %d, %d",
154  par->move.dst[0], par->move.dst[1], par->move.dst[2],
155  par->move.dst[3], par->move.dst[4], par->move.dst[5]);
156  av_bprintf(bp, ", %d, %d, %d, %d, %d, %d",
157  par->move.src[0], par->move.src[1], par->move.src[2],
158  par->move.src[3], par->move.src[4], par->move.src[5]);
159  break;
160  case SWS_UOP_PACK:
161  case SWS_UOP_UNPACK:
162  av_bprintf(bp, ", %d, %d, %d, %d",
163  par->pack.pattern[0], par->pack.pattern[1],
164  par->pack.pattern[2], par->pack.pattern[3]);
165  break;
166  case SWS_UOP_CLEAR:
167  av_bprintf(bp, ", 0x%05x, 0x%05x", par->clear.one, par->clear.zero);
168  break;
169  case SWS_UOP_LINEAR:
170  case SWS_UOP_LINEAR_FMA:
171  av_bprintf(bp, ", 0x%05x, 0x%05x", par->lin.one, par->lin.zero);
172  if (uop->uop == SWS_UOP_LINEAR_FMA)
173  av_bprintf(bp, ", 0x%05x", par->lin.exact);
174  break;
175  case SWS_UOP_DITHER:
176  av_bprintf(bp, ", %u, %u, %u, %u, %u",
177  par->dither.y_offset[0], par->dither.y_offset[1],
178  par->dither.y_offset[2], par->dither.y_offset[3],
179  par->dither.size_log2);
180  break;
181  }
182 
183  av_bprintf(bp, ")");
184  return 0;
185 }
186 
187 static int register_uop(struct AVTreeNode **root, const SwsUOp *uop)
188 {
189  SwsUOp *key = av_memdup(uop, sizeof(*uop));
190  if (!key)
191  return AVERROR(ENOMEM);
192  memset(&key->data, 0, sizeof(key->data));
193 
194  struct AVTreeNode *node = av_tree_node_alloc();
195  if (!node) {
196  av_free(key);
197  return AVERROR(ENOMEM);
198  }
199 
200  av_tree_insert(root, key, ff_sws_uop_cmp_v, &node);
201  if (node) {
202  av_free(node);
203  av_free(key);
204  }
205  return 0;
206 }
207 
209 {
211  if (!uops)
212  return AVERROR(ENOMEM);
213 
214  int ret = ff_sws_ops_translate(ctx, ops, flags, uops);
215  if (ret < 0)
216  goto fail;
217 
218  struct AVTreeNode **root = ctx->opaque;
219  for (int i = 0; i < uops->num_ops; i++) {
220  ret = register_uop(root, &uops->ops[i]);
221  if (ret < 0)
222  goto fail;
223  }
224 
225 fail:
226  ff_sws_uop_list_free(&uops);
227  return ret;
228 }
229 
230 static const SwsUOpFlags uop_flags[] = {
231  0,
232  SWS_UOP_FLAG_FMA | SWS_UOP_FLAG_MOVE, /* x86 backend */
233 };
234 
235 static int register_uops(SwsContext *ctx, const SwsOpList *ops,
237 {
238  for (int i = 0; i < FF_ARRAY_ELEMS(uop_flags); i++) {
239  int ret = register_flags(ctx, ops, uop_flags[i]);
240  if (ret < 0)
241  return ret;
242  }
243 
244  *out = (SwsCompiledOp) {0}; /* dummy value, will be immediately freed */
245  return 0;
246 }
247 
248 /* Dummy backend that just registers all seen uops */
249 static const SwsOpBackend backend_uops = {
250  .name = "uops_gen",
251  .compile = register_uops,
252 };
253 
254 static int register_all_uops(SwsContext *ctx, void *graph, SwsOpList *ops)
255 {
256  /* ff_sws_compile_pass() takes over ownership of `ops` */
258  if (!copy)
259  return AVERROR(ENOMEM);
260 
262  return ff_sws_compile_pass(graph, &backend_uops, &copy, flags, NULL, NULL);
263 }
264 
265 static const SwsFlags flags_list[] = {
266  0,
267  SWS_ACCURATE_RND, /* may insert extra 1x1 dither ops (for accurate rounding) */
268  SWS_BITEXACT, /* prevents some FMA optimizations */
270 };
271 
272 /* Limit the range of av_tree_enumerate() to only matching uop and type */
273 static int enum_type(void *opaque, void *elem)
274 {
275  const SwsUOp *a = opaque, *b = elem;
276  if (a->type != b->type)
277  return (int) b->type - a->type;
278  if (a->uop != b->uop)
279  return (int) b->uop - a->uop;
280  return 0;
281 }
282 
283 static int free_uop_key(void *opaque, void *key)
284 {
285  av_free(key);
286  return 0;
287 }
288 
289 /**
290  * Generate a set of boilerplate C preprocessor macros for describing and
291  * programmatically iterating over all possible SwsUOps.
292  *
293  * This function can be quite slow as it iterates over every possible
294  * combination of pixel formats and flags.
295  *
296  * Returns 0 or a negative error code. On success, an allocated string is
297  * returned via `out_str`, and must be av_free()'d by the caller.
298  */
299 static int sws_uops_macros_gen(char **out_str)
300 {
301  int ret;
302  struct AVTreeNode *root = NULL;
303 
304  AVBPrint bprint, *const bp = &bprint;
306 
307  /* Allocate dummy graph and context for ff_sws_compile_pass() */
308  SwsGraph *graph = ff_sws_graph_alloc();
309  if (!graph)
310  return AVERROR(ENOMEM);
311 
312  SwsContext *ctx = graph->ctx = sws_alloc_context();
313  if (!ctx) {
314  ret = AVERROR(ENOMEM);
315  goto fail;
316  }
317 
318  /* Use this to plumb the tree state through all the layers of abstraction */
319  ctx->opaque = &root;
320  ctx->scaler = SWS_SCALE_BILINEAR; /* cheaper to generate filter kernels */
321 
322  /* Register all unique uops over every relevant combination of flags */
323  for (int i = 0; i < FF_ARRAY_ELEMS(flags_list); i++) {
324  ctx->flags = flags_list[i];
327  if (ret < 0)
328  goto fail;
329  }
330 
331  /**
332  * Additionally make sure planar reads/writes are always available for all
333  * formats, because checkasm depends on them to be able to verify the
334  * input/output of any other operations.
335  */
338  continue;
339  for (int elems = 1; elems <= 4; elems++) {
340  for (int rw = 0; rw < 2; rw++) {
341  SwsUOp uop = {
342  .type = type,
344  .mask = SWS_COMP_ELEMS(elems),
345  };
346 
347  ret = register_uop(&root, &uop);
348  if (ret < 0)
349  goto fail;
350  }
351  }
352  }
353 
354  #define BPRINT_STR(str) av_bprint_append_data(bp, str, strlen(str))
355  BPRINT_STR(
356 "/**\n"
357 " * This file is automatically generated. Do not edit manually.\n"
358 " * To regenerate, run: make fate-sws-uops-macros GEN=1\n"
359 " */\n"
360 "\n"
361 "#ifndef SWSCALE_UOPS_MACROS_H\n"
362 "#define SWSCALE_UOPS_MACROS_H\n"
363 "\n"
364 "/**\n"
365 " * Boilerplate helper macros, for template-based backends. These will be\n"
366 " * instantiated like this, with parameters in struct order:\n"
367 " * MACRO(__VA_ARGS__, NAME, UOP, TYPE, MASK, [PARAMS,])\n"
368 " * The _STRUCT variants pass all arguments in C struct syntax, while the\n"
369 " * plain variants give them as separate C values (e.g. for use in calls)\n"
370 " */\n"
371 "#define SWS_GLUE3(x, y, z) x ## _ ## y ## _ ## z\n"
372 "#define SWS_FOR(TYPE, UOP, MACRO, ...) \\\n"
373 " SWS_GLUE3(SWS_FOR, TYPE, UOP)(MACRO, __VA_ARGS__)\n"
374 "#define SWS_FOR_STRUCT(TYPE, UOP, MACRO, ...) \\\n"
375 " SWS_GLUE3(SWS_FOR_STRUCT, TYPE, UOP)(MACRO, __VA_ARGS__)\n"
376 "\n");
377 
378  SwsUOp key = { .data.opaque = bp };
379  for (key.type = SWS_PIXEL_NONE + 1; key.type < SWS_PIXEL_TYPE_NB; key.type++) {
380  for (key.uop = SWS_UOP_INVALID + 1; key.uop < SWS_UOP_TYPE_NB; key.uop++) {
381  const char *macro = uop_names[key.uop].full + sizeof("SWS_UOP_") - 1;
382  const char *prefix = pixel_types[key.type].prefix;
383  av_bprintf(bp, "#define SWS_FOR_%s%s(MACRO, ...)", prefix, macro);
385  av_bprintf(bp, "\n");
386  av_bprintf(bp, "#define SWS_FOR_STRUCT_%s%s(MACRO, ...)", prefix, macro);
388  av_bprintf(bp, "\n");
389  }
390  }
391 
392  BPRINT_STR("\n#endif /* SWSCALE_UOPS_MACROS_H */");
393  ret = av_bprint_finalize(bp, out_str);
394 
395 fail:
398  av_tree_destroy(root);
399  ff_sws_graph_free(&graph);
401  return ret;
402 }
403 
404 int main(int argc, char **argv)
405 {
406 #ifdef _WIN32
407  _setmode(_fileno(stdout), _O_BINARY);
408 #endif
409 
410  char *macros = NULL;
411  int ret = sws_uops_macros_gen(&macros);
412  if (ret >= 0)
413  puts(macros);
414  av_free(macros);
415  return ret;
416 }
flags
const SwsFlags flags[]
Definition: swscale.c:85
register_all_uops
static int register_all_uops(SwsContext *ctx, void *graph, SwsOpList *ops)
Definition: uops_macros_gen.c:254
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
uop_flags
static const SwsUOpFlags uop_flags[]
Definition: uops_macros_gen.c:230
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:123
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
SwsUOpParams::move
SwsMoveUOp move
Definition: uops.h:214
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:663
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:244
SWS_UOP_RSHIFT
@ SWS_UOP_RSHIFT
Definition: uops.h:144
SWS_PIXEL_NONE
@ SWS_PIXEL_NONE
Definition: uops.h:39
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:182
enum_type
static int enum_type(void *opaque, void *elem)
Definition: uops_macros_gen.c:273
ops.h
AVTreeNode::elem
void * elem
Definition: tree.c:28
SWS_BITEXACT
@ SWS_BITEXACT
Definition: swscale.h:180
uops_list.h
b
#define b
Definition: input.c:43
SWS_UOP_LINEAR_FMA
@ SWS_UOP_LINEAR_FMA
Definition: uops.h:147
register_uop
static int register_uop(struct AVTreeNode **root, const SwsUOp *uop)
Definition: uops_macros_gen.c:187
ops_dispatch.h
av_tree_node_alloc
struct AVTreeNode * av_tree_node_alloc(void)
Allocate an AVTreeNode.
Definition: tree.c:34
SwsUOpParams::swizzle
SwsSwizzleUOp swizzle
Definition: uops.h:213
SWS_UOP_LSHIFT
@ SWS_UOP_LSHIFT
Definition: uops.h:143
SwsLinearUOp::one
uint32_t one
Definition: uops.h:186
SWS_UOP_TYPE_NB
@ SWS_UOP_TYPE_NB
Definition: uops.h:151
SwsOpBackend::name
const char * name
Definition: ops_dispatch.h:134
SWS_UOP_NAME_MAX
#define SWS_UOP_NAME_MAX
Generate a unique name for a SwsUOp.
Definition: uops.h:252
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:817
SwsMoveUOp::num_moves
int num_moves
Definition: uops.h:169
av_memdup
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Definition: mem.c:304
BPRINT_STR
#define BPRINT_STR(str)
macros.h
SWS_UOP_PACK
@ SWS_UOP_PACK
Definition: uops.h:142
SwsShiftUOp::amount
uint8_t amount
Definition: uops.h:159
SWS_UOP_PERMUTE
@ SWS_UOP_PERMUTE
Definition: uops.h:120
SwsUOpParams::pack
SwsPackUOp pack
Definition: uops.h:215
ff_sws_pixel_type_is_int
bool ff_sws_pixel_type_is_int(SwsPixelType type)
Definition: ops.c:92
register_flags
static int register_flags(SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags)
Definition: uops_macros_gen.c:208
type
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 type
Definition: writing_filters.txt:86
SwsUOpParams
Definition: uops.h:210
SWS_COMP_ELEMS
#define SWS_COMP_ELEMS(N)
Definition: uops.h:73
SwsFilterUOp::type
SwsPixelType type
Definition: uops.h:155
SWS_UOP_COPY
@ SWS_UOP_COPY
Definition: uops.h:121
SWS_UOP_INVALID
@ SWS_UOP_INVALID
Definition: uops.h:102
register_uops
static int register_uops(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
Definition: uops_macros_gen.c:235
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:249
SWS_UOP_MOVE
@ SWS_UOP_MOVE
Definition: uops.h:122
SwsFlags
SwsFlags
Definition: swscale.h:133
ff_sws_enum_op_lists
static 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 ...
Definition: op_list_gen_template.c:89
SwsUOp::uop
SwsUOpType uop
Definition: uops.h:224
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:1465
pixel_types
static const struct @591 pixel_types[SWS_PIXEL_TYPE_NB]
main
int main(int argc, char **argv)
Definition: uops_macros_gen.c:404
SWS_UOP_WRITE_PLANAR
@ SWS_UOP_WRITE_PLANAR
Definition: uops.h:114
prefix
char prefix[8]
Definition: uops_macros_gen.c:49
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:299
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
AVFormatContext::opaque
void * opaque
User data.
Definition: avformat.h:1878
key
const char * key
Definition: hwcontext_opencl.c:189
SwsOpBackend
Definition: ops_dispatch.h:133
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:44
SwsUOpParams::shift
SwsShiftUOp shift
Definition: uops.h:212
UOP_NAME
#define UOP_NAME(OP, ABBR)
abbr
char abbr[32]
Definition: uops_macros_gen.c:41
SwsMoveUOp::dst
int8_t dst[SWS_UOP_MOVE_MAX]
Definition: uops.h:172
free_uop_key
static int free_uop_key(void *opaque, void *key)
Definition: uops_macros_gen.c:283
AVTreeNode
Definition: tree.c:26
SwsClearUOp::one
SwsCompMask one
Definition: uops.h:181
SWS_UOP_FLAG_MOVE
@ SWS_UOP_FLAG_MOVE
Definition: uops.h:98
uop_names
static const struct @590 uop_names[SWS_UOP_TYPE_NB]
This file is part of FFmpeg.
av_tree_destroy
void av_tree_destroy(AVTreeNode *t)
Definition: tree.c:146
SwsPixelType
SwsPixelType
Definition: uops.h:38
SwsUOp::par
SwsUOpParams par
Definition: uops.h:226
error.h
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:221
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:173
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:1043
SWS_UOP_READ_PLANAR_FV_FMA
@ SWS_UOP_READ_PLANAR_FV_FMA
Definition: uops.h:108
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
SwsLinearUOp::zero
uint32_t zero
Definition: uops.h:187
SwsUOp::mask
SwsCompMask mask
Definition: uops.h:225
SwsDitherUOp::size_log2
uint8_t size_log2
Definition: uops.h:201
SWS_UOP_UNPACK
@ SWS_UOP_UNPACK
Definition: uops.h:141
tree.h
SWS_PIXEL_U32
@ SWS_PIXEL_U32
Definition: uops.h:42
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:204
bprint.h
flags_list
static const SwsFlags flags_list[]
Definition: uops_macros_gen.c:265
SWS_UOP_READ_PLANAR
@ SWS_UOP_READ_PLANAR
Definition: uops.h:105
SWS_PIXEL_U8
@ SWS_PIXEL_U8
Definition: uops.h:40
SWS_UOP_LINEAR
@ SWS_UOP_LINEAR
Definition: uops.h:146
SwsUOpParams::lin
SwsLinearUOp lin
Definition: uops.h:217
SwsPackUOp::pattern
uint8_t pattern[4]
Definition: uops.h:177
op_list_gen_template.c
SwsUOp::type
SwsPixelType type
Definition: uops.h:223
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:685
ret
ret
Definition: filter_design.txt:187
pixfmt.h
SwsUOpList::num_ops
int num_ops
Definition: uops.h:257
SwsCompiledOp
Definition: ops_dispatch.h:100
ff_sws_uop_list_free
void ff_sws_uop_list_free(SwsUOpList **p_ops)
Definition: uops.c:190
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:122
generate_entry_args
static int generate_entry_args(void *opaque, void *key)
Definition: uops_macros_gen.c:124
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:190
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:200
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
SwsUOpList
Definition: uops.h:255
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:148
SwsUOpParams::dither
SwsDitherUOp dither
Definition: uops.h:218
mem.h
SwsGraph
Filter graph, which represents a 'baked' pixel format conversion.
Definition: graph.h:122
SWS_PIXEL_F32
@ SWS_PIXEL_F32
Definition: uops.h:43
SWS_UOP_READ_PLANAR_FV
@ SWS_UOP_READ_PLANAR_FV
Definition: uops.h:107
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
uops.h
SwsUOpFlags
uint32_t SwsUOpFlags
Definition: uops.h:94
SWS_UOP_READ_PLANAR_FH
@ SWS_UOP_READ_PLANAR_FH
Definition: uops.h:106
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:2381
SwsMoveUOp::src
int8_t src[SWS_UOP_MOVE_MAX]
Definition: uops.h:173
SwsUOpParams::filter
SwsFilterUOp filter
Definition: uops.h:211
SWS_UOP_FLAG_FMA
@ SWS_UOP_FLAG_FMA
Definition: uops.h:97
SWS_ACCURATE_RND
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition: swscale.h:179
SWS_UOP_CLEAR
@ SWS_UOP_CLEAR
Definition: uops.h:145
SwsOpList
Helper struct for representing a list of operations.
Definition: ops.h:265
SwsContext
Main external API structure.
Definition: swscale.h:229
SWS_PIXEL_U16
@ SWS_PIXEL_U16
Definition: uops.h:41
SWS_OP_FLAG_DRY_RUN
@ SWS_OP_FLAG_DRY_RUN
Definition: ops_dispatch.h:170
SwsSwizzleUOp::in
uint8_t in[4]
Definition: uops.h:163
SwsUOpParams::clear
SwsClearUOp clear
Definition: uops.h:216
SwsUOpList::ops
SwsUOp * ops
Definition: uops.h:256
swscale.h