FFmpeg
Data Structures | Macros
uops_tmpl.h File Reference
#include <assert.h>
#include <float.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "ops_chain.h"
#include "uops_macros.h"

Go to the source code of this file.

Data Structures

union  block_t
 
struct  SwsOpIter
 Internal context holding per-iter execution data. More...
 

Macros

#define SWS_BLOCK_SIZE   32
 Copyright (C) 2026 Niklas Haas. More...
 
#define SIZEOF_BLOCK   (sizeof(pixel_t) * SWS_BLOCK_SIZE)
 
#define SWS_LOOP   AV_PRAGMA(GCC ivdep)
 
#define bitfn2(name, ext)   name ## _ ## ext
 
#define bitfn(name, ext)   bitfn2(name, ext)
 
#define fn(name)   bitfn(name, PX)
 
#define bump_ptr(ptr, bump)   ((pixel_t *) ((uintptr_t) (ptr) + (bump)))
 
#define X   SWS_COMP_TEST(mask, 0)
 
#define Y   SWS_COMP_TEST(mask, 1)
 
#define Z   SWS_COMP_TEST(mask, 2)
 
#define W   SWS_COMP_TEST(mask, 3)
 
#define DECL_FUNC(NAME, ...)
 
#define DECL_READ(NAME, ...)
 
#define DECL_WRITE(NAME, ...)
 
#define CALL(NAME, ...)   fn(NAME)(iter, impl, x, y, z, w, __VA_ARGS__)
 
#define CONTINUE(...)
 
#define DECL_SETUP(NAME, PARAMS, OUT)
 
#define DECL_IMPL(FUNC, NAME, TYPE, UOP, ...)
 
#define DECL_IMPL_READ(...)
 
#define DECL_IMPL_WRITE(...)
 
#define REF_ENTRY(DUMMY, NAME, ...)   &op_##NAME,
 
#define DECL_ENTRY(SETUP, NAME, ...)
 

Macro Definition Documentation

◆ SWS_BLOCK_SIZE

#define SWS_BLOCK_SIZE   32

Copyright (C) 2026 Niklas Haas.

This file is part of FFmpeg.

FFmpeg is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

FFmpeg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with FFmpeg; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Helper macros for the C-based backend.

To use these macros, pixel_t should be defined as the type of pixels.

Definition at line 40 of file uops_tmpl.h.

◆ SIZEOF_BLOCK

#define SIZEOF_BLOCK   (sizeof(pixel_t) * SWS_BLOCK_SIZE)

Definition at line 50 of file uops_tmpl.h.

◆ SWS_LOOP

#define SWS_LOOP   AV_PRAGMA(GCC ivdep)

Definition at line 68 of file uops_tmpl.h.

◆ bitfn2

#define bitfn2 (   name,
  ext 
)    name ## _ ## ext

Definition at line 74 of file uops_tmpl.h.

◆ bitfn

#define bitfn (   name,
  ext 
)    bitfn2(name, ext)

Definition at line 75 of file uops_tmpl.h.

◆ fn

#define fn (   name)    bitfn(name, PX)

Definition at line 76 of file uops_tmpl.h.

◆ bump_ptr

#define bump_ptr (   ptr,
  bump 
)    ((pixel_t *) ((uintptr_t) (ptr) + (bump)))

Definition at line 78 of file uops_tmpl.h.

◆ X

#define X   SWS_COMP_TEST(mask, 0)

Definition at line 81 of file uops_tmpl.h.

◆ Y

#define Y   SWS_COMP_TEST(mask, 1)

Definition at line 82 of file uops_tmpl.h.

◆ Z

#define Z   SWS_COMP_TEST(mask, 2)

Definition at line 83 of file uops_tmpl.h.

◆ W

#define W   SWS_COMP_TEST(mask, 3)

Definition at line 84 of file uops_tmpl.h.

◆ DECL_FUNC

#define DECL_FUNC (   NAME,
  ... 
)
Value:
fn(NAME)(SwsOpIter *restrict iter, const SwsOpImpl *restrict impl, \
pixel_t *restrict x, pixel_t *restrict y, \
pixel_t *restrict z, pixel_t *restrict w, \
__VA_ARGS__)

Definition at line 87 of file uops_tmpl.h.

◆ DECL_READ

#define DECL_READ (   NAME,
  ... 
)
Value:
DECL_FUNC(NAME, __VA_ARGS__, \
const pixel_t *restrict in0, const pixel_t *restrict in1, \
const pixel_t *restrict in2, const pixel_t *restrict in3) \

Definition at line 94 of file uops_tmpl.h.

◆ DECL_WRITE

#define DECL_WRITE (   NAME,
  ... 
)
Value:
DECL_FUNC(NAME, __VA_ARGS__, \
pixel_t *restrict out0, pixel_t *restrict out1, \
pixel_t *restrict out2, pixel_t *restrict out3) \

Definition at line 99 of file uops_tmpl.h.

◆ CALL

#define CALL (   NAME,
  ... 
)    fn(NAME)(iter, impl, x, y, z, w, __VA_ARGS__)

Definition at line 104 of file uops_tmpl.h.

◆ CONTINUE

#define CONTINUE (   ...)
Value:
((void (*)(SwsOpIter *, const SwsOpImpl *, \
void *restrict x, void *restrict y, \
void *restrict z, void *restrict w)) impl->cont) \
(iter, &impl[1], __VA_ARGS__)

Definition at line 107 of file uops_tmpl.h.

◆ DECL_SETUP

#define DECL_SETUP (   NAME,
  PARAMS,
  OUT 
)
Value:
av_unused static int fn(NAME)(const SwsImplParams *PARAMS, \
SwsImplResult *OUT)

Definition at line 114 of file uops_tmpl.h.

◆ DECL_IMPL

#define DECL_IMPL (   FUNC,
  NAME,
  TYPE,
  UOP,
  ... 
)
Value:
av_flatten static void NAME##_c(SwsOpIter *restrict iter, \
const SwsOpImpl *restrict impl, \
void *restrict x, void *restrict y, \
void *restrict z, void *restrict w) \
{ \
CALL(FUNC, __VA_ARGS__); \
}

Definition at line 119 of file uops_tmpl.h.

◆ DECL_IMPL_READ

#define DECL_IMPL_READ (   ...)
Value:
DECL_IMPL(__VA_ARGS__, \
(const pixel_t *) iter->in[0], (const pixel_t *) iter->in[1], \
(const pixel_t *) iter->in[2], (const pixel_t *) iter->in[3])

Definition at line 128 of file uops_tmpl.h.

◆ DECL_IMPL_WRITE

#define DECL_IMPL_WRITE (   ...)
Value:
DECL_IMPL(__VA_ARGS__, \
(pixel_t *) iter->out[0], (pixel_t *) iter->out[1], \
(pixel_t *) iter->out[2], (pixel_t *) iter->out[3])

Definition at line 133 of file uops_tmpl.h.

◆ REF_ENTRY

#define REF_ENTRY (   DUMMY,
  NAME,
  ... 
)    &op_##NAME,

Definition at line 138 of file uops_tmpl.h.

◆ DECL_ENTRY

#define DECL_ENTRY (   SETUP,
  NAME,
  ... 
)
Value:
static const SwsOpEntry op_##NAME = { \
.func = (SwsFuncPtr) NAME##_c, \
__VA_ARGS__, \
};

Definition at line 139 of file uops_tmpl.h.

fn
#define fn(name)
Definition: uops_tmpl.h:76
SwsOpIter
Internal context holding per-iter execution data.
Definition: uops_tmpl.h:56
av_always_inline
#define av_always_inline
Definition: attributes.h:76
SwsFuncPtr
void(* SwsFuncPtr)(void)
Per-kernel execution context.
Definition: ops_chain.h:70
DECL_FUNC
#define DECL_FUNC(NAME,...)
Definition: uops_tmpl.h:87
av_unused
#define av_unused
Definition: attributes.h:164
SwsOpImpl
Definition: ops_chain.h:71
PARAMS
#define PARAMS(...)
Definition: vf_drawvg.c:259
DECL_IMPL
#define DECL_IMPL(FUNC, NAME, TYPE, UOP,...)
Definition: uops_tmpl.h:119
SwsImplParams
Definition: ops_chain.h:105
SwsOpEntry::func
SwsFuncPtr func
Definition: ops_chain.h:130
av_flatten
#define av_flatten
Definition: attributes.h:125
SwsOpEntry
Definition: ops_chain.h:122
OUT
@ OUT
Definition: af_loudnorm.c:41
pixel_t
#define pixel_t
Definition: uops_tmpl.c:51
FUNC
#define FUNC(a)
Definition: bit_depth_template.c:104
SETUP
@ SETUP
Definition: rtspcodes.h:133
w
uint8_t w
Definition: llvidencdsp.c:39