aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2018-02-27 12:20:40 +0000
committerymherklotz <ymherklotz@gmail.com>2018-02-27 12:20:40 +0000
commit8c4c776fedeb003055d3badde73ae014c1d51a8d (patch)
tree0527dcc2fa4645726321093d1dd7349fb9c8ab89
parent1a354b47a09800805ecdf6a0ec24fc1f67405bd8 (diff)
downloadNoiseSilencer-8c4c776fedeb003055d3badde73ae014c1d51a8d.tar.gz
NoiseSilencer-8c4c776fedeb003055d3badde73ae014c1d51a8d.zip
Added efficient code
-rw-r--r--lab5/RTDSP/.launches/RTDSP.launch4
-rw-r--r--lab5/RTDSP/Matlab/coeff.txt2
-rw-r--r--lab5/RTDSP/Matlab/filter_coeff_ell_a.txt1
-rw-r--r--lab5/RTDSP/Matlab/filter_coeff_ell_b.txt1
-rw-r--r--lab5/RTDSP/Matlab/gen_filter.m4
-rw-r--r--lab5/RTDSP/intio.c16
6 files changed, 13 insertions, 15 deletions
diff --git a/lab5/RTDSP/.launches/RTDSP.launch b/lab5/RTDSP/.launches/RTDSP.launch
index d970f38..4330703 100644
--- a/lab5/RTDSP/.launches/RTDSP.launch
+++ b/lab5/RTDSP/.launches/RTDSP.launch
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="com.ti.ccstudio.debug.core.CCELaunchType">
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
-<booleanAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_S_ONLY" value="false"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<booleanAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_S_ONLY" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="com.ti.ccstudio.debug.core.CCEDebugger"/>
<stringAttribute key="CCEDebugOptions.CPU_RESOLVE_OPTION" value="exact"/>
<stringAttribute key="org.eclipse.debug.ui.DISPLAY_NAME" value="RTDSP [Debug] - Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/TMS320C671X"/>
@@ -13,7 +13,7 @@
<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:\Github\RTDSP\lab5\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 11:57:55 GMT 2018&quot; time_long=&quot;1519732675312&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
+<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;/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;"/>
diff --git a/lab5/RTDSP/Matlab/coeff.txt b/lab5/RTDSP/Matlab/coeff.txt
new file mode 100644
index 0000000..6c1b0ff
--- /dev/null
+++ b/lab5/RTDSP/Matlab/coeff.txt
@@ -0,0 +1,2 @@
+double a[] = {1.000000000000000e+00, -3.622738280081862e+00, 5.063887790131743e+00, -3.234610259864946e+00, 7.984164681552797e-01, };
+double b[] = {9.756494393306392e-02, -3.428674269973439e-01, 4.911005379625814e-01, -3.428674269973437e-01, 9.756494393306386e-02, };
diff --git a/lab5/RTDSP/Matlab/filter_coeff_ell_a.txt b/lab5/RTDSP/Matlab/filter_coeff_ell_a.txt
deleted file mode 100644
index f6d3023..0000000
--- a/lab5/RTDSP/Matlab/filter_coeff_ell_a.txt
+++ /dev/null
@@ -1 +0,0 @@
- 1.0000000000000000e+00 -3.6227382800818617e+00 5.0638877901317434e+00 -3.2346102598649464e+00 7.9841646815527967e-01
diff --git a/lab5/RTDSP/Matlab/filter_coeff_ell_b.txt b/lab5/RTDSP/Matlab/filter_coeff_ell_b.txt
deleted file mode 100644
index c8c1e48..0000000
--- a/lab5/RTDSP/Matlab/filter_coeff_ell_b.txt
+++ /dev/null
@@ -1 +0,0 @@
- 9.7564943933063919e-02 -3.4286742699734390e-01 4.9110053796258135e-01 -3.4286742699734374e-01 9.7564943933063863e-02
diff --git a/lab5/RTDSP/Matlab/gen_filter.m b/lab5/RTDSP/Matlab/gen_filter.m
index 618d719..6822bfe 100644
--- a/lab5/RTDSP/Matlab/gen_filter.m
+++ b/lab5/RTDSP/Matlab/gen_filter.m
@@ -2,10 +2,10 @@ Fs = 8000;
[b,a] = elliptical (Fs);
freqz(b, a);
-fileID = fopen('coeff2.txt','w');
+fileID = fopen('coeff.txt','w');
fprintf(fileID, 'double a[] = {');
fprintf(fileID, '%.15e, ', a);
fprintf(fileID, '};\ndouble b[] = {');
fprintf(fileID, '%.15e, ', b);
-fprintf(fileID, '};');
+fprintf(fileID, '};\n');
fclose(fileID); \ No newline at end of file
diff --git a/lab5/RTDSP/intio.c b/lab5/RTDSP/intio.c
index 567324c..e7ae084 100644
--- a/lab5/RTDSP/intio.c
+++ b/lab5/RTDSP/intio.c
@@ -43,7 +43,7 @@
// PI defined here for use in your code
#define PI 3.141592653589793
-#include "Matlab/coeff2.txt"
+#include "Matlab/coeff.txt"
int N = sizeof(a)/sizeof(a[0]);
short* x;
@@ -133,23 +133,21 @@ void init_HWI()
void ISR_AIC()
{
int i = N-1;
+ double Y = 0.0;
//Shift the values
for (; i > 0; --i) {
x[i] = x[i-1];
y[i] = y[i-1];
+
+ Y += x[i] * b[i] - y[i] * a[i];
}
x[0] = mono_read_16Bit();
- y[0] = 0.0;
+ Y += x[0] * b[0];
- for (i = 0; i < N; ++i) {
- y[0] += x[i] * b[i];
- if(i != 0) {
- y[0] -= y[i] * a[i];
- }
- }
+ y[0] = Y;
- mono_write_16Bit((short)y[0]);
+ mono_write_16Bit((short)Y);
}