Updated 8-point interpolation

This commit is contained in:
pagefault
2001-09-06 14:47:07 +00:00
parent 03d3ce064b
commit 5ee45932e0
2 changed files with 44 additions and 11 deletions

View File

@@ -3513,6 +3513,11 @@ WaveIndex times 8 dd 0
;%%DontFilter1 ;
EXTSYM fir_interpolate
EXTSYM fir_lut
section .data
NEWSYM fir_tmp,dd 0,0
section .text
%macro DSPInterpolate 1
@@ -3558,10 +3563,37 @@ EXTSYM fir_interpolate
jmp %%end
%%fir_interpolate
%if 1
xor eax,eax
mov ebx,[BRRPlace0+%1*8]
mov al,[BRRPlace0+%1*8+3]
shl eax,2
and ebx,0FFFFFFh
add ebx,1000h
shr ebx,9
and ebx,0FFF0h
add ebx,[fir_lut]
movq mm0,[eax+PSampleBuf+(%1*26*4)]
packssdw mm0,[eax+PSampleBuf+(%1*26*4)+8]
movq mm1,[eax+PSampleBuf+(%1*26*4)+16]
packssdw mm1,[eax+PSampleBuf+(%1*26*4)+24]
movq mm2,[ebx]
movq mm3,[ebx+8]
pmaddwd mm0,mm2
pmaddwd mm1,mm3
paddd mm0,mm1
movq [fir_tmp],mm0
emms
mov eax,[fir_tmp]
add eax,[fir_tmp+4]
sar eax,14
%else
push dword PSampleBuf+(%1*26*4)
push dword [BRRPlace0+%1*8]
call fir_interpolate
add esp,+8
%endif
cmp eax,32767
jle %%clip1
mov eax,32767

View File

@@ -9,11 +9,8 @@
*
*/
#ifdef __LINUX__
#include "../gblhdr.h"
#else
#include <math.h>
#endif
#include <stdio.h>
#ifndef log2
inline float log2(float f) {
@@ -55,7 +52,7 @@ inline float log2(float f) {
------------------------------------------------------------------------------------------------
*/
// quantizer scale of window coefs
#define WFIR_QUANTBITS 15
#define WFIR_QUANTBITS 14
#define WFIR_QUANTSCALE (1L<<WFIR_QUANTBITS)
#define WFIR_8SHIFT (WFIR_QUANTBITS-8)
#define WFIR_16BITSHIFT (WFIR_QUANTBITS)
@@ -137,11 +134,11 @@ class CzWINDOWEDFIR
}
return (float)(_LWc*_LSi);
}
static signed int lut[WFIR_LUTLEN*WFIR_WIDTH];
static signed short lut[WFIR_LUTLEN*WFIR_WIDTH];
static signed int lut_co[WFIR_CUTOFFLEN*WFIR_WIDTH];
};
signed int CzWINDOWEDFIR::lut[WFIR_LUTLEN*WFIR_WIDTH];
signed short CzWINDOWEDFIR::lut[WFIR_LUTLEN*WFIR_WIDTH];
signed int CzWINDOWEDFIR::lut_co[WFIR_CUTOFFLEN*WFIR_WIDTH];
CzWINDOWEDFIR::CzWINDOWEDFIR()
@@ -161,7 +158,7 @@ CzWINDOWEDFIR::CzWINDOWEDFIR()
_LGain = 1.0f/_LGain;
for( _LCc=0;_LCc<WFIR_WIDTH;_LCc++ )
{ float _LCoef = (float)floor( 0.5 + _LScale*_LCoefs[_LCc]*_LGain );
lut[_LIdx+_LCc] = (signed int)( (_LCoef<-_LScale)?-_LScale:((_LCoef>_LScale)?_LScale:_LCoef) );
lut[_LIdx+_LCc] = (signed short)( (_LCoef<-_LScale)?-_LScale:((_LCoef>_LScale)?_LScale:_LCoef) );
}
}
for( _LPcl=0;_LPcl<WFIR_CUTOFFLEN;_LPcl++ )
@@ -260,10 +257,14 @@ inline int __fir_interpolate(unsigned int nPos, int *p)
return vol;
}
extern "C" int fir_interpolate(unsigned int nPos, int *p)
extern "C" {
signed short *fir_lut = &CzWINDOWEDFIR::lut[0];
int fir_interpolate(unsigned int nPos, int *p)
{
return __fir_interpolate(nPos, p);
}
}
#define WFIR_CUTOFFSHIFT (32-(WFIR_CUTOFFBITS+WFIR_LOG2WIDTH))
#define WFIR_CUTOFFMASK ((((1L<<(32-WFIR_CUTOFFSHIFT))-1)&~((1L<<WFIR_LOG2WIDTH)-1)))