Make clip opcode working and add regression tests to it.

This commit is contained in:
Veikko Sariola
2020-05-16 22:49:59 +03:00
parent 5760f78201
commit ac5b4dd496
7 changed files with 76 additions and 9 deletions

View File

@ -24,7 +24,7 @@ su_op_distort_mono:
%ifdef SU_INCLUDE_WAVESHAPER
su_waveshaper:
fxch ; x a
call MANGLE_FUNC(su_clip_op,0)
call su_clip
fxch ; a x' (from now on just called x)
fld st0 ; a a x
fsub dword [c_0_5] ; a-.5 a x
@ -193,15 +193,22 @@ su_op_filter_skipneghighpass:
; Input: st0 : x
; Output: st0 : min(max(x,-1),1)
;-------------------------------------------------------------------------------
%if CLIP_ID > -1
%define SU_INCLUDE_CLIP
%endif
%ifdef SU_INCLUDE_CLIP
SECT_TEXT(suclip)
EXPORT MANGLE_FUNC(su_clip_op,0)
%if CLIP_ID > -1
EXPORT MANGLE_FUNC(su_op_clip,0)
%ifdef INCLUDE_STEREO_CLIP
jnc su_op_clip_mono
call su_stereo_filterhelper
%define INCLUDE_STEREO_FILTERHELPER
su_op_clip_mono:
%endif
%define SU_INCLUDE_CLIP
; flow into su_doclip
%endif ; CLIP_ID > -1
%ifdef SU_INCLUDE_CLIP
su_clip:
fld1 ; 1 x a
fucomi st1 ; if (1 <= x)
jbe short su_clip_do ; goto Clip_Do

View File

@ -61,7 +61,7 @@ c_32767 dd 32767.0
mov ecx, 2
%%loop: ; loop over two channels, left & right
fld dword [edi]
call MANGLE_FUNC(su_clip_op,0)
call su_clip
fmul dword [c_32767]
push eax
fistp dword [esp]