FFmpeg
Data Structures | Macros | Enumerations | Functions
sw_ops.c File Reference
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/mem_internal.h"
#include "libavutil/refstruct.h"
#include "libswscale/filters.h"
#include "libswscale/ops_dispatch.h"
#include "libswscale/uops.h"
#include "libswscale/uops_macros.h"
#include "checkasm.h"

Go to the source code of this file.

Data Structures

struct  Test
 

Macros

#define FMT(fmt, ...)   tprintf((char[256]) {0}, 256, fmt, __VA_ARGS__)
 
#define MK_RANGES(R)   ((const unsigned[]) { R, R, R, R })
 
#define CHECK_FUNCTION(CHECK, NAME, ...)   CHECK(#NAME, &(SwsUOp) { __VA_ARGS__ });
 
#define CHECK_FOR(UOP, CHECK)
 

Enumerations

enum  { MAX_UOPS = 3, NB_PLANES = 4, PIXELS = 64, LINES = 16 }
 Copyright (C) 2025 Niklas Haas. More...
 

Functions

static const char * tprintf (char buf[], size_t size, const char *fmt,...)
 
static float rndf (void)
 
static SwsPixel constpx (SwsPixelType type, int val)
 
static SwsPixel rndpx (SwsPixelType type)
 
static void fill32f (float *line, int num, unsigned range)
 
static void fill32 (uint32_t *line, int num, unsigned range)
 
static void fill16 (uint16_t *line, int num, unsigned range)
 
static void fill8 (uint8_t *line, int num, unsigned range)
 
static SwsPixelType pixel_type_to_int (const SwsPixelType type)
 
static void check_compiled (const Test *test, const SwsCompiledOp *comp_ref, const SwsCompiledOp *comp_new)
 
static void run_test (const Test *test)
 
static void check_uop (const char *name, const SwsUOp *uop, SwsCompMask mask_in, SwsCompMask mask_out, const unsigned ranges[NB_PLANES])
 
static void check_range (const char *name, const SwsUOp *uop, const unsigned ranges[NB_PLANES])
 
static void check_simple (const char *name, const SwsUOp *uop)
 
static void check_scalar (const char *name, SwsUOp *uop)
 
static void check_vec4 (const char *name, SwsUOp *uop)
 
static void check_read (const char *name, SwsUOp *uop)
 
static void check_write (const char *name, const SwsUOp *uop)
 
static void check_filter (const char *name, SwsUOp *uop)
 
static void check_swizzle (const char *name, const SwsUOp *uop)
 
static void check_expand_bit (const char *name, const SwsUOp *uop)
 
static void check_cast (const char *name, const SwsUOp *uop)
 
static void check_scale (const char *name, SwsUOp *uop)
 
static void check_unpack (const char *name, const SwsUOp *uop)
 
static void check_pack (const char *name, const SwsUOp *uop)
 
static void check_linear (const char *name, SwsUOp *uop)
 
static void check_dither (const char *name, SwsUOp *uop)
 
void checkasm_check_sw_ops (void)
 

Macro Definition Documentation

◆ FMT

#define FMT (   fmt,
  ... 
)    tprintf((char[256]) {0}, 256, fmt, __VA_ARGS__)

Definition at line 56 of file sw_ops.c.

◆ MK_RANGES

#define MK_RANGES (   R)    ((const unsigned[]) { R, R, R, R })

Definition at line 477 of file sw_ops.c.

◆ CHECK_FUNCTION

#define CHECK_FUNCTION (   CHECK,
  NAME,
  ... 
)    CHECK(#NAME, &(SwsUOp) { __VA_ARGS__ });

Definition at line 637 of file sw_ops.c.

◆ CHECK_FOR

#define CHECK_FOR (   UOP,
  CHECK 
)
Value:
SWS_FOR_STRUCT(U16, UOP, CHECK_FUNCTION, CHECK) \
SWS_FOR_STRUCT(U32, UOP, CHECK_FUNCTION, CHECK) \
SWS_FOR_STRUCT(F32, UOP, CHECK_FUNCTION, CHECK) \
report(#UOP)

Definition at line 640 of file sw_ops.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

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 General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details.

You should have received a copy of the GNU 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.

Enumerator
MAX_UOPS 
NB_PLANES 
PIXELS 
LINES 

Definition at line 34 of file sw_ops.c.

Function Documentation

◆ tprintf()

static const char* tprintf ( char  buf[],
size_t  size,
const char *  fmt,
  ... 
)
static

Definition at line 57 of file sw_ops.c.

◆ rndf()

static float rndf ( void  )
static

Definition at line 66 of file sw_ops.c.

Referenced by fill32f(), and rndpx().

◆ constpx()

static SwsPixel constpx ( SwsPixelType  type,
int  val 
)
static

Definition at line 75 of file sw_ops.c.

Referenced by check_linear().

◆ rndpx()

static SwsPixel rndpx ( SwsPixelType  type)
static

Definition at line 86 of file sw_ops.c.

Referenced by check_dither(), check_linear(), check_scalar(), check_scale(), and check_vec4().

◆ fill32f()

static void fill32f ( float line,
int  num,
unsigned  range 
)
static

Definition at line 97 of file sw_ops.c.

Referenced by check_compiled().

◆ fill32()

static void fill32 ( uint32_t *  line,
int  num,
unsigned  range 
)
static

Definition at line 104 of file sw_ops.c.

Referenced by check_compiled(), fill16(), and fill8().

◆ fill16()

static void fill16 ( uint16_t *  line,
int  num,
unsigned  range 
)
static

Definition at line 110 of file sw_ops.c.

Referenced by check_compiled().

◆ fill8()

static void fill8 ( uint8_t *  line,
int  num,
unsigned  range 
)
static

Definition at line 120 of file sw_ops.c.

Referenced by check_compiled().

◆ pixel_type_to_int()

static SwsPixelType pixel_type_to_int ( const SwsPixelType  type)
static

Definition at line 130 of file sw_ops.c.

Referenced by check_uop().

◆ check_compiled()

static void check_compiled ( const Test test,
const SwsCompiledOp comp_ref,
const SwsCompiledOp comp_new 
)
static

We can't use check_func() alone because the actual function pointer may be a wrapper or entry point shared by multiple implementations. Solve it by hashing in the active CPU flags as well.

Definition at line 143 of file sw_ops.c.

Referenced by run_test().

◆ run_test()

static void run_test ( const Test test)
static

Definition at line 278 of file sw_ops.c.

Referenced by check_uop().

◆ check_uop()

static void check_uop ( const char *  name,
const SwsUOp uop,
SwsCompMask  mask_in,
SwsCompMask  mask_out,
const unsigned  ranges[NB_PLANES] 
)
static

◆ check_range()

static void check_range ( const char *  name,
const SwsUOp uop,
const unsigned  ranges[NB_PLANES] 
)
static

Definition at line 451 of file sw_ops.c.

Referenced by check_expand_bit(), check_scale(), and check_simple().

◆ check_simple()

static void check_simple ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 458 of file sw_ops.c.

Referenced by check_dither(), check_linear(), check_scalar(), check_vec4(), and checkasm_check_sw_ops().

◆ check_scalar()

static void check_scalar ( const char *  name,
SwsUOp uop 
)
static

Definition at line 463 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_vec4()

static void check_vec4 ( const char *  name,
SwsUOp uop 
)
static

Definition at line 469 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_read()

static void check_read ( const char *  name,
SwsUOp uop 
)
static

Definition at line 479 of file sw_ops.c.

Referenced by check_filter(), and checkasm_check_sw_ops().

◆ check_write()

static void check_write ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 484 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_filter()

static void check_filter ( const char *  name,
SwsUOp uop 
)
static

Definition at line 493 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_swizzle()

static void check_swizzle ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 526 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_expand_bit()

static void check_expand_bit ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 533 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_cast()

static void check_cast ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 538 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_scale()

static void check_scale ( const char *  name,
SwsUOp uop 
)
static

Definition at line 560 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_unpack()

static void check_unpack ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 577 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_pack()

static void check_pack ( const char *  name,
const SwsUOp uop 
)
static

Definition at line 586 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_linear()

static void check_linear ( const char *  name,
SwsUOp uop 
)
static

Definition at line 597 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ check_dither()

static void check_dither ( const char *  name,
SwsUOp uop 
)
static

Definition at line 614 of file sw_ops.c.

Referenced by checkasm_check_sw_ops().

◆ checkasm_check_sw_ops()

void checkasm_check_sw_ops ( void  )

Definition at line 647 of file sw_ops.c.

CHECK
CHECK(-1) CHECK(-2) }} }} CHECK(1) CHECK(2) }} }} } if(diff0+diff1 > 0) temp -
SWS_FOR_STRUCT
#define SWS_FOR_STRUCT(TYPE, UOP, MACRO,...)
Definition: uops_macros.h:19
CHECK_FUNCTION
#define CHECK_FUNCTION(CHECK, NAME,...)
Definition: sw_ops.c:637