[DEV] update new lutin 0.8.0

This commit is contained in:
Edouard DUPIN 2015-10-14 21:21:03 +02:00
parent 6c8ec84963
commit f81dd459c6
5 changed files with 81 additions and 101 deletions

View File

@ -3,17 +3,34 @@ import lutin.module as module
import lutin.tools as tools
import lutin.debug as debug
def get_type():
return "BINARY"
def get_sub_type():
return "TEST"
def get_desc():
return "test chunkware"
def get_licence():
return "APACHE-2"
def create(target):
my_module = module.Module(__file__, 'audio-algo-chunkware-test', 'BINARY')
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
my_module.add_src_file([
'test/main.cpp',
'test/debug.cpp'
'test/main.cpp'
])
my_module.add_module_depend(['audio-algo-chunkware'])
my_module.add_module_depend(['audio-algo-chunkware', 'test-debug'])
return my_module

View File

@ -3,12 +3,30 @@ import lutin.module as module
import lutin.tools as tools
import lutin.debug as debug
def get_type():
return "LIBRARY"
def get_desc():
return "chunkware algo"
def get_licence():
return "BSD-2"
def create(target):
my_module = module.Module(__file__, 'audio-algo-chunkware', 'LIBRARY')
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
def get_version():
return [0,0,0]
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
my_module.add_src_file([
'audio/algo/chunkware/debug.cpp',
'audio/algo/chunkware/Compressor.cpp',
@ -26,11 +44,11 @@ def create(target):
'audio/algo/chunkware/AttRelEnvelope.h',
'audio/algo/chunkware/Gate.h',
'audio/algo/chunkware/GateRms.h',
'audio/algo/chunkware/Gain.h',
'audio/algo/chunkware/Limiter.h'
])
my_module.add_module_depend(['etk', 'audio'])
my_module.add_path(tools.get_current_path(__file__))
# return module
return my_module

View File

@ -1,13 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#include "debug.h"
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("test-LMS");
return g_val;
}

View File

@ -1,42 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#ifndef __APPL_DEBUG_H__
#define __APPL_DEBUG_H__
#include <etk/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_PRINT(data) APPL_BASE(-1, data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)
#ifdef DEBUG
#define APPL_INFO(data) APPL_BASE(4, data)
#define APPL_DEBUG(data) APPL_BASE(5, data)
#define APPL_VERBOSE(data) APPL_BASE(6, data)
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
#else
#define APPL_INFO(data) do { } while(false)
#define APPL_DEBUG(data) do { } while(false)
#define APPL_VERBOSE(data) do { } while(false)
#define APPL_TODO(data) do { } while(false)
#endif
#define APPL_ASSERT(cond,data) \
do { \
if (!(cond)) { \
APPL_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)
#endif

View File

@ -4,7 +4,7 @@
* @license APACHE v2.0 (see license file)
*/
#include <test/debug.h>
#include <test-debug/debug.h>
#include <etk/etk.h>
#include <audio/algo/chunkware/Compressor.h>
#include <audio/algo/chunkware/Limiter.h>
@ -24,7 +24,7 @@ static std::vector<double> convert(const std::vector<int16_t>& _data) {
out[iii] = _data[iii];
out[iii] /= 32768.0;
out[iii] *= 2.1;
//APPL_INFO(" in=" << _data[iii] << " => " << out[iii]);
//TEST_INFO(" in=" << _data[iii] << " => " << out[iii]);
}
return out;
}
@ -100,7 +100,7 @@ void performanceCompressor() {
}
}
}
APPL_PRINT("Start compressor performance ...");
TEST_PRINT("Start compressor performance ...");
Performance perfo;
audio::algo::chunkware::Compressor algo;
algo.setThreshold(-10);
@ -112,12 +112,12 @@ void performanceCompressor() {
perfo.toc();
usleep(1000);
}
APPL_PRINT("Performance Compressor (double): ");
APPL_PRINT(" blockSize=" << input.size() << " sample");
APPL_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
TEST_PRINT("Performance Compressor (double): ");
TEST_PRINT(" blockSize=" << input.size() << " sample");
TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing().count() << "ns ");
APPL_PRINT(" min < avg < max= " << (float((perfo.getMinProcessing().count()*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().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
}
@ -139,7 +139,7 @@ void performanceLimiter() {
}
}
}
APPL_PRINT("Start Limiter performance ...");
TEST_PRINT("Start Limiter performance ...");
Performance perfo;
audio::algo::chunkware::Limiter algo;
algo.setSampleRate(48000);
@ -153,12 +153,12 @@ void performanceLimiter() {
perfo.toc();
usleep(1000);
}
APPL_PRINT("Performance Limiter (double): ");
APPL_PRINT(" blockSize=" << input.size() << " sample");
APPL_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
TEST_PRINT("Performance Limiter (double): ");
TEST_PRINT(" blockSize=" << input.size() << " sample");
TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing().count() << "ns ");
APPL_PRINT(" min < avg < max = " << (float((perfo.getMinProcessing().count()*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().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
}
@ -180,7 +180,7 @@ void performanceGate() {
}
}
}
APPL_PRINT("Start Gate performance ...");
TEST_PRINT("Start Gate performance ...");
Performance perfo;
audio::algo::chunkware::Gate algo;
algo.setSampleRate(48000);
@ -194,12 +194,12 @@ void performanceGate() {
perfo.toc();
usleep(1000);
}
APPL_PRINT("Performance Gate (double): ");
APPL_PRINT(" blockSize=" << input.size() << " sample");
APPL_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
TEST_PRINT("Performance Gate (double): ");
TEST_PRINT(" blockSize=" << input.size() << " sample");
TEST_PRINT(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing().count() << "ns ");
APPL_PRINT(" min < avg < max = " << (float((perfo.getMinProcessing().count()*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().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
}
@ -227,12 +227,12 @@ int main(int _argc, const char** _argv) {
sampleRate = etk::string_to_int32_t(data);
} else if ( data == "-h"
|| data == "--help") {
APPL_PRINT("Help : ");
APPL_PRINT(" ./xxx --fb=file.raw --mic=file.raw");
APPL_PRINT(" --in=YYY.raw inout file");
APPL_PRINT(" --performance Generate signal to force algo to maximum process time");
APPL_PRINT(" --perf Enable performence test (little slower but real performence test)");
APPL_PRINT(" --sample-rate=XXXX Signal sample rate (default 48000)");
TEST_PRINT("Help : ");
TEST_PRINT(" ./xxx --fb=file.raw --mic=file.raw");
TEST_PRINT(" --in=YYY.raw inout file");
TEST_PRINT(" --performance Generate signal to force algo to maximum process time");
TEST_PRINT(" --perf Enable performence test (little slower but real performence test)");
TEST_PRINT(" --sample-rate=XXXX Signal sample rate (default 48000)");
exit(0);
}
}
@ -244,12 +244,12 @@ int main(int _argc, const char** _argv) {
return 0;
}
if (inputName == "") {
APPL_ERROR("Can not Process missing parameters...");
TEST_ERROR("Can not Process missing parameters...");
exit(-1);
}
APPL_INFO("Read input:");
TEST_INFO("Read input:");
std::vector<double> inputData = convert(etk::FSNodeReadAllDataType<int16_t>(inputName));
APPL_INFO(" " << inputData.size() << " samples");
TEST_INFO(" " << inputData.size() << " samples");
// resize output :
std::vector<double> output;
output.resize(inputData.size(), 0);
@ -265,9 +265,9 @@ int main(int _argc, const char** _argv) {
for (int32_t iii=0; iii<output.size()/blockSize; ++iii) {
if (lastPourcent != 100*iii / (output.size()/blockSize)) {
lastPourcent = 100*iii / (output.size()/blockSize);
APPL_INFO("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
TEST_INFO("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
} else {
APPL_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize);
TEST_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize);
}
perfo.tic();
algo.process(audio::format_double, &output[iii*blockSize], &inputData[iii*blockSize], blockSize, 1);
@ -287,9 +287,9 @@ int main(int _argc, const char** _argv) {
for (int32_t iii=0; iii<output.size()/blockSize; ++iii) {
if (lastPourcent != 100*iii / (output.size()/blockSize)) {
lastPourcent = 100*iii / (output.size()/blockSize);
APPL_INFO("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
TEST_INFO("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
} else {
APPL_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize);
TEST_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize);
}
perfo.tic();
algo.process(&output[iii*blockSize], &inputData[iii*blockSize], blockSize, 1, audio::format_double);
@ -301,15 +301,15 @@ int main(int _argc, const char** _argv) {
if (perf == true) {
APPL_INFO("Performance Result: ");
APPL_INFO(" blockSize=" << blockSize << " sample");
APPL_INFO(" min=" << perfo.getMinProcessing().count() << " ns");
APPL_INFO(" max=" << perfo.getMaxProcessing().count() << " ns");
APPL_INFO(" avg=" << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << " ns");
TEST_INFO("Performance Result: ");
TEST_INFO(" blockSize=" << blockSize << " sample");
TEST_INFO(" min=" << perfo.getMinProcessing().count() << " ns");
TEST_INFO(" max=" << perfo.getMaxProcessing().count() << " ns");
TEST_INFO(" avg=" << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << " ns");
APPL_INFO(" min=" << (float((perfo.getMinProcessing().count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_INFO(" max=" << (float((perfo.getMaxProcessing().count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*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().count()*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));