Fix build errors in test programs.

MaxSignalType and memcpy were undeclared in some places.
abs() should be used instead of fabs() on integers.

Add support for building on x64, and link with -lm to get
the trig functions.

With these changes, the test programs can be built for native Linux.

BUG=
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/22919004

git-svn-id: http://webrtc.googlecode.com/svn/deps/third_party/openmax@7360 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/dl/sp/src/test/test_fft.gyp b/dl/sp/src/test/test_fft.gyp
index c1be018..d9764cc 100644
--- a/dl/sp/src/test/test_fft.gyp
+++ b/dl/sp/src/test/test_fft.gyp
@@ -167,13 +167,16 @@
         'test_float_rfft.c',
         'support/float_rfft_thresholds.h',
       ],
+      'libraries': [
+        '-lm',
+      ],
       'conditions': [
         ['target_arch == "arm" or target_arch == "arm64"', {
           'sources': [
             'support/float_rfft_neon.c',
           ],
         }],
-        ['target_arch == "ia32"', {
+        ['target_arch == "ia32" or target_arch == "x64"', {
           'sources': [
             'support/float_rfft_x86.c',
           ],
@@ -192,8 +195,11 @@
       'sources': [
         'test_fft_time.c',
       ],
+      'libraries': [
+        '-lm',
+      ],
       'conditions': [
-        ['target_arch == "ia32" or target_arch == "arm64" or target_arch == "mipsel"', {
+        ['target_arch == "ia32" or target_arch == "x64" or target_arch == "arm64" or target_arch == "mipsel"', {
           'defines': [
             # Timing test only for float FFTs on x86 and arm64 and MIPSEL.
             'FLOAT_ONLY',
diff --git a/dl/sp/src/test/test_fft_time.c b/dl/sp/src/test/test_fft_time.c
index 6154228..beaa895 100644
--- a/dl/sp/src/test/test_fft_time.c
+++ b/dl/sp/src/test/test_fft_time.c
@@ -11,6 +11,7 @@
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <unistd.h>
@@ -609,11 +610,11 @@
       GetUserTime(&start_time);
       for (k = 0; k < count; ++k) {
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(x[n].Re) > factor) {
-            factor = fabs(x[n].Re);
+          if (abs(x[n].Re) > factor) {
+            factor = abs(x[n].Re);
           }
-          if (fabs(x[n].Im) > factor) {
-            factor = fabs(x[n].Im);
+          if (abs(x[n].Im) > factor) {
+            factor = abs(x[n].Im);
           }
         }
 
@@ -653,11 +654,11 @@
       GetUserTime(&start_time);
       for (k = 0; k < count; ++k) {
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(x[n].Re) > factor) {
-            factor = fabs(x[n].Re);
+          if (abs(x[n].Re) > factor) {
+            factor = abs(x[n].Re);
           }
-          if (fabs(x[n].Im) > factor) {
-            factor = fabs(x[n].Im);
+          if (abs(x[n].Im) > factor) {
+            factor = abs(x[n].Im);
           }
         }
         factor = ((1 << 18) - 1) / factor;
@@ -791,11 +792,11 @@
       GetUserTime(&start_time);
       for (k = 0; k < count; ++k) {
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(x[n].Re) > factor) {
-            factor = fabs(x[n].Re);
+          if (abs(x[n].Re) > factor) {
+            factor = abs(x[n].Re);
           }
-          if (fabs(x[n].Im) > factor) {
-            factor = fabs(x[n].Im);
+          if (abs(x[n].Im) > factor) {
+            factor = abs(x[n].Im);
           }
         }
 
@@ -835,11 +836,11 @@
       GetUserTime(&start_time);
       for (k = 0; k < count; ++k) {
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(x[n].Re) > factor) {
-            factor = fabs(x[n].Re);
+          if (abs(x[n].Re) > factor) {
+            factor = abs(x[n].Re);
           }
-          if (fabs(x[n].Im) > factor) {
-            factor = fabs(x[n].Im);
+          if (abs(x[n].Im) > factor) {
+            factor = abs(x[n].Im);
           }
         }
         factor = ((1 << 15) - 1) / factor;
@@ -1013,8 +1014,8 @@
          * Spend some time computing the max of the signal, and then scaling it.
          */
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(xr[n]) > factor) {
-            factor = fabs(xr[n]);
+          if (abs(xr[n]) > factor) {
+            factor = abs(xr[n]);
           }
         }
 
@@ -1080,8 +1081,8 @@
          * Spend some time scaling the FFT signal to fixed point.
          */
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(yrTrue[n]) > factor) {
-            factor = fabs(yrTrue[n]);
+          if (abs(yrTrue[n]) > factor) {
+            factor = abs(yrTrue[n]);
           }
         }
         for (n = 0; n < fft_size; ++n) {
@@ -1282,8 +1283,8 @@
          * Spend some time computing the max of the signal, and then scaling it.
          */
         for (n = 0; n < fft_size; ++n) {
-          if (fabs(xr[n]) > factor) {
-            factor = fabs(xr[n]);
+          if (abs(xr[n]) > factor) {
+            factor = abs(xr[n]);
           }
         }
 
@@ -1331,8 +1332,8 @@
          * Spend some time scaling the FFT signal to fixed point.
          */
         for (n = 0; n < fft_size + 2; ++n) {
-          if (fabs(yrTrue[n]) > factor) {
-            factor = fabs(yrTrue[n]);
+          if (abs(yrTrue[n]) > factor) {
+            factor = abs(yrTrue[n]);
           }
         }
         for (n = 0; n < fft_size + 2; ++n) {
diff --git a/dl/sp/src/test/test_util_fft.c b/dl/sp/src/test/test_util_fft.c
index 3deb041..025ee8d 100644
--- a/dl/sp/src/test/test_util_fft.c
+++ b/dl/sp/src/test/test_util_fft.c
@@ -10,6 +10,7 @@
 #include "dl/sp/src/test/test_util.h"
 
 #include "dl/sp/src/test/compare.h"
+#include "dl/sp/src/test/gensig.h"
 
 /*
  * Test results from running either forward or inverse FFT tests