OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_ARM_FFT_TEST_UTIL_H_ |
| 12 #define WEBRTC_ARM_FFT_TEST_UTIL_H_ |
| 13 |
| 14 #include <stdio.h> |
| 15 |
| 16 #include "dl/sp/src/test/compare.h" |
| 17 |
| 18 /* Command line options */ |
| 19 struct Options { |
| 20 /* |
| 21 * Set to non-zero if test is only for real signals. This is just |
| 22 * for printing out the correct usage message. |
| 23 */ |
| 24 int real_only_; |
| 25 |
| 26 /* Debugging output level, used in test and non-test mode */ |
| 27 int verbose_; |
| 28 |
| 29 /* Test mode where all tests are run. */ |
| 30 int test_mode_; |
| 31 |
| 32 /* Run forward FFT tests (in test mode) */ |
| 33 int do_forward_tests_; |
| 34 |
| 35 /* Run inverse FFT tests (in test mode) */ |
| 36 int do_inverse_tests_; |
| 37 |
| 38 /* Minimum FFT order for test mode */ |
| 39 int min_fft_order_; |
| 40 |
| 41 /* Maximum FFT order for test mode */ |
| 42 int max_fft_order_; |
| 43 |
| 44 /* FFT Order */ |
| 45 int fft_log_size_; |
| 46 |
| 47 /* Forward FFT scale factor, only for for fixed-point routines */ |
| 48 int scale_factor_; |
| 49 |
| 50 /* Signal type to use for testing */ |
| 51 int signal_type_; |
| 52 |
| 53 /* Signal amplitude */ |
| 54 float signal_value_; |
| 55 |
| 56 /* Set if the command line options set a value for signalValue */ |
| 57 int signal_value_given_; |
| 58 }; |
| 59 |
| 60 /* |
| 61 * Information about a test that is known to fail. |
| 62 */ |
| 63 struct KnownTestFailures { |
| 64 /* FFT order of the test */ |
| 65 int fft_order_; |
| 66 |
| 67 /* Set to non-zero for inverse FFT case. Otherwise, it's forward FFT */ |
| 68 int is_inverse_fft_test_; |
| 69 |
| 70 /* The test signal used */ |
| 71 int signal_type_; |
| 72 }; |
| 73 |
| 74 struct TestInfo { |
| 75 /* True if test is for real signals */ |
| 76 int real_only_; |
| 77 |
| 78 /* Max FFT order to be tested */ |
| 79 int max_fft_order_; |
| 80 |
| 81 /* Min FFT order to be tested */ |
| 82 int min_fft_order_; |
| 83 |
| 84 /* True if forward FFT tests should be run */ |
| 85 int do_forward_tests_; |
| 86 |
| 87 /* True if inverse FFT tests should be run */ |
| 88 int do_inverse_tests_; |
| 89 |
| 90 /* SNR threshold for forward FFT tests */ |
| 91 float forward_threshold_; |
| 92 |
| 93 /* SNR threshold for inverse FFT tests */ |
| 94 float inverse_threshold_; |
| 95 |
| 96 /* |
| 97 * Array of known test failures. Should either be 0 or point to |
| 98 * an array of known failures, terminated by a test case with |
| 99 * negative fftOrder. |
| 100 */ |
| 101 struct KnownTestFailures* known_failures_; |
| 102 }; |
| 103 |
| 104 /* |
| 105 * Set default options for the command line options. Must be called |
| 106 * before call |processCommandLine| |
| 107 */ |
| 108 void SetDefaultOptions(struct Options* options, int real_only, |
| 109 int max_fft_order); |
| 110 |
| 111 /* |
| 112 * Process the command line options |
| 113 */ |
| 114 void ProcessCommandLine(struct Options* options, int argc, char* argv[], |
| 115 const char* summary); |
| 116 |
| 117 /* |
| 118 * Print command line options and their values, for debugging. |
| 119 */ |
| 120 void DumpOptions(FILE*, const struct Options* options); |
| 121 |
| 122 /* |
| 123 * Run one forward FFT test of the given size, signal type, and amplitude |
| 124 */ |
| 125 float RunOneForwardTest(int fft_log_size, int signal_type, |
| 126 float signal_value, struct SnrResult* snr); |
| 127 |
| 128 /* |
| 129 * Run one inverse FFT test of the given size, signal type, and amplitude |
| 130 */ |
| 131 float RunOneInverseTest(int fft_log_size, int signal_type, |
| 132 float signal_value, struct SnrResult* snr); |
| 133 |
| 134 /* |
| 135 * Run all FFT tests, as specified by |info| |
| 136 */ |
| 137 void RunAllTests(const struct TestInfo* info); |
| 138 |
| 139 /* |
| 140 * Returns the program name, for debugging. |
| 141 */ |
| 142 char* ProgramName(char*); |
| 143 |
| 144 /* |
| 145 * Return true if the specified FFT test is a known failure. |
| 146 */ |
| 147 int IsKnownFailure(int fft_order, int is_forward_fft, int signal_type, |
| 148 struct KnownTestFailures* known_failures); |
| 149 |
| 150 /* |
| 151 * Neatly print the contents of an array to stdout. |
| 152 */ |
| 153 void DumpArrayReal16(const char* array_name, int count, const OMX_S16* array); |
| 154 void DumpArrayReal32(const char* array_name, int count, const OMX_S32* array); |
| 155 void DumpArrayComplex16(const char* array_name, int count, |
| 156 const OMX_SC16* array); |
| 157 void DumpArrayComplex32(const char* array_name, int count, |
| 158 const OMX_SC32* array); |
| 159 void DumpArrayFloat(const char* array_name, int count, const OMX_F32* array); |
| 160 void DumpArrayComplexFloat(const char* array_name, int count, |
| 161 const OMX_FC32* array); |
| 162 #endif |
OLD | NEW |