]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/audio-preprocessing.git/blobdiff - common/components/clk.c
add the CCS console output "Test Passed", after 30000 audio frames have been processed
[processor-sdk/audio-preprocessing.git] / common / components / clk.c
index 40be13511efc0ffb3a6f93f47f06709c5c2596c9..c67e26ed7993fe0e74be6ca0943e7dd59d401556 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Texas Instruments Incorporated
+ * Copyright (c) 2017, Texas Instruments Incorporated\r
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 \r
 #include <strings.h>\r
 \r
+#include "fil.h"                      /* FILE I/O implementation */\r
+#include "sys.h"                      /* System API and structures */\r
+#include "sysbfflt.h"                 /* System support for BF filters */\r
+\r
 /* The infamous xdc/std.h must come before any header file which uses XDC symbols */\r
 #include <xdc/std.h>              /* mandatory - have to include first, for BIOS types */\r
-#include <ti/mas/types/types.h>\r
+#include <types.h>\r
 #include <ti/mas/aer/bf.h>\r
 //#include <ti/mas/aer/mss.h>\r
 #include "mss/mss.h"              /* local version used */\r
 #include <ti/mas/vpe/asnr.h>\r
-#include <ti/mas/vau/vau.h>\r
+#if (SYS_USE_DRC)\r
+///#include <ti/mas/vau/vau.h>\r
+#include <ti/mas/aer/drc.h>\r
+#endif\r
 \r
 /*----------------------------------------\r
  *  BIOS header files\r
 \r
 #include <ti/sysbios/knl/Semaphore.h> /* this looks obvious */\r
 \r
-#include "fil.h"                      /* FILE I/O implementation */\r
-#include "sys.h"                      /* System API and structures */\r
-#include "sysbfflt.h"                 /* System support for BF filters */\r
-\r
 #define Timestamp_get Timestamp_get32 /* use 32-bit time stamps */\r
 \r
 #define MIN(a,b)    (((a)>(b))?(b):(a))     /* Min/Max macros */\r
@@ -147,9 +150,19 @@ void swiDataIn(void)
  *\r
  *===========================================*/\r
 \r
+#if (SYS_USE_DRC)\r
+/* Output frame for MSS, input for DRC */\r
+#pragma DATA_ALIGN(txOutFrame1,8)\r
+linSample txOutFrame1[SYS_FRAME_LENGTH];\r
+\r
+/* Output frame for DRC, input for VAU */\r
+#pragma DATA_ALIGN(txOutFrame2,8)\r
+linSample txOutFrame2[SYS_FRAME_LENGTH];\r
+#else\r
 /* Output frame for MSS, input for VAU */\r
 #pragma DATA_ALIGN(txOutFrame,8)\r
 linSample txOutFrame[SYS_FRAME_LENGTH];\r
+#endif\r
 \r
 typedef struct txBfDebug_stc {\r
  tulong frmcnt;     /* normal frames */\r
@@ -177,12 +190,14 @@ typedef struct txTaskProfile_stc {
   txTaskProfileData_t   bf;       /* Beamformer profile */\r
   txTaskProfileData_t   asnr;     /* ASNR profile */\r
   txTaskProfileData_t   mss;      /* MSS profile */\r
+  txTaskProfileData_t   drc;      /* DRC profile */\r
   txTaskProfileData_t   vau;      /* VAU profile */\r
 } txTaskProfile_t;\r
 volatile txTaskProfile_t  txTaskProfile = {\r
   {~(0uL), 0, 0, 0.0f},\r
   {~(0uL), 0, 0, 0.0f},\r
   {~(0uL), 0, 0, 0.0f},\r
+  {~(0uL), 0, 0, 0.0f},\r
   {~(0uL), 0, 0, 0.0f}\r
 };\r
 \r
@@ -212,10 +227,12 @@ void taskTx(void)
 \r
   mssDebugStat_t  mssDbg;\r
 \r
+#if 0\r
   ISPHENC1_FrameType vauOldFrameType;       /* previous speech/noise */\r
   ISPHENC1_FrameType vauFrameType;          /* use for every frame */\r
 \r
   vauOldFrameType = (ISPHENC1_FrameType)255;    /* Start with invalid, update only on changes */\r
+#endif\r
 \r
   memset(&txTaskDebug,0,sizeof(txTaskDebug));   /* zero debug stats */\r
 \r
@@ -314,7 +331,11 @@ void taskTx(void)
 \r
     t1 = Timestamp_get();\r
     inst_p  = sysContext.mssInst_p;         /* fetch the MSS instance pointer */\r
+#if (SYS_USE_DRC)\r
+           frame_p = txOutFrame1;              /* point to the output frame buffer */\r
+#else\r
     frame_p = txOutFrame;                   /* point to the output frame buffer */\r
+#endif\r
 \r
     err = mssProcess(inst_p, (void*)frame_p,      /* instance and output frame pointers */\r
                      (void*)frame_p,              /* WORKAROUND (not used, but no NULL) */\r
@@ -362,8 +383,28 @@ void taskTx(void)
     }\r
 \r
     /* Done with MSS */\r
-    /* Run VAU */\r
 \r
+#if (SYS_USE_DRC)\r
+    /* Run DRC */\r
+    t1 = Timestamp_get();\r
+    inst_p      = sysContext.drcInst_p;     /* fetch the DRC instance pointer */\r
+    frame_p     = txOutFrame1;              /* point to the MSS output frame buffer and use it as input */\r
+    outframe_p  = txOutFrame2;              /* point to DRC output frame */\r
+    err = drcProcess(inst_p, frame_p,       /* instance and input frame pointers */\r
+                    outframe_p);           /* pointer to output buffer pointer */\r
+    t2 = Timestamp_get();\r
+    delta = t2-t1;\r
+    txTaskProfile.drc.min = MIN(txTaskProfile.drc.min,delta);\r
+    txTaskProfile.drc.max = MAX(txTaskProfile.drc.max,delta);\r
+    txTaskProfile.drc.n++;\r
+    txTaskProfile.drc.total += (float)delta;\r
+    /* Done with DRC */\r
+#else\r
+    outframe_p = frame_p;\r
+#endif\r
+\r
+    /* Run VAU */\r
+#if 0\r
     t1 = Timestamp_get();\r
     inst_p  = sysContext.vauInst_p;         /* fetch the VAU instance pointer */\r
     frame_p = txOutFrame;                   /* point to the Tx output frame buffer and use it as input */\r
@@ -402,6 +443,7 @@ void taskTx(void)
 \r
       Log_write4(UIAEvt_intWithKey, 20*alert, 3, 0, (IArg)"VAU-ALERT");\r
     }\r
+#endif\r
 \r
     /*---------------------------------*/\r
     /* Save samples to the output file */\r
@@ -413,6 +455,7 @@ void taskTx(void)
         if (!sysContext.eof) {\r
           sysContext.eof = TRUE;\r
           System_printf("taskTx: EOF Reached.\n");\r
+          System_printf("\nTest Passed\n");
           System_flush();\r
         }\r
       }\r