So I can quickly iterate on the new swscale code.
Unified · Split
| @@ -47,6 +47,8 @@ struct options { · 46 unmodified lines | |||
| 47 | int threads; | 47 | int threads; |
| 48 | int iters; | 48 | int iters; |
| 49 | int bench; | 49 | int bench; |
| 50 | int flags; | ||
| 51 | int dither; | ||
| 50 | }; | 52 | }; |
| 51 | 53 | ||
| 52 | struct mode { | 54 | struct mode { |
| @@ -54,15 +56,15 @@ struct mode { · 1 unmodified line | |||
| 54 | SwsDither dither; | 56 | SwsDither dither; |
| 55 | }; | 57 | }; |
| 56 | 58 | ||
| 57 | const struct mode modes[] = { | 59 | const SwsFlags flags[] = { |
| 58 | { SWS_FAST_BILINEAR }, | 60 | SWS_FAST_BILINEAR, |
| 59 | { SWS_BILINEAR }, | 61 | SWS_BILINEAR, |
| 60 | { SWS_BICUBIC }, | 62 | SWS_BICUBIC, |
| 61 | { SWS_X | SWS_BITEXACT }, | 63 | SWS_X | SWS_BITEXACT, |
| 62 | { SWS_POINT }, | 64 | SWS_POINT, |
| 63 | { SWS_AREA | SWS_ACCURATE_RND }, | 65 | SWS_AREA | SWS_ACCURATE_RND, |
| 64 | { SWS_BICUBIC | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP }, | 66 | SWS_BICUBIC | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP, |
| 65 | {0}, // test defaults | 67 | 0, // test defaults |
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | static FFSFC64 prng_state; | 70 | static FFSFC64 prng_state; |
| @@ -277,13 +279,21 @@ static int run_self_tests(const AVFrame *ref, struct options opts) · 208 unmodified lines | |||
| 277 | continue; | 279 | continue; |
| 278 | for (int h = 0; h < FF_ARRAY_ELEMS(dst_h); h++) | 280 | for (int h = 0; h < FF_ARRAY_ELEMS(dst_h); h++) |
| 279 | for (int w = 0; w < FF_ARRAY_ELEMS(dst_w); w++) | 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 | if (ff_sfc64_get(&prng_state) > UINT64_MAX * opts.prob) | 288 | if (ff_sfc64_get(&prng_state) > UINT64_MAX * opts.prob) |
| 282 | continue; | 289 | continue; |
| 283 | 290 | ||
| 284 | if (run_test(src_fmt, dst_fmt, dst_w[w], dst_h[h], | 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 | return -1; | 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 | .threads = 1, | 354 | .threads = 1, |
| 345 | .iters = 1, | 355 | .iters = 1, |
| 346 | .prob = 1.0, | 356 | .prob = 1.0, |
| 357 | .flags = -1, | ||
| 358 | .dither = -1, | ||
| 347 | }; | 359 | }; |
| 348 | 360 | ||
| 349 | AVFrame *rgb = NULL, *ref = NULL; | 361 | AVFrame *rgb = NULL, *ref = NULL; |
| @@ -368,6 +380,10 @@ int main(int argc, char **argv) · 18 unmodified lines | |||
| 368 | " Only test the specified source pixel format\n" | 380 | " Only test the specified source pixel format\n" |
| 369 | " -bench <iters>\n" | 381 | " -bench <iters>\n" |
| 370 | " Run benchmarks with the specified number of iterations. This mode also increases the size of the test images\n" | 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 | " -threads <threads>\n" | 387 | " -threads <threads>\n" |
| 372 | " Use the specified number of threads\n" | 388 | " Use the specified number of threads\n" |
| 373 | " -cpuflags <cpuflags>\n" | 389 | " -cpuflags <cpuflags>\n" |
| @@ -409,6 +425,10 @@ int main(int argc, char **argv) · 35 unmodified lines | |||
| 409 | opts.iters = FFMAX(opts.iters, 1); | 425 | opts.iters = FFMAX(opts.iters, 1); |
| 410 | opts.w = 1920; | 426 | opts.w = 1920; |
| 411 | opts.h = 1080; | 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 | } else if (!strcmp(argv[i], "-threads")) { | 432 | } else if (!strcmp(argv[i], "-threads")) { |
| 413 | opts.threads = atoi(argv[i + 1]); | 433 | opts.threads = atoi(argv[i + 1]); |
| 414 | } else if (!strcmp(argv[i], "-p")) { | 434 | } else if (!strcmp(argv[i], "-p")) { |