FFmpeg
Macros | Functions
ops_tmpl_int.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/bswap.h"
#include "ops_backend.h"
#include "ops_tmpl_common.c"

Go to the source code of this file.

Macros

#define BIT_DEPTH   8
 Copyright (C) 2025 Niklas Haas. More...
 
#define PIXEL_TYPE   SWS_PIXEL_U8
 
#define PIXEL_MAX   0xFFu
 
#define pixel_t   uint8_t
 
#define block_t   u8block_t
 
#define px   u8
 
#define IS_FLOAT   0
 
#define FMT_CHAR   u
 
#define PIXEL_MIN   0
 
#define WRAP_READ(FUNC, ELEMS, FRAC, PACKED)
 
#define WRAP_WRITE(FUNC, ELEMS, FRAC, PACKED)
 
#define WRAP_PACK_UNPACK(X, Y, Z, W)
 
#define DECL_SWIZZLE(X, Y, Z, W)
 Swizzle by directly swapping the order of arguments to the continuation. More...
 
#define DECL_EXPAND_LUMA(X, W, T0, T1)
 

Functions

 DECL_READ (read_planar, const int elems)
 
 DECL_READ (read_packed, const int elems)
 
 DECL_WRITE (write_planar, const int elems)
 
 DECL_WRITE (write_packed, const int elems)
 
 DECL_READ (read_nibbles, const int elems)
 
 DECL_READ (read_bits, const int elems)
 
 DECL_WRITE (write_nibbles, const int elems)
 
 DECL_WRITE (write_bits, const int elems)
 
 DECL_PATTERN (expand16)
 
 WRAP_COMMON_PATTERNS (expand16,.op=SWS_OP_CONVERT,.convert.to=SWS_PIXEL_U16,.convert.expand=true,)
 
 DECL_PATTERN (expand32)
 
 WRAP_COMMON_PATTERNS (expand32,.op=SWS_OP_CONVERT,.convert.to=SWS_PIXEL_U32,.convert.expand=true,)
 
 DECL_PATTERN (convert_float)
 
 WRAP_COMMON_PATTERNS (convert_float,.op=SWS_OP_CONVERT,.convert.to=SWS_PIXEL_F32,)
 
static const SwsOpTable fn (op_table_int)
 

Macro Definition Documentation

◆ BIT_DEPTH

#define BIT_DEPTH   8

Copyright (C) 2025 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

Definition at line 27 of file ops_tmpl_int.c.

◆ PIXEL_TYPE

#define PIXEL_TYPE   SWS_PIXEL_U8

Definition at line 45 of file ops_tmpl_int.c.

◆ PIXEL_MAX

#define PIXEL_MAX   0xFFu

Definition at line 46 of file ops_tmpl_int.c.

◆ pixel_t

#define pixel_t   uint8_t

Definition at line 47 of file ops_tmpl_int.c.

◆ block_t

#define block_t   u8block_t

Definition at line 48 of file ops_tmpl_int.c.

◆ px

#define px   u8

Definition at line 49 of file ops_tmpl_int.c.

◆ IS_FLOAT

#define IS_FLOAT   0

Definition at line 54 of file ops_tmpl_int.c.

◆ FMT_CHAR

#define FMT_CHAR   u

Definition at line 55 of file ops_tmpl_int.c.

◆ PIXEL_MIN

#define PIXEL_MIN   0

Definition at line 56 of file ops_tmpl_int.c.

◆ WRAP_READ

#define WRAP_READ (   FUNC,
  ELEMS,
  FRAC,
  PACKED 
)
Value:
{ \
CALL_READ(FUNC, ELEMS); \
for (int i = 0; i < (PACKED ? 1 : ELEMS); i++) \
iter->in[i] += sizeof(block_t) * (PACKED ? ELEMS : 1) >> FRAC; \
} \
.rw = { \
.elems = ELEMS, \
.packed = PACKED, \
.frac = FRAC, \
}, \
);

Definition at line 123 of file ops_tmpl_int.c.

◆ WRAP_WRITE

#define WRAP_WRITE (   FUNC,
  ELEMS,
  FRAC,
  PACKED 
)
Value:
{ \
CALL_WRITE(FUNC, ELEMS); \
for (int i = 0; i < (PACKED ? 1 : ELEMS); i++) \
iter->out[i] += sizeof(block_t) * (PACKED ? ELEMS : 1) >> FRAC; \
} \
.rw = { \
.elems = ELEMS, \
.packed = PACKED, \
.frac = FRAC, \
}, \
);

Definition at line 148 of file ops_tmpl_int.c.

◆ WRAP_PACK_UNPACK

#define WRAP_PACK_UNPACK (   X,
  Y,
  Z,
  W 
)

Definition at line 306 of file ops_tmpl_int.c.

◆ DECL_SWIZZLE

#define DECL_SWIZZLE (   X,
  Y,
  Z,
  W 
)
Value:
fn(swizzle_##X##Y##Z##W)(SwsOpIter *restrict iter, \
const SwsOpImpl *restrict impl, \
block_t c0, block_t c1, block_t c2, block_t c3) \
{ \
CONTINUE(block_t, c##X, c##Y, c##Z, c##W); \
} \
DECL_ENTRY(swizzle_##X##Y##Z##W, \
.swizzle.in = { X, Y, Z, W }, \
);

Swizzle by directly swapping the order of arguments to the continuation.

Note that this is only safe to do if no arguments are duplicated.

Definition at line 427 of file ops_tmpl_int.c.

◆ DECL_EXPAND_LUMA

#define DECL_EXPAND_LUMA (   X,
  W,
  T0,
  T1 
)
Value:
fn(expand_luma_##X##W)(SwsOpIter *restrict iter, \
const SwsOpImpl *restrict impl, \
block_t c0, block_t c1, block_t c2, block_t c3) \
{ \
for (int i = 0; i < SWS_BLOCK_SIZE; i++) \
T0[i] = T1[i] = c0[i]; \
CONTINUE(block_t, c##X, T0, T1, c##W); \
} \
DECL_ENTRY(expand_luma_##X##W, \
.swizzle.in = { X, 0, 0, W }, \
);

Definition at line 461 of file ops_tmpl_int.c.

Function Documentation

◆ DECL_READ() [1/4]

DECL_READ ( read_planar  ,
const int  elems 
)

Definition at line 59 of file ops_tmpl_int.c.

◆ DECL_READ() [2/4]

DECL_READ ( read_packed  ,
const int  elems 
)

Definition at line 77 of file ops_tmpl_int.c.

◆ DECL_WRITE() [1/4]

DECL_WRITE ( write_planar  ,
const int  elems 
)

Definition at line 95 of file ops_tmpl_int.c.

◆ DECL_WRITE() [2/4]

DECL_WRITE ( write_packed  ,
const int  elems 
)

Definition at line 109 of file ops_tmpl_int.c.

◆ DECL_READ() [3/4]

DECL_READ ( read_nibbles  ,
const int  elems 
)

Definition at line 174 of file ops_tmpl_int.c.

◆ DECL_READ() [4/4]

DECL_READ ( read_bits  ,
const int  elems 
)

Definition at line 188 of file ops_tmpl_int.c.

◆ DECL_WRITE() [3/4]

DECL_WRITE ( write_nibbles  ,
const int  elems 
)

Definition at line 211 of file ops_tmpl_int.c.

◆ DECL_WRITE() [4/4]

DECL_WRITE ( write_bits  ,
const int  elems 
)

Definition at line 218 of file ops_tmpl_int.c.

◆ DECL_PATTERN() [1/3]

DECL_PATTERN ( expand16  )

Definition at line 259 of file ops_tmpl_int.c.

◆ WRAP_COMMON_PATTERNS() [1/3]

WRAP_COMMON_PATTERNS ( expand16  ,
op = SWS_OP_CONVERT,
.convert.  to = SWS_PIXEL_U16,
.convert.  expand = true 
)

◆ DECL_PATTERN() [2/3]

DECL_PATTERN ( expand32  )

Definition at line 284 of file ops_tmpl_int.c.

◆ WRAP_COMMON_PATTERNS() [2/3]

WRAP_COMMON_PATTERNS ( expand32  ,
op = SWS_OP_CONVERT,
.convert.  to = SWS_PIXEL_U32,
.convert.  expand = true 
)

◆ DECL_PATTERN() [3/3]

DECL_PATTERN ( convert_float  )

Definition at line 403 of file ops_tmpl_int.c.

◆ WRAP_COMMON_PATTERNS() [3/3]

WRAP_COMMON_PATTERNS ( convert_float  ,
op = SWS_OP_CONVERT,
.convert.  to = SWS_PIXEL_F32 
)

◆ fn()

static const SwsOpTable fn ( op_table_int  )
static
SWS_OP_READ
@ SWS_OP_READ
Definition: ops.h:48
W
@ W
Definition: vf_addroi.c:27
SWS_OP_SWIZZLE
@ SWS_OP_SWIZZLE
Definition: ops.h:58
ELEMS
#define ELEMS
SwsOpIter
Copyright (C) 2025 Niklas Haas.
Definition: ops_backend.h:46
c1
static const uint64_t c1
Definition: murmur3.c:52
X
@ X
Definition: vf_addroi.c:27
CONTINUE
#define CONTINUE(TYPE,...)
Definition: ops_backend.h:116
op
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
SwsOpImpl
Definition: ops_chain.h:67
DECL_ENTRY
#define DECL_ENTRY(NAME,...)
Definition: ops_backend.h:133
SWS_BLOCK_SIZE
#define SWS_BLOCK_SIZE
Copyright (C) 2025 Niklas Haas.
Definition: ops_backend.c:30
fn
static const SwsOpTable fn(op_table_int)
DECL_IMPL
#define DECL_IMPL(NAME)
Definition: ops_backend.h:109
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:424
SWS_OP_WRITE
@ SWS_OP_WRITE
Definition: ops.h:49
SWS_FUNC
#define SWS_FUNC
Definition: ops_backend.h:56
Y
#define Y
Definition: boxblur.h:37
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
block_t
#define block_t
Definition: ops_tmpl_int.c:48
c2
static const uint64_t c2
Definition: murmur3.c:53
FUNC
#define FUNC(a)
Definition: bit_depth_template.c:101