| 665 | }; |
| 666 | |
| 667 | int main(int argc, char **argv) |
| 668 | { |
| 669 | uint8_t *input; |
| 670 | uint8_t *output; |
| 671 | unsigned i, impl, size; |
| 672 | int opt; |
| 673 | |
| 674 | while ((opt = getopt(argc, argv, "hl:a:r:")) != -1) { |
| 675 | switch (opt) { |
| 676 | case 'l': |
| 677 | enabled_libs = optarg; |
| 678 | break; |
| 679 | case 'a': |
| 680 | enabled_algos = optarg; |
| 681 | break; |
| 682 | case 'r': |
| 683 | specified_runs = strtol(optarg, NULL, 0); |
| 684 | break; |
| 685 | case 'h': |
| 686 | default: |
| 687 | fprintf(stderr, "Usage: %s [-l libs] [-a algos] [-r runs]\n", |
| 688 | argv[0]); |
| 689 | if ((USE_EXT_LIBS)) { |
| 690 | char buf[1024]; |
| 691 | snprintf(buf, sizeof(buf), "%s%s%s%s", |
| 692 | ((USE_EXT_LIBS) & USE_crypto) ? "+crypto" : "", |
| 693 | ((USE_EXT_LIBS) & USE_gcrypt) ? "+gcrypt" : "", |
| 694 | ((USE_EXT_LIBS) & USE_mbedcrypto) ? "+mbedcrypto" : "", |
| 695 | ((USE_EXT_LIBS) & USE_tomcrypt) ? "+tomcrypt" : ""); |
| 696 | fprintf(stderr, "Built with the following external libraries:\n" |
| 697 | "make VERSUS=%s\n", buf + 1); |
| 698 | } else { |
| 699 | fprintf(stderr, "Built without external libraries; use\n" |
| 700 | "make VERSUS=crypto+gcrypt+mbedcrypto+tomcrypt tools/crypto_bench\n" |
| 701 | "to enable them.\n"); |
| 702 | } |
| 703 | exit(opt != 'h'); |
| 704 | } |
| 705 | } |
| 706 | input = av_malloc(MAX_INPUT_SIZE * 2); |
| 707 | if (!input) |
| 708 | fatal_error("out of memory"); |
| 709 | for (i = 0; i < MAX_INPUT_SIZE; i += 4) |
| 710 | AV_WB32(input + i, i); |
| 711 | |
| 712 | output = input + MAX_INPUT_SIZE; |
| 713 | |
| 714 | size = MAX_INPUT_SIZE; |
| 715 | for (impl = 0; impl < FF_ARRAY_ELEMS(implementations); impl++) |
| 716 | run_implementation(input, output, &implementations[impl], size); |
| 717 | |
| 718 | av_free(input); |
| 719 | |
| 720 | return 0; |
| 721 | } |
nothing calls this directly
no test coverage detected