Fix issues so clang can compile OpenMAX DL library and tests.

BUG=2976
R=andrew@webrtc.org, turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/deps/third_party/openmax@5810 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/dl/sp/api/omxSP.h b/dl/sp/api/omxSP.h
index 5a7980a..d056fb9 100644
--- a/dl/sp/api/omxSP.h
+++ b/dl/sp/api/omxSP.h
@@ -2203,6 +2203,59 @@
 );
 
 /**
+ * Function:  omxSP_FFTFwd_CToC_FC32_Sfs   (2.2.4.2.2)
+ *
+ * Description:
+ * Compute an FFT for a complex signal of length of 2^order, 
+ * where 0 <= order <= 15. 
+ * Transform length is determined by the specification structure, which 
+ * must be initialized prior to calling the FFT function using the appropriate 
+ * helper, i.e., <FFTInit_C_sc32> or <FFTInit_C_SC16>. The relationship 
+ * between the input and output sequences can be expressed in terms of the 
+ * DFT, i.e., 
+ *
+ *      X[k] = SUM[n=0...N-1]x[n].e^(-jnk.2.pi/N)
+ *      k = 0,1,2,..., N-1
+ *      N = 2^order
+ *
+ * Input Arguments:
+ *   pSrc - pointer to the input signal, a complex-valued vector of length
+ *            2^order; must be aligned on a 32 byte boundary. 
+ *   pFFTSpec - pointer to the preallocated and initialized specification 
+ *            structure 
+ *
+ * Output Arguments:
+ *   pDst - pointer to the complex-valued output vector, of length 2^order;
+ *            must be aligned on an 32-byte boundary. 
+ *
+ * Return Value:
+ *    
+ *    OMX_Sts_NoErr - no error 
+ *    OMX_Sts_BadArgErr - returned if one or more of the following conditions 
+ *              is true: 
+ *    -   one or more of the following pointers is NULL: pSrc, pDst, or 
+ *              pFFTSpec. 
+ *    -    pSrc or pDst is not 32-byte aligned 
+ *    -    scaleFactor<0 or scaleFactor >32 
+ *
+ */
+OMXResult omxSP_FFTFwd_CToC_FC32_Sfs (
+    const OMX_FC32 *pSrc,
+    OMX_FC32 *pDst,
+    const OMXFFTSpec_C_FC32 *pFFTSpec
+);
+#ifdef __arm__
+/*
+ * Non-NEON version
+ */    
+OMXResult omxSP_FFTFwd_CToC_FC32_Sfs_vfp (
+    const OMX_FC32 *pSrc,
+    OMX_FC32 *pDst,
+    const OMXFFTSpec_C_FC32 *pFFTSpec
+);
+#endif
+
+/**
  * Function:  omxSP_FFTFwd_RToCCS_F32_Sfs
  *
  * Description:
@@ -2421,6 +2474,59 @@
 );
 
 /**
+ * Function:  omxSP_FFTInv_CToC_FC32_Sfs   (2.2.4.2.4)
+ *
+ * Description:
+ * These functions compute an inverse FFT for a complex signal of
+ * length of 2^order, where 0 <= order <= 15. Transform length is
+ * determined by the specification structure, which must be
+ * initialized prior to calling the FFT function using the appropriate
+ * helper, i.e., <FFTInit_C_FC32>. The relationship between the input
+ * and output sequences can be expressed in terms of the IDFT, i.e.:
+ *
+ *     x[n] = SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N)
+ *     n=0,1,2,...N-1
+ *     N=2^order.
+ *
+ * Input Arguments:
+ *   pSrc - pointer to the complex-valued input signal, of length 2^order ; 
+ *          must be aligned on a 32-byte boundary. 
+ *   pFFTSpec - pointer to the preallocated and initialized specification 
+ *            structure 
+ *
+ * Output Arguments:
+ *   order 
+ *   pDst - pointer to the complex-valued output signal, of length 2^order; 
+ *          must be aligned on a 32-byte boundary. 
+ *
+ * Return Value:
+ *    
+ *    OMX_Sts_NoErr - no error 
+ *    OMX_Sts_BadArgErr - returned if one or more of the following conditions 
+ *              is true: 
+ *    -   one or more of the following pointers is NULL: pSrc, pDst, or 
+ *              pFFTSpec. 
+ *    -   pSrc or pDst is not 32-byte aligned 
+ *    -   scaleFactor<0 or scaleFactor>32
+ *
+ */
+OMXResult omxSP_FFTInv_CToC_FC32_Sfs (
+    const OMX_FC32 *pSrc,
+    OMX_FC32 *pDst,
+    const OMXFFTSpec_C_FC32 *pFFTSpec
+);
+#ifdef __arm__
+/*
+ * Non-NEON version
+ */    
+OMXResult omxSP_FFTInv_CToC_FC32_Sfs_vfp (
+    const OMX_FC32 *pSrc,
+    OMX_FC32 *pDst,
+    const OMXFFTSpec_C_FC32 *pFFTSpec
+);
+#endif
+
+/**
  * Function:  omxSP_FFTInv_CCSToR_F32_Sfs
  *
  * Description:
diff --git a/dl/sp/src/arm/detect.c b/dl/sp/src/arm/detect.c
index b74220a..57bfe40 100644
--- a/dl/sp/src/arm/detect.c
+++ b/dl/sp/src/arm/detect.c
@@ -14,7 +14,7 @@
 #include "android/log.h"
 #include "dl/sp/api/omxSP.h"
 
-int HasArmNeon() {
+int omxSP_HasArmNeon() {
   return (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
 }
 
@@ -23,7 +23,7 @@
    * Choose the correct (NEON or non-NEON) routines for both the
    * forward and inverse FFTs
    */
-  if (HasArmNeon()) {
+  if (omxSP_HasArmNeon()) {
     __android_log_print(ANDROID_LOG_INFO, "OpenMAX DL FFT",
                         "Using NEON FFT");
     omxSP_FFTFwd_RToCCS_F32 = omxSP_FFTFwd_RToCCS_F32_Sfs;
diff --git a/dl/sp/src/test/support/float_rfft_detect.c b/dl/sp/src/test/support/float_rfft_detect.c
index cf81e8d..e8b1e54 100644
--- a/dl/sp/src/test/support/float_rfft_detect.c
+++ b/dl/sp/src/test/support/float_rfft_detect.c
@@ -16,6 +16,8 @@
 static const char* message =
     "Test forward and inverse real floating-point FFT (Autodetect NEON)\n";
 
+extern int omxSP_HasArmNeon();
+
 const char* UsageMessage() {
   return message;
 }
@@ -26,8 +28,6 @@
 }
 
 void SetThresholds(struct TestInfo* info) {
-  extern int HasArmNeon();
-
   if (HasArmNeon()) {
     info->forward_threshold_ = FLOAT_RFFT_FORWARD_THRESHOLD_NEON;
     info->inverse_threshold_ = FLOAT_RFFT_INVERSE_THRESHOLD_NEON;
diff --git a/dl/sp/src/test/test_fft16.c b/dl/sp/src/test/test_fft16.c
index 05fc778..8d55ed6 100644
--- a/dl/sp/src/test/test_fft16.c
+++ b/dl/sp/src/test/test_fft16.c
@@ -48,7 +48,7 @@
     {-1, 0, 0}
 };
 
-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
   struct Options options;
   struct TestInfo info;
 
@@ -89,6 +89,8 @@
                &info,
                "16-bit FFT");
   }
+
+  return 0;
 }
 
 void GenerateSignal(OMX_SC16* x, struct ComplexFloat* fft,
diff --git a/dl/sp/src/test/test_fft32.c b/dl/sp/src/test/test_fft32.c
index fe3c57a..9fc7855 100644
--- a/dl/sp/src/test/test_fft32.c
+++ b/dl/sp/src/test/test_fft32.c
@@ -26,7 +26,7 @@
 int verbose;
 int signal_value;
 
-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
   struct Options options;
   struct TestInfo info;
 
@@ -67,6 +67,8 @@
                &info,
                "32-bit FFT");
   }
+
+  return 0;
 }
 
 void GenerateSignal(OMX_SC32* x, OMX_SC32* fft, int size, int signal_type) {
diff --git a/dl/sp/src/test/test_fft_time.c b/dl/sp/src/test/test_fft_time.c
index 04228d9..db65134 100644
--- a/dl/sp/src/test/test_fft_time.c
+++ b/dl/sp/src/test/test_fft_time.c
@@ -19,6 +19,7 @@
 #include "dl/sp/api/omxSP.h"
 #include "dl/sp/src/test/aligned_ptr.h"
 #include "dl/sp/src/test/gensig.h"
+#include "dl/sp/src/test/test_util.h"
 
 #define MAX_FFT_ORDER TWIDDLE_TABLE_ORDER
 #define MAX_FFT_ORDER_FIXED_POINT 12
@@ -83,7 +84,7 @@
 static int min_fft_order = 2;
 static int max_fft_order = MAX_FFT_ORDER;
 
-void TimeFFTUsage(const char* prog) {
+void TimeFFTUsage(char* prog) {
   fprintf(stderr, 
       "%s: [-hTFICA] [-f fft] [-c count] [-n logsize] [-s scale]\n"
       "    [-g signal-type] [-S signal value]\n"
@@ -140,7 +141,7 @@
 }
 
 /* TODO(kma/ajm/rtoy): use strings instead of numbers for fft_type. */
-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
   int fft_log_size = 4;
   float signal_value = 32767;
   int signal_type = 0;
@@ -256,6 +257,8 @@
         break;
     }
   }
+
+  return 0;
 }
 
 void GetUserTime(struct timeval* time) {
@@ -365,7 +368,7 @@
   if (do_forward_test) {
     GetUserTime(&start_time);
     for (n = 0; n < count; ++n) {
-      FORWARD_FLOAT_FFT(x, y, fft_fwd_spec);
+      FORWARD_FLOAT_FFT((OMX_FC32*) x, (OMX_FC32*) y, fft_fwd_spec);
     }
     GetUserTime(&end_time);
 
@@ -377,7 +380,7 @@
   if (do_inverse_test) {
     GetUserTime(&start_time);
     for (n = 0; n < count; ++n) {
-      INVERSE_FLOAT_FFT(y, z, fft_inv_spec);
+      INVERSE_FLOAT_FFT((OMX_FC32*) y, z, fft_inv_spec);
     }
     GetUserTime(&end_time);
 
diff --git a/dl/sp/src/test/test_rfft16_s16.c b/dl/sp/src/test/test_rfft16_s16.c
index 33ca5b3..126a8c0 100644
--- a/dl/sp/src/test/test_rfft16_s16.c
+++ b/dl/sp/src/test/test_rfft16_s16.c
@@ -27,7 +27,7 @@
 int signal_value = 32767;
 int scale_factor = 0;
 
-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
   struct Options options;
   struct TestInfo info;
 
@@ -65,6 +65,8 @@
                &info,
                "16-bit Real FFT using 16-bit complex FFT");
   }
+
+  return 0;
 }
 
 void GenerateSignal(struct ComplexFloat* fft,
diff --git a/dl/sp/src/test/test_rfft16_s32.c b/dl/sp/src/test/test_rfft16_s32.c
index a319984..398f61d 100644
--- a/dl/sp/src/test/test_rfft16_s32.c
+++ b/dl/sp/src/test/test_rfft16_s32.c
@@ -26,7 +26,7 @@
 
 #define MAX_FFT_ORDER   12
 
-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
   struct Options options;
   struct TestInfo info;
 
@@ -61,6 +61,8 @@
                &info,
                "16-bit Real FFT using 32-bit complex FFT");
   }
+
+  return 0;
 }
 
 void GenerateSignal(OMX_S16* x, OMX_SC32* fft, int size, int signal_type) {
diff --git a/dl/sp/src/test/test_rfft32.c b/dl/sp/src/test/test_rfft32.c
index 1b81d44..19cad8e 100644
--- a/dl/sp/src/test/test_rfft32.c
+++ b/dl/sp/src/test/test_rfft32.c
@@ -26,7 +26,7 @@
 
 #define MAX_FFT_ORDER   12
 
-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
   struct Options options;
   struct TestInfo info;
 
@@ -65,6 +65,8 @@
                &info,
                "32-bit Real FFT");
   }
+
+  return 0;
 }
 
 void GenerateSignal(OMX_S32* x, OMX_SC32* fft, int size, int signal_type) {
diff --git a/dl/sp/src/test/test_util.c b/dl/sp/src/test/test_util.c
index e9ca0cf..d21d8c5 100644
--- a/dl/sp/src/test/test_util.c
+++ b/dl/sp/src/test/test_util.c
@@ -16,6 +16,7 @@
 
 #include "dl/sp/api/armSP.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
diff --git a/dl/sp/src/x86/x86SP_FFT_F32_radix4_kernel.c b/dl/sp/src/x86/x86SP_FFT_F32_radix4_kernel.c
index e7c7b89..fab3471 100644
--- a/dl/sp/src/x86/x86SP_FFT_F32_radix4_kernel.c
+++ b/dl/sp/src/x86/x86SP_FFT_F32_radix4_kernel.c
@@ -87,6 +87,30 @@
     const OMX_F32 *twiddle,
     OMX_INT n);
 
+extern void x86SP_FFT_CToC_FC32_Fwd_Radix2_ls(
+    const OMX_F32 *in,
+    OMX_F32 *out,
+    const OMX_F32 *twiddle,
+    OMX_INT n);
+
+extern void x86SP_FFT_CToC_FC32_Inv_Radix2_ls(
+    const OMX_F32 *in,
+    OMX_F32 *out,
+    const OMX_F32 *twiddle,
+    OMX_INT n);
+
+extern void x86SP_FFT_CToC_FC32_Fwd_Radix2_ls_sse(
+    const OMX_F32 *in,
+    OMX_F32 *out,
+    const OMX_F32 *twiddle,
+    OMX_INT n);
+
+extern void x86SP_FFT_CToC_FC32_Inv_Radix2_ls_sse(
+    const OMX_F32 *in,
+    OMX_F32 *out,
+    const OMX_F32 *twiddle,
+    OMX_INT n);
+
 OMX_F32* x86SP_F32_radix4_kernel_OutOfPlace(
     const OMX_F32 *src,
     OMX_F32 *buf1,