added header and footer for doxygen

added sinc function

 Changes to be committed:
	new file:   dox/doxy_stylesheet.css
	modified:   dox/doxyfile_ru
	new file:   dox/footer.html
	new file:   dox/header.html
	modified:   dspl/src/fft.c
	modified:   dspl/src/fillarray.c
	modified:   dspl/src/fourier_series.c
	modified:   dspl/src/math.c
	modified:   dspl/src/signals.c
	modified:   include/dspl.c
	modified:   include/dspl.h
	modified:   release/include/dspl.c
	modified:   release/include/dspl.h
pull/2/head
Dsplib 2018-09-12 23:52:09 +03:00
rodzic 19d4e40a88
commit 4ec07a1b4f
13 zmienionych plików z 2307 dodań i 452 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,4 +1,4 @@
# Doxyfile 1.8.11
# Doxyfile 1.8.13
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@ -303,6 +303,15 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
@ -809,8 +818,8 @@ INPUT_ENCODING = UTF-8
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
FILE_PATTERNS = *.c \
*.cc \
@ -1156,7 +1165,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER =
HTML_HEADER = header.html
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@ -1166,7 +1175,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER =
HTML_FOOTER = footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@ -1178,7 +1187,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_STYLESHEET =
HTML_STYLESHEET = doxy_stylesheet.css
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@ -2424,6 +2433,11 @@ DIAFILE_DIRS =
PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.

46
dox/footer.html 100644
Wyświetl plik

@ -0,0 +1,46 @@
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
</a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
</div> <!--div id="dsplib_content"-->
</div><!--div id="dsplib_maket"-->
</div> <!-- div id="dsplib_main" -->
<div id="dsplib_footer">
<div id = "dsplib_bottombar">
<a href="http://ru.dsplib.org">Содержание</a>
<a href="http://ru.dsplib.org/dspl">DSPL</a>
<a href="http://ru.dsplib.org/forum">Форум</a>
<div class="dsplib_copyright">
&copy; Бахурин Сергей 2015 - 2018. Все права защищены.
Любое копирование материалов сайте без разрешения автора запрещено.
</div>
</div>
</div>
</div> <!-- div id="wrapper" -->
</body>
</html>

134
dox/header.html 100644
Wyświetl plik

@ -0,0 +1,134 @@
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
<link href="http://dsplib.org/header_footer.css" rel="stylesheet">
</head>
<body>
<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter32971694 = new Ya.Metrika({
id:32971694,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
} catch(e) { }
});
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/watch.js";
if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/32971694" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<div id="dsplib_wrapper">
<div id="dsplib_main">
<div id="dsplib_header">
<div id = "dsplib_menubar">
<nav>
<ul>
<div id = "dsplib_logo"><img src="http://dsplib.org/logo.png" /> </div>
<li><a href="http://ru.dsplib.org">Содержание</a></li>
<li><a href="http://ru.dsplib.org/dspl">DSPL</a></li>
<li><a href="http://ru.dsplib.org/forum">Форум</a></li>
</ul>
</nav>
</div><!--div id="dsplib_header"-->
</div><!--div id = "dsplib_menubar"-->
<div id="dsplib_maket">
<div id="dsplib_right">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- right -->
<ins class="adsbygoogle"
style="display:inline-block;width:160px;height:600px"
data-ad-client="ca-pub-6804616542664514"
data-ad-slot="1279323001"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div id="dsplib_content">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -26,7 +26,7 @@ int fft_bit_reverse(complex_t* x, complex_t* y, int n, int p2);
int fft_dit(fft_t *pfft, int n, complex_t* y);
void fft_dit_krn( complex_t *x0, complex_t *x1, complex_t *w, int n,
void fft_dit_krn( complex_t *x0, complex_t *x1, complex_t *w, int n,
complex_t *y0, complex_t *y1);
int fft_p2(int n);
@ -42,33 +42,33 @@ int DSPL_API ifft_cmplx(complex_t *x, int n, fft_t* pfft, complex_t* y)
{
int err, k;
double norm;
if(!x || !pfft || !y)
return ERROR_PTR;
if(n<1)
return ERROR_SIZE;
err = fft_create(pfft, n);
if(err != RES_OK)
return err;
memcpy(pfft->t1, x, n*sizeof(complex_t));
for(k = 0; k < n; k++)
IM(pfft->t1[k]) = -IM(pfft->t1[k]);
err = fft_dit(pfft, n, y);
if(err!=RES_OK)
return err;
norm = 1.0 / (double)n;
for(k = 0; k < n; k++)
{
RE(y[k]) = RE(y[k])*norm;
IM(y[k]) = -IM(y[k])*norm;
}
return RES_OK;
return RES_OK;
}
@ -83,19 +83,19 @@ Real vector FFT
int DSPL_API fft(double *x, int n, fft_t* pfft, complex_t* y)
{
int err;
if(!x || !pfft || !y)
return ERROR_PTR;
if(n<1)
return ERROR_SIZE;
err = fft_create(pfft, n);
if(err != RES_OK)
return err;
re2cmplx(x, n, pfft->t1);
return fft_dit(pfft, n, y);
}
@ -118,7 +118,7 @@ int DSPL_API fft_cmplx(complex_t *x, int n, fft_t* pfft, complex_t* y)
err = fft_create(pfft, n);
if(err != RES_OK)
return err;
memcpy(pfft->t1, x, n*sizeof(complex_t));
return fft_dit(pfft, n, y);
@ -131,39 +131,39 @@ FFT bit reverse
*******************************************************************************/
int fft_bit_reverse(complex_t* x, complex_t* y, int n, int p2)
{
static unsigned char rb_table[256] =
static unsigned char rb_table[256] =
{
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
@ -171,20 +171,20 @@ int fft_bit_reverse(complex_t* x, complex_t* y, int n, int p2)
return ERROR_PTR;
if(n<1 || p2 < 1)
return ERROR_SIZE;
unsigned int v, c;
for(v = 0; v < n; v++)
{
c = (unsigned int)
((rb_table[ v & 0xff] << 24) |
(rb_table[(v >> 8) & 0xff] << 16) |
(rb_table[(v >> 16) & 0xff] << 8) |
(rb_table[(v >> 8) & 0xff] << 16) |
(rb_table[(v >> 16) & 0xff] << 8) |
(rb_table[(v >> 24) & 0xff])) >> (32 - p2);
RE(y[c]) = RE(x[v]);
IM(y[c]) = IM(x[v]);
}
}
return RES_OK;
}
@ -260,11 +260,11 @@ int fft_dit(fft_t *pfft, int n, complex_t* y)
s = n>>1;
m = 1;
waddr = 0;
err = fft_bit_reverse(t1, t0, n, p2);
if(err!= RES_OK)
return err;
while(s)
{
dm = m<<1;
@ -284,9 +284,9 @@ int fft_dit(fft_t *pfft, int n, complex_t* y)
{
fft_dit_krn(t0, t0+m, w+waddr, m, y, y+m);
}
s >>= 1;
s >>= 1;
}
return RES_OK;
}
@ -298,7 +298,7 @@ int fft_dit(fft_t *pfft, int n, complex_t* y)
/*******************************************************************************
FFT decimation in time kernel
*******************************************************************************/
void fft_dit_krn(complex_t *x0, complex_t *x1, complex_t *w, int n,
void fft_dit_krn(complex_t *x0, complex_t *x1, complex_t *w, int n,
complex_t *y0, complex_t *y1)
{
int k;
@ -310,11 +310,11 @@ void fft_dit_krn(complex_t *x0, complex_t *x1, complex_t *w, int n,
RE(y0[k]) = RE(x0[k]) + RE(mul);
IM(y0[k]) = IM(x0[k]) + IM(mul);
RE(y1[k]) = RE(x0[k]) - RE(mul);
IM(y1[k]) = IM(x0[k]) - IM(mul);
}
}
}
@ -369,13 +369,13 @@ int DSPL_API fft_shift(double* x, int n, double* y)
int k;
double tmp;
double *buf;
if(!x || !y)
return ERROR_PTR;
if(n<1)
return ERROR_SIZE;
r = n%2;
if(!r)
{
@ -385,7 +385,7 @@ int DSPL_API fft_shift(double* x, int n, double* y)
tmp = x[k];
y[k] = x[k+n2];
y[k+n2] = tmp;
}
}
}
else
{
@ -395,28 +395,28 @@ int DSPL_API fft_shift(double* x, int n, double* y)
memcpy(y, x+n2, (n2+1)*sizeof(double));
memcpy(y+n2+1, buf, n2*sizeof(double));
free(buf);
}
}
return RES_OK;
}
/**************************************************************************************************
/*******************************************************************************
FFT shifting for complex vector
***************************************************************************************************/
*******************************************************************************/
int DSPL_API fft_shift_cmplx(complex_t* x, int n, complex_t* y)
{
int n2, r;
int k;
complex_t tmp;
complex_t *buf;
if(!x || !y)
return ERROR_PTR;
if(n<1)
return ERROR_SIZE;
r = n%2;
if(!r)
{
@ -425,13 +425,13 @@ int DSPL_API fft_shift_cmplx(complex_t* x, int n, complex_t* y)
{
RE(tmp) = RE(x[k]);
IM(tmp) = IM(x[k]);
RE(y[k]) = RE(x[k+n2]);
IM(y[k]) = IM(x[k+n2]);
RE(y[k+n2]) = RE(tmp);
IM(y[k+n2]) = IM(tmp);
}
}
}
else
{
@ -441,14 +441,7 @@ int DSPL_API fft_shift_cmplx(complex_t* x, int n, complex_t* y)
memcpy(y, x+n2, (n2+1)*sizeof(complex_t));
memcpy(y+n2+1, buf, n2*sizeof(complex_t));
free(buf);
}
}
return RES_OK;
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -25,18 +25,18 @@
/**************************************************************************************************
/*******************************************************************************
Linspace array filling
***************************************************************************************************/
*******************************************************************************/
int DSPL_API linspace(double x0, double x1, int n, int type, double* x)
{
double dx;
int k;
if(n < 2)
return ERROR_SIZE;
if(!x)
return ERROR_PTR;
return ERROR_PTR;
switch (type)
{
@ -54,22 +54,22 @@ int DSPL_API linspace(double x0, double x1, int n, int type, double* x)
break;
default:
return ERROR_SYM_TYPE;
}
return RES_OK;
}
return RES_OK;
}
/**************************************************************************************************
/*******************************************************************************
Logspace array filling
***************************************************************************************************/
*******************************************************************************/
int DSPL_API logspace(double x0, double x1, int n, int type, double* x)
{
double mx, a, b;
int k;
if(n < 2)
return ERROR_SIZE;
if(!x)
@ -77,7 +77,7 @@ int DSPL_API logspace(double x0, double x1, int n, int type, double* x)
a = pow(10.0, x0);
b = pow(10.0, x1);
switch (type)
{
case DSPL_SYMMETRIC:
@ -94,12 +94,7 @@ int DSPL_API logspace(double x0, double x1, int n, int type, double* x)
break;
default:
return ERROR_SYM_TYPE;
}
return RES_OK;
}
return RES_OK;
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -19,8 +19,8 @@
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dspl.h"
@ -29,9 +29,9 @@
int DSPL_API fourier_series_dec(double* t, double* s, int nt, double period, int nw, double* w, complex_t* y)
{
int k, m;
double dw = M_2PI / period;
double dw = M_2PI / period;
complex_t e[2];
if(!t || !s || !w || !y)
return ERROR_PTR;
if(nt<1 || nw < 1)
@ -43,22 +43,22 @@ int DSPL_API fourier_series_dec(double* t, double* s, int nt, double period, int
for(k = 0; k < nw; k++)
{
w[k] = (k - nw/2) * dw;
w[k] = (k - nw/2) * dw;
RE(e[1]) = s[0] * cos(w[k] * t[0]);
IM(e[1]) = -s[0] * sin(w[k] * t[0]);
IM(e[1]) = -s[0] * sin(w[k] * t[0]);
for(m = 1; m < nt; m++)
{
RE(e[0]) = RE(e[1]);
IM(e[0]) = IM(e[1]);
IM(e[0]) = IM(e[1]);
RE(e[1]) = s[m] * cos(w[k] * t[m]);
IM(e[1]) = - s[m] * sin(w[k] * t[m]);
RE(y[k]) += 0.5 * (RE(e[0]) + RE(e[1])) * (t[m] - t[m-1]);
IM(y[k]) += 0.5 * (IM(e[0]) + IM(e[1])) * (t[m] - t[m-1]);
}
}
RE(y[k]) /= period;
IM(y[k]) /= period;
}
}
if(!(nw%2))
RE(y[0]) = RE(y[1]) = 0.0;
@ -72,29 +72,29 @@ int DSPL_API fourier_series_dec(double* t, double* s, int nt, double period, int
int DSPL_API fourier_series_rec(double* w, complex_t* s, int nw, double *t, int nt, complex_t* y)
{
int k, m;
complex_t e;
int k, m;
complex_t e;
if(!t || !s || !w || !y)
return ERROR_PTR;
if(nt<1 || nw < 1)
return ERROR_SIZE;
memset(y, 0, nt*sizeof(complex_t));
for(k = 0; k < nw; k++)
{
for(m = 1; m < nt; m++)
for(m = 0; m < nt; m++)
{
RE(e) = cos(w[k] * t[m]);
IM(e) = sin(w[k] * t[m]);
RE(y[k]) += CMRE(s[k], e);
IM(y[k]) += CMIM(s[k], e);
RE(y[m]) += CMRE(s[k], e);
IM(y[m]) += CMIM(s[k], e);
}
}
}
return RES_OK;
return RES_OK;
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of DSPL.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -24,10 +24,37 @@
#include "dspl.h"
/*******************************************************************************
module operator for double
*******************************************************************************/
double DSPL_API dmod (double x, double y)
{
if(y == 0.0)
return x;
return x - floor(x/y) * y;
if(y == 0.0)
return x;
return x - floor(x/y) * y;
}
/*******************************************************************************
sinc(x) = sin(pi*x)/(pi*x)
*******************************************************************************/
int DSPL_API sinc(double* x, int n, double* y)
{
int k;
if(!x || !y)
return ERROR_PTR;
if(n<1)
return ERROR_SIZE;
for(k = 0; k < n; k++)
y[k] = (x[k]==0.0) ? 1.0 : sin(M_PI*x[k])/(M_PI*x[k]);
return RES_OK;
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -20,8 +20,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dspl.h"
@ -29,32 +29,58 @@
/**************************************************************************************************
/*******************************************************************************
Rectangle pulse signal
***************************************************************************************************/
int DSPL_API signal_pimp(double* t, size_t n, double amp, double tau, double dt, double period, double* y)
*******************************************************************************/
int DSPL_API signal_pimp(double* t, size_t n, double amp,
double tau, double dt, double period, double* y)
{
int k;
double ll, lr, p2, tp;
if(!t || !y)
return ERROR_PTR;
if(n < 1)
return ERROR_SIZE;
if(tau < 0.0 || period < 0.0)
return ERROR_NEGATIVE;
int k;
double ll, lr, p2, tp;
ll = -0.5 * tau;
lr = 0.5 * tau;
p2 = period*0.5;
for(k = 0; k < n; k++)
{
tp = dmod(t[k] - dt + p2, period) - p2;
y[k] = (tp < ll || tp > lr) ? 0.0 : amp;
}
if(!t || !y)
return ERROR_PTR;
if(n < 1)
return ERROR_SIZE;
if(tau < 0.0 || period < 0.0)
return ERROR_NEGATIVE;
return RES_OK;
ll = -0.5 * tau;
lr = 0.5 * tau;
p2 = period*0.5;
for(k = 0; k < n; k++)
{
tp = dmod(t[k] - dt + p2, period) - p2;
y[k] = (tp < ll || tp > lr) ? 0.0 : amp;
}
return RES_OK;
}
/*******************************************************************************
Saw periodic signal
*******************************************************************************/
int DSPL_API signal_saw(double* t, size_t n, double amp,
double dt, double period, double* y)
{
int k;
double p2, tp;
if(!t || !y)
return ERROR_PTR;
if(n < 1)
return ERROR_SIZE;
if(period < 0.0)
return ERROR_NEGATIVE;
p2 = period*0.5;
for(k = 0; k < n; k++)
{
tp = dmod(t[k] - dt + p2, period) - p2;
y[k] = amp * tp;
}
return RES_OK;
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -73,11 +73,11 @@ p_dspl_info dspl_info ;
p_farrow_lagrange farrow_lagrange ;
p_farrow_spline farrow_spline ;
p_filter_iir filter_iir ;
p_filter_zp2ab filter_zp2ab ;
p_filter_zp2ab filter_zp2ab ;
p_fft fft ;
p_fft_cmplx fft_cmplx ;
p_fft_create fft_create ;
p_fft_free fft_free ;
p_fft_cmplx fft_cmplx ;
p_fft_create fft_create ;
p_fft_free fft_free ;
p_fft_shift fft_shift ;
p_fft_shift_cmplx fft_shift_cmplx ;
p_flipip flipip ;
@ -105,7 +105,9 @@ p_randu randu ;
p_ratcompos ratcompos ;
p_re2cmplx re2cmplx ;
p_signal_pimp signal_pimp ;
p_signal_saw signal_saw ;
p_sin_cmplx sin_cmplx ;
p_sinc sinc ;
p_sqrt_cmplx sqrt_cmplx ;
p_trapint trapint ;
p_trapint_cmplx trapint_cmplx ;
@ -143,14 +145,14 @@ void* dspl_load()
{
char* fname;
#ifdef WIN_OS
HINSTANCE handle;
HINSTANCE handle;
handle = LoadLibrary(TEXT("libdspl.dll"));
if (!handle)
{
printf("libdspl.dll loading ERROR!\n");
return NULL;
}
#endif //WIN_OS
#endif //WIN_OS
#ifdef LINUX_OS
@ -158,7 +160,7 @@ void* dspl_load()
void *handle;
// open the *.so
handle = dlopen ("./libdspl.so", RTLD_LAZY);
if (!handle)
if (!handle)
{
printf("libdspl.so loading ERROR!\n");
return NULL;
@ -235,7 +237,9 @@ void* dspl_load()
LOAD_FUNC(ratcompos);
LOAD_FUNC(re2cmplx);
LOAD_FUNC(signal_pimp);
LOAD_FUNC(signal_saw);
LOAD_FUNC(sin_cmplx);
LOAD_FUNC(sinc);
LOAD_FUNC(sqrt_cmplx);
LOAD_FUNC(trapint);
LOAD_FUNC(trapint_cmplx);
@ -244,26 +248,26 @@ void* dspl_load()
LOAD_FUNC(writetxt);
LOAD_FUNC(writetxt_3d);
LOAD_FUNC(writetxt_3dline);
#ifdef WIN_OS
return (void*)handle;
exit_label:
printf("function %s loading ERROR!\n", fname);
if(handle)
FreeLibrary(handle);
return NULL;
return NULL;
#endif //WIN_OS
#ifdef LINUX_OS
return handle;
return handle;
exit_label:
printf("function %s loading ERROR!\n", fname);
if(handle)
dlclose(handle);
return NULL;
#endif //LINUX_OS
return NULL;
#endif //LINUX_OS
}
@ -277,13 +281,10 @@ void dspl_free(void* handle)
#ifdef WIN_OS
FreeLibrary((HINSTANCE)handle);
#endif //WIN_OS
#ifdef LINUX_OS
dlclose(handle);
#endif //LINUX_OS
#endif //LINUX_OS
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -25,7 +25,7 @@
#include <math.h>
/* math const definition */
#ifndef M_PI
@ -34,10 +34,10 @@
#ifndef M_2PI
#define M_2PI 6.283185307179586476925286766559
#endif
typedef double complex_t[2];
typedef double complex_t[2];
@ -54,10 +54,10 @@ typedef struct
#define RE(x) (x[0])
#define IM(x) (x[1])
#define IM(x) (x[1])
#define SQR(x) ((x) * (x))
#define SQR(x) ((x) * (x))
#define ABSSQR(x) ((SQR(RE(x))) + (SQR(IM(x))))
#define ABS(x) sqrt((ABSSQR(x)))
@ -65,7 +65,7 @@ typedef struct
#define CMIM(a,b) ((RE(a)) * (IM(b)) + (IM(a)) * (RE(b)))
#define CMCONJRE(a, b) ((RE(a)) * (RE(b)) + (IM(a)) * (IM(b)))
#define CMCONJIM(a, b) ((IM(a)) * (RE(b)) - (RE(a)) * (IM(b)))
#define CMCONJIM(a, b) ((IM(a)) * (RE(b)) - (RE(a)) * (IM(b)))
@ -198,7 +198,7 @@ extern "C" {
#endif
//------------------------------------------------------------------------------
DECLARE_FUNC(int, acos_cmplx, complex_t*
COMMA int
@ -208,9 +208,9 @@ DECLARE_FUNC(int, asin_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, butter_ap, double
DECLARE_FUNC(int, butter_ap, double
COMMA int
COMMA double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, butter_ap_zp, int
@ -235,11 +235,11 @@ DECLARE_FUNC(int, cheby1_ap, double
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cheby1_ap_zp, int
COMMA double
COMMA complex_t*
COMMA int*
COMMA complex_t*
DECLARE_FUNC(int, cheby1_ap_zp, int
COMMA double
COMMA complex_t*
COMMA int*
COMMA complex_t*
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cheby2_ap, double rs
@ -249,54 +249,54 @@ DECLARE_FUNC(int, cheby2_ap, double rs
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cheby2_ap_zp, int
COMMA double
COMMA complex_t*
COMMA int*
COMMA complex_t*
COMMA complex_t*
COMMA int*
COMMA complex_t*
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cmplx2re, complex_t*
COMMA int
COMMA double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, concat, void*
COMMA size_t
COMMA void*
COMMA size_t
COMMA void*
COMMA size_t
COMMA void*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, conv, double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, conv, double*
COMMA int
COMMA double*
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, conv_cmplx, complex_t*
COMMA int
COMMA complex_t*
COMMA int
DECLARE_FUNC(int, conv_cmplx, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, conv_fft_cmplx, complex_t* a
COMMA int na
COMMA complex_t* b
COMMA int nb
COMMA int nb
COMMA fft_t* pfft
COMMA complex_t* c);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cos_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, cos_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, dft, double*
COMMA int
DECLARE_FUNC(int, dft, double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, dft_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, dft_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(double, dmod, double
DECLARE_FUNC(double, dmod, double
COMMA double);
//------------------------------------------------------------------------------
DECLARE_FUNC(void, dspl_info, void);
@ -319,7 +319,7 @@ DECLARE_FUNC(int, ellip_ap, double rp
//------------------------------------------------------------------------------
DECLARE_FUNC(int, ellip_ap_zp, int ord
COMMA double rp
COMMA double rs
COMMA double rs
COMMA complex_t* z
COMMA int* nz
COMMA complex_t* p
@ -376,57 +376,57 @@ DECLARE_FUNC(int, idft_cmplx, complex_t*
//------------------------------------------------------------------------------
DECLARE_FUNC(int, ifft_cmplx, complex_t*
COMMA int
COMMA fft_t*
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, farrow_lagrange, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
DECLARE_FUNC(int, farrow_lagrange, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, farrow_spline, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
DECLARE_FUNC(int, farrow_spline, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, filter_iir, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, filter_iir, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, filter_zp2ab, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA int
COMMA double*
DECLARE_FUNC(int, filter_zp2ab, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA int
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft, double*
COMMA int
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_cmplx, complex_t*
COMMA int
COMMA fft_t*
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_create, fft_t*
DECLARE_FUNC(int, fft_cmplx, complex_t*
COMMA int
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_create, fft_t*
COMMA int);
//------------------------------------------------------------------------------
DECLARE_FUNC(void, fft_free, fft_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_shift, double*
COMMA int n
DECLARE_FUNC(int, fft_shift, double*
COMMA int n
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_shift_cmplx, complex_t*
@ -439,43 +439,43 @@ DECLARE_FUNC(int, flipip, double*
DECLARE_FUNC(int, flipip_cmplx, complex_t*
COMMA int);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fourier_series_dec, double*
COMMA double*
COMMA int
COMMA double
COMMA int
COMMA double*
DECLARE_FUNC(int, fourier_series_dec, double*
COMMA double*
COMMA int
COMMA double
COMMA int
COMMA double*
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fourier_series_rec, double*
COMMA complex_t*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, freqs, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs_cmplx, double* b
COMMA double* a
COMMA int ord
COMMA int ord
COMMA complex_t* s
COMMA int n
COMMA complex_t* h);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs_resp, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA int
COMMA double*
COMMA double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA int
COMMA double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs2time, double*
@ -487,11 +487,11 @@ DECLARE_FUNC(int, freqs2time, double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqz, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, freqz, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, goertzel, double*
@ -502,14 +502,14 @@ DECLARE_FUNC(int, goertzel, double*
//------------------------------------------------------------------------------
DECLARE_FUNC(int, goertzel_cmplx, complex_t*
COMMA int
COMMA int*
COMMA int
COMMA int*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, linspace, double
COMMA double
COMMA int
COMMA int
COMMA int
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, log_cmplx, complex_t*
@ -524,7 +524,7 @@ DECLARE_FUNC(int, logspace, double
//------------------------------------------------------------------------------
DECLARE_FUNC(int, low2bp, double* b
COMMA double* a
COMMA int ord
COMMA int ord
COMMA double w0
COMMA double wpl
COMMA double wph
@ -547,41 +547,41 @@ DECLARE_FUNC(int, low2low, double* b
COMMA double* beta
COMMA double* alpha);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, poly_z2a_cmplx, complex_t*
COMMA int
COMMA int
DECLARE_FUNC(int, poly_z2a_cmplx, complex_t*
COMMA int
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, polyval, double*
COMMA int
COMMA double*
COMMA int
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, polyval_cmplx, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, randn, double*
COMMA int
COMMA double
DECLARE_FUNC(int, randn, double*
COMMA int
COMMA double
COMMA double);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, randu, double*
DECLARE_FUNC(int, randu, double*
COMMA int);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, ratcompos, double* b
COMMA double* a
COMMA int n
COMMA int n
COMMA double* c
COMMA double* d
COMMA int p
COMMA int p
COMMA double* beta
COMMA double* alpha);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, re2cmplx, double*
DECLARE_FUNC(int, re2cmplx, double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
@ -593,43 +593,54 @@ DECLARE_FUNC(int, signal_pimp, double*
COMMA double
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sin_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, signal_saw, double* t
COMMA size_t n
COMMA double amp
COMMA double dt
COMMA double period
COMMA double* y);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sin_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sqrt_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, sinc, double* x
COMMA int n
COMMA double* y);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sqrt_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, trapint, double*
COMMA double*
COMMA int
DECLARE_FUNC(int, trapint, double*
COMMA double*
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, trapint_cmplx, double*
DECLARE_FUNC(int, trapint_cmplx, double*
COMMA complex_t*
COMMA int
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, unwrap, double*
COMMA int
COMMA double
COMMA double
COMMA double);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, writebin, void*
COMMA int
COMMA int
COMMA int
COMMA int
COMMA char*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, writetxt, double*
COMMA double*
COMMA int
DECLARE_FUNC(int, writetxt, double*
COMMA double*
COMMA int
COMMA char*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, writetxt_3d, double* x
COMMA int nx
COMMA double* y
COMMA int ny
COMMA int ny
COMMA double* z
COMMA char* fn);
//------------------------------------------------------------------------------

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -73,11 +73,11 @@ p_dspl_info dspl_info ;
p_farrow_lagrange farrow_lagrange ;
p_farrow_spline farrow_spline ;
p_filter_iir filter_iir ;
p_filter_zp2ab filter_zp2ab ;
p_filter_zp2ab filter_zp2ab ;
p_fft fft ;
p_fft_cmplx fft_cmplx ;
p_fft_create fft_create ;
p_fft_free fft_free ;
p_fft_cmplx fft_cmplx ;
p_fft_create fft_create ;
p_fft_free fft_free ;
p_fft_shift fft_shift ;
p_fft_shift_cmplx fft_shift_cmplx ;
p_flipip flipip ;
@ -105,7 +105,9 @@ p_randu randu ;
p_ratcompos ratcompos ;
p_re2cmplx re2cmplx ;
p_signal_pimp signal_pimp ;
p_signal_saw signal_saw ;
p_sin_cmplx sin_cmplx ;
p_sinc sinc ;
p_sqrt_cmplx sqrt_cmplx ;
p_trapint trapint ;
p_trapint_cmplx trapint_cmplx ;
@ -143,14 +145,14 @@ void* dspl_load()
{
char* fname;
#ifdef WIN_OS
HINSTANCE handle;
HINSTANCE handle;
handle = LoadLibrary(TEXT("libdspl.dll"));
if (!handle)
{
printf("libdspl.dll loading ERROR!\n");
return NULL;
}
#endif //WIN_OS
#endif //WIN_OS
#ifdef LINUX_OS
@ -158,7 +160,7 @@ void* dspl_load()
void *handle;
// open the *.so
handle = dlopen ("./libdspl.so", RTLD_LAZY);
if (!handle)
if (!handle)
{
printf("libdspl.so loading ERROR!\n");
return NULL;
@ -235,7 +237,9 @@ void* dspl_load()
LOAD_FUNC(ratcompos);
LOAD_FUNC(re2cmplx);
LOAD_FUNC(signal_pimp);
LOAD_FUNC(signal_saw);
LOAD_FUNC(sin_cmplx);
LOAD_FUNC(sinc);
LOAD_FUNC(sqrt_cmplx);
LOAD_FUNC(trapint);
LOAD_FUNC(trapint_cmplx);
@ -244,26 +248,26 @@ void* dspl_load()
LOAD_FUNC(writetxt);
LOAD_FUNC(writetxt_3d);
LOAD_FUNC(writetxt_3dline);
#ifdef WIN_OS
return (void*)handle;
exit_label:
printf("function %s loading ERROR!\n", fname);
if(handle)
FreeLibrary(handle);
return NULL;
return NULL;
#endif //WIN_OS
#ifdef LINUX_OS
return handle;
return handle;
exit_label:
printf("function %s loading ERROR!\n", fname);
if(handle)
dlclose(handle);
return NULL;
#endif //LINUX_OS
return NULL;
#endif //LINUX_OS
}
@ -277,13 +281,10 @@ void dspl_free(void* handle)
#ifdef WIN_OS
FreeLibrary((HINSTANCE)handle);
#endif //WIN_OS
#ifdef LINUX_OS
dlclose(handle);
#endif //LINUX_OS
#endif //LINUX_OS
}

Wyświetl plik

@ -3,7 +3,7 @@
* Digital Signal Processing Library [http://dsplib.org]
*
* This file is part of libdspl-2.0.
*
*
* is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -25,7 +25,7 @@
#include <math.h>
/* math const definition */
#ifndef M_PI
@ -34,10 +34,10 @@
#ifndef M_2PI
#define M_2PI 6.283185307179586476925286766559
#endif
typedef double complex_t[2];
typedef double complex_t[2];
@ -54,10 +54,10 @@ typedef struct
#define RE(x) (x[0])
#define IM(x) (x[1])
#define IM(x) (x[1])
#define SQR(x) ((x) * (x))
#define SQR(x) ((x) * (x))
#define ABSSQR(x) ((SQR(RE(x))) + (SQR(IM(x))))
#define ABS(x) sqrt((ABSSQR(x)))
@ -65,7 +65,7 @@ typedef struct
#define CMIM(a,b) ((RE(a)) * (IM(b)) + (IM(a)) * (RE(b)))
#define CMCONJRE(a, b) ((RE(a)) * (RE(b)) + (IM(a)) * (IM(b)))
#define CMCONJIM(a, b) ((IM(a)) * (RE(b)) - (RE(a)) * (IM(b)))
#define CMCONJIM(a, b) ((IM(a)) * (RE(b)) - (RE(a)) * (IM(b)))
@ -198,7 +198,7 @@ extern "C" {
#endif
//------------------------------------------------------------------------------
DECLARE_FUNC(int, acos_cmplx, complex_t*
COMMA int
@ -208,9 +208,9 @@ DECLARE_FUNC(int, asin_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, butter_ap, double
DECLARE_FUNC(int, butter_ap, double
COMMA int
COMMA double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, butter_ap_zp, int
@ -235,11 +235,11 @@ DECLARE_FUNC(int, cheby1_ap, double
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cheby1_ap_zp, int
COMMA double
COMMA complex_t*
COMMA int*
COMMA complex_t*
DECLARE_FUNC(int, cheby1_ap_zp, int
COMMA double
COMMA complex_t*
COMMA int*
COMMA complex_t*
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cheby2_ap, double rs
@ -249,54 +249,54 @@ DECLARE_FUNC(int, cheby2_ap, double rs
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cheby2_ap_zp, int
COMMA double
COMMA complex_t*
COMMA int*
COMMA complex_t*
COMMA complex_t*
COMMA int*
COMMA complex_t*
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cmplx2re, complex_t*
COMMA int
COMMA double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, concat, void*
COMMA size_t
COMMA void*
COMMA size_t
COMMA void*
COMMA size_t
COMMA void*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, conv, double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, conv, double*
COMMA int
COMMA double*
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, conv_cmplx, complex_t*
COMMA int
COMMA complex_t*
COMMA int
DECLARE_FUNC(int, conv_cmplx, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, conv_fft_cmplx, complex_t* a
COMMA int na
COMMA complex_t* b
COMMA int nb
COMMA int nb
COMMA fft_t* pfft
COMMA complex_t* c);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, cos_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, cos_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, dft, double*
COMMA int
DECLARE_FUNC(int, dft, double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, dft_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, dft_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(double, dmod, double
DECLARE_FUNC(double, dmod, double
COMMA double);
//------------------------------------------------------------------------------
DECLARE_FUNC(void, dspl_info, void);
@ -319,7 +319,7 @@ DECLARE_FUNC(int, ellip_ap, double rp
//------------------------------------------------------------------------------
DECLARE_FUNC(int, ellip_ap_zp, int ord
COMMA double rp
COMMA double rs
COMMA double rs
COMMA complex_t* z
COMMA int* nz
COMMA complex_t* p
@ -376,57 +376,57 @@ DECLARE_FUNC(int, idft_cmplx, complex_t*
//------------------------------------------------------------------------------
DECLARE_FUNC(int, ifft_cmplx, complex_t*
COMMA int
COMMA fft_t*
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, farrow_lagrange, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
DECLARE_FUNC(int, farrow_lagrange, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, farrow_spline, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
DECLARE_FUNC(int, farrow_spline, double*
COMMA int
COMMA double
COMMA double
COMMA double
COMMA double**
COMMA int*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, filter_iir, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, filter_iir, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, filter_zp2ab, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA int
COMMA double*
DECLARE_FUNC(int, filter_zp2ab, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA int
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft, double*
COMMA int
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_cmplx, complex_t*
COMMA int
COMMA fft_t*
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_create, fft_t*
DECLARE_FUNC(int, fft_cmplx, complex_t*
COMMA int
COMMA fft_t*
COMMA complex_t* );
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_create, fft_t*
COMMA int);
//------------------------------------------------------------------------------
DECLARE_FUNC(void, fft_free, fft_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_shift, double*
COMMA int n
DECLARE_FUNC(int, fft_shift, double*
COMMA int n
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fft_shift_cmplx, complex_t*
@ -439,43 +439,43 @@ DECLARE_FUNC(int, flipip, double*
DECLARE_FUNC(int, flipip_cmplx, complex_t*
COMMA int);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fourier_series_dec, double*
COMMA double*
COMMA int
COMMA double
COMMA int
COMMA double*
DECLARE_FUNC(int, fourier_series_dec, double*
COMMA double*
COMMA int
COMMA double
COMMA int
COMMA double*
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, fourier_series_rec, double*
COMMA complex_t*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, freqs, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs_cmplx, double* b
COMMA double* a
COMMA int ord
COMMA int ord
COMMA complex_t* s
COMMA int n
COMMA complex_t* h);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs_resp, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA int
COMMA double*
COMMA double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA int
COMMA double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqs2time, double*
@ -487,11 +487,11 @@ DECLARE_FUNC(int, freqs2time, double*
COMMA double*
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, freqz, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
DECLARE_FUNC(int, freqz, double*
COMMA double*
COMMA int
COMMA double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, goertzel, double*
@ -502,14 +502,14 @@ DECLARE_FUNC(int, goertzel, double*
//------------------------------------------------------------------------------
DECLARE_FUNC(int, goertzel_cmplx, complex_t*
COMMA int
COMMA int*
COMMA int
COMMA int*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, linspace, double
COMMA double
COMMA int
COMMA int
COMMA int
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, log_cmplx, complex_t*
@ -524,7 +524,7 @@ DECLARE_FUNC(int, logspace, double
//------------------------------------------------------------------------------
DECLARE_FUNC(int, low2bp, double* b
COMMA double* a
COMMA int ord
COMMA int ord
COMMA double w0
COMMA double wpl
COMMA double wph
@ -547,41 +547,41 @@ DECLARE_FUNC(int, low2low, double* b
COMMA double* beta
COMMA double* alpha);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, poly_z2a_cmplx, complex_t*
COMMA int
COMMA int
DECLARE_FUNC(int, poly_z2a_cmplx, complex_t*
COMMA int
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, polyval, double*
COMMA int
COMMA double*
COMMA int
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, polyval_cmplx, complex_t*
COMMA int
COMMA complex_t*
COMMA int
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, randn, double*
COMMA int
COMMA double
DECLARE_FUNC(int, randn, double*
COMMA int
COMMA double
COMMA double);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, randu, double*
DECLARE_FUNC(int, randu, double*
COMMA int);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, ratcompos, double* b
COMMA double* a
COMMA int n
COMMA int n
COMMA double* c
COMMA double* d
COMMA int p
COMMA int p
COMMA double* beta
COMMA double* alpha);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, re2cmplx, double*
DECLARE_FUNC(int, re2cmplx, double*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
@ -593,43 +593,54 @@ DECLARE_FUNC(int, signal_pimp, double*
COMMA double
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sin_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, signal_saw, double* t
COMMA size_t n
COMMA double amp
COMMA double dt
COMMA double period
COMMA double* y);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sin_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sqrt_cmplx, complex_t*
COMMA int
DECLARE_FUNC(int, sinc, double* x
COMMA int n
COMMA double* y);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, sqrt_cmplx, complex_t*
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, trapint, double*
COMMA double*
COMMA int
DECLARE_FUNC(int, trapint, double*
COMMA double*
COMMA int
COMMA double*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, trapint_cmplx, double*
DECLARE_FUNC(int, trapint_cmplx, double*
COMMA complex_t*
COMMA int
COMMA int
COMMA complex_t*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, unwrap, double*
COMMA int
COMMA double
COMMA double
COMMA double);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, writebin, void*
COMMA int
COMMA int
COMMA int
COMMA int
COMMA char*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, writetxt, double*
COMMA double*
COMMA int
DECLARE_FUNC(int, writetxt, double*
COMMA double*
COMMA int
COMMA char*);
//------------------------------------------------------------------------------
DECLARE_FUNC(int, writetxt_3d, double* x
COMMA int nx
COMMA double* y
COMMA int ny
COMMA int ny
COMMA double* z
COMMA char* fn);
//------------------------------------------------------------------------------