FFmpeg
Loading...
Searching...
No Matches
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"
32
34
35#ifdef _WIN32
36#include <io.h>
37#include <fcntl.h>
38#endif
39
40/*********************************************************************/
41static 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
56static 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
68static 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
76static 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
104static 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 }
185 if (!node)
186 copy = NULL;
187
188error:
189 av_free(node);
190 av_free(copy);
191 return ret;
192}
193
196{
197 struct AVTreeNode **root = (struct AVTreeNode **) ctx->opaque;
198 int ret;
199
201 if (!uops)
202 return AVERROR(ENOMEM);
203
205 if (!(ctx->flags & SWS_BITEXACT))
207 ret = ff_sws_ops_translate(ctx, ops, flags, uops);
208 if (ret == AVERROR(ENOTSUP)) {
209 ret = 0;
210 goto end;
211 }
212 if (ret < 0)
213 goto end;
214
215 /* Use at most two full vregs during the widest precision section */
216 int block_size = (uops->pixel_size_max == 4) ? 8 : 16;
217
218 for (int i = 0; i < uops->num_ops; i++) {
220 convert_to_aarch64_impl(&uops->ops[i], block_size, &params);
222 if (ret < 0)
223 goto end;
224 if (params.uop == SWS_UOP_LINEAR_FMA && params.type == SWS_PIXEL_F32) {
225 /**
226 * Generate both sets of linear op functions that do use
227 * and do not use fmla (selected by SWS_BITEXACT).
228 */
231 if (ret < 0)
232 goto end;
233 }
234 }
235
236 *out = (SwsCompiledOp) { 0 };
237 ret = 0;
238
239end:
241 return ret;
242}
243
245 .name = "collect_ops",
246 .compile = collect_ops_compile,
247};
248
249/*********************************************************************/
250static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops)
251{
252 /* Skip ops lists which include filtering, since this is still not
253 * supported. */
254 for (int i = 0; i < ops->num_ops; i++) {
255 const SwsOp *op = &ops->ops[i];
256 switch (op->op) {
257 case SWS_OP_READ:
258 case SWS_OP_WRITE:
259 if (op->rw.filter.op)
260 return 0;
261 break;
262 case SWS_OP_FILTER_H:
263 case SWS_OP_FILTER_V:
264 return 0;
265 }
266 }
267
268 /* ff_sws_compile_pass() takes over ownership of `ops` */
270 if (!copy)
271 return AVERROR(ENOMEM);
272
275}
276
277/*********************************************************************/
278static const char op_type_names[SWS_UOP_TYPE_NB][16] = {
279 [SWS_UOP_READ_BIT ] = "read_bit",
280 [SWS_UOP_READ_NIBBLE ] = "read_nibble",
281 [SWS_UOP_READ_PACKED ] = "read_packed",
282 [SWS_UOP_READ_PLANAR ] = "read_planar",
283 [SWS_UOP_WRITE_BIT ] = "write_bit",
284 [SWS_UOP_WRITE_NIBBLE ] = "write_nibble",
285 [SWS_UOP_WRITE_PACKED ] = "write_packed",
286 [SWS_UOP_WRITE_PLANAR ] = "write_planar",
287 [SWS_UOP_SWAP_BYTES ] = "swap_bytes",
288 [SWS_UOP_PERMUTE ] = "permute",
289 [SWS_UOP_COPY ] = "copy",
290 [SWS_UOP_UNPACK ] = "unpack",
291 [SWS_UOP_PACK ] = "pack",
292 [SWS_UOP_LSHIFT ] = "lshift",
293 [SWS_UOP_RSHIFT ] = "rshift",
294 [SWS_UOP_CLEAR ] = "clear",
295 [SWS_UOP_TO_U8 ] = "to_u8",
296 [SWS_UOP_TO_U16 ] = "to_u16",
297 [SWS_UOP_TO_U32 ] = "to_u32",
298 [SWS_UOP_TO_F32 ] = "to_f32",
299 [SWS_UOP_EXPAND_PAIR ] = "expand_pair",
300 [SWS_UOP_EXPAND_QUAD ] = "expand_quad",
301 [SWS_UOP_ADD ] = "add",
302 [SWS_UOP_MIN ] = "min",
303 [SWS_UOP_MAX ] = "max",
304 [SWS_UOP_SCALE ] = "scale",
305 [SWS_UOP_LINEAR ] = "linear",
306 [SWS_UOP_LINEAR_FMA ] = "linear_fma",
307 [SWS_UOP_DITHER ] = "dither",
308};
309
310static const char pixel_type_names[SWS_PIXEL_TYPE_NB][4] = {
311 [SWS_PIXEL_U8 ] = "u8",
312 [SWS_PIXEL_U16] = "u16",
313 [SWS_PIXEL_U32] = "u32",
314 [SWS_PIXEL_F32] = "f32",
315};
316
317static const char uop_types[SWS_UOP_TYPE_NB][32] = {
318 [SWS_UOP_READ_BIT ] = "SWS_UOP_READ_BIT",
319 [SWS_UOP_READ_NIBBLE ] = "SWS_UOP_READ_NIBBLE",
320 [SWS_UOP_READ_PACKED ] = "SWS_UOP_READ_PACKED",
321 [SWS_UOP_READ_PLANAR ] = "SWS_UOP_READ_PLANAR",
322 [SWS_UOP_WRITE_BIT ] = "SWS_UOP_WRITE_BIT",
323 [SWS_UOP_WRITE_NIBBLE ] = "SWS_UOP_WRITE_NIBBLE",
324 [SWS_UOP_WRITE_PACKED ] = "SWS_UOP_WRITE_PACKED",
325 [SWS_UOP_WRITE_PLANAR ] = "SWS_UOP_WRITE_PLANAR",
326 [SWS_UOP_SWAP_BYTES ] = "SWS_UOP_SWAP_BYTES",
327 [SWS_UOP_PERMUTE ] = "SWS_UOP_PERMUTE",
328 [SWS_UOP_COPY ] = "SWS_UOP_COPY",
329 [SWS_UOP_UNPACK ] = "SWS_UOP_UNPACK",
330 [SWS_UOP_PACK ] = "SWS_UOP_PACK",
331 [SWS_UOP_LSHIFT ] = "SWS_UOP_LSHIFT",
332 [SWS_UOP_RSHIFT ] = "SWS_UOP_RSHIFT",
333 [SWS_UOP_CLEAR ] = "SWS_UOP_CLEAR",
334 [SWS_UOP_TO_U8 ] = "SWS_UOP_TO_U8",
335 [SWS_UOP_TO_U16 ] = "SWS_UOP_TO_U16",
336 [SWS_UOP_TO_U32 ] = "SWS_UOP_TO_U32",
337 [SWS_UOP_TO_F32 ] = "SWS_UOP_TO_F32",
338 [SWS_UOP_EXPAND_PAIR ] = "SWS_UOP_EXPAND_PAIR",
339 [SWS_UOP_EXPAND_QUAD ] = "SWS_UOP_EXPAND_QUAD",
340 [SWS_UOP_ADD ] = "SWS_UOP_ADD",
341 [SWS_UOP_MIN ] = "SWS_UOP_MIN",
342 [SWS_UOP_MAX ] = "SWS_UOP_MAX",
343 [SWS_UOP_SCALE ] = "SWS_UOP_SCALE",
344 [SWS_UOP_LINEAR ] = "SWS_UOP_LINEAR",
345 [SWS_UOP_LINEAR_FMA ] = "SWS_UOP_LINEAR_FMA",
346 [SWS_UOP_DITHER ] = "SWS_UOP_DITHER",
347};
348
349static const char pixel_types[SWS_PIXEL_TYPE_NB][32] = {
350 [SWS_PIXEL_U8 ] = "SWS_PIXEL_U8",
351 [SWS_PIXEL_U16] = "SWS_PIXEL_U16",
352 [SWS_PIXEL_U32] = "SWS_PIXEL_U32",
353 [SWS_PIXEL_F32] = "SWS_PIXEL_F32",
354};
355
356static void serialize_op(AVBPrint *bp, const SwsAArch64OpImplParams *params)
357{
358#define FUNC_NAME_WIDTH 45
359#define UOP_NAME_WIDTH 21
360#define TYPE_NAME_WIDTH 14
361
362 const SwsUOpParams *par = &params->par;
363
364 char func_name[FUNC_NAME_WIDTH + 2];
365 snprintf(func_name, sizeof(func_name), "ff_sws_%s", op_type_names[params->uop]);
366 switch (params->uop) {
367 case SWS_UOP_PERMUTE:
368 case SWS_UOP_COPY:
369 av_strlcatf(func_name, sizeof(func_name), "_%012" PRIx64, move_to_mask(&par->move));
370 break;
371 case SWS_UOP_UNPACK:
372 case SWS_UOP_PACK:
373 av_strlcatf(func_name, sizeof(func_name), "_%04x", pack_to_mask(&par->pack));
374 break;
375 case SWS_UOP_LSHIFT:
376 case SWS_UOP_RSHIFT:
377 av_strlcatf(func_name, sizeof(func_name), "_%u", par->shift.amount);
378 break;
379 case SWS_UOP_CLEAR:
380 av_strlcatf(func_name, sizeof(func_name), "_%04x", clear_to_mask(&par->clear));
381 break;
382 case SWS_UOP_LINEAR:
384 av_strlcatf(func_name, sizeof(func_name), "_%010" PRIx64, linear_to_mask(&par->lin));
385 break;
386 case SWS_UOP_DITHER:
387 av_strlcatf(func_name, sizeof(func_name), "_%04x_%u", dither_to_mask(params, &par->dither), par->dither.size_log2);
388 break;
389 }
390 av_strlcatf(func_name, sizeof(func_name), "_%u_%s_%04x_neon,",
391 params->block_size, pixel_type_names[params->type], nibble_mask(params->mask));
392
393 char uop_name[UOP_NAME_WIDTH + 2];
394 snprintf(uop_name, sizeof(uop_name), "%s,", uop_types[params->uop]);
395
396 char type_name[TYPE_NAME_WIDTH + 2];
397 snprintf(type_name, sizeof(type_name), "%s,", pixel_types[params->type]);
398
399 av_bprintf(bp, "ENTRY(%-*s { .uop = %-*s .block_size = %2u, .type = %-*s .mask = 0x%x",
400 FUNC_NAME_WIDTH, func_name, UOP_NAME_WIDTH, uop_name,
401 params->block_size, TYPE_NAME_WIDTH, type_name, params->mask);
402 switch (params->uop) {
403 case SWS_UOP_PERMUTE:
404 case SWS_UOP_COPY:
405 av_bprintf(bp, ", .par.move = { .num_moves = %d, .dst = {%d, %d, %d, %d, %d, %d}, .src = {%d, %d, %d, %d, %d, %d} }",
406 par->move.num_moves,
407 par->move.dst[0], par->move.dst[1], par->move.dst[2],
408 par->move.dst[3], par->move.dst[4], par->move.dst[5],
409 par->move.src[0], par->move.src[1], par->move.src[2],
410 par->move.src[3], par->move.src[4], par->move.src[5]);
411 break;
412 case SWS_UOP_UNPACK:
413 case SWS_UOP_PACK:
414 av_bprintf(bp, ", .par.pack = { .pattern = {%d, %d, %d, %d} }",
415 par->pack.pattern[0], par->pack.pattern[1],
416 par->pack.pattern[2], par->pack.pattern[3]);
417 break;
418 case SWS_UOP_LSHIFT:
419 case SWS_UOP_RSHIFT:
420 av_bprintf(bp, ", .par.shift = { .amount = %u }", par->shift.amount);
421 break;
422 case SWS_UOP_CLEAR:
423 av_bprintf(bp, ", .par.clear = { .one = 0x%0x, .zero = 0x%0x }", par->clear.one, par->clear.zero);
424 break;
425 case SWS_UOP_LINEAR:
427 av_bprintf(bp, ", .par.lin = { .one = 0x%x, .zero = 0x%x }", par->lin.one, par->lin.zero);
428 break;
429 case SWS_UOP_DITHER:
430 av_bprintf(bp, ", .par.dither = { .y_offset = {%u, %u, %u, %u}, .size_log2 = %u }",
431 par->dither.y_offset[0], par->dither.y_offset[1],
432 par->dither.y_offset[2], par->dither.y_offset[3],
433 par->dither.size_log2);
434 break;
435 }
436 av_bprintf(bp, " })");
437}
438
439/* Serialize SwsAArch64OpImplParams for one function. */
440static int print_op(void *opaque, void *elem)
441{
443 FILE *fp = (FILE *) opaque;
444
445 AVBPrint bp;
447 serialize_op(&bp, params);
448 fprintf(fp, "%s\n", bp.str);
450
452
453 return 0;
454}
455
456/*********************************************************************/
457int main(int argc, char *argv[])
458{
459 struct AVTreeNode *root = NULL;
460 int ret = 1;
461
462#ifdef _WIN32
463 _setmode(_fileno(stdout), _O_BINARY);
464#endif
465
467 if (!ctx)
468 goto fail;
469
470 SwsGraph *graph = ff_sws_graph_alloc();
471 if (!graph)
472 goto fail;
473
474 graph->ctx = ctx;
475 ctx->opaque = &root;
476
477 static const SwsFlags flags_list[] = {
478 0,
479 SWS_ACCURATE_RND, /* may insert extra 1x1 dither ops (for accurate rounding) */
480 SWS_BITEXACT, /* prevents some FMA optimizations */
482 };
483 for (int i = 0; i < FF_ARRAY_ELEMS(flags_list); i++) {
484 ctx->flags = flags_list[i];
487 if (ret < 0)
488 break;
489 }
490
491 /**
492 * Generate a C file with all the unique function parameter entries
493 * collected by aarch64_enum_ops().
494 */
495 printf("/*\n");
496 printf(" * This file is automatically generated. Do not edit manually.\n");
497 printf(" * To regenerate, run: make fate-sws-ops-entries-aarch64 GEN=1\n");
498 printf(" */\n");
499 printf("\n");
501
502 ff_sws_graph_free(&graph);
503
504fail:
507 return ret;
508}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
SwsAArch64OpImplParams params
Definition ops.c:52
static FILE * out
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition avstring.c:103
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition bprint.c:121
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition bprint.c:68
AVBPrint public header.
#define AV_BPRINT_SIZE_UNLIMITED
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define ib(width, name)
Definition cbs_h264.c:65
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
__device__ int printf(const char *,...)
int main
Definition dovi_rpuenc.c:38
int ret
Definition ffplay.c:391
SwsGraph * ff_sws_graph_alloc(void)
Allocate an empty SwsGraph.
Definition graph.c:874
void ff_sws_graph_free(SwsGraph **pgraph)
Uninitialize any state associate with this filter graph and free it.
Definition graph.c:950
#define fail
Definition test.h:479
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition bprint.c:234
#define AVERROR(e)
Definition error.h:45
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Definition mem.c:408
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
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
void av_tree_destroy(AVTreeNode *t)
Definition tree.c:146
struct AVTreeNode * av_tree_node_alloc(void)
Allocate an AVTreeNode.
Definition tree.c:34
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
Definition utils.c:1081
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
Definition utils.c:2408
SwsFlags
Definition swscale.h:131
@ SWS_BITEXACT
Definition swscale.h:178
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition swscale.h:177
int a
#define b
Definition input.c:43
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
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
static const uint16_t mask[17]
Definition lzw.c:38
Memory handling functions.
char * root
Definition mscl.c:248
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 ...
SwsOpList * ff_sws_op_list_duplicate(const SwsOpList *ops)
Returns a duplicate of ops, or NULL on OOM.
Definition ops.c:757
@ SWS_OP_FILTER_V
Definition ops.h:64
@ SWS_OP_FILTER_H
Definition ops.h:63
@ SWS_OP_WRITE
Definition ops.h:41
@ SWS_OP_READ
Definition ops.h:40
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.
@ SWS_OP_FLAG_DRY_RUN
@ SWS_OP_FLAG_SPLIT_MEMCPY
static uint16_t nibble_mask(SwsCompMask mask)
Definition ops_impl.h:34
#define NIBBLE_SET(mask, idx, val)
Definition ops_impl.h:32
static void convert_to_aarch64_impl(const SwsUOp *uop, int block_size, SwsAArch64OpImplParams *out)
NOTE: This file is #include'd directly by both the NEON backend and the sws_ops_aarch64 tool.
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
static void print_op(const RasmContext *rctx, AVBPrint *bp, const int *local_labels, RasmOp op)
Definition rasm_print.c:227
#define FF_ARRAY_ELEMS(a)
void * elem
Definition tree.c:28
SwsAArch64OpImplParams describes the parameters for an SwsUOpType operation.
Definition ops_impl.h:47
SwsUOpParams par
Definition ops_impl.h:52
SwsPixelType type
Definition ops_impl.h:50
The clear values (SwsUOp.data.vec4) are always expanded to repeating 32-bit patterns,...
Definition uops.h:262
SwsCompMask one
Definition uops.h:263
SwsCompMask zero
Definition uops.h:264
Main external API structure.
Definition swscale.h:227
uint8_t size_log2
Definition uops.h:283
uint8_t y_offset[4]
Definition uops.h:282
Filter graph, which represents a 'baked' pixel format conversion.
Definition graph.h:133
SwsContext * ctx
Definition graph.h:134
uint32_t zero
Definition uops.h:269
uint32_t one
Definition uops.h:268
int8_t src[SWS_UOP_MOVE_MAX]
Definition uops.h:251
int num_moves
Definition uops.h:247
int8_t dst[SWS_UOP_MOVE_MAX]
Definition uops.h:250
Helper struct for representing a list of operations.
Definition ops.h:318
SwsOp * ops
Definition ops.h:319
int num_ops
Definition ops.h:320
Definition ops.h:252
uint8_t pattern[4]
Definition uops.h:255
uint8_t amount
Definition uops.h:241
SwsUOp * ops
Definition uops.h:345
int pixel_size_max
Definition uops.h:351
int num_ops
Definition uops.h:346
#define TYPE_NAME_WIDTH
static const char uop_types[SWS_UOP_TYPE_NB][32]
static int aarch64_collect_op(const SwsAArch64OpImplParams *params, struct AVTreeNode **root)
static const char pixel_type_names[SWS_PIXEL_TYPE_NB][4]
static int print_op(void *opaque, void *elem)
static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops)
static void serialize_op(AVBPrint *bp, const SwsAArch64OpImplParams *params)
static const char op_type_names[SWS_UOP_TYPE_NB][16]
static int aarch64_op_impl_cmp(const void *a, const void *b)
static uint16_t pack_to_mask(const SwsPackUOp *pack)
static uint64_t move_to_mask(const SwsMoveUOp *move)
#define UOP_NAME_WIDTH
static const char pixel_types[SWS_PIXEL_TYPE_NB][32]
static const SwsOpBackend backend_collect
static uint64_t linear_to_mask(const SwsLinearUOp *linear)
static uint16_t dither_to_mask(const SwsAArch64OpImplParams *p, const SwsDitherUOp *dither)
static int collect_ops_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
static uint16_t clear_to_mask(const SwsClearUOp *clear)
#define FUNC_NAME_WIDTH
#define av_free(p)
static void error(const char *err)
#define src
Definition vp8dsp.c:248
FILE * fp
Definition swscale.c:145
A tree container.
SwsMoveUOp move
Definition uops.h:300
SwsClearUOp clear
Definition uops.h:302
SwsDitherUOp dither
Definition uops.h:304
SwsLinearUOp lin
Definition uops.h:303
SwsShiftUOp shift
Definition uops.h:299
SwsPackUOp pack
Definition uops.h:301
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:644
SwsUOpList * ff_sws_uop_list_alloc(void)
Definition uops.c:176
void ff_sws_uop_list_free(SwsUOpList **p_ops)
Definition uops.c:162
uint32_t SwsUOpFlags
Definition uops.h:158
@ SWS_PIXEL_F32
Definition uops.h:45
@ SWS_PIXEL_U32
Definition uops.h:44
@ SWS_PIXEL_U16
Definition uops.h:43
@ SWS_PIXEL_TYPE_NB
Definition uops.h:46
@ SWS_PIXEL_U8
Definition uops.h:42
#define SWS_COMP(X)
Definition uops.h:133
#define SWS_MASK(I, J)
Definition uops.h:275
@ SWS_UOP_TO_U8
Definition uops.h:199
@ SWS_UOP_PACK
Definition uops.h:212
@ SWS_UOP_PERMUTE
Definition uops.h:191
@ SWS_UOP_EXPAND_QUAD
Definition uops.h:198
@ SWS_UOP_READ_PLANAR
Definition uops.h:173
@ SWS_UOP_WRITE_PLANAR
Definition uops.h:182
@ SWS_UOP_READ_NIBBLE
Definition uops.h:178
@ SWS_UOP_MAX
Definition uops.h:208
@ SWS_UOP_READ_BIT
Definition uops.h:179
@ SWS_UOP_SWAP_BYTES
Definition uops.h:195
@ SWS_UOP_MIN
Definition uops.h:207
@ SWS_UOP_LINEAR
Definition uops.h:216
@ SWS_UOP_RSHIFT
Definition uops.h:214
@ SWS_UOP_COPY
Definition uops.h:192
@ SWS_UOP_WRITE_NIBBLE
Definition uops.h:184
@ SWS_UOP_LINEAR_FMA
Definition uops.h:217
@ SWS_UOP_SCALE
Definition uops.h:205
@ SWS_UOP_WRITE_PACKED
Definition uops.h:183
@ SWS_UOP_WRITE_BIT
Definition uops.h:185
@ SWS_UOP_READ_PACKED
Definition uops.h:177
@ SWS_UOP_EXPAND_PAIR
Definition uops.h:197
@ SWS_UOP_TO_U16
Definition uops.h:200
@ SWS_UOP_DITHER
Definition uops.h:218
@ SWS_UOP_ADD
Definition uops.h:206
@ SWS_UOP_TYPE_NB
Definition uops.h:222
@ SWS_UOP_CLEAR
Definition uops.h:215
@ SWS_UOP_TO_U32
Definition uops.h:201
@ SWS_UOP_UNPACK
Definition uops.h:211
@ SWS_UOP_TO_F32
Definition uops.h:202
@ SWS_UOP_LSHIFT
Definition uops.h:213
@ SWS_UOP_FLAG_FMA
Definition uops.h:161
@ SWS_UOP_FLAG_ADD
Definition uops.h:165
@ SWS_UOP_FLAG_PUNNING
Definition uops.h:166
static const SwsFlags flags_list[]
static const uint16_t dither[8][8]
Definition vf_gradfun.c:46
static void copy(const float *p1, float *p2, const int length)