56#define FMT(fmt, ...) tprintf((char[256]) {0}, 256, fmt, __VA_ARGS__)
57static const char *
tprintf(
char buf[],
size_t size,
const char *fmt, ...)
68 union { uint32_t
u;
float f; } x;
71 }
while (!isnormal(x.f));
100 for (
int i = 0;
i < num;
i++)
106 for (
int i = 0;
i < num;
i++)
115 for (
int i = 0;
i < num;
i++)
125 for (
int i = 0;
i < num;
i++)
152 uintptr_t
id = (uintptr_t) comp_new->
func;
153 id ^= (
id << 6) + (
id >> 2) + 0x9e3779b97f4a7c15 + comp_new->
cpu_flags;
166 void *plane =
src0[p];
168 memset(plane, 0,
sizeof(
src0[p]));
172 switch (
test->type_in) {
174 fill8(plane,
sizeof(
src0[p]) /
sizeof(uint8_t),
test->ranges[p]);
177 fill16(plane,
sizeof(
src0[p]) /
sizeof(uint16_t),
test->ranges[p]);
180 fill32(plane,
sizeof(
src0[p]) /
sizeof(uint32_t),
test->ranges[p]);
189 memset(dst0, 0,
sizeof(dst0));
190 memset(dst1, 0,
sizeof(dst1));
192 const int read_size =
PIXELS *
test->pixel_bits_in >> 3;
193 const int write_size =
PIXELS *
test->pixel_bits_out >> 3;
208 switch (read_op->
uop) {
211 static_assert(
sizeof(
src0[1]) >=
sizeof(uint32_t[256]),
"palette plane too small");
215 for (
int y = 0; y <
LINES - 1; y++)
217 in_bump_y[
LINES - 1] = 0;
223 for (
int x = 0; x <
PIXELS; x++)
224 in_offset_x[x] =
offsets[x] *
test->pixel_bits_in >> 3;
231 exec.
out[
i] = (
void *) dst0[
i];
239 exec.
out[
i] = (
void *) dst1[
i];
250 const int stride =
sizeof(dst0[
i][0]);
251 switch (
test->type_out) {
253 checkasm_check(uint8_t, (
void *) dst0[
i],
stride,
258 checkasm_check(uint16_t, (
void *) dst0[
i],
stride,
263 checkasm_check(uint32_t, (
void *) dst0[
i],
stride,
268 checkasm_check(float_ulp, (
void *) dst0[
i],
stride,
288 .num_ops =
test->num_uops,
295 for (
int i = 0;
i <
test->num_uops;
i++) {
336 }
else if (ret < 0) {
358 .type_in = uop->
type,
359 .type_out = uop->
type,
471 for (
int i = 0;
i < 4;
i++)
477#define MK_RANGES(R) ((const unsigned[]) { R, R, R, R })
488 const int bits = 8 >> frac;
553 unsigned range = UINT32_MAX >> (32 - osize * 8);
563 const unsigned max = UINT32_MAX >> (32 -
bits);
580 const int total = pat[0] + pat[1] + pat[2] + pat[3];
581 const unsigned range = UINT32_MAX >> (32 - total);
589 const unsigned ranges[4] = {
590 (1 << pat[0]) - 1, (1 << pat[1]) - 1,
591 (1 << pat[2]) - 1, (1 << pat[3]) - 1,
600 for (
int i = 0;
i < 4;
i++) {
601 for (
int j = 0; j < 5; j++) {
663#define CHECK_FUNCTION(CHECK, NAME, ...) \
664 CHECK(#NAME, &(SwsUOp) { __VA_ARGS__ });
666#define CHECK_FOR(UOP, CHECK) \
667 SWS_FOR_STRUCT(U8, UOP, CHECK_FUNCTION, CHECK) \
668 SWS_FOR_STRUCT(U16, UOP, CHECK_FUNCTION, CHECK) \
669 SWS_FOR_STRUCT(U32, UOP, CHECK_FUNCTION, CHECK) \
670 SWS_FOR_STRUCT(F32, UOP, CHECK_FUNCTION, CHECK) \
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
static const char * checkasm_get_cpu_suffix(void)
Get the suffix for the current CPU flag, or "c" if none.
static const uint8_t bits[8]
int ff_sws_filter_generate(void *log, const SwsFilterParams *params, SwsFilterWeights **out)
Generate a filter kernel for the given parameters.
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
#define SWS_PARAM_DEFAULT
@ SWS_SCALE_POINT
nearest neighbor (point sampling)
@ SWS_SCALE_SINC
unwindowed sinc
CHECKASM_API void checkasm_init(void *buf, size_t bytes)
Initialize a buffer with pathological test patterns.
static const int offsets[]
static void scale(int *out, const int *in, const int w, const int h, const int shift)
#define u(width, name, range_min, range_max)
SwsLut3D * ff_sws_lut3d_alloc(void)
Allocates a refstruct.
#define DECLARE_ALIGNED_64(t, v)
const SwsOpBackend *const ff_sws_op_backends[]
void ff_sws_compiled_op_unref(SwsCompiledOp *comp)
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
#define FF_ARRAY_ELEMS(a)
Main external API structure.
int src_size
The relative sizes of the input and output images.
SwsScaler scaler
The filter kernel and parameters to use.
char name[16]
Extra metadata about the filter, used to inform the optimizer / range tracker about the filter's beha...
int * offsets
The computed source pixel positions for each row of the filter.
Append a set of operations for applying a gamut/tone mapping 3D LUT to the pixels.
v3u16_t output[OUTPUT_LUT_SIZE_PT][OUTPUT_LUT_SIZE_PT][OUTPUT_LUT_SIZE_I]
v3u16_t input[INPUT_LUT_SIZE][INPUT_LUT_SIZE][INPUT_LUT_SIZE]
v2u16_t tone_map[TONE_LUT_SIZE+1]
int(* compile_uops)(SwsContext *ctx, const SwsUOpList *uops, SwsCompiledOp *out)
Alternative to compile that takes a list of micro-ops directly.
enum AVPixelFormat hw_format
If NONE, backend only supports software frames.
Copyright (C) 2026 Niklas Haas.
int32_t block_size_out[4]
int32_t * in_offset_x
Pixel offset map; for horizontal scaling, in bytes.
ptrdiff_t in_bump[4]
Pointer bump, difference between stride and processed line size.
int32_t * in_bump_y
Line bump; determines how many additional lines to advance (after incrementing normally to the next l...
SwsFilterWeights * kernel
union SwsUOp::@242237116251216327057105100216205033300341206345 data
unsigned ranges[NB_PLANES]
static void fill16(uint16_t *line, int num, unsigned range)
static void fill8(uint8_t *line, int num, unsigned range)
static void check_expand_bit(const char *name, const SwsUOp *uop)
static void check_lut_3d(const char *name, SwsUOp *uop)
#define CHECK_FOR(UOP, CHECK)
static void check_scalar(const char *name, SwsUOp *uop)
static void fill32f(float *line, int num, unsigned range)
static void check_write(const char *name, const SwsUOp *uop)
static SwsPixel rndpx(SwsPixelType type)
static void check_uop(const char *name, const SwsUOp *uop, SwsCompMask mask_in, SwsCompMask mask_out, const unsigned ranges[NB_PLANES])
static void run_test(const Test *test)
static void check_filter(const char *name, SwsUOp *uop)
static void check_vec4(const char *name, SwsUOp *uop)
void checkasm_check_sw_ops(void)
static void check_read(const char *name, SwsUOp *uop)
static void check_dither(const char *name, SwsUOp *uop)
static void check_linear(const char *name, SwsUOp *uop)
static void check_scale(const char *name, SwsUOp *uop)
static void check_simple(const char *name, const SwsUOp *uop)
static void check_pack(const char *name, const SwsUOp *uop)
static void check_swizzle(const char *name, const SwsUOp *uop)
static void check_unpack(const char *name, const SwsUOp *uop)
static SwsPixelType pixel_type_to_int(const SwsPixelType type)
static void check_cast(const char *name, const SwsUOp *uop)
static void check_range(const char *name, const SwsUOp *uop, const unsigned ranges[NB_PLANES])
static const char * tprintf(char buf[], size_t size, const char *fmt,...)
static SwsPixel constpx(SwsPixelType type, int val)
static void fill32(uint32_t *line, int num, unsigned range)
static void check_compiled(const Test *test, const SwsCompiledOp *comp_ref, const SwsCompiledOp *comp_new)
#define checkasm_call(func,...)
Call a function with signal handling.
CHECKASM_API CheckasmKey CHECKASM_API void checkasm_set_func_variant(const char *id,...) CHECKASM_PRINTF(1
Set a custom variant identifier for the next checkasm_check_func() call.
static AVFormatContext * ctx
int ff_sws_dither_height(const SwsDitherUOp *dither)
Computes (1 << size_log2) + MAX(y_offset).
#define SWS_COMP_TEST(mask, X)
#define SWS_COMP_ELEMS(N)
#define SWS_COMP_COUNT(mask)
static av_const bool ff_sws_pixel_type_is_int(SwsPixelType type)
uint8_t SwsCompMask
Bit-mask of components.
static av_const int ff_sws_pixel_type_size(SwsPixelType type)