History

float_dsp-test: allow forcing cpuflags

James Almer committed 12 years ago

Commit 5402d1b1 parent ea77d3b2 files · +31 −6Browse files

Showing the changes to libavutil/float_dsp.c (1 of 2 files). Show all

Unified · Split

libavutil/float_dsp.c+30−5
@@ -146,6 +146,12 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact) · 145 unmodified lines
146146 #include <stdint.h>
147147 #include <stdlib.h>
148148 #include <string.h>
149+#if HAVE_UNISTD_H
150+#include <unistd.h> /* for getopt */
151+#endif
152+#if !HAVE_GETOPT
153+#include "compat/getopt.c"
154+#endif
149155
150156 #include "common.h"
151157 #include "cpu.h"
@@ -369,7 +375,7 @@ static int test_scalarproduct_float(AVFloatDSPContext *fdsp, AVFloatDSPContext * · 217 unmodified lines
369375
370376 int main(int argc, char **argv)
371377 {
372− int ret = 0;
378+ int ret = 0, seeded = 0;
373379 uint32_t seed;
374380 AVFloatDSPContext fdsp, cdsp;
375381 AVLFG lfg;
@@ -380,12 +386,31 @@ int main(int argc, char **argv) · 4 unmodified lines
380386 LOCAL_ALIGNED(32, double, dbl_src0, [LEN]);
381387 LOCAL_ALIGNED(32, double, dbl_src1, [LEN]);
382388
383− if (argc > 2 && !strcmp(argv[1], "-s"))
384− seed = strtoul(argv[2], NULL, 10);
385− else
389+ for (;;) {
390+ int arg = getopt(argc, argv, "s:c:");
391+ if (arg == -1)
392+ break;
393+ switch (arg) {
394+ case 's':
395+ seed = strtoul(optarg, NULL, 10);
396+ seeded = 1;
397+ break;
398+ case 'c':
399+ {
400+ int cpuflags = av_get_cpu_flags();
401+
402+ if (av_parse_cpu_caps(&cpuflags, optarg) < 0)
403+ return 1;
404+
405+ av_force_cpu_flags(cpuflags);
406+ break;
407+ }
408+ }
409+ }
410+ if (!seeded)
386411 seed = av_get_random_seed();
387412
388− av_log(NULL, AV_LOG_INFO, "float_dsp-test: random seed %u\n", seed);
413+ av_log(NULL, AV_LOG_INFO, "float_dsp-test: %s %u\n", seeded ? "seed" : "random seed", seed);
389414
390415 av_lfg_init(&lfg, seed);
391416

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