Go to the documentation of this file.
56 #define FMT(fmt, ...) tprintf((char[256]) {0}, 256, fmt, __VA_ARGS__)
57 static 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) {
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++) {
637 #define CHECK_FUNCTION(CHECK, NAME, ...) \
638 CHECK(#NAME, &(SwsUOp) { __VA_ARGS__ });
640 #define CHECK_FOR(UOP, CHECK) \
641 SWS_FOR_STRUCT(U8, UOP, CHECK_FUNCTION, CHECK) \
642 SWS_FOR_STRUCT(U16, UOP, CHECK_FUNCTION, CHECK) \
643 SWS_FOR_STRUCT(U32, UOP, CHECK_FUNCTION, CHECK) \
644 SWS_FOR_STRUCT(F32, UOP, CHECK_FUNCTION, CHECK) \
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
static void check_uop(const char *name, const SwsUOp *uop, SwsCompMask mask_in, SwsCompMask mask_out, const unsigned ranges[NB_PLANES])
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int src_size
The relative sizes of the input and output images.
static const char * checkasm_get_cpu_suffix(void)
Get the suffix for the current CPU flag, or "c" if none.
ptrdiff_t in_bump[4]
Pointer bump, difference between stride and processed line size.
static void check_read(const char *name, SwsUOp *uop)
static void check_pack(const char *name, const SwsUOp *uop)
static av_const bool ff_sws_pixel_type_is_int(SwsPixelType type)
#define u(width, name, range_min, range_max)
void checkasm_check_sw_ops(void)
int32_t block_size_out[4]
static void check_unpack(const char *name, const SwsUOp *uop)
int * offsets
The computed source pixel positions for each row of the filter.
static void check_scale(const char *name, SwsUOp *uop)
int ff_sws_filter_generate(void *log, const SwsFilterParams *params, SwsFilterWeights **out)
Generate a filter kernel for the given parameters.
#define DECLARE_ALIGNED_64(t, v)
#define SWS_COMP_TEST(mask, X)
const SwsOpBackend *const ff_sws_op_backends[]
static void check_dither(const char *name, SwsUOp *uop)
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
enum AVPixelFormat hw_format
If NONE, backend only supports software frames.
#define SWS_COMP_ELEMS(N)
#define checkasm_call(func,...)
Call a function with signal handling.
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
#define CHECK_FOR(UOP, CHECK)
static SwsPixelType pixel_type_to_int(const SwsPixelType type)
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.
#define FF_ARRAY_ELEMS(a)
static SwsPixel constpx(SwsPixelType type, int val)
SwsFilterWeights * kernel
static const int offsets[]
#define AV_CEIL_RSHIFT(a, b)
int flags
Flags modifying the (de)muxer behaviour.
int32_t * in_bump_y
Line bump; determines how many additional lines to advance (after incrementing normally to the next l...
static SwsPixel rndpx(SwsPixelType type)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void fill32(uint32_t *line, int num, unsigned range)
static AVFormatContext * ctx
uint8_t SwsCompMask
Bit-mask of components.
static void check_linear(const char *name, SwsUOp *uop)
static av_const int ff_sws_pixel_type_size(SwsPixelType type)
Copyright (C) 2026 Niklas Haas.
static void fill16(uint16_t *line, int num, unsigned range)
static const char * tprintf(char buf[], size_t size, const char *fmt,...)
void ff_sws_compiled_op_unref(SwsCompiledOp *comp)
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
static void check_cast(const char *name, const SwsUOp *uop)
static void check_vec4(const char *name, SwsUOp *uop)
static void check_swizzle(const char *name, const SwsUOp *uop)
static void check_write(const char *name, const SwsUOp *uop)
@ SWS_SCALE_SINC
unwindowed sinc
#define SWS_PARAM_DEFAULT
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define i(width, name, range_min, range_max)
int(* compile_uops)(SwsContext *ctx, const SwsUOpList *uops, SwsCompiledOp *out)
Alternative to compile that takes a list of micro-ops directly.
char name[16]
Extra metadata about the filter, used to inform the optimizer / range tracker about the filter's beha...
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static void fill32f(float *line, int num, unsigned range)
@ SWS_SCALE_POINT
nearest neighbor (point sampling)
static void check_range(const char *name, const SwsUOp *uop, const unsigned ranges[NB_PLANES])
int32_t * in_offset_x
Pixel offset map; for horizontal scaling, in bytes.
static void check_expand_bit(const char *name, const SwsUOp *uop)
double scaler_params[SWS_NUM_SCALER_PARAMS]
static void check_simple(const char *name, const SwsUOp *uop)
static void check_filter(const char *name, SwsUOp *uop)
#define SWS_COMP_COUNT(mask)
static void run_test(const Test *test)
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
unsigned ranges[NB_PLANES]
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static void check_compiled(const Test *test, const SwsCompiledOp *comp_ref, const SwsCompiledOp *comp_new)
static void fill8(uint8_t *line, int num, unsigned range)
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
int ff_sws_dither_height(const SwsDitherUOp *dither)
Computes (1 << size_log2) + MAX(y_offset).
Main external API structure.
SwsScaler scaler
The filter kernel and parameters to use.
static void check_scalar(const char *name, SwsUOp *uop)