FFmpeg
Macros
mem_internal.h File Reference
#include "config.h"
#include <stdint.h>
#include <stdalign.h>
#include "attributes.h"
#include "macros.h"

Go to the source code of this file.

Macros

#define DECLARE_ALIGNED_T(n, t, v)   alignas(n) t v
 
#define DECLARE_ASM_ALIGNED(n, t, v)   alignas(n) t av_used v
 
#define DECLARE_ASM_CONST(n, t, v)   alignas(n) static const t av_used v
 
#define ALIGN_64   16
 
#define ALIGN_32   16
 
#define DECLARE_ALIGNED(n, t, v)   DECLARE_ALIGNED_V(n,t,v)
 
#define DECLARE_ALIGNED_V(n, t, v)   DECLARE_ALIGNED_##n(t,v)
 
#define DECLARE_ALIGNED_4(t, v)   DECLARE_ALIGNED_T( 4, t, v)
 
#define DECLARE_ALIGNED_8(t, v)   DECLARE_ALIGNED_T( 8, t, v)
 
#define DECLARE_ALIGNED_16(t, v)   DECLARE_ALIGNED_T( 16, t, v)
 
#define DECLARE_ALIGNED_32(t, v)   DECLARE_ALIGNED_T(ALIGN_32, t, v)
 
#define DECLARE_ALIGNED_64(t, v)   DECLARE_ALIGNED_T(ALIGN_64, t, v)
 
#define E1(x)   x
 
#define LOCAL_ALIGNED_D(a, t, v, s, o, ...)
 
#define LOCAL_ALIGNED(a, t, v, ...)   LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)
 
#define LOCAL_ALIGNED_4(t, v, ...)   E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_8(t, v, ...)   E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_16(t, v, ...)   E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_32(t, v, ...)   E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
 

Macro Definition Documentation

◆ DECLARE_ALIGNED_T

#define DECLARE_ALIGNED_T (   n,
  t,
 
)    alignas(n) t v

Definition at line 88 of file mem_internal.h.

◆ DECLARE_ASM_ALIGNED

#define DECLARE_ASM_ALIGNED (   n,
  t,
 
)    alignas(n) t av_used v

Declare an aligned variable appropriate for use in inline assembly code.

DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
Parameters
nMinimum alignment in bytes
tType of the variable (or array element)
vName of the variable

Definition at line 89 of file mem_internal.h.

◆ DECLARE_ASM_CONST

#define DECLARE_ASM_CONST (   n,
  t,
 
)    alignas(n) static const t av_used v

Declare a static constant aligned variable appropriate for use in inline assembly code.

DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
Parameters
nMinimum alignment in bytes
tType of the variable (or array element)
vName of the variable

Definition at line 90 of file mem_internal.h.

◆ ALIGN_64

#define ALIGN_64   16

Definition at line 100 of file mem_internal.h.

◆ ALIGN_32

#define ALIGN_32   16

Definition at line 101 of file mem_internal.h.

◆ DECLARE_ALIGNED

#define DECLARE_ALIGNED (   n,
  t,
 
)    DECLARE_ALIGNED_V(n,t,v)

Declare a variable that is aligned in memory.

DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
// The default-alignment equivalent would be
uint16_t aligned_int = 42;
uint8_t aligned_array[128];
Parameters
nMinimum alignment in bytes
tType of the variable (or array element)
vName of the variable

Definition at line 104 of file mem_internal.h.

◆ DECLARE_ALIGNED_V

#define DECLARE_ALIGNED_V (   n,
  t,
 
)    DECLARE_ALIGNED_##n(t,v)

Definition at line 108 of file mem_internal.h.

◆ DECLARE_ALIGNED_4

#define DECLARE_ALIGNED_4 (   t,
 
)    DECLARE_ALIGNED_T( 4, t, v)

Definition at line 110 of file mem_internal.h.

◆ DECLARE_ALIGNED_8

#define DECLARE_ALIGNED_8 (   t,
 
)    DECLARE_ALIGNED_T( 8, t, v)

Definition at line 111 of file mem_internal.h.

◆ DECLARE_ALIGNED_16

#define DECLARE_ALIGNED_16 (   t,
 
)    DECLARE_ALIGNED_T( 16, t, v)

Definition at line 112 of file mem_internal.h.

◆ DECLARE_ALIGNED_32

#define DECLARE_ALIGNED_32 (   t,
 
)    DECLARE_ALIGNED_T(ALIGN_32, t, v)

Definition at line 113 of file mem_internal.h.

◆ DECLARE_ALIGNED_64

#define DECLARE_ALIGNED_64 (   t,
 
)    DECLARE_ALIGNED_T(ALIGN_64, t, v)

Definition at line 114 of file mem_internal.h.

◆ E1

#define E1 (   x)    x

Definition at line 118 of file mem_internal.h.

◆ LOCAL_ALIGNED_D

#define LOCAL_ALIGNED_D (   a,
  t,
  v,
  s,
  o,
  ... 
)
Value:
DECLARE_ALIGNED(a, t, la_##v) s o; \
t (*v) o = la_##v

Definition at line 120 of file mem_internal.h.

◆ LOCAL_ALIGNED

#define LOCAL_ALIGNED (   a,
  t,
  v,
  ... 
)    LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)

Definition at line 124 of file mem_internal.h.

◆ LOCAL_ALIGNED_4

#define LOCAL_ALIGNED_4 (   t,
  v,
  ... 
)    E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))

Definition at line 126 of file mem_internal.h.

◆ LOCAL_ALIGNED_8

#define LOCAL_ALIGNED_8 (   t,
  v,
  ... 
)    E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))

Definition at line 128 of file mem_internal.h.

◆ LOCAL_ALIGNED_16

#define LOCAL_ALIGNED_16 (   t,
  v,
  ... 
)    E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))

Definition at line 130 of file mem_internal.h.

◆ LOCAL_ALIGNED_32

#define LOCAL_ALIGNED_32 (   t,
  v,
  ... 
)    E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))

Definition at line 132 of file mem_internal.h.

DECLARE_ASM_ALIGNED
#define DECLARE_ASM_ALIGNED(n, t, v)
Definition: mem_internal.h:89
DECLARE_ASM_CONST
#define DECLARE_ASM_CONST(n, t, v)
Definition: mem_internal.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:198
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:104
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