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/thread.h"
32 #include "libavutil/tree.h"
33 #include "ops.h"
34 #include "ops_dispatch.h"
35 #include "op_list_gen_template.c"
36 #include "swscale.h"
37 #include "uops.h"
38 #include "uops_list.h"
39 
40 static const struct {
41  char full[32];
42  char abbr[32];
44 #define UOP_NAME(OP, ABBR) [OP] = { #OP, ABBR },
46 };
47 
48 static const struct {
49  char full[16];
50  char prefix[8];
52  [SWS_PIXEL_NONE] = { "SWS_PIXEL_NONE", "" },
53  [SWS_PIXEL_U8] = { "SWS_PIXEL_U8", "U8_" },
54  [SWS_PIXEL_U16] = { "SWS_PIXEL_U16", "U16_" },
55  [SWS_PIXEL_U32] = { "SWS_PIXEL_U32", "U32_" },
56  [SWS_PIXEL_F32] = { "SWS_PIXEL_F32", "F32_" },
57 };
58 
59 static int generate_entry_struct(void *opaque, void *key)
60 {
61  const SwsUOp *ref = opaque;
62  const SwsUOp *uop = key;
63  AVBPrint *bp = ref->data.opaque;
64  char name[SWS_UOP_NAME_MAX];
65  ff_sws_uop_name(uop, name);
66  av_bprintf(bp, " \\\n MACRO(__VA_ARGS__, %-40s", name);
67  av_bprintf(bp, ", .type = %-13s, .uop = %-24s, .mask = 0x%x",
68  pixel_types[uop->type].full, uop_names[uop->uop].full, uop->mask);
69 
70  const SwsUOpParams *par = &uop->par;
71  switch (uop->uop) {
75  av_bprintf(bp, ", .par.filter.type = %s", pixel_types[par->filter.type].full);
76  break;
77  case SWS_UOP_RW_SHUFFLE:
78  av_bprintf(bp, ", .par.shuffle.clear_value = 0x%x"
79  ", .par.shuffle.read_size = %u"
80  ", .par.shuffle.write_size = %u",
81  par->shuffle.clear_value,
82  par->shuffle.read_size, par->shuffle.write_size);
83  break;
84  case SWS_UOP_LSHIFT:
85  case SWS_UOP_RSHIFT:
86  av_bprintf(bp, ", .par.shift.amount = %u", par->shift.amount);
87  break;
88  case SWS_UOP_PERMUTE:
89  case SWS_UOP_COPY:
90  av_bprintf(bp, ", .par.move.num_moves = %d", par->move.num_moves);
91  av_bprintf(bp, ", .par.move.dst = {%d, %d, %d, %d, %d, %d}",
92  par->move.dst[0], par->move.dst[1], par->move.dst[2],
93  par->move.dst[3], par->move.dst[4], par->move.dst[5]);
94  av_bprintf(bp, ", .par.move.src = {%d, %d, %d, %d, %d, %d}",
95  par->move.src[0], par->move.src[1], par->move.src[2],
96  par->move.src[3], par->move.src[4], par->move.src[5]);
97  break;
98  case SWS_UOP_PACK:
99  case SWS_UOP_UNPACK:
100  av_bprintf(bp, ", .par.pack.pattern = {%d, %d, %d, %d}",
101  par->pack.pattern[0], par->pack.pattern[1],
102  par->pack.pattern[2], par->pack.pattern[3]);
103  break;
104  case SWS_UOP_CLEAR:
105  av_bprintf(bp, ", .par.clear.one = 0x%x, .par.clear.zero = 0x%x",
106  par->clear.one, par->clear.zero);
107  break;
108  case SWS_UOP_LINEAR:
109  case SWS_UOP_LINEAR_FMA:
110  av_bprintf(bp, ", .par.lin.one = 0x%x, .par.lin.zero = 0x%x",
111  par->lin.one, par->lin.zero);
112  if (uop->uop == SWS_UOP_LINEAR_FMA)
113  av_bprintf(bp, ", .par.lin.exact = 0x%x", par->lin.exact);
114  break;
115  case SWS_UOP_DITHER:
116  av_bprintf(bp, ", .par.dither = { .y_offset = {%u, %u, %u, %u}, .size_log2 = %u }",
117  par->dither.y_offset[0], par->dither.y_offset[1],
118  par->dither.y_offset[2], par->dither.y_offset[3],
119  par->dither.size_log2);
120  break;
121  case SWS_UOP_LUT_3D:
122  av_bprintf(bp, ", .par.lut3d.dynamic = %d", par->lut3d.dynamic);
123  break;
124  }
125 
126  av_bprintf(bp, ")");
127  return 0;
128 }
129 
130 static int generate_entry_args(void *opaque, void *key)
131 {
132  const SwsUOp *ref = opaque;
133  const SwsUOp *uop = key;
134  AVBPrint *bp = ref->data.opaque;
135  char name[SWS_UOP_NAME_MAX];
136  ff_sws_uop_name(uop, name);
137  av_bprintf(bp, " \\\n MACRO(__VA_ARGS__, %-40s, %-13s, %-24s, 0x%x",
138  name, pixel_types[uop->type].full, uop_names[uop->uop].full, uop->mask);
139 
140  const SwsUOpParams *par = &uop->par;
141  switch (uop->uop) {
145  av_bprintf(bp, ", %s", pixel_types[par->filter.type].full);
146  break;
147  case SWS_UOP_RW_SHUFFLE:
148  av_bprintf(bp, ", 0x%x, %u, %u", par->shuffle.clear_value,
149  par->shuffle.read_size, par->shuffle.write_size);
150  break;
151  case SWS_UOP_LSHIFT:
152  case SWS_UOP_RSHIFT:
153  av_bprintf(bp, ", %u", par->shift.amount);
154  break;
155  case SWS_UOP_PERMUTE:
156  case SWS_UOP_COPY:
157  av_bprintf(bp, ", %d", par->move.num_moves);
158  av_bprintf(bp, ", %d, %d, %d, %d, %d, %d",
159  par->move.dst[0], par->move.dst[1], par->move.dst[2],
160  par->move.dst[3], par->move.dst[4], par->move.dst[5]);
161  av_bprintf(bp, ", %d, %d, %d, %d, %d, %d",
162  par->move.src[0], par->move.src[1], par->move.src[2],
163  par->move.src[3], par->move.src[4], par->move.src[5]);
164  break;
165  case SWS_UOP_PACK:
166  case SWS_UOP_UNPACK:
167  av_bprintf(bp, ", %d, %d, %d, %d",
168  par->pack.pattern[0], par->pack.pattern[1],
169  par->pack.pattern[2], par->pack.pattern[3]);
170  break;
171  case SWS_UOP_CLEAR:
172  av_bprintf(bp, ", 0x%05x, 0x%05x", par->clear.one, par->clear.zero);
173  break;
174  case SWS_UOP_LINEAR:
175  case SWS_UOP_LINEAR_FMA:
176  av_bprintf(bp, ", 0x%05x, 0x%05x", par->lin.one, par->lin.zero);
177  if (uop->uop == SWS_UOP_LINEAR_FMA)
178  av_bprintf(bp, ", 0x%05x", par->lin.exact);
179  break;
180  case SWS_UOP_DITHER:
181  av_bprintf(bp, ", %u, %u, %u, %u, %u",
182  par->dither.y_offset[0], par->dither.y_offset[1],
183  par->dither.y_offset[2], par->dither.y_offset[3],
184  par->dither.size_log2);
185  break;
186  case SWS_UOP_LUT_3D:
187  av_bprintf(bp, ", %d", par->lut3d.dynamic);
188  break;
189  }
190 
191  av_bprintf(bp, ")");
192  return 0;
193 }
194 
195 struct EnumPriv {
196  struct AVTreeNode *root;
198 };
199 
200 static int register_uop(struct EnumPriv *s, const SwsUOp *uop)
201 {
202  SwsUOp *key = av_memdup(uop, sizeof(*uop));
203  if (!key)
204  return AVERROR(ENOMEM);
205  memset(&key->data, 0, sizeof(key->data));
206 
207  struct AVTreeNode *node = av_tree_node_alloc();
208  if (!node) {
209  av_free(key);
210  return AVERROR(ENOMEM);
211  }
212 
213  ff_mutex_lock(&s->lock);
214  av_tree_insert(&s->root, key, ff_sws_uop_cmp_v, &node);
215  ff_mutex_unlock(&s->lock);
216  if (node) {
217  av_free(node);
218  av_free(key);
219  }
220  return 0;
221 }
222 
224 {
226  if (!uops)
227  return AVERROR(ENOMEM);
228 
229  int ret = ff_sws_ops_translate(ctx, ops, flags, uops);
230  if (ret < 0)
231  goto fail;
232 
233  for (int i = 0; i < uops->num_ops; i++) {
234  ret = register_uop(ctx->opaque, &uops->ops[i]);
235  if (ret < 0)
236  goto fail;
237  }
238 
239 fail:
240  ff_sws_uop_list_free(&uops);
241  return ret;
242 }
243 
244 static const SwsUOpFlags uop_flags[] = {
245  0,
246  SWS_UOP_FLAG_PSHUFB | SWS_UOP_FLAG_FMA, /* x86 backend */
247 };
248 
249 static int register_uops(SwsContext *ctx, const SwsOpList *ops,
251 {
252  for (int i = 0; i < FF_ARRAY_ELEMS(uop_flags); i++) {
253  int ret = register_flags(ctx, ops, uop_flags[i]);
254  if (ret < 0)
255  return ret;
256  }
257 
258  *out = (SwsCompiledOp) {0}; /* dummy value, will be immediately freed */
259  return 0;
260 }
261 
262 /* Dummy backend that just registers all seen uops */
263 static const SwsOpBackend backend_uops = {
264  .name = "uops_gen",
265  .compile = register_uops,
266 };
267 
268 static int register_all_uops(SwsContext *ctx, void *graph, SwsOpList *ops)
269 {
270  /* ff_sws_compile_pass() takes over ownership of `ops` */
272  if (!copy)
273  return AVERROR(ENOMEM);
274 
276  return ff_sws_compile_pass(graph, &backend_uops, &copy, flags, NULL, NULL);
277 }
278 
279 static const SwsFlags flags_list[] = {
280  0,
281  SWS_ACCURATE_RND, /* may insert extra 1x1 dither ops (for accurate rounding) */
282  SWS_BITEXACT, /* prevents some FMA optimizations */
284 };
285 
286 /* Limit the range of av_tree_enumerate() to only matching uop and type */
287 static int enum_type(void *opaque, void *elem)
288 {
289  const SwsUOp *a = opaque, *b = elem;
290  if (a->type != b->type)
291  return (int) b->type - a->type;
292  if (a->uop != b->uop)
293  return (int) b->uop - a->uop;
294  return 0;
295 }
296 
297 static int free_uop_key(void *opaque, void *key)
298 {
299  av_free(key);
300  return 0;
301 }
302 
303 /**
304  * Generate a set of boilerplate C preprocessor macros for describing and
305  * programmatically iterating over all possible SwsUOps.
306  *
307  * This function can be quite slow as it iterates over every possible
308  * combination of pixel formats and flags.
309  *
310  * Returns 0 or a negative error code. On success, an allocated string is
311  * returned via `out_str`, and must be av_free()'d by the caller.
312  */
313 static int sws_uops_macros_gen(char **out_str)
314 {
315  struct EnumPriv s = {0};
316  SwsLut3D *lut3d = NULL;
317  int ret = ff_mutex_init(&s.lock, NULL);
318  if (ret)
319  return AVERROR(ENOSYS);
320 
321  AVBPrint bprint, *const bp = &bprint;
323 
324  /* Allocate dummy graph and context for ff_sws_compile_pass() */
325  SwsGraph *graph = ff_sws_graph_alloc();
327  if (!graph || !ctx) {
328  ret = AVERROR(ENOMEM);
329  goto fail;
330  }
331 
332  /* Use this to plumb the enum state through all the layers of abstraction */
333  graph->ctx = ctx;
334  ctx->opaque = &s;
335  ctx->scaler = SWS_SCALE_BILINEAR; /* cheaper to generate filter kernels */
336  ctx->threads = 0; /* use slice threading to speed up tree building */
337 
338  /* Allocate dummy 3DLUT to force generation of SWS_UOP_LUT_3D */
339  lut3d = ff_sws_lut3d_alloc();
340  if (!lut3d) {
341  ret = AVERROR(ENOMEM);
342  goto fail;
343  }
344  ret = ff_sws_enum_op_lists(ctx, graph, lut3d, AV_PIX_FMT_NONE,
346  if (ret < 0)
347  goto fail;
348 
349  lut3d->dynamic = true;
350  ret = ff_sws_enum_op_lists(ctx, graph, lut3d, AV_PIX_FMT_NONE,
352  if (ret < 0)
353  goto fail;
354 
355  /* Register all unique uops over every relevant combination of flags */
356  for (int i = 0; i < FF_ARRAY_ELEMS(flags_list); i++) {
357  ctx->flags = flags_list[i];
360  if (ret < 0)
361  goto fail;
362  }
363 
364  #define BPRINT_STR(str) av_bprint_append_data(bp, str, strlen(str))
365  BPRINT_STR(
366 "/**\n"
367 " * This file is automatically generated. Do not edit manually.\n"
368 " * To regenerate, run: make fate-sws-uops-macros GEN=1\n"
369 " */\n"
370 "\n"
371 "#ifndef SWSCALE_UOPS_MACROS_H\n"
372 "#define SWSCALE_UOPS_MACROS_H\n"
373 "\n"
374 "/**\n"
375 " * Boilerplate helper macros, for template-based backends. These will be\n"
376 " * instantiated like this, with parameters in struct order:\n"
377 " * MACRO(__VA_ARGS__, NAME, UOP, TYPE, MASK, [PARAMS,])\n"
378 " * The _STRUCT variants pass all arguments in C struct syntax, while the\n"
379 " * plain variants give them as separate C values (e.g. for use in calls)\n"
380 " */\n"
381 "#define SWS_GLUE3(x, y, z) x ## _ ## y ## _ ## z\n"
382 "#define SWS_FOR(TYPE, UOP, MACRO, ...) \\\n"
383 " SWS_GLUE3(SWS_FOR, TYPE, UOP)(MACRO, __VA_ARGS__)\n"
384 "#define SWS_FOR_STRUCT(TYPE, UOP, MACRO, ...) \\\n"
385 " SWS_GLUE3(SWS_FOR_STRUCT, TYPE, UOP)(MACRO, __VA_ARGS__)\n"
386 "\n");
387 
388  SwsUOp key = { .data.opaque = bp };
389  for (key.type = SWS_PIXEL_NONE + 1; key.type < SWS_PIXEL_TYPE_NB; key.type++) {
390  for (key.uop = SWS_UOP_INVALID + 1; key.uop < SWS_UOP_TYPE_NB; key.uop++) {
391  const char *macro = uop_names[key.uop].full + sizeof("SWS_UOP_") - 1;
392  const char *prefix = pixel_types[key.type].prefix;
393  av_bprintf(bp, "#define SWS_FOR_%s%s(MACRO, ...)", prefix, macro);
395  av_bprintf(bp, "\n");
396  av_bprintf(bp, "#define SWS_FOR_STRUCT_%s%s(MACRO, ...)", prefix, macro);
398  av_bprintf(bp, "\n");
399  }
400  }
401 
402  BPRINT_STR("\n#endif /* SWSCALE_UOPS_MACROS_H */");
403  ret = av_bprint_finalize(bp, out_str);
404 
405 fail:
406  av_refstruct_unref(&lut3d);
409  av_tree_destroy(s.root);
410  ff_mutex_destroy(&s.lock);
411  ff_sws_graph_free(&graph);
413  return ret;
414 }
415 
416 int main(int argc, char **argv)
417 {
418 #ifdef _WIN32
419  _setmode(_fileno(stdout), _O_BINARY);
420 #endif
421 
422  char *macros = NULL;
423  int ret = sws_uops_macros_gen(&macros);
424  if (ret >= 0)
425  puts(macros);
426  av_free(macros);
427  return ret;
428 }
register_all_uops
static int register_all_uops(SwsContext *ctx, void *graph, SwsOpList *ops)
Definition: uops_macros_gen.c:268
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:244
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
ff_mutex_init
static int ff_mutex_init(AVMutex *mutex, const void *attr)
Definition: thread.h:187
SwsGraph::ctx
SwsContext * ctx
Definition: graph.h:133
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
thread.h
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:287
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
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:136
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:2985
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:866
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
ff_mutex_unlock
static int ff_mutex_unlock(AVMutex *mutex)
Definition: thread.h:189
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:223
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:249
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:263
AVMutex
#define AVMutex
Definition: thread.h:184
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:416
prefix
char prefix[8]
Definition: uops_macros_gen.c:50
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:313
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
AVFormatContext::opaque
void * opaque
User data.
Definition: avformat.h:1912
SwsOpBackend
Definition: ops_dispatch.h:134
generate_entry_struct
static int generate_entry_struct(void *opaque, void *key)
Definition: uops_macros_gen.c:59
fail
#define fail
Definition: test.h:479
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:42
SwsShuffleUOp::read_size
uint8_t read_size
Definition: uops.h:187
SwsMoveUOp::dst
int8_t dst[SWS_UOP_MOVE_MAX]
Definition: uops.h:210
EnumPriv::lock
AVMutex lock
Definition: uops_macros_gen.c:197
free_uop_key
static int free_uop_key(void *opaque, void *key)
Definition: uops_macros_gen.c:297
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_mutex_destroy
static int ff_mutex_destroy(AVMutex *mutex)
Definition: thread.h:190
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:942
SwsUOp
Definition: uops.h:264
EnumPriv::root
struct AVTreeNode * root
Definition: uops_macros_gen.c:196
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
EnumPriv
Definition: uops_macros_gen.c:195
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_mutex_lock
static int ff_mutex_lock(AVMutex *mutex)
Definition: thread.h:188
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
register_uop
static int register_uop(struct EnumPriv *s, const SwsUOp *uop)
Definition: uops_macros_gen.c:200
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:279
SWS_PIXEL_U8
@ SWS_PIXEL_U8
Definition: uops.h:41
s
uint8_t s
Definition: llvidencdsp.c:39
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:130
full
char full[32]
Definition: uops_macros_gen.c:41
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:781
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:132
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:2321
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