@@ -258,7 +258,8 @@ void circshift(float *x, int n, int k)
258258 k < 0 ? shift (x , - k , n ) : shift (x , n - k , n );
259259}
260260#define NUMPTS 15
261- ierper pch1 , pch2 ;
261+ #define NUMPTS_DRS (7)
262+ ierper pch1 , pch2 , pch3 ;
262263__attribute__((constructor )) static void initialize (void )
263264{
264265 if (decompressedCoefficients )
@@ -267,14 +268,16 @@ __attribute__((constructor)) static void initialize(void)
267268 decompressResamplerMQ (compressedCoeffMQ , decompressedCoefficients );
268269 initIerper (& pch1 , NUMPTS + 2 );
269270 initIerper (& pch2 , NUMPTS + 2 );
271+ initIerper (& pch3 , NUMPTS_DRS + 2 );
270272}
271273__attribute__((destructor )) static void destruction (void )
272274{
273275 free (decompressedCoefficients );
274276 decompressedCoefficients = 0 ;
275277 freeIerper (& pch1 );
276278 freeIerper (& pch2 );
277- }
279+ freeIerper (& pch3 );
280+ }
278281static void JamesDSPOfflineResampling (float const * in , float * out , size_t lenIn , size_t lenOut , int channels , double src_ratio , int resampleQuality )
279282{
280283 if (lenOut == lenIn && lenIn == 1 )
@@ -534,3 +537,20 @@ int ComputeEqResponse(const double* jfreq, double* jgain, int interpolationMode,
534537 return 0 ;
535538}
536539
540+ int ComputeCompResponse (int n , const double * jfreq , const double * jgain , int queryPts , const double * dispFreq , float * response )
541+ {
542+ double freqComp [NUMPTS_DRS + 2 ];
543+ double gainComp [NUMPTS_DRS + 2 ];
544+
545+ memcpy (freqComp + 1 , jfreq , NUMPTS_DRS * sizeof (double ));
546+ memcpy (gainComp + 1 , jgain , NUMPTS_DRS * sizeof (double ));
547+
548+ freqComp [0 ] = 0.0 ;
549+ gainComp [0 ] = gainComp [1 ];
550+ freqComp [NUMPTS_DRS + 1 ] = 24000.0 ;
551+ gainComp [NUMPTS_DRS + 1 ] = gainComp [NUMPTS_DRS ];
552+ makima (& pch3 , freqComp , gainComp , NUMPTS_DRS + 2 , 1 , 1 );
553+ ierper * lerpPtr = & pch3 ;
554+ for (int i = 0 ; i < queryPts ; i ++ )
555+ response [i ] = (float )getValueAt (& lerpPtr -> cb , dispFreq [i ]);
556+ }
0 commit comments