2018-10-07 03:36:44 +00:00
|
|
|
#pragma once
|
2017-09-28 03:11:40 +00:00
|
|
|
|
2019-08-19 23:08:54 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
|
|
|
|
2017-09-28 03:11:40 +00:00
|
|
|
#include "boo/System.hpp"
|
|
|
|
#include "boo/audiodev/IAudioVoice.hpp"
|
2019-08-19 23:08:54 +00:00
|
|
|
#include "lib/audiodev/Common.hpp"
|
2017-09-28 03:11:40 +00:00
|
|
|
|
|
|
|
#if INTEL_IPP
|
|
|
|
#include "ipp.h"
|
|
|
|
#endif
|
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
namespace boo {
|
2017-09-28 03:11:40 +00:00
|
|
|
|
|
|
|
#if INTEL_IPP
|
2017-10-03 05:19:55 +00:00
|
|
|
#define USE_LPF 0
|
2017-10-02 00:59:18 +00:00
|
|
|
|
2017-10-03 05:19:55 +00:00
|
|
|
#if USE_LPF
|
2018-12-08 05:17:51 +00:00
|
|
|
class FIRFilter12k {
|
|
|
|
IppsFIRSpec_32f* m_firSpec;
|
|
|
|
Ipp8u* m_firBuffer;
|
|
|
|
Ipp32f* m_dlySrc;
|
|
|
|
Ipp32f* m_inBuf;
|
|
|
|
|
2017-10-02 00:59:18 +00:00
|
|
|
public:
|
2018-12-08 05:17:51 +00:00
|
|
|
explicit FIRFilter12k(int windowFrames, double sampleRate);
|
|
|
|
~FIRFilter12k();
|
|
|
|
void Process(Ipp32f* buf, int windowFrames);
|
2017-10-02 00:59:18 +00:00
|
|
|
};
|
2017-10-03 05:19:55 +00:00
|
|
|
#endif
|
2017-10-02 00:59:18 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
class WindowedHilbert {
|
2017-10-03 05:19:55 +00:00
|
|
|
#if USE_LPF
|
2018-12-08 05:17:51 +00:00
|
|
|
FIRFilter12k m_fir;
|
2017-10-03 05:19:55 +00:00
|
|
|
#endif
|
2018-12-08 05:17:51 +00:00
|
|
|
IppsHilbertSpec* m_spec;
|
|
|
|
Ipp8u* m_buffer;
|
|
|
|
int m_windowFrames, m_halfFrames;
|
|
|
|
int m_bufIdx = 0;
|
|
|
|
Ipp32f* m_inputBuf;
|
|
|
|
Ipp32fc* m_outputBuf;
|
|
|
|
Ipp32fc* m_output[4];
|
|
|
|
Ipp32f* m_hammingTable;
|
|
|
|
void _AddWindow();
|
|
|
|
|
2017-09-28 03:11:40 +00:00
|
|
|
public:
|
2018-12-08 05:17:51 +00:00
|
|
|
explicit WindowedHilbert(int windowFrames, double sampleRate);
|
|
|
|
~WindowedHilbert();
|
|
|
|
void AddWindow(const float* input, int stride);
|
|
|
|
void AddWindow(const int32_t* input, int stride);
|
|
|
|
void AddWindow(const int16_t* input, int stride);
|
|
|
|
template <typename T>
|
|
|
|
void Output(T* output, float lCoef, float rCoef) const;
|
2017-09-28 03:11:40 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
class LtRtProcessing {
|
|
|
|
AudioVoiceEngineMixInfo m_inMixInfo;
|
|
|
|
int m_windowFrames;
|
|
|
|
int m_halfFrames;
|
|
|
|
int m_outputOffset;
|
|
|
|
int m_bufferTail = 0;
|
|
|
|
int m_bufferHead = 0;
|
|
|
|
std::unique_ptr<int16_t[]> m_16Buffer;
|
|
|
|
std::unique_ptr<int32_t[]> m_32Buffer;
|
|
|
|
std::unique_ptr<float[]> m_fltBuffer;
|
2017-09-28 03:11:40 +00:00
|
|
|
#if INTEL_IPP
|
2018-12-08 05:17:51 +00:00
|
|
|
WindowedHilbert m_hilbertSL, m_hilbertSR;
|
2017-09-28 03:11:40 +00:00
|
|
|
#endif
|
2018-12-08 05:17:51 +00:00
|
|
|
template <typename T>
|
|
|
|
T* _getInBuf();
|
|
|
|
template <typename T>
|
|
|
|
T* _getOutBuf();
|
|
|
|
|
2017-09-28 03:11:40 +00:00
|
|
|
public:
|
2018-12-08 05:17:51 +00:00
|
|
|
LtRtProcessing(int _5msFrames, const AudioVoiceEngineMixInfo& mixInfo);
|
|
|
|
template <typename T>
|
|
|
|
void Process(const T* input, T* output, int frameCount);
|
|
|
|
const AudioVoiceEngineMixInfo& inMixInfo() const { return m_inMixInfo; }
|
2017-09-28 03:11:40 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
} // namespace boo
|