It's not available on all systems and using argc/argv directly does not
complicate the code much.
---
 libavcodec/fft-test.c |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c
index 75941a1..038a4be 100644
--- a/libavcodec/fft-test.c
+++ b/libavcodec/fft-test.c
@@ -217,8 +217,8 @@ static void help(void)
            "-d     (I)DCT test\n"
            "-r     (I)RDFT test\n"
            "-i     inverse transform test\n"
-           "-n b   set the transform size to 2^b\n"
-           "-f x   set scale factor for output data of (I)MDCT to x\n"
+           "-nb    set the transform size to 2^b\n"
+           "-fx    set scale factor for output data of (I)MDCT to x\n"
            );
 }
 
@@ -233,10 +233,12 @@ int main(int argc, char **argv)
 {
     FFTComplex *tab, *tab1, *tab_ref;
     FFTSample *tab2;
-    int it, i, c;
+    int it, i;
     int cpuflags;
     int do_speed = 0;
     int err = 1;
+    int optindex;
+    char *opt;
     enum tf_transform transform = TRANSFORM_FFT;
     int do_inverse = 0;
     FFTContext s1, *s = &s1;
@@ -252,11 +254,10 @@ int main(int argc, char **argv)
     av_lfg_init(&prng, 1);
 
     fft_nbits = 9;
-    for(;;) {
-        c = getopt(argc, argv, "hsimrdn:f:c:");
-        if (c == -1)
-            break;
-        switch(c) {
+    optindex = 1;
+    while (optindex < argc) {
+        opt = argv[optindex++];
+        switch (opt[1]) {
         case 'h':
             help();
             return 1;
@@ -276,13 +277,13 @@ int main(int argc, char **argv)
             transform = TRANSFORM_DCT;
             break;
         case 'n':
-            fft_nbits = atoi(optarg);
+            fft_nbits = atoi(opt + 2);
             break;
         case 'f':
-            scale = atof(optarg);
+            scale = atof(opt + 2);
             break;
         case 'c':
-            cpuflags = av_parse_cpu_flags(optarg);
+            cpuflags = av_parse_cpu_flags(opt + 2);
             if (cpuflags < 0)
                 return 1;
             av_set_cpu_flags_mask(cpuflags);
-- 
1.7.10

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to