FFmpeg
sws_ops_aarch64.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 Ramiro Polla
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdio.h>
22 
23 #include "libavutil/avassert.h"
24 #include "libavutil/bprint.h"
25 #include "libavutil/mem.h"
26 #include "libavutil/tree.h"
27 #include "libswscale/graph.h"
28 #include "libswscale/ops.h"
29 #include "libswscale/ops_chain.h"
32 
34 
35 #ifdef _WIN32
36 #include <io.h>
37 #include <fcntl.h>
38 #endif
39 
40 /*********************************************************************/
41 static uint16_t clear_to_mask(const SwsClearUOp *clear)
42 {
43  uint16_t mask = 0;
44  for (int i = 0; i < 4; i++) {
45  if (clear->zero & SWS_COMP(i)) {
46  /* no-op */
47  } else if (clear->one & SWS_COMP(i)) {
48  NIBBLE_SET(mask, i, 1);
49  } else {
50  NIBBLE_SET(mask, i, 0xf);
51  }
52  }
53  return mask;
54 }
55 
56 static uint64_t move_to_mask(const SwsMoveUOp *move)
57 {
58  uint64_t mask = 0;
59  for (int i = 0; i < move->num_moves; i++) {
60  uint8_t dst = move->dst[i] < 0 ? 0xf : move->dst[i];
61  uint8_t src = move->src[i] < 0 ? 0xf : move->src[i];
62  uint64_t pair = src | (dst << 4);
63  mask |= pair << (i * 8);
64  }
65  return mask;
66 }
67 
68 static uint16_t pack_to_mask(const SwsPackUOp *pack)
69 {
70  uint16_t mask = 0;
71  for (int i = 0; i < 4; i++)
72  NIBBLE_SET(mask, i, pack->pattern[i]);
73  return mask;
74 }
75 
76 static uint64_t linear_to_mask(const SwsLinearUOp *linear)
77 {
78  uint64_t mask = 0;
79  for (int i = 0; i < 4; i++) {
80  for (int j = 0; j < 5; j++) {
81  int jj = (j == 0) ? 4 : (j - 1);
82  if (linear->one & SWS_MASK(i, jj))
83  mask |= 1ULL << (2 * ((5 * i + j)));
84  else if (!(linear->zero & SWS_MASK(i, jj)))
85  mask |= 3ULL << (2 * ((5 * i + j)));
86  }
87  }
88  return mask;
89 }
90 
92 {
93  uint16_t mask = 0;
94  for (int i = 0; i < 4; i++) {
95  if (p->mask & SWS_COMP(i)) {
96  NIBBLE_SET(mask, i, dither->y_offset[i]);
97  } else {
98  NIBBLE_SET(mask, i, 0xf);
99  }
100  }
101  return mask;
102 }
103 
104 static int aarch64_op_impl_cmp(const void *a, const void *b)
105 {
106  const SwsAArch64OpImplParams *pa = (const SwsAArch64OpImplParams *) a;
107  const SwsAArch64OpImplParams *pb = (const SwsAArch64OpImplParams *) b;
108  const SwsUOpParams *para = &pa->par;
109  const SwsUOpParams *parb = &pb->par;
110 
111  if (pa->uop != pb->uop)
112  return (int) pa->uop - pb->uop;
113 
114  switch (pa->uop) {
115  case SWS_UOP_PERMUTE:
116  case SWS_UOP_COPY: {
117  uint64_t ia = move_to_mask(&para->move);
118  uint64_t ib = move_to_mask(&parb->move);
119  if (ia != ib)
120  return (int64_t) (ia - ib) < 0 ? -1 : 1;
121  break;
122  }
123  case SWS_UOP_UNPACK:
124  case SWS_UOP_PACK: {
125  uint16_t ia = pack_to_mask(&para->pack);
126  uint16_t ib = pack_to_mask(&parb->pack);
127  if (ia != ib)
128  return (int) ia - ib;
129  break;
130  }
131  case SWS_UOP_LSHIFT:
132  case SWS_UOP_RSHIFT:
133  if (para->shift.amount != parb->shift.amount)
134  return (int) para->shift.amount - parb->shift.amount;
135  break;
136  case SWS_UOP_CLEAR: {
137  uint16_t ia = clear_to_mask(&para->clear);
138  uint16_t ib = clear_to_mask(&parb->clear);
139  if (ia != ib)
140  return (int) ia - ib;
141  break;
142  }
143  case SWS_UOP_LINEAR:
144  case SWS_UOP_LINEAR_FMA: {
145  uint64_t ia = linear_to_mask(&para->lin);
146  uint64_t ib = linear_to_mask(&parb->lin);
147  if (ia != ib)
148  return (int64_t) (ia - ib) < 0 ? -1 : 1;
149  break;
150  }
151  case SWS_UOP_DITHER: {
152  uint16_t ia = dither_to_mask(pa, &para->dither);
153  uint16_t ib = dither_to_mask(pb, &parb->dither);
154  if (ia != ib)
155  return (int) ia - ib;
156  if (para->dither.size_log2 != parb->dither.size_log2)
157  return (int) para->dither.size_log2 - parb->dither.size_log2;
158  break;
159  }
160  }
161 
162  if (pa->block_size != pb->block_size)
163  return (int) pa->block_size - pb->block_size;
164  if (pa->type != pb->type)
165  return (int) pa->type - pb->type;
166  if (pa->mask != pb->mask)
167  return (int) pa->mask - pb->mask;
168 
169  return 0;
170 }
171 
172 /*********************************************************************/
173 /* Insert the SwsAArch64OpImplParams structure into the AVTreeNode. */
175 {
176  int ret = 0;
177 
178  struct AVTreeNode *node = av_tree_node_alloc();
180  if (!node || !copy) {
181  ret = AVERROR(ENOMEM);
182  goto error;
183  }
184  av_tree_insert(root, copy, aarch64_op_impl_cmp, &node);
185  if (!node)
186  copy = NULL;
187 
188 error:
189  av_free(node);
190  av_free(copy);
191  return ret;
192 }
193 
194 static int collect_ops_compile(SwsContext *ctx, const SwsOpList *ops,
196 {
197  struct AVTreeNode **root = (struct AVTreeNode **) ctx->opaque;
198  int ret;
199 
200  /* Use at most two full vregs during the widest precision section */
201  int block_size = (ff_sws_op_list_max_size(ops) == 4) ? 8 : 16;
202 
203  for (int i = 0; i < ops->num_ops; i++) {
205  ret = convert_to_aarch64_impl(ctx, ops, i, block_size, &params);
206  if (ret == AVERROR(ENOTSUP))
207  continue;
208  if (ret < 0)
209  goto end;
210  ret = aarch64_collect_op(&params, root);
211  if (ret < 0)
212  goto end;
213  if (params.uop == SWS_UOP_LINEAR_FMA) {
214  /**
215  * Generate both sets of linear op functions that do use
216  * and do not use fmla (selected by SWS_BITEXACT).
217  */
219  ret = aarch64_collect_op(&params, root);
220  if (ret < 0)
221  goto end;
222  }
223  }
224 
225  *out = (SwsCompiledOp) { 0 };
226  ret = 0;
227 
228 end:
229  return ret;
230 }
231 
233  .name = "collect_ops",
234  .compile = collect_ops_compile,
235 };
236 
237 /*********************************************************************/
238 static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops)
239 {
240  /* Skip ops lists which include filtering, since this is still not
241  * supported. */
242  for (int i = 0; i < ops->num_ops; i++) {
243  const SwsOp *op = &ops->ops[i];
244  switch (op->op) {
245  case SWS_OP_READ:
246  case SWS_OP_WRITE:
247  if (op->rw.filter.op)
248  return 0;
249  break;
250  case SWS_OP_FILTER_H:
251  case SWS_OP_FILTER_V:
252  return 0;
253  }
254  }
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(opaque, &backend_collect, &copy, flags, NULL, NULL);
263 }
264 
265 /*********************************************************************/
266 static const char op_type_names[SWS_UOP_TYPE_NB][16] = {
267  [SWS_UOP_READ_BIT ] = "read_bit",
268  [SWS_UOP_READ_NIBBLE ] = "read_nibble",
269  [SWS_UOP_READ_PACKED ] = "read_packed",
270  [SWS_UOP_READ_PLANAR ] = "read_planar",
271  [SWS_UOP_WRITE_BIT ] = "write_bit",
272  [SWS_UOP_WRITE_NIBBLE ] = "write_nibble",
273  [SWS_UOP_WRITE_PACKED ] = "write_packed",
274  [SWS_UOP_WRITE_PLANAR ] = "write_planar",
275  [SWS_UOP_SWAP_BYTES ] = "swap_bytes",
276  [SWS_UOP_PERMUTE ] = "permute",
277  [SWS_UOP_COPY ] = "copy",
278  [SWS_UOP_UNPACK ] = "unpack",
279  [SWS_UOP_PACK ] = "pack",
280  [SWS_UOP_LSHIFT ] = "lshift",
281  [SWS_UOP_RSHIFT ] = "rshift",
282  [SWS_UOP_CLEAR ] = "clear",
283  [SWS_UOP_TO_U8 ] = "to_u8",
284  [SWS_UOP_TO_U16 ] = "to_u16",
285  [SWS_UOP_TO_U32 ] = "to_u32",
286  [SWS_UOP_TO_F32 ] = "to_f32",
287  [SWS_UOP_EXPAND_PAIR ] = "expand_pair",
288  [SWS_UOP_EXPAND_QUAD ] = "expand_quad",
289  [SWS_UOP_MIN ] = "min",
290  [SWS_UOP_MAX ] = "max",
291  [SWS_UOP_SCALE ] = "scale",
292  [SWS_UOP_LINEAR ] = "linear",
293  [SWS_UOP_LINEAR_FMA ] = "linear_fma",
294  [SWS_UOP_DITHER ] = "dither",
295 };
296 
297 static const char pixel_type_names[SWS_PIXEL_TYPE_NB][4] = {
298  [SWS_PIXEL_U8 ] = "u8",
299  [SWS_PIXEL_U16] = "u16",
300  [SWS_PIXEL_U32] = "u32",
301  [SWS_PIXEL_F32] = "f32",
302 };
303 
304 static const char uop_types[SWS_UOP_TYPE_NB][32] = {
305  [SWS_UOP_READ_BIT ] = "SWS_UOP_READ_BIT",
306  [SWS_UOP_READ_NIBBLE ] = "SWS_UOP_READ_NIBBLE",
307  [SWS_UOP_READ_PACKED ] = "SWS_UOP_READ_PACKED",
308  [SWS_UOP_READ_PLANAR ] = "SWS_UOP_READ_PLANAR",
309  [SWS_UOP_WRITE_BIT ] = "SWS_UOP_WRITE_BIT",
310  [SWS_UOP_WRITE_NIBBLE ] = "SWS_UOP_WRITE_NIBBLE",
311  [SWS_UOP_WRITE_PACKED ] = "SWS_UOP_WRITE_PACKED",
312  [SWS_UOP_WRITE_PLANAR ] = "SWS_UOP_WRITE_PLANAR",
313  [SWS_UOP_SWAP_BYTES ] = "SWS_UOP_SWAP_BYTES",
314  [SWS_UOP_PERMUTE ] = "SWS_UOP_PERMUTE",
315  [SWS_UOP_COPY ] = "SWS_UOP_COPY",
316  [SWS_UOP_UNPACK ] = "SWS_UOP_UNPACK",
317  [SWS_UOP_PACK ] = "SWS_UOP_PACK",
318  [SWS_UOP_LSHIFT ] = "SWS_UOP_LSHIFT",
319  [SWS_UOP_RSHIFT ] = "SWS_UOP_RSHIFT",
320  [SWS_UOP_CLEAR ] = "SWS_UOP_CLEAR",
321  [SWS_UOP_TO_U8 ] = "SWS_UOP_TO_U8",
322  [SWS_UOP_TO_U16 ] = "SWS_UOP_TO_U16",
323  [SWS_UOP_TO_U32 ] = "SWS_UOP_TO_U32",
324  [SWS_UOP_TO_F32 ] = "SWS_UOP_TO_F32",
325  [SWS_UOP_EXPAND_PAIR ] = "SWS_UOP_EXPAND_PAIR",
326  [SWS_UOP_EXPAND_QUAD ] = "SWS_UOP_EXPAND_QUAD",
327  [SWS_UOP_MIN ] = "SWS_UOP_MIN",
328  [SWS_UOP_MAX ] = "SWS_UOP_MAX",
329  [SWS_UOP_SCALE ] = "SWS_UOP_SCALE",
330  [SWS_UOP_LINEAR ] = "SWS_UOP_LINEAR",
331  [SWS_UOP_LINEAR_FMA ] = "SWS_UOP_LINEAR_FMA",
332  [SWS_UOP_DITHER ] = "SWS_UOP_DITHER",
333 };
334 
335 static const char pixel_types[SWS_PIXEL_TYPE_NB][32] = {
336  [SWS_PIXEL_U8 ] = "SWS_PIXEL_U8",
337  [SWS_PIXEL_U16] = "SWS_PIXEL_U16",
338  [SWS_PIXEL_U32] = "SWS_PIXEL_U32",
339  [SWS_PIXEL_F32] = "SWS_PIXEL_F32",
340 };
341 
342 static void serialize_op(AVBPrint *bp, const SwsAArch64OpImplParams *params)
343 {
344 #define FUNC_NAME_WIDTH 45
345 #define UOP_NAME_WIDTH 21
346 #define TYPE_NAME_WIDTH 14
347 
348  const SwsUOpParams *par = &params->par;
349 
350  char func_name[FUNC_NAME_WIDTH + 2];
351  snprintf(func_name, sizeof(func_name), "ff_sws_%s", op_type_names[params->uop]);
352  switch (params->uop) {
353  case SWS_UOP_PERMUTE:
354  case SWS_UOP_COPY:
355  av_strlcatf(func_name, sizeof(func_name), "_%012" PRIx64, move_to_mask(&par->move));
356  break;
357  case SWS_UOP_UNPACK:
358  case SWS_UOP_PACK:
359  av_strlcatf(func_name, sizeof(func_name), "_%04x", pack_to_mask(&par->pack));
360  break;
361  case SWS_UOP_LSHIFT:
362  case SWS_UOP_RSHIFT:
363  av_strlcatf(func_name, sizeof(func_name), "_%u", par->shift.amount);
364  break;
365  case SWS_UOP_CLEAR:
366  av_strlcatf(func_name, sizeof(func_name), "_%04x", clear_to_mask(&par->clear));
367  break;
368  case SWS_UOP_LINEAR:
369  case SWS_UOP_LINEAR_FMA:
370  av_strlcatf(func_name, sizeof(func_name), "_%010" PRIx64, linear_to_mask(&par->lin));
371  break;
372  case SWS_UOP_DITHER:
373  av_strlcatf(func_name, sizeof(func_name), "_%04x_%u", dither_to_mask(params, &par->dither), par->dither.size_log2);
374  break;
375  }
376  av_strlcatf(func_name, sizeof(func_name), "_%u_%s_%04x_neon,",
378 
379  char uop_name[UOP_NAME_WIDTH + 2];
380  snprintf(uop_name, sizeof(uop_name), "%s,", uop_types[params->uop]);
381 
382  char type_name[TYPE_NAME_WIDTH + 2];
383  snprintf(type_name, sizeof(type_name), "%s,", pixel_types[params->type]);
384 
385  av_bprintf(bp, "ENTRY(%-*s { .uop = %-*s .block_size = %2u, .type = %-*s .mask = 0x%x",
386  FUNC_NAME_WIDTH, func_name, UOP_NAME_WIDTH, uop_name,
387  params->block_size, TYPE_NAME_WIDTH, type_name, params->mask);
388  switch (params->uop) {
389  case SWS_UOP_PERMUTE:
390  case SWS_UOP_COPY:
391  av_bprintf(bp, ", .par.move = { .num_moves = %d, .dst = {%d, %d, %d, %d, %d, %d}, .src = {%d, %d, %d, %d, %d, %d} }",
392  par->move.num_moves,
393  par->move.dst[0], par->move.dst[1], par->move.dst[2],
394  par->move.dst[3], par->move.dst[4], par->move.dst[5],
395  par->move.src[0], par->move.src[1], par->move.src[2],
396  par->move.src[3], par->move.src[4], par->move.src[5]);
397  break;
398  case SWS_UOP_UNPACK:
399  case SWS_UOP_PACK:
400  av_bprintf(bp, ", .par.pack = { .pattern = {%d, %d, %d, %d} }",
401  par->pack.pattern[0], par->pack.pattern[1],
402  par->pack.pattern[2], par->pack.pattern[3]);
403  break;
404  case SWS_UOP_LSHIFT:
405  case SWS_UOP_RSHIFT:
406  av_bprintf(bp, ", .par.shift = { .amount = %u }", par->shift.amount);
407  break;
408  case SWS_UOP_CLEAR:
409  av_bprintf(bp, ", .par.clear = { .one = 0x%0x, .zero = 0x%0x }", par->clear.one, par->clear.zero);
410  break;
411  case SWS_UOP_LINEAR:
412  case SWS_UOP_LINEAR_FMA:
413  av_bprintf(bp, ", .par.lin = { .one = 0x%x, .zero = 0x%x }", par->lin.one, par->lin.zero);
414  break;
415  case SWS_UOP_DITHER:
416  av_bprintf(bp, ", .par.dither = { .y_offset = {%u, %u, %u, %u}, .size_log2 = %u }",
417  par->dither.y_offset[0], par->dither.y_offset[1],
418  par->dither.y_offset[2], par->dither.y_offset[3],
419  par->dither.size_log2);
420  break;
421  }
422  av_bprintf(bp, " })");
423 }
424 
425 /* Serialize SwsAArch64OpImplParams for one function. */
426 static int print_op(void *opaque, void *elem)
427 {
429  FILE *fp = (FILE *) opaque;
430 
431  AVBPrint bp;
433  serialize_op(&bp, params);
434  fprintf(fp, "%s\n", bp.str);
435  av_bprint_finalize(&bp, NULL);
436 
437  av_free(params);
438 
439  return 0;
440 }
441 
442 /*********************************************************************/
443 int main(int argc, char *argv[])
444 {
445  struct AVTreeNode *root = NULL;
446  int ret = 1;
447 
448 #ifdef _WIN32
449  _setmode(_fileno(stdout), _O_BINARY);
450 #endif
451 
453  if (!ctx)
454  goto fail;
455 
456  SwsGraph *graph = ff_sws_graph_alloc();
457  if (!graph)
458  goto fail;
459 
460  graph->ctx = ctx;
461  ctx->opaque = &root;
462 
464  register_op);
465 
466  /**
467  * Generate a C file with all the unique function parameter entries
468  * collected by aarch64_enum_ops().
469  */
470  printf("/*\n");
471  printf(" * This file is automatically generated. Do not edit manually.\n");
472  printf(" * To regenerate, run: make fate-sws-ops-entries-aarch64 GEN=1\n");
473  printf(" */\n");
474  printf("\n");
475  av_tree_enumerate(root, stdout, NULL, print_op);
476 
477  ff_sws_graph_free(&graph);
478 
479 fail:
480  av_tree_destroy(root);
482  return ret;
483 }
SWS_OP_READ
@ SWS_OP_READ
Definition: ops.h:39
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:32
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
SWS_UOP_SCALE
@ SWS_UOP_SCALE
Definition: uops.h:164
SwsGraph::ctx
SwsContext * ctx
Definition: graph.h:123
collect_ops_compile
static int collect_ops_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
Definition: sws_ops_aarch64.c:194
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
printf
__device__ int printf(const char *,...)
SwsUOpParams::move
SwsMoveUOp move
Definition: uops.h:250
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:625
serialize_op
static void serialize_op(AVBPrint *bp, const SwsAArch64OpImplParams *params)
Definition: sws_ops_aarch64.c:342
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
dither_to_mask
static uint16_t dither_to_mask(const SwsAArch64OpImplParams *p, const SwsDitherUOp *dither)
Definition: sws_ops_aarch64.c:91
SWS_UOP_RSHIFT
@ SWS_UOP_RSHIFT
Definition: uops.h:173
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
SwsClearUOp::zero
SwsCompMask zero
Definition: uops.h:218
ff_sws_op_list_max_size
int ff_sws_op_list_max_size(const SwsOpList *ops)
Returns the size of the largest pixel type used in ops.
Definition: ops.c:740
int64_t
long long int64_t
Definition: coverity.c:34
linear_to_mask
static uint64_t linear_to_mask(const SwsLinearUOp *linear)
Definition: sws_ops_aarch64.c:76
mask
int mask
Definition: mediacodecdec_common.c:154
FUNC_NAME_WIDTH
#define FUNC_NAME_WIDTH
pixel_types
static const char pixel_types[SWS_PIXEL_TYPE_NB][32]
Definition: sws_ops_aarch64.c:335
pixel_type_names
static const char pixel_type_names[SWS_PIXEL_TYPE_NB][4]
Definition: sws_ops_aarch64.c:297
ops.h
AVTreeNode::elem
void * elem
Definition: tree.c:28
b
#define b
Definition: input.c:43
linear
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:135
SWS_UOP_LINEAR_FMA
@ SWS_UOP_LINEAR_FMA
Definition: uops.h:176
SWS_UOP_MAX
@ SWS_UOP_MAX
Definition: uops.h:167
ops_dispatch.h
av_tree_node_alloc
struct AVTreeNode * av_tree_node_alloc(void)
Allocate an AVTreeNode.
Definition: tree.c:34
SWS_UOP_LSHIFT
@ SWS_UOP_LSHIFT
Definition: uops.h:172
SwsLinearUOp::one
uint32_t one
Definition: uops.h:222
SWS_UOP_TYPE_NB
@ SWS_UOP_TYPE_NB
Definition: uops.h:180
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:103
SwsOpBackend::name
const char * name
Definition: ops_dispatch.h:135
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:205
av_memdup
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Definition: mem.c:302
SwsMoveUOp
Definition: uops.h:202
SWS_UOP_TO_U16
@ SWS_UOP_TO_U16
Definition: uops.h:159
SwsOpList::num_ops
int num_ops
Definition: ops.h:267
SWS_UOP_PACK
@ SWS_UOP_PACK
Definition: uops.h:171
SwsShiftUOp::amount
uint8_t amount
Definition: uops.h:199
SWS_UOP_PERMUTE
@ SWS_UOP_PERMUTE
Definition: uops.h:150
SwsUOpParams::pack
SwsPackUOp pack
Definition: uops.h:251
SwsUOpParams
Definition: uops.h:246
SWS_UOP_COPY
@ SWS_UOP_COPY
Definition: uops.h:151
clear_to_mask
static uint16_t clear_to_mask(const SwsClearUOp *clear)
Definition: sws_ops_aarch64.c:41
ops_chain.h
avassert.h
SWS_UOP_WRITE_NIBBLE
@ SWS_UOP_WRITE_NIBBLE
Definition: uops.h:143
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:504
SwsAArch64OpImplParams::uop
SwsUOpType uop
Definition: ops_impl.h:48
SwsPackUOp
Definition: uops.h:212
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
dither
static const uint16_t dither[8][8]
Definition: vf_gradfun.c:46
SWS_UOP_WRITE_PLANAR
@ SWS_UOP_WRITE_PLANAR
Definition: uops.h:141
op
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
Definition: anm.c:76
SWS_UOP_TO_F32
@ SWS_UOP_TO_F32
Definition: uops.h:161
SWS_UOP_MIN
@ SWS_UOP_MIN
Definition: uops.h:166
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
SWS_UOP_READ_PACKED
@ SWS_UOP_READ_PACKED
Definition: uops.h:136
SWS_OP_FILTER_H
@ SWS_OP_FILTER_H
Definition: ops.h:62
params
SwsAArch64OpImplParams params
Definition: ops.c:51
AVFormatContext::opaque
void * opaque
User data.
Definition: avformat.h:1897
SwsOpBackend
Definition: ops_dispatch.h:134
SwsAArch64OpImplParams::mask
SwsCompMask mask
Definition: ops_impl.h:49
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:249
SwsLinearUOp
Definition: uops.h:221
aarch64_op_impl_cmp
static int aarch64_op_impl_cmp(const void *a, const void *b)
Definition: sws_ops_aarch64.c:104
SwsMoveUOp::dst
int8_t dst[SWS_UOP_MOVE_MAX]
Definition: uops.h:208
AVTreeNode
Definition: tree.c:26
SwsClearUOp::one
SwsCompMask one
Definition: uops.h:217
SWS_OP_FILTER_V
@ SWS_OP_FILTER_V
Definition: ops.h:63
print_op
static int print_op(void *opaque, void *elem)
Definition: sws_ops_aarch64.c:426
SwsClearUOp
Definition: uops.h:216
SWS_UOP_READ_NIBBLE
@ SWS_UOP_READ_NIBBLE
Definition: uops.h:137
av_tree_destroy
void av_tree_destroy(AVTreeNode *t)
Definition: tree.c:146
move_to_mask
static uint64_t move_to_mask(const SwsMoveUOp *move)
Definition: sws_ops_aarch64.c:56
SWS_UOP_TO_U32
@ SWS_UOP_TO_U32
Definition: uops.h:160
NIBBLE_SET
#define NIBBLE_SET(mask, idx, val)
Definition: ops_impl.h:32
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
SWS_UOP_WRITE_BIT
@ SWS_UOP_WRITE_BIT
Definition: uops.h:144
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
UOP_NAME_WIDTH
#define UOP_NAME_WIDTH
sws_alloc_context
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
Definition: utils.c:1033
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
pack_to_mask
static uint16_t pack_to_mask(const SwsPackUOp *pack)
Definition: sws_ops_aarch64.c:68
SwsLinearUOp::zero
uint32_t zero
Definition: uops.h:223
SwsDitherUOp::size_log2
uint8_t size_log2
Definition: uops.h:237
SWS_OP_WRITE
@ SWS_OP_WRITE
Definition: ops.h:40
op_type_names
static const char op_type_names[SWS_UOP_TYPE_NB][16]
Definition: sws_ops_aarch64.c:266
SWS_UOP_UNPACK
@ SWS_UOP_UNPACK
Definition: uops.h:170
SWS_COMP
#define SWS_COMP(X)
Definition: uops.h:96
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
xf
#define xf(width, name, var, range_min, range_max, subs,...)
Definition: cbs_av1.c:622
bprint.h
ops_impl_conv.c
SWS_UOP_TO_U8
@ SWS_UOP_TO_U8
Definition: uops.h:158
SWS_UOP_READ_PLANAR
@ SWS_UOP_READ_PLANAR
Definition: uops.h:132
SwsOpList::ops
SwsOp * ops
Definition: ops.h:266
SWS_PIXEL_U8
@ SWS_PIXEL_U8
Definition: uops.h:40
graph.h
SWS_UOP_SWAP_BYTES
@ SWS_UOP_SWAP_BYTES
Definition: uops.h:154
SWS_UOP_LINEAR
@ SWS_UOP_LINEAR
Definition: uops.h:175
SwsOp
Definition: ops.h:210
SwsUOpParams::lin
SwsLinearUOp lin
Definition: uops.h:253
SwsPackUOp::pattern
uint8_t pattern[4]
Definition: uops.h:213
op_list_gen_template.c
ret
ret
Definition: filter_design.txt:187
SwsCompiledOp
Definition: ops_dispatch.h:101
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:122
TYPE_NAME_WIDTH
#define TYPE_NAME_WIDTH
convert_to_aarch64_impl
static int convert_to_aarch64_impl(SwsContext *ctx, const SwsOpList *ops, int n, int block_size, SwsAArch64OpImplParams *out)
Convert SwsOp to a SwsAArch64OpImplParams.
Definition: ops_impl_conv.c:98
SwsAArch64OpImplParams::par
SwsUOpParams par
Definition: ops_impl.h:52
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
main
int main(int argc, char *argv[])
Definition: sws_ops_aarch64.c:443
aarch64_collect_op
static int aarch64_collect_op(const SwsAArch64OpImplParams *params, struct AVTreeNode **root)
Definition: sws_ops_aarch64.c:174
SwsDitherUOp::y_offset
uint8_t y_offset[4]
Definition: uops.h:236
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
register_op
static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops)
Definition: sws_ops_aarch64.c:238
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:177
SWS_UOP_WRITE_PACKED
@ SWS_UOP_WRITE_PACKED
Definition: uops.h:142
SwsAArch64OpImplParams::block_size
uint8_t block_size
Definition: ops_impl.h:51
SwsDitherUOp
Definition: uops.h:235
SwsUOpParams::dither
SwsDitherUOp dither
Definition: uops.h:254
SwsAArch64OpImplParams
SwsAArch64OpImplParams describes the parameters for an SwsUOpType operation.
Definition: ops_impl.h:47
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
ib
#define ib(width, name)
Definition: cbs_h264.c:65
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
SWS_UOP_EXPAND_QUAD
@ SWS_UOP_EXPAND_QUAD
Definition: uops.h:157
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:2324
SwsMoveUOp::src
int8_t src[SWS_UOP_MOVE_MAX]
Definition: uops.h:209
uop_types
static const char uop_types[SWS_UOP_TYPE_NB][32]
Definition: sws_ops_aarch64.c:304
nibble_mask
static uint16_t nibble_mask(SwsCompMask mask)
Definition: ops_impl.h:34
SWS_UOP_READ_BIT
@ SWS_UOP_READ_BIT
Definition: uops.h:138
SWS_UOP_CLEAR
@ SWS_UOP_CLEAR
Definition: uops.h:174
SwsOpList
Helper struct for representing a list of operations.
Definition: ops.h:265
SwsContext
Main external API structure.
Definition: swscale.h:227
SWS_PIXEL_U16
@ SWS_PIXEL_U16
Definition: uops.h:41
SwsAArch64OpImplParams::type
SwsPixelType type
Definition: ops_impl.h:50
SWS_MASK
#define SWS_MASK(I, J)
Definition: uops.h:229
SWS_OP_FLAG_DRY_RUN
@ SWS_OP_FLAG_DRY_RUN
Definition: ops_dispatch.h:175
snprintf
#define snprintf
Definition: snprintf.h:34
SwsUOpParams::clear
SwsClearUOp clear
Definition: uops.h:252
src
#define src
Definition: vp8dsp.c:248
SWS_UOP_EXPAND_PAIR
@ SWS_UOP_EXPAND_PAIR
Definition: uops.h:156
backend_collect
static const SwsOpBackend backend_collect
Definition: sws_ops_aarch64.c:232