29#undef HAVE_AV_CONFIG_H
156 return ratio > 10.00 ?
"\033[1;94m" :
157 ratio > 2.00 ?
"\033[1;32m" :
158 ratio > 1.02 ?
"\033[32m" :
160 ratio > 0.90 ?
"\033[33m" :
161 ratio > 0.75 ?
"\033[31m" :
167 if (
state.speedup_count) {
168 double ratio =
exp(
state.speedup_logavg /
state.speedup_count);
169 fprintf(stderr,
"Overall speedup=%.3fx %s%s\033[0m, min=%.3fx max=%.3fx\n", ratio,
181 float variance = 1.0 / 12;
182 if (
desc->comp[0].depth < 8) {
184 variance *= (8 -
desc->comp[0].depth);
190 const float r = 0.299 / (1 <<
desc->comp[0].depth);
191 const float g = 0.587 / (1 <<
desc->comp[1].depth);
192 const float b = 0.114 / (1 <<
desc->comp[2].depth);
193 return (
r *
r +
g *
g +
b *
b) * variance;
195 const float y = 1.0 / (1 <<
desc->comp[0].depth);
196 return y * y * variance;
203 int comps =
desc->nb_components >= 3 ? 0x7 : 0x1;
215 for (
int p = 0; p < 4; p++) {
216 const int stride_a =
out->linesize[p];
217 const int stride_b =
ref->linesize[p];
218 const int w =
out->width;
219 const int h =
out->height;
221 const int is_chroma = p == 1 || p == 2;
222 const uint8_t def = is_chroma ? 128 : 0xFF;
223 const int has_ref = comps & (1 << p);
228 for (
int y = 0; y < (
h & ~3); y += 4) {
229 for (
int x = 0; x < (
w & ~3); x += 4) {
230 const float c1 = .01 * .01 * 255 * 255 * 64;
231 const float c2 = .03 * .03 * 255 * 255 * 64 * 63;
232 int s1 = 0, s2 = 0,
ss = 0, s12 = 0, var, covar;
234 for (
int yy = 0; yy < 4; yy++) {
235 for (
int xx = 0; xx < 4; xx++) {
236 int a =
out->data[p][(y + yy) * stride_a + x + xx];
237 int b = has_ref ?
ref->data[p][(y + yy) * stride_b + x + xx] : def;
245 var =
ss * 64 - s1 * s1 - s2 * s2;
246 covar = s12 * 64 - s1 * s2;
247 sum += (2 * s1 * s2 +
c1) * (2 * covar +
c2) /
248 ((s1 * s1 + s2 * s2 +
c1) * (var +
c2));
253 ssim[p] = count ? sum / count : 0.0;
259 const float weights[3] = { 0.8, 0.1, 0.1 };
262 for (
int i = 0;
i < 3;
i++)
278 memset(
frame->linesize, 0,
sizeof(
frame->linesize));
290 for (
int p = 0; p < nb_planes; p++) {
291 const int is_chroma = p == 1 || p == 2;
331 for (
int i = 0;
ret >= 0 &&
i <
opts->iters;
i++) {
333 if (
opts->align_dst) {
382 for (
int i = 0;
ret >= 0 &&
i <
opts->iters;
i++)
490 for (
int i = 0;
ret >= 0 &&
i <
opts->iters;
i++) {
523 "%-*s %*dx%*d -> %-*s %*dx%*d, flags=0x%0*x dither=%u scaler=%d/%d",
525 opts->pretty ? 4 : 0,
src->width,
526 opts->pretty ? 4 : 0,
src->height,
528 opts->pretty ? 4 : 0,
dst->width,
529 opts->pretty ? 4 : 0,
dst->height,
537 int dst_w,
int dst_h,
543 AVBPrint bprint, *bp = &bprint;
549 if (!
opts->bench || !ref_r) {
550 av_bprintf(bp,
", SSIM={Y=%f U=%f V=%f A=%f} loss=%e",
551 r->ssim[0],
r->ssim[1],
r->ssim[2],
r->ssim[3],
559 opts->pretty ? 7 : 0,
r->time,
opts->iters);
562 / ((
double)
r->time /
opts->iters);
567 state.speedup_logavg += log(ratio);
568 state.speedup_count++;
572 av_bprintf(bp,
" (ref=%*"PRId64
"/%u us), speedup=%*.3fx %s%s\033[0m",
574 opts->pretty ? 6 : 0, ratio,
581 fputs(bp->str, stdout);
586 if (
r->loss - expected_loss > 1e-4 && dst_w >=
ref->width && dst_h >=
ref->height) {
587 const int bad =
r->loss - expected_loss > 1e-2;
589 const char *worse_str =
bad ?
"WORSE" :
"worse";
595 av_bprintf(bp,
" loss %e is %s by %e, expected loss %e\n",
596 r->loss, worse_str,
r->loss - expected_loss, expected_loss);
601 if (ref_r &&
r->loss - ref_r->
loss > 1e-4) {
611 const int bad =
r->loss - ref_r->
loss > 1e-2 && dst_bits > 1;
613 const char *worse_str =
bad ?
"WORSE" :
"worse";
619 av_bprintf(bp,
" loss %e is %s by %e, ref loss %e SSIM={Y=%f U=%f V=%f A=%f}\n",
620 r->loss, worse_str,
r->loss - ref_r->
loss, ref_r->
loss,
650 default:
return "unknown";
689 fputs(bp.str, stdout);
724 state.coverage_total++;
727 state.coverage_supported++;
750 if (
opts->flags >= 0)
769 for (
int i = 0;
i <
sizeof(
md5);
i++)
786 const float c1 = 0.01 * 0.01;
787 const float ref_var = 1.0 / 12.0;
791 const float total_var = src_var + dst_var + out_var;
792 const float ssim_luma = (2 * ref_var +
c1) / (2 * ref_var + total_var +
c1);
793 const float ssim_expected[4] = { ssim_luma, 1, 1, 1 };
794 const float expected_loss =
get_loss(ssim_expected);
803 if (
opts->align_src) {
849 if (src_var > dst_var) {
850 const float src_loss = (2 * ref_var +
c1) / (2 * ref_var + src_var +
c1);
851 r.ssim[0] =
FFMIN(
r.ssim[0], src_loss);
861 if (ref_r &&
r.loss - ref_r->
loss > 1e-2) {
896 if (
state.hw_device_constr->valid_sw_formats[
i] == fmt)
904 const int scaler_sub =
opts->scaler_sub ?
opts->scaler_sub :
opts->scaler;
948 src_fmt_min = src_fmt_max =
opts->src_fmt;
950 dst_fmt_min = dst_fmt_max =
opts->dst_fmt;
952 for (src_fmt = src_fmt_min; src_fmt <= src_fmt_max; src_fmt++) {
955 for (dst_fmt = dst_fmt_min; dst_fmt <= dst_fmt_max; dst_fmt++) {
969 int dst_w = (
opts->dst_w >= 0) ?
opts->dst_w : dst_w_values[
w];
970 int dst_h = (
opts->dst_h >= 0) ?
opts->dst_h : dst_h_values[
h];
992 if (
opts->dst_w >= 0 ||
opts->dst_h >= 0)
994 if (
opts->scaler < 0)
997 if (
opts->dst_w >= 0 ||
opts->dst_h >= 0)
999 if (
opts->scaler < 0)
1018 for (
int line = 1; fgets(buf,
sizeof(buf),
fp);
line++) {
1019 char src_fmt_str[21], dst_fmt_str[21];
1028 "%20s %dx%d -> %20s %dx%d, flags=0x%x dither=%u scaler=%u/%u, "
1029 "SSIM={Y=%f U=%f V=%f A=%f} loss=%e%n",
1030 src_fmt_str, &sw, &sh, dst_fmt_str, &dw, &dh,
1033 &
r.ssim[0], &
r.ssim[1], &
r.ssim[2], &
r.ssim[3],
1037 "Malformed reference file in line %d\n",
line);
1041 ret = sscanf(buf + n,
1042 ", time=%"PRId64
"/%u us",
1046 "Missing benchmarks from reference file in line %d\n",
1056 "Unknown pixel formats (%s and/or %s) in line %d\n",
1057 src_fmt_str, dst_fmt_str,
line);
1061 if (sw !=
ref->width || sh !=
ref->height) {
1063 "Mismatching dimensions %dx%d (ref is %dx%d) in line %d\n",
1129static int run_runner(
void *priv,
int jobnr,
int threadnr,
int nb_jobs,
int nb_threads)
1167 for (
int y = 0; y <
rgb->height; y++) {
1168 for (
int x = 0; x <
rgb->width; x++) {
1169 for (
int c = 0;
c < 4;
c++)
1186 if (
ret < 0 && strchr(str,
':')) {
1192 char *saveptr =
NULL;
1210 const char *sep = strchr(str,
':');
1211 const char *str_threads = sep == str ?
NULL : str;
1212 const char *str_runners = sep ? sep + 1 :
NULL;
1213 int threads = str_threads ? atoi(str_threads) : 1;
1214 int runners = str_runners ? atoi(str_runners) : 1;
1215 if (threads < 0 ||
runners < 0)
1223 opts->threads = threads;
1230 if (!strcmp(str,
"legacy"))
1232 if (!strcmp(str,
"new"))
1243 for (
int i = 1;
i < argc;
i += 2) {
1244 if (!strcmp(argv[
i],
"-help") || !strcmp(argv[
i],
"--help")) {
1246 "swscale [options...]\n"
1250 " Uses file as reference to compare tests against. Tests that have become worse will contain the string worse or WORSE\n"
1251 " -p <number between 0.0 and 1.0>\n"
1252 " The proportion of tests or comparisons to perform.\n"
1253 " It is often convenient to perform a random subset\n"
1255 " Only test the specified destination pixel format\n"
1257 " Only test the specified source pixel format\n"
1258 " -s <size>[:<size>]\n"
1259 " Set frame size (WxH or abbreviation)\n"
1260 " Optionally set destination frame size (after a ':' separator character).\n"
1262 " Run benchmarks with the specified number of iterations. This mode also sets the frame size to 1920x1080 (unless -s is specified)\n"
1264 " Test with a specific combination of flags\n"
1266 " Test with a specific dither mode\n"
1267 " -backends <backends>\n"
1268 " Restrict to the given set of allowed swscale backends\n"
1269 " -scaler <algorithm>\n"
1270 " Test with a specified scaler algorithm\n"
1271 " If 'none', test only conversions that do not involve scaling\n"
1272 " -scaler_sub <algorithm>\n"
1273 " Test with a specified scaler algorithm for chroma planes\n"
1274 " -align_src <alignment>\n"
1275 " If nonzero, allocate source buffers with a custom stride alignment\n"
1276 " If negative, the buffers are also vertically flipped (negative stride)\n"
1277 " -align_dst <alignment>\n"
1278 " If nonzero, allocate destination buffers with a custom stride alignment\n"
1279 " If negative, the buffers are also vertically flipped (negative stride)\n"
1280 " -api <new or legacy>\n"
1281 " Use selected swscale API for the main conversion (default: new)\n"
1283 " Use Vulkan hardware acceleration on the specified device for the main conversion\n"
1284 " If 'default', use the default device, and skip all tests if none is available\n"
1285 " -threads [<threads>][:<runners>]\n"
1286 " Use the specified number of threads per conversion (default: 1)\n"
1287 " Optionally run multiple tests concurrently on <runners> threads (default: 1)\n"
1288 " A value of 0 picks the number of threads automatically\n"
1289 " Benchmark results may be skewed when using multiple runners\n"
1290 " -cpuflags <cpuflags>\n"
1291 " Uses the specified cpuflags in the tests\n"
1292 " -pretty <1 or 0>\n"
1293 " Align fields while printing results\n"
1294 " -coverage <1 or 0>\n"
1295 " Set up each conversion without running it, and print the backend and\n"
1296 " CPU flags of each of its passes. Also print a summary with how many\n"
1297 " conversions are supported and an MD5 of the per-conversion lines.\n"
1299 " Enable log verbosity at given level\n"
1303 if (argv[
i][0] !=
'-' ||
i + 1 == argc)
1305 if (!strcmp(argv[
i],
"-ref")) {
1306 *
fp = fopen(argv[
i + 1],
"r");
1308 fprintf(stderr,
"could not open '%s'\n", argv[
i + 1]);
1312 }
else if (!strcmp(argv[
i],
"-cpuflags")) {
1316 fprintf(stderr,
"invalid cpu flags %s\n", argv[
i + 1]);
1320 }
else if (!strcmp(argv[
i],
"-src")) {
1323 fprintf(stderr,
"invalid pixel format %s\n", argv[
i + 1]);
1327 }
else if (!strcmp(argv[
i],
"-dst")) {
1330 fprintf(stderr,
"invalid pixel format %s\n", argv[
i + 1]);
1334 }
else if (!strcmp(argv[
i],
"-s")) {
1337 fprintf(stderr,
"invalid frame size %s\n", argv[
i + 1]);
1340 }
else if (!strcmp(argv[
i],
"-bench")) {
1341 int iters = atoi(argv[
i + 1]);
1347 opts->iters = iters;
1349 }
else if (!strcmp(argv[
i],
"-flags")) {
1353 fprintf(stderr,
"invalid flags %s\n", argv[
i + 1]);
1356 }
else if (!strcmp(argv[
i],
"-backends")) {
1360 fprintf(stderr,
"invalid backends %s\n", argv[
i + 1]);
1363 }
else if (!strcmp(argv[
i],
"-dither")) {
1364 opts->dither = atoi(argv[
i + 1]);
1365 }
else if (!strcmp(argv[
i],
"-scaler") || !strcmp(argv[
i],
"-scaler_sub")) {
1366 int opt_is_scaler = !strcmp(argv[
i],
"-scaler");
1367 if (opt_is_scaler && !strcmp(argv[
i + 1],
"none")) {
1374 fprintf(stderr,
"invalid scaler algorithm %s\n", argv[
i + 1]);
1377 }
else if (!strcmp(argv[
i],
"-align_src")) {
1378 opts->align_src = atoi(argv[
i + 1]);
1381 fprintf(stderr,
"invalid alignment %s\n", argv[
i + 1]);
1384 }
else if (!strcmp(argv[
i],
"-align_dst")) {
1385 opts->align_dst = atoi(argv[
i + 1]);
1388 fprintf(stderr,
"invalid alignment %s\n", argv[
i + 1]);
1391 }
else if (!strcmp(argv[
i],
"-api")) {
1394 fprintf(stderr,
"invalid api %s\n", argv[
i + 1]);
1398 }
else if (!strcmp(argv[
i],
"-hw")) {
1399 const int hw_default = !strcmp(argv[
i + 1],
"default");
1402 hw_default ?
NULL : argv[
i + 1],
NULL, 0);
1405 fprintf(stderr,
"No Vulkan device available, skipping.\n");
1408 fprintf(stderr,
"Failed to create Vulkan device '%s'\n",
1413 state.hw_device_constr =
1415 if (!
state.hw_device_constr) {
1416 fprintf(stderr,
"Failed to retrieve Vulkan device constraints '%s'\n",
1421 }
else if (!strcmp(argv[
i],
"-threads")) {
1424 fprintf(stderr,
"invalid thread count %s\n", argv[
i + 1]);
1427 }
else if (!strcmp(argv[
i],
"-p")) {
1428 opts->prob = atof(argv[
i + 1]);
1429 }
else if (!strcmp(argv[
i],
"-pretty")) {
1430 opts->pretty = atoi(argv[
i + 1]);
1431 }
else if (!strcmp(argv[
i],
"-coverage")) {
1432 opts->coverage = atoi(argv[
i + 1]);
1433 }
else if (!strcmp(argv[
i],
"-v")) {
1437 fprintf(stderr,
"bad option or argument missing (%s) see -help\n", argv[
i]);
1443 if (
opts->coverage &&
1445 fprintf(stderr,
"-coverage is not supported with -hw, -api legacy or multiple runners\n");
1496 if (!
state.runners) {
1501 for (
int i = 0;
i <
opts.runners;
i++) {
1516 if (
opts.coverage) {
1518 if (!
state.coverage_md5) {
1529 if (
opts.runners > 1) {
1538 fprintf(stderr,
"Failed to create %d runner threads: %s\n",
1547 if (
opts.coverage &&
ret >= 0)
1554 for (
int i = 0;
state.runners &&
i <
opts.runners;
i++)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
static struct AVMD5 * md5
static AVFormatContext * ctx
static AVDictionary * opts
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static const uint8_t *BS_FUNC align(BSCTX *bc)
Skip bits to a byte boundary.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_AUTOMATIC
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define ss(width, name, subs,...)
#define AV_CEIL_RSHIFT(a, b)
#define FFABSU(a)
Unsigned Absolute value.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
__device__ int printf(const char *,...)
reference-counted frame API
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_log_set_level(int level)
Set the log level.
int av_log_get_level(void)
Get the current log level.
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
Finish hashing and output digest value.
struct AVMD5 * av_md5_alloc(void)
Allocate an AVMD5 context.
void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
Update hash value.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
int sws_scale_frame(SwsContext *sws, AVFrame *dst, const AVFrame *src)
Scale source data from src and write the output to dst.
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.
int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
Like sws_scale_frame, but without actually scaling.
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
@ SWS_BACKEND_LEGACY
Legacy bespoke format-specific code.
@ SWS_BACKEND_MEMCPY
Fast path using libc memcpy() / memset()
@ SWS_BACKEND_AARCH64
Chained AArch64 NEON kernels.
@ SWS_BACKEND_X86
Chained x86 SIMD kernels.
@ SWS_BACKEND_C
Template-based C reference implementation.
@ SWS_BACKEND_SPIRV
Vulkan SPIR-V backend.
@ SWS_BICUBIC
2-tap cubic B-spline
@ SWS_BILINEAR
bilinear filtering
@ SWS_FULL_CHR_H_INP
Perform full chroma interpolation when downscaling RGB sources.
@ SWS_FAST_BILINEAR
Scaler selection options.
@ SWS_ACCURATE_RND
Force bit-exact output.
@ SWS_POINT
nearest neighbor
@ SWS_FULL_CHR_H_INT
Perform full chroma upsampling when upscaling to RGB.
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
static const int weights[]
static AVBufferRef * hw_device_ctx
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
Free an AVHWFrameConstraints structure.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags)
Copy data to or from a hw surface.
AVHWFramesConstraints * av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, const void *hwconfig)
Get the constraints on HW frames given a device and the HW-specific configuration to be used with tha...
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
@ AV_HWDEVICE_TYPE_VULKAN
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
void av_force_cpu_flags(int arg)
Disables cpu detection and forces the specified flags.
int av_parse_cpu_caps(unsigned *flags, const char *s)
Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define AV_MUTEX_INITIALIZER
static int ff_mutex_unlock(AVMutex *mutex)
static int ff_mutex_lock(AVMutex *mutex)
Utility Preprocessor macros.
Public header for MD5 hash function implementation.
void * av_calloc(size_t nmemb, size_t size)
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
@ AV_PIX_FMT_NB
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
simple Pseudo Random Number Generator
static uint64_t ff_sfc64_get(FFSFC64 *s)
static void ff_sfc64_init(FFSFC64 *s, uint64_t seeda, uint64_t seedb, uint64_t seedc, int rounds)
Initialize sfc64 with up to 3 seeds.
static volatile sig_atomic_t sig
#define FF_ARRAY_ELEMS(a)
void avpriv_slicethread_free(AVSliceThread **pctx)
Destroy slice threading context.
int avpriv_slicethread_execute2(AVSliceThread *ctx, int nb_jobs, int execute_main)
Execute slice threading.
int avpriv_slicethread_create2(AVSliceThread **pctx, void *priv, int(*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), int(*main_func)(void *priv), int nb_threads)
Create slice threading context.
struct AVSliceThread AVSliceThread
A reference to a data buffer.
uint8_t * data
The data buffer.
int depth
Number of bits in the component.
This structure describes decoded (raw) audio or video data.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
This struct describes the constraints on hardware frames attached to a given device with a hardware-s...
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int width
The allocated dimensions of the frames in this pool.
Context structure for the Lagged Fibonacci PRNG.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Main external API structure.
int src_h
Width and height of the source frame.
int dst_format
Destination pixel format.
int threads
How many threads to use for processing, or 0 for automatic selection.
SwsScaler scaler
Scaling filter.
int dst_h
Width and height of the destination frame.
SwsBackend backends
Bitmask of SWS_BACKEND_*.
SwsScaler scaler_sub
Scaler used specifically for up/downsampling subsampled (chroma) planes.
int src_w
Deprecated frame property overrides, for the legacy API only.
int src_format
Source pixel format.
SwsDither dither
Dither mode.
unsigned flags
Bitmask of SWS_*.
Filter graph, which represents a 'baked' pixel format conversion.
SwsPass ** passes
Sorted sequence of filter passes to apply.
Represents a single filter pass in the scaling graph.
enum AVPixelFormat dst_fmt
enum AVPixelFormat src_fmt
enum AVPixelFormat src_fmt
struct test_results ref_r
enum AVPixelFormat dst_fmt
static SwsInternal * sws_internal(const SwsContext *sws)
static void error(const char *err)
static int ref[MAX_W *MAX_W]
static const char * backend_name(SwsBackend backend)
static const char * speedup_color(double ratio)
static int init_ref(AVFrame *ref, const struct options *opts)
static int run_runner(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)
static int push_test(const struct test_case *t, const struct options *opts)
static int run_test(struct runner *runner, const struct test_case *t, const struct options *opts)
static float estimate_quantization_noise(enum AVPixelFormat fmt)
static void runner_free(struct runner *runner)
static void exit_handler(int sig)
static int run_self_tests(const struct options *opts)
static int fmt_disabled(const struct options *opts, enum AVPixelFormat fmt)
static int parse_threads(struct options *opts, const char *str)
static float get_loss(const float ssim[4])
static const SwsFlags coverage_flags[]
static int runner_init(struct runner *runner)
static int checked_sws_scale_frame(SwsContext *c, AVFrame *dst, const AVFrame *src)
static int init_frame(AVFrame **pframe, const AVFrame *ref, int width, int height, enum AVPixelFormat format)
static int check_coverage(struct runner *runner, const struct test_case *t, const struct mode *mode, const struct options *opts)
static int parse_implementation(const char *str)
static int run_coverage(struct runner *runner, const struct test_case *t, const struct options *opts)
static int scale_hw(AVFrame *dst, const AVFrame *src, const struct mode *mode, const struct options *opts, int64_t *out_time)
static int fmt_is_supported_by_hw(enum AVPixelFormat fmt)
static int scale_legacy(AVFrame *dst, const AVFrame *src, const struct mode *mode, const struct options *opts, int64_t *out_time)
static void get_ssim(float ssim[4], const AVFrame *out, const AVFrame *ref, int comps)
static int fmt_is_subsampled(enum AVPixelFormat fmt)
static void print_test_params(AVBPrint *bp, const AVFrame *src, const AVFrame *dst, const struct mode *mode, const struct options *opts)
static int parse_size(struct options *opts, const char *str, char **pbuf)
static void describe_passes(AVBPrint *bp, const SwsGraph *graph)
static int run_producer(void *priv)
static void print_coverage_summary(void)
static int parse_options(int argc, char **argv, struct options *opts, FILE **fp)
static int fmt_comps(enum AVPixelFormat fmt)
static void print_results(const AVFrame *ref, const AVFrame *src, const AVFrame *dst, int dst_w, int dst_h, const struct mode *mode, const struct options *opts, const struct test_results *r, const struct test_results *ref_r, float expected_loss)
static int scale_new(struct runner *runner, AVFrame *dst, const AVFrame *src, const struct mode *mode, const struct options *opts, int64_t *out_time)
static int run_file_tests(const struct options *opts)
AVHWFramesConstraints * hw_device_constr
AVThreadMessageQueue * queue
static int test_formats(const struct options *opts, enum AVPixelFormat src, enum AVPixelFormat dst)
static int get_buffer(AVFrame *frame, int align)
static int run_tests(const struct options *opts)
static void unref_buffers(AVFrame *frame)
static struct @232240247175332074307271266321204261331170211232 state
static void print_coverage_result(const AVFrame *src, const AVFrame *dst, const struct mode *mode, const struct options *opts, const SwsGraph *graph)
struct AVMD5 * coverage_md5
void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, int err)
Set the sending error code.
int av_thread_message_queue_recv(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Receive a message from the queue.
int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, unsigned nelem, unsigned elsize)
Allocate a new message queue.
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, int err)
Set the receiving error code.
int av_thread_message_queue_send(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Send a message on the queue.
void av_thread_message_flush(AVThreadMessageQueue *mq)
Flush the message queue.
void av_thread_message_queue_free(AVThreadMessageQueue **mq)
Free a message queue.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.