So I can quickly iterate on the new swscale code.
Unified · Split
| @@ -47,6 +47,8 @@ struct options { · 46 unmodified lines | ||
| 47 | 47 | int threads; |
| 48 | 48 | int iters; |
| 49 | 49 | int bench; |
| 50 | + int flags; | |
| 51 | + int dither; | |
| 50 | 52 | }; |
| 51 | 53 | |
| 52 | 54 | struct mode { |
| @@ -54,15 +56,15 @@ struct mode { · 1 unmodified line | ||
| 54 | 56 | SwsDither dither; |
| 55 | 57 | }; |
| 56 | 58 | |
| 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 | |
| 66 | 68 | }; |
| 67 | 69 | |
| 68 | 70 | static FFSFC64 prng_state; |
| @@ -277,13 +279,21 @@ static int run_self_tests(const AVFrame *ref, struct options opts) · 208 unmodified lines | ||
| 277 | 279 | continue; |
| 278 | 280 | for (int h = 0; h < FF_ARRAY_ELEMS(dst_h); h++) |
| 279 | 281 | 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 | + | |
| 281 | 288 | if (ff_sfc64_get(&prng_state) > UINT64_MAX * opts.prob) |
| 282 | 289 | continue; |
| 283 | 290 | |
| 284 | 291 | 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) | |
| 286 | 293 | return -1; |
| 294 | + | |
| 295 | + if (opts.flags >= 0) | |
| 296 | + break; | |
| 287 | 297 | } |
| 288 | 298 | } |
| 289 | 299 | } |
| @@ -344,6 +354,8 @@ int main(int argc, char **argv) · 54 unmodified lines | ||
| 344 | 354 | .threads = 1, |
| 345 | 355 | .iters = 1, |
| 346 | 356 | .prob = 1.0, |
| 357 | + .flags = -1, | |
| 358 | + .dither = -1, | |
| 347 | 359 | }; |
| 348 | 360 | |
| 349 | 361 | AVFrame *rgb = NULL, *ref = NULL; |
| @@ -368,6 +380,10 @@ int main(int argc, char **argv) · 18 unmodified lines | ||
| 368 | 380 | " Only test the specified source pixel format\n" |
| 369 | 381 | " -bench <iters>\n" |
| 370 | 382 | " 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" | |
| 371 | 387 | " -threads <threads>\n" |
| 372 | 388 | " Use the specified number of threads\n" |
| 373 | 389 | " -cpuflags <cpuflags>\n" |
| @@ -409,6 +425,10 @@ int main(int argc, char **argv) · 35 unmodified lines | ||
| 409 | 425 | opts.iters = FFMAX(opts.iters, 1); |
| 410 | 426 | opts.w = 1920; |
| 411 | 427 | 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]); | |
| 412 | 432 | } else if (!strcmp(argv[i], "-threads")) { |
| 413 | 433 | opts.threads = atoi(argv[i + 1]); |
| 414 | 434 | } else if (!strcmp(argv[i], "-p")) { |