2121
2222#include " ../config.h"
2323
24- template <class TPCM , int nIn>
24+ template <size_t nIn>
2525class TQmf {
2626 static const float TapHalf[24 ];
2727 float QmfWindow[48 ];
28- TPCM PcmBuffer[nIn + 46 ];
28+ float PcmBuffer[nIn + 46 ];
2929 float PcmBufferMerge[nIn + 46 ];
30- float DelayBuff[46 ];
3130public:
32- TQmf () {
31+ TQmf () noexcept {
3332 const int sz = sizeof (QmfWindow)/sizeof (QmfWindow[0 ]);
3433
3534 for (size_t i = 0 ; i < sz/2 ; i++) {
@@ -41,13 +40,12 @@ class TQmf {
4140 }
4241 }
4342
44- void Analysis (TPCM * in, float * lower, float * upper) {
43+ void Analysis (const float * in, float * lower, float * upper) noexcept {
4544 float temp;
46- for (size_t i = 0 ; i < 46 ; i++)
47- PcmBuffer[i] = PcmBuffer[nIn + i];
4845
49- for (size_t i = 0 ; i < nIn; i++)
50- PcmBuffer[46 +i] = in[i];
46+ memcpy (&PcmBuffer[0 ], &PcmBuffer[nIn], 46 * sizeof (float ));
47+
48+ memcpy (&PcmBuffer[46 ], in, nIn * sizeof (float ));
5149
5250 for (size_t j = 0 ; j < nIn; j+=2 ) {
5351 lower[j/2 ] = upper[j/2 ] = 0.0 ;
@@ -61,10 +59,9 @@ class TQmf {
6159 }
6260 }
6361
64- void Synthesis (TPCM * out, float * lower, float * upper) {
65- memcpy (&PcmBufferMerge[0 ], &DelayBuff[0 ], 46 *sizeof (float ));
62+ void Synthesis (float * out, const float * lower, const float * upper) noexcept {
6663 float * newPart = &PcmBufferMerge[46 ];
67- for (int i = 0 ; i < nIn; i+=4 ) {
64+ for (size_t i = 0 ; i < nIn; i+=4 ) {
6865 newPart[i+0 ] = lower[i/2 ] + upper[i/2 ];
6966 newPart[i+1 ] = lower[i/2 ] - upper[i/2 ];
7067 newPart[i+2 ] = lower[i/2 + 1 ] + upper[i/2 + 1 ];
@@ -84,12 +81,12 @@ class TQmf {
8481 winP += 2 ;
8582 out += 2 ;
8683 }
87- memcpy (&DelayBuff [0 ], &PcmBufferMerge[nIn], 46 * sizeof (float ));
84+ memcpy (&PcmBufferMerge [0 ], &PcmBufferMerge[nIn], 46 * sizeof (float ));
8885 }
8986};
9087
91- template <class TPCM , int nIn>
92- const float TQmf<TPCM , nIn>::TapHalf[24 ] = {
88+ template <size_t nIn>
89+ const float TQmf<nIn>::TapHalf[24 ] = {
9390 -0.00001461907 , -0.00009205479 , -0.000056157569 , 0.00030117269 ,
9491 0.0002422519 , -0.00085293897 , -0.0005205574 , 0.0020340169 ,
9592 0.00078333891 , -0.0042153862 , -0.00075614988 , 0.0078402944 ,
0 commit comments