Compare commits
3 Commits
952e34a0b8
...
d18a48bca1
Author | SHA1 | Date | |
---|---|---|---|
d18a48bca1 | |||
4b04365f3f | |||
44911d3616 |
@ -78,6 +78,7 @@ namespace audio {
|
|||||||
break;
|
break;
|
||||||
case audio::format_float:
|
case audio::format_float:
|
||||||
{
|
{
|
||||||
|
AA_SPEEX_ERROR("RESAMPLE: " << _nbChunk << " ==> " << _nbChunkOut);
|
||||||
uint32_t nbChunkInput = _nbChunk;
|
uint32_t nbChunkInput = _nbChunk;
|
||||||
uint32_t nbChunkOutput = _nbChunkOut;
|
uint32_t nbChunkOutput = _nbChunkOut;
|
||||||
int ret = speex_resampler_process_interleaved_float(m_speexResampler,
|
int ret = speex_resampler_process_interleaved_float(m_speexResampler,
|
||||||
@ -85,6 +86,7 @@ namespace audio {
|
|||||||
&nbChunkInput,
|
&nbChunkInput,
|
||||||
reinterpret_cast<float*>(_output),
|
reinterpret_cast<float*>(_output),
|
||||||
&nbChunkOutput);
|
&nbChunkOutput);
|
||||||
|
AA_SPEEX_ERROR("RESAMPLE: " << nbChunkInput << " ==> " << nbChunkOutput << " DONE");
|
||||||
// Check all input and output ...
|
// Check all input and output ...
|
||||||
if (nbChunkInput != _nbChunk) {
|
if (nbChunkInput != _nbChunk) {
|
||||||
AA_SPEEX_ERROR("inputSize (not all read ...) proceed=" << nbChunkInput << " requested=" << _nbChunk);
|
AA_SPEEX_ERROR("inputSize (not all read ...) proceed=" << nbChunkInput << " requested=" << _nbChunk);
|
||||||
@ -132,7 +134,7 @@ etk::Vector<enum audio::format> audio::algo::speex::Resampler::getSupportedForma
|
|||||||
|
|
||||||
etk::Vector<enum audio::format> audio::algo::speex::Resampler::getNativeSupportedFormat() {
|
etk::Vector<enum audio::format> audio::algo::speex::Resampler::getNativeSupportedFormat() {
|
||||||
etk::Vector<enum audio::format> out;
|
etk::Vector<enum audio::format> out;
|
||||||
out.pushBack(audio::format_float);
|
//out.pushBack(audio::format_float); ==> sppex dsp only compille in fixpoint, of float ... not at the same time ...
|
||||||
out.pushBack(audio::format_int16);
|
out.pushBack(audio::format_int16);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
114
audio/algo/speex/Vad.cpp
Normal file
114
audio/algo/speex/Vad.cpp
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define speex_POSIX 1
|
||||||
|
#include <audio/algo/speex/Vad.hpp>
|
||||||
|
#include <audio/algo/speex/debug.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <webrtc/common_audio/vad/include/webrtc_vad.h>
|
||||||
|
|
||||||
|
namespace audio {
|
||||||
|
namespace algo {
|
||||||
|
namespace speex {
|
||||||
|
class VadPrivate {
|
||||||
|
private:
|
||||||
|
VadInst *m_vad = null;
|
||||||
|
bool m_voiceDetected = false;
|
||||||
|
uint32_t calculateBlockSize(uint32_t _sampleRate, uint32_t _sizeInMs) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
VadPrivate() {
|
||||||
|
WebRtcVad_Create(&m_vad);
|
||||||
|
WebRtcVad_Init(m_vad);
|
||||||
|
}
|
||||||
|
|
||||||
|
~VadPrivate() {
|
||||||
|
/* TODO : Check this leak ...
|
||||||
|
if (m_speexPreprocessState) {
|
||||||
|
speex_preprocess_state_destroy(m_speexPreprocessState);
|
||||||
|
m_speexPreprocessState = null;
|
||||||
|
}
|
||||||
|
if (m_speexEchoState) {
|
||||||
|
speex_echo_state_destroy(m_speexEchoState);
|
||||||
|
m_speexEchoState = null;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Main input algo process.
|
||||||
|
* @param[in,out] _output Output data.
|
||||||
|
* @param[in] _input Input data.
|
||||||
|
* @param[in] _inputFeedback Input feedback data (all time MONO).
|
||||||
|
* @param[in] _nbChunk Number of chunk in the input buffer.
|
||||||
|
* @param[in] _nbChannel Number of channel in the stream.
|
||||||
|
*/
|
||||||
|
void process(const void* _input, size_t _nbChunk) {
|
||||||
|
if (m_vad == null) {
|
||||||
|
AA_SPEEX_ERROR("speex handle is not initialize ==> can not process");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_voiceDetected = WebRtcVad_Process(m_vad, 16000, (const int16_t*)_input, _nbChunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t getOptimalFrameSize() {
|
||||||
|
return 160;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getVoiceDetected() {
|
||||||
|
return m_voiceDetected;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void audio::algo::speex::Vad::init(int8_t _nbChannel, float _sampleRate, enum audio::format _format) {
|
||||||
|
m_private.reset();
|
||||||
|
m_private = ememory::makeShared<audio::algo::speex::VadPrivate>();
|
||||||
|
}
|
||||||
|
|
||||||
|
etk::Vector<float> audio::algo::speex::Vad::getSupportedSampleRate() {
|
||||||
|
etk::Vector<float> out;
|
||||||
|
out.pushBack(16000);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
etk::Vector<enum audio::format> audio::algo::speex::Vad::getSupportedFormat() {
|
||||||
|
return getNativeSupportedFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
etk::Vector<enum audio::format> audio::algo::speex::Vad::getNativeSupportedFormat() {
|
||||||
|
etk::Vector<enum audio::format> out;
|
||||||
|
out.pushBack(audio::format_int16);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
/// set 10 ms ==> 160 sample
|
||||||
|
void audio::algo::speex::Vad::process(const void* _input, size_t _nbChunk) {
|
||||||
|
if (m_private == null) {
|
||||||
|
AA_SPEEX_ERROR("Algo is not initialized...");
|
||||||
|
}
|
||||||
|
m_private->process(_input, _nbChunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t audio::algo::speex::Vad::getOptimalFrameSize() {
|
||||||
|
if (m_private == null) {
|
||||||
|
AA_SPEEX_ERROR("Algo is not initialized...");
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
return m_private->getOptimalFrameSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool audio::algo::speex::Vad::getVoiceDetected() {
|
||||||
|
if (m_private == null) {
|
||||||
|
AA_SPEEX_ERROR("Algo is not initialized...");
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
return m_private->getVoiceDetected();
|
||||||
|
}
|
64
audio/algo/speex/Vad.hpp
Normal file
64
audio/algo/speex/Vad.hpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <etk/types.hpp>
|
||||||
|
#include <audio/format.hpp>
|
||||||
|
#include <chrono>
|
||||||
|
#include <ememory/memory.hpp>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace audio {
|
||||||
|
namespace algo {
|
||||||
|
namespace speex {
|
||||||
|
class VadPrivate;
|
||||||
|
class Vad {
|
||||||
|
public:
|
||||||
|
Vad() = default;
|
||||||
|
virtual ~Vad() = default;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Initialize the Algorithm
|
||||||
|
* @param[in] _nbChannel Number of channel in the stream.
|
||||||
|
* @param[in] _sampleRate Sample rate.
|
||||||
|
* @param[in] _format Input/output data format.
|
||||||
|
*/
|
||||||
|
virtual void init(int8_t _nbChannel, float _sampleRate, enum audio::format _format = audio::format_float);
|
||||||
|
/**
|
||||||
|
* @brief Get list of samplerate suported.
|
||||||
|
* @return list of supported samplerate
|
||||||
|
*/
|
||||||
|
virtual etk::Vector<float> getSupportedSampleRate();
|
||||||
|
/**
|
||||||
|
* @brief Get list of format suported in input.
|
||||||
|
* @return list of supported format
|
||||||
|
*/
|
||||||
|
virtual etk::Vector<enum audio::format> getSupportedFormat();
|
||||||
|
/**
|
||||||
|
* @brief Get list of algorithm format suported. No format convertion.
|
||||||
|
* @return list of supported format
|
||||||
|
*/
|
||||||
|
virtual etk::Vector<enum audio::format> getNativeSupportedFormat();
|
||||||
|
/**
|
||||||
|
* @brief Main input algo process.
|
||||||
|
* @param[in,out] _output Output data.
|
||||||
|
* @param[in] _input Input data.
|
||||||
|
* @param[in] _inputFeedback Input feedback data (all time MONO).
|
||||||
|
* @param[in] _nbChunk Number of chunk in the input buffer.
|
||||||
|
* @param[in] _nbChannel Number of channel in the stream.
|
||||||
|
*/
|
||||||
|
virtual void process(const void* _input, size_t _nbChunk);
|
||||||
|
|
||||||
|
bool getVoiceDetected();
|
||||||
|
|
||||||
|
int32_t getOptimalFrameSize();
|
||||||
|
protected:
|
||||||
|
ememory::SharedPtr<VadPrivate> m_private; //!< private data.
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.debug as debug
|
import realog.debug as debug
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.debug as debug
|
import realog.debug as debug
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
@ -28,15 +28,18 @@ def configure(target, my_module):
|
|||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'audio/algo/speex/debug.cpp',
|
'audio/algo/speex/debug.cpp',
|
||||||
'audio/algo/speex/Resampler.cpp',
|
'audio/algo/speex/Resampler.cpp',
|
||||||
'audio/algo/speex/Aec.cpp'
|
'audio/algo/speex/Aec.cpp',
|
||||||
|
'audio/algo/speex/Vad.cpp',
|
||||||
])
|
])
|
||||||
my_module.add_header_file([
|
my_module.add_header_file([
|
||||||
'audio/algo/speex/Resampler.hpp',
|
'audio/algo/speex/Resampler.hpp',
|
||||||
'audio/algo/speex/Aec.hpp'
|
'audio/algo/speex/Aec.hpp',
|
||||||
|
'audio/algo/speex/Vad.hpp',
|
||||||
])
|
])
|
||||||
my_module.add_depend([
|
my_module.add_depend([
|
||||||
'etk',
|
'etk',
|
||||||
'audio'
|
'audio',
|
||||||
|
'webrtc',
|
||||||
])
|
])
|
||||||
my_module.add_optionnal_depend('speex-dsp', ["c++", "-DHAVE_SPEEX_DSP"])
|
my_module.add_optionnal_depend('speex-dsp', ["c++", "-DHAVE_SPEEX_DSP"])
|
||||||
my_module.add_path(".")
|
my_module.add_path(".")
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
|
|
||||||
#include <test-debug/debug.hpp>
|
#include <test-debug/debug.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
|
#include <etk/uri/uri.hpp>
|
||||||
#include <audio/algo/speex/Resampler.hpp>
|
#include <audio/algo/speex/Resampler.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <audio/algo/speex/Aec.hpp>
|
||||||
#include <echrono/Steady.hpp>
|
#include <echrono/Steady.hpp>
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
|
|
||||||
@ -166,28 +167,29 @@ void performanceResampler() {
|
|||||||
modeFloat = performanceResamplerStepFloat(48000, 8000, iii);
|
modeFloat = performanceResamplerStepFloat(48000, 8000, iii);
|
||||||
modeI16 = performanceResamplerStepI16(48000, 8000, iii);
|
modeI16 = performanceResamplerStepI16(48000, 8000, iii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Vector<int16_t> loadDataI16(etk::String _fileName, int32_t _nbChannel, int32_t _selectChannel, bool _formatFileInteger16, int32_t _delaySample = 0) {
|
etk::Vector<int16_t> loadDataI16(etk::Uri _uri, int32_t _nbChannel, int32_t _selectChannel, bool _formatFileInteger16, int32_t _delaySample = 0) {
|
||||||
TEST_INFO("Read : '" << _fileName << "'");
|
TEST_INFO("Read : '" << _uri << "'");
|
||||||
etk::Vector<int16_t> out;
|
etk::Vector<int16_t> out;
|
||||||
int32_t offset = 0;
|
|
||||||
if (etk::end_with(_fileName, ".wav") == true) {
|
|
||||||
// remove the first 44 bytes
|
|
||||||
offset = 44;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<_delaySample; ++iii) {
|
for (int32_t iii=0; iii<_delaySample; ++iii) {
|
||||||
out.pushBack(0);
|
out.pushBack(0);
|
||||||
}
|
}
|
||||||
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(_uri);
|
||||||
|
if (fileIO->open(etk::io::OpenMode::Read) == false) {
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
if (_uri.getPath().getExtention() == "wav") {
|
||||||
|
// remove the first 44 bytes
|
||||||
|
fileIO->seek(44, etk::io::SeekMode::Start);
|
||||||
|
}
|
||||||
if (_formatFileInteger16 == true) {
|
if (_formatFileInteger16 == true) {
|
||||||
etk::Vector<int16_t> tmpData = etk::FSNodeReadAllDataType<int16_t>(_fileName, offset);
|
etk::Vector<int16_t> tmpData = fileIO->readAll<int16_t>();
|
||||||
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
||||||
out.pushBack(tmpData[iii+_selectChannel]);
|
out.pushBack(tmpData[iii+_selectChannel]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
etk::Vector<float> tmpData = etk::FSNodeReadAllDataType<float>(_fileName, offset);
|
etk::Vector<float> tmpData = fileIO->readAll<float>();
|
||||||
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
||||||
double val = double(tmpData[iii+_selectChannel])*32768.0;
|
double val = double(tmpData[iii+_selectChannel])*32768.0;
|
||||||
if (val >= 32767.0) {
|
if (val >= 32767.0) {
|
||||||
@ -199,33 +201,38 @@ etk::Vector<int16_t> loadDataI16(etk::String _fileName, int32_t _nbChannel, int3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fileIO->close();
|
||||||
TEST_INFO(" " << out.size() << " samples");
|
TEST_INFO(" " << out.size() << " samples");
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::Vector<float> loadDataFloat(etk::String _fileName, int32_t _nbChannel, int32_t _selectChannel, bool _formatFileInteger16, int32_t _delaySample = 0) {
|
etk::Vector<float> loadDataFloat(etk::Uri _uri, int32_t _nbChannel, int32_t _selectChannel, bool _formatFileInteger16, int32_t _delaySample = 0) {
|
||||||
TEST_INFO("Read : '" << _fileName << "'");
|
TEST_INFO("Read : '" << _uri << "'");
|
||||||
etk::Vector<float> out;
|
etk::Vector<float> out;
|
||||||
int32_t offset = 0;
|
|
||||||
if (etk::end_with(_fileName, ".wav") == true) {
|
|
||||||
// remove the first 44 bytes
|
|
||||||
offset = 44;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<_delaySample; ++iii) {
|
for (int32_t iii=0; iii<_delaySample; ++iii) {
|
||||||
out.pushBack(0.0);
|
out.pushBack(0.0);
|
||||||
}
|
}
|
||||||
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(_uri);
|
||||||
|
if (fileIO->open(etk::io::OpenMode::Read) == false) {
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
if (_uri.getPath().getExtention() == "wav") {
|
||||||
|
// remove the first 44 bytes
|
||||||
|
fileIO->seek(44, etk::io::SeekMode::Start);
|
||||||
|
}
|
||||||
if (_formatFileInteger16 == true) {
|
if (_formatFileInteger16 == true) {
|
||||||
etk::Vector<int16_t> tmpData = etk::FSNodeReadAllDataType<int16_t>(_fileName, offset);
|
etk::Vector<int16_t> tmpData = fileIO->readAll<int16_t>();
|
||||||
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
||||||
out.pushBack(double(tmpData[iii+_selectChannel])/32768.0);
|
out.pushBack(double(tmpData[iii+_selectChannel])/32768.0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
etk::Vector<float> tmpData = etk::FSNodeReadAllDataType<float>(_fileName, offset);
|
etk::Vector<float> tmpData = fileIO->readAll<float>();
|
||||||
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
for (int32_t iii=0; iii<tmpData.size(); iii+=_nbChannel) {
|
||||||
out.pushBack(tmpData[iii+_selectChannel]);
|
out.pushBack(tmpData[iii+_selectChannel]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fileIO->close();
|
||||||
TEST_INFO(" " << out.size() << " samples");
|
TEST_INFO(" " << out.size() << " samples");
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -233,9 +240,9 @@ etk::Vector<float> loadDataFloat(etk::String _fileName, int32_t _nbChannel, int3
|
|||||||
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 = "";
|
etk::Path inputName = "";
|
||||||
etk::String feedbackName = "";
|
etk::Path feedbackName = "";
|
||||||
etk::String outputName = "output.raw";
|
etk::Path outputName = "output.raw";
|
||||||
bool performance = false;
|
bool performance = false;
|
||||||
bool perf = false;
|
bool perf = false;
|
||||||
int64_t sampleRateIn = 48000;
|
int64_t sampleRateIn = 48000;
|
||||||
@ -361,7 +368,7 @@ int main(int _argc, const char** _argv) {
|
|||||||
}
|
}
|
||||||
if (test == "RESAMPLING") {
|
if (test == "RESAMPLING") {
|
||||||
TEST_INFO("Start resampling test ... ");
|
TEST_INFO("Start resampling test ... ");
|
||||||
if (inputName == "") {
|
if (inputName.isEmpty() == true) {
|
||||||
TEST_ERROR("Can not Process missing parameters...");
|
TEST_ERROR("Can not Process missing parameters...");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@ -407,7 +414,14 @@ int main(int _argc, const char** _argv) {
|
|||||||
TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
|
||||||
}
|
}
|
||||||
TEST_PRINT("Store in file : '" << outputName << "' size = " << output.size());
|
TEST_PRINT("Store in file : '" << outputName << "' size = " << output.size());
|
||||||
etk::FSNodeWriteAllDataType<int16_t>(outputName, output);
|
|
||||||
|
|
||||||
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(outputName);
|
||||||
|
if (fileIO->open(etk::io::OpenMode::Write) == false) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fileIO->writeAll<int16_t>(output);
|
||||||
|
fileIO->close();
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
} else if (test == "AEC") {
|
} else if (test == "AEC") {
|
||||||
// process in chunk of XXX samples represent 10 ms of DATA ==> this is webRTC ...
|
// process in chunk of XXX samples represent 10 ms of DATA ==> this is webRTC ...
|
||||||
@ -445,20 +459,26 @@ int main(int _argc, const char** _argv) {
|
|||||||
if (perf == true) {
|
if (perf == true) {
|
||||||
TEST_PRINT("Performance Result: ");
|
TEST_PRINT("Performance Result: ");
|
||||||
TEST_INFO(" blockSize=" << blockSize << " sample");
|
TEST_INFO(" blockSize=" << blockSize << " sample");
|
||||||
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
|
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing().get() << "ns < "
|
||||||
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
|
<< perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << "ns < "
|
||||||
<< perfo.getMaxProcessing().count() << "ns ");
|
<< perfo.getMaxProcessing().get() << "ns ");
|
||||||
float avg = (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRateIn)/double(blockSize))/1000000000.0)*100.0;
|
float avg = (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRateIn)/double(blockSize))/1000000000.0)*100.0;
|
||||||
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().count()*sampleRateIn)/double(blockSize))/1000000000.0)*100.0 << "% < "
|
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().get()*sampleRateIn)/double(blockSize))/1000000000.0)*100.0 << "% < "
|
||||||
<< avg << "% < "
|
<< avg << "% < "
|
||||||
<< (float((perfo.getMaxProcessing().count()*sampleRateIn)/double(blockSize))/1000000000.0)*100.0 << "%");
|
<< (float((perfo.getMaxProcessing().get()*sampleRateIn)/double(blockSize))/1000000000.0)*100.0 << "%");
|
||||||
TEST_PRINT("float : " << sampleRateIn << " : " << avg << "%");
|
TEST_PRINT("float : " << sampleRateIn << " : " << avg << "%");
|
||||||
}
|
}
|
||||||
TEST_PRINT("Store in file : '" << outputName << "' size = " << output.size());
|
TEST_PRINT("Store in file : '" << outputName << "' size = " << output.size());
|
||||||
etk::FSNodeWriteAllDataType<int16_t>(outputName, output);
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(outputName);
|
||||||
|
if (fileIO->open(etk::io::OpenMode::Write) == false) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fileIO->writeAll<int16_t>(output);
|
||||||
|
fileIO->close();
|
||||||
}
|
}
|
||||||
TEST_PRINT(" ***************************************");
|
TEST_PRINT(" ***************************************");
|
||||||
TEST_PRINT(" ** APPLICATION FINISHED OK **");
|
TEST_PRINT(" ** APPLICATION FINISHED OK **");
|
||||||
TEST_PRINT(" ***************************************");
|
TEST_PRINT(" ***************************************");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user