[DEV] continue removing stl

This commit is contained in:
Edouard DUPIN 2017-08-28 00:08:06 +02:00
parent a073d51f3d
commit 3a1721f6e1
3 changed files with 21 additions and 21 deletions

View File

@ -125,15 +125,15 @@ void audio::algo::speex::Resampler::init(int8_t _nbChannel, float _inputSampleRa
m_private = ememory::makeShared<audio::algo::speex::ResamplerPrivate>(_nbChannel, _inputSampleRate, _outputSampleRate, _quality, _format); m_private = ememory::makeShared<audio::algo::speex::ResamplerPrivate>(_nbChannel, _inputSampleRate, _outputSampleRate, _quality, _format);
} }
std::vector<enum audio::format> audio::algo::speex::Resampler::getSupportedFormat() { etk::Vector<enum audio::format> audio::algo::speex::Resampler::getSupportedFormat() {
std::vector<enum audio::format> out = getNativeSupportedFormat(); etk::Vector<enum audio::format> out = getNativeSupportedFormat();
return out; return out;
} }
std::vector<enum audio::format> audio::algo::speex::Resampler::getNativeSupportedFormat() { etk::Vector<enum audio::format> audio::algo::speex::Resampler::getNativeSupportedFormat() {
std::vector<enum audio::format> out; etk::Vector<enum audio::format> out;
out.push_back(audio::format_float); out.pushBack(audio::format_float);
out.push_back(audio::format_int16); out.pushBack(audio::format_int16);
return out; return out;
} }

View File

@ -9,7 +9,7 @@
#include <audio/format.hpp> #include <audio/format.hpp>
#include <chrono> #include <chrono>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <vector> #include <etk/Vector.hpp>
namespace audio { namespace audio {
namespace algo { namespace algo {
@ -33,12 +33,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 std::vector<enum audio::format> getSupportedFormat(); virtual etk::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 std::vector<enum audio::format> getNativeSupportedFormat(); virtual etk::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

@ -35,8 +35,8 @@ class Performance {
void toc() { void toc() {
m_timeStop = std::chrono::steady_clock::now(); m_timeStop = std::chrono::steady_clock::now();
std::chrono::nanoseconds time = m_timeStop - m_timeStart; std::chrono::nanoseconds time = m_timeStop - m_timeStart;
m_minProcessing = std::min(m_minProcessing, time); m_minProcessing = etk::min(m_minProcessing, time);
m_maxProcessing = std::max(m_maxProcessing, time); m_maxProcessing = etk::max(m_maxProcessing, time);
m_totalTimeProcessing += time; m_totalTimeProcessing += time;
m_totalIteration++; m_totalIteration++;
@ -58,9 +58,9 @@ class Performance {
}; };
float performanceResamplerStepFloat(float _sampleRateIn, float _sampleRateOut, int8_t _quality) { float performanceResamplerStepFloat(float _sampleRateIn, float _sampleRateOut, int8_t _quality) {
std::vector<float> input; etk::Vector<float> input;
input.resize(1024, 0); input.resize(1024, 0);
std::vector<float> output; etk::Vector<float> output;
output.resize(input.size()*10, 0); output.resize(input.size()*10, 0);
double sampleRate = _sampleRateIn; double sampleRate = _sampleRateIn;
{ {
@ -98,9 +98,9 @@ float performanceResamplerStepFloat(float _sampleRateIn, float _sampleRateOut, i
} }
float performanceResamplerStepI16(float _sampleRateIn, float _sampleRateOut, int8_t _quality) { float performanceResamplerStepI16(float _sampleRateIn, float _sampleRateOut, int8_t _quality) {
std::vector<int16_t> input; etk::Vector<int16_t> input;
input.resize(1024, 0); input.resize(1024, 0);
std::vector<int16_t> output; etk::Vector<int16_t> output;
output.resize(input.size()*10, 0); output.resize(input.size()*10, 0);
double sampleRate = _sampleRateIn; double sampleRate = _sampleRateIn;
{ {
@ -171,17 +171,17 @@ void performanceResampler() {
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);
std::string inputName = ""; etk::String inputName = "";
std::string outputName = "output.raw"; etk::String outputName = "output.raw";
bool performance = false; bool performance = false;
bool perf = false; bool perf = false;
int64_t sampleRateIn = 48000; int64_t sampleRateIn = 48000;
int64_t sampleRateOut = 48000; int64_t sampleRateOut = 48000;
int32_t nbChan = 1; int32_t nbChan = 1;
int32_t quality = 4; int32_t quality = 4;
std::string test = ""; etk::String test = "";
for (int32_t iii=0; iii<_argc ; ++iii) { for (int32_t iii=0; iii<_argc ; ++iii) {
std::string data = _argv[iii]; etk::String data = _argv[iii];
if (etk::start_with(data,"--in=")) { if (etk::start_with(data,"--in=")) {
inputName = &data[5]; inputName = &data[5];
} else if (etk::start_with(data,"--out=")) { } else if (etk::start_with(data,"--out=")) {
@ -235,10 +235,10 @@ int main(int _argc, const char** _argv) {
exit(-1); exit(-1);
} }
TEST_INFO("Read input:"); TEST_INFO("Read input:");
std::vector<int16_t> inputData = etk::FSNodeReadAllDataType<int16_t>(inputName); etk::Vector<int16_t> inputData = etk::FSNodeReadAllDataType<int16_t>(inputName);
TEST_INFO(" " << inputData.size() << " samples"); TEST_INFO(" " << inputData.size() << " samples");
// resize output : // resize output :
std::vector<int16_t> output; etk::Vector<int16_t> output;
output.resize(inputData.size()*sampleRateOut/sampleRateIn+5000, 0); output.resize(inputData.size()*sampleRateOut/sampleRateIn+5000, 0);
// process in chunk of 256 samples // process in chunk of 256 samples
int32_t blockSize = 256*nbChan; int32_t blockSize = 256*nbChan;