[DEV] update new lutin 0.8.0
This commit is contained in:
parent
b3a28539ae
commit
4b7259ccf6
@ -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 drain audio algo"
|
||||
|
||||
def get_licence():
|
||||
return "APACHE-2"
|
||||
|
||||
def create(target):
|
||||
my_module = module.Module(__file__, 'audio-algo-drain-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-drain'])
|
||||
my_module.add_module_depend(['audio-algo-drain', 'test-debug'])
|
||||
return my_module
|
||||
|
||||
|
||||
|
@ -3,16 +3,31 @@ import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import lutin.debug as debug
|
||||
|
||||
|
||||
def get_type():
|
||||
return "LIBRARY"
|
||||
|
||||
def get_desc():
|
||||
return "drain basic algorithm"
|
||||
|
||||
def get_licence():
|
||||
# return a table with : "Licence Name", contamination if link static, contamination if link dynamic, "Licence string description / FileName / auto for classicle licence"]
|
||||
return ["APACHE-2", False, False, "auto"]
|
||||
return "APACHE-2"
|
||||
|
||||
|
||||
def create(target):
|
||||
my_module = module.Module(__file__, 'audio-algo-drain', '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/drain/debug.cpp',
|
||||
'audio/algo/drain/BiQuad.cpp',
|
||||
@ -25,11 +40,7 @@ def create(target):
|
||||
'audio/algo/drain/Equalizer.h'
|
||||
])
|
||||
my_module.add_module_depend(['etk', 'audio'])
|
||||
|
||||
my_module.add_export_path(tools.get_current_path(__file__))
|
||||
|
||||
#my_module.set_licence(module.APACHE_2)
|
||||
|
||||
my_module.add_path(tools.get_current_path(__file__))
|
||||
return my_module
|
||||
|
||||
|
||||
|
@ -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-drain");
|
||||
return g_val;
|
||||
}
|
||||
|
41
test/debug.h
41
test/debug.h
@ -1,41 +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)
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#ifdef DEBUG
|
||||
#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_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
|
@ -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/drain/Equalizer.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
@ -76,7 +76,7 @@ float performanceEqualizerType(audio::format _type) {
|
||||
}
|
||||
}
|
||||
}
|
||||
APPL_INFO("Start Equalizer (1 biquad) ... " << _type);
|
||||
TEST_INFO("Start Equalizer (1 biquad) ... " << _type);
|
||||
Performance perfo;
|
||||
audio::algo::drain::Equalizer algo;
|
||||
// configure in float
|
||||
@ -91,15 +91,15 @@ float performanceEqualizerType(audio::format _type) {
|
||||
perfo.toc();
|
||||
usleep(1000);
|
||||
}
|
||||
APPL_INFO(" blockSize=" << input.size() << " sample");
|
||||
APPL_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
|
||||
TEST_INFO(" blockSize=" << input.size() << " sample");
|
||||
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
|
||||
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
|
||||
<< perfo.getMaxProcessing().count() << "ns ");
|
||||
float avg = (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0;
|
||||
APPL_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
|
||||
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
|
||||
<< avg << "% < "
|
||||
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
|
||||
APPL_PRINT("type=" << _type << ": " << avg << "%");
|
||||
TEST_PRINT("type=" << _type << ": " << avg << "%");
|
||||
return avg;
|
||||
}
|
||||
|
||||
@ -154,15 +154,15 @@ int main(int _argc, const char** _argv) {
|
||||
quality = 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 input file");
|
||||
APPL_PRINT(" --out=zzz.raw output 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(" --test=XXXX some test availlable ...");
|
||||
APPL_PRINT(" EQUALIZER Test resampling data 16 bit mode");
|
||||
APPL_PRINT(" --sample-rate=XXXX Input signal sample rate (default 48000)");
|
||||
TEST_PRINT("Help : ");
|
||||
TEST_PRINT(" ./xxx --fb=file.raw --mic=file.raw");
|
||||
TEST_PRINT(" --in=YYY.raw input file");
|
||||
TEST_PRINT(" --out=zzz.raw output 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(" --test=XXXX some test availlable ...");
|
||||
TEST_PRINT(" EQUALIZER Test resampling data 16 bit mode");
|
||||
TEST_PRINT(" --sample-rate=XXXX Input signal sample rate (default 48000)");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@ -174,14 +174,14 @@ int main(int _argc, const char** _argv) {
|
||||
}
|
||||
if (test == "EQUALIZER") {
|
||||
/*
|
||||
APPL_INFO("Start resampling test ... ");
|
||||
TEST_INFO("Start resampling test ... ");
|
||||
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<int16_t> inputData = etk::FSNodeReadAllDataType<int16_t>(inputName);
|
||||
APPL_INFO(" " << inputData.size() << " samples");
|
||||
TEST_INFO(" " << inputData.size() << " samples");
|
||||
// resize output :
|
||||
std::vector<int16_t> output;
|
||||
output.resize(inputData.size()*sampleRateOut/sampleRateIn+5000, 0);
|
||||
@ -196,9 +196,9 @@ int main(int _argc, const char** _argv) {
|
||||
for (int32_t iii=0; iii<inputData.size()/blockSize; ++iii) {
|
||||
if (lastPourcent != 100*iii / (inputData.size()/blockSize)) {
|
||||
lastPourcent = 100*iii / (inputData.size()/blockSize);
|
||||
APPL_INFO("Process : " << iii*blockSize << "/" << int32_t(inputData.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
|
||||
TEST_INFO("Process : " << iii*blockSize << "/" << int32_t(inputData.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
|
||||
} else {
|
||||
APPL_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(inputData.size()/blockSize)*blockSize);
|
||||
TEST_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(inputData.size()/blockSize)*blockSize);
|
||||
}
|
||||
size_t availlableSize = (output.size() - outputPosition) / nbChan;
|
||||
perfo.tic();
|
||||
@ -210,15 +210,15 @@ int main(int _argc, const char** _argv) {
|
||||
outputPosition += availlableSize*nbChan;
|
||||
}
|
||||
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()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||
APPL_INFO(" max=" << (float((perfo.getMaxProcessing().count()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||
APPL_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||
TEST_INFO(" min=" << (float((perfo.getMinProcessing().count()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||
TEST_INFO(" max=" << (float((perfo.getMaxProcessing().count()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||
TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||
}
|
||||
etk::FSNodeWriteAllDataType<int16_t>(outputName, output);
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user