[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.tools as tools
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
|
|
||||||
|
|
||||||
|
def get_type():
|
||||||
|
return "BINARY"
|
||||||
|
|
||||||
|
def get_sub_type():
|
||||||
|
return "TEST"
|
||||||
|
|
||||||
def get_desc():
|
def get_desc():
|
||||||
return "test drain audio algo"
|
return "test drain audio algo"
|
||||||
|
|
||||||
|
def get_licence():
|
||||||
|
return "APACHE-2"
|
||||||
|
|
||||||
def create(target):
|
def get_compagny_type():
|
||||||
my_module = module.Module(__file__, 'audio-algo-drain-test', 'BINARY')
|
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([
|
my_module.add_src_file([
|
||||||
'test/main.cpp',
|
'test/main.cpp'
|
||||||
'test/debug.cpp'
|
|
||||||
])
|
])
|
||||||
my_module.add_module_depend(['audio-algo-drain'])
|
my_module.add_module_depend(['audio-algo-drain', 'test-debug'])
|
||||||
return my_module
|
return my_module
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,16 +3,31 @@ import lutin.module as module
|
|||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
|
|
||||||
|
|
||||||
|
def get_type():
|
||||||
|
return "LIBRARY"
|
||||||
|
|
||||||
def get_desc():
|
def get_desc():
|
||||||
return "drain basic algorithm"
|
return "drain basic algorithm"
|
||||||
|
|
||||||
def get_licence():
|
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"
|
||||||
return ["APACHE-2", False, False, "auto"]
|
|
||||||
|
|
||||||
|
|
||||||
def create(target):
|
def get_compagny_type():
|
||||||
my_module = module.Module(__file__, 'audio-algo-drain', 'LIBRARY')
|
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([
|
my_module.add_src_file([
|
||||||
'audio/algo/drain/debug.cpp',
|
'audio/algo/drain/debug.cpp',
|
||||||
'audio/algo/drain/BiQuad.cpp',
|
'audio/algo/drain/BiQuad.cpp',
|
||||||
@ -25,11 +40,7 @@ def create(target):
|
|||||||
'audio/algo/drain/Equalizer.h'
|
'audio/algo/drain/Equalizer.h'
|
||||||
])
|
])
|
||||||
my_module.add_module_depend(['etk', 'audio'])
|
my_module.add_module_depend(['etk', 'audio'])
|
||||||
|
my_module.add_path(tools.get_current_path(__file__))
|
||||||
my_module.add_export_path(tools.get_current_path(__file__))
|
|
||||||
|
|
||||||
#my_module.set_licence(module.APACHE_2)
|
|
||||||
|
|
||||||
return my_module
|
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)
|
* @license APACHE v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/debug.h>
|
#include <test-debug/debug.h>
|
||||||
#include <etk/etk.h>
|
#include <etk/etk.h>
|
||||||
#include <audio/algo/drain/Equalizer.h>
|
#include <audio/algo/drain/Equalizer.h>
|
||||||
#include <etk/os/FSNode.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;
|
Performance perfo;
|
||||||
audio::algo::drain::Equalizer algo;
|
audio::algo::drain::Equalizer algo;
|
||||||
// configure in float
|
// configure in float
|
||||||
@ -91,15 +91,15 @@ float performanceEqualizerType(audio::format _type) {
|
|||||||
perfo.toc();
|
perfo.toc();
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
APPL_INFO(" blockSize=" << input.size() << " sample");
|
TEST_INFO(" blockSize=" << input.size() << " sample");
|
||||||
APPL_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
|
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
|
||||||
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
|
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
|
||||||
<< perfo.getMaxProcessing().count() << "ns ");
|
<< perfo.getMaxProcessing().count() << "ns ");
|
||||||
float avg = (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0;
|
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 << "% < "
|
<< avg << "% < "
|
||||||
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
|
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
|
||||||
APPL_PRINT("type=" << _type << ": " << avg << "%");
|
TEST_PRINT("type=" << _type << ": " << avg << "%");
|
||||||
return avg;
|
return avg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,15 +154,15 @@ int main(int _argc, const char** _argv) {
|
|||||||
quality = etk::string_to_int32_t(data);
|
quality = etk::string_to_int32_t(data);
|
||||||
} else if ( data == "-h"
|
} else if ( data == "-h"
|
||||||
|| data == "--help") {
|
|| data == "--help") {
|
||||||
APPL_PRINT("Help : ");
|
TEST_PRINT("Help : ");
|
||||||
APPL_PRINT(" ./xxx --fb=file.raw --mic=file.raw");
|
TEST_PRINT(" ./xxx --fb=file.raw --mic=file.raw");
|
||||||
APPL_PRINT(" --in=YYY.raw input file");
|
TEST_PRINT(" --in=YYY.raw input file");
|
||||||
APPL_PRINT(" --out=zzz.raw output file");
|
TEST_PRINT(" --out=zzz.raw output file");
|
||||||
APPL_PRINT(" --performance Generate signal to force algo to maximum process time");
|
TEST_PRINT(" --performance Generate signal to force algo to maximum process time");
|
||||||
APPL_PRINT(" --perf Enable performence test (little slower but real performence test)");
|
TEST_PRINT(" --perf Enable performence test (little slower but real performence test)");
|
||||||
APPL_PRINT(" --test=XXXX some test availlable ...");
|
TEST_PRINT(" --test=XXXX some test availlable ...");
|
||||||
APPL_PRINT(" EQUALIZER Test resampling data 16 bit mode");
|
TEST_PRINT(" EQUALIZER Test resampling data 16 bit mode");
|
||||||
APPL_PRINT(" --sample-rate=XXXX Input signal sample rate (default 48000)");
|
TEST_PRINT(" --sample-rate=XXXX Input signal sample rate (default 48000)");
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -174,14 +174,14 @@ int main(int _argc, const char** _argv) {
|
|||||||
}
|
}
|
||||||
if (test == "EQUALIZER") {
|
if (test == "EQUALIZER") {
|
||||||
/*
|
/*
|
||||||
APPL_INFO("Start resampling test ... ");
|
TEST_INFO("Start resampling test ... ");
|
||||||
if (inputName == "") {
|
if (inputName == "") {
|
||||||
APPL_ERROR("Can not Process missing parameters...");
|
TEST_ERROR("Can not Process missing parameters...");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
APPL_INFO("Read input:");
|
TEST_INFO("Read input:");
|
||||||
std::vector<int16_t> inputData = etk::FSNodeReadAllDataType<int16_t>(inputName);
|
std::vector<int16_t> inputData = etk::FSNodeReadAllDataType<int16_t>(inputName);
|
||||||
APPL_INFO(" " << inputData.size() << " samples");
|
TEST_INFO(" " << inputData.size() << " samples");
|
||||||
// resize output :
|
// resize output :
|
||||||
std::vector<int16_t> output;
|
std::vector<int16_t> output;
|
||||||
output.resize(inputData.size()*sampleRateOut/sampleRateIn+5000, 0);
|
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) {
|
for (int32_t iii=0; iii<inputData.size()/blockSize; ++iii) {
|
||||||
if (lastPourcent != 100*iii / (inputData.size()/blockSize)) {
|
if (lastPourcent != 100*iii / (inputData.size()/blockSize)) {
|
||||||
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 {
|
} 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;
|
size_t availlableSize = (output.size() - outputPosition) / nbChan;
|
||||||
perfo.tic();
|
perfo.tic();
|
||||||
@ -210,15 +210,15 @@ int main(int _argc, const char** _argv) {
|
|||||||
outputPosition += availlableSize*nbChan;
|
outputPosition += availlableSize*nbChan;
|
||||||
}
|
}
|
||||||
if (perf == true) {
|
if (perf == true) {
|
||||||
APPL_INFO("Performance Result: ");
|
TEST_INFO("Performance Result: ");
|
||||||
APPL_INFO(" blockSize=" << blockSize << " sample");
|
TEST_INFO(" blockSize=" << blockSize << " sample");
|
||||||
APPL_INFO(" min=" << perfo.getMinProcessing().count() << " ns");
|
TEST_INFO(" min=" << perfo.getMinProcessing().count() << " ns");
|
||||||
APPL_INFO(" max=" << perfo.getMaxProcessing().count() << " ns");
|
TEST_INFO(" max=" << perfo.getMaxProcessing().count() << " ns");
|
||||||
APPL_INFO(" avg=" << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << " ns");
|
TEST_INFO(" avg=" << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << " ns");
|
||||||
|
|
||||||
APPL_INFO(" min=" << (float((perfo.getMinProcessing().count()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
TEST_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 << " %");
|
TEST_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(" avg=" << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||||
}
|
}
|
||||||
etk::FSNodeWriteAllDataType<int16_t>(outputName, output);
|
etk::FSNodeWriteAllDataType<int16_t>(outputName, output);
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user