FFmpeg
uops_macros.asm.h
Go to the documentation of this file.
1 /**
2  * Copyright (C) 2025 Niklas Haas
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 /**
22  * WARNING: This file is preprocessed by the C compiler to generate the NASM
23  * source file uops_macros.gen.asm. It must *NOT* include any headers that
24  * may inadvertently declare any C syntax. The following header only declares
25  * further macros, and is therefore safe.
26  */
27 #include "../uops_macros.h"
28 
29 /**
30  * NASM expects one statement per source line, but the C preprocessor expands
31  * multi-line macros into a single line. This NASM macro allows us to work
32  * around that by expanding its arguments into multiple lines.
33  */
34 %macro MULTILINE 0-*
35  %rep %0
36  %1
37  %rotate 1
38  %endrep
39 %endmacro
40 
41 /* Used to suppress "trailing empty parameter" warnings */
42 %macro dummy 0
43 %endmacro
44 
45 #define DECL_OP_MACRO(...) {DECL_OP MACRO __VA_ARGS__},
46 #define DEF_MACRO(UOP, TYPE) \
47  %define DECL_##TYPE##_##UOP(MACRO) \
48  MULTILINE SWS_FOR_##TYPE##_##UOP(DECL_OP_MACRO) \
49  dummy
50 
51 #define DEF_ALL_MACROS(TYPE) \
52  MULTILINE \
53  {DEF_MACRO(READ_BIT, TYPE)}, \
54  {DEF_MACRO(READ_NIBBLE, TYPE)}, \
55  {DEF_MACRO(READ_PACKED, TYPE)}, \
56  {DEF_MACRO(READ_PLANAR, TYPE)}, \
57  {DEF_MACRO(READ_PLANAR_FH, TYPE)}, \
58  {DEF_MACRO(READ_PLANAR_FV, TYPE)}, \
59  {DEF_MACRO(READ_PLANAR_FV_FMA, TYPE)}, \
60  {DEF_MACRO(READ_PALETTE, TYPE)}, \
61  {DEF_MACRO(WRITE_BIT, TYPE)}, \
62  {DEF_MACRO(WRITE_NIBBLE, TYPE)}, \
63  {DEF_MACRO(WRITE_PACKED, TYPE)}, \
64  {DEF_MACRO(WRITE_PLANAR, TYPE)}, \
65  {DEF_MACRO(MOVE, TYPE)}, \
66  {DEF_MACRO(SWAP_BYTES, TYPE)}, \
67  {DEF_MACRO(EXPAND_BIT, TYPE)}, \
68  {DEF_MACRO(EXPAND_PAIR, TYPE)}, \
69  {DEF_MACRO(EXPAND_QUAD, TYPE)}, \
70  {DEF_MACRO(TO_U8, TYPE)}, \
71  {DEF_MACRO(TO_U16, TYPE)}, \
72  {DEF_MACRO(TO_U32, TYPE)}, \
73  {DEF_MACRO(TO_F32, TYPE)}, \
74  {DEF_MACRO(SCALE, TYPE)}, \
75  {DEF_MACRO(LINEAR_FMA, TYPE)}, \
76  {DEF_MACRO(ADD, TYPE)}, \
77  {DEF_MACRO(MIN, TYPE)}, \
78  {DEF_MACRO(MAX, TYPE)}, \
79  {DEF_MACRO(UNPACK, TYPE)}, \
80  {DEF_MACRO(PACK, TYPE)}, \
81  {DEF_MACRO(LSHIFT, TYPE)}, \
82  {DEF_MACRO(RSHIFT, TYPE)}, \
83  {DEF_MACRO(CLEAR, TYPE)}, \
84  {DEF_MACRO(DITHER, TYPE)}
85 
U16
@ U16
Definition: sw_ops.c:42
F32
@ F32
Definition: sw_ops.c:44
dummy
static int dummy
Definition: ffplay.c:3751
rotate
static void rotate(const float rot_quaternion[2][4], float *vec)
Rotate vector with given rotation quaternion.
Definition: vf_v360.c:4081
U8
@ U8
Definition: sw_ops.c:41
U32
@ U32
Definition: sw_ops.c:43
DEF_ALL_MACROS
#define DEF_ALL_MACROS(TYPE)
Definition: uops_macros.asm.h:51