FFmpeg
Data Structures | Macros | Typedefs | Enumerations | Functions
uops.h File Reference
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include "libavutil/attributes.h"

Go to the source code of this file.

Data Structures

union  SwsPixel
 
struct  SwsFilterUOp
 
struct  SwsShiftUOp
 
struct  SwsSwizzleUOp
 
struct  SwsMoveUOp
 
struct  SwsPackUOp
 
struct  SwsClearUOp
 
struct  SwsLinearUOp
 
struct  SwsDitherUOp
 
union  SwsUOpParams
 
struct  SwsUOp
 
struct  SwsUOpList
 

Macros

#define SWS_COMP(X)   (1 << (X))
 
#define SWS_COMP_TEST(mask, X)   (!!((mask) & SWS_COMP(X)))
 
#define SWS_COMP_INV(mask)   ((mask) ^ SWS_COMP_ALL)
 
#define SWS_COMP_ELEMS(N)   ((1 << (N)) - 1)
 
#define SWS_COMP_MASK(X, Y, Z, W)
 
#define SWS_UOP_MOVE_MAX   6
 
#define SWS_UOP_NAME_MAX   64
 Generate a unique name for a SwsUOp. More...
 

Typedefs

typedef uint8_t SwsCompMask
 Bit-mask of components. More...
 
typedef uint32_t SwsUOpFlags
 

Enumerations

enum  SwsPixelType {
  SWS_PIXEL_NONE = 0, SWS_PIXEL_U8, SWS_PIXEL_U16, SWS_PIXEL_U32,
  SWS_PIXEL_F32, SWS_PIXEL_TYPE_NB
}
 
enum  { SWS_COMP_NONE = 0, SWS_COMP_ALL = 0xF }
 
enum  SwsUOpFlagBits { SWS_UOP_FLAG_NONE = 0, SWS_UOP_FLAG_FMA = (1 << 0), SWS_UOP_FLAG_MOVE = (1 << 1) }
 
enum  SwsUOpType {
  SWS_UOP_INVALID = 0, SWS_UOP_READ_PLANAR, SWS_UOP_READ_PLANAR_FH, SWS_UOP_READ_PLANAR_FV,
  SWS_UOP_READ_PLANAR_FV_FMA, SWS_UOP_READ_PACKED, SWS_UOP_READ_NIBBLE, SWS_UOP_READ_BIT,
  SWS_UOP_WRITE_PLANAR, SWS_UOP_WRITE_PACKED, SWS_UOP_WRITE_NIBBLE, SWS_UOP_WRITE_BIT,
  SWS_UOP_PERMUTE, SWS_UOP_COPY, SWS_UOP_MOVE, SWS_UOP_SWAP_BYTES,
  SWS_UOP_EXPAND_BIT, SWS_UOP_EXPAND_PAIR, SWS_UOP_EXPAND_QUAD, SWS_UOP_TO_U8,
  SWS_UOP_TO_U16, SWS_UOP_TO_U32, SWS_UOP_TO_F32, SWS_UOP_SCALE,
  SWS_UOP_ADD, SWS_UOP_MIN, SWS_UOP_MAX, SWS_UOP_UNPACK,
  SWS_UOP_PACK, SWS_UOP_LSHIFT, SWS_UOP_RSHIFT, SWS_UOP_CLEAR,
  SWS_UOP_LINEAR, SWS_UOP_LINEAR_FMA, SWS_UOP_DITHER, SWS_UOP_TYPE_NB
}
 

Functions

const char * ff_sws_pixel_type_name (SwsPixelType type)
 
int ff_sws_pixel_type_size (SwsPixelType type) av_const
 
bool ff_sws_pixel_type_is_int (SwsPixelType type) av_const
 
int ff_sws_dither_height (const SwsDitherUOp *dither)
 Computes (1 << size_log2) + MAX(y_offset). More...
 
int ff_sws_uop_cmp (const SwsUOp *a, const SwsUOp *b)
 Compare two SwsUOps for equality (excluding constant data). More...
 
static int ff_sws_uop_cmp_v (const void *a, const void *b)
 
void ff_sws_uop_name (const SwsUOp *op, char buf[SWS_UOP_NAME_MAX])
 
SwsUOpListff_sws_uop_list_alloc (void)
 
void ff_sws_uop_list_free (SwsUOpList **ops)
 
int ff_sws_uop_list_append (SwsUOpList *uops, SwsUOp *uop)
 
int ff_sws_ops_translate (SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags, SwsUOpList *uops)
 Translate a list of operations down to micro-ops, which can be further optimized and then directly executed by backends. More...
 
int ff_sws_uops_macros_gen (char **out_str)
 Generate a set of boilerplate C preprocessor macros for describing and programmatically iterating over all possible SwsUOps. More...
 

Macro Definition Documentation

◆ SWS_COMP

#define SWS_COMP (   X)    (1 << (X))

Definition at line 70 of file uops.h.

◆ SWS_COMP_TEST

#define SWS_COMP_TEST (   mask,
  X 
)    (!!((mask) & SWS_COMP(X)))

Definition at line 71 of file uops.h.

◆ SWS_COMP_INV

#define SWS_COMP_INV (   mask)    ((mask) ^ SWS_COMP_ALL)

Definition at line 72 of file uops.h.

◆ SWS_COMP_ELEMS

#define SWS_COMP_ELEMS (   N)    ((1 << (N)) - 1)

Definition at line 73 of file uops.h.

◆ SWS_COMP_MASK

#define SWS_COMP_MASK (   X,
  Y,
  Z,
  W 
)
Value:
(((X) ? SWS_COMP(0) : 0) | \
((Y) ? SWS_COMP(1) : 0) | \
((Z) ? SWS_COMP(2) : 0) | \
((W) ? SWS_COMP(3) : 0))

Definition at line 74 of file uops.h.

◆ SWS_UOP_MOVE_MAX

#define SWS_UOP_MOVE_MAX   6

Definition at line 154 of file uops.h.

◆ SWS_UOP_NAME_MAX

#define SWS_UOP_NAME_MAX   64

Generate a unique name for a SwsUOp.

Definition at line 232 of file uops.h.

Typedef Documentation

◆ SwsCompMask

typedef uint8_t SwsCompMask

Bit-mask of components.

Exact meaning depends on the usage context.

Definition at line 61 of file uops.h.

◆ SwsUOpFlags

typedef uint32_t SwsUOpFlags

Definition at line 81 of file uops.h.

Enumeration Type Documentation

◆ SwsPixelType

Enumerator
SWS_PIXEL_NONE 
SWS_PIXEL_U8 
SWS_PIXEL_U16 
SWS_PIXEL_U32 
SWS_PIXEL_F32 
SWS_PIXEL_TYPE_NB 

Definition at line 38 of file uops.h.

◆ anonymous enum

anonymous enum
Enumerator
SWS_COMP_NONE 
SWS_COMP_ALL 

Definition at line 67 of file uops.h.

◆ SwsUOpFlagBits

Enumerator
SWS_UOP_FLAG_NONE 
SWS_UOP_FLAG_FMA 
SWS_UOP_FLAG_MOVE 

Definition at line 82 of file uops.h.

◆ SwsUOpType

enum SwsUOpType
Enumerator
SWS_UOP_INVALID 
SWS_UOP_READ_PLANAR 
SWS_UOP_READ_PLANAR_FH 
SWS_UOP_READ_PLANAR_FV 
SWS_UOP_READ_PLANAR_FV_FMA 
SWS_UOP_READ_PACKED 
SWS_UOP_READ_NIBBLE 
SWS_UOP_READ_BIT 
SWS_UOP_WRITE_PLANAR 
SWS_UOP_WRITE_PACKED 
SWS_UOP_WRITE_NIBBLE 
SWS_UOP_WRITE_BIT 
SWS_UOP_PERMUTE 
SWS_UOP_COPY 
SWS_UOP_MOVE 
SWS_UOP_SWAP_BYTES 
SWS_UOP_EXPAND_BIT 
SWS_UOP_EXPAND_PAIR 
SWS_UOP_EXPAND_QUAD 
SWS_UOP_TO_U8 
SWS_UOP_TO_U16 
SWS_UOP_TO_U32 
SWS_UOP_TO_F32 
SWS_UOP_SCALE 
SWS_UOP_ADD 
SWS_UOP_MIN 
SWS_UOP_MAX 
SWS_UOP_UNPACK 
SWS_UOP_PACK 
SWS_UOP_LSHIFT 
SWS_UOP_RSHIFT 
SWS_UOP_CLEAR 
SWS_UOP_LINEAR 
SWS_UOP_LINEAR_FMA 
SWS_UOP_DITHER 
SWS_UOP_TYPE_NB 

Definition at line 88 of file uops.h.

Function Documentation

◆ ff_sws_pixel_type_name()

const char* ff_sws_pixel_type_name ( SwsPixelType  type)

Definition at line 62 of file ops.c.

Referenced by ff_sws_op_desc(), ff_sws_op_list_print(), and ff_sws_uop_name().

◆ ff_sws_pixel_type_size()

int ff_sws_pixel_type_size ( SwsPixelType  type) const

◆ ff_sws_pixel_type_is_int()

bool ff_sws_pixel_type_is_int ( SwsPixelType  type) const

◆ ff_sws_dither_height()

int ff_sws_dither_height ( const SwsDitherUOp dither)

Computes (1 << size_log2) + MAX(y_offset).

The dither matrix attached to the SwsUOp is always pre-padded to this number of lines.

Definition at line 400 of file uops.c.

Referenced by DECL_SETUP(), and translate_dither_op().

◆ ff_sws_uop_cmp()

int ff_sws_uop_cmp ( const SwsUOp a,
const SwsUOp b 
)

Compare two SwsUOps for equality (excluding constant data).

Compare two SwsUOps for equality (excluding constant data).

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 32 of file uops.c.

Referenced by ff_sws_uop_cmp_v(), and ff_sws_uop_lookup().

◆ ff_sws_uop_cmp_v()

static int ff_sws_uop_cmp_v ( const void *  a,
const void *  b 
)
inlinestatic

Definition at line 224 of file uops.h.

Referenced by register_uop().

◆ ff_sws_uop_name()

void ff_sws_uop_name ( const SwsUOp op,
char  buf[SWS_UOP_NAME_MAX] 
)

◆ ff_sws_uop_list_alloc()

SwsUOpList* ff_sws_uop_list_alloc ( void  )

Definition at line 382 of file uops.c.

Referenced by compile(), print_ops(), and register_flags().

◆ ff_sws_uop_list_free()

void ff_sws_uop_list_free ( SwsUOpList **  ops)

Definition at line 368 of file uops.c.

Referenced by compile(), print_ops(), and register_flags().

◆ ff_sws_uop_list_append()

int ff_sws_uop_list_append ( SwsUOpList uops,
SwsUOp uop 
)

◆ ff_sws_ops_translate()

int ff_sws_ops_translate ( SwsContext ctx,
const SwsOpList ops,
SwsUOpFlags  flags,
SwsUOpList uops 
)

Translate a list of operations down to micro-ops, which can be further optimized and then directly executed by backends.

Return 0 or a negative error code.

Definition at line 850 of file uops.c.

Referenced by compile(), print_ops(), and register_flags().

◆ ff_sws_uops_macros_gen()

int ff_sws_uops_macros_gen ( char **  out_str)

Generate a set of boilerplate C preprocessor macros for describing and programmatically iterating over all possible SwsUOps.

This function can be quite slow as it iterates over every possible combination of pixel formats and flags.

Returns 0 or a negative error code. On success, an allocated string is returned via out_str, and must be av_free()'d by the caller.

Additionally make sure planar reads/writes are always available for all formats, because checkasm depends on them to be able to verify the input/output of any other operations.

Definition at line 964 of file uops.c.

Referenced by main().

Z
#define Z
Definition: uops_tmpl.h:83
X
@ X
Definition: vf_addroi.c:27
W
#define W(a, i, v)
Definition: jpegls.h:119
SWS_COMP
#define SWS_COMP(X)
Definition: uops.h:70
Y
#define Y
Definition: boxblur.h:37