Compare commits

..

No commits in common. "1be102a51c4db4cb863700c008af2001d49b01d2" and "7cdc3856baaf0ef1b9c8e55ffaf0e44a3ca47b5e" have entirely different histories.

10 changed files with 103 additions and 103 deletions

View File

@ -49,15 +49,15 @@ void audio::algo::chunkware::Compressor::init() {
m_isConfigured = true; m_isConfigured = true;
} }
etk::Vector<enum audio::format> audio::algo::chunkware::Compressor::getSupportedFormat() { std::vector<enum audio::format> audio::algo::chunkware::Compressor::getSupportedFormat() {
etk::Vector<enum audio::format> out = getNativeSupportedFormat(); std::vector<enum audio::format> out = getNativeSupportedFormat();
out.pushBack(audio::format_int16); out.push_back(audio::format_int16);
return out; return out;
} }
etk::Vector<enum audio::format> audio::algo::chunkware::Compressor::getNativeSupportedFormat() { std::vector<enum audio::format> audio::algo::chunkware::Compressor::getNativeSupportedFormat() {
etk::Vector<enum audio::format> out; std::vector<enum audio::format> out;
out.pushBack(audio::format_double); out.push_back(audio::format_double);
return out; return out;
} }
@ -82,7 +82,7 @@ void audio::algo::chunkware::Compressor::process(void* _output, const void* _inp
processDouble(vals, vals, _nbChannel); processDouble(vals, vals, _nbChannel);
for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) { for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) {
vals[kkk] *= 32768.0; vals[kkk] *= 32768.0;
output[iii*_nbChannel+kkk] = int16_t(etk::avg(-32768.0, vals[kkk], 32767.0)); output[iii*_nbChannel+kkk] = int16_t(std::avg(-32768.0, vals[kkk], 32767.0));
} }
} }
} }
@ -108,8 +108,8 @@ void audio::algo::chunkware::Compressor::processDouble(double* _out, const doubl
double keyLink = 0; double keyLink = 0;
// get greater value; // get greater value;
for (int8_t iii=0; iii<_nbChannel; ++iii) { for (int8_t iii=0; iii<_nbChannel; ++iii) {
double absValue = etk::abs(_in[iii]); double absValue = std::abs(_in[iii]);
keyLink = etk::max(keyLink, absValue); keyLink = std::max(keyLink, absValue);
} }
processDouble(_out, _in, _nbChannel, keyLink); processDouble(_out, _in, _nbChannel, keyLink);
} }

View File

@ -47,12 +47,12 @@ namespace audio {
* @brief Get list of format suported in input. * @brief Get list of format suported in input.
* @return list of supported format * @return list of supported format
*/ */
virtual etk::Vector<enum audio::format> getSupportedFormat(); virtual std::vector<enum audio::format> getSupportedFormat();
/** /**
* @brief Get list of algorithm format suported. No format convertion. * @brief Get list of algorithm format suported. No format convertion.
* @return list of supported format * @return list of supported format
*/ */
virtual etk::Vector<enum audio::format> getNativeSupportedFormat(); virtual std::vector<enum audio::format> getNativeSupportedFormat();
/** /**
* @brief Main input algo process. * @brief Main input algo process.
* @param[in,out] _output Output data. * @param[in,out] _output Output data.

View File

@ -47,15 +47,15 @@ void audio::algo::chunkware::Gate::init() {
m_isConfigured = true; m_isConfigured = true;
} }
etk::Vector<enum audio::format> audio::algo::chunkware::Gate::getSupportedFormat() { std::vector<enum audio::format> audio::algo::chunkware::Gate::getSupportedFormat() {
etk::Vector<enum audio::format> out = getNativeSupportedFormat(); std::vector<enum audio::format> out = getNativeSupportedFormat();
out.pushBack(audio::format_int16); out.push_back(audio::format_int16);
return out; return out;
} }
etk::Vector<enum audio::format> audio::algo::chunkware::Gate::getNativeSupportedFormat() { std::vector<enum audio::format> audio::algo::chunkware::Gate::getNativeSupportedFormat() {
etk::Vector<enum audio::format> out; std::vector<enum audio::format> out;
out.pushBack(audio::format_double); out.push_back(audio::format_double);
return out; return out;
} }
@ -77,7 +77,7 @@ void audio::algo::chunkware::Gate::process(void* _output, const void* _input, si
processDouble(vals, vals, _nbChannel); processDouble(vals, vals, _nbChannel);
for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) { for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) {
vals[kkk] *= 32768.0; vals[kkk] *= 32768.0;
output[iii*_nbChannel+kkk] = int16_t(etk::avg(-32768.0, vals[kkk], 32767.0)); output[iii*_nbChannel+kkk] = int16_t(std::avg(-32768.0, vals[kkk], 32767.0));
} }
} }
} }
@ -103,8 +103,8 @@ void audio::algo::chunkware::Gate::processDouble(double* _out, const double* _in
double keyLink = 0; double keyLink = 0;
// get greater value; // get greater value;
for (int8_t iii=0; iii<_nbChannel; ++iii) { for (int8_t iii=0; iii<_nbChannel; ++iii) {
double absValue = etk::abs(_in[iii]); double absValue = std::abs(_in[iii]);
keyLink = etk::max(keyLink, absValue); keyLink = std::max(keyLink, absValue);
} }
processDouble(_out, _in, _nbChannel, keyLink); processDouble(_out, _in, _nbChannel, keyLink);
} }

View File

@ -47,12 +47,12 @@ namespace audio {
* @brief Get list of format suported in input. * @brief Get list of format suported in input.
* @return list of supported format * @return list of supported format
*/ */
virtual etk::Vector<enum audio::format> getSupportedFormat(); virtual std::vector<enum audio::format> getSupportedFormat();
/** /**
* @brief Get list of algorithm format suported. No format convertion. * @brief Get list of algorithm format suported. No format convertion.
* @return list of supported format * @return list of supported format
*/ */
virtual etk::Vector<enum audio::format> getNativeSupportedFormat(); virtual std::vector<enum audio::format> getNativeSupportedFormat();
/** /**
* @brief Main input algo process. * @brief Main input algo process.
* @param[in,out] _output Output data. * @param[in,out] _output Output data.

View File

@ -74,24 +74,25 @@ void audio::algo::chunkware::Limiter::init(int8_t _nbChannel) {
m_outputBuffer.resize(_nbChannel); m_outputBuffer.resize(_nbChannel);
for (int8_t iii=0; iii<_nbChannel; ++iii) { for (int8_t iii=0; iii<_nbChannel; ++iii) {
m_outputBuffer[iii].resize(BUFFER_SIZE, 0.0); m_outputBuffer[iii].resize(BUFFER_SIZE, 0.0);
m_outputBuffer[iii].assign(BUFFER_SIZE, 0.0);
} }
m_isConfigured = true; m_isConfigured = true;
} }
void audio::algo::chunkware::FastEnvelope::setCoef() { void audio::algo::chunkware::FastEnvelope::setCoef() {
// rises to 99% of in value over duration of time constant // rises to 99% of in value over duration of time constant
m_coefficient = etk::pow(0.01, (1000.0 / (m_timeMs * m_sampleRate))); m_coefficient = std::pow(0.01, (1000.0 / (m_timeMs * m_sampleRate)));
} }
etk::Vector<enum audio::format> audio::algo::chunkware::Limiter::getSupportedFormat() { std::vector<enum audio::format> audio::algo::chunkware::Limiter::getSupportedFormat() {
etk::Vector<enum audio::format> out = getNativeSupportedFormat(); std::vector<enum audio::format> out = getNativeSupportedFormat();
out.pushBack(audio::format_int16); out.push_back(audio::format_int16);
return out; return out;
} }
etk::Vector<enum audio::format> audio::algo::chunkware::Limiter::getNativeSupportedFormat() { std::vector<enum audio::format> audio::algo::chunkware::Limiter::getNativeSupportedFormat() {
etk::Vector<enum audio::format> out; std::vector<enum audio::format> out;
out.pushBack(audio::format_double); out.push_back(audio::format_double);
return out; return out;
} }
@ -116,7 +117,7 @@ void audio::algo::chunkware::Limiter::process(void* _output, const void* _input,
processDouble(vals, vals, _nbChannel); processDouble(vals, vals, _nbChannel);
for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) { for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) {
vals[kkk] *= 32768.0; vals[kkk] *= 32768.0;
output[iii*_nbChannel+kkk] = int16_t(etk::avg(-32768.0, vals[kkk], 32767.0)); output[iii*_nbChannel+kkk] = int16_t(std::avg(-32768.0, vals[kkk], 32767.0));
} }
} }
} }
@ -141,8 +142,8 @@ void audio::algo::chunkware::Limiter::processDouble(double* _out, const double*
double keyLink = 0; double keyLink = 0;
// get greater value; // get greater value;
for (int8_t iii=0; iii<_nbChannel; ++iii) { for (int8_t iii=0; iii<_nbChannel; ++iii) {
double absValue = etk::abs(_in[iii]); double absValue = std::abs(_in[iii]);
keyLink = etk::max(keyLink, absValue); keyLink = std::max(keyLink, absValue);
} }
// we always want to feed the sidechain AT LEATS the threshold value // we always want to feed the sidechain AT LEATS the threshold value
if (keyLink < m_threshold) { if (keyLink < m_threshold) {

View File

@ -28,8 +28,8 @@
#include <audio/format.hpp> #include <audio/format.hpp>
#include <audio/algo/chunkware/AttRelEnvelope.hpp> #include <audio/algo/chunkware/AttRelEnvelope.hpp>
#include <audio/algo/chunkware/Gain.hpp> #include <audio/algo/chunkware/Gain.hpp>
#include <echrono/Steady.hpp> #include <chrono>
#include <etk/Vector.hpp> #include <vector>
namespace audio { namespace audio {
namespace algo { namespace algo {
@ -63,12 +63,12 @@ namespace audio {
* @brief Get list of format suported in input. * @brief Get list of format suported in input.
* @return list of supported format * @return list of supported format
*/ */
virtual etk::Vector<enum audio::format> getSupportedFormat(); virtual std::vector<enum audio::format> getSupportedFormat();
/** /**
* @brief Get list of algorithm format suported. No format convertion. * @brief Get list of algorithm format suported. No format convertion.
* @return list of supported format * @return list of supported format
*/ */
virtual etk::Vector<enum audio::format> getNativeSupportedFormat(); virtual std::vector<enum audio::format> getNativeSupportedFormat();
/** /**
* @brief Main input algo process. * @brief Main input algo process.
* @param[in,out] _output Output data. * @param[in,out] _output Output data.
@ -97,7 +97,7 @@ namespace audio {
} }
protected: protected:
echrono::microseconds m_attackTime; //!< attaque time in ms. std::chrono::microseconds m_attackTime; //!< attaque time in ms.
public: public:
virtual void setAttack(double _ms); virtual void setAttack(double _ms);
virtual double getAttack() const { virtual double getAttack() const {
@ -105,7 +105,7 @@ namespace audio {
} }
protected: protected:
echrono::microseconds m_releaseTime; //!< attaque time in ms. std::chrono::microseconds m_releaseTime; //!< attaque time in ms.
public: public:
virtual void setRelease(double _ms); virtual void setRelease(double _ms);
virtual double getRelease() const { virtual double getRelease() const {
@ -150,7 +150,7 @@ namespace audio {
static const int BUFFER_SIZE = 1024; //!< buffer size (always a power of 2!) static const int BUFFER_SIZE = 1024; //!< buffer size (always a power of 2!)
uint32_t m_bufferMask; //!< buffer mask uint32_t m_bufferMask; //!< buffer mask
uint32_t m_cursor; //!< cursor uint32_t m_cursor; //!< cursor
etk::Vector<etk::Vector<double> > m_outputBuffer; //!< output buffer std::vector<std::vector<double> > m_outputBuffer; //!< output buffer
}; };
} }
} }

View File

@ -13,7 +13,7 @@ def get_desc():
return "test chunkware" return "test chunkware"
def get_licence(): def get_licence():
return "MPL-2" return "APACHE-2"
def get_compagny_type(): def get_compagny_type():
return "com" return "com"

View File

@ -1,7 +1,7 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* @copyright 2015, Edouard DUPIN, all right reserved * @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
#include <test-debug/debug.hpp> #include <test-debug/debug.hpp>
@ -10,14 +10,13 @@
#include <audio/algo/chunkware/Limiter.hpp> #include <audio/algo/chunkware/Limiter.hpp>
#include <audio/algo/chunkware/Gate.hpp> #include <audio/algo/chunkware/Gate.hpp>
#include <etk/os/FSNode.hpp> #include <etk/os/FSNode.hpp>
#include <echrono/Steady.hpp> #include <chrono>
#include <ethread/Thread.hpp> #include <thread>
#include <ethread/tools.hpp>
static etk::Vector<double> convert(const etk::Vector<int16_t>& _data) { static std::vector<double> convert(const std::vector<int16_t>& _data) {
etk::Vector<double> out; std::vector<double> out;
out.resize(_data.size(), 0.0); out.resize(_data.size(), 0.0);
for (size_t iii=0; iii<_data.size(); ++iii) { for (size_t iii=0; iii<_data.size(); ++iii) {
out[iii] = _data[iii]; out[iii] = _data[iii];
@ -28,11 +27,11 @@ static etk::Vector<double> convert(const etk::Vector<int16_t>& _data) {
return out; return out;
} }
static etk::Vector<int16_t> convert(const etk::Vector<double>& _data) { static std::vector<int16_t> convert(const std::vector<double>& _data) {
etk::Vector<int16_t> out; std::vector<int16_t> out;
out.resize(_data.size(), 0.0); out.resize(_data.size(), 0.0);
for (size_t iii=0; iii<_data.size(); ++iii) { for (size_t iii=0; iii<_data.size(); ++iii) {
out[iii] = int16_t(etk::avg(-32768.0, _data[iii]*32768.0, 32767.0)); out[iii] = int16_t(std::avg(-32768.0, _data[iii]*32768.0, 32767.0));
} }
return out; return out;
} }
@ -40,40 +39,40 @@ static etk::Vector<int16_t> convert(const etk::Vector<double>& _data) {
class Performance { class Performance {
private: private:
echrono::Steady m_timeStart; std::chrono::steady_clock::time_point m_timeStart;
echrono::Steady m_timeStop; std::chrono::steady_clock::time_point m_timeStop;
echrono::Duration m_totalTimeProcessing; std::chrono::nanoseconds m_totalTimeProcessing;
echrono::Duration m_minProcessing; std::chrono::nanoseconds m_minProcessing;
echrono::Duration m_maxProcessing; std::chrono::nanoseconds m_maxProcessing;
int32_t m_totalIteration; int32_t m_totalIteration;
public: public:
Performance() : Performance() :
m_totalTimeProcessing(0), m_totalTimeProcessing(0),
m_minProcessing(int64_t(99999999999999LL)), m_minProcessing(99999999999999LL),
m_maxProcessing(0), m_maxProcessing(0),
m_totalIteration(0) { m_totalIteration(0) {
} }
void tic() { void tic() {
m_timeStart = echrono::Steady::now(); m_timeStart = std::chrono::steady_clock::now();
} }
void toc() { void toc() {
m_timeStop = echrono::Steady::now(); m_timeStop = std::chrono::steady_clock::now();
echrono::Duration time = m_timeStop - m_timeStart; std::chrono::nanoseconds time = m_timeStop - m_timeStart;
m_minProcessing = etk::min(m_minProcessing, time); m_minProcessing = std::min(m_minProcessing, time);
m_maxProcessing = etk::max(m_maxProcessing, time); m_maxProcessing = std::max(m_maxProcessing, time);
m_totalTimeProcessing += time; m_totalTimeProcessing += time;
m_totalIteration++; m_totalIteration++;
} }
echrono::Duration getTotalTimeProcessing() { std::chrono::nanoseconds getTotalTimeProcessing() {
return m_totalTimeProcessing; return m_totalTimeProcessing;
} }
echrono::Duration getMinProcessing() { std::chrono::nanoseconds getMinProcessing() {
return m_minProcessing; return m_minProcessing;
} }
echrono::Duration getMaxProcessing() { std::chrono::nanoseconds getMaxProcessing() {
return m_maxProcessing; return m_maxProcessing;
} }
int32_t getTotalIteration() { int32_t getTotalIteration() {
@ -83,9 +82,9 @@ class Performance {
}; };
void performanceCompressor() { void performanceCompressor() {
etk::Vector<double> input; std::vector<double> input;
input.resize(8192, 0); input.resize(8192, 0);
etk::Vector<double> output; std::vector<double> output;
output.resize(8192, 0); output.resize(8192, 0);
double sampleRate = 48000.0; double sampleRate = 48000.0;
{ {
@ -109,22 +108,22 @@ void performanceCompressor() {
perfo.tic(); perfo.tic();
algo.process(&output[0], &input[0], input.size(), 1, audio::format_double); algo.process(&output[0], &input[0], input.size(), 1, audio::format_double);
perfo.toc(); perfo.toc();
ethread::sleepMilliSeconds((1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
TEST_PRINT("Performance Compressor (double): "); TEST_PRINT("Performance Compressor (double): ");
TEST_PRINT(" blockSize=" << input.size() << " sample"); TEST_PRINT(" blockSize=" << input.size() << " sample");
TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing() << " < " TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << "ns < " << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing()); << perfo.getMaxProcessing().count() << "ns ");
TEST_PRINT(" min < avg < max= " << (float((perfo.getMinProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < " TEST_PRINT(" min < avg < max= " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < " << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%"); << (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
} }
void performanceLimiter() { void performanceLimiter() {
etk::Vector<double> input; std::vector<double> input;
input.resize(8192, 0); input.resize(8192, 0);
etk::Vector<double> output; std::vector<double> output;
output.resize(8192, 0); output.resize(8192, 0);
double sampleRate = 48000.0; double sampleRate = 48000.0;
{ {
@ -150,22 +149,22 @@ void performanceLimiter() {
perfo.tic(); perfo.tic();
algo.process(&output[0], &input[0], input.size(), 1, audio::format_double); algo.process(&output[0], &input[0], input.size(), 1, audio::format_double);
perfo.toc(); perfo.toc();
ethread::sleepMilliSeconds((1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
TEST_PRINT("Performance Limiter (double): "); TEST_PRINT("Performance Limiter (double): ");
TEST_PRINT(" blockSize=" << input.size() << " sample"); TEST_PRINT(" blockSize=" << input.size() << " sample");
TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing() << " < " TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << "ns < " << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing()); << perfo.getMaxProcessing().count() << "ns ");
TEST_PRINT(" min < avg < max = " << (float((perfo.getMinProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < " TEST_PRINT(" min < avg < max = " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < " << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%"); << (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
} }
void performanceGate() { void performanceGate() {
etk::Vector<double> input; std::vector<double> input;
input.resize(8192, 0); input.resize(8192, 0);
etk::Vector<double> output; std::vector<double> output;
output.resize(8192, 0); output.resize(8192, 0);
double sampleRate = 48000.0; double sampleRate = 48000.0;
{ {
@ -191,16 +190,16 @@ void performanceGate() {
perfo.tic(); perfo.tic();
algo.process(&output[0], &input[0], input.size(), 1, audio::format_double); algo.process(&output[0], &input[0], input.size(), 1, audio::format_double);
perfo.toc(); perfo.toc();
ethread::sleepMilliSeconds((1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
TEST_PRINT("Performance Gate (double): "); TEST_PRINT("Performance Gate (double): ");
TEST_PRINT(" blockSize=" << input.size() << " sample"); TEST_PRINT(" blockSize=" << input.size() << " sample");
TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing() << " < " TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << "ns < " << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing()); << perfo.getMaxProcessing().count() << "ns ");
TEST_PRINT(" min < avg < max = " << (float((perfo.getMinProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < " TEST_PRINT(" min < avg < max = " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < " << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%"); << (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
} }
@ -209,12 +208,12 @@ void performanceGate() {
int main(int _argc, const char** _argv) { int main(int _argc, const char** _argv) {
// the only one init for etk: // the only one init for etk:
etk::init(_argc, _argv); etk::init(_argc, _argv);
etk::String inputName = ""; std::string inputName = "";
bool performance = false; bool performance = false;
bool perf = false; bool perf = false;
int64_t sampleRate = 48000; int64_t sampleRate = 48000;
for (int32_t iii=0; iii<_argc ; ++iii) { for (int32_t iii=0; iii<_argc ; ++iii) {
etk::String data = _argv[iii]; std::string data = _argv[iii];
if (etk::start_with(data,"--in=")) { if (etk::start_with(data,"--in=")) {
inputName = &data[5]; inputName = &data[5];
} else if (data == "--performance") { } else if (data == "--performance") {
@ -247,10 +246,10 @@ int main(int _argc, const char** _argv) {
exit(-1); exit(-1);
} }
TEST_INFO("Read input:"); TEST_INFO("Read input:");
etk::Vector<double> inputData = convert(etk::FSNodeReadAllDataType<int16_t>(inputName)); std::vector<double> inputData = convert(etk::FSNodeReadAllDataType<int16_t>(inputName));
TEST_INFO(" " << inputData.size() << " samples"); TEST_INFO(" " << inputData.size() << " samples");
// resize output : // resize output :
etk::Vector<double> output; std::vector<double> output;
output.resize(inputData.size(), 0); output.resize(inputData.size(), 0);
// process in chunk of 256 samples // process in chunk of 256 samples
int32_t blockSize = 256; int32_t blockSize = 256;
@ -272,7 +271,7 @@ int main(int _argc, const char** _argv) {
algo.process(audio::format_double, &output[iii*blockSize], &inputData[iii*blockSize], blockSize, 1); algo.process(audio::format_double, &output[iii*blockSize], &inputData[iii*blockSize], blockSize, 1);
if (perf == true) { if (perf == true) {
perfo.toc(); perfo.toc();
ethread::sleepMilliSeconds((1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
} }
*/ */
@ -294,7 +293,7 @@ int main(int _argc, const char** _argv) {
algo.process(&output[iii*blockSize], &inputData[iii*blockSize], blockSize, 1, audio::format_double); algo.process(&output[iii*blockSize], &inputData[iii*blockSize], blockSize, 1, audio::format_double);
if (perf == true) { if (perf == true) {
perfo.toc(); perfo.toc();
ethread::sleepMilliSeconds((1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
} }
@ -302,13 +301,13 @@ int main(int _argc, const char** _argv) {
if (perf == true) { if (perf == true) {
TEST_INFO("Performance Result: "); TEST_INFO("Performance Result: ");
TEST_INFO(" blockSize=" << blockSize << " sample"); TEST_INFO(" blockSize=" << blockSize << " sample");
TEST_INFO(" min=" << perfo.getMinProcessing()); TEST_INFO(" min=" << perfo.getMinProcessing().count() << " ns");
TEST_INFO(" max=" << perfo.getMaxProcessing()); TEST_INFO(" max=" << perfo.getMaxProcessing().count() << " ns");
TEST_INFO(" avg=" << perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << " ns"); TEST_INFO(" avg=" << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << " ns");
TEST_INFO(" min=" << (float((perfo.getMinProcessing().get()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %"); TEST_INFO(" min=" << (float((perfo.getMinProcessing().count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" max=" << (float((perfo.getMaxProcessing().get()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %"); TEST_INFO(" max=" << (float((perfo.getMaxProcessing().count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRate)/blockSize)/1000000000.0)*100.0 << " %"); TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
} }
etk::FSNodeWriteAllDataType<int16_t>("output.raw", convert(output)); etk::FSNodeWriteAllDataType<int16_t>("output.raw", convert(output));

View File

@ -1 +1 @@
1.0.0 0.2.0