Files
EqualizerAPO/libHybridConv-0.1.1/hcTest.c
T
jthedering b8cdd47f71 Version 1.0
Added: Configuration Editor, which allows to edit configurations in a graphical user interface. Contains GUIs for most commands supported by E-APO, but as lines can also be edited directly, all commands can be used.
Added: Command "GraphicEQ", which can act as a regular, fixed-band graphic equalizer (via the GUI) but also supports variable bands so that any desired frequency response can be specified. Internally, it is implemented via convolution with a generated IR.
Added: Command "Convolution", which allows to convolve the signal with a user-provided impulse response to achieve e.g. equalization or reverberation effects.
Improved: Configurator performs checks for registry values that are needed for the operation of E-APO, which may be changed by driver installations, fixing the values if necessary.
Improved: Configurator shows which is the default device as a hint to the user.
2015-09-27 16:01:21 +00:00

139 lines
3.9 KiB
C

/***************************************************************************
* Copyright (C) 2009 by Christian Borss *
* christian.borss@rub.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "libHybridConv.h"
#include <math.h>
int main(void)
{
int s, m, l;
int sflen, mflen, lflen;
int num;
double tau_1, tau_16;
double cpu_load;
double c0[9];
double c1[9];
double tau_s, tau_m, tau_l;
int num_s, num_m, num_l;
int hlen = 96000;
int f_s = 48000;
// performance measurement with uniform segmentation
for (s = 0; s < 9; s++)
{
sflen = 64 << s;
num = 1;
printf("%5d / %2d ", sflen, num);
tau_1 = getProcTime(sflen, num, 2.0);
num = 16;
printf("%5d / %2d ", sflen, num);
tau_16 = getProcTime(sflen, num, 2.0);
c1[s] = (tau_16 - tau_1) / 15.0;
c0[s] = tau_1 - c1[s];
printf("\n");
}
printf("\n");
// performance prediction with 3 segment lengths
for (s = 0; s < 5; s++)
{
for (m = 1; m < 5; m++)
{
for (l = 1; l+m+s < 9; l++)
{
sflen = 64 << s;
mflen = sflen << m;
lflen = mflen << l;
num_s = mflen / sflen;
num_m = 2 * lflen / mflen;
num_l = ceil((hlen - num_s * sflen - num_m * mflen) / (double)lflen);
tau_s = c0[s] + c1[s] * num_s;
tau_m = c0[s+m] + c1[s+m] * num_m;
tau_l = c0[s+m+l] + c1[s+m+l] * num_l;
cpu_load = 100.0 * (tau_s * lflen / sflen + tau_m * lflen / mflen + tau_l) * f_s / (double)lflen;
printf("%4d / %4d / %4d ", sflen, mflen, lflen);
printf("Predicted CPU load: %5.2f %%\n", cpu_load);
}
}
printf("\n");
}
printf("\n");
// performance prediction with 2 segment lengths
for (m = 0; m < 8; m++)
{
for (l = 1; l+m < 9; l++)
{
mflen = 64 << m;
lflen = mflen << l;
num_m = 2 * lflen / mflen;
num_l = ceil((hlen - num_m * mflen) / (double)lflen);
tau_m = c0[m] + c1[m] * num_m;
tau_l = c0[m+l] + c1[m+l] * num_l;
cpu_load = 100.0 * (tau_m * lflen / mflen + tau_l) * f_s / (double)lflen;
printf(" / %4d / %4d ", mflen, lflen);
printf("Predicted CPU load: %5.2f %%\n", cpu_load);
}
printf("\n");
}
printf("\n");
// performance prediction with 1 segment lengths
for (l = 0; l < 9; l++)
{
lflen = 64 << l;
num_l = ceil(hlen / (double)lflen);
tau_l = c0[l] + c1[l] * num_l;
cpu_load = 100.0 * tau_l * f_s / (double)lflen;
printf(" / / %4d ", lflen);
printf("Predicted CPU load: %5.2f %%\n", cpu_load);
}
printf("\n");
for (s = 0; s < 5; s++)
{
for (m = 1; m < 5; m++)
{
for (l = 1; l+m+s < 9; l++)
{
sflen = 64 << s;
mflen = sflen << m;
lflen = mflen << l;
printf("%4d / %4d / %4d ", sflen, mflen, lflen);
hcBenchmarkTripple(sflen, mflen, lflen);
}
}
printf("\n");
}
return 0;
}