diff options
author | ymherklotz <ymherklotz@gmail.com> | 2018-03-05 12:54:29 +0000 |
---|---|---|
committer | ymherklotz <ymherklotz@gmail.com> | 2018-03-05 12:54:29 +0000 |
commit | fb6696ea0232887f63a943b11e0f16b811b241b9 (patch) | |
tree | ad0d3809e21060c6463e6c36a7a3ce31a0a53290 /Project/RTDSP | |
parent | fcaf88ac27152cf3c553fb5976ce2aed3b64f6f2 (diff) | |
download | NoiseSilencer-fb6696ea0232887f63a943b11e0f16b811b241b9.tar.gz NoiseSilencer-fb6696ea0232887f63a943b11e0f16b811b241b9.zip |
Ex2 working
Diffstat (limited to 'Project/RTDSP')
-rw-r--r-- | Project/RTDSP/.launches/RTDSP.launch | 6 | ||||
-rw-r--r-- | Project/RTDSP/dft.c | 46 | ||||
-rw-r--r-- | Project/RTDSP/frame.c | 9 |
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="<?xml version="1.0" encoding="UTF-8"?> <memoryBlockExpressionList/> "/> -<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="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 12:18:55 GMT 2018" time_long="1519733935329"/> <module name="C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Thu Mar 01 13:36:20 GMT 2018" time_long="1519911380476"/> <module name="C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Mon Mar 05 10:28:49 GMT 2018" time_long="1520245729915"/> <module name="C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Mon Mar 05 11:30:19 GMT 2018" time_long="1520249419272"/> </modules> "/> +<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="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 12:18:55 GMT 2018" time_long="1519733935329"/> <module name="C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Thu Mar 01 13:36:20 GMT 2018" time_long="1519911380476"/> <module name="C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Mon Mar 05 11:30:19 GMT 2018" time_long="1520249419272"/> <module name="C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Mon Mar 05 12:50:48 GMT 2018" time_long="1520254248914"/> </modules> "/> <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="<?xml version="1.0" encoding="UTF-8"?> <globalVariableList/> "/> @@ -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]); + } |