aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2018-03-05 12:54:29 +0000
committerymherklotz <ymherklotz@gmail.com>2018-03-05 12:54:29 +0000
commitfb6696ea0232887f63a943b11e0f16b811b241b9 (patch)
treead0d3809e21060c6463e6c36a7a3ce31a0a53290
parentfcaf88ac27152cf3c553fb5976ce2aed3b64f6f2 (diff)
downloadNoiseSilencer-fb6696ea0232887f63a943b11e0f16b811b241b9.tar.gz
NoiseSilencer-fb6696ea0232887f63a943b11e0f16b811b241b9.zip
Ex2 working
-rw-r--r--Project/RTDSP/.launches/RTDSP.launch6
-rw-r--r--Project/RTDSP/dft.c46
-rw-r--r--Project/RTDSP/frame.c9
3 files changed, 9 insertions, 52 deletions
diff --git a/Project/RTDSP/.launches/RTDSP.launch b/Project/RTDSP/.launches/RTDSP.launch
index b408121..51f5f6d 100644
--- a/Project/RTDSP/.launches/RTDSP.launch
+++ b/Project/RTDSP/.launches/RTDSP.launch
@@ -12,8 +12,8 @@
<stringAttribute key="com.ti.ccstudio.debug.core.DISPLAY_NAME_FORMAT" value="RTDSP [Debug] - {0}"/>
<stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_OPTION" value="full"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
-<stringAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_NAME" value="C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out"/>
-<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;modules&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Fri Jan 19 14:07:28 GMT 2018&quot; time_long=&quot;1516370848357&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Jan 23 11:15:11 GMT 2018&quot; time_long=&quot;1516706111426&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 01 11:44:21 GMT 2018&quot; time_long=&quot;1517485461898&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 15 13:55:55 GMT 2018&quot; time_long=&quot;1518702955359&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Feb 27 12:18:55 GMT 2018&quot; time_long=&quot;1519733935329&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Mar 01 13:36:20 GMT 2018&quot; time_long=&quot;1519911380476&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out&quot; time=&quot;Mon Mar 05 10:28:49 GMT 2018&quot; time_long=&quot;1520245729915&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out&quot; time=&quot;Mon Mar 05 11:30:19 GMT 2018&quot; time_long=&quot;1520249419272&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
+<stringAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_NAME" value="C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out"/>
+<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;modules&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Fri Jan 19 14:07:28 GMT 2018&quot; time_long=&quot;1516370848357&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Jan 23 11:15:11 GMT 2018&quot; time_long=&quot;1516706111426&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 01 11:44:21 GMT 2018&quot; time_long=&quot;1517485461898&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 15 13:55:55 GMT 2018&quot; time_long=&quot;1518702955359&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Feb 27 12:18:55 GMT 2018&quot; time_long=&quot;1519733935329&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Mar 01 13:36:20 GMT 2018&quot; time_long=&quot;1519911380476&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out&quot; time=&quot;Mon Mar 05 11:30:19 GMT 2018&quot; time_long=&quot;1520249419272&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out&quot; time=&quot;Mon Mar 05 12:50:48 GMT 2018&quot; time_long=&quot;1520254248914&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
<stringAttribute key="CCEDebugOptions.CPU_NAME" value="Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/TMS320C671X"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTDSP"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
@@ -21,6 +21,6 @@
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/RTDSP.out"/>
<stringAttribute key="CCEDebugOptions.CPU_ISA" value="TMS320C671X"/>
<stringAttribute key="com.ti.ccstudio.debug.core.BUILD_CONFIGURATION" value="Debug"/>
-<stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_FILE" value="C:\GIT\RTDSP\Project\RTDSP\NewTargetConfiguration.ccxml"/>
+<stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_FILE" value="C:\github\RTDSP\Project\RTDSP\NewTargetConfiguration.ccxml"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="com.ti.ccstudio.debug.core.sourceLocator"/>
</launchConfiguration>
diff --git a/Project/RTDSP/dft.c b/Project/RTDSP/dft.c
deleted file mode 100644
index 2e47680..0000000
--- a/Project/RTDSP/dft.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-
-#define E_PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062
-#define N 8
-
-typedef struct {
- float r;
- float i;
-} Complex;
-
-float x[] = {0, 0, 2, 3, 4, 0, 0, 0};
-Complex X[N];
-float x_out[N];
-
-void dft() {
- int n, k;
- for(k = 0; k < N; ++k) {
- X[k].r = 0.f;
- X[k].i = 0.f;
- for(n = 0; n < N; ++n) {
- X[k].r += x[n] * cos(2 * E_PI * k * n / N);
- X[k].i -= x[n] * sin(2 * E_PI * k * n / N);
- }
- }
-}
-
-void idft() {
- int n, k;
- for(n = 0; n < N; ++n) {
- x_out[n] = 0.f;
- for(k = 0; k < N; ++k) {
- x_out[n] += X[k].r * cos(2 * E_PI * k * n / N) - X[k].i * sin(2 * E_PI * k * n / N);
- }
- x_out[n] /= N;
- }
-}
-
-int main() {
- int k;
- dft();
- idft();
- for(k = 0; k < N; ++k) {
- printf("x[%d] = %.2f, X[%d] = %.2f + %.2fi, x_out[%d] = %.2f\n", k, x[k], k, X[k].r, X[k].i, k, x_out[k]);
- }
-}
diff --git a/Project/RTDSP/frame.c b/Project/RTDSP/frame.c
index 1db240e..0f506e0 100644
--- a/Project/RTDSP/frame.c
+++ b/Project/RTDSP/frame.c
@@ -78,7 +78,7 @@ float *input;
float *intermediate;
float *output;
volatile int index = 0;
-float* mag;
+float mag[BUFLEN];
complex C[BUFLEN];
@@ -197,14 +197,17 @@ void wait_buffer(void)
/************************* DO PROCESSING OF FRAME HERE **************************/
// Copy data elements to complex
- for (i = 0; i < BUFLEN; ++i)
+ for (i = 0; i < BUFLEN; ++i) {
+ C[i].i = 0;
C[i].r = intermediate[i];
+ }
fft(BUFLEN, C);
// Calculate the magnitude of the complex numbers
- for (i = 0; i < BUFLEN; ++i)
+ for (i = 0; i < BUFLEN; ++i) {
mag[i] = cabs(C[i]);
+ }