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

Go to the source code of this file.

Macros

#define DECLARE_ALIGNED_T(n, t, v)   t __attribute__ ((aligned (n))) v
 
#define DECLARE_ASM_ALIGNED(n, t, v)   t av_used __attribute__ ((aligned (n))) v
 
#define DECLARE_ASM_CONST(n, t, v)   static const t av_used __attribute__ ((aligned (n))) 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_A(a, t, v, s, o, ...)
 
#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_A(4, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_8(t, v, ...)   E1(LOCAL_ALIGNED_A(8, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_16(t, v, ...)   E1(LOCAL_ALIGNED_A(16, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_32(t, v, ...)   E1(LOCAL_ALIGNED_A(32, t, v, __VA_ARGS__,,))
 

Macro Definition Documentation

◆ DECLARE_ALIGNED_T

#define DECLARE_ALIGNED_T (   n,
  t,
 
)    t __attribute__ ((aligned (n))) v

Definition at line 85 of file mem_internal.h.

◆ DECLARE_ASM_ALIGNED

#define DECLARE_ASM_ALIGNED (   n,
  t,
 
)    t av_used __attribute__ ((aligned (n))) 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 86 of file mem_internal.h.

◆ DECLARE_ASM_CONST

#define DECLARE_ASM_CONST (   n,
  t,
 
)    static const t av_used __attribute__ ((aligned (n))) 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 87 of file mem_internal.h.

◆ ALIGN_64

#define ALIGN_64   16

Definition at line 105 of file mem_internal.h.

◆ ALIGN_32

#define ALIGN_32   16

Definition at line 106 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 109 of file mem_internal.h.

◆ DECLARE_ALIGNED_V

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

Definition at line 113 of file mem_internal.h.

◆ DECLARE_ALIGNED_4

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

Definition at line 115 of file mem_internal.h.

◆ DECLARE_ALIGNED_8

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

Definition at line 116 of file mem_internal.h.

◆ DECLARE_ALIGNED_16

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

Definition at line 117 of file mem_internal.h.

◆ DECLARE_ALIGNED_32

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

Definition at line 118 of file mem_internal.h.

◆ DECLARE_ALIGNED_64

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

Definition at line 119 of file mem_internal.h.

◆ E1

#define E1 (   x)    x

Definition at line 123 of file mem_internal.h.

◆ LOCAL_ALIGNED_A

#define LOCAL_ALIGNED_A (   a,
  t,
  v,
  s,
  o,
  ... 
)
Value:
uint8_t la_##v[sizeof(t s o) + (a)]; \
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)

Definition at line 125 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 129 of file mem_internal.h.

◆ LOCAL_ALIGNED

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

Definition at line 133 of file mem_internal.h.

◆ LOCAL_ALIGNED_4

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

Definition at line 138 of file mem_internal.h.

◆ LOCAL_ALIGNED_8

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

Definition at line 144 of file mem_internal.h.

◆ LOCAL_ALIGNED_16

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

Definition at line 150 of file mem_internal.h.

◆ LOCAL_ALIGNED_32

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

Definition at line 156 of file mem_internal.h.

DECLARE_ASM_ALIGNED
#define DECLARE_ASM_ALIGNED(n, t, v)
Definition: mem_internal.h:86
DECLARE_ASM_CONST
#define DECLARE_ASM_CONST(n, t, v)
Definition: mem_internal.h:87
s
#define s(width, name)
Definition: cbs_vp9.c:198
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
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
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78