FFmpeg
Loading...
Searching...
No Matches
stdatomic_impl.h File Reference
#include <string.h>
#include <intrin.h>

Go to the source code of this file.

Macros

#define FF_ATOMIC_LOCK_FREE   2
 
#define FF_ATOMIC_ALIGN64
 
#define WIN32_ATOMIC_LOAD_STORE(name, type, W)
 
#define WIN32_ATOMIC_ORDERED(Intrinsic, suffix)
 
#define WIN32_ATOMIC_XCHG_REL
 
#define WIN32_ATOMIC_CALL(Intrinsic, rel, order, ...)
 
#define WIN32_ATOMIC_OP(op, Intrinsic, rel, expr, name, type)
 
#define WIN32_ATOMIC_RMW(name, type, P, S)
 

Functions

static av_always_inline void ff_atomic_signal_fence (memory_order order)
 
static av_always_inline void win32_atomic_full_fence (void)
 
static av_always_inline void ff_atomic_thread_fence (memory_order order)
 

Macro Definition Documentation

◆ FF_ATOMIC_LOCK_FREE

#define FF_ATOMIC_LOCK_FREE   2

Definition at line 26 of file stdatomic_impl.h.

◆ FF_ATOMIC_ALIGN64

#define FF_ATOMIC_ALIGN64

Definition at line 34 of file stdatomic_impl.h.

◆ WIN32_ATOMIC_LOAD_STORE

#define WIN32_ATOMIC_LOAD_STORE ( name,
type,
W )
Value:
static av_always_inline type \
ff_atomic_load_##name(const volatile void *object, memory_order order) \
{ \
type value = \
(type)__iso_volatile_load##W((const volatile __int##W *)object); \
if (order != memory_order_relaxed) \
_ReadWriteBarrier(); \
return value; \
} \
\
static av_always_inline void ff_atomic_store_##name(volatile void *object, \
type desired, \
memory_order order) \
{ \
if (order != memory_order_relaxed) \
_ReadWriteBarrier(); \
__iso_volatile_store##W((volatile __int##W *)object, (__int##W)desired); \
if (order == memory_order_seq_cst) \
win32_atomic_full_fence(); \
}
double value
Definition eval.c:102
cl_device_type type
#define W(a, i, v)
Definition jpegls.h:119
#define av_always_inline
Definition attributes.h:72
const char * name
Definition qsvenc.c:142
memory_order
Definition stdatomic.h:28
@ memory_order_seq_cst
Definition stdatomic.h:34
@ memory_order_relaxed
Definition stdatomic.h:29

Definition at line 152 of file stdatomic_impl.h.

◆ WIN32_ATOMIC_ORDERED

#define WIN32_ATOMIC_ORDERED ( Intrinsic,
suffix )
Value:
Intrinsic

Definition at line 174 of file stdatomic_impl.h.

◆ WIN32_ATOMIC_XCHG_REL

#define WIN32_ATOMIC_XCHG_REL

Definition at line 175 of file stdatomic_impl.h.

◆ WIN32_ATOMIC_CALL

#define WIN32_ATOMIC_CALL ( Intrinsic,
rel,
order,
... )
Value:
((order) == memory_order_relaxed \
? WIN32_ATOMIC_ORDERED(Intrinsic, _nf)(__VA_ARGS__) \
: (order) == memory_order_release \
? WIN32_ATOMIC_ORDERED(Intrinsic, rel)(__VA_ARGS__) \
: (order) == memory_order_acquire || (order) == memory_order_consume \
? WIN32_ATOMIC_ORDERED(Intrinsic, _acq)(__VA_ARGS__) \
: Intrinsic(__VA_ARGS__))
@ memory_order_consume
Definition stdatomic.h:30
@ memory_order_release
Definition stdatomic.h:32
@ memory_order_acquire
Definition stdatomic.h:31
#define WIN32_ATOMIC_ORDERED(Intrinsic, suffix)

Definition at line 187 of file stdatomic_impl.h.

◆ WIN32_ATOMIC_OP

#define WIN32_ATOMIC_OP ( op,
Intrinsic,
rel,
expr,
name,
type )
Value:
static av_always_inline type ff_atomic_##op##name(volatile void *object, \
type operand, \
memory_order order) \
{ \
return WIN32_ATOMIC_CALL(Intrinsic, rel, order, object, expr); \
}
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
#define WIN32_ATOMIC_CALL(Intrinsic, rel, order,...)

Definition at line 222 of file stdatomic_impl.h.

◆ WIN32_ATOMIC_RMW

#define WIN32_ATOMIC_RMW ( name,
type,
P,
S )
Value:
static av_always_inline bool ff_atomic_cas_##name(volatile void *object, \
void *expected, \
type desired, \
memory_order order) \
{ \
type old, prev; \
memcpy(&old, expected, sizeof(old)); \
prev = WIN32_ATOMIC_CALL(P##CompareExchange##S, _rel, order, \
object, desired, old); \
if (prev == old) \
return 1; \
memcpy(expected, &prev, sizeof(prev)); \
return 0; \
} \
\
WIN32_ATOMIC_OP(exchange, P##Exchange##S, WIN32_ATOMIC_XCHG_REL, \
operand, _##name, type) \
WIN32_ATOMIC_OP(fetch_add, P##ExchangeAdd##S, _rel, operand, _##name, type) \
WIN32_ATOMIC_OP(fetch_sub, P##ExchangeAdd##S, _rel, \
(type)(0 - (uint64_t)operand), _##name, type) \
WIN32_ATOMIC_OP(fetch_or, P##Or##S, _rel, operand, _##name, type) \
WIN32_ATOMIC_OP(fetch_xor, P##Xor##S, _rel, operand, _##name, type) \
WIN32_ATOMIC_OP(fetch_and, P##And##S, _rel, operand, _##name, type)
#define _
#define S(s, c, i)
#define P
static int exchange(MqcState *mqc, uint8_t *cxstate, int lps)
Definition mqcdec.c:45
#define WIN32_ATOMIC_XCHG_REL

Definition at line 233 of file stdatomic_impl.h.

Function Documentation

◆ ff_atomic_signal_fence()

static av_always_inline void ff_atomic_signal_fence ( memory_order order)
static

Definition at line 38 of file stdatomic_impl.h.

◆ win32_atomic_full_fence()

static av_always_inline void win32_atomic_full_fence ( void )
static

Definition at line 142 of file stdatomic_impl.h.

Referenced by ff_atomic_thread_fence().

◆ ff_atomic_thread_fence()

static av_always_inline void ff_atomic_thread_fence ( memory_order order)
static

Definition at line 177 of file stdatomic_impl.h.