History

float_dsp-test: allow forcing cpuflags

James Almer committed 12 years ago

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

Unified · Split

2 files
  1. libavutil/float_dsp.c +30 −5
  2. tests/fate/libavutil.mak +1 −1
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
146#include <stdint.h>146#include <stdint.h>
147#include <stdlib.h>147#include <stdlib.h>
148#include <string.h>148#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
149 155
150#include "common.h"156#include "common.h"
151#include "cpu.h"157#include "cpu.h"
@@ -369,7 +375,7 @@ static int test_scalarproduct_float(AVFloatDSPContext *fdsp, AVFloatDSPContext * · 217 unmodified lines
369 375
370int main(int argc, char **argv)376int main(int argc, char **argv)
371{377{
372 int ret = 0;378 int ret = 0, seeded = 0;
373 uint32_t seed;379 uint32_t seed;
374 AVFloatDSPContext fdsp, cdsp;380 AVFloatDSPContext fdsp, cdsp;
375 AVLFG lfg;381 AVLFG lfg;
@@ -380,12 +386,31 @@ int main(int argc, char **argv) · 4 unmodified lines
380 LOCAL_ALIGNED(32, double, dbl_src0, [LEN]);386 LOCAL_ALIGNED(32, double, dbl_src0, [LEN]);
381 LOCAL_ALIGNED(32, double, dbl_src1, [LEN]);387 LOCAL_ALIGNED(32, double, dbl_src1, [LEN]);
382 388
383 if (argc > 2 && !strcmp(argv[1], "-s"))389 for (;;) {
384 seed = strtoul(argv[2], NULL, 10);390 int arg = getopt(argc, argv, "s:c:");
385 else391 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)
386 seed = av_get_random_seed();411 seed = av_get_random_seed();
387 412
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);
389 414
390 av_lfg_init(&lfg, seed);415 av_lfg_init(&lfg, seed);
391 416
tests/fate/libavutil.mak+1−1
@@ -53,7 +53,7 @@ fate-fifo: CMD = run libavutil/fifo-test · 52 unmodified lines
53 53
54FATE_LIBAVUTIL += fate-float-dsp54FATE_LIBAVUTIL += fate-float-dsp
55fate-float-dsp: libavutil/float_dsp-test$(EXESUF)55fate-float-dsp: libavutil/float_dsp-test$(EXESUF)
56fate-float-dsp: CMD = run libavutil/float_dsp-test56fate-float-dsp: CMD = run libavutil/float_dsp-test $(CPUFLAGS:%=-c%)
57fate-float-dsp: CMP = null57fate-float-dsp: CMP = null
58fate-float-dsp: REF = /dev/null58fate-float-dsp: REF = /dev/null
59 59

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