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

Go to the source code of this file.

Macros

#define DECLARE_ALIGNED(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 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

#define DECLARE_ALIGNED (   n,
  t,
 
)    t __attribute__ ((aligned (n))) 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 87 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 88 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 89 of file mem_internal.h.

◆ E1

#define E1 (   x)    x

Definition at line 102 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 104 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 108 of file mem_internal.h.

◆ LOCAL_ALIGNED

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

Definition at line 112 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 117 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 123 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 129 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 135 of file mem_internal.h.

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