History

tests/swscale: allow choosing specific flags and dither mode

So I can quickly iterate on the new swscale code.

Niklas Haas committed 1 year ago

Commit 0e2742a1 parent 35c091f1 file · +31 −11Browse files

Unified · Split

libswscale/tests/swscale.c+31−11
@@ -47,6 +47,8 @@ struct options { · 46 unmodified lines
4747 int threads;
4848 int iters;
4949 int bench;
50+ int flags;
51+ int dither;
5052 };
5153
5254 struct mode {
@@ -54,15 +56,15 @@ struct mode { · 1 unmodified line
5456 SwsDither dither;
5557 };
5658
57−const struct mode modes[] = {
58− { SWS_FAST_BILINEAR },
59− { SWS_BILINEAR },
60− { SWS_BICUBIC },
61− { SWS_X | SWS_BITEXACT },
62− { SWS_POINT },
63− { SWS_AREA | SWS_ACCURATE_RND },
64− { SWS_BICUBIC | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP },
65− {0}, // test defaults
59+const SwsFlags flags[] = {
60+ SWS_FAST_BILINEAR,
61+ SWS_BILINEAR,
62+ SWS_BICUBIC,
63+ SWS_X | SWS_BITEXACT,
64+ SWS_POINT,
65+ SWS_AREA | SWS_ACCURATE_RND,
66+ SWS_BICUBIC | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP,
67+ 0, // test defaults
6668 };
6769
6870 static FFSFC64 prng_state;
@@ -277,13 +279,21 @@ static int run_self_tests(const AVFrame *ref, struct options opts) · 208 unmodified lines
277279 continue;
278280 for (int h = 0; h < FF_ARRAY_ELEMS(dst_h); h++)
279281 for (int w = 0; w < FF_ARRAY_ELEMS(dst_w); w++)
280− for (int m = 0; m < FF_ARRAY_ELEMS(modes); m++) {
282+ for (int f = 0; f < FF_ARRAY_ELEMS(flags); f++) {
283+ struct mode mode = {
284+ .flags = opts.flags >= 0 ? opts.flags : flags[f],
285+ .dither = opts.dither >= 0 ? opts.dither : SWS_DITHER_AUTO,
286+ };
287+
281288 if (ff_sfc64_get(&prng_state) > UINT64_MAX * opts.prob)
282289 continue;
283290
284291 if (run_test(src_fmt, dst_fmt, dst_w[w], dst_h[h],
285− modes[m], opts, ref, NULL) < 0)
292+ mode, opts, ref, NULL) < 0)
286293 return -1;
294+
295+ if (opts.flags >= 0)
296+ break;
287297 }
288298 }
289299 }
@@ -344,6 +354,8 @@ int main(int argc, char **argv) · 54 unmodified lines
344354 .threads = 1,
345355 .iters = 1,
346356 .prob = 1.0,
357+ .flags = -1,
358+ .dither = -1,
347359 };
348360
349361 AVFrame *rgb = NULL, *ref = NULL;
@@ -368,6 +380,10 @@ int main(int argc, char **argv) · 18 unmodified lines
368380 " Only test the specified source pixel format\n"
369381 " -bench <iters>\n"
370382 " Run benchmarks with the specified number of iterations. This mode also increases the size of the test images\n"
383+ " -flags <flags>\n"
384+ " Test with a specific combination of flags\n"
385+ " -dither <mode>\n"
386+ " Test with a specific dither mode\n"
371387 " -threads <threads>\n"
372388 " Use the specified number of threads\n"
373389 " -cpuflags <cpuflags>\n"
@@ -409,6 +425,10 @@ int main(int argc, char **argv) · 35 unmodified lines
409425 opts.iters = FFMAX(opts.iters, 1);
410426 opts.w = 1920;
411427 opts.h = 1080;
428+ } else if (!strcmp(argv[i], "-flags")) {
429+ opts.flags = strtol(argv[i + 1], NULL, 0);
430+ } else if (!strcmp(argv[i], "-dither")) {
431+ opts.dither = atoi(argv[i + 1]);
412432 } else if (!strcmp(argv[i], "-threads")) {
413433 opts.threads = atoi(argv[i + 1]);
414434 } else if (!strcmp(argv[i], "-p")) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t