Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4880269
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
221 KB
Subscribers
None
View Options
diff --git a/dereverbrate/dereveb_c/FFTImplementationCallback.cpp b/dereverbrate/dereveb_c/FFTImplementationCallback.cpp
index def8499..8e08b67 100644
--- a/dereverbrate/dereveb_c/FFTImplementationCallback.cpp
+++ b/dereverbrate/dereveb_c/FFTImplementationCallback.cpp
@@ -1,968 +1,968 @@
//
// File: FFTImplementationCallback.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "FFTImplementationCallback.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : const ::coder::array<double, 2U> &x
// int xoffInit
// ::coder::array<creal_T, 1U> &y
// int nrowsx
// int nRows
// int nfft
// const ::coder::array<creal_T, 1U> &wwc
// const ::coder::array<double, 2U> &costab
// const ::coder::array<double, 2U> &sintab
// const ::coder::array<double, 2U> &costabinv
// const ::coder::array<double, 2U> &sintabinv
// Return Type : void
//
namespace coder {
namespace internal {
void FFTImplementationCallback::doHalfLengthBluestein(
const ::coder::array<double, 2U> &x, int xoffInit,
::coder::array<creal_T, 1U> &y, int nrowsx, int nRows, int nfft,
const ::coder::array<creal_T, 1U> &wwc,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab,
const ::coder::array<double, 2U> &costabinv,
const ::coder::array<double, 2U> &sintabinv)
{
array<creal_T, 1U> fv;
array<creal_T, 1U> fy;
array<creal_T, 1U> reconVar1;
array<creal_T, 1U> reconVar2;
array<creal_T, 1U> ytmp;
array<double, 2U> b_costab;
array<double, 2U> b_sintab;
array<double, 2U> costab1q;
array<double, 2U> hcostabinv;
array<double, 2U> hsintab;
array<double, 2U> hsintabinv;
array<int, 2U> wrapIndex;
double b_temp_re_tmp;
double re_tmp;
double temp_im;
double temp_re;
double twid_im;
double twid_re;
double z_tmp;
int hnRows;
int i;
int iDelta2;
int ihi;
int istart;
int j;
int ju;
int k;
int nRowsD2;
int nd2;
int temp_re_tmp;
boolean_T tst;
hnRows = nRows / 2;
ytmp.set_size(hnRows);
if (hnRows > nrowsx) {
ytmp.set_size(hnRows);
for (iDelta2 = 0; iDelta2 < hnRows; iDelta2++) {
ytmp[iDelta2].re = 0.0;
ytmp[iDelta2].im = 0.0;
}
}
if ((x.size(0) & 1) == 0) {
tst = true;
ihi = x.size(0);
} else if (x.size(0) >= nRows) {
tst = true;
ihi = nRows;
} else {
tst = false;
ihi = x.size(0) - 1;
}
if (ihi > nRows) {
ihi = nRows;
}
nd2 = nRows << 1;
temp_im = 6.2831853071795862 / static_cast<double>(nd2);
j = nd2 / 2 / 2;
costab1q.set_size(1, j + 1);
costab1q[0] = 1.0;
nd2 = j / 2 - 1;
for (k = 0; k <= nd2; k++) {
costab1q[k + 1] = std::cos(temp_im * (static_cast<double>(k) + 1.0));
}
iDelta2 = nd2 + 2;
nd2 = j - 1;
for (k = iDelta2; k <= nd2; k++) {
costab1q[k] = std::sin(temp_im * static_cast<double>(j - k));
}
costab1q[j] = 0.0;
j = costab1q.size(1) - 1;
nd2 = (costab1q.size(1) - 1) << 1;
b_costab.set_size(1, nd2 + 1);
b_sintab.set_size(1, nd2 + 1);
b_costab[0] = 1.0;
b_sintab[0] = 0.0;
for (k = 0; k < j; k++) {
b_costab[k + 1] = costab1q[k + 1];
b_sintab[k + 1] = -costab1q[(j - k) - 1];
}
iDelta2 = costab1q.size(1);
for (k = iDelta2; k <= nd2; k++) {
b_costab[k] = -costab1q[nd2 - k];
b_sintab[k] = -costab1q[k - j];
}
nd2 = costab.size(1) / 2;
costab1q.set_size(1, nd2);
hsintab.set_size(1, nd2);
hcostabinv.set_size(1, nd2);
hsintabinv.set_size(1, nd2);
for (i = 0; i < nd2; i++) {
iDelta2 = ((i + 1) << 1) - 2;
costab1q[i] = costab[iDelta2];
hsintab[i] = sintab[iDelta2];
hcostabinv[i] = costabinv[iDelta2];
hsintabinv[i] = sintabinv[iDelta2];
}
reconVar1.set_size(hnRows);
reconVar2.set_size(hnRows);
wrapIndex.set_size(1, hnRows);
for (i = 0; i < hnRows; i++) {
iDelta2 = i << 1;
temp_im = b_sintab[iDelta2];
temp_re = b_costab[iDelta2];
reconVar1[i].re = temp_im + 1.0;
reconVar1[i].im = -temp_re;
reconVar2[i].re = 1.0 - temp_im;
reconVar2[i].im = temp_re;
if (i + 1 != 1) {
wrapIndex[i] = (hnRows - i) + 1;
} else {
wrapIndex[0] = 1;
}
}
z_tmp = static_cast<double>(ihi) / 2.0;
iDelta2 = static_cast<int>(z_tmp);
for (ju = 0; ju < iDelta2; ju++) {
temp_re_tmp = (hnRows + ju) - 1;
temp_re = wwc[temp_re_tmp].re;
temp_im = wwc[temp_re_tmp].im;
nd2 = xoffInit + (ju << 1);
twid_re = x[nd2];
twid_im = x[nd2 + 1];
ytmp[ju].re = temp_re * twid_re + temp_im * twid_im;
ytmp[ju].im = temp_re * twid_im - temp_im * twid_re;
}
if (!tst) {
temp_re_tmp = (hnRows + static_cast<int>(z_tmp)) - 1;
temp_re = wwc[temp_re_tmp].re;
temp_im = wwc[temp_re_tmp].im;
twid_re = x[xoffInit + (static_cast<int>(z_tmp) << 1)];
ytmp[static_cast<int>(z_tmp)].re = temp_re * twid_re + temp_im * 0.0;
ytmp[static_cast<int>(z_tmp)].im = temp_re * 0.0 - temp_im * twid_re;
if (static_cast<int>(z_tmp) + 2 <= hnRows) {
iDelta2 = static_cast<int>(static_cast<double>(ihi) / 2.0) + 2;
for (i = iDelta2; i <= hnRows; i++) {
ytmp[i - 1].re = 0.0;
ytmp[i - 1].im = 0.0;
}
}
} else if (static_cast<int>(z_tmp) + 1 <= hnRows) {
iDelta2 = static_cast<int>(static_cast<double>(ihi) / 2.0) + 1;
for (i = iDelta2; i <= hnRows; i++) {
ytmp[i - 1].re = 0.0;
ytmp[i - 1].im = 0.0;
}
}
z_tmp = static_cast<double>(nfft) / 2.0;
nd2 = static_cast<int>(z_tmp);
fy.set_size(nd2);
if (static_cast<int>(z_tmp) > ytmp.size(0)) {
fy.set_size(nd2);
for (iDelta2 = 0; iDelta2 < nd2; iDelta2++) {
fy[iDelta2].re = 0.0;
fy[iDelta2].im = 0.0;
}
}
ihi = ytmp.size(0);
istart = static_cast<int>(z_tmp);
if (ihi <= istart) {
istart = ihi;
}
iDelta2 = static_cast<int>(z_tmp) - 2;
nRowsD2 = static_cast<int>(z_tmp) / 2;
k = nRowsD2 / 2;
nd2 = 0;
ju = 0;
for (i = 0; i <= istart - 2; i++) {
fy[nd2] = ytmp[i];
j = static_cast<int>(z_tmp);
tst = true;
while (tst) {
j >>= 1;
ju ^= j;
tst = ((ju & j) == 0);
}
nd2 = ju;
}
fy[nd2] = ytmp[istart - 1];
if (static_cast<int>(z_tmp) > 1) {
for (i = 0; i <= iDelta2; i += 2) {
b_temp_re_tmp = fy[i + 1].re;
temp_re = fy[i + 1].im;
re_tmp = fy[i].re;
twid_re = fy[i].im;
fy[i + 1].re = re_tmp - b_temp_re_tmp;
fy[i + 1].im = twid_re - temp_re;
fy[i].re = re_tmp + b_temp_re_tmp;
fy[i].im = twid_re + temp_re;
}
}
nd2 = 2;
iDelta2 = 4;
ju = ((k - 1) << 2) + 1;
while (k > 0) {
for (i = 0; i < ju; i += iDelta2) {
temp_re_tmp = i + nd2;
temp_re = fy[temp_re_tmp].re;
temp_im = fy[temp_re_tmp].im;
fy[temp_re_tmp].re = fy[i].re - temp_re;
fy[temp_re_tmp].im = fy[i].im - temp_im;
fy[i].re = fy[i].re + temp_re;
fy[i].im = fy[i].im + temp_im;
}
istart = 1;
for (j = k; j < nRowsD2; j += k) {
twid_re = costab1q[j];
twid_im = hsintab[j];
i = istart;
ihi = istart + ju;
while (i < ihi) {
temp_re_tmp = i + nd2;
b_temp_re_tmp = fy[temp_re_tmp].im;
temp_im = fy[temp_re_tmp].re;
temp_re = twid_re * temp_im - twid_im * b_temp_re_tmp;
temp_im = twid_re * b_temp_re_tmp + twid_im * temp_im;
fy[temp_re_tmp].re = fy[i].re - temp_re;
fy[temp_re_tmp].im = fy[i].im - temp_im;
fy[i].re = fy[i].re + temp_re;
fy[i].im = fy[i].im + temp_im;
i += iDelta2;
}
istart++;
}
k /= 2;
nd2 = iDelta2;
iDelta2 += iDelta2;
ju -= nd2;
}
FFTImplementationCallback::r2br_r2dit_trig_impl(wwc, static_cast<int>(z_tmp),
costab1q, hsintab, fv);
nd2 = fy.size(0);
for (iDelta2 = 0; iDelta2 < nd2; iDelta2++) {
re_tmp = fy[iDelta2].re;
twid_im = fv[iDelta2].im;
temp_im = fy[iDelta2].im;
temp_re = fv[iDelta2].re;
fy[iDelta2].re = re_tmp * temp_re - temp_im * twid_im;
fy[iDelta2].im = re_tmp * twid_im + temp_im * temp_re;
}
FFTImplementationCallback::r2br_r2dit_trig_impl(fy, static_cast<int>(z_tmp),
hcostabinv, hsintabinv, fv);
if (fv.size(0) > 1) {
temp_im = 1.0 / static_cast<double>(fv.size(0));
nd2 = fv.size(0);
for (iDelta2 = 0; iDelta2 < nd2; iDelta2++) {
fv[iDelta2].re = temp_im * fv[iDelta2].re;
fv[iDelta2].im = temp_im * fv[iDelta2].im;
}
}
iDelta2 = wwc.size(0);
for (k = hnRows; k <= iDelta2; k++) {
temp_im = wwc[k - 1].re;
temp_re = fv[k - 1].im;
twid_re = wwc[k - 1].im;
twid_im = fv[k - 1].re;
nd2 = k - hnRows;
ytmp[nd2].re = temp_im * twid_im + twid_re * temp_re;
ytmp[nd2].im = temp_im * temp_re - twid_re * twid_im;
}
for (i = 0; i < hnRows; i++) {
double ytmp_re_tmp;
iDelta2 = wrapIndex[i];
temp_im = ytmp[i].re;
temp_re = reconVar1[i].im;
twid_re = ytmp[i].im;
twid_im = reconVar1[i].re;
re_tmp = ytmp[iDelta2 - 1].re;
b_temp_re_tmp = -ytmp[iDelta2 - 1].im;
z_tmp = reconVar2[i].im;
ytmp_re_tmp = reconVar2[i].re;
y[i].re = 0.5 * ((temp_im * twid_im - twid_re * temp_re) +
(re_tmp * ytmp_re_tmp - b_temp_re_tmp * z_tmp));
y[i].im = 0.5 * ((temp_im * temp_re + twid_re * twid_im) +
(re_tmp * z_tmp + b_temp_re_tmp * ytmp_re_tmp));
iDelta2 = hnRows + i;
y[iDelta2].re = 0.5 * ((temp_im * ytmp_re_tmp - twid_re * z_tmp) +
(re_tmp * twid_im - b_temp_re_tmp * temp_re));
y[iDelta2].im = 0.5 * ((temp_im * z_tmp + twid_re * ytmp_re_tmp) +
(re_tmp * temp_re + b_temp_re_tmp * twid_im));
}
}
//
// Arguments : const ::coder::array<double, 2U> &x
// int xoffInit
// ::coder::array<creal_T, 1U> &y
// int unsigned_nRows
// const ::coder::array<double, 2U> &costab
// const ::coder::array<double, 2U> &sintab
// Return Type : void
//
void FFTImplementationCallback::doHalfLengthRadix2(
const ::coder::array<double, 2U> &x, int xoffInit,
::coder::array<creal_T, 1U> &y, int unsigned_nRows,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab)
{
array<creal_T, 1U> reconVar1;
array<creal_T, 1U> reconVar2;
array<double, 2U> hcostab;
array<double, 2U> hsintab;
array<int, 2U> wrapIndex;
array<int, 1U> bitrevIndex;
double b_y_re_tmp;
double c_y_re_tmp;
double d_y_re_tmp;
double temp2_im;
double temp2_re;
double temp_im;
double temp_im_tmp;
double temp_re;
double temp_re_tmp;
double y_re_tmp;
double z_tmp;
int hszCostab;
int i;
int istart;
int iy;
int j;
int ju;
int k;
int nRows;
int nRowsD2;
int nRowsM2;
boolean_T tst;
nRows = unsigned_nRows / 2;
j = y.size(0);
if (j > nRows) {
j = nRows;
}
nRowsM2 = nRows - 2;
nRowsD2 = nRows / 2;
k = nRowsD2 / 2;
hszCostab = costab.size(1) / 2;
hcostab.set_size(1, hszCostab);
hsintab.set_size(1, hszCostab);
for (i = 0; i < hszCostab; i++) {
iy = ((i + 1) << 1) - 2;
hcostab[i] = costab[iy];
hsintab[i] = sintab[iy];
}
reconVar1.set_size(nRows);
reconVar2.set_size(nRows);
wrapIndex.set_size(1, nRows);
for (i = 0; i < nRows; i++) {
temp_re = sintab[i];
temp2_re = costab[i];
reconVar1[i].re = temp_re + 1.0;
reconVar1[i].im = -temp2_re;
reconVar2[i].re = 1.0 - temp_re;
reconVar2[i].im = temp2_re;
if (i + 1 != 1) {
wrapIndex[i] = (nRows - i) + 1;
} else {
wrapIndex[0] = 1;
}
}
z_tmp = static_cast<double>(unsigned_nRows) / 2.0;
ju = 0;
iy = 1;
hszCostab = static_cast<int>(z_tmp);
bitrevIndex.set_size(hszCostab);
for (istart = 0; istart < hszCostab; istart++) {
bitrevIndex[istart] = 0;
}
for (istart = 0; istart <= j - 2; istart++) {
bitrevIndex[istart] = iy;
hszCostab = static_cast<int>(z_tmp);
tst = true;
while (tst) {
hszCostab >>= 1;
ju ^= hszCostab;
tst = ((ju & hszCostab) == 0);
}
iy = ju + 1;
}
bitrevIndex[j - 1] = iy;
if ((x.size(0) & 1) == 0) {
tst = true;
j = x.size(0);
} else if (x.size(0) >= unsigned_nRows) {
tst = true;
j = unsigned_nRows;
} else {
tst = false;
j = x.size(0) - 1;
}
if (j > unsigned_nRows) {
j = unsigned_nRows;
}
temp_re = static_cast<double>(j) / 2.0;
istart = static_cast<int>(temp_re);
for (i = 0; i < istart; i++) {
iy = xoffInit + (i << 1);
y[bitrevIndex[i] - 1].re = x[iy];
y[bitrevIndex[i] - 1].im = x[iy + 1];
}
if (!tst) {
istart = bitrevIndex[static_cast<int>(temp_re)] - 1;
y[istart].re = x[xoffInit + (static_cast<int>(temp_re) << 1)];
y[istart].im = 0.0;
}
if (nRows > 1) {
for (i = 0; i <= nRowsM2; i += 2) {
temp_re_tmp = y[i + 1].re;
temp_im_tmp = y[i + 1].im;
y[i + 1].re = y[i].re - temp_re_tmp;
y[i + 1].im = y[i].im - y[i + 1].im;
y[i].re = y[i].re + temp_re_tmp;
y[i].im = y[i].im + temp_im_tmp;
}
}
hszCostab = 2;
iy = 4;
ju = ((k - 1) << 2) + 1;
while (k > 0) {
for (i = 0; i < ju; i += iy) {
nRowsM2 = i + hszCostab;
temp_re = y[nRowsM2].re;
temp_im = y[nRowsM2].im;
y[nRowsM2].re = y[i].re - temp_re;
y[nRowsM2].im = y[i].im - temp_im;
y[i].re = y[i].re + temp_re;
y[i].im = y[i].im + temp_im;
}
istart = 1;
for (j = k; j < nRowsD2; j += k) {
temp2_re = hcostab[j];
temp2_im = hsintab[j];
i = istart;
nRows = istart + ju;
while (i < nRows) {
nRowsM2 = i + hszCostab;
temp_re_tmp = y[nRowsM2].im;
y_re_tmp = y[nRowsM2].re;
temp_re = temp2_re * y_re_tmp - temp2_im * temp_re_tmp;
temp_im = temp2_re * temp_re_tmp + temp2_im * y_re_tmp;
y[nRowsM2].re = y[i].re - temp_re;
y[nRowsM2].im = y[i].im - temp_im;
y[i].re = y[i].re + temp_re;
y[i].im = y[i].im + temp_im;
i += iy;
}
istart++;
}
k /= 2;
hszCostab = iy;
iy += iy;
ju -= hszCostab;
}
hszCostab = static_cast<int>(z_tmp) / 2;
temp_re_tmp = y[0].re;
temp_im_tmp = y[0].im;
y[0].re =
0.5 * ((temp_re_tmp * reconVar1[0].re - temp_im_tmp * reconVar1[0].im) +
(temp_re_tmp * reconVar2[0].re - -temp_im_tmp * reconVar2[0].im));
y[0].im =
0.5 * ((temp_re_tmp * reconVar1[0].im + temp_im_tmp * reconVar1[0].re) +
(temp_re_tmp * reconVar2[0].im + -temp_im_tmp * reconVar2[0].re));
y[static_cast<int>(z_tmp)].re =
0.5 * ((temp_re_tmp * reconVar2[0].re - temp_im_tmp * reconVar2[0].im) +
(temp_re_tmp * reconVar1[0].re - -temp_im_tmp * reconVar1[0].im));
y[static_cast<int>(z_tmp)].im =
0.5 * ((temp_re_tmp * reconVar2[0].im + temp_im_tmp * reconVar2[0].re) +
(temp_re_tmp * reconVar1[0].im + -temp_im_tmp * reconVar1[0].re));
for (i = 2; i <= hszCostab; i++) {
double temp2_im_tmp;
temp_re_tmp = y[i - 1].re;
temp_im_tmp = y[i - 1].im;
istart = wrapIndex[i - 1];
temp2_im = y[istart - 1].re;
temp2_im_tmp = y[istart - 1].im;
y_re_tmp = reconVar1[i - 1].im;
b_y_re_tmp = reconVar1[i - 1].re;
c_y_re_tmp = reconVar2[i - 1].im;
d_y_re_tmp = reconVar2[i - 1].re;
y[i - 1].re = 0.5 * ((temp_re_tmp * b_y_re_tmp - temp_im_tmp * y_re_tmp) +
(temp2_im * d_y_re_tmp - -temp2_im_tmp * c_y_re_tmp));
y[i - 1].im = 0.5 * ((temp_re_tmp * y_re_tmp + temp_im_tmp * b_y_re_tmp) +
(temp2_im * c_y_re_tmp + -temp2_im_tmp * d_y_re_tmp));
iy = (static_cast<int>(z_tmp) + i) - 1;
y[iy].re = 0.5 * ((temp_re_tmp * d_y_re_tmp - temp_im_tmp * c_y_re_tmp) +
(temp2_im * b_y_re_tmp - -temp2_im_tmp * y_re_tmp));
y[iy].im = 0.5 * ((temp_re_tmp * c_y_re_tmp + temp_im_tmp * d_y_re_tmp) +
(temp2_im * y_re_tmp + -temp2_im_tmp * b_y_re_tmp));
temp_im = reconVar1[istart - 1].im;
temp_re = reconVar1[istart - 1].re;
y_re_tmp = reconVar2[istart - 1].im;
temp2_re = reconVar2[istart - 1].re;
y[istart - 1].re =
0.5 * ((temp2_im * temp_re - temp2_im_tmp * temp_im) +
(temp_re_tmp * temp2_re - -temp_im_tmp * y_re_tmp));
y[istart - 1].im =
0.5 * ((temp2_im * temp_im + temp2_im_tmp * temp_re) +
(temp_re_tmp * y_re_tmp + -temp_im_tmp * temp2_re));
istart = (istart + static_cast<int>(z_tmp)) - 1;
y[istart].re = 0.5 * ((temp2_im * temp2_re - temp2_im_tmp * y_re_tmp) +
(temp_re_tmp * temp_re - -temp_im_tmp * temp_im));
y[istart].im = 0.5 * ((temp2_im * y_re_tmp + temp2_im_tmp * temp2_re) +
(temp_re_tmp * temp_im + -temp_im_tmp * temp_re));
}
temp_re_tmp = y[hszCostab].re;
temp_im_tmp = y[hszCostab].im;
y_re_tmp = reconVar1[hszCostab].im;
b_y_re_tmp = reconVar1[hszCostab].re;
c_y_re_tmp = reconVar2[hszCostab].im;
d_y_re_tmp = reconVar2[hszCostab].re;
temp_re = temp_re_tmp * d_y_re_tmp;
temp2_re = temp_re_tmp * b_y_re_tmp;
y[hszCostab].re = 0.5 * ((temp2_re - temp_im_tmp * y_re_tmp) +
(temp_re - -temp_im_tmp * c_y_re_tmp));
temp2_im = temp_re_tmp * c_y_re_tmp;
temp_im = temp_re_tmp * y_re_tmp;
y[hszCostab].im = 0.5 * ((temp_im + temp_im_tmp * b_y_re_tmp) +
(temp2_im + -temp_im_tmp * d_y_re_tmp));
istart = static_cast<int>(z_tmp) + hszCostab;
y[istart].re = 0.5 * ((temp_re - temp_im_tmp * c_y_re_tmp) +
(temp2_re - -temp_im_tmp * y_re_tmp));
y[istart].im = 0.5 * ((temp2_im + temp_im_tmp * d_y_re_tmp) +
(temp_im + -temp_im_tmp * b_y_re_tmp));
}
//
// Arguments : const ::coder::array<double, 2U> &x
// int n2blue
// int nfft
// const ::coder::array<double, 2U> &costab
// const ::coder::array<double, 2U> &sintab
// const ::coder::array<double, 2U> &sintabinv
// ::coder::array<creal_T, 2U> &y
// Return Type : void
//
void FFTImplementationCallback::dobluesteinfft(
const ::coder::array<double, 2U> &x, int n2blue, int nfft,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab,
const ::coder::array<double, 2U> &sintabinv, ::coder::array<creal_T, 2U> &y)
{
array<creal_T, 1U> b_fv;
array<creal_T, 1U> fv;
array<creal_T, 1U> r;
array<creal_T, 1U> wwc;
double b_re_tmp;
double c_re_tmp;
double d_re_tmp;
double re_tmp;
int b_k;
int b_y;
int i;
int i1;
int minNrowsNx;
int nInt2m1;
int u0;
int xoff;
if ((nfft & 1) == 0) {
int k;
int nInt2;
int nRows;
int rt;
nRows = nfft / 2;
nInt2m1 = (nRows + nRows) - 1;
wwc.set_size(nInt2m1);
rt = 0;
wwc[nRows - 1].re = 1.0;
wwc[nRows - 1].im = 0.0;
nInt2 = nRows << 1;
for (k = 0; k <= nRows - 2; k++) {
double nt_im;
double nt_re;
b_y = ((k + 1) << 1) - 1;
if (nInt2 - rt <= b_y) {
rt += b_y - nInt2;
} else {
rt += b_y;
}
nt_im = -3.1415926535897931 * static_cast<double>(rt) /
static_cast<double>(nRows);
if (nt_im == 0.0) {
nt_re = 1.0;
nt_im = 0.0;
} else {
nt_re = std::cos(nt_im);
nt_im = std::sin(nt_im);
}
i = (nRows - k) - 2;
wwc[i].re = nt_re;
wwc[i].im = -nt_im;
}
i = nInt2m1 - 1;
for (k = i; k >= nRows; k--) {
wwc[k] = wwc[(nInt2m1 - k) - 1];
}
} else {
int k;
int nInt2;
int rt;
nInt2m1 = (nfft + nfft) - 1;
wwc.set_size(nInt2m1);
rt = 0;
wwc[nfft - 1].re = 1.0;
wwc[nfft - 1].im = 0.0;
nInt2 = nfft << 1;
for (k = 0; k <= nfft - 2; k++) {
double nt_im;
double nt_re;
b_y = ((k + 1) << 1) - 1;
if (nInt2 - rt <= b_y) {
rt += b_y - nInt2;
} else {
rt += b_y;
}
nt_im = -3.1415926535897931 * static_cast<double>(rt) /
static_cast<double>(nfft);
if (nt_im == 0.0) {
nt_re = 1.0;
nt_im = 0.0;
} else {
nt_re = std::cos(nt_im);
nt_im = std::sin(nt_im);
}
i = (nfft - k) - 2;
wwc[i].re = nt_re;
wwc[i].im = -nt_im;
}
i = nInt2m1 - 1;
for (k = i; k >= nfft; k--) {
wwc[k] = wwc[(nInt2m1 - k) - 1];
}
}
nInt2m1 = x.size(0);
y.set_size(nfft, x.size(1));
if (nfft > x.size(0)) {
y.set_size(nfft, x.size(1));
b_y = nfft * x.size(1);
for (i = 0; i < b_y; i++) {
y[i].re = 0.0;
y[i].im = 0.0;
}
}
b_y = x.size(1) - 1;
#pragma omp parallel for num_threads(omp_get_max_threads()) private( \
fv, b_fv, r, xoff, i1, minNrowsNx, u0, b_k, re_tmp, b_re_tmp, c_re_tmp, \
d_re_tmp)
for (int chan = 0; chan <= b_y; chan++) {
xoff = chan * nInt2m1;
r.set_size(nfft);
if (nfft > x.size(0)) {
r.set_size(nfft);
for (i1 = 0; i1 < nfft; i1++) {
r[i1].re = 0.0;
r[i1].im = 0.0;
}
}
if ((n2blue != 1) && ((nfft & 1) == 0)) {
FFTImplementationCallback::doHalfLengthBluestein(
x, xoff, r, x.size(0), nfft, n2blue, wwc, costab, sintab, costab,
sintabinv);
} else {
minNrowsNx = x.size(0);
if (nfft <= minNrowsNx) {
minNrowsNx = nfft;
}
for (b_k = 0; b_k < minNrowsNx; b_k++) {
u0 = (nfft + b_k) - 1;
i1 = xoff + b_k;
r[b_k].re = wwc[u0].re * x[i1];
r[b_k].im = wwc[u0].im * -x[i1];
}
i1 = minNrowsNx + 1;
for (b_k = i1; b_k <= nfft; b_k++) {
r[b_k - 1].re = 0.0;
r[b_k - 1].im = 0.0;
}
FFTImplementationCallback::r2br_r2dit_trig_impl(r, n2blue, costab, sintab,
b_fv);
FFTImplementationCallback::r2br_r2dit_trig_impl(wwc, n2blue, costab,
sintab, fv);
fv.set_size(b_fv.size(0));
u0 = b_fv.size(0);
for (i1 = 0; i1 < u0; i1++) {
re_tmp = b_fv[i1].re;
b_re_tmp = fv[i1].im;
c_re_tmp = b_fv[i1].im;
d_re_tmp = fv[i1].re;
fv[i1].re = re_tmp * d_re_tmp - c_re_tmp * b_re_tmp;
fv[i1].im = re_tmp * b_re_tmp + c_re_tmp * d_re_tmp;
}
FFTImplementationCallback::r2br_r2dit_trig_impl(fv, n2blue, costab,
sintabinv, b_fv);
if (b_fv.size(0) > 1) {
re_tmp = 1.0 / static_cast<double>(b_fv.size(0));
u0 = b_fv.size(0);
for (i1 = 0; i1 < u0; i1++) {
b_fv[i1].re = re_tmp * b_fv[i1].re;
b_fv[i1].im = re_tmp * b_fv[i1].im;
}
}
i1 = wwc.size(0);
for (b_k = nfft; b_k <= i1; b_k++) {
re_tmp = wwc[b_k - 1].re;
b_re_tmp = b_fv[b_k - 1].im;
c_re_tmp = wwc[b_k - 1].im;
d_re_tmp = b_fv[b_k - 1].re;
u0 = b_k - nfft;
r[u0].re = re_tmp * d_re_tmp + c_re_tmp * b_re_tmp;
r[u0].im = re_tmp * b_re_tmp - c_re_tmp * d_re_tmp;
}
}
u0 = r.size(0);
for (i1 = 0; i1 < u0; i1++) {
y[i1 + y.size(0) * chan] = r[i1];
}
}
}
//
// Arguments : int nfft
// boolean_T useRadix2
// int *n2blue
// int *nRows
// Return Type : void
//
void FFTImplementationCallback::get_algo_sizes(int nfft, boolean_T useRadix2,
int *n2blue, int *nRows)
{
*n2blue = 1;
if (useRadix2) {
*nRows = nfft;
} else {
if (nfft > 0) {
int n;
int pmax;
n = (nfft + nfft) - 1;
pmax = 31;
if (n <= 1) {
pmax = 0;
} else {
int pmin;
boolean_T exitg1;
pmin = 0;
exitg1 = false;
while ((!exitg1) && (pmax - pmin > 1)) {
int k;
int pow2p;
k = (pmin + pmax) >> 1;
pow2p = 1 << k;
if (pow2p == n) {
pmax = k;
exitg1 = true;
} else if (pow2p > n) {
pmax = k;
} else {
pmin = k;
}
}
}
*n2blue = 1 << pmax;
}
*nRows = *n2blue;
}
}
//
// Arguments : const ::coder::array<double, 2U> &x
// int n1_unsigned
// const ::coder::array<double, 2U> &costab
// const ::coder::array<double, 2U> &sintab
// ::coder::array<creal_T, 2U> &y
// Return Type : void
//
void FFTImplementationCallback::r2br_r2dit_trig(
const ::coder::array<double, 2U> &x, int n1_unsigned,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab, ::coder::array<creal_T, 2U> &y)
{
array<creal_T, 1U> r;
int i1;
int loop_ub;
int nrows;
int xoff;
nrows = x.size(0);
y.set_size(n1_unsigned, x.size(1));
if (n1_unsigned > x.size(0)) {
y.set_size(n1_unsigned, x.size(1));
loop_ub = n1_unsigned * x.size(1);
for (int i{0}; i < loop_ub; i++) {
y[i].re = 0.0;
y[i].im = 0.0;
}
}
loop_ub = x.size(1) - 1;
#pragma omp parallel for num_threads(omp_get_max_threads()) private(r, xoff, i1)
for (int chan = 0; chan <= loop_ub; chan++) {
xoff = chan * nrows;
r.set_size(n1_unsigned);
if (n1_unsigned > x.size(0)) {
r.set_size(n1_unsigned);
for (i1 = 0; i1 < n1_unsigned; i1++) {
r[i1].re = 0.0;
r[i1].im = 0.0;
}
}
FFTImplementationCallback::doHalfLengthRadix2(x, xoff, r, n1_unsigned,
costab, sintab);
xoff = r.size(0);
for (i1 = 0; i1 < xoff; i1++) {
y[i1 + y.size(0) * chan] = r[i1];
}
}
}
//
// Arguments : const ::coder::array<creal_T, 1U> &x
// int unsigned_nRows
// const ::coder::array<double, 2U> &costab
// const ::coder::array<double, 2U> &sintab
// ::coder::array<creal_T, 1U> &y
// Return Type : void
//
void FFTImplementationCallback::r2br_r2dit_trig_impl(
const ::coder::array<creal_T, 1U> &x, int unsigned_nRows,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab, ::coder::array<creal_T, 1U> &y)
{
double temp_im;
double temp_re;
double temp_re_tmp;
double twid_re;
int i;
int iDelta2;
int iheight;
int iy;
int ju;
int k;
int nRowsD2;
y.set_size(unsigned_nRows);
if (unsigned_nRows > x.size(0)) {
y.set_size(unsigned_nRows);
for (iy = 0; iy < unsigned_nRows; iy++) {
y[iy].re = 0.0;
y[iy].im = 0.0;
}
}
iDelta2 = x.size(0);
if (iDelta2 > unsigned_nRows) {
iDelta2 = unsigned_nRows;
}
iheight = unsigned_nRows - 2;
nRowsD2 = unsigned_nRows / 2;
k = nRowsD2 / 2;
iy = 0;
ju = 0;
for (i = 0; i <= iDelta2 - 2; i++) {
boolean_T tst;
y[iy] = x[i];
iy = unsigned_nRows;
tst = true;
while (tst) {
iy >>= 1;
ju ^= iy;
tst = ((ju & iy) == 0);
}
iy = ju;
}
y[iy] = x[iDelta2 - 1];
if (unsigned_nRows > 1) {
for (i = 0; i <= iheight; i += 2) {
temp_re_tmp = y[i + 1].re;
temp_im = y[i + 1].im;
temp_re = y[i].re;
twid_re = y[i].im;
y[i + 1].re = temp_re - temp_re_tmp;
y[i + 1].im = twid_re - temp_im;
y[i].re = temp_re + temp_re_tmp;
y[i].im = twid_re + temp_im;
}
}
iy = 2;
iDelta2 = 4;
iheight = ((k - 1) << 2) + 1;
while (k > 0) {
int b_temp_re_tmp;
for (i = 0; i < iheight; i += iDelta2) {
b_temp_re_tmp = i + iy;
temp_re = y[b_temp_re_tmp].re;
temp_im = y[b_temp_re_tmp].im;
y[b_temp_re_tmp].re = y[i].re - temp_re;
y[b_temp_re_tmp].im = y[i].im - temp_im;
y[i].re = y[i].re + temp_re;
y[i].im = y[i].im + temp_im;
}
ju = 1;
for (int j{k}; j < nRowsD2; j += k) {
double twid_im;
int ihi;
twid_re = costab[j];
twid_im = sintab[j];
i = ju;
ihi = ju + iheight;
while (i < ihi) {
b_temp_re_tmp = i + iy;
temp_re_tmp = y[b_temp_re_tmp].im;
temp_im = y[b_temp_re_tmp].re;
temp_re = twid_re * temp_im - twid_im * temp_re_tmp;
temp_im = twid_re * temp_re_tmp + twid_im * temp_im;
y[b_temp_re_tmp].re = y[i].re - temp_re;
y[b_temp_re_tmp].im = y[i].im - temp_im;
y[i].re = y[i].re + temp_re;
y[i].im = y[i].im + temp_im;
i += iDelta2;
}
ju++;
}
k /= 2;
iy = iDelta2;
iDelta2 += iDelta2;
iheight -= iy;
}
}
} // namespace internal
} // namespace coder
//
// File trailer for FFTImplementationCallback.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/FFTImplementationCallback.h b/dereverbrate/dereveb_c/FFTImplementationCallback.h
index 2abb496..7ef16d8 100644
--- a/dereverbrate/dereveb_c/FFTImplementationCallback.h
+++ b/dereverbrate/dereveb_c/FFTImplementationCallback.h
@@ -1,65 +1,65 @@
//
// File: FFTImplementationCallback.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef FFTIMPLEMENTATIONCALLBACK_H
#define FFTIMPLEMENTATIONCALLBACK_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Type Definitions
namespace coder {
namespace internal {
class FFTImplementationCallback {
public:
static void get_algo_sizes(int nfft, boolean_T useRadix2, int *n2blue,
int *nRows);
static void r2br_r2dit_trig(const ::coder::array<double, 2U> &x,
int n1_unsigned,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab,
::coder::array<creal_T, 2U> &y);
static void dobluesteinfft(const ::coder::array<double, 2U> &x, int n2blue,
int nfft, const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab,
const ::coder::array<double, 2U> &sintabinv,
::coder::array<creal_T, 2U> &y);
static void r2br_r2dit_trig_impl(const ::coder::array<creal_T, 1U> &x,
int unsigned_nRows,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab,
::coder::array<creal_T, 1U> &y);
protected:
static void doHalfLengthRadix2(const ::coder::array<double, 2U> &x,
int xoffInit, ::coder::array<creal_T, 1U> &y,
int unsigned_nRows,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab);
static void
doHalfLengthBluestein(const ::coder::array<double, 2U> &x, int xoffInit,
::coder::array<creal_T, 1U> &y, int nrowsx, int nRows,
int nfft, const ::coder::array<creal_T, 1U> &wwc,
const ::coder::array<double, 2U> &costab,
const ::coder::array<double, 2U> &sintab,
const ::coder::array<double, 2U> &costabinv,
const ::coder::array<double, 2U> &sintabinv);
};
} // namespace internal
} // namespace coder
#endif
//
// File trailer for FFTImplementationCallback.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/OverflowLimit.cpp b/dereverbrate/dereveb_c/OverflowLimit.cpp
new file mode 100644
index 0000000..cd46714
--- /dev/null
+++ b/dereverbrate/dereveb_c/OverflowLimit.cpp
@@ -0,0 +1,94 @@
+//
+// File: OverflowLimit.cpp
+//
+// MATLAB Coder version : 5.3
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
+//
+
+// Include Files
+#include "OverflowLimit.h"
+#include "rt_nonfinite.h"
+#include <cmath>
+
+// Function Definitions
+//
+// Arguments : const double inputAudios1[220500]
+// double mix_out[220500]
+// Return Type : void
+//
+void OverflowLimit(const double inputAudios1[220500], double mix_out[220500])
+{
+ static double varargin_1[220500];
+ double MAX;
+ double f;
+ int MIN;
+ int idx;
+ int k;
+ for (k = 0; k < 220500; k++) {
+ varargin_1[k] = std::abs(inputAudios1[k]);
+ }
+ if (!std::isnan(varargin_1[0])) {
+ idx = 1;
+ } else {
+ boolean_T exitg1;
+ idx = 0;
+ k = 2;
+ exitg1 = false;
+ while ((!exitg1) && (k < 220501)) {
+ if (!std::isnan(varargin_1[k - 1])) {
+ idx = k;
+ exitg1 = true;
+ } else {
+ k++;
+ }
+ }
+ }
+ if (idx == 0) {
+ MAX = varargin_1[0];
+ } else {
+ MAX = varargin_1[idx - 1];
+ MIN = idx + 1;
+ for (k = MIN; k < 220501; k++) {
+ f = varargin_1[k - 1];
+ if (MAX < f) {
+ MAX = f;
+ }
+ }
+ }
+ if (MAX > 1.0) {
+ MAX = 32767.0;
+ MIN = -32768;
+ } else {
+ MAX = 0.9999;
+ MIN = -1;
+ }
+ f = 1.0;
+ // 不存在溢出,一直是1
+ // SETPSIZE 为f的变化步长,通常的取值为(1-f)/VALUE,此处取SETPSIZE 为 32
+ // VALUE值可以取 8, 16, 32,64,128.
+ // 32;
+ for (idx = 0; idx < 220500; idx++) {
+ double mixVal;
+ mixVal = inputAudios1[idx] * f;
+ if (mixVal > MAX) {
+ f = MAX / mixVal;
+ //
+ mixVal = MAX;
+ }
+ if (mixVal < MIN) {
+ f = static_cast<double>(MIN) / mixVal;
+ mixVal = MIN;
+ }
+ if (f < 1.0) {
+ f += (1.0 - f) / 128.0;
+ // 每次缩放以后就逐渐回归
+ }
+ mix_out[idx] = mixVal;
+ }
+}
+
+//
+// File trailer for OverflowLimit.cpp
+//
+// [EOF]
+//
diff --git a/dereverbrate/dereveb_c/OverflowLimit.h b/dereverbrate/dereveb_c/OverflowLimit.h
new file mode 100644
index 0000000..81a4903
--- /dev/null
+++ b/dereverbrate/dereveb_c/OverflowLimit.h
@@ -0,0 +1,25 @@
+//
+// File: OverflowLimit.h
+//
+// MATLAB Coder version : 5.3
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
+//
+
+#ifndef OVERFLOWLIMIT_H
+#define OVERFLOWLIMIT_H
+
+// Include Files
+#include "rtwtypes.h"
+#include "omp.h"
+#include <cstddef>
+#include <cstdlib>
+
+// Function Declarations
+void OverflowLimit(const double inputAudios1[220500], double mix_out[220500]);
+
+#endif
+//
+// File trailer for OverflowLimit.h
+//
+// [EOF]
+//
diff --git a/dereverbrate/dereveb_c/codedescriptor.dmr b/dereverbrate/dereveb_c/codedescriptor.dmr
index 137b03a..4fb2e5e 100644
Binary files a/dereverbrate/dereveb_c/codedescriptor.dmr and b/dereverbrate/dereveb_c/codedescriptor.dmr differ
diff --git a/dereverbrate/dereveb_c/computeDFT.cpp b/dereverbrate/dereveb_c/computeDFT.cpp
index 3cb20de..ec21b22 100644
--- a/dereverbrate/dereveb_c/computeDFT.cpp
+++ b/dereverbrate/dereveb_c/computeDFT.cpp
@@ -1,252 +1,252 @@
//
// File: computeDFT.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "computeDFT.h"
#include "FFTImplementationCallback.h"
#include "dereveb_c_rtwutil.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Declarations
static int div_s32(int numerator, int denominator);
// Function Definitions
//
// Arguments : int numerator
// int denominator
// Return Type : int
//
static int div_s32(int numerator, int denominator)
{
int quotient;
if (denominator == 0) {
if (numerator >= 0) {
quotient = MAX_int32_T;
} else {
quotient = MIN_int32_T;
}
} else {
unsigned int b_denominator;
unsigned int b_numerator;
if (numerator < 0) {
b_numerator = ~static_cast<unsigned int>(numerator) + 1U;
} else {
b_numerator = static_cast<unsigned int>(numerator);
}
if (denominator < 0) {
b_denominator = ~static_cast<unsigned int>(denominator) + 1U;
} else {
b_denominator = static_cast<unsigned int>(denominator);
}
b_numerator /= b_denominator;
if ((numerator < 0) != (denominator < 0)) {
quotient = -static_cast<int>(b_numerator);
} else {
quotient = static_cast<int>(b_numerator);
}
}
return quotient;
}
//
// Arguments : const ::coder::array<double, 2U> &xin
// double nfft
// ::coder::array<creal_T, 2U> &Xx
// ::coder::array<double, 1U> &f
// Return Type : void
//
namespace coder {
void computeDFT(const ::coder::array<double, 2U> &xin, double nfft,
::coder::array<creal_T, 2U> &Xx, ::coder::array<double, 1U> &f)
{
array<double, 2U> costab;
array<double, 2U> costab1q;
array<double, 2U> sintab;
array<double, 2U> sintabinv;
array<double, 2U> wrappedData;
array<double, 2U> xw;
double freq_res;
double half_res;
int b_remainder;
int i;
int i1;
int k;
int loop_ub_tmp;
int nFullPasses;
int offset;
loop_ub_tmp = static_cast<int>(nfft);
xw.set_size(loop_ub_tmp, xin.size(1));
offset = static_cast<int>(nfft) * xin.size(1);
for (i = 0; i < offset; i++) {
xw[i] = 0.0;
}
if (xin.size(0) > nfft) {
i = xin.size(1);
for (int j{0}; j < i; j++) {
if (xin.size(0) == 1) {
wrappedData.set_size(1, loop_ub_tmp);
for (i1 = 0; i1 < loop_ub_tmp; i1++) {
wrappedData[i1] = 0.0;
}
} else {
wrappedData.set_size(loop_ub_tmp, 1);
for (i1 = 0; i1 < loop_ub_tmp; i1++) {
wrappedData[i1] = 0.0;
}
}
nFullPasses = div_s32(xin.size(0), static_cast<int>(nfft));
offset = nFullPasses * static_cast<int>(nfft);
b_remainder = (xin.size(0) - offset) - 1;
for (k = 0; k <= b_remainder; k++) {
wrappedData[k] = xin[(offset + k) + xin.size(0) * j];
}
i1 = b_remainder + 2;
for (k = i1; k <= loop_ub_tmp; k++) {
wrappedData[k - 1] = 0.0;
}
for (b_remainder = 0; b_remainder < nFullPasses; b_remainder++) {
offset = b_remainder * static_cast<int>(nfft);
for (k = 0; k < loop_ub_tmp; k++) {
wrappedData[k] = wrappedData[k] + xin[(offset + k) + xin.size(0) * j];
}
}
offset = wrappedData.size(0) * wrappedData.size(1);
for (i1 = 0; i1 < offset; i1++) {
xw[i1 + xw.size(0) * j] = wrappedData[i1];
}
}
} else {
xw.set_size(xin.size(0), xin.size(1));
offset = xin.size(0) * xin.size(1);
for (i = 0; i < offset; i++) {
xw[i] = xin[i];
}
}
if ((xw.size(0) == 0) || (xw.size(1) == 0)) {
Xx.set_size(loop_ub_tmp, xw.size(1));
offset = static_cast<int>(nfft) * xw.size(1);
for (i = 0; i < offset; i++) {
Xx[i].re = 0.0;
Xx[i].im = 0.0;
}
} else {
boolean_T useRadix2;
useRadix2 =
((static_cast<int>(nfft) > 0) &&
((static_cast<int>(nfft) & (static_cast<int>(nfft) - 1)) == 0));
internal::FFTImplementationCallback::get_algo_sizes(
static_cast<int>(nfft), useRadix2, &nFullPasses, &offset);
freq_res = 6.2831853071795862 / static_cast<double>(offset);
b_remainder = offset / 2 / 2;
costab1q.set_size(1, b_remainder + 1);
costab1q[0] = 1.0;
offset = b_remainder / 2 - 1;
for (k = 0; k <= offset; k++) {
costab1q[k + 1] = std::cos(freq_res * (static_cast<double>(k) + 1.0));
}
i = offset + 2;
i1 = b_remainder - 1;
for (k = i; k <= i1; k++) {
costab1q[k] = std::sin(freq_res * static_cast<double>(b_remainder - k));
}
costab1q[b_remainder] = 0.0;
if (!useRadix2) {
b_remainder = costab1q.size(1) - 1;
offset = (costab1q.size(1) - 1) << 1;
costab.set_size(1, offset + 1);
sintab.set_size(1, offset + 1);
costab[0] = 1.0;
sintab[0] = 0.0;
sintabinv.set_size(1, offset + 1);
for (k = 0; k < b_remainder; k++) {
sintabinv[k + 1] = costab1q[(b_remainder - k) - 1];
}
i = costab1q.size(1);
for (k = i; k <= offset; k++) {
sintabinv[k] = costab1q[k - b_remainder];
}
for (k = 0; k < b_remainder; k++) {
costab[k + 1] = costab1q[k + 1];
sintab[k + 1] = -costab1q[(b_remainder - k) - 1];
}
i = costab1q.size(1);
for (k = i; k <= offset; k++) {
costab[k] = -costab1q[offset - k];
sintab[k] = -costab1q[k - b_remainder];
}
} else {
b_remainder = costab1q.size(1) - 1;
offset = (costab1q.size(1) - 1) << 1;
costab.set_size(1, offset + 1);
sintab.set_size(1, offset + 1);
costab[0] = 1.0;
sintab[0] = 0.0;
for (k = 0; k < b_remainder; k++) {
costab[k + 1] = costab1q[k + 1];
sintab[k + 1] = -costab1q[(b_remainder - k) - 1];
}
i = costab1q.size(1);
for (k = i; k <= offset; k++) {
costab[k] = -costab1q[offset - k];
sintab[k] = -costab1q[k - b_remainder];
}
sintabinv.set_size(1, 0);
}
if (useRadix2) {
internal::FFTImplementationCallback::r2br_r2dit_trig(
xw, static_cast<int>(nfft), costab, sintab, Xx);
} else {
internal::FFTImplementationCallback::dobluesteinfft(
xw, nFullPasses, static_cast<int>(nfft), costab, sintab, sintabinv,
Xx);
}
}
freq_res = 6.2831853071795862 / nfft;
if (nfft - 1.0 < 0.0) {
costab1q.set_size(costab1q.size(0), 0);
} else if (std::isinf(nfft - 1.0) && (0.0 == nfft - 1.0)) {
costab1q.set_size(1, 1);
costab1q[0] = rtNaN;
} else {
offset = static_cast<int>(std::floor(nfft - 1.0));
costab1q.set_size(1, offset + 1);
for (i = 0; i <= offset; i++) {
costab1q[i] = i;
}
}
costab1q.set_size(1, costab1q.size(1));
offset = costab1q.size(1) - 1;
for (i = 0; i <= offset; i++) {
costab1q[i] = freq_res * costab1q[i];
}
half_res = freq_res / 2.0;
if (rt_remd_snf(nfft, 2.0) != 0.0) {
double halfNPTS;
halfNPTS = (nfft + 1.0) / 2.0;
costab1q[static_cast<int>(halfNPTS) - 1] = 3.1415926535897931 - half_res;
costab1q[static_cast<int>(static_cast<unsigned int>(halfNPTS))] =
half_res + 3.1415926535897931;
} else {
costab1q[static_cast<int>(nfft / 2.0 + 1.0) - 1] = 3.1415926535897931;
}
costab1q[static_cast<int>(nfft) - 1] = 6.2831853071795862 - freq_res;
f.set_size(costab1q.size(1));
offset = costab1q.size(1);
for (i = 0; i < offset; i++) {
f[i] = costab1q[i];
}
}
} // namespace coder
//
// File trailer for computeDFT.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/computeDFT.h b/dereverbrate/dereveb_c/computeDFT.h
index f0bf894..5179abe 100644
--- a/dereverbrate/dereveb_c/computeDFT.h
+++ b/dereverbrate/dereveb_c/computeDFT.h
@@ -1,30 +1,30 @@
//
// File: computeDFT.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef COMPUTEDFT_H
#define COMPUTEDFT_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void computeDFT(const ::coder::array<double, 2U> &xin, double nfft,
::coder::array<creal_T, 2U> &Xx, ::coder::array<double, 1U> &f);
}
#endif
//
// File trailer for computeDFT.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c.cpp b/dereverbrate/dereveb_c/dereveb_c.cpp
index b4ad4bb..f20e9d9 100644
--- a/dereverbrate/dereveb_c/dereveb_c.cpp
+++ b/dereverbrate/dereveb_c/dereveb_c.cpp
@@ -1,1598 +1,1574 @@
//
// File: dereveb_c.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "dereveb_c.h"
+#include "OverflowLimit.h"
#include "dereveb_c_data.h"
#include "dereveb_c_initialize.h"
#include "div.h"
#include "hann.h"
#include "ifft.h"
#include "ixfun.h"
#include "minOrMax.h"
#include "ref.h"
#include "rt_nonfinite.h"
#include "spectrogram.h"
#include "sum.h"
#include "unsafeSxfun.h"
#include "coder_array.h"
+#include <algorithm>
#include <cmath>
#include <cstring>
// Function Declarations
static void b_binary_expand_op(coder::array<boolean_T, 1U> &unchanged,
const coder::array<double, 1U> &newEstimates,
const coder::array<double, 2U> &H_pow,
int blockIndex);
static void binary_expand_op(coder::array<double, 2U> &H_pow, int blockIndex,
const coder::array<creal_T, 2U> &M,
const coder::array<double, 2U> &C);
static void binary_expand_op(coder::array<creal_T, 1U> &vocal_reverb,
const coder::array<double, 1U> &G_R,
const coder::array<creal_T, 2U> &M,
int inputFrameIndex);
static void binary_expand_op(coder::array<double, 2U> &H_pow_sm,
const coder::array<double, 2U> &H_pow);
static void
binary_expand_op(coder::array<double, 1U> &newEstimates,
const coder::array<double, 2U> &previousSFramesPower_vc,
const coder::array<double, 2U> &H_pow_sm);
static void binary_expand_op(coder::array<double, 1U> &G_Rxx,
const coder::captured_var frequencyCount,
const coder::array<double, 1U> &G_Sxx);
-static void binary_expand_op(coder::array<creal_T, 1U> &bk_revertant,
+static void binary_expand_op(coder::array<creal_T, 1U> &G_R_vc,
const coder::array<double, 1U> &G_Rxx,
- const coder::array<creal_T, 2U> &M,
+ const coder::array<creal_T, 2U> &M_vc,
+ int inputFrameIndex,
+ const coder::array<creal_T, 1U> &vocal_reverb);
+
+static void binary_expand_op(coder::array<creal_T, 2U> &R_vc,
int inputFrameIndex,
- const coder::array<double, 1U> &r);
+ const coder::array<creal_T, 1U> &G_R_vc,
+ const coder::array<double, 1U> &y);
static void binary_expand_op(double output[220500],
const coder::array<int, 2U> &r,
const coder::array<double, 2U> &sampleRange,
const coder::array<double, 1U> &window,
const coder::array<double, 1U> &r1);
static void c_binary_expand_op(coder::array<double, 1U> &G_Sxx,
const coder::captured_var frequencyCount,
- const coder::array<double, 1U> &r1);
+ const coder::array<double, 1U> &y);
static void reconstruct(coder::captured_var *stftWindowSize,
coder::captured_var *frequencyCount,
coder::captured_var *frameCount,
const coder::array<creal_T, 2U> &spectrumx,
const coder::array<double, 1U> &window,
double overlapSamples, double output[220500]);
static double rt_hypotd_snf(double u0, double u1);
// Function Definitions
//
// Arguments : coder::array<boolean_T, 1U> &unchanged
// const coder::array<double, 1U> &newEstimates
// const coder::array<double, 2U> &H_pow
// int blockIndex
// Return Type : void
//
static void b_binary_expand_op(coder::array<boolean_T, 1U> &unchanged,
const coder::array<double, 1U> &newEstimates,
const coder::array<double, 2U> &H_pow,
int blockIndex)
{
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
i = H_pow.size(0);
if (i == 1) {
stride_0_0 = newEstimates.size(0);
} else {
stride_0_0 = i;
}
unchanged.set_size(stride_0_0);
stride_0_0 = (newEstimates.size(0) != 1);
stride_1_0 = (i != 1);
if (i == 1) {
loop_ub = newEstimates.size(0);
} else {
loop_ub = i;
}
for (i = 0; i < loop_ub; i++) {
unchanged[i] = (newEstimates[i * stride_0_0] >=
H_pow[i * stride_1_0 + H_pow.size(0) * blockIndex]);
}
}
//
// Arguments : coder::array<double, 2U> &H_pow
// int blockIndex
// const coder::array<creal_T, 2U> &M
// const coder::array<double, 2U> &C
// Return Type : void
//
static void binary_expand_op(coder::array<double, 2U> &H_pow, int blockIndex,
const coder::array<creal_T, 2U> &M,
const coder::array<double, 2U> &C)
{
coder::array<double, 1U> r;
int b_H_pow;
int i;
int i1;
int i2;
int i3;
int stride_1_0;
int stride_3_0;
b_H_pow = H_pow.size(0) - 1;
i = M.size(0);
i1 = M.size(0);
i2 = C.size(0);
if (i2 == 1) {
i3 = i1;
} else {
i3 = i2;
}
if (i3 == 1) {
if (b_H_pow + 1 == 1) {
i3 = i;
} else {
i3 = b_H_pow + 1;
}
} else if (i2 == 1) {
i3 = i1;
} else {
i3 = i2;
}
r.set_size(i3);
stride_1_0 = (b_H_pow + 1 != 1);
stride_3_0 = (i2 != 1);
if (i2 == 1) {
i3 = i1;
} else {
i3 = i2;
}
if (i3 == 1) {
if (b_H_pow + 1 == 1) {
b_H_pow = i;
} else {
b_H_pow++;
}
} else if (i2 == 1) {
b_H_pow = i1;
} else {
b_H_pow = i2;
}
for (i = 0; i < b_H_pow; i++) {
r[i] = 0.2 * H_pow[i * stride_1_0 + H_pow.size(0) * blockIndex] +
0.8 * C[i * stride_3_0 + C.size(0) * blockIndex];
}
b_H_pow = r.size(0);
for (i = 0; i < b_H_pow; i++) {
H_pow[i + H_pow.size(0) * blockIndex] = r[i];
}
}
//
// Arguments : coder::array<creal_T, 1U> &vocal_reverb
// const coder::array<double, 1U> &G_R
// const coder::array<creal_T, 2U> &M
// int inputFrameIndex
// Return Type : void
//
static void binary_expand_op(coder::array<creal_T, 1U> &vocal_reverb,
const coder::array<double, 1U> &G_R,
const coder::array<creal_T, 2U> &M,
int inputFrameIndex)
{
int i;
int i1;
int loop_ub;
int stride_0_0;
int stride_1_0;
i = M.size(0);
if (i == 1) {
i1 = G_R.size(0);
} else {
i1 = i;
}
vocal_reverb.set_size(i1);
stride_0_0 = (G_R.size(0) != 1);
stride_1_0 = (i != 1);
if (i == 1) {
loop_ub = G_R.size(0);
} else {
loop_ub = i;
}
for (i = 0; i < loop_ub; i++) {
double d;
i1 = i * stride_1_0;
d = G_R[i * stride_0_0];
vocal_reverb[i].re = d * M[i1 + M.size(0) * inputFrameIndex].re;
vocal_reverb[i].im = d * M[i1 + M.size(0) * inputFrameIndex].im;
}
}
//
// Arguments : coder::array<double, 2U> &H_pow_sm
// const coder::array<double, 2U> &H_pow
// Return Type : void
//
static void binary_expand_op(coder::array<double, 2U> &H_pow_sm,
const coder::array<double, 2U> &H_pow)
{
coder::array<double, 2U> r;
int i;
int i1;
int loop_ub;
int stride_0_0;
int stride_1_0;
if (H_pow.size(0) == 1) {
i = H_pow_sm.size(0);
} else {
i = H_pow.size(0);
}
r.set_size(i, 400);
stride_0_0 = (H_pow_sm.size(0) != 1);
stride_1_0 = (H_pow.size(0) != 1);
if (H_pow.size(0) == 1) {
loop_ub = H_pow_sm.size(0);
} else {
loop_ub = H_pow.size(0);
}
for (i = 0; i < 400; i++) {
for (i1 = 0; i1 < loop_ub; i1++) {
r[i1 + r.size(0) * i] =
- 0.95 * H_pow_sm[i1 * stride_0_0 + H_pow_sm.size(0) * i] +
- 0.05 * H_pow[i1 * stride_1_0 + H_pow.size(0) * i];
+ 0.5 * H_pow_sm[i1 * stride_0_0 + H_pow_sm.size(0) * i] +
+ 0.5 * H_pow[i1 * stride_1_0 + H_pow.size(0) * i];
}
}
H_pow_sm.set_size(r.size(0), 400);
loop_ub = r.size(0);
for (i = 0; i < 400; i++) {
for (i1 = 0; i1 < loop_ub; i1++) {
H_pow_sm[i1 + H_pow_sm.size(0) * i] = r[i1 + r.size(0) * i];
}
}
}
//
// Arguments : coder::array<double, 1U> &newEstimates
// const coder::array<double, 2U> &previousSFramesPower_vc
// const coder::array<double, 2U> &H_pow_sm
// Return Type : void
//
static void
binary_expand_op(coder::array<double, 1U> &newEstimates,
const coder::array<double, 2U> &previousSFramesPower_vc,
const coder::array<double, 2U> &H_pow_sm)
{
coder::array<double, 2U> b_previousSFramesPower_vc;
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
if (H_pow_sm.size(0) == 1) {
i = previousSFramesPower_vc.size(0);
} else {
i = H_pow_sm.size(0);
}
b_previousSFramesPower_vc.set_size(i, 400);
stride_0_0 = (previousSFramesPower_vc.size(0) != 1);
stride_1_0 = (H_pow_sm.size(0) != 1);
if (H_pow_sm.size(0) == 1) {
loop_ub = previousSFramesPower_vc.size(0);
} else {
loop_ub = H_pow_sm.size(0);
}
for (i = 0; i < 400; i++) {
for (int i1{0}; i1 < loop_ub; i1++) {
b_previousSFramesPower_vc[i1 + b_previousSFramesPower_vc.size(0) * i] =
previousSFramesPower_vc[i1 * stride_0_0 +
previousSFramesPower_vc.size(0) * i] *
H_pow_sm[i1 * stride_1_0 + H_pow_sm.size(0) * i];
}
}
coder::sum(b_previousSFramesPower_vc, newEstimates);
}
//
// Arguments : coder::array<double, 1U> &G_Rxx
// const coder::captured_var frequencyCount
// const coder::array<double, 1U> &G_Sxx
// Return Type : void
//
static void binary_expand_op(coder::array<double, 1U> &G_Rxx,
const coder::captured_var frequencyCount,
const coder::array<double, 1U> &G_Sxx)
{
coder::array<double, 1U> r;
int i;
int loop_ub;
int stride_1_0;
int stride_3_0;
if (G_Sxx.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
i = G_Sxx.size(0);
}
if (i == 1) {
if (G_Rxx.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
i = G_Rxx.size(0);
}
} else if (G_Sxx.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
i = G_Sxx.size(0);
}
r.set_size(i);
stride_1_0 = (G_Rxx.size(0) != 1);
stride_3_0 = (G_Sxx.size(0) != 1);
if (G_Sxx.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
i = G_Sxx.size(0);
}
if (i == 1) {
if (G_Rxx.size(0) == 1) {
loop_ub = static_cast<int>(frequencyCount.contents);
} else {
loop_ub = G_Rxx.size(0);
}
} else if (G_Sxx.size(0) == 1) {
loop_ub = static_cast<int>(frequencyCount.contents);
} else {
loop_ub = G_Sxx.size(0);
}
for (i = 0; i < loop_ub; i++) {
r[i] = 0.7 * G_Rxx[i * stride_1_0] + 0.3 * (1.0 - G_Sxx[i * stride_3_0]);
}
G_Rxx.set_size(r.size(0));
loop_ub = r.size(0);
for (i = 0; i < loop_ub; i++) {
G_Rxx[i] = r[i];
}
}
//
-// Arguments : coder::array<creal_T, 1U> &bk_revertant
+// Arguments : coder::array<creal_T, 1U> &G_R_vc
// const coder::array<double, 1U> &G_Rxx
-// const coder::array<creal_T, 2U> &M
+// const coder::array<creal_T, 2U> &M_vc
// int inputFrameIndex
-// const coder::array<double, 1U> &r
+// const coder::array<creal_T, 1U> &vocal_reverb
// Return Type : void
//
-static void binary_expand_op(coder::array<creal_T, 1U> &bk_revertant,
+static void binary_expand_op(coder::array<creal_T, 1U> &G_R_vc,
const coder::array<double, 1U> &G_Rxx,
- const coder::array<creal_T, 2U> &M,
+ const coder::array<creal_T, 2U> &M_vc,
int inputFrameIndex,
- const coder::array<double, 1U> &r)
+ const coder::array<creal_T, 1U> &vocal_reverb)
{
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
int stride_2_0;
- i = M.size(0);
- if (r.size(0) == 1) {
- if (i == 1) {
- stride_0_0 = G_Rxx.size(0);
- } else {
- stride_0_0 = i;
- }
+ i = M_vc.size(0);
+ if (vocal_reverb.size(0) == 1) {
+ loop_ub = i;
} else {
- stride_0_0 = r.size(0);
+ loop_ub = vocal_reverb.size(0);
}
- bk_revertant.set_size(stride_0_0);
+ if (loop_ub == 1) {
+ loop_ub = G_Rxx.size(0);
+ } else if (vocal_reverb.size(0) == 1) {
+ loop_ub = i;
+ } else {
+ loop_ub = vocal_reverb.size(0);
+ }
+ G_R_vc.set_size(loop_ub);
stride_0_0 = (G_Rxx.size(0) != 1);
stride_1_0 = (i != 1);
- stride_2_0 = (r.size(0) != 1);
- if (r.size(0) == 1) {
- if (i == 1) {
- loop_ub = G_Rxx.size(0);
- } else {
- loop_ub = i;
- }
+ stride_2_0 = (vocal_reverb.size(0) != 1);
+ if (vocal_reverb.size(0) == 1) {
+ loop_ub = i;
} else {
- loop_ub = r.size(0);
+ loop_ub = vocal_reverb.size(0);
+ }
+ if (loop_ub == 1) {
+ loop_ub = G_Rxx.size(0);
+ } else if (vocal_reverb.size(0) == 1) {
+ loop_ub = i;
+ } else {
+ loop_ub = vocal_reverb.size(0);
}
for (i = 0; i < loop_ub; i++) {
- double b_G_Rxx_re_tmp;
double d;
- int G_Rxx_re_tmp;
- G_Rxx_re_tmp = i * stride_1_0;
- b_G_Rxx_re_tmp = G_Rxx[i * stride_0_0];
- d = r[i * stride_2_0];
- bk_revertant[i].re =
- d * (b_G_Rxx_re_tmp * M[G_Rxx_re_tmp + M.size(0) * inputFrameIndex].re);
- bk_revertant[i].im =
- d * (b_G_Rxx_re_tmp * M[G_Rxx_re_tmp + M.size(0) * inputFrameIndex].im);
+ int M_vc_re_tmp;
+ int b_M_vc_re_tmp;
+ M_vc_re_tmp = i * stride_1_0;
+ b_M_vc_re_tmp = i * stride_2_0;
+ d = G_Rxx[i * stride_0_0];
+ G_R_vc[i].re = d * (M_vc[M_vc_re_tmp + M_vc.size(0) * inputFrameIndex].re +
+ vocal_reverb[b_M_vc_re_tmp].re);
+ G_R_vc[i].im = d * (M_vc[M_vc_re_tmp + M_vc.size(0) * inputFrameIndex].im +
+ vocal_reverb[b_M_vc_re_tmp].im);
+ }
+}
+
+//
+// Arguments : coder::array<creal_T, 2U> &R_vc
+// int inputFrameIndex
+// const coder::array<creal_T, 1U> &G_R_vc
+// const coder::array<double, 1U> &y
+// Return Type : void
+//
+static void binary_expand_op(coder::array<creal_T, 2U> &R_vc,
+ int inputFrameIndex,
+ const coder::array<creal_T, 1U> &G_R_vc,
+ const coder::array<double, 1U> &y)
+{
+ int loop_ub;
+ int stride_0_0;
+ int stride_1_0;
+ stride_0_0 = (G_R_vc.size(0) != 1);
+ stride_1_0 = (y.size(0) != 1);
+ if (y.size(0) == 1) {
+ loop_ub = G_R_vc.size(0);
+ } else {
+ loop_ub = y.size(0);
+ }
+ for (int i{0}; i < loop_ub; i++) {
+ double d;
+ d = y[i * stride_1_0];
+ R_vc[i + R_vc.size(0) * inputFrameIndex].re = d * G_R_vc[i * stride_0_0].re;
+ R_vc[i + R_vc.size(0) * inputFrameIndex].im = d * G_R_vc[i * stride_0_0].im;
}
}
//
// Arguments : double output[220500]
// const coder::array<int, 2U> &r
// const coder::array<double, 2U> &sampleRange
// const coder::array<double, 1U> &window
// const coder::array<double, 1U> &r1
// Return Type : void
//
static void binary_expand_op(double output[220500],
const coder::array<int, 2U> &r,
const coder::array<double, 2U> &sampleRange,
const coder::array<double, 1U> &window,
const coder::array<double, 1U> &r1)
{
coder::array<double, 2U> b_output;
int i;
int loop_ub;
int stride_0_1;
int stride_1_1;
int stride_2_1;
b_output.set_size(1, r.size(1));
stride_0_1 = (sampleRange.size(1) != 1);
stride_1_1 = (window.size(0) != 1);
stride_2_1 = (r1.size(0) != 1);
loop_ub = r.size(1);
for (i = 0; i < loop_ub; i++) {
b_output[i] = output[static_cast<int>(sampleRange[i * stride_0_1]) - 1] +
window[i * stride_1_1] * r1[i * stride_2_1];
}
loop_ub = b_output.size(1);
for (i = 0; i < loop_ub; i++) {
output[r[i] - 1] = b_output[i];
}
}
//
// Arguments : coder::array<double, 1U> &G_Sxx
// const coder::captured_var frequencyCount
-// const coder::array<double, 1U> &r1
+// const coder::array<double, 1U> &y
// Return Type : void
//
static void c_binary_expand_op(coder::array<double, 1U> &G_Sxx,
const coder::captured_var frequencyCount,
- const coder::array<double, 1U> &r1)
+ const coder::array<double, 1U> &y)
{
coder::array<double, 1U> r;
int i;
int loop_ub;
int stride_1_0;
int stride_3_0;
- if (r1.size(0) == 1) {
+ if (y.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
- i = r1.size(0);
+ i = y.size(0);
}
if (i == 1) {
if (G_Sxx.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
i = G_Sxx.size(0);
}
- } else if (r1.size(0) == 1) {
+ } else if (y.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
- i = r1.size(0);
+ i = y.size(0);
}
r.set_size(i);
stride_1_0 = (G_Sxx.size(0) != 1);
- stride_3_0 = (r1.size(0) != 1);
- if (r1.size(0) == 1) {
+ stride_3_0 = (y.size(0) != 1);
+ if (y.size(0) == 1) {
i = static_cast<int>(frequencyCount.contents);
} else {
- i = r1.size(0);
+ i = y.size(0);
}
if (i == 1) {
if (G_Sxx.size(0) == 1) {
loop_ub = static_cast<int>(frequencyCount.contents);
} else {
loop_ub = G_Sxx.size(0);
}
- } else if (r1.size(0) == 1) {
+ } else if (y.size(0) == 1) {
loop_ub = static_cast<int>(frequencyCount.contents);
} else {
- loop_ub = r1.size(0);
+ loop_ub = y.size(0);
}
for (i = 0; i < loop_ub; i++) {
- r[i] = 0.7 * G_Sxx[i * stride_1_0] + 0.3 * r1[i * stride_3_0];
+ r[i] = 0.7 * G_Sxx[i * stride_1_0] + 0.3 * y[i * stride_3_0];
}
G_Sxx.set_size(r.size(0));
loop_ub = r.size(0);
for (i = 0; i < loop_ub; i++) {
G_Sxx[i] = r[i];
}
}
//
// Arguments : coder::captured_var *stftWindowSize
// coder::captured_var *frequencyCount
// coder::captured_var *frameCount
// const coder::array<creal_T, 2U> &spectrumx
// const coder::array<double, 1U> &window
// double overlapSamples
// double output[220500]
// Return Type : void
//
static void reconstruct(coder::captured_var *stftWindowSize,
coder::captured_var *frequencyCount,
coder::captured_var *frameCount,
const coder::array<creal_T, 2U> &spectrumx,
const coder::array<double, 1U> &window,
double overlapSamples, double output[220500])
{
coder::array<creal_T, 2U> r;
coder::array<creal_T, 2U> spectrum;
coder::array<creal_T, 1U> b_spectrum;
coder::array<creal_T, 1U> r1;
coder::array<double, 2U> b_output;
coder::array<double, 2U> sampleRange;
coder::array<double, 1U> r2;
coder::array<int, 2U> r3;
double xtmp_im;
double xtmp_re;
int b_i;
int i;
int i1;
int loop_ub;
int m;
int md2;
int n;
boolean_T exitg1;
- // scalex = sum(abs(dry_vc))/(sum(abs(reverberated_vc))+ 1e-4);
- // scalex = min(1,scalex);
- // reverberated_vc = scalex*reverberated_vc;
- // reverberated_vc = OverflowLimit(reverberated_vc);
// Helper functions
stftWindowSize->contents = window.size(0);
frameCount->contents = spectrumx.size(1);
frequencyCount->contents = spectrumx.size(0);
i = static_cast<int>(stftWindowSize->contents);
loop_ub = static_cast<int>(frameCount->contents);
spectrum.set_size(i, loop_ub);
md2 = i * loop_ub;
for (i = 0; i < md2; i++) {
spectrum[i].re = 0.0;
spectrum[i].im = 1.0E-5;
}
// spectrum(frequencyCount+1:stftWindowSize, :) =
// conj(flipud(spectrum(1:frequencyCount-2, :)));
xtmp_re = frequencyCount->contents;
if (2.0 > xtmp_re) {
i = 0;
i1 = -1;
} else {
i = 1;
i1 = static_cast<int>(xtmp_re) - 1;
}
md2 = spectrumx.size(1);
for (n = 0; n < md2; n++) {
m = spectrumx.size(0);
for (b_i = 0; b_i < m; b_i++) {
spectrum[b_i + spectrum.size(0) * n] =
spectrumx[b_i + spectrumx.size(0) * n];
}
}
sampleRange.set_size(1, loop_ub);
for (n = 0; n < loop_ub; n++) {
sampleRange[n] = 0.0;
}
loop_ub = sampleRange.size(1);
for (n = 0; n < loop_ub; n++) {
spectrum[spectrum.size(0) * n].re = 0.0;
spectrum[spectrum.size(0) * n].im = 0.0;
}
i1 -= i;
if (1 > i1) {
loop_ub = -1;
} else {
loop_ub = i1 - 1;
}
xtmp_re = frequencyCount->contents + 1.0;
if (xtmp_re > stftWindowSize->contents) {
i1 = 1;
} else {
i1 = static_cast<int>(xtmp_re);
}
md2 = spectrumx.size(1) - 1;
r.set_size(loop_ub + 1, spectrumx.size(1));
for (n = 0; n <= md2; n++) {
for (b_i = 0; b_i <= loop_ub; b_i++) {
m = i + b_i;
r[b_i + r.size(0) * n].re = spectrumx[m + spectrumx.size(0) * n].re;
r[b_i + r.size(0) * n].im = -spectrumx[m + spectrumx.size(0) * n].im;
}
}
m = r.size(0) - 1;
n = r.size(1);
md2 = r.size(0) >> 1;
for (loop_ub = 0; loop_ub < n; loop_ub++) {
for (b_i = 0; b_i < md2; b_i++) {
xtmp_re = r[b_i + r.size(0) * loop_ub].re;
xtmp_im = r[b_i + r.size(0) * loop_ub].im;
i = m - b_i;
r[b_i + r.size(0) * loop_ub] = r[i + r.size(0) * loop_ub];
r[i + r.size(0) * loop_ub].re = xtmp_re;
r[i + r.size(0) * loop_ub].im = xtmp_im;
}
}
loop_ub = r.size(1);
for (i = 0; i < loop_ub; i++) {
md2 = r.size(0);
for (n = 0; n < md2; n++) {
spectrum[((i1 + n) + spectrum.size(0) * i) - 1] = r[n + r.size(0) * i];
}
}
std::memset(&output[0], 0, 220500U * sizeof(double));
xtmp_im = stftWindowSize->contents - overlapSamples;
xtmp_re = frameCount->contents;
md2 = 0;
exitg1 = false;
while ((!exitg1) && (md2 <= static_cast<int>(xtmp_re) - 1)) {
double b;
double frameStart;
frameStart = ((static_cast<double>(md2) + 1.0) - 1.0) * xtmp_im;
b = frameStart + stftWindowSize->contents;
if (b > 220500.0) {
exitg1 = true;
} else {
if (std::isnan(frameStart + 1.0) || std::isnan(b)) {
sampleRange.set_size(1, 1);
sampleRange[0] = rtNaN;
} else if (b < frameStart + 1.0) {
sampleRange.set_size(1, 0);
} else if ((std::isinf(frameStart + 1.0) || std::isinf(b)) &&
(frameStart + 1.0 == b)) {
sampleRange.set_size(1, 1);
sampleRange[0] = rtNaN;
} else if (std::floor(frameStart + 1.0) == frameStart + 1.0) {
loop_ub = static_cast<int>(std::floor(b - (frameStart + 1.0)));
sampleRange.set_size(1, loop_ub + 1);
for (i = 0; i <= loop_ub; i++) {
sampleRange[i] = (frameStart + 1.0) + static_cast<double>(i);
}
} else {
double apnd;
double cdiff;
double ndbl;
ndbl = std::floor((b - (frameStart + 1.0)) + 0.5);
apnd = (frameStart + 1.0) + ndbl;
cdiff = apnd - b;
if (std::abs(cdiff) <
4.4408920985006262E-16 *
std::fmax(std::abs(frameStart + 1.0), std::abs(b))) {
ndbl++;
apnd = b;
} else if (cdiff > 0.0) {
apnd = (frameStart + 1.0) + (ndbl - 1.0);
} else {
ndbl++;
}
if (ndbl >= 0.0) {
n = static_cast<int>(ndbl);
} else {
n = 0;
}
sampleRange.set_size(1, n);
if (n > 0) {
sampleRange[0] = frameStart + 1.0;
if (n > 1) {
sampleRange[n - 1] = apnd;
m = (n - 1) / 2;
for (loop_ub = 0; loop_ub <= m - 2; loop_ub++) {
sampleRange[loop_ub + 1] =
(frameStart + 1.0) + (static_cast<double>(loop_ub) + 1.0);
sampleRange[(n - loop_ub) - 2] =
apnd - (static_cast<double>(loop_ub) + 1.0);
}
if (m << 1 == n - 1) {
sampleRange[m] = ((frameStart + 1.0) + apnd) / 2.0;
} else {
sampleRange[m] = (frameStart + 1.0) + static_cast<double>(m);
sampleRange[m + 1] = apnd - static_cast<double>(m);
}
}
}
}
// reconstructedFrame(:) = window .* ifft(spectrum(:, frameIndex),
// 'symmetric');
// v = spectrum(:, frameIndex);
// v_conj= conj(v([1,end:-1:2]));
loop_ub = spectrum.size(0);
b_spectrum.set_size(spectrum.size(0));
for (i = 0; i < loop_ub; i++) {
b_spectrum[i] = spectrum[i + spectrum.size(0) * md2];
}
coder::ifft(b_spectrum, r1);
r2.set_size(r1.size(0));
loop_ub = r1.size(0);
for (i = 0; i < loop_ub; i++) {
r2[i] = r1[i].re;
}
r3.set_size(1, sampleRange.size(1));
loop_ub = sampleRange.size(1);
for (i = 0; i < loop_ub; i++) {
r3[i] = static_cast<int>(sampleRange[i]);
}
if (window.size(0) == 1) {
i = r2.size(0);
} else {
i = window.size(0);
}
if ((window.size(0) == r2.size(0)) && (sampleRange.size(1) == i)) {
b_output.set_size(1, r3.size(1));
loop_ub = r3.size(1);
for (i = 0; i < loop_ub; i++) {
b_output[i] =
output[static_cast<int>(sampleRange[i]) - 1] + window[i] * r2[i];
}
loop_ub = b_output.size(1);
for (i = 0; i < loop_ub; i++) {
output[r3[i] - 1] = b_output[i];
}
} else {
binary_expand_op(output, r3, sampleRange, window, r2);
}
md2++;
}
}
}
//
// Arguments : double u0
// double u1
// Return Type : double
//
static double rt_hypotd_snf(double u0, double u1)
{
double a;
double y;
a = std::abs(u0);
y = std::abs(u1);
if (a < y) {
a /= y;
y *= std::sqrt(a * a + 1.0);
} else if (a > y) {
y /= a;
y = a * std::sqrt(y * y + 1.0);
} else if (!std::isnan(y)) {
y = a * 1.4142135623730951;
}
return y;
}
//
// % inputFilename = 'audio/EchoSample.mp3';
// inputFilename =
// '/Volumes/T7_2/starmaker_files/音效提取算法/effect_files/2/vocal_left_16k.wav';
// inputFilename =
// '/Volumes/T7_2/starmaker_files/音效提取算法/effect_files/1/vocla_left.wav';
//
// % inputFilename = 'audio/stalbans_omni_sing.mp3';
// % inputFilename = 'audio/mozart_reverb_short.mp3';
// [signal, fs] = audioread(inputFilename);
// signal= signal(1:fs*30);
// % Take only the left channel from the stereo recording
// signal = signal(:, 1);
//
// Arguments : const double b_signal[220500]
// const double signal_vc[220500]
// double fs
// const double impulseResponse[264600]
// double reverberated_vc[220500]
// Return Type : void
//
void dereveb_c(const double b_signal[220500], const double signal_vc[220500],
double fs, const double impulseResponse[264600],
double reverberated_vc[220500])
{
+ static double c_y[220500];
+ static double d_y[220500];
coder::captured_var frameCount;
coder::captured_var frequencyCount;
coder::captured_var stftWindowSize;
coder::array<creal_T, 2U> M;
coder::array<creal_T, 2U> M_vc;
coder::array<creal_T, 2U> R_vc;
coder::array<creal_T, 2U> S_vc;
coder::array<creal_T, 2U> allBlocks;
coder::array<creal_T, 2U> x;
- coder::array<creal_T, 1U> bk_revertant;
+ coder::array<creal_T, 1U> G_R_vc;
coder::array<creal_T, 1U> vocal_dry;
coder::array<creal_T, 1U> vocal_reverb;
coder::array<double, 2U> C;
coder::array<double, 2U> H_pow;
coder::array<double, 2U> H_pow_sm;
coder::array<double, 2U> b_previousSFramesPower;
coder::array<double, 2U> c_previousSFramesPower;
coder::array<double, 2U> previousMFramesPower;
coder::array<double, 2U> previousSFramesPower;
coder::array<double, 2U> previousSFramesPower_vc;
- coder::array<double, 2U> r1;
+ coder::array<double, 2U> r;
coder::array<double, 2U> y;
coder::array<double, 1U> G_R;
coder::array<double, 1U> G_Rxx;
coder::array<double, 1U> G_S;
coder::array<double, 1U> G_Sxx;
coder::array<double, 1U> b_y;
+ coder::array<double, 1U> e_y;
coder::array<double, 1U> inputFramePower;
coder::array<double, 1U> newEstimates;
- coder::array<double, 1U> r;
coder::array<double, 1U> window;
- coder::array<int, 1U> r2;
+ coder::array<int, 1U> r1;
coder::array<boolean_T, 1U> unchanged;
double overlapSamples;
- double scale_cl;
+ double varargin_1;
+ double varargin_2;
+ int hi;
int i;
int i1;
int i2;
int k;
int loop_ub;
int nx;
+ int xblockoffset;
if (!isInitialized_dereveb_c) {
dereveb_c_initialize();
}
// Dereverberation
// inputFilename_vc =
// '/Volumes/T7_2/starmaker_files/音效提取算法/effect_files/2/611752105030248995_8162774327817435_dv_44100_16k.wav';
// inputFilename_vc =
// '/Volumes/T7_2/starmaker_files/音效提取算法/effect_files/1/611752105030249000_8162774329368194_dv_44100.wav';
// [signal_vc, fs] = audioread(inputFilename_vc);
// signal_vc= signal_vc(1:fs*30);
// % Take only the left channel from the stereo recording
// signal_vc = signal_vc(:, 1);
// Compute the signal's STFT
stftWindowSize.contents = 1024.0 * std::floor(fs / 16000.0);
// In the paper he used 0.5 (50% overlap).
overlapSamples = std::floor(0.75 * stftWindowSize.contents);
// TODO: zero padding?
coder::hann(stftWindowSize.contents, window);
+ // window = ones(stftWindowSize,1);
// Specify empty Fs so that t is returned in samples and w in rad/sample.
// figure;
// [M,~,~] = spectrogram(signal, window, overlapSamples, [], []);
coder::spectrogram(b_signal, window, overlapSamples, M);
// M ('microphone') - input signal (reverberated) frequency-domain vectors.
// Rows - frequencies, Columns - time frames (middle time-
// point)
frequencyCount.contents = M.size(0);
// [M_vc,~,~] = spectrogram(signal_vc, window, overlapSamples, [], []);
coder::spectrogram(signal_vc, window, overlapSamples, M_vc);
+ // [output_fft,output_win] = myspectrum(signal_vc, window, overlapSamples);
// M ('microphone') - input signal (reverberated) frequency-domain vectors.
// Rows - frequencies, Columns - time frames (middle time-point)
frameCount.contents = std::fmin(static_cast<double>(M.size(1)),
static_cast<double>(M_vc.size(1)));
// Constants
// Impulse response block length - has to be 'sufficiently small'
// TODO: experiment with value. Is this really the same as the window size?
// Number of impulse response blocks. TODO: experiment.
// Minimum gain per frequency. TODO: Experiment.
// Maximum magnitude estimate per impulse response block and frequency.
// Should 'reflect real world systems'. (Page 11 - MaxValue.)
// maxHEstimate(:) = readImpulseResponse('audio/stalbans_a_mono.wav', B,
// window, overlapSamples);
// impulseResponse = audioread(irFilename);
// assert(irFs == fs);
// function image = spectrogramPlot(spectrum, t, w)
// figure;
// image = imagesc(t, w, 10*log10(abs(spectrum)+eps));
// image.Parent.YDir = 'normal';
// colorbar();
// end
coder::b_spectrogram(impulseResponse, window, overlapSamples, allBlocks);
// pow = @(x) abs(x).^2;
loop_ub = allBlocks.size(0);
x.set_size(allBlocks.size(0), 400);
for (i = 0; i < 400; i++) {
for (i1 = 0; i1 < loop_ub; i1++) {
x[i1 + x.size(0) * i] = allBlocks[i1 + allBlocks.size(0) * i];
}
}
nx = allBlocks.size(0) * 400;
y.set_size(allBlocks.size(0), 400);
for (k = 0; k < nx; k++) {
y[k] = rt_hypotd_snf(x[k].re, x[k].im);
}
loop_ub = y.size(0) * 400;
y.set_size(y.size(0), 400);
for (i = 0; i < loop_ub; i++) {
- scale_cl = y[i];
- y[i] = scale_cl * scale_cl;
+ varargin_1 = y[i];
+ y[i] = varargin_1 * varargin_1;
}
// maxHEstimate(:) = 0.9;
// Bias used to keep the magnitude estimate from getting stuck on a wrong
// minimum.
// TODO: Experiment
// From the paper - gamma (Page 10). Lower means more smoothing between
// gains vectors of consecutive frames. Value 0-1 (1 = no smoothing).
// From the paper - alpha (Page 11). Lower means less smoothing between
// magnitude response block estimates on consecutive frames.
// Value 0-1 (0 = no smoothing).
// Algorithm implementation: block-wise signal dereverberation.
allBlocks.set_size(M.size(0), M.size(1));
loop_ub = M.size(0) * M.size(1);
for (i = 0; i < loop_ub; i++) {
allBlocks[i].re = 0.0;
allBlocks[i].im = 1.0E-5;
}
// Dry signal frequency-domain vectors.
// Reverberated components frequency-domain vectors.
S_vc.set_size(M.size(0), M.size(1));
loop_ub = M.size(0) * M.size(1);
for (i = 0; i < loop_ub; i++) {
S_vc[i].re = 0.0;
S_vc[i].im = 1.0E-5;
}
R_vc.set_size(M.size(0), M.size(1));
loop_ub = M.size(0) * M.size(1);
for (i = 0; i < loop_ub; i++) {
R_vc[i].re = 0.0;
R_vc[i].im = 1.0E-5;
}
// Reverberant system frequency response estimate blocks - power.
// H_pow = zeros(frequencyCount, B);
// Set initial estimates to half of the maximum.
+ // H_pow = maxHEstimate / 2;
H_pow.set_size(y.size(0), 400);
loop_ub = y.size(0) * 400;
for (i = 0; i < loop_ub; i++) {
- H_pow[i] = y[i] / 2.0;
+ H_pow[i] = y[i] / 15.0;
}
// pow = @(x) abs(x).^2;
previousSFramesPower.set_size(M.size(0), 400);
loop_ub = M.size(0) * 400;
for (i = 0; i < loop_ub; i++) {
previousSFramesPower[i] = 0.0;
}
// Most recent previous frame is first.
previousMFramesPower.set_size(M.size(0), 400);
loop_ub = M.size(0) * 400;
for (i = 0; i < loop_ub; i++) {
previousMFramesPower[i] = 1.0;
}
// Most recent previous frame is first.
// Reverberant system frequency response power estimate blocks - temporary.
C.set_size(H_pow.size(0), 400);
loop_ub = H_pow.size(0) * 400;
for (i = 0; i < loop_ub; i++) {
C[i] = 0.0;
}
// Matrix to keep all estimates over time (not needed by algorithm - just
// for visualization purposes).
// H_pow_all = zeros([HisCount size(H_pow)]);
// Initially, all components are estimated to belong to the dry signal.
G_S.set_size(M.size(0));
loop_ub = M.size(0);
for (i = 0; i < loop_ub; i++) {
G_S[i] = 1.0;
}
G_R.set_size(M.size(0));
loop_ub = M.size(0);
for (i = 0; i < loop_ub; i++) {
G_R[i] = 0.0;
}
G_Sxx.set_size(M.size(0));
loop_ub = M.size(0);
for (i = 0; i < loop_ub; i++) {
G_Sxx[i] = 1.0;
}
G_Rxx.set_size(M.size(0));
loop_ub = M.size(0);
for (i = 0; i < loop_ub; i++) {
G_Rxx[i] = 0.0;
}
previousSFramesPower_vc.set_size(M.size(0), 400);
loop_ub = M.size(0) * 400;
for (i = 0; i < loop_ub; i++) {
previousSFramesPower_vc[i] = 0.0;
}
// Most recent previous frame is first.
// Most recent previous frame is first.
H_pow_sm.set_size(H_pow.size(0), 400);
loop_ub = H_pow.size(0) * 400;
for (i = 0; i < loop_ub; i++) {
H_pow_sm[i] = H_pow[i];
}
i = static_cast<int>(frameCount.contents);
if (0.0 <= i - 1) {
i2 = y.size(0);
}
for (int inputFrameIndex{0}; inputFrameIndex < i; inputFrameIndex++) {
- double varargin_2;
- int b_i;
// X = sprintf('frameidx: %d / %d \r',inputFrameIndex,frameCount);
// disp(X)
loop_ub = M.size(0);
- newEstimates.set_size(M.size(0));
+ b_y.set_size(M.size(0));
for (k = 0; k < loop_ub; k++) {
- newEstimates[k] = rt_hypotd_snf(M[k + M.size(0) * inputFrameIndex].re,
- M[k + M.size(0) * inputFrameIndex].im);
+ b_y[k] = rt_hypotd_snf(M[k + M.size(0) * inputFrameIndex].re,
+ M[k + M.size(0) * inputFrameIndex].im);
}
- inputFramePower.set_size(newEstimates.size(0));
- loop_ub = newEstimates.size(0);
+ inputFramePower.set_size(b_y.size(0));
+ loop_ub = b_y.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
- scale_cl = newEstimates[i1];
- inputFramePower[i1] = scale_cl * scale_cl;
+ varargin_1 = b_y[i1];
+ inputFramePower[i1] = varargin_1 * varargin_1;
}
// Update system frequency response estimates.
loop_ub = inputFramePower.size(0);
- for (int blockIndex{0}; blockIndex < 400; blockIndex++) {
+ for (k = 0; k < 400; k++) {
if (inputFramePower.size(0) == previousMFramesPower.size(0)) {
newEstimates.set_size(inputFramePower.size(0));
for (i1 = 0; i1 < loop_ub; i1++) {
newEstimates[i1] =
inputFramePower[i1] /
- previousMFramesPower[i1 +
- previousMFramesPower.size(0) * blockIndex];
+ previousMFramesPower[i1 + previousMFramesPower.size(0) * k];
}
} else {
binary_expand_op(newEstimates, inputFramePower, previousMFramesPower,
- blockIndex);
+ k);
}
if (newEstimates.size(0) == H_pow.size(0)) {
unchanged.set_size(newEstimates.size(0));
- nx = newEstimates.size(0);
- for (i1 = 0; i1 < nx; i1++) {
- unchanged[i1] =
- (newEstimates[i1] >= H_pow[i1 + H_pow.size(0) * blockIndex]);
+ xblockoffset = newEstimates.size(0);
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ unchanged[i1] = (newEstimates[i1] >= H_pow[i1 + H_pow.size(0) * k]);
}
} else {
- b_binary_expand_op(unchanged, newEstimates, H_pow, blockIndex);
+ b_binary_expand_op(unchanged, newEstimates, H_pow, k);
}
- k = unchanged.size(0) - 1;
- nx = 0;
- for (b_i = 0; b_i <= k; b_i++) {
- if (unchanged[b_i]) {
- nx++;
+ hi = unchanged.size(0) - 1;
+ xblockoffset = 0;
+ for (nx = 0; nx <= hi; nx++) {
+ if (unchanged[nx]) {
+ xblockoffset++;
}
}
- r2.set_size(nx);
- nx = 0;
- for (b_i = 0; b_i <= k; b_i++) {
- if (unchanged[b_i]) {
- r2[nx] = b_i + 1;
- nx++;
+ r1.set_size(xblockoffset);
+ xblockoffset = 0;
+ for (nx = 0; nx <= hi; nx++) {
+ if (unchanged[nx]) {
+ r1[xblockoffset] = nx + 1;
+ xblockoffset++;
}
}
- nx = r2.size(0);
- r.set_size(r2.size(0));
- for (i1 = 0; i1 < nx; i1++) {
- r[i1] = H_pow[(r2[i1] + H_pow.size(0) * blockIndex) - 1] * 1.01;
+ xblockoffset = r1.size(0);
+ b_y.set_size(r1.size(0));
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ b_y[i1] = H_pow[(r1[i1] + H_pow.size(0) * k) - 1] * 1.01;
}
- k = unchanged.size(0);
- nx = 0;
- for (b_i = 0; b_i < k; b_i++) {
- if (unchanged[b_i]) {
- newEstimates[b_i] = r[nx] + 2.2204460492503131E-16;
- nx++;
+ hi = unchanged.size(0);
+ xblockoffset = 0;
+ for (nx = 0; nx < hi; nx++) {
+ if (unchanged[nx]) {
+ newEstimates[nx] = b_y[xblockoffset] + 2.2204460492503131E-16;
+ xblockoffset++;
}
}
if (newEstimates.size(0) == i2) {
- nx = newEstimates.size(0);
- for (i1 = 0; i1 < nx; i1++) {
- scale_cl = newEstimates[i1];
- varargin_2 = y[i1 + y.size(0) * blockIndex];
- C[i1 + C.size(0) * blockIndex] = std::fmin(scale_cl, varargin_2);
+ xblockoffset = newEstimates.size(0);
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ varargin_1 = newEstimates[i1];
+ varargin_2 = y[i1 + y.size(0) * k];
+ C[i1 + C.size(0) * k] = std::fmin(varargin_1, varargin_2);
}
} else {
- nx = y.size(0);
- b_y.set_size(y.size(0));
- for (i1 = 0; i1 < nx; i1++) {
- b_y[i1] = y[i1 + y.size(0) * blockIndex];
+ xblockoffset = y.size(0);
+ e_y.set_size(y.size(0));
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ e_y[i1] = y[i1 + y.size(0) * k];
}
- coder::internal::expand_min(newEstimates, b_y, r);
- nx = r.size(0);
- for (i1 = 0; i1 < nx; i1++) {
- C[i1 + C.size(0) * blockIndex] = r[i1];
+ coder::internal::expand_min(newEstimates, e_y, b_y);
+ xblockoffset = b_y.size(0);
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ C[i1 + C.size(0) * k] = b_y[i1];
}
}
- nx = M.size(0);
+ xblockoffset = M.size(0);
if (M.size(0) == 1) {
i1 = H_pow.size(0);
} else {
i1 = M.size(0);
}
if (M.size(0) == 1) {
- k = C.size(0);
+ nx = C.size(0);
} else {
- k = M.size(0);
+ nx = M.size(0);
}
if ((M.size(0) == H_pow.size(0)) && (M.size(0) == C.size(0)) &&
- (i1 == k)) {
- r.set_size(M.size(0));
- for (i1 = 0; i1 < nx; i1++) {
- r[i1] = 0.2 * H_pow[i1 + H_pow.size(0) * blockIndex] +
- 0.8 * C[i1 + C.size(0) * blockIndex];
+ (i1 == nx)) {
+ b_y.set_size(M.size(0));
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ b_y[i1] =
+ 0.2 * H_pow[i1 + H_pow.size(0) * k] + 0.8 * C[i1 + C.size(0) * k];
}
- nx = r.size(0);
- for (i1 = 0; i1 < nx; i1++) {
- H_pow[i1 + H_pow.size(0) * blockIndex] = r[i1];
+ xblockoffset = b_y.size(0);
+ for (i1 = 0; i1 < xblockoffset; i1++) {
+ H_pow[i1 + H_pow.size(0) * k] = b_y[i1];
}
} else {
- binary_expand_op(H_pow, blockIndex, M, C);
+ binary_expand_op(H_pow, k, M, C);
}
}
// % H_pow_all(inputFrameIndex, :, :) = H_pow;
// H_pow_all(2:end,:,:) = H_pow_all( 1:end-1,:,:);
// H_pow_all(1,:, :) = H_pow; %%放在最开始位置
// TODO: ?? G_S = sqrt(G_S);
// Enforce a minimum gain for each frequency.
if (previousSFramesPower.size(0) == H_pow.size(0)) {
b_previousSFramesPower.set_size(previousSFramesPower.size(0), 400);
loop_ub = previousSFramesPower.size(0) * 400;
for (i1 = 0; i1 < loop_ub; i1++) {
b_previousSFramesPower[i1] = previousSFramesPower[i1] * H_pow[i1];
}
- coder::sum(b_previousSFramesPower, r);
+ coder::sum(b_previousSFramesPower, b_y);
} else {
- binary_expand_op(r, previousSFramesPower, H_pow);
+ binary_expand_op(b_y, previousSFramesPower, H_pow);
}
- if (r.size(0) == inputFramePower.size(0)) {
- r1.set_size(r.size(0), 2);
- loop_ub = r.size(0);
+ if (b_y.size(0) == inputFramePower.size(0)) {
+ r.set_size(b_y.size(0), 2);
+ loop_ub = b_y.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
- r1[i1] = 1.0 - r[i1] / inputFramePower[i1];
+ r[i1] = 1.0 - b_y[i1] / inputFramePower[i1];
}
loop_ub = M.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
- r1[i1 + r1.size(0)] = 0.0;
+ r[i1 + r.size(0)] = 0.0;
}
- coder::internal::maximum(r1, r);
+ coder::internal::maximum(r, b_y);
} else {
- c_binary_expand_op(r, inputFramePower, M);
+ c_binary_expand_op(b_y, inputFramePower, M);
}
loop_ub = G_S.size(0);
i1 = static_cast<int>(frequencyCount.contents);
if (frequencyCount.contents == 1.0) {
- k = G_S.size(0);
+ nx = G_S.size(0);
} else {
- k = static_cast<int>(frequencyCount.contents);
+ nx = static_cast<int>(frequencyCount.contents);
}
if (frequencyCount.contents == 1.0) {
- nx = r.size(0);
+ xblockoffset = b_y.size(0);
} else {
- nx = static_cast<int>(frequencyCount.contents);
+ xblockoffset = static_cast<int>(frequencyCount.contents);
}
- if ((i1 == G_S.size(0)) && (i1 == r.size(0)) && (k == nx)) {
- for (b_i = 0; b_i < loop_ub; b_i++) {
- G_S[b_i] = 0.7 * G_S[b_i] + 0.3 * r[b_i];
+ if ((i1 == G_S.size(0)) && (i1 == b_y.size(0)) && (nx == xblockoffset)) {
+ for (nx = 0; nx < loop_ub; nx++) {
+ G_S[nx] = 0.7 * G_S[nx] + 0.3 * b_y[nx];
}
} else {
- c_binary_expand_op(G_S, frequencyCount, r);
+ c_binary_expand_op(G_S, frequencyCount, b_y);
}
loop_ub = G_R.size(0);
if (frequencyCount.contents == 1.0) {
- k = G_R.size(0);
+ nx = G_R.size(0);
} else {
- k = static_cast<int>(frequencyCount.contents);
+ nx = static_cast<int>(frequencyCount.contents);
}
if (frequencyCount.contents == 1.0) {
- nx = G_S.size(0);
+ xblockoffset = G_S.size(0);
} else {
- nx = static_cast<int>(frequencyCount.contents);
+ xblockoffset = static_cast<int>(frequencyCount.contents);
}
- if ((i1 == G_R.size(0)) && (i1 == G_S.size(0)) && (k == nx)) {
- for (b_i = 0; b_i < loop_ub; b_i++) {
- G_R[b_i] = 0.7 * G_R[b_i] + 0.3 * (1.0 - G_S[b_i]);
+ if ((i1 == G_R.size(0)) && (i1 == G_S.size(0)) && (nx == xblockoffset)) {
+ for (nx = 0; nx < loop_ub; nx++) {
+ G_R[nx] = 0.7 * G_R[nx] + 0.3 * (1.0 - G_S[nx]);
}
} else {
binary_expand_op(G_R, frequencyCount, G_S);
}
loop_ub = G_S.size(0);
if (G_S.size(0) == M.size(0)) {
vocal_dry.set_size(G_S.size(0));
- for (b_i = 0; b_i < loop_ub; b_i++) {
- vocal_dry[b_i].re = G_S[b_i] * M[b_i + M.size(0) * inputFrameIndex].re;
- vocal_dry[b_i].im = G_S[b_i] * M[b_i + M.size(0) * inputFrameIndex].im;
+ for (nx = 0; nx < loop_ub; nx++) {
+ vocal_dry[nx].re = G_S[nx] * M[nx + M.size(0) * inputFrameIndex].re;
+ vocal_dry[nx].im = G_S[nx] * M[nx + M.size(0) * inputFrameIndex].im;
}
} else {
binary_expand_op(vocal_dry, G_S, M, inputFrameIndex);
}
loop_ub = vocal_dry.size(0);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- allBlocks[b_i + allBlocks.size(0) * inputFrameIndex] = vocal_dry[b_i];
+ for (nx = 0; nx < loop_ub; nx++) {
+ allBlocks[nx + allBlocks.size(0) * inputFrameIndex] = vocal_dry[nx];
}
// G_S .* real(inputFrame) + 1j*G_S .* imag(inputFrame); % %%干声
loop_ub = G_R.size(0);
if (G_R.size(0) == M.size(0)) {
vocal_reverb.set_size(G_R.size(0));
- for (b_i = 0; b_i < loop_ub; b_i++) {
- vocal_reverb[b_i].re =
- G_R[b_i] * M[b_i + M.size(0) * inputFrameIndex].re;
- vocal_reverb[b_i].im =
- G_R[b_i] * M[b_i + M.size(0) * inputFrameIndex].im;
+ for (nx = 0; nx < loop_ub; nx++) {
+ vocal_reverb[nx].re = G_R[nx] * M[nx + M.size(0) * inputFrameIndex].re;
+ vocal_reverb[nx].im = G_R[nx] * M[nx + M.size(0) * inputFrameIndex].im;
}
} else {
binary_expand_op(vocal_reverb, G_R, M, inputFrameIndex);
}
// G_R .* real(inputFrame) + 1j*G_R .* imag(inputFrame); % %%混响
// Shift all previous frames one column to the right, and insert the
// current frame at the beginning.
- nx = previousSFramesPower.size(0) - 1;
+ xblockoffset = previousSFramesPower.size(0) - 1;
c_previousSFramesPower.set_size(previousSFramesPower.size(0), 399);
- for (b_i = 0; b_i < 399; b_i++) {
- for (k = 0; k <= nx; k++) {
- c_previousSFramesPower[k + c_previousSFramesPower.size(0) * b_i] =
- previousSFramesPower[k + previousSFramesPower.size(0) * b_i];
+ for (nx = 0; nx < 399; nx++) {
+ for (hi = 0; hi <= xblockoffset; hi++) {
+ c_previousSFramesPower[hi + c_previousSFramesPower.size(0) * nx] =
+ previousSFramesPower[hi + previousSFramesPower.size(0) * nx];
}
}
loop_ub = c_previousSFramesPower.size(0);
- for (b_i = 0; b_i < 399; b_i++) {
- for (k = 0; k < loop_ub; k++) {
- previousSFramesPower[k + previousSFramesPower.size(0) * (b_i + 1)] =
- c_previousSFramesPower[k + c_previousSFramesPower.size(0) * b_i];
+ for (nx = 0; nx < 399; nx++) {
+ for (hi = 0; hi < loop_ub; hi++) {
+ previousSFramesPower[hi + previousSFramesPower.size(0) * (nx + 1)] =
+ c_previousSFramesPower[hi + c_previousSFramesPower.size(0) * nx];
}
}
loop_ub = allBlocks.size(0);
- newEstimates.set_size(allBlocks.size(0));
+ b_y.set_size(allBlocks.size(0));
for (k = 0; k < loop_ub; k++) {
- newEstimates[k] =
+ b_y[k] =
rt_hypotd_snf(allBlocks[k + allBlocks.size(0) * inputFrameIndex].re,
allBlocks[k + allBlocks.size(0) * inputFrameIndex].im);
}
- loop_ub = newEstimates.size(0);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- scale_cl = newEstimates[b_i];
- previousSFramesPower[b_i] = scale_cl * scale_cl;
+ loop_ub = b_y.size(0);
+ for (nx = 0; nx < loop_ub; nx++) {
+ varargin_1 = b_y[nx];
+ previousSFramesPower[nx] = varargin_1 * varargin_1;
}
- nx = previousMFramesPower.size(0) - 1;
+ xblockoffset = previousMFramesPower.size(0) - 1;
c_previousSFramesPower.set_size(previousMFramesPower.size(0), 399);
- for (b_i = 0; b_i < 399; b_i++) {
- for (k = 0; k <= nx; k++) {
- c_previousSFramesPower[k + c_previousSFramesPower.size(0) * b_i] =
- previousMFramesPower[k + previousMFramesPower.size(0) * b_i];
+ for (nx = 0; nx < 399; nx++) {
+ for (hi = 0; hi <= xblockoffset; hi++) {
+ c_previousSFramesPower[hi + c_previousSFramesPower.size(0) * nx] =
+ previousMFramesPower[hi + previousMFramesPower.size(0) * nx];
}
}
loop_ub = c_previousSFramesPower.size(0);
- for (b_i = 0; b_i < 399; b_i++) {
- for (k = 0; k < loop_ub; k++) {
- previousMFramesPower[k + previousMFramesPower.size(0) * (b_i + 1)] =
- c_previousSFramesPower[k + c_previousSFramesPower.size(0) * b_i];
+ for (nx = 0; nx < 399; nx++) {
+ for (hi = 0; hi < loop_ub; hi++) {
+ previousMFramesPower[hi + previousMFramesPower.size(0) * (nx + 1)] =
+ c_previousSFramesPower[hi + c_previousSFramesPower.size(0) * nx];
}
}
loop_ub = inputFramePower.size(0);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- previousMFramesPower[b_i] = inputFramePower[b_i];
+ for (nx = 0; nx < loop_ub; nx++) {
+ previousMFramesPower[nx] = inputFramePower[nx];
}
// %%%%%%%%%%%添加新的部分%%%%%%%%%%%%%%
loop_ub = M_vc.size(0);
- bk_revertant.set_size(M_vc.size(0));
- inputFramePower.set_size(M_vc.size(0));
+ G_R_vc.set_size(M_vc.size(0));
+ e_y.set_size(M_vc.size(0));
for (k = 0; k < loop_ub; k++) {
- bk_revertant[k] = M_vc[k + M_vc.size(0) * inputFrameIndex];
- inputFramePower[k] =
- rt_hypotd_snf(M_vc[k + M_vc.size(0) * inputFrameIndex].re,
- M_vc[k + M_vc.size(0) * inputFrameIndex].im);
- }
- // %%%% 方法4,借鉴aec的方法;
- // CNT = 50;%10;%
- // H_pow_sm = (1- 1/CNT)*H_pow_sm + (1/CNT)*H_pow;
- // newG_R_vc = (sum(previousSFramesPower_vc .* H_pow_sm, 2)) ;
- // yfk = newG_R_vc; %sum(YFb,2);%%将YFb按行求和,得到65*1的矩阵
- // N = stftWindowSize/2;
- // tmp = [yfk ; flipud(conj(yfk(2:N)))];
- // ykt = real(ifft(tmp));
- // ykfb = ykt(end-N+1:end);%%得到回声信号时域,为64*1矩阵
- //
- // % ---------------------- Error estimation
- // ekfb = dk + ykfb;%%时域误差信号
- //
- //
- // scale_cl = sum(abs(bk_revertant)) / (sum(abs(inputFrame_vc)) +
- // 1e-10); scale_cl = min(1,scale_cl); S_vc(:, inputFrameIndex) =
- // (1-scale_cl) * real(inputFrame_vc) + 1j * (1-scale_cl) *
- // imag(inputFrame_vc); %%vc 干声 R_vc(:, inputFrameIndex) =
- // bk_revertant; %%混响
- // %%方法5:
- // 直接使用vc文件,不计算增益,直接相加,rir做平滑,增加下限(rir平滑没问题)
- // CNT = 50;%10;%
- // % st = max(1,inputFrameIndex-CNT);
- // % en = inputFrameIndex;
- // % H_pow = squeeze(mean(H_pow_all(st:en, :, :),1));
- // % newG_R_vc = (sum(previousSFramesPower_vc .* H_pow, 2)) ;
- // H_pow_sm = (1- 1/CNT)*H_pow_sm + (1/CNT)*H_pow;
- // newG_R_vc = (sum(previousSFramesPower_vc .* H_pow_sm, 2)) ;
- // G_R_vc = (1-gainSmoothingFactor_vc).*G_R_vc +
- // gainSmoothingFactor_vc.*newG_R_vc;
- //
- // % vocal_effect = G_R .* inputFrame;
- // % % bk_revertant = min(G_R_vc,vocal_effect);
- // % % bk_revertant = max(bk_revertant,0.2*vocal_effect);
- // % G_R_vc_abs = abs(G_R_vc);
- // % vocal_effect_abs = abs(vocal_effect);
- // % idx_change = G_R_vc_abs > vocal_effect_abs;
- // % G_R_vc(idx_change,:)= vocal_effect(idx_change,:);
- // % idx_change = G_R_vc_abs < 0.2*vocal_effect_abs;
- // % G_R_vc(idx_change,:)= vocal_effect(idx_change,:);
- // bk_revertant = G_R_vc;
- //
- //
- // % S_vc(:, inputFrameIndex) = inputFrame_vc; %%vc 干声
- // % R_vc(:, inputFrameIndex) = bk_revertant; %%混响
- // 方法6:rir做平滑,背景混响(平滑)和当前混响直接相加 (第一版本c的算法)
- // %%%%%当前混响
- // CNT = 50;%10;%
- // H_pow_sm = (1- 1/CNT)*H_pow_sm + (1/CNT)*H_pow;
- // newG_R_vc = (sum(previousSFramesPower_vc .* H_pow_sm, 2)) ;
- // G_R_vc = (1-gainSmoothingFactor).*G_R_vc +
- // gainSmoothingFactor.*newG_R_vc;
- // %%%%%得到backgroud混响
- // vocal_effect = G_R .* inputFrame;
- // vocal_effect_abs = abs(vocal_effect);
- // vocal_effect_sm = vocal_effect_abs;
- // N1 = 10;
- // for ii = 1:length(vocal_effect_abs)
- // st = max(ii-N1,1);
- // en = min(ii+N1,length(vocal_effect_abs));
- // vocal_effect_sm(ii) = mean(vocal_effect_abs(st:en));
- // end
- // vocal_effect_sm_final = vocal_effect_sm .*(vocal_effect ./
- // (vocal_effect_abs+1e-5)); %混响相加,并做限制
- // %%复数谱直接相加,效果不错
- // G_R_vc = G_R_vc + vocal_effect_sm_final;
- //
- // G_R_vc_abs = abs(G_R_vc);
- // vocal_effect_abs = abs(vocal_effect);
- // idx_change = G_R_vc_abs > vocal_effect_abs;
- // G_R_vc(idx_change,:)= vocal_effect(idx_change,:);
- // idx_change = G_R_vc_abs < 0.2*vocal_effect_abs;
- // G_R_vc(idx_change,:)= vocal_effect(idx_change,:);
- // bk_revertant = G_R_vc;
- //
- // scale_cl = sum(abs(bk_revertant)) / (sum(abs(inputFrame_vc)) +
- // 1e-10); scale_cl = min(1,scale_cl); S_vc(:, inputFrameIndex) =
- // (1-scale_cl) * real(inputFrame_vc) + 1j * (1-scale_cl) *
- // imag(inputFrame_vc); %%vc 干声 R_vc(:, inputFrameIndex) =
- // bk_revertant; %%混响
- //
- // %%% 第二版本c的算法
- // CNT = 50;%10;%
- // H_pow_sm = (1- 1/CNT)*H_pow_sm + (1/CNT)*H_pow;
- // % newG_R_vc = (sum(previousSFramesPower_vc .* H_pow_sm, 2)) ;
- // tmp_reverb =(sum(previousSFramesPower_vc .* H_pow_sm, 2));
- // newG_Sxx = 1 - tmp_reverb./ (inputFramePower_vc + tmp_reverb);
- // newG_Sxx = max([newG_Sxx minGain], [], 2);
- // G_Sxx = (1-gainSmoothingFactor).*G_Sxx +
- // gainSmoothingFactor.*newG_Sxx; newG_Rxx = 1 - G_Sxx; G_Rxx =
- // (1-gainSmoothingFactor).*G_Rxx + gainSmoothingFactor.*newG_Rxx;
- // G_R_vc = G_Rxx .* inputFrame;
- //
- // %%%%%平滑后作为基础混响
- // G_R_vc = G_Rxx .* (inputFrame_vc + G_R_vc); %%%gain*混响
- // N1 = 3;
- // G_R_vc_abs = abs(G_R_vc);
- // G_R_vc_sm = G_R_vc_abs;
- // for ii = 1:length(G_R_vc_abs)
- // st = max(ii-N1,1);
- // en = min(ii+N1,length(G_R_vc_abs));
- // G_R_vc_sm(ii) = mean(G_R_vc_abs(st:en));
- // end
- // G_R_vc = G_R_vc_sm .*(G_R_vc ./ (G_R_vc_abs+1e-5));
- // G_R_vc = G_Rxx.*inputFrame_vc + G_R_vc;
- // bk_revertant = G_R_vc;
- //
- // scale_cl = sum(abs(bk_revertant)) / (sum(abs(inputFrame_vc)) +
- // 1e-10); scale_cl = min(1,scale_cl); S_vc(:, inputFrameIndex) =
- // (1-scale_cl) * real(inputFrame_vc) + 1j * (1-scale_cl) *
- // imag(inputFrame_vc); %%vc 干声 R_vc(:, inputFrameIndex) =
- // bk_revertant; %%混响
- // %%%方法8:在方法8的基础上,使用vc计算混响比例,然后在乘以原始比例,加个限制min(1.0,scale)
- // %%%%%% ==》 (能听到环绕声,有拖尾)
+ G_R_vc[k] = M_vc[k + M_vc.size(0) * inputFrameIndex];
+ e_y[k] = rt_hypotd_snf(M_vc[k + M_vc.size(0) * inputFrameIndex].re,
+ M_vc[k + M_vc.size(0) * inputFrameIndex].im);
+ }
+ // %%%方法8_1:第二版本c的算法基础上修改.
// 10;%
if (H_pow_sm.size(0) == H_pow.size(0)) {
loop_ub = H_pow_sm.size(0) * 400;
H_pow_sm.set_size(H_pow_sm.size(0), 400);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- H_pow_sm[b_i] = 0.95 * H_pow_sm[b_i] + 0.05 * H_pow[b_i];
+ for (nx = 0; nx < loop_ub; nx++) {
+ H_pow_sm[nx] = 0.5 * H_pow_sm[nx] + 0.5 * H_pow[nx];
}
} else {
binary_expand_op(H_pow_sm, H_pow);
}
if (previousSFramesPower_vc.size(0) == H_pow_sm.size(0)) {
b_previousSFramesPower.set_size(previousSFramesPower_vc.size(0), 400);
loop_ub = previousSFramesPower_vc.size(0) * 400;
- for (b_i = 0; b_i < loop_ub; b_i++) {
- b_previousSFramesPower[b_i] =
- previousSFramesPower_vc[b_i] * H_pow_sm[b_i];
+ for (nx = 0; nx < loop_ub; nx++) {
+ b_previousSFramesPower[nx] = previousSFramesPower_vc[nx] * H_pow_sm[nx];
}
coder::sum(b_previousSFramesPower, newEstimates);
} else {
binary_expand_op(newEstimates, previousSFramesPower_vc, H_pow_sm);
}
- r.set_size(inputFramePower.size(0));
- loop_ub = inputFramePower.size(0);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- scale_cl = inputFramePower[b_i];
- r[b_i] = scale_cl * scale_cl;
+ b_y.set_size(e_y.size(0));
+ loop_ub = e_y.size(0);
+ for (nx = 0; nx < loop_ub; nx++) {
+ varargin_1 = e_y[nx];
+ b_y[nx] = varargin_1 * varargin_1;
}
- if (r.size(0) == 1) {
- k = newEstimates.size(0);
+ if (b_y.size(0) == 1) {
+ nx = newEstimates.size(0);
} else {
- k = r.size(0);
+ nx = b_y.size(0);
}
- if ((r.size(0) == newEstimates.size(0)) && (newEstimates.size(0) == k)) {
- r1.set_size(newEstimates.size(0), 2);
+ if ((b_y.size(0) == newEstimates.size(0)) && (newEstimates.size(0) == nx)) {
+ r.set_size(newEstimates.size(0), 2);
loop_ub = newEstimates.size(0);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- r1[b_i] = 1.0 - newEstimates[b_i] / (r[b_i] + newEstimates[b_i]);
+ for (nx = 0; nx < loop_ub; nx++) {
+ r[nx] = 1.0 - newEstimates[nx] / (b_y[nx] + newEstimates[nx]);
}
loop_ub = M.size(0);
- for (b_i = 0; b_i < loop_ub; b_i++) {
- r1[b_i + r1.size(0)] = 0.0;
+ for (nx = 0; nx < loop_ub; nx++) {
+ r[nx + r.size(0)] = 0.0;
}
- coder::internal::maximum(r1, r);
+ coder::internal::maximum(r, b_y);
} else {
- binary_expand_op(r, newEstimates, M);
+ binary_expand_op(b_y, newEstimates, M);
}
loop_ub = G_Sxx.size(0);
if (frequencyCount.contents == 1.0) {
- k = G_Sxx.size(0);
+ nx = G_Sxx.size(0);
} else {
- k = static_cast<int>(frequencyCount.contents);
+ nx = static_cast<int>(frequencyCount.contents);
}
if (frequencyCount.contents == 1.0) {
- nx = r.size(0);
+ xblockoffset = b_y.size(0);
} else {
- nx = static_cast<int>(frequencyCount.contents);
+ xblockoffset = static_cast<int>(frequencyCount.contents);
}
- if ((i1 == G_Sxx.size(0)) && (i1 == r.size(0)) && (k == nx)) {
- for (b_i = 0; b_i < loop_ub; b_i++) {
- G_Sxx[b_i] = 0.7 * G_Sxx[b_i] + 0.3 * r[b_i];
+ if ((i1 == G_Sxx.size(0)) && (i1 == b_y.size(0)) && (nx == xblockoffset)) {
+ for (nx = 0; nx < loop_ub; nx++) {
+ G_Sxx[nx] = 0.7 * G_Sxx[nx] + 0.3 * b_y[nx];
}
} else {
- c_binary_expand_op(G_Sxx, frequencyCount, r);
+ c_binary_expand_op(G_Sxx, frequencyCount, b_y);
}
loop_ub = G_Rxx.size(0);
if (frequencyCount.contents == 1.0) {
- k = G_Rxx.size(0);
+ nx = G_Rxx.size(0);
} else {
- k = static_cast<int>(frequencyCount.contents);
+ nx = static_cast<int>(frequencyCount.contents);
}
if (frequencyCount.contents == 1.0) {
- nx = G_Sxx.size(0);
+ xblockoffset = G_Sxx.size(0);
} else {
- nx = static_cast<int>(frequencyCount.contents);
+ xblockoffset = static_cast<int>(frequencyCount.contents);
}
- if ((i1 == G_Rxx.size(0)) && (i1 == G_Sxx.size(0)) && (k == nx)) {
+ if ((i1 == G_Rxx.size(0)) && (i1 == G_Sxx.size(0)) &&
+ (nx == xblockoffset)) {
for (i1 = 0; i1 < loop_ub; i1++) {
G_Rxx[i1] = 0.7 * G_Rxx[i1] + 0.3 * (1.0 - G_Sxx[i1]);
}
} else {
binary_expand_op(G_Rxx, frequencyCount, G_Sxx);
}
+ // G_R_vc = G_Rxx .* inputFrame ;
+ loop_ub = G_Rxx.size(0);
+ if (M_vc.size(0) == 1) {
+ i1 = vocal_reverb.size(0);
+ } else {
+ i1 = M_vc.size(0);
+ }
+ if ((M_vc.size(0) == vocal_reverb.size(0)) && (G_Rxx.size(0) == i1)) {
+ G_R_vc.set_size(G_Rxx.size(0));
+ for (i1 = 0; i1 < loop_ub; i1++) {
+ G_R_vc[i1].re =
+ G_Rxx[i1] * (M_vc[i1 + M_vc.size(0) * inputFrameIndex].re +
+ vocal_reverb[i1].re);
+ G_R_vc[i1].im =
+ G_Rxx[i1] * (M_vc[i1 + M_vc.size(0) * inputFrameIndex].im +
+ vocal_reverb[i1].im);
+ }
+ } else {
+ binary_expand_op(G_R_vc, G_Rxx, M_vc, inputFrameIndex, vocal_reverb);
+ }
// 修正了能量以后copy的vocal混响
// G_R_vc =G_Rxx .* (inputFrame_vc + G_R_vc);
// 混响
// 干声
- // vocal_dry_sm = (1 - dryMagnitudeSmoothingFactor) .* vocal_dry_sm +
- // dryMagnitudeSmoothingFactor.* abs(vocal_dry ); vc_dray_sm = (1 -
- // dryMagnitudeSmoothingFactor) .* vc_dray_sm +
- // dryMagnitudeSmoothingFactor.* abs(inputFrame_vc );
- nx = vocal_reverb.size(0);
- r.set_size(vocal_reverb.size(0));
+ // vc_dray_sm = (1 - dryMagnitudeSmoothingFactor) .* vc_dray_sm +
+ // dryMagnitudeSmoothingFactor.* abs(inputFrame_vc ); vocal_dry_sm = (1
+ // - dryMagnitudeSmoothingFactor) .* vocal_dry_sm +
+ // dryMagnitudeSmoothingFactor.* abs(vocal_dry );
+ // vc_dray_sm = vc_dray_sm + abs(vocal_reverb); %混响大一些
+ // scale = min(1,(vocal_dry_sm./( vc_dray_sm + 1e-8)));
+ // scale = max(min(1,(vc_dray_sm./(vocal_dry_sm + 1e-8))),0.5);
+ // S_vc(:, inputFrameIndex) = (1-scale_cl) * real(inputFrame_vc) + 1j *
+ // (1-scale_cl) * imag(inputFrame_vc); %%vc 干声
+ loop_ub = M_vc.size(0);
+ for (i1 = 0; i1 < loop_ub; i1++) {
+ S_vc[i1 + S_vc.size(0) * inputFrameIndex] =
+ M_vc[i1 + M_vc.size(0) * inputFrameIndex];
+ }
+ nx = G_R_vc.size(0);
+ b_y.set_size(G_R_vc.size(0));
for (k = 0; k < nx; k++) {
- r[k] = rt_hypotd_snf(vocal_reverb[k].re, vocal_reverb[k].im);
+ b_y[k] = rt_hypotd_snf(G_R_vc[k].re, G_R_vc[k].im);
}
nx = vocal_dry.size(0);
newEstimates.set_size(vocal_dry.size(0));
for (k = 0; k < nx; k++) {
newEstimates[k] = rt_hypotd_snf(vocal_dry[k].re, vocal_dry[k].im);
}
- if (inputFramePower.size(0) == 1) {
- i1 = r.size(0);
+ nx = vocal_reverb.size(0);
+ inputFramePower.set_size(vocal_reverb.size(0));
+ for (k = 0; k < nx; k++) {
+ inputFramePower[k] =
+ rt_hypotd_snf(vocal_reverb[k].re, vocal_reverb[k].im);
+ }
+ if (e_y.size(0) == 1) {
+ i1 = b_y.size(0);
} else {
- i1 = inputFramePower.size(0);
+ i1 = e_y.size(0);
}
if (newEstimates.size(0) == 1) {
- k = r.size(0);
+ nx = inputFramePower.size(0);
} else {
- k = newEstimates.size(0);
+ nx = newEstimates.size(0);
}
- if ((inputFramePower.size(0) == r.size(0)) &&
- (newEstimates.size(0) == r.size(0)) && (i1 == k)) {
- r.set_size(inputFramePower.size(0));
- loop_ub = inputFramePower.size(0);
+ if ((e_y.size(0) == b_y.size(0)) &&
+ (newEstimates.size(0) == inputFramePower.size(0)) && (i1 == nx)) {
+ b_y.set_size(e_y.size(0));
+ loop_ub = e_y.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
- varargin_2 = (inputFramePower[i1] + r[i1]) /
- ((newEstimates[i1] + r[i1]) + 1.0E-8);
- r[i1] = std::fmin(1.0, varargin_2);
+ varargin_2 = (e_y[i1] + b_y[i1]) /
+ ((newEstimates[i1] + inputFramePower[i1]) + 1.0E-8);
+ b_y[i1] = std::fmin(1.0, varargin_2);
}
} else {
- binary_expand_op(r, inputFramePower, newEstimates);
- }
- loop_ub = G_Rxx.size(0);
- if (G_Rxx.size(0) == 1) {
- i1 = M.size(0);
- } else {
- i1 = G_Rxx.size(0);
+ binary_expand_op(b_y, e_y, newEstimates, inputFramePower);
}
- if ((G_Rxx.size(0) == M.size(0)) && (i1 == r.size(0))) {
- bk_revertant.set_size(G_Rxx.size(0));
+ if (G_R_vc.size(0) == b_y.size(0)) {
+ loop_ub = G_R_vc.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
- bk_revertant[i1].re =
- r[i1] * (G_Rxx[i1] * M[i1 + M.size(0) * inputFrameIndex].re);
- bk_revertant[i1].im =
- r[i1] * (G_Rxx[i1] * M[i1 + M.size(0) * inputFrameIndex].im);
+ R_vc[i1 + R_vc.size(0) * inputFrameIndex].re = b_y[i1] * G_R_vc[i1].re;
+ R_vc[i1 + R_vc.size(0) * inputFrameIndex].im = b_y[i1] * G_R_vc[i1].im;
}
} else {
- binary_expand_op(bk_revertant, G_Rxx, M, inputFrameIndex, r);
- }
- nx = bk_revertant.size(0);
- newEstimates.set_size(bk_revertant.size(0));
- for (k = 0; k < nx; k++) {
- newEstimates[k] = rt_hypotd_snf(bk_revertant[k].re, bk_revertant[k].im);
- }
- scale_cl = std::fmin(1.0, coder::sum(newEstimates) /
- (coder::sum(inputFramePower) + 1.0E-10));
- varargin_2 = (1.0 - scale_cl) * 0.0;
- loop_ub = M_vc.size(0);
- for (i1 = 0; i1 < loop_ub; i1++) {
- double d;
- d = M_vc[i1 + M_vc.size(0) * inputFrameIndex].im;
- S_vc[i1 + S_vc.size(0) * inputFrameIndex].re =
- (1.0 - scale_cl) * M_vc[i1 + M_vc.size(0) * inputFrameIndex].re +
- varargin_2 * d;
- S_vc[i1 + S_vc.size(0) * inputFrameIndex].im = (1.0 - scale_cl) * d;
- }
- // vc 干声
- loop_ub = bk_revertant.size(0);
- for (i1 = 0; i1 < loop_ub; i1++) {
- R_vc[i1 + R_vc.size(0) * inputFrameIndex] = bk_revertant[i1];
+ binary_expand_op(R_vc, inputFrameIndex, G_R_vc, b_y);
}
// 混响
// Shift all previous frames one column to the right, and insert the
// current frame at the beginning.
- nx = previousSFramesPower_vc.size(0) - 1;
+ xblockoffset = previousSFramesPower_vc.size(0) - 1;
c_previousSFramesPower.set_size(previousSFramesPower_vc.size(0), 399);
for (i1 = 0; i1 < 399; i1++) {
- for (b_i = 0; b_i <= nx; b_i++) {
- c_previousSFramesPower[b_i + c_previousSFramesPower.size(0) * i1] =
- previousSFramesPower_vc[b_i + previousSFramesPower_vc.size(0) * i1];
+ for (nx = 0; nx <= xblockoffset; nx++) {
+ c_previousSFramesPower[nx + c_previousSFramesPower.size(0) * i1] =
+ previousSFramesPower_vc[nx + previousSFramesPower_vc.size(0) * i1];
}
}
loop_ub = c_previousSFramesPower.size(0);
for (i1 = 0; i1 < 399; i1++) {
- for (b_i = 0; b_i < loop_ub; b_i++) {
- previousSFramesPower_vc[b_i +
+ for (nx = 0; nx < loop_ub; nx++) {
+ previousSFramesPower_vc[nx +
previousSFramesPower_vc.size(0) * (i1 + 1)] =
- c_previousSFramesPower[b_i + c_previousSFramesPower.size(0) * i1];
+ c_previousSFramesPower[nx + c_previousSFramesPower.size(0) * i1];
}
}
loop_ub = S_vc.size(0);
- newEstimates.set_size(S_vc.size(0));
+ b_y.set_size(S_vc.size(0));
for (k = 0; k < loop_ub; k++) {
- newEstimates[k] =
- rt_hypotd_snf(S_vc[k + S_vc.size(0) * inputFrameIndex].re,
- S_vc[k + S_vc.size(0) * inputFrameIndex].im);
+ b_y[k] = rt_hypotd_snf(S_vc[k + S_vc.size(0) * inputFrameIndex].re,
+ S_vc[k + S_vc.size(0) * inputFrameIndex].im);
}
- loop_ub = newEstimates.size(0);
+ loop_ub = b_y.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
- scale_cl = newEstimates[i1];
- previousSFramesPower_vc[i1] = scale_cl * scale_cl;
+ varargin_1 = b_y[i1];
+ previousSFramesPower_vc[i1] = varargin_1 * varargin_1;
}
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
// Reconstruct and play dry signal
// dry_vc = zeros(inputLength_vc,1);
// dry_vc(:) = reconstruct(S_vc, window, overlapSamples, inputLength_vc);
// Reconstruct and play reverberant components
reconstruct(&stftWindowSize, &frequencyCount, &frameCount, R_vc, window,
overlapSamples, reverberated_vc);
// Reconstruct and play original reverberant signal using both components
// reverbConstant = 5;
+ for (k = 0; k < 220500; k++) {
+ overlapSamples = signal_vc[k];
+ varargin_1 = reverberated_vc[k] + overlapSamples;
+ reverberated_vc[k] = varargin_1;
+ c_y[k] = std::abs(overlapSamples);
+ d_y[k] = std::abs(varargin_1);
+ }
+ varargin_1 = c_y[0];
+ for (k = 0; k < 1023; k++) {
+ varargin_1 += c_y[k + 1];
+ }
+ for (nx = 0; nx < 215; nx++) {
+ xblockoffset = (nx + 1) << 10;
+ overlapSamples = c_y[xblockoffset];
+ if (nx + 2 == 216) {
+ hi = 340;
+ } else {
+ hi = 1024;
+ }
+ for (k = 2; k <= hi; k++) {
+ overlapSamples += c_y[(xblockoffset + k) - 1];
+ }
+ varargin_1 += overlapSamples;
+ }
+ varargin_2 = d_y[0];
+ for (k = 0; k < 1023; k++) {
+ varargin_2 += d_y[k + 1];
+ }
+ for (nx = 0; nx < 215; nx++) {
+ xblockoffset = (nx + 1) << 10;
+ overlapSamples = d_y[xblockoffset];
+ if (nx + 2 == 216) {
+ hi = 340;
+ } else {
+ hi = 1024;
+ }
+ for (k = 2; k <= hi; k++) {
+ overlapSamples += d_y[(xblockoffset + k) - 1];
+ }
+ varargin_2 += overlapSamples;
+ }
+ overlapSamples = std::fmin(1.0, varargin_1 / (varargin_2 + 0.0001));
for (i = 0; i < 220500; i++) {
- reverberated_vc[i] += signal_vc[i];
+ reverberated_vc[i] *= overlapSamples;
}
+ std::copy(&reverberated_vc[0], &reverberated_vc[220500], &c_y[0]);
+ OverflowLimit(c_y, reverberated_vc);
}
//
// File trailer for dereveb_c.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c.h b/dereverbrate/dereveb_c/dereveb_c.h
index 8da900e..6766615 100644
--- a/dereverbrate/dereveb_c/dereveb_c.h
+++ b/dereverbrate/dereveb_c/dereveb_c.h
@@ -1,28 +1,28 @@
//
// File: dereveb_c.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DEREVEB_C_H
#define DEREVEB_C_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
extern void dereveb_c(const double b_signal[220500],
const double signal_vc[220500], double fs,
const double impulseResponse[264600],
double reverberated_vc[220500]);
#endif
//
// File trailer for dereveb_c.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_data.cpp b/dereverbrate/dereveb_c/dereveb_c_data.cpp
index 26aef6e..66e7093 100644
--- a/dereverbrate/dereveb_c/dereveb_c_data.cpp
+++ b/dereverbrate/dereveb_c/dereveb_c_data.cpp
@@ -1,21 +1,21 @@
//
// File: dereveb_c_data.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "dereveb_c_data.h"
#include "rt_nonfinite.h"
// Variable Definitions
omp_nest_lock_t dereveb_c_nestLockGlobal;
boolean_T isInitialized_dereveb_c{false};
//
// File trailer for dereveb_c_data.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_data.h b/dereverbrate/dereveb_c/dereveb_c_data.h
index b59bf85..c00d58f 100644
--- a/dereverbrate/dereveb_c/dereveb_c_data.h
+++ b/dereverbrate/dereveb_c/dereveb_c_data.h
@@ -1,26 +1,26 @@
//
// File: dereveb_c_data.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DEREVEB_C_DATA_H
#define DEREVEB_C_DATA_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Variable Declarations
extern omp_nest_lock_t dereveb_c_nestLockGlobal;
extern boolean_T isInitialized_dereveb_c;
#endif
//
// File trailer for dereveb_c_data.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_initialize.cpp b/dereverbrate/dereveb_c/dereveb_c_initialize.cpp
index 7aa56d2..f63baeb 100644
--- a/dereverbrate/dereveb_c/dereveb_c_initialize.cpp
+++ b/dereverbrate/dereveb_c/dereveb_c_initialize.cpp
@@ -1,28 +1,28 @@
//
// File: dereveb_c_initialize.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "dereveb_c_initialize.h"
#include "dereveb_c_data.h"
#include "rt_nonfinite.h"
// Function Definitions
//
// Arguments : void
// Return Type : void
//
void dereveb_c_initialize()
{
omp_init_nest_lock(&dereveb_c_nestLockGlobal);
isInitialized_dereveb_c = true;
}
//
// File trailer for dereveb_c_initialize.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_initialize.h b/dereverbrate/dereveb_c/dereveb_c_initialize.h
index 29c2c40..4c47af4 100644
--- a/dereverbrate/dereveb_c/dereveb_c_initialize.h
+++ b/dereverbrate/dereveb_c/dereveb_c_initialize.h
@@ -1,25 +1,25 @@
//
// File: dereveb_c_initialize.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DEREVEB_C_INITIALIZE_H
#define DEREVEB_C_INITIALIZE_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
extern void dereveb_c_initialize();
#endif
//
// File trailer for dereveb_c_initialize.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_rtw.mk b/dereverbrate/dereveb_c/dereveb_c_rtw.mk
index 32c41f0..639fe6c 100644
--- a/dereverbrate/dereveb_c/dereveb_c_rtw.mk
+++ b/dereverbrate/dereveb_c/dereveb_c_rtw.mk
@@ -1,475 +1,479 @@
###########################################################################
## Makefile generated for component 'dereveb_c'.
##
## Makefile : dereveb_c_rtw.mk
-## Generated on : Tue Mar 28 21:20:32 2023
+## Generated on : Fri Mar 31 11:35:11 2023
## Final product: ./dereveb_c.a
## Product type : static-library
##
###########################################################################
###########################################################################
## MACROS
###########################################################################
# Macro Descriptions:
# PRODUCT_NAME Name of the system to build
# MAKEFILE Name of this makefile
# MODELLIB Static library target
PRODUCT_NAME = dereveb_c
MAKEFILE = dereveb_c_rtw.mk
MATLAB_ROOT = /Applications/MATLAB_R2021b.app
MATLAB_BIN = /Applications/MATLAB_R2021b.app/bin
MATLAB_ARCH_BIN = $(MATLAB_BIN)/maci64
START_DIR = /Volumes/T7_2/starmaker_files/音效提取算法/dereverberate
TGT_FCN_LIB = ISO_C++11
SOLVER_OBJ =
CLASSIC_INTERFACE = 0
MODEL_HAS_DYNAMICALLY_LOADED_SFCNS =
RELATIVE_PATH_TO_ANCHOR = ../../..
C_STANDARD_OPTS = -fno-common -fexceptions
CPP_STANDARD_OPTS = -std=c++14 -fno-common -fexceptions
MODELLIB = dereveb_c.a
###########################################################################
## TOOLCHAIN SPECIFICATIONS
###########################################################################
# Toolchain Name: Clang v3.1 | gmake (64-bit Mac)
# Supported Version(s): 3.1
# ToolchainInfo Version: 2021b
# Specification Revision: 1.0
#
#-------------------------------------------
# Macros assumed to be defined elsewhere
#-------------------------------------------
# C_STANDARD_OPTS
# CPP_STANDARD_OPTS
#-----------
# MACROS
#-----------
ARCHS = x86_64
XCODE_SDK_VER = $(shell perl $(MATLAB_ROOT)/rtw/c/tools/macsdkver.pl)
XCODE_SDK = MacOSX$(XCODE_SDK_VER).sdk
XCODE_DEVEL_DIR = $(shell xcode-select -print-path)
XCODE_SDK_ROOT = $(XCODE_DEVEL_DIR)/Platforms/MacOSX.platform/Developer/SDKs/$(XCODE_SDK)
TOOLCHAIN_SRCS =
TOOLCHAIN_INCS =
TOOLCHAIN_LIBS =
#------------------------
# BUILD TOOL COMMANDS
#------------------------
# C Compiler: Clang C Compiler
CC = xcrun clang
# Linker: Clang Linker
LD = xcrun clang++
# C++ Compiler: Clang C++ Compiler
CPP = xcrun clang++
# C++ Linker: Clang C++ Linker
CPP_LD = xcrun clang++
# Archiver: Clang Archiver
AR = xcrun ar
# MEX Tool: MEX Tool
MEX_PATH = $(MATLAB_ARCH_BIN)
MEX = "$(MEX_PATH)/mex"
# Download: Download
DOWNLOAD =
# Execute: Execute
EXECUTE = $(PRODUCT)
# Builder: GMAKE Utility
MAKE_PATH = %MATLAB%/bin/maci64
MAKE = "$(MAKE_PATH)/gmake"
#-------------------------
# Directives/Utilities
#-------------------------
CDEBUG = -g
C_OUTPUT_FLAG = -o
LDDEBUG = -g
OUTPUT_FLAG = -o
CPPDEBUG = -g
CPP_OUTPUT_FLAG = -o
CPPLDDEBUG = -g
OUTPUT_FLAG = -o
ARDEBUG =
STATICLIB_OUTPUT_FLAG =
MEX_DEBUG = -g
RM = @rm -f
ECHO = @echo
MV = @mv
RUN =
#--------------------------------------
# "Faster Runs" Build Configuration
#--------------------------------------
ARFLAGS = ruvs
CFLAGS = -c -isysroot $(XCODE_SDK_ROOT) -arch $(ARCHS) $(C_STANDARD_OPTS) -mmacosx-version-min=10.15 \
-O3
CPPFLAGS = -c -isysroot $(XCODE_SDK_ROOT) -arch $(ARCHS) $(CPP_STANDARD_OPTS) -mmacosx-version-min=10.15 \
-O3
CPP_LDFLAGS = -arch $(ARCHS) -isysroot $(XCODE_SDK_ROOT) -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/$(RELATIVE_PATH_TO_ANCHOR)
CPP_SHAREDLIB_LDFLAGS = -dynamiclib -install_name @rpath/$(notdir $(PRODUCT)) -isysroot $(XCODE_SDK_ROOT) \
-Wl,$(LD_NAMESPACE) $(LD_UNDEFS)
DOWNLOAD_FLAGS =
EXECUTE_FLAGS =
LDFLAGS = -arch $(ARCHS) -isysroot $(XCODE_SDK_ROOT) -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/$(RELATIVE_PATH_TO_ANCHOR)
MEX_CPPFLAGS =
MEX_CPPLDFLAGS =
MEX_CFLAGS =
MEX_LDFLAGS =
MAKE_FLAGS = -f $(MAKEFILE)
SHAREDLIB_LDFLAGS = -dynamiclib -install_name @rpath/$(notdir $(PRODUCT)) -isysroot $(XCODE_SDK_ROOT) \
-Wl,$(LD_NAMESPACE) $(LD_UNDEFS)
###########################################################################
## OUTPUT INFO
###########################################################################
PRODUCT = ./dereveb_c.a
PRODUCT_TYPE = "static-library"
BUILD_TYPE = "Static Library"
###########################################################################
## INCLUDE PATHS
###########################################################################
INCLUDES_BUILDINFO = -I$(START_DIR)/codegen/lib/dereveb_c -I$(START_DIR) -I$(MATLAB_ROOT)/extern/include
INCLUDES = $(INCLUDES_BUILDINFO)
###########################################################################
## DEFINES
###########################################################################
DEFINES_CUSTOM =
DEFINES_STANDARD = -DMODEL=dereveb_c
DEFINES = $(DEFINES_CUSTOM) $(DEFINES_STANDARD)
###########################################################################
## SOURCE FILES
###########################################################################
-SRCS = $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_data.cpp $(START_DIR)/codegen/lib/dereveb_c/rt_nonfinite.cpp $(START_DIR)/codegen/lib/dereveb_c/rtGetNaN.cpp $(START_DIR)/codegen/lib/dereveb_c/rtGetInf.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_initialize.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_terminate.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c.cpp $(START_DIR)/codegen/lib/dereveb_c/hann.cpp $(START_DIR)/codegen/lib/dereveb_c/iseven.cpp $(START_DIR)/codegen/lib/dereveb_c/gencoswin.cpp $(START_DIR)/codegen/lib/dereveb_c/spectrogram.cpp $(START_DIR)/codegen/lib/dereveb_c/hamming.cpp $(START_DIR)/codegen/lib/dereveb_c/ixfun.cpp $(START_DIR)/codegen/lib/dereveb_c/sum.cpp $(START_DIR)/codegen/lib/dereveb_c/minOrMax.cpp $(START_DIR)/codegen/lib/dereveb_c/ifft.cpp $(START_DIR)/codegen/lib/dereveb_c/computeDFT.cpp $(START_DIR)/codegen/lib/dereveb_c/welchparse.cpp $(START_DIR)/codegen/lib/dereveb_c/pspectrogram.cpp $(START_DIR)/codegen/lib/dereveb_c/div.cpp $(START_DIR)/codegen/lib/dereveb_c/unsafeSxfun.cpp $(START_DIR)/codegen/lib/dereveb_c/FFTImplementationCallback.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_rtwutil.cpp
+SRCS = $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_data.cpp $(START_DIR)/codegen/lib/dereveb_c/rt_nonfinite.cpp $(START_DIR)/codegen/lib/dereveb_c/rtGetNaN.cpp $(START_DIR)/codegen/lib/dereveb_c/rtGetInf.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_initialize.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_terminate.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c.cpp $(START_DIR)/codegen/lib/dereveb_c/hann.cpp $(START_DIR)/codegen/lib/dereveb_c/iseven.cpp $(START_DIR)/codegen/lib/dereveb_c/gencoswin.cpp $(START_DIR)/codegen/lib/dereveb_c/spectrogram.cpp $(START_DIR)/codegen/lib/dereveb_c/hamming.cpp $(START_DIR)/codegen/lib/dereveb_c/ixfun.cpp $(START_DIR)/codegen/lib/dereveb_c/sum.cpp $(START_DIR)/codegen/lib/dereveb_c/minOrMax.cpp $(START_DIR)/codegen/lib/dereveb_c/ifft.cpp $(START_DIR)/codegen/lib/dereveb_c/OverflowLimit.cpp $(START_DIR)/codegen/lib/dereveb_c/computeDFT.cpp $(START_DIR)/codegen/lib/dereveb_c/welchparse.cpp $(START_DIR)/codegen/lib/dereveb_c/pspectrogram.cpp $(START_DIR)/codegen/lib/dereveb_c/div.cpp $(START_DIR)/codegen/lib/dereveb_c/unsafeSxfun.cpp $(START_DIR)/codegen/lib/dereveb_c/FFTImplementationCallback.cpp $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_rtwutil.cpp
ALL_SRCS = $(SRCS)
###########################################################################
## OBJECTS
###########################################################################
-OBJS = dereveb_c_data.o rt_nonfinite.o rtGetNaN.o rtGetInf.o dereveb_c_initialize.o dereveb_c_terminate.o dereveb_c.o hann.o iseven.o gencoswin.o spectrogram.o hamming.o ixfun.o sum.o minOrMax.o ifft.o computeDFT.o welchparse.o pspectrogram.o div.o unsafeSxfun.o FFTImplementationCallback.o dereveb_c_rtwutil.o
+OBJS = dereveb_c_data.o rt_nonfinite.o rtGetNaN.o rtGetInf.o dereveb_c_initialize.o dereveb_c_terminate.o dereveb_c.o hann.o iseven.o gencoswin.o spectrogram.o hamming.o ixfun.o sum.o minOrMax.o ifft.o OverflowLimit.o computeDFT.o welchparse.o pspectrogram.o div.o unsafeSxfun.o FFTImplementationCallback.o dereveb_c_rtwutil.o
ALL_OBJS = $(OBJS)
###########################################################################
## PREBUILT OBJECT FILES
###########################################################################
PREBUILT_OBJS =
###########################################################################
## LIBRARIES
###########################################################################
LIBS =
###########################################################################
## SYSTEM LIBRARIES
###########################################################################
SYSTEM_LIBS = -L"$(MATLAB_ROOT)/sys/os/maci64" -lm -lstdc++ -liomp5
###########################################################################
## ADDITIONAL TOOLCHAIN FLAGS
###########################################################################
#---------------
# C Compiler
#---------------
CFLAGS_OPTS = -Xpreprocessor -fopenmp -I/Applications/MATLAB_R2021b.app/toolbox/eml/externalDependency/omp/maci64/include -DOpenMP_omp_LIBRARY=/Applications/MATLAB_R2021b.app/sys/os/maci64/libiomp5.dylib
CFLAGS_BASIC = $(DEFINES) $(INCLUDES)
CFLAGS += $(CFLAGS_OPTS) $(CFLAGS_BASIC)
#-----------------
# C++ Compiler
#-----------------
CPPFLAGS_OPTS = -Xpreprocessor -fopenmp -I/Applications/MATLAB_R2021b.app/toolbox/eml/externalDependency/omp/maci64/include -DOpenMP_omp_LIBRARY=/Applications/MATLAB_R2021b.app/sys/os/maci64/libiomp5.dylib
CPPFLAGS_BASIC = $(DEFINES) $(INCLUDES)
CPPFLAGS += $(CPPFLAGS_OPTS) $(CPPFLAGS_BASIC)
#---------------
# C++ Linker
#---------------
CPP_LDFLAGS_ = -Wl,-rpath,$(MATLAB_ROOT)/sys/os/$(ARCH)/
CPP_LDFLAGS += $(CPP_LDFLAGS_)
#------------------------------
# C++ Shared Library Linker
#------------------------------
CPP_SHAREDLIB_LDFLAGS_ = -Wl,-rpath,$(MATLAB_ROOT)/sys/os/$(ARCH)/
CPP_SHAREDLIB_LDFLAGS += $(CPP_SHAREDLIB_LDFLAGS_)
#-----------
# Linker
#-----------
LDFLAGS_ = -Wl,-rpath,$(MATLAB_ROOT)/sys/os/$(ARCH)/
LDFLAGS += $(LDFLAGS_)
#--------------------------
# Shared Library Linker
#--------------------------
SHAREDLIB_LDFLAGS_ = -Wl,-rpath,$(MATLAB_ROOT)/sys/os/$(ARCH)/
SHAREDLIB_LDFLAGS += $(SHAREDLIB_LDFLAGS_)
###########################################################################
## INLINED COMMANDS
###########################################################################
###########################################################################
## PHONY TARGETS
###########################################################################
.PHONY : all build clean info prebuild download execute
all : build
@echo "### Successfully generated all binary outputs."
build : prebuild $(PRODUCT)
prebuild :
download : $(PRODUCT)
execute : download
###########################################################################
## FINAL TARGET
###########################################################################
#---------------------------------
# Create a static library
#---------------------------------
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS)
@echo "### Creating static library "$(PRODUCT)" ..."
$(AR) $(ARFLAGS) $(PRODUCT) $(OBJS)
@echo "### Created: $(PRODUCT)"
###########################################################################
## INTERMEDIATE TARGETS
###########################################################################
#---------------------
# SOURCE-TO-OBJECT
#---------------------
%.o : %.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : %.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : $(START_DIR)/codegen/lib/dereveb_c/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : $(START_DIR)/codegen/lib/dereveb_c/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : $(START_DIR)/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : $(START_DIR)/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
dereveb_c_data.o : $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_data.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rt_nonfinite.o : $(START_DIR)/codegen/lib/dereveb_c/rt_nonfinite.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rtGetNaN.o : $(START_DIR)/codegen/lib/dereveb_c/rtGetNaN.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rtGetInf.o : $(START_DIR)/codegen/lib/dereveb_c/rtGetInf.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
dereveb_c_initialize.o : $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_initialize.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
dereveb_c_terminate.o : $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_terminate.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
dereveb_c.o : $(START_DIR)/codegen/lib/dereveb_c/dereveb_c.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
hann.o : $(START_DIR)/codegen/lib/dereveb_c/hann.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
iseven.o : $(START_DIR)/codegen/lib/dereveb_c/iseven.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
gencoswin.o : $(START_DIR)/codegen/lib/dereveb_c/gencoswin.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
spectrogram.o : $(START_DIR)/codegen/lib/dereveb_c/spectrogram.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
hamming.o : $(START_DIR)/codegen/lib/dereveb_c/hamming.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
ixfun.o : $(START_DIR)/codegen/lib/dereveb_c/ixfun.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
sum.o : $(START_DIR)/codegen/lib/dereveb_c/sum.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
minOrMax.o : $(START_DIR)/codegen/lib/dereveb_c/minOrMax.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
ifft.o : $(START_DIR)/codegen/lib/dereveb_c/ifft.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
+OverflowLimit.o : $(START_DIR)/codegen/lib/dereveb_c/OverflowLimit.cpp
+ $(CPP) $(CPPFLAGS) -o "$@" "$<"
+
+
computeDFT.o : $(START_DIR)/codegen/lib/dereveb_c/computeDFT.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
welchparse.o : $(START_DIR)/codegen/lib/dereveb_c/welchparse.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
pspectrogram.o : $(START_DIR)/codegen/lib/dereveb_c/pspectrogram.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
div.o : $(START_DIR)/codegen/lib/dereveb_c/div.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
unsafeSxfun.o : $(START_DIR)/codegen/lib/dereveb_c/unsafeSxfun.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
FFTImplementationCallback.o : $(START_DIR)/codegen/lib/dereveb_c/FFTImplementationCallback.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
dereveb_c_rtwutil.o : $(START_DIR)/codegen/lib/dereveb_c/dereveb_c_rtwutil.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
###########################################################################
## DEPENDENCIES
###########################################################################
$(ALL_OBJS) : rtw_proj.tmw $(MAKEFILE)
###########################################################################
## MISCELLANEOUS TARGETS
###########################################################################
info :
@echo "### PRODUCT = $(PRODUCT)"
@echo "### PRODUCT_TYPE = $(PRODUCT_TYPE)"
@echo "### BUILD_TYPE = $(BUILD_TYPE)"
@echo "### INCLUDES = $(INCLUDES)"
@echo "### DEFINES = $(DEFINES)"
@echo "### ALL_SRCS = $(ALL_SRCS)"
@echo "### ALL_OBJS = $(ALL_OBJS)"
@echo "### LIBS = $(LIBS)"
@echo "### MODELREF_LIBS = $(MODELREF_LIBS)"
@echo "### SYSTEM_LIBS = $(SYSTEM_LIBS)"
@echo "### TOOLCHAIN_LIBS = $(TOOLCHAIN_LIBS)"
@echo "### CFLAGS = $(CFLAGS)"
@echo "### LDFLAGS = $(LDFLAGS)"
@echo "### SHAREDLIB_LDFLAGS = $(SHAREDLIB_LDFLAGS)"
@echo "### CPPFLAGS = $(CPPFLAGS)"
@echo "### CPP_LDFLAGS = $(CPP_LDFLAGS)"
@echo "### CPP_SHAREDLIB_LDFLAGS = $(CPP_SHAREDLIB_LDFLAGS)"
@echo "### ARFLAGS = $(ARFLAGS)"
@echo "### MEX_CFLAGS = $(MEX_CFLAGS)"
@echo "### MEX_CPPFLAGS = $(MEX_CPPFLAGS)"
@echo "### MEX_LDFLAGS = $(MEX_LDFLAGS)"
@echo "### MEX_CPPLDFLAGS = $(MEX_CPPLDFLAGS)"
@echo "### DOWNLOAD_FLAGS = $(DOWNLOAD_FLAGS)"
@echo "### EXECUTE_FLAGS = $(EXECUTE_FLAGS)"
@echo "### MAKE_FLAGS = $(MAKE_FLAGS)"
clean :
$(ECHO) "### Deleting all derived files..."
$(RM) $(PRODUCT)
$(RM) $(ALL_OBJS)
$(ECHO) "### Deleted all derived files."
diff --git a/dereverbrate/dereveb_c/dereveb_c_rtwutil.cpp b/dereverbrate/dereveb_c/dereveb_c_rtwutil.cpp
index 86fe70d..4d66c50 100644
--- a/dereverbrate/dereveb_c/dereveb_c_rtwutil.cpp
+++ b/dereverbrate/dereveb_c/dereveb_c_rtwutil.cpp
@@ -1,89 +1,89 @@
//
// File: dereveb_c_rtwutil.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "dereveb_c_rtwutil.h"
#include "rt_nonfinite.h"
#include <cfloat>
#include <cmath>
// Function Definitions
//
// Arguments : int numerator
// int denominator
// Return Type : int
//
int div_s32_floor(int numerator, int denominator)
{
int quotient;
if (denominator == 0) {
if (numerator >= 0) {
quotient = MAX_int32_T;
} else {
quotient = MIN_int32_T;
}
} else {
unsigned int absDenominator;
unsigned int absNumerator;
unsigned int tempAbsQuotient;
boolean_T quotientNeedsNegation;
if (numerator < 0) {
absNumerator = ~static_cast<unsigned int>(numerator) + 1U;
} else {
absNumerator = static_cast<unsigned int>(numerator);
}
if (denominator < 0) {
absDenominator = ~static_cast<unsigned int>(denominator) + 1U;
} else {
absDenominator = static_cast<unsigned int>(denominator);
}
quotientNeedsNegation = ((numerator < 0) != (denominator < 0));
tempAbsQuotient = absNumerator / absDenominator;
if (quotientNeedsNegation) {
absNumerator %= absDenominator;
if (absNumerator > 0U) {
tempAbsQuotient++;
}
quotient = -static_cast<int>(tempAbsQuotient);
} else {
quotient = static_cast<int>(tempAbsQuotient);
}
}
return quotient;
}
//
// Arguments : double u0
// double u1
// Return Type : double
//
double rt_remd_snf(double u0, double u1)
{
double y;
if (std::isnan(u0) || std::isnan(u1) || std::isinf(u0)) {
y = rtNaN;
} else if (std::isinf(u1)) {
y = u0;
} else if ((u1 != 0.0) && (u1 != std::trunc(u1))) {
double q;
q = std::abs(u0 / u1);
if (!(std::abs(q - std::floor(q + 0.5)) > DBL_EPSILON * q)) {
y = 0.0 * u0;
} else {
y = std::fmod(u0, u1);
}
} else {
y = std::fmod(u0, u1);
}
return y;
}
//
// File trailer for dereveb_c_rtwutil.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_rtwutil.h b/dereverbrate/dereveb_c/dereveb_c_rtwutil.h
index 9de1959..2b47d78 100644
--- a/dereverbrate/dereveb_c/dereveb_c_rtwutil.h
+++ b/dereverbrate/dereveb_c/dereveb_c_rtwutil.h
@@ -1,27 +1,27 @@
//
// File: dereveb_c_rtwutil.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DEREVEB_C_RTWUTIL_H
#define DEREVEB_C_RTWUTIL_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
extern int div_s32_floor(int numerator, int denominator);
extern double rt_remd_snf(double u0, double u1);
#endif
//
// File trailer for dereveb_c_rtwutil.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_terminate.cpp b/dereverbrate/dereveb_c/dereveb_c_terminate.cpp
index 317b83f..b0dc77a 100644
--- a/dereverbrate/dereveb_c/dereveb_c_terminate.cpp
+++ b/dereverbrate/dereveb_c/dereveb_c_terminate.cpp
@@ -1,28 +1,28 @@
//
// File: dereveb_c_terminate.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "dereveb_c_terminate.h"
#include "dereveb_c_data.h"
#include "rt_nonfinite.h"
// Function Definitions
//
// Arguments : void
// Return Type : void
//
void dereveb_c_terminate()
{
omp_destroy_nest_lock(&dereveb_c_nestLockGlobal);
isInitialized_dereveb_c = false;
}
//
// File trailer for dereveb_c_terminate.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_terminate.h b/dereverbrate/dereveb_c/dereveb_c_terminate.h
index 898ed28..399445a 100644
--- a/dereverbrate/dereveb_c/dereveb_c_terminate.h
+++ b/dereverbrate/dereveb_c/dereveb_c_terminate.h
@@ -1,25 +1,25 @@
//
// File: dereveb_c_terminate.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DEREVEB_C_TERMINATE_H
#define DEREVEB_C_TERMINATE_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
extern void dereveb_c_terminate();
#endif
//
// File trailer for dereveb_c_terminate.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/dereveb_c_types.h b/dereverbrate/dereveb_c/dereveb_c_types.h
index 535ed01..1669ce9 100644
--- a/dereverbrate/dereveb_c/dereveb_c_types.h
+++ b/dereverbrate/dereveb_c/dereveb_c_types.h
@@ -1,20 +1,20 @@
//
// File: dereveb_c_types.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DEREVEB_C_TYPES_H
#define DEREVEB_C_TYPES_H
// Include Files
#include "rtwtypes.h"
#define MAX_THREADS omp_get_max_threads()
#endif
//
// File trailer for dereveb_c_types.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/div.cpp b/dereverbrate/dereveb_c/div.cpp
index 329b7db..ed37fa1 100644
--- a/dereverbrate/dereveb_c/div.cpp
+++ b/dereverbrate/dereveb_c/div.cpp
@@ -1,56 +1,56 @@
//
// File: div.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "div.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
// Function Definitions
//
// Arguments : coder::array<double, 1U> &newEstimates
// const coder::array<double, 1U> &inputFramePower
// const coder::array<double, 2U> &previousMFramesPower
// int blockIndex
// Return Type : void
//
void binary_expand_op(coder::array<double, 1U> &newEstimates,
const coder::array<double, 1U> &inputFramePower,
const coder::array<double, 2U> &previousMFramesPower,
int blockIndex)
{
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
i = previousMFramesPower.size(0);
if (i == 1) {
stride_0_0 = inputFramePower.size(0);
} else {
stride_0_0 = i;
}
newEstimates.set_size(stride_0_0);
stride_0_0 = (inputFramePower.size(0) != 1);
stride_1_0 = (i != 1);
if (i == 1) {
loop_ub = inputFramePower.size(0);
} else {
loop_ub = i;
}
for (i = 0; i < loop_ub; i++) {
newEstimates[i] =
inputFramePower[i * stride_0_0] /
previousMFramesPower[i * stride_1_0 +
previousMFramesPower.size(0) * blockIndex];
}
}
//
// File trailer for div.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/div.h b/dereverbrate/dereveb_c/div.h
index da1b9c2..eef0fde 100644
--- a/dereverbrate/dereveb_c/div.h
+++ b/dereverbrate/dereveb_c/div.h
@@ -1,29 +1,29 @@
//
// File: div.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef DIV_H
#define DIV_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
void binary_expand_op(coder::array<double, 1U> &newEstimates,
const coder::array<double, 1U> &inputFramePower,
const coder::array<double, 2U> &previousMFramesPower,
int blockIndex);
#endif
//
// File trailer for div.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/gencoswin.cpp b/dereverbrate/dereveb_c/gencoswin.cpp
index bd5fe8c..2d3e99f 100644
--- a/dereverbrate/dereveb_c/gencoswin.cpp
+++ b/dereverbrate/dereveb_c/gencoswin.cpp
@@ -1,104 +1,104 @@
//
// File: gencoswin.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "gencoswin.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : double m
// double n
// ::coder::array<double, 1U> &w
// Return Type : void
//
namespace coder {
void b_calc_window(double m, double n, ::coder::array<double, 1U> &w)
{
array<double, 2U> y;
int k;
int nx;
if (std::isnan(m - 1.0)) {
y.set_size(1, 1);
y[0] = rtNaN;
} else if (m - 1.0 < 0.0) {
y.set_size(1, 0);
} else if (std::isinf(m - 1.0) && (0.0 == m - 1.0)) {
y.set_size(1, 1);
y[0] = rtNaN;
} else {
nx = static_cast<int>(std::floor(m - 1.0));
y.set_size(1, nx + 1);
for (k = 0; k <= nx; k++) {
y[k] = k;
}
}
w.set_size(y.size(1));
nx = y.size(1);
for (k = 0; k < nx; k++) {
w[k] = 6.2831853071795862 * (y[k] / (n - 1.0));
}
nx = w.size(0);
for (k = 0; k < nx; k++) {
w[k] = std::cos(w[k]);
}
nx = w.size(0);
for (k = 0; k < nx; k++) {
w[k] = 0.54 - 0.46 * w[k];
}
}
//
// Arguments : double m
// double n
// ::coder::array<double, 1U> &w
// Return Type : void
//
void calc_window(double m, double n, ::coder::array<double, 1U> &w)
{
array<double, 2U> y;
int k;
int nx;
if (std::isnan(m - 1.0)) {
y.set_size(1, 1);
y[0] = rtNaN;
} else if (m - 1.0 < 0.0) {
y.set_size(1, 0);
} else if (std::isinf(m - 1.0) && (0.0 == m - 1.0)) {
y.set_size(1, 1);
y[0] = rtNaN;
} else {
nx = static_cast<int>(std::floor(m - 1.0));
y.set_size(1, nx + 1);
for (k = 0; k <= nx; k++) {
y[k] = k;
}
}
w.set_size(y.size(1));
nx = y.size(1);
for (k = 0; k < nx; k++) {
w[k] = 6.2831853071795862 * (y[k] / (n - 1.0));
}
nx = w.size(0);
for (k = 0; k < nx; k++) {
w[k] = std::cos(w[k]);
}
nx = w.size(0);
for (k = 0; k < nx; k++) {
w[k] = 0.5 - 0.5 * w[k];
}
}
} // namespace coder
//
// File trailer for gencoswin.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/gencoswin.h b/dereverbrate/dereveb_c/gencoswin.h
index 0671c6b..14546c5 100644
--- a/dereverbrate/dereveb_c/gencoswin.h
+++ b/dereverbrate/dereveb_c/gencoswin.h
@@ -1,31 +1,31 @@
//
// File: gencoswin.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef GENCOSWIN_H
#define GENCOSWIN_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void b_calc_window(double m, double n, ::coder::array<double, 1U> &w);
void calc_window(double m, double n, ::coder::array<double, 1U> &w);
} // namespace coder
#endif
//
// File trailer for gencoswin.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/hamming.cpp b/dereverbrate/dereveb_c/hamming.cpp
index f637f06..aa8c332 100644
--- a/dereverbrate/dereveb_c/hamming.cpp
+++ b/dereverbrate/dereveb_c/hamming.cpp
@@ -1,116 +1,116 @@
//
// File: hamming.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "hamming.h"
#include "dereveb_c_rtwutil.h"
#include "gencoswin.h"
#include "iseven.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : double varargin_1
// ::coder::array<double, 1U> &w
// Return Type : void
//
namespace coder {
void hamming(double varargin_1, ::coder::array<double, 1U> &w)
{
array<double, 1U> b_w;
double L;
int i;
int trivialwin;
int w_size;
signed char w_data;
w_size = 1;
w_data = 0;
trivialwin = 0;
if (varargin_1 == std::floor(varargin_1)) {
L = varargin_1;
} else {
L = std::round(varargin_1);
}
if (L == 0.0) {
w_size = 0;
trivialwin = 1;
} else if (L == 1.0) {
w_data = 1;
trivialwin = 1;
}
w.set_size(w_size);
for (i = 0; i < w_size; i++) {
w[0] = w_data;
}
if (trivialwin == 0) {
if (iseven(L)) {
int i1;
int loop_ub;
b_calc_window(L / 2.0, L, w);
if (1 > w.size(0)) {
i = 0;
w_size = 1;
i1 = -1;
} else {
i = w.size(0) - 1;
w_size = -1;
i1 = 0;
}
trivialwin = div_s32_floor(i1 - i, w_size);
b_w.set_size((w.size(0) + trivialwin) + 1);
loop_ub = w.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
b_w[i1] = w[i1];
}
for (i1 = 0; i1 <= trivialwin; i1++) {
b_w[i1 + w.size(0)] = w[i + w_size * i1];
}
w.set_size(b_w.size(0));
trivialwin = b_w.size(0);
for (i = 0; i < trivialwin; i++) {
w[i] = b_w[i];
}
} else {
int i1;
int loop_ub;
b_calc_window((L + 1.0) / 2.0, L, w);
if (1 > w.size(0) - 1) {
i = 0;
w_size = 1;
i1 = -1;
} else {
i = w.size(0) - 2;
w_size = -1;
i1 = 0;
}
trivialwin = div_s32_floor(i1 - i, w_size);
b_w.set_size((w.size(0) + trivialwin) + 1);
loop_ub = w.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
b_w[i1] = w[i1];
}
for (i1 = 0; i1 <= trivialwin; i1++) {
b_w[i1 + w.size(0)] = w[i + w_size * i1];
}
w.set_size(b_w.size(0));
trivialwin = b_w.size(0);
for (i = 0; i < trivialwin; i++) {
w[i] = b_w[i];
}
}
}
}
} // namespace coder
//
// File trailer for hamming.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/hamming.h b/dereverbrate/dereveb_c/hamming.h
index 44c49e3..292238f 100644
--- a/dereverbrate/dereveb_c/hamming.h
+++ b/dereverbrate/dereveb_c/hamming.h
@@ -1,29 +1,29 @@
//
// File: hamming.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef HAMMING_H
#define HAMMING_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void hamming(double varargin_1, ::coder::array<double, 1U> &w);
}
#endif
//
// File trailer for hamming.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/hann.cpp b/dereverbrate/dereveb_c/hann.cpp
index 21f76f4..bdcea75 100644
--- a/dereverbrate/dereveb_c/hann.cpp
+++ b/dereverbrate/dereveb_c/hann.cpp
@@ -1,116 +1,116 @@
//
// File: hann.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "hann.h"
#include "dereveb_c_rtwutil.h"
#include "gencoswin.h"
#include "iseven.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : double varargin_1
// ::coder::array<double, 1U> &w
// Return Type : void
//
namespace coder {
void hann(double varargin_1, ::coder::array<double, 1U> &w)
{
array<double, 1U> b_w;
double L;
int i;
int trivialwin;
int w_size;
signed char w_data;
w_size = 1;
w_data = 0;
trivialwin = 0;
if (varargin_1 == std::floor(varargin_1)) {
L = varargin_1;
} else {
L = std::round(varargin_1);
}
if (L == 0.0) {
w_size = 0;
trivialwin = 1;
} else if (L == 1.0) {
w_data = 1;
trivialwin = 1;
}
w.set_size(w_size);
for (i = 0; i < w_size; i++) {
w[0] = w_data;
}
if (trivialwin == 0) {
if (iseven(L + 1.0)) {
int i1;
int loop_ub;
calc_window((L + 1.0) / 2.0, L + 1.0, w);
if (2 > w.size(0)) {
i = 0;
w_size = 1;
i1 = -1;
} else {
i = w.size(0) - 1;
w_size = -1;
i1 = 1;
}
trivialwin = div_s32_floor(i1 - i, w_size);
b_w.set_size((w.size(0) + trivialwin) + 1);
loop_ub = w.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
b_w[i1] = w[i1];
}
for (i1 = 0; i1 <= trivialwin; i1++) {
b_w[i1 + w.size(0)] = w[i + w_size * i1];
}
w.set_size(b_w.size(0));
trivialwin = b_w.size(0);
for (i = 0; i < trivialwin; i++) {
w[i] = b_w[i];
}
} else {
int i1;
int loop_ub;
calc_window(((L + 1.0) + 1.0) / 2.0, L + 1.0, w);
if (2 > w.size(0) - 1) {
i = 0;
w_size = 1;
i1 = -1;
} else {
i = w.size(0) - 2;
w_size = -1;
i1 = 1;
}
trivialwin = div_s32_floor(i1 - i, w_size);
b_w.set_size((w.size(0) + trivialwin) + 1);
loop_ub = w.size(0);
for (i1 = 0; i1 < loop_ub; i1++) {
b_w[i1] = w[i1];
}
for (i1 = 0; i1 <= trivialwin; i1++) {
b_w[i1 + w.size(0)] = w[i + w_size * i1];
}
w.set_size(b_w.size(0));
trivialwin = b_w.size(0);
for (i = 0; i < trivialwin; i++) {
w[i] = b_w[i];
}
}
}
}
} // namespace coder
//
// File trailer for hann.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/hann.h b/dereverbrate/dereveb_c/hann.h
index e2cfbee..8846916 100644
--- a/dereverbrate/dereveb_c/hann.h
+++ b/dereverbrate/dereveb_c/hann.h
@@ -1,29 +1,29 @@
//
// File: hann.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef HANN_H
#define HANN_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void hann(double varargin_1, ::coder::array<double, 1U> &w);
}
#endif
//
// File trailer for hann.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/ifft.cpp b/dereverbrate/dereveb_c/ifft.cpp
index bda3ff5..1357129 100644
--- a/dereverbrate/dereveb_c/ifft.cpp
+++ b/dereverbrate/dereveb_c/ifft.cpp
@@ -1,224 +1,224 @@
//
// File: ifft.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "ifft.h"
#include "FFTImplementationCallback.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : const ::coder::array<creal_T, 1U> &x
// ::coder::array<creal_T, 1U> &y
// Return Type : void
//
namespace coder {
void ifft(const ::coder::array<creal_T, 1U> &x, ::coder::array<creal_T, 1U> &y)
{
array<creal_T, 1U> b_fv;
array<creal_T, 1U> fv;
array<creal_T, 1U> wwc;
array<double, 2U> costab;
array<double, 2U> costab1q;
array<double, 2U> sintab;
array<double, 2U> sintabinv;
int N2blue;
int nd2;
int nfft;
nfft = x.size(0);
if (x.size(0) == 0) {
y.set_size(0);
} else {
double nt_im;
int i;
int k;
int nInt2;
int rt;
boolean_T useRadix2;
useRadix2 = ((x.size(0) & (x.size(0) - 1)) == 0);
internal::FFTImplementationCallback::get_algo_sizes(x.size(0), useRadix2,
&N2blue, &nd2);
nt_im = 6.2831853071795862 / static_cast<double>(nd2);
nInt2 = nd2 / 2 / 2;
costab1q.set_size(1, nInt2 + 1);
costab1q[0] = 1.0;
nd2 = nInt2 / 2 - 1;
for (k = 0; k <= nd2; k++) {
costab1q[k + 1] = std::cos(nt_im * (static_cast<double>(k) + 1.0));
}
i = nd2 + 2;
rt = nInt2 - 1;
for (k = i; k <= rt; k++) {
costab1q[k] = std::sin(nt_im * static_cast<double>(nInt2 - k));
}
costab1q[nInt2] = 0.0;
if (!useRadix2) {
nInt2 = costab1q.size(1) - 1;
nd2 = (costab1q.size(1) - 1) << 1;
costab.set_size(1, nd2 + 1);
sintab.set_size(1, nd2 + 1);
costab[0] = 1.0;
sintab[0] = 0.0;
sintabinv.set_size(1, nd2 + 1);
for (k = 0; k < nInt2; k++) {
sintabinv[k + 1] = costab1q[(nInt2 - k) - 1];
}
i = costab1q.size(1);
for (k = i; k <= nd2; k++) {
sintabinv[k] = costab1q[k - nInt2];
}
for (k = 0; k < nInt2; k++) {
costab[k + 1] = costab1q[k + 1];
sintab[k + 1] = -costab1q[(nInt2 - k) - 1];
}
i = costab1q.size(1);
for (k = i; k <= nd2; k++) {
costab[k] = -costab1q[nd2 - k];
sintab[k] = -costab1q[k - nInt2];
}
} else {
nInt2 = costab1q.size(1) - 1;
nd2 = (costab1q.size(1) - 1) << 1;
costab.set_size(1, nd2 + 1);
sintab.set_size(1, nd2 + 1);
costab[0] = 1.0;
sintab[0] = 0.0;
for (k = 0; k < nInt2; k++) {
costab[k + 1] = costab1q[k + 1];
sintab[k + 1] = costab1q[(nInt2 - k) - 1];
}
i = costab1q.size(1);
for (k = i; k <= nd2; k++) {
costab[k] = -costab1q[nd2 - k];
sintab[k] = costab1q[k - nInt2];
}
sintabinv.set_size(1, 0);
}
if (useRadix2) {
internal::FFTImplementationCallback::r2br_r2dit_trig_impl(
x, x.size(0), costab, sintab, y);
if (y.size(0) > 1) {
nt_im = 1.0 / static_cast<double>(y.size(0));
nd2 = y.size(0);
for (i = 0; i < nd2; i++) {
y[i].re = nt_im * y[i].re;
y[i].im = nt_im * y[i].im;
}
}
} else {
double b_re_tmp;
double c_re_tmp;
double nt_re;
double re_tmp;
nd2 = (x.size(0) + x.size(0)) - 1;
wwc.set_size(nd2);
rt = 0;
wwc[x.size(0) - 1].re = 1.0;
wwc[x.size(0) - 1].im = 0.0;
nInt2 = x.size(0) << 1;
i = x.size(0);
for (k = 0; k <= i - 2; k++) {
int b_y;
b_y = ((k + 1) << 1) - 1;
if (nInt2 - rt <= b_y) {
rt += b_y - nInt2;
} else {
rt += b_y;
}
nt_im = 3.1415926535897931 * static_cast<double>(rt) /
static_cast<double>(nfft);
if (nt_im == 0.0) {
nt_re = 1.0;
nt_im = 0.0;
} else {
nt_re = std::cos(nt_im);
nt_im = std::sin(nt_im);
}
wwc[(x.size(0) - k) - 2].re = nt_re;
wwc[(x.size(0) - k) - 2].im = -nt_im;
}
i = nd2 - 1;
for (k = i; k >= nfft; k--) {
wwc[k] = wwc[(nd2 - k) - 1];
}
y.set_size(x.size(0));
nd2 = x.size(0);
for (k = 0; k < nd2; k++) {
nt_re = wwc[(nfft + k) - 1].re;
nt_im = wwc[(nfft + k) - 1].im;
re_tmp = x[k].im;
b_re_tmp = x[k].re;
y[k].re = nt_re * b_re_tmp + nt_im * re_tmp;
y[k].im = nt_re * re_tmp - nt_im * b_re_tmp;
}
i = x.size(0) + 1;
for (k = i; k <= nfft; k++) {
y[k - 1].re = 0.0;
y[k - 1].im = 0.0;
}
internal::FFTImplementationCallback::r2br_r2dit_trig_impl(
y, N2blue, costab, sintab, fv);
internal::FFTImplementationCallback::r2br_r2dit_trig_impl(
wwc, N2blue, costab, sintab, b_fv);
b_fv.set_size(fv.size(0));
nd2 = fv.size(0);
for (i = 0; i < nd2; i++) {
nt_im = fv[i].re;
re_tmp = b_fv[i].im;
b_re_tmp = fv[i].im;
c_re_tmp = b_fv[i].re;
b_fv[i].re = nt_im * c_re_tmp - b_re_tmp * re_tmp;
b_fv[i].im = nt_im * re_tmp + b_re_tmp * c_re_tmp;
}
internal::FFTImplementationCallback::r2br_r2dit_trig_impl(
b_fv, N2blue, costab, sintabinv, fv);
if (fv.size(0) > 1) {
nt_im = 1.0 / static_cast<double>(fv.size(0));
nd2 = fv.size(0);
for (i = 0; i < nd2; i++) {
fv[i].re = nt_im * fv[i].re;
fv[i].im = nt_im * fv[i].im;
}
}
nt_re = x.size(0);
i = x.size(0);
rt = wwc.size(0);
for (k = i; k <= rt; k++) {
double ar;
nt_im = wwc[k - 1].re;
re_tmp = fv[k - 1].im;
b_re_tmp = wwc[k - 1].im;
c_re_tmp = fv[k - 1].re;
ar = nt_im * c_re_tmp + b_re_tmp * re_tmp;
nt_im = nt_im * re_tmp - b_re_tmp * c_re_tmp;
if (nt_im == 0.0) {
nd2 = k - i;
y[nd2].re = ar / nt_re;
y[nd2].im = 0.0;
} else if (ar == 0.0) {
nd2 = k - i;
y[nd2].re = 0.0;
y[nd2].im = nt_im / nt_re;
} else {
nd2 = k - i;
y[nd2].re = ar / nt_re;
y[nd2].im = nt_im / nt_re;
}
}
}
}
}
} // namespace coder
//
// File trailer for ifft.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/ifft.h b/dereverbrate/dereveb_c/ifft.h
index 3dc9488..91b31ee 100644
--- a/dereverbrate/dereveb_c/ifft.h
+++ b/dereverbrate/dereveb_c/ifft.h
@@ -1,29 +1,29 @@
//
// File: ifft.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef IFFT_H
#define IFFT_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void ifft(const ::coder::array<creal_T, 1U> &x, ::coder::array<creal_T, 1U> &y);
}
#endif
//
// File trailer for ifft.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.cpp b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.cpp
index dd07bf2..aeafb93 100644
--- a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.cpp
+++ b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.cpp
@@ -1,324 +1,324 @@
//
// File: _coder_dereveb_c_api.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "_coder_dereveb_c_api.h"
#include "_coder_dereveb_c_mex.h"
// Variable Definitions
emlrtCTX emlrtRootTLSGlobal{nullptr};
emlrtContext emlrtContextGlobal{
true, // bFirstTime
false, // bInitialized
131611U, // fVersionInfo
nullptr, // fErrorFunction
"dereveb_c", // fFunctionName
nullptr, // fRTCallStack
false, // bDebugMode
{2045744189U, 2170104910U, 2743257031U, 4284093946U}, // fSigWrd
nullptr // fSigMem
};
// Function Declarations
static real_T b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *fs,
const char_T *identifier);
static real_T b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
const emlrtMsgIdentifier *parentId);
static real_T (*c_emlrt_marshallIn(const emlrtStack *sp,
const mxArray *impulseResponse,
const char_T *identifier))[264600];
static real_T (*c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
const emlrtMsgIdentifier *parentId))[264600];
static real_T (*d_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
const emlrtMsgIdentifier *msgId))[220500];
static real_T e_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
const emlrtMsgIdentifier *msgId);
static real_T (*emlrt_marshallIn(const emlrtStack *sp, const mxArray *b_signal,
const char_T *identifier))[220500];
static real_T (*emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
const emlrtMsgIdentifier *parentId))[220500];
static const mxArray *emlrt_marshallOut(const real_T u[220500]);
static real_T (*f_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
const emlrtMsgIdentifier *msgId))[264600];
// Function Definitions
//
// Arguments : const emlrtStack *sp
// const mxArray *fs
// const char_T *identifier
// Return Type : real_T
//
static real_T b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *fs,
const char_T *identifier)
{
emlrtMsgIdentifier thisId;
real_T y;
thisId.fIdentifier = const_cast<const char_T *>(identifier);
thisId.fParent = nullptr;
thisId.bParentIsCell = false;
y = b_emlrt_marshallIn(sp, emlrtAlias(fs), &thisId);
emlrtDestroyArray(&fs);
return y;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *u
// const emlrtMsgIdentifier *parentId
// Return Type : real_T
//
static real_T b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
const emlrtMsgIdentifier *parentId)
{
real_T y;
y = e_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
emlrtDestroyArray(&u);
return y;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *impulseResponse
// const char_T *identifier
// Return Type : real_T (*)[264600]
//
static real_T (*c_emlrt_marshallIn(const emlrtStack *sp,
const mxArray *impulseResponse,
const char_T *identifier))[264600]
{
emlrtMsgIdentifier thisId;
real_T(*y)[264600];
thisId.fIdentifier = const_cast<const char_T *>(identifier);
thisId.fParent = nullptr;
thisId.bParentIsCell = false;
y = c_emlrt_marshallIn(sp, emlrtAlias(impulseResponse), &thisId);
emlrtDestroyArray(&impulseResponse);
return y;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *u
// const emlrtMsgIdentifier *parentId
// Return Type : real_T (*)[264600]
//
static real_T (*c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
const emlrtMsgIdentifier *parentId))[264600]
{
real_T(*y)[264600];
y = f_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
emlrtDestroyArray(&u);
return y;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *src
// const emlrtMsgIdentifier *msgId
// Return Type : real_T (*)[220500]
//
static real_T (*d_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
const emlrtMsgIdentifier *msgId))[220500]
{
static const int32_T dims{220500};
real_T(*ret)[220500];
emlrtCheckBuiltInR2012b((emlrtCTX)sp, msgId, src, (const char_T *)"double",
false, 1U, (void *)&dims);
ret = (real_T(*)[220500])emlrtMxGetData(src);
emlrtDestroyArray(&src);
return ret;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *src
// const emlrtMsgIdentifier *msgId
// Return Type : real_T
//
static real_T e_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
const emlrtMsgIdentifier *msgId)
{
static const int32_T dims{0};
real_T ret;
emlrtCheckBuiltInR2012b((emlrtCTX)sp, msgId, src, (const char_T *)"double",
false, 0U, (void *)&dims);
ret = *(real_T *)emlrtMxGetData(src);
emlrtDestroyArray(&src);
return ret;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *b_signal
// const char_T *identifier
// Return Type : real_T (*)[220500]
//
static real_T (*emlrt_marshallIn(const emlrtStack *sp, const mxArray *b_signal,
const char_T *identifier))[220500]
{
emlrtMsgIdentifier thisId;
real_T(*y)[220500];
thisId.fIdentifier = const_cast<const char_T *>(identifier);
thisId.fParent = nullptr;
thisId.bParentIsCell = false;
y = emlrt_marshallIn(sp, emlrtAlias(b_signal), &thisId);
emlrtDestroyArray(&b_signal);
return y;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *u
// const emlrtMsgIdentifier *parentId
// Return Type : real_T (*)[220500]
//
static real_T (*emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
const emlrtMsgIdentifier *parentId))[220500]
{
real_T(*y)[220500];
y = d_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
emlrtDestroyArray(&u);
return y;
}
//
// Arguments : const real_T u[220500]
// Return Type : const mxArray *
//
static const mxArray *emlrt_marshallOut(const real_T u[220500])
{
static const int32_T i{0};
static const int32_T i1{220500};
const mxArray *m;
const mxArray *y;
y = nullptr;
m = emlrtCreateNumericArray(1, (const void *)&i, mxDOUBLE_CLASS, mxREAL);
emlrtMxSetData((mxArray *)m, (void *)&u[0]);
emlrtSetDimensions((mxArray *)m, &i1, 1);
emlrtAssign(&y, m);
return y;
}
//
// Arguments : const emlrtStack *sp
// const mxArray *src
// const emlrtMsgIdentifier *msgId
// Return Type : real_T (*)[264600]
//
static real_T (*f_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
const emlrtMsgIdentifier *msgId))[264600]
{
static const int32_T dims{264600};
real_T(*ret)[264600];
emlrtCheckBuiltInR2012b((emlrtCTX)sp, msgId, src, (const char_T *)"double",
false, 1U, (void *)&dims);
ret = (real_T(*)[264600])emlrtMxGetData(src);
emlrtDestroyArray(&src);
return ret;
}
//
// Arguments : const mxArray * const prhs[4]
// const mxArray **plhs
// Return Type : void
//
void dereveb_c_api(const mxArray *const prhs[4], const mxArray **plhs)
{
emlrtStack st{
nullptr, // site
nullptr, // tls
nullptr // prev
};
real_T(*impulseResponse)[264600];
real_T(*b_signal)[220500];
real_T(*reverberated_vc)[220500];
real_T(*signal_vc)[220500];
real_T fs;
st.tls = emlrtRootTLSGlobal;
reverberated_vc = (real_T(*)[220500])mxMalloc(sizeof(real_T[220500]));
// Marshall function inputs
b_signal = emlrt_marshallIn(&st, emlrtAlias(prhs[0]), "signal");
signal_vc = emlrt_marshallIn(&st, emlrtAlias(prhs[1]), "signal_vc");
fs = b_emlrt_marshallIn(&st, emlrtAliasP(prhs[2]), "fs");
impulseResponse =
c_emlrt_marshallIn(&st, emlrtAlias(prhs[3]), "impulseResponse");
// Invoke the target function
dereveb_c(*b_signal, *signal_vc, fs, *impulseResponse, *reverberated_vc);
// Marshall function outputs
*plhs = emlrt_marshallOut(*reverberated_vc);
}
//
// Arguments : void
// Return Type : void
//
void dereveb_c_atexit()
{
emlrtStack st{
nullptr, // site
nullptr, // tls
nullptr // prev
};
mexFunctionCreateRootTLS();
st.tls = emlrtRootTLSGlobal;
emlrtEnterRtStackR2012b(&st);
emlrtLeaveRtStackR2012b(&st);
emlrtDestroyRootTLS(&emlrtRootTLSGlobal);
dereveb_c_xil_terminate();
dereveb_c_xil_shutdown();
emlrtExitTimeCleanup(&emlrtContextGlobal);
}
//
// Arguments : void
// Return Type : void
//
void dereveb_c_initialize()
{
emlrtStack st{
nullptr, // site
nullptr, // tls
nullptr // prev
};
mexFunctionCreateRootTLS();
st.tls = emlrtRootTLSGlobal;
emlrtClearAllocCountR2012b(&st, false, 0U, nullptr);
emlrtEnterRtStackR2012b(&st);
emlrtFirstTimeR2012b(emlrtRootTLSGlobal);
}
//
// Arguments : void
// Return Type : void
//
void dereveb_c_terminate()
{
emlrtStack st{
nullptr, // site
nullptr, // tls
nullptr // prev
};
st.tls = emlrtRootTLSGlobal;
emlrtLeaveRtStackR2012b(&st);
emlrtDestroyRootTLS(&emlrtRootTLSGlobal);
}
//
// File trailer for _coder_dereveb_c_api.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.h b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.h
index e5b6ace..21a7303 100644
--- a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.h
+++ b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_api.h
@@ -1,42 +1,42 @@
//
// File: _coder_dereveb_c_api.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef _CODER_DEREVEB_C_API_H
#define _CODER_DEREVEB_C_API_H
// Include Files
#include "emlrt.h"
#include "tmwtypes.h"
#include <algorithm>
#include <cstring>
// Variable Declarations
extern emlrtCTX emlrtRootTLSGlobal;
extern emlrtContext emlrtContextGlobal;
// Function Declarations
void dereveb_c(real_T b_signal[220500], real_T signal_vc[220500], real_T fs,
real_T impulseResponse[264600], real_T reverberated_vc[220500]);
void dereveb_c_api(const mxArray *const prhs[4], const mxArray **plhs);
void dereveb_c_atexit();
void dereveb_c_initialize();
void dereveb_c_terminate();
void dereveb_c_xil_shutdown();
void dereveb_c_xil_terminate();
#endif
//
// File trailer for _coder_dereveb_c_api.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.cpp b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.cpp
index 171ceea..26d046f 100644
--- a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.cpp
+++ b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.cpp
@@ -1,85 +1,85 @@
//
// File: _coder_dereveb_c_mex.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "_coder_dereveb_c_mex.h"
#include "_coder_dereveb_c_api.h"
// Function Definitions
//
// Arguments : int32_T nlhs
// mxArray *plhs[]
// int32_T nrhs
// const mxArray *prhs[]
// Return Type : void
//
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs,
const mxArray *prhs[])
{
mexAtExit(&dereveb_c_atexit);
// Module initialization.
dereveb_c_initialize();
try {
emlrtShouldCleanupOnError((emlrtCTX *)emlrtRootTLSGlobal, false);
// Dispatch the entry-point.
unsafe_dereveb_c_mexFunction(nlhs, plhs, nrhs, prhs);
// Module termination.
dereveb_c_terminate();
} catch (...) {
emlrtCleanupOnException((emlrtCTX *)emlrtRootTLSGlobal);
throw;
}
}
//
// Arguments : void
// Return Type : emlrtCTX
//
emlrtCTX mexFunctionCreateRootTLS()
{
emlrtCreateRootTLSR2021a(&emlrtRootTLSGlobal, &emlrtContextGlobal, nullptr, 1,
nullptr);
return emlrtRootTLSGlobal;
}
//
// Arguments : int32_T nlhs
// mxArray *plhs[1]
// int32_T nrhs
// const mxArray *prhs[4]
// Return Type : void
//
void unsafe_dereveb_c_mexFunction(int32_T nlhs, mxArray *plhs[1], int32_T nrhs,
const mxArray *prhs[4])
{
emlrtStack st{
nullptr, // site
nullptr, // tls
nullptr // prev
};
const mxArray *outputs;
st.tls = emlrtRootTLSGlobal;
// Check for proper number of arguments.
if (nrhs != 4) {
emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:WrongNumberOfInputs", 5, 12, 4, 4,
9, "dereveb_c");
}
if (nlhs > 1) {
emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:TooManyOutputArguments", 3, 4, 9,
"dereveb_c");
}
// Call the function.
dereveb_c_api(prhs, &outputs);
// Copy over outputs to the caller.
emlrtReturnArrays(1, &plhs[0], &outputs);
}
//
// File trailer for _coder_dereveb_c_mex.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.h b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.h
index 38924b5..c3bafcb 100644
--- a/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.h
+++ b/dereverbrate/dereveb_c/interface/_coder_dereveb_c_mex.h
@@ -1,30 +1,30 @@
//
// File: _coder_dereveb_c_mex.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef _CODER_DEREVEB_C_MEX_H
#define _CODER_DEREVEB_C_MEX_H
// Include Files
#include "emlrt.h"
#include "mex.h"
#include "tmwtypes.h"
// Function Declarations
MEXFUNCTION_LINKAGE void mexFunction(int32_T nlhs, mxArray *plhs[],
int32_T nrhs, const mxArray *prhs[]);
emlrtCTX mexFunctionCreateRootTLS();
void unsafe_dereveb_c_mexFunction(int32_T nlhs, mxArray *plhs[1], int32_T nrhs,
const mxArray *prhs[4]);
#endif
//
// File trailer for _coder_dereveb_c_mex.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/iseven.cpp b/dereverbrate/dereveb_c/iseven.cpp
index 3e3c32b..54603e9 100644
--- a/dereverbrate/dereveb_c/iseven.cpp
+++ b/dereverbrate/dereveb_c/iseven.cpp
@@ -1,43 +1,43 @@
//
// File: iseven.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "iseven.h"
#include "rt_nonfinite.h"
#include <cmath>
// Function Definitions
//
// Arguments : double x
// Return Type : boolean_T
//
namespace coder {
boolean_T iseven(double x)
{
double r;
if (std::isnan(x) || std::isinf(x)) {
r = rtNaN;
} else if (x == 0.0) {
r = 0.0;
} else {
r = std::fmod(x, 2.0);
if (r == 0.0) {
r = 0.0;
} else if (x < 0.0) {
r += 2.0;
}
}
return r == 0.0;
}
} // namespace coder
//
// File trailer for iseven.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/iseven.h b/dereverbrate/dereveb_c/iseven.h
index 61c629f..eff940c 100644
--- a/dereverbrate/dereveb_c/iseven.h
+++ b/dereverbrate/dereveb_c/iseven.h
@@ -1,28 +1,28 @@
//
// File: iseven.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef ISEVEN_H
#define ISEVEN_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
boolean_T iseven(double x);
}
#endif
//
// File trailer for iseven.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/ixfun.cpp b/dereverbrate/dereveb_c/ixfun.cpp
index 2dd7da6..26a0bc2 100644
--- a/dereverbrate/dereveb_c/ixfun.cpp
+++ b/dereverbrate/dereveb_c/ixfun.cpp
@@ -1,65 +1,65 @@
//
// File: ixfun.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "ixfun.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : const ::coder::array<double, 1U> &a
// const ::coder::array<double, 1U> &b
// ::coder::array<double, 1U> &c
// Return Type : void
//
namespace coder {
namespace internal {
void expand_min(const ::coder::array<double, 1U> &a,
const ::coder::array<double, 1U> &b,
::coder::array<double, 1U> &c)
{
int acoef;
int csz_idx_0;
int u0;
u0 = a.size(0);
acoef = b.size(0);
if (u0 <= acoef) {
acoef = u0;
}
if (a.size(0) == 1) {
csz_idx_0 = b.size(0);
} else {
csz_idx_0 = acoef;
}
u0 = a.size(0);
acoef = b.size(0);
if (u0 <= acoef) {
acoef = u0;
}
if (a.size(0) == 1) {
acoef = b.size(0);
}
c.set_size(acoef);
if (csz_idx_0 != 0) {
acoef = (a.size(0) != 1);
u0 = csz_idx_0 - 1;
for (csz_idx_0 = 0; csz_idx_0 <= u0; csz_idx_0++) {
c[csz_idx_0] = std::fmin(a[acoef * csz_idx_0], b[csz_idx_0]);
}
}
}
} // namespace internal
} // namespace coder
//
// File trailer for ixfun.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/ixfun.h b/dereverbrate/dereveb_c/ixfun.h
index 8bc6ce5..f18544d 100644
--- a/dereverbrate/dereveb_c/ixfun.h
+++ b/dereverbrate/dereveb_c/ixfun.h
@@ -1,33 +1,33 @@
//
// File: ixfun.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef IXFUN_H
#define IXFUN_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
namespace internal {
void expand_min(const ::coder::array<double, 1U> &a,
const ::coder::array<double, 1U> &b,
::coder::array<double, 1U> &c);
}
} // namespace coder
#endif
//
// File trailer for ixfun.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/minOrMax.cpp b/dereverbrate/dereveb_c/minOrMax.cpp
index 6e0bda8..93743cc 100644
--- a/dereverbrate/dereveb_c/minOrMax.cpp
+++ b/dereverbrate/dereveb_c/minOrMax.cpp
@@ -1,163 +1,163 @@
//
// File: minOrMax.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "minOrMax.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
-// Arguments : coder::array<double, 1U> &r2
+// Arguments : coder::array<double, 1U> &y
// const coder::array<double, 1U> &newEstimates
// const coder::array<creal_T, 2U> &M
// Return Type : void
//
-void binary_expand_op(coder::array<double, 1U> &r2,
+void binary_expand_op(coder::array<double, 1U> &y,
const coder::array<double, 1U> &newEstimates,
const coder::array<creal_T, 2U> &M)
{
coder::array<double, 2U> r1;
coder::array<double, 1U> r;
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
int stride_2_0;
if (newEstimates.size(0) == 1) {
- i = r2.size(0);
+ i = y.size(0);
} else {
i = newEstimates.size(0);
}
if (i == 1) {
i = newEstimates.size(0);
} else if (newEstimates.size(0) == 1) {
- i = r2.size(0);
+ i = y.size(0);
} else {
i = newEstimates.size(0);
}
r.set_size(i);
stride_0_0 = (newEstimates.size(0) != 1);
- stride_1_0 = (r2.size(0) != 1);
+ stride_1_0 = (y.size(0) != 1);
stride_2_0 = (newEstimates.size(0) != 1);
if (newEstimates.size(0) == 1) {
- i = r2.size(0);
+ i = y.size(0);
} else {
i = newEstimates.size(0);
}
if (i == 1) {
loop_ub = newEstimates.size(0);
} else if (newEstimates.size(0) == 1) {
- loop_ub = r2.size(0);
+ loop_ub = y.size(0);
} else {
loop_ub = newEstimates.size(0);
}
for (i = 0; i < loop_ub; i++) {
r[i] = 1.0 - newEstimates[i * stride_0_0] /
- (r2[i * stride_1_0] + newEstimates[i * stride_2_0]);
+ (y[i * stride_1_0] + newEstimates[i * stride_2_0]);
}
r1.set_size(r.size(0), 2);
loop_ub = r.size(0);
for (i = 0; i < loop_ub; i++) {
r1[i] = r[i];
}
loop_ub = M.size(0);
for (i = 0; i < loop_ub; i++) {
r1[i + r1.size(0)] = 0.0;
}
- coder::internal::maximum(r1, r2);
+ coder::internal::maximum(r1, y);
}
//
-// Arguments : coder::array<double, 1U> &r2
+// Arguments : coder::array<double, 1U> &y
// const coder::array<double, 1U> &inputFramePower
// const coder::array<creal_T, 2U> &M
// Return Type : void
//
-void c_binary_expand_op(coder::array<double, 1U> &r2,
+void c_binary_expand_op(coder::array<double, 1U> &y,
const coder::array<double, 1U> &inputFramePower,
const coder::array<creal_T, 2U> &M)
{
coder::array<double, 2U> r1;
coder::array<double, 1U> r;
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
if (inputFramePower.size(0) == 1) {
- i = r2.size(0);
+ i = y.size(0);
} else {
i = inputFramePower.size(0);
}
r.set_size(i);
- stride_0_0 = (r2.size(0) != 1);
+ stride_0_0 = (y.size(0) != 1);
stride_1_0 = (inputFramePower.size(0) != 1);
if (inputFramePower.size(0) == 1) {
- loop_ub = r2.size(0);
+ loop_ub = y.size(0);
} else {
loop_ub = inputFramePower.size(0);
}
for (i = 0; i < loop_ub; i++) {
- r[i] = 1.0 - r2[i * stride_0_0] / inputFramePower[i * stride_1_0];
+ r[i] = 1.0 - y[i * stride_0_0] / inputFramePower[i * stride_1_0];
}
r1.set_size(r.size(0), 2);
loop_ub = r.size(0);
for (i = 0; i < loop_ub; i++) {
r1[i] = r[i];
}
loop_ub = M.size(0);
for (i = 0; i < loop_ub; i++) {
r1[i + r1.size(0)] = 0.0;
}
- coder::internal::maximum(r1, r2);
+ coder::internal::maximum(r1, y);
}
//
// Arguments : const ::coder::array<double, 2U> &x
// ::coder::array<double, 1U> &ex
// Return Type : void
//
namespace coder {
namespace internal {
void maximum(const ::coder::array<double, 2U> &x,
::coder::array<double, 1U> &ex)
{
int m;
m = x.size(0) - 1;
ex.set_size(x.size(0));
if (x.size(0) >= 1) {
int i;
for (i = 0; i <= m; i++) {
ex[i] = x[i];
}
for (i = 0; i <= m; i++) {
double b;
boolean_T p;
b = x[i + x.size(0)];
if (std::isnan(b)) {
p = false;
} else if (std::isnan(ex[i])) {
p = true;
} else {
p = (ex[i] < b);
}
if (p) {
ex[i] = b;
}
}
}
}
} // namespace internal
} // namespace coder
//
// File trailer for minOrMax.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/minOrMax.h b/dereverbrate/dereveb_c/minOrMax.h
index 1b04bd0..489fa45 100644
--- a/dereverbrate/dereveb_c/minOrMax.h
+++ b/dereverbrate/dereveb_c/minOrMax.h
@@ -1,40 +1,40 @@
//
// File: minOrMax.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef MINORMAX_H
#define MINORMAX_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
-void binary_expand_op(coder::array<double, 1U> &r2,
+void binary_expand_op(coder::array<double, 1U> &y,
const coder::array<double, 1U> &newEstimates,
const coder::array<creal_T, 2U> &M);
-void c_binary_expand_op(coder::array<double, 1U> &r2,
+void c_binary_expand_op(coder::array<double, 1U> &y,
const coder::array<double, 1U> &inputFramePower,
const coder::array<creal_T, 2U> &M);
namespace coder {
namespace internal {
void maximum(const ::coder::array<double, 2U> &x,
::coder::array<double, 1U> &ex);
}
} // namespace coder
#endif
//
// File trailer for minOrMax.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/pspectrogram.cpp b/dereverbrate/dereveb_c/pspectrogram.cpp
index de5b733..71c15c4 100644
--- a/dereverbrate/dereveb_c/pspectrogram.cpp
+++ b/dereverbrate/dereveb_c/pspectrogram.cpp
@@ -1,124 +1,124 @@
//
// File: pspectrogram.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "pspectrogram.h"
#include "dereveb_c_rtwutil.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
// Arguments : ::coder::array<creal_T, 2U> &y
// ::coder::array<double, 1U> &f
// double nfft
// const char options_range[8]
// Return Type : void
//
namespace coder {
void formatSpectrogram(::coder::array<creal_T, 2U> &y,
::coder::array<double, 1U> &f, double nfft,
const char options_range[8])
{
static const char cv[128]{
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08',
'\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11',
'\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a',
'\x1b', '\x1c', '\x1d', '\x1e', '\x1f', ' ', '!', '\"', '#',
'$', '%', '&', '\'', '(', ')', '*', '+', ',',
'-', '.', '/', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', ':', ';', '<', '=', '>',
'?', '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z', '[', '\\', ']', '^', '_', '`', 'a', 'b',
'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}',
'~', '\x7f'};
static const char cv1[8]{'o', 'n', 'e', 's', 'i', 'd', 'e', 'd'};
array<double, 2U> w1;
int kstr;
boolean_T b_bool;
b_bool = false;
kstr = 0;
int exitg1;
do {
exitg1 = 0;
if (kstr < 8) {
if (cv[static_cast<unsigned char>(options_range[kstr])] !=
cv[static_cast<int>(cv1[kstr])]) {
exitg1 = 1;
} else {
kstr++;
}
} else {
b_bool = true;
exitg1 = 1;
}
} while (exitg1 == 0);
if (b_bool) {
double freq_res;
double halfNPTS;
double half_res;
int b_y;
int i;
freq_res = 6.2831853071795862 / nfft;
if (std::isnan(nfft - 1.0)) {
w1.set_size(1, 1);
w1[0] = rtNaN;
} else if (nfft - 1.0 < 0.0) {
w1.set_size(w1.size(0), 0);
} else if (std::isinf(nfft - 1.0) && (0.0 == nfft - 1.0)) {
w1.set_size(1, 1);
w1[0] = rtNaN;
} else {
kstr = static_cast<int>(std::floor(nfft - 1.0));
w1.set_size(1, kstr + 1);
for (i = 0; i <= kstr; i++) {
w1[i] = i;
}
}
w1.set_size(1, w1.size(1));
kstr = w1.size(1) - 1;
for (i = 0; i <= kstr; i++) {
w1[i] = freq_res * w1[i];
}
half_res = freq_res / 2.0;
if (rt_remd_snf(nfft, 2.0) != 0.0) {
halfNPTS = (nfft + 1.0) / 2.0;
w1[static_cast<int>(halfNPTS) - 1] = 3.1415926535897931 - half_res;
w1[static_cast<int>(static_cast<unsigned int>(halfNPTS))] =
half_res + 3.1415926535897931;
} else {
halfNPTS = nfft / 2.0 + 1.0;
w1[static_cast<int>(halfNPTS) - 1] = 3.1415926535897931;
}
w1[static_cast<int>(nfft) - 1] = 6.2831853071795862 - freq_res;
kstr = static_cast<int>(halfNPTS);
f.set_size(kstr);
for (i = 0; i < kstr; i++) {
f[i] = w1[i];
}
b_y = y.size(1) - 1;
for (i = 0; i <= b_y; i++) {
for (int i1{0}; i1 < kstr; i1++) {
y[i1 + static_cast<int>(halfNPTS) * i] = y[i1 + y.size(0) * i];
}
}
y.set_size(kstr, b_y + 1);
}
}
} // namespace coder
//
// File trailer for pspectrogram.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/pspectrogram.h b/dereverbrate/dereveb_c/pspectrogram.h
index 7a8de2e..dcd1536 100644
--- a/dereverbrate/dereveb_c/pspectrogram.h
+++ b/dereverbrate/dereveb_c/pspectrogram.h
@@ -1,31 +1,31 @@
//
// File: pspectrogram.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef PSPECTROGRAM_H
#define PSPECTROGRAM_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void formatSpectrogram(::coder::array<creal_T, 2U> &y,
::coder::array<double, 1U> &f, double nfft,
const char options_range[8]);
}
#endif
//
// File trailer for pspectrogram.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/ref.h b/dereverbrate/dereveb_c/ref.h
index bae6e04..c90d290 100644
--- a/dereverbrate/dereveb_c/ref.h
+++ b/dereverbrate/dereveb_c/ref.h
@@ -1,31 +1,31 @@
//
// File: ref.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef REF_H
#define REF_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Type Definitions
namespace coder {
class captured_var {
public:
double contents;
};
} // namespace coder
#endif
//
// File trailer for ref.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rtGetInf.cpp b/dereverbrate/dereveb_c/rtGetInf.cpp
index c28bd31..75fe773 100644
--- a/dereverbrate/dereveb_c/rtGetInf.cpp
+++ b/dereverbrate/dereveb_c/rtGetInf.cpp
@@ -1,55 +1,55 @@
//
// File: rtGetInf.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Abstract:
// MATLAB for code generation function to initialize non-finite, Inf and
// MinusInf
// Include Files
#include "rtGetInf.h"
#include "rt_nonfinite.h"
// Function: rtGetInf
// ==================================================================
// Abstract:
// Initialize rtInf needed by the generated code.
real_T rtGetInf(void)
{
return rtInf;
}
// Function: rtGetInfF
// =================================================================
// Abstract:
// Initialize rtInfF needed by the generated code.
real32_T rtGetInfF(void)
{
return rtInfF;
}
// Function: rtGetMinusInf
// =============================================================
// Abstract:
// Initialize rtMinusInf needed by the generated code.
real_T rtGetMinusInf(void)
{
return rtMinusInf;
}
// Function: rtGetMinusInfF
// ============================================================
// Abstract:
// Initialize rtMinusInfF needed by the generated code.
real32_T rtGetMinusInfF(void)
{
return rtMinusInfF;
}
//
// File trailer for rtGetInf.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rtGetInf.h b/dereverbrate/dereveb_c/rtGetInf.h
index fece781..8207991 100644
--- a/dereverbrate/dereveb_c/rtGetInf.h
+++ b/dereverbrate/dereveb_c/rtGetInf.h
@@ -1,31 +1,31 @@
//
// File: rtGetInf.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef RTGETINF_H
#define RTGETINF_H
// Include Files
#include "rtwtypes.h"
#ifdef __cplusplus
extern "C" {
#endif
extern real_T rtGetInf(void);
extern real32_T rtGetInfF(void);
extern real_T rtGetMinusInf(void);
extern real32_T rtGetMinusInfF(void);
#ifdef __cplusplus
}
#endif
#endif
//
// File trailer for rtGetInf.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rtGetNaN.cpp b/dereverbrate/dereveb_c/rtGetNaN.cpp
index fc2a00b..a9ed462 100644
--- a/dereverbrate/dereveb_c/rtGetNaN.cpp
+++ b/dereverbrate/dereveb_c/rtGetNaN.cpp
@@ -1,38 +1,38 @@
//
// File: rtGetNaN.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Abstract:
// MATLAB for code generation function to initialize non-finite, NaN
// Include Files
#include "rtGetNaN.h"
#include "rt_nonfinite.h"
// Function: rtGetNaN
// ======================================================================
// Abstract:
// Initialize rtNaN needed by the generated code.
// NaN is initialized as non-signaling. Assumes IEEE.
real_T rtGetNaN(void)
{
return rtNaN;
}
// Function: rtGetNaNF
// =====================================================================
// Abstract:
// Initialize rtNaNF needed by the generated code.
// NaN is initialized as non-signaling. Assumes IEEE
real32_T rtGetNaNF(void)
{
return rtNaNF;
}
//
// File trailer for rtGetNaN.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rtGetNaN.h b/dereverbrate/dereveb_c/rtGetNaN.h
index e20bb6d..6cc1060 100644
--- a/dereverbrate/dereveb_c/rtGetNaN.h
+++ b/dereverbrate/dereveb_c/rtGetNaN.h
@@ -1,29 +1,29 @@
//
// File: rtGetNaN.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef RTGETNAN_H
#define RTGETNAN_H
// Include Files
#include "rtwtypes.h"
#ifdef __cplusplus
extern "C" {
#endif
extern real_T rtGetNaN(void);
extern real32_T rtGetNaNF(void);
#ifdef __cplusplus
}
#endif
#endif
//
// File trailer for rtGetNaN.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rt_nonfinite.cpp b/dereverbrate/dereveb_c/rt_nonfinite.cpp
index bcc3bc1..279e4ab 100644
--- a/dereverbrate/dereveb_c/rt_nonfinite.cpp
+++ b/dereverbrate/dereveb_c/rt_nonfinite.cpp
@@ -1,27 +1,27 @@
//
// File: rt_nonfinite.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Abstract:
// MATLAB for code generation function to initialize non-finites,
// (Inf, NaN and -Inf).
// Include Files
#include "rt_nonfinite.h"
#include <cmath>
#include <limits>
real_T rtNaN{std::numeric_limits<real_T>::quiet_NaN()};
real_T rtInf{std::numeric_limits<real_T>::infinity()};
real_T rtMinusInf{-std::numeric_limits<real_T>::infinity()};
real32_T rtNaNF{std::numeric_limits<real32_T>::quiet_NaN()};
real32_T rtInfF{std::numeric_limits<real32_T>::infinity()};
real32_T rtMinusInfF{-std::numeric_limits<real32_T>::infinity()};
//
// File trailer for rt_nonfinite.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rt_nonfinite.h b/dereverbrate/dereveb_c/rt_nonfinite.h
index 0392c04..f094aa8 100644
--- a/dereverbrate/dereveb_c/rt_nonfinite.h
+++ b/dereverbrate/dereveb_c/rt_nonfinite.h
@@ -1,33 +1,33 @@
//
// File: rt_nonfinite.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef RT_NONFINITE_H
#define RT_NONFINITE_H
// Include Files
#include "rtwtypes.h"
#ifdef __cplusplus
extern "C" {
#endif
extern real_T rtInf;
extern real_T rtMinusInf;
extern real_T rtNaN;
extern real32_T rtInfF;
extern real32_T rtMinusInfF;
extern real32_T rtNaNF;
#ifdef __cplusplus
}
#endif
#endif
//
// File trailer for rt_nonfinite.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/rtwtypes.h b/dereverbrate/dereveb_c/rtwtypes.h
index 523ca9d..e3bc12e 100644
--- a/dereverbrate/dereveb_c/rtwtypes.h
+++ b/dereverbrate/dereveb_c/rtwtypes.h
@@ -1,45 +1,45 @@
//
// File: rtwtypes.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef RTWTYPES_H
#define RTWTYPES_H
/*=======================================================================*
* Fixed width word size data types: *
* int64_T - signed 64 bit integers *
* uint64_T - unsigned 64 bit integers *
*=======================================================================*/
#if defined(__APPLE__)
#ifndef INT64_T
#define INT64_T long
#define FMT64 "l"
#if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG)
#define INT_TYPE_64_IS_LONG
#endif
#endif
#endif
#if defined(__APPLE__)
#ifndef UINT64_T
#define UINT64_T unsigned long
#define FMT64 "l"
#if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG)
#define INT_TYPE_64_IS_LONG
#endif
#endif
#endif
// Include Files
#include "tmwtypes.h"
#endif
//
// File trailer for rtwtypes.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/spectrogram.cpp b/dereverbrate/dereveb_c/spectrogram.cpp
index 5e61750..cf5ca8b 100644
--- a/dereverbrate/dereveb_c/spectrogram.cpp
+++ b/dereverbrate/dereveb_c/spectrogram.cpp
@@ -1,270 +1,270 @@
//
// File: spectrogram.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "spectrogram.h"
#include "computeDFT.h"
#include "hamming.h"
#include "pspectrogram.h"
#include "rt_nonfinite.h"
#include "welchparse.h"
#include "coder_array.h"
#include <algorithm>
#include <cmath>
// Type Definitions
struct cell_wrap_6 {
double f1[220500];
};
struct cell_wrap_22 {
double f1[264600];
};
// Function Definitions
//
// Arguments : const double x[264600]
// const ::coder::array<double, 1U> &varargin_1
// double varargin_2
// ::coder::array<creal_T, 2U> &varargout_1
// Return Type : void
//
namespace coder {
void b_spectrogram(const double x[264600],
const ::coder::array<double, 1U> &varargin_1,
double varargin_2, ::coder::array<creal_T, 2U> &varargout_1)
{
static cell_wrap_22 r;
array<double, 2U> r1;
array<double, 2U> xin;
array<double, 1U> win;
double b_expl_temp;
double expl_temp;
double hopSize;
double options_nfft;
int acoef;
int bcoef;
int i;
int i1;
int iCol;
char options_range[8];
boolean_T c_expl_temp;
boolean_T d_expl_temp;
boolean_T e_expl_temp;
boolean_T f_expl_temp;
boolean_T g_expl_temp;
boolean_T h_expl_temp;
std::copy(&x[0], &x[264600], &r.f1[0]);
if (varargin_1.size(0) == 0) {
hopSize = std::trunc((7.0 * varargin_2 + 264600.0) / 8.0);
hamming(hopSize, win);
} else if (varargin_1.size(0) > 1) {
hopSize = varargin_1.size(0);
win.set_size(varargin_1.size(0));
bcoef = varargin_1.size(0);
for (i = 0; i < bcoef; i++) {
win[i] = varargin_1[i];
}
} else {
hamming(varargin_1[0], win);
hopSize = win.size(0);
}
signal::internal::spectral::welch_options(
hopSize, &options_nfft, &expl_temp, &b_expl_temp, &c_expl_temp,
&d_expl_temp, &e_expl_temp, &f_expl_temp, &g_expl_temp, &h_expl_temp,
options_range);
hopSize = static_cast<double>(win.size(0)) - varargin_2;
i = static_cast<int>(std::trunc((264600.0 - varargin_2) / hopSize));
xin.set_size(win.size(0), i);
bcoef = win.size(0) *
static_cast<int>(std::trunc((264600.0 - varargin_2) / hopSize));
for (i1 = 0; i1 < bcoef; i1++) {
xin[i1] = 0.0;
}
for (iCol = 0; iCol < i; iCol++) {
expl_temp = hopSize * ((static_cast<double>(iCol) + 1.0) - 1.0);
b_expl_temp = static_cast<double>(win.size(0)) + expl_temp;
if (expl_temp + 1.0 > b_expl_temp) {
i1 = 0;
acoef = 0;
} else {
i1 = static_cast<int>(expl_temp + 1.0) - 1;
acoef = static_cast<int>(b_expl_temp);
}
bcoef = acoef - i1;
for (acoef = 0; acoef < bcoef; acoef++) {
xin[acoef + xin.size(0) * iCol] = r.f1[i1 + acoef];
}
}
bcoef = xin.size(0);
iCol = win.size(0);
if (bcoef <= iCol) {
iCol = bcoef;
}
if (xin.size(0) == 1) {
iCol = win.size(0);
} else if (win.size(0) == 1) {
iCol = xin.size(0);
} else if (win.size(0) == xin.size(0)) {
iCol = win.size(0);
}
r1.set_size(iCol, xin.size(1));
bcoef = xin.size(0);
iCol = win.size(0);
if (bcoef <= iCol) {
iCol = bcoef;
}
if (xin.size(0) == 1) {
iCol = win.size(0);
} else if (win.size(0) == 1) {
iCol = xin.size(0);
} else if (win.size(0) == xin.size(0)) {
iCol = win.size(0);
}
if ((iCol != 0) && (xin.size(1) != 0)) {
bcoef = (xin.size(1) != 1);
i = xin.size(1) - 1;
for (int k{0}; k <= i; k++) {
int b_bcoef;
iCol = bcoef * k;
acoef = (win.size(0) != 1);
b_bcoef = (xin.size(0) != 1);
i1 = r1.size(0) - 1;
for (int b_k{0}; b_k <= i1; b_k++) {
r1[b_k + r1.size(0) * k] =
win[acoef * b_k] * xin[b_bcoef * b_k + xin.size(0) * iCol];
}
}
}
computeDFT(r1, options_nfft, varargout_1, win);
formatSpectrogram(varargout_1, win, options_nfft, options_range);
}
//
// Arguments : const double x[220500]
// const ::coder::array<double, 1U> &varargin_1
// double varargin_2
// ::coder::array<creal_T, 2U> &varargout_1
// Return Type : void
//
void spectrogram(const double x[220500],
const ::coder::array<double, 1U> &varargin_1,
double varargin_2, ::coder::array<creal_T, 2U> &varargout_1)
{
static cell_wrap_6 r;
array<double, 2U> r1;
array<double, 2U> xin;
array<double, 1U> win;
double b_expl_temp;
double expl_temp;
double hopSize;
double options_nfft;
int acoef;
int bcoef;
int i;
int i1;
int iCol;
char options_range[8];
boolean_T c_expl_temp;
boolean_T d_expl_temp;
boolean_T e_expl_temp;
boolean_T f_expl_temp;
boolean_T g_expl_temp;
boolean_T h_expl_temp;
std::copy(&x[0], &x[220500], &r.f1[0]);
if (varargin_1.size(0) == 0) {
hopSize = std::trunc((7.0 * varargin_2 + 220500.0) / 8.0);
hamming(hopSize, win);
} else if (varargin_1.size(0) > 1) {
hopSize = varargin_1.size(0);
win.set_size(varargin_1.size(0));
bcoef = varargin_1.size(0);
for (i = 0; i < bcoef; i++) {
win[i] = varargin_1[i];
}
} else {
hamming(varargin_1[0], win);
hopSize = win.size(0);
}
signal::internal::spectral::welch_options(
hopSize, &options_nfft, &expl_temp, &b_expl_temp, &c_expl_temp,
&d_expl_temp, &e_expl_temp, &f_expl_temp, &g_expl_temp, &h_expl_temp,
options_range);
hopSize = static_cast<double>(win.size(0)) - varargin_2;
i = static_cast<int>(std::trunc((220500.0 - varargin_2) / hopSize));
xin.set_size(win.size(0), i);
bcoef = win.size(0) *
static_cast<int>(std::trunc((220500.0 - varargin_2) / hopSize));
for (i1 = 0; i1 < bcoef; i1++) {
xin[i1] = 0.0;
}
for (iCol = 0; iCol < i; iCol++) {
expl_temp = hopSize * ((static_cast<double>(iCol) + 1.0) - 1.0);
b_expl_temp = static_cast<double>(win.size(0)) + expl_temp;
if (expl_temp + 1.0 > b_expl_temp) {
i1 = 0;
acoef = 0;
} else {
i1 = static_cast<int>(expl_temp + 1.0) - 1;
acoef = static_cast<int>(b_expl_temp);
}
bcoef = acoef - i1;
for (acoef = 0; acoef < bcoef; acoef++) {
xin[acoef + xin.size(0) * iCol] = r.f1[i1 + acoef];
}
}
bcoef = xin.size(0);
iCol = win.size(0);
if (bcoef <= iCol) {
iCol = bcoef;
}
if (xin.size(0) == 1) {
iCol = win.size(0);
} else if (win.size(0) == 1) {
iCol = xin.size(0);
} else if (win.size(0) == xin.size(0)) {
iCol = win.size(0);
}
r1.set_size(iCol, xin.size(1));
bcoef = xin.size(0);
iCol = win.size(0);
if (bcoef <= iCol) {
iCol = bcoef;
}
if (xin.size(0) == 1) {
iCol = win.size(0);
} else if (win.size(0) == 1) {
iCol = xin.size(0);
} else if (win.size(0) == xin.size(0)) {
iCol = win.size(0);
}
if ((iCol != 0) && (xin.size(1) != 0)) {
bcoef = (xin.size(1) != 1);
i = xin.size(1) - 1;
for (int k{0}; k <= i; k++) {
int b_bcoef;
iCol = bcoef * k;
acoef = (win.size(0) != 1);
b_bcoef = (xin.size(0) != 1);
i1 = r1.size(0) - 1;
for (int b_k{0}; b_k <= i1; b_k++) {
r1[b_k + r1.size(0) * k] =
win[acoef * b_k] * xin[b_bcoef * b_k + xin.size(0) * iCol];
}
}
}
computeDFT(r1, options_nfft, varargout_1, win);
formatSpectrogram(varargout_1, win, options_nfft, options_range);
}
} // namespace coder
//
// File trailer for spectrogram.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/spectrogram.h b/dereverbrate/dereveb_c/spectrogram.h
index b483cb0..02af3e4 100644
--- a/dereverbrate/dereveb_c/spectrogram.h
+++ b/dereverbrate/dereveb_c/spectrogram.h
@@ -1,35 +1,35 @@
//
// File: spectrogram.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef SPECTROGRAM_H
#define SPECTROGRAM_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void b_spectrogram(const double x[264600],
const ::coder::array<double, 1U> &varargin_1,
double varargin_2, ::coder::array<creal_T, 2U> &varargout_1);
void spectrogram(const double x[220500],
const ::coder::array<double, 1U> &varargin_1,
double varargin_2, ::coder::array<creal_T, 2U> &varargout_1);
} // namespace coder
#endif
//
// File trailer for spectrogram.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/sum.cpp b/dereverbrate/dereveb_c/sum.cpp
index 2a37a03..64d8c77 100644
--- a/dereverbrate/dereveb_c/sum.cpp
+++ b/dereverbrate/dereveb_c/sum.cpp
@@ -1,99 +1,48 @@
//
// File: sum.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "sum.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
// Function Definitions
//
// Arguments : const ::coder::array<double, 2U> &x
// ::coder::array<double, 1U> &y
// Return Type : void
//
namespace coder {
void sum(const ::coder::array<double, 2U> &x, ::coder::array<double, 1U> &y)
{
if (x.size(0) == 0) {
y.set_size(0);
} else {
int vstride;
int xj;
vstride = x.size(0);
y.set_size(x.size(0));
for (xj = 0; xj < vstride; xj++) {
y[xj] = x[xj];
}
for (int k{0}; k < 399; k++) {
int xoffset;
xoffset = (k + 1) * vstride;
for (xj = 0; xj < vstride; xj++) {
y[xj] = y[xj] + x[xoffset + xj];
}
}
}
}
-//
-// Arguments : const ::coder::array<double, 1U> &x
-// Return Type : double
-//
-double sum(const ::coder::array<double, 1U> &x)
-{
- double y;
- if (x.size(0) == 0) {
- y = 0.0;
- } else {
- int firstBlockLength;
- int k;
- int lastBlockLength;
- int nblocks;
- if (x.size(0) <= 1024) {
- firstBlockLength = x.size(0);
- lastBlockLength = 0;
- nblocks = 1;
- } else {
- firstBlockLength = 1024;
- nblocks = x.size(0) / 1024;
- lastBlockLength = x.size(0) - (nblocks << 10);
- if (lastBlockLength > 0) {
- nblocks++;
- } else {
- lastBlockLength = 1024;
- }
- }
- y = x[0];
- for (k = 2; k <= firstBlockLength; k++) {
- y += x[k - 1];
- }
- for (int ib{2}; ib <= nblocks; ib++) {
- double bsum;
- int hi;
- firstBlockLength = (ib - 1) << 10;
- bsum = x[firstBlockLength];
- if (ib == nblocks) {
- hi = lastBlockLength;
- } else {
- hi = 1024;
- }
- for (k = 2; k <= hi; k++) {
- bsum += x[(firstBlockLength + k) - 1];
- }
- y += bsum;
- }
- }
- return y;
-}
-
} // namespace coder
//
// File trailer for sum.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/sum.h b/dereverbrate/dereveb_c/sum.h
index 2173cdd..ede2696 100644
--- a/dereverbrate/dereveb_c/sum.h
+++ b/dereverbrate/dereveb_c/sum.h
@@ -1,31 +1,29 @@
//
// File: sum.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef SUM_H
#define SUM_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
void sum(const ::coder::array<double, 2U> &x, ::coder::array<double, 1U> &y);
-double sum(const ::coder::array<double, 1U> &x);
-
-} // namespace coder
+}
#endif
//
// File trailer for sum.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/unsafeSxfun.cpp b/dereverbrate/dereveb_c/unsafeSxfun.cpp
index b0cc1a5..154106b 100644
--- a/dereverbrate/dereveb_c/unsafeSxfun.cpp
+++ b/dereverbrate/dereveb_c/unsafeSxfun.cpp
@@ -1,87 +1,90 @@
//
// File: unsafeSxfun.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "unsafeSxfun.h"
#include "rt_nonfinite.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
//
-// Arguments : coder::array<double, 1U> &r
-// const coder::array<double, 1U> &inputFramePower
+// Arguments : coder::array<double, 1U> &y
+// const coder::array<double, 1U> &a_tmp
// const coder::array<double, 1U> &newEstimates
+// const coder::array<double, 1U> &inputFramePower
// Return Type : void
//
-void binary_expand_op(coder::array<double, 1U> &r,
- const coder::array<double, 1U> &inputFramePower,
- const coder::array<double, 1U> &newEstimates)
+void binary_expand_op(coder::array<double, 1U> &y,
+ const coder::array<double, 1U> &a_tmp,
+ const coder::array<double, 1U> &newEstimates,
+ const coder::array<double, 1U> &inputFramePower)
{
- coder::array<double, 1U> b_inputFramePower;
+ coder::array<double, 1U> b_a_tmp;
int i;
int loop_ub;
int stride_0_0;
int stride_1_0;
int stride_2_0;
int stride_3_0;
- if (r.size(0) == 1) {
+ if (inputFramePower.size(0) == 1) {
i = newEstimates.size(0);
} else {
- i = r.size(0);
+ i = inputFramePower.size(0);
}
if (i == 1) {
- if (r.size(0) == 1) {
- i = inputFramePower.size(0);
+ if (y.size(0) == 1) {
+ i = a_tmp.size(0);
} else {
- i = r.size(0);
+ i = y.size(0);
}
- } else if (r.size(0) == 1) {
+ } else if (inputFramePower.size(0) == 1) {
i = newEstimates.size(0);
} else {
- i = r.size(0);
+ i = inputFramePower.size(0);
}
- b_inputFramePower.set_size(i);
- stride_0_0 = (inputFramePower.size(0) != 1);
- stride_1_0 = (r.size(0) != 1);
+ b_a_tmp.set_size(i);
+ stride_0_0 = (a_tmp.size(0) != 1);
+ stride_1_0 = (y.size(0) != 1);
stride_2_0 = (newEstimates.size(0) != 1);
- stride_3_0 = (r.size(0) != 1);
- if (r.size(0) == 1) {
+ stride_3_0 = (inputFramePower.size(0) != 1);
+ if (inputFramePower.size(0) == 1) {
i = newEstimates.size(0);
} else {
- i = r.size(0);
+ i = inputFramePower.size(0);
}
if (i == 1) {
- if (r.size(0) == 1) {
- loop_ub = inputFramePower.size(0);
+ if (y.size(0) == 1) {
+ loop_ub = a_tmp.size(0);
} else {
- loop_ub = r.size(0);
+ loop_ub = y.size(0);
}
- } else if (r.size(0) == 1) {
+ } else if (inputFramePower.size(0) == 1) {
loop_ub = newEstimates.size(0);
} else {
- loop_ub = r.size(0);
+ loop_ub = inputFramePower.size(0);
}
for (i = 0; i < loop_ub; i++) {
- b_inputFramePower[i] =
- (inputFramePower[i * stride_0_0] + r[i * stride_1_0]) /
- ((newEstimates[i * stride_2_0] + r[i * stride_3_0]) + 1.0E-8);
+ b_a_tmp[i] =
+ (a_tmp[i * stride_0_0] + y[i * stride_1_0]) /
+ ((newEstimates[i * stride_2_0] + inputFramePower[i * stride_3_0]) +
+ 1.0E-8);
}
- r.set_size(b_inputFramePower.size(0));
- loop_ub = b_inputFramePower.size(0);
+ y.set_size(b_a_tmp.size(0));
+ loop_ub = b_a_tmp.size(0);
for (i = 0; i < loop_ub; i++) {
double varargin_2;
- varargin_2 = b_inputFramePower[i];
- r[i] = std::fmin(1.0, varargin_2);
+ varargin_2 = b_a_tmp[i];
+ y[i] = std::fmin(1.0, varargin_2);
}
}
//
// File trailer for unsafeSxfun.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/unsafeSxfun.h b/dereverbrate/dereveb_c/unsafeSxfun.h
index f16ea61..6689188 100644
--- a/dereverbrate/dereveb_c/unsafeSxfun.h
+++ b/dereverbrate/dereveb_c/unsafeSxfun.h
@@ -1,28 +1,29 @@
//
// File: unsafeSxfun.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef UNSAFESXFUN_H
#define UNSAFESXFUN_H
// Include Files
#include "rtwtypes.h"
#include "coder_array.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
-void binary_expand_op(coder::array<double, 1U> &r,
- const coder::array<double, 1U> &inputFramePower,
- const coder::array<double, 1U> &newEstimates);
+void binary_expand_op(coder::array<double, 1U> &y,
+ const coder::array<double, 1U> &a_tmp,
+ const coder::array<double, 1U> &newEstimates,
+ const coder::array<double, 1U> &inputFramePower);
#endif
//
// File trailer for unsafeSxfun.h
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/welchparse.cpp b/dereverbrate/dereveb_c/welchparse.cpp
index 48b890b..2f8eb24 100644
--- a/dereverbrate/dereveb_c/welchparse.cpp
+++ b/dereverbrate/dereveb_c/welchparse.cpp
@@ -1,127 +1,127 @@
//
// File: welchparse.cpp
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
// Include Files
#include "welchparse.h"
#include "rt_nonfinite.h"
#include <cmath>
#include <math.h>
// Function Declarations
static double rt_powd_snf(double u0, double u1);
// Function Definitions
//
// Arguments : double u0
// double u1
// Return Type : double
//
static double rt_powd_snf(double u0, double u1)
{
double y;
if (std::isnan(u0) || std::isnan(u1)) {
y = rtNaN;
} else {
double d;
double d1;
d = std::abs(u0);
d1 = std::abs(u1);
if (std::isinf(u1)) {
if (d == 1.0) {
y = 1.0;
} else if (d > 1.0) {
if (u1 > 0.0) {
y = rtInf;
} else {
y = 0.0;
}
} else if (u1 > 0.0) {
y = 0.0;
} else {
y = rtInf;
}
} else if (d1 == 0.0) {
y = 1.0;
} else if (d1 == 1.0) {
if (u1 > 0.0) {
y = u0;
} else {
y = 1.0 / u0;
}
} else if (u1 == 2.0) {
y = u0 * u0;
} else if ((u1 == 0.5) && (u0 >= 0.0)) {
y = std::sqrt(u0);
} else if ((u0 < 0.0) && (u1 > std::floor(u1))) {
y = rtNaN;
} else {
y = std::pow(u0, u1);
}
}
return y;
}
//
// Arguments : double N
// double *options1_nfft
// double *options1_Fs
// double *options1_conflevel
// boolean_T *options1_average
// boolean_T *options1_maxhold
// boolean_T *options1_minhold
// boolean_T *options1_MIMO
// boolean_T *options1_isNFFTSingle
// boolean_T *options1_centerdc
// char options1_range[8]
// Return Type : void
//
namespace coder {
namespace signal {
namespace internal {
namespace spectral {
void welch_options(double N, double *options1_nfft, double *options1_Fs,
double *options1_conflevel, boolean_T *options1_average,
boolean_T *options1_maxhold, boolean_T *options1_minhold,
boolean_T *options1_MIMO, boolean_T *options1_isNFFTSingle,
boolean_T *options1_centerdc, char options1_range[8])
{
static const char cv[8]{'o', 'n', 'e', 's', 'i', 'd', 'e', 'd'};
double absn;
int eint;
for (int i{0}; i < 8; i++) {
options1_range[i] = cv[i];
}
absn = std::abs(N);
if ((!std::isinf(absn)) && (!std::isnan(absn))) {
double f;
f = frexp(absn, &eint);
absn = eint;
if (f == 0.5) {
absn = static_cast<double>(eint) - 1.0;
}
}
*options1_nfft = std::fmax(256.0, rt_powd_snf(2.0, absn));
*options1_Fs = rtNaN;
*options1_average = true;
*options1_maxhold = false;
*options1_minhold = false;
*options1_MIMO = false;
*options1_conflevel = rtNaN;
*options1_isNFFTSingle = false;
*options1_centerdc = false;
}
} // namespace spectral
} // namespace internal
} // namespace signal
} // namespace coder
//
// File trailer for welchparse.cpp
//
// [EOF]
//
diff --git a/dereverbrate/dereveb_c/welchparse.h b/dereverbrate/dereveb_c/welchparse.h
index 07d1a8f..a84c34f 100644
--- a/dereverbrate/dereveb_c/welchparse.h
+++ b/dereverbrate/dereveb_c/welchparse.h
@@ -1,38 +1,38 @@
//
// File: welchparse.h
//
// MATLAB Coder version : 5.3
-// C/C++ source code generated on : 29-Mar-2023 11:20:55
+// C/C++ source code generated on : 31-Mar-2023 11:34:29
//
#ifndef WELCHPARSE_H
#define WELCHPARSE_H
// Include Files
#include "rtwtypes.h"
#include "omp.h"
#include <cstddef>
#include <cstdlib>
// Function Declarations
namespace coder {
namespace signal {
namespace internal {
namespace spectral {
void welch_options(double N, double *options1_nfft, double *options1_Fs,
double *options1_conflevel, boolean_T *options1_average,
boolean_T *options1_maxhold, boolean_T *options1_minhold,
boolean_T *options1_MIMO, boolean_T *options1_isNFFTSingle,
boolean_T *options1_centerdc, char options1_range[8]);
}
} // namespace internal
} // namespace signal
} // namespace coder
#endif
//
// File trailer for welchparse.h
//
// [EOF]
//
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 12, 08:29 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1347144
Default Alt Text
(221 KB)
Attached To
R350 av_svc
Event Timeline
Log In to Comment