- use time intervals PVQA API
This commit is contained in:
parent
7c753dca40
commit
05689d0984
|
|
@ -649,7 +649,11 @@ void AudioReceiver::initPvqa()
|
||||||
if (!mPVQA)
|
if (!mPVQA)
|
||||||
{
|
{
|
||||||
mPVQA = std::make_shared<MT::SevanaPVQA>();
|
mPVQA = std::make_shared<MT::SevanaPVQA>();
|
||||||
|
#if defined(USE_PVQA_STREAM)
|
||||||
mPVQA->open(PVQA_INTERVAL, MT::SevanaPVQA::Model::Stream);
|
mPVQA->open(PVQA_INTERVAL, MT::SevanaPVQA::Model::Stream);
|
||||||
|
#else
|
||||||
|
mPVQA->open(PVQA_INTERVAL, MT::SevanaPVQA::Model::Interval);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -672,8 +676,12 @@ void AudioReceiver::updatePvqa(const void *data, int size)
|
||||||
int time4pvqa = (int)(frames * PVQA_INTERVAL * 1000);
|
int time4pvqa = (int)(frames * PVQA_INTERVAL * 1000);
|
||||||
int size4pvqa = (int)fmt.sizeFromTime(time4pvqa);
|
int size4pvqa = (int)fmt.sizeFromTime(time4pvqa);
|
||||||
ICELogInfo(<< "Updating PVQA with " << time4pvqa << " milliseconds of audio.");
|
ICELogInfo(<< "Updating PVQA with " << time4pvqa << " milliseconds of audio.");
|
||||||
|
#if defined(USE_PVQA_STREAM)
|
||||||
mPVQA->update(fmt.mRate, fmt.mChannels, mPvqaBuffer->data(), size4pvqa);
|
mPVQA->update(fmt.mRate, fmt.mChannels, mPvqaBuffer->data(), size4pvqa);
|
||||||
mPvqaBuffer->erase(size4pvqa);
|
mPvqaBuffer->erase(size4pvqa);
|
||||||
|
#else
|
||||||
|
// Just wait for getResults() to make analysis
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,13 +690,14 @@ float AudioReceiver::calculatePvqaMos(int rate, std::string& report)
|
||||||
{
|
{
|
||||||
if (mPVQA && mPvqaBuffer)
|
if (mPVQA && mPvqaBuffer)
|
||||||
{
|
{
|
||||||
// Flush remaining audio to analyzer
|
if (mPVQA->getModel() == MT::SevanaPVQA::Model::Interval)
|
||||||
/*if (mPvqaBuffer->filled())
|
{
|
||||||
{
|
Audio::Format fmt;
|
||||||
mPVQA->update(rate, AUDIO_CHANNELS, mPvqaBuffer->data(), mPvqaBuffer->filled());
|
return mPVQA->process(fmt.mRate, fmt.mChannels, mPvqaBuffer->data(), mPvqaBuffer->filled(),
|
||||||
mPvqaBuffer->clear();
|
report, MT::SevanaPVQA::Codec::None);
|
||||||
}*/
|
}
|
||||||
return mPVQA->getResults(report, nullptr, rate, MT::SevanaPVQA::Codec::None);
|
else
|
||||||
|
return mPVQA->getResults(report, nullptr, rate, MT::SevanaPVQA::Codec::None);
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,8 @@ void SevanaPVQA::update(int samplerate, int channels, const void *pcmBuffer, int
|
||||||
ICELogError(<< "No PVQA context.");
|
ICELogError(<< "No PVQA context.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Model is assert here as it can be any if context is not created.
|
// Model is assert here as it can be any if context is not created.
|
||||||
assert (mModel == Model::Stream);
|
assert (mModel == Model::Stream);
|
||||||
|
|
||||||
|
|
@ -346,6 +348,8 @@ void SevanaPVQA::update(int samplerate, int channels, const void *pcmBuffer, int
|
||||||
{
|
{
|
||||||
ICELogError(<< "Failed to stream data to PVQA instance. Result code: " << rescode);
|
ICELogError(<< "Failed to stream data to PVQA instance. Result code: " << rescode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int milliseconds = pcmLength / 2 / channels / (samplerate / 1000);
|
int milliseconds = pcmLength / 2 / channels / (samplerate / 1000);
|
||||||
mProcessedMilliseconds += milliseconds;
|
mProcessedMilliseconds += milliseconds;
|
||||||
mAllProcessedMilliseconds += milliseconds;
|
mAllProcessedMilliseconds += milliseconds;
|
||||||
|
|
@ -466,7 +470,7 @@ float SevanaPVQA::getResults(std::string& report, EchoData** echo, int samplerat
|
||||||
|
|
||||||
// Limit maximal value of MOS depending on codec
|
// Limit maximal value of MOS depending on codec
|
||||||
float result = (float)results.dMOSLike;
|
float result = (float)results.dMOSLike;
|
||||||
float mv = 5.0;
|
float mv = 5.0f;
|
||||||
switch (codec)
|
switch (codec)
|
||||||
{
|
{
|
||||||
case Codec::G711: mv = 4.1f; break;
|
case Codec::G711: mv = 4.1f; break;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
#if defined(USE_AQUA_LIBRARY)
|
#if defined(USE_AQUA_LIBRARY)
|
||||||
# include "aqua.h"
|
# include "aqua.h"
|
||||||
# include <json/json.h>
|
# include <json/json.h>
|
||||||
|
#include <helper/HL_ByteBuffer.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,6 +70,7 @@ protected:
|
||||||
std::string mDumpWavPath;
|
std::string mDumpWavPath;
|
||||||
bool mOpenFailed = false;
|
bool mOpenFailed = false;
|
||||||
|
|
||||||
|
ByteBuffer mAudioDump;
|
||||||
public:
|
public:
|
||||||
static std::string getVersion();
|
static std::string getVersion();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue