Move jnc *_mono, ..., *_mono: code from function bodies to the stereofilter helper.

This commit is contained in:
Veikko Sariola
2020-05-20 08:49:23 +03:00
parent dc99157fbb
commit 6f7fed4c6b

View File

@ -10,12 +10,10 @@
SECT_TEXT(sudistrt) SECT_TEXT(sudistrt)
EXPORT MANGLE_FUNC(su_op_distort,0) EXPORT MANGLE_FUNC(su_op_distort,0)
%ifdef INCLUDE_STEREO_DISTORT %ifdef INCLUDE_STEREO_DISTORT
jnc su_op_distort_mono call su_effects_stereohelper
call su_stereo_filterhelper %define INCLUDE_EFFECTS_STEREOHELPER
%define INCLUDE_STEREO_FILTERHELPER %endif
su_op_distort_mono:
%endif
fld dword [edx+su_distort_ports.drive] fld dword [edx+su_distort_ports.drive]
%define SU_INCLUDE_WAVESHAPER %define SU_INCLUDE_WAVESHAPER
; flow into waveshaper ; flow into waveshaper
@ -51,12 +49,10 @@ su_waveshaper:
SECT_TEXT(suhold) SECT_TEXT(suhold)
EXPORT MANGLE_FUNC(su_op_hold,0) EXPORT MANGLE_FUNC(su_op_hold,0)
%ifdef INCLUDE_STEREO_HOLD %ifdef INCLUDE_STEREO_HOLD
jnc su_op_hold_mono call su_effects_stereohelper
call su_stereo_filterhelper %define INCLUDE_EFFECTS_STEREOHELPER
%define INCLUDE_STEREO_FILTERHELPER %endif
su_op_hold_mono:
%endif
fld dword [edx+su_hold_ports.freq] ; f x fld dword [edx+su_hold_ports.freq] ; f x
fmul st0, st0 ; f^2 x fmul st0, st0 ; f^2 x
fchs ; -f^2 x fchs ; -f^2 x
@ -86,12 +82,10 @@ su_op_hold_holding:
SECT_TEXT(sucrush) SECT_TEXT(sucrush)
EXPORT MANGLE_FUNC(su_op_crush,0) EXPORT MANGLE_FUNC(su_op_crush,0)
%ifdef INCLUDE_STEREO_CRUSH %ifdef INCLUDE_STEREO_CRUSH
jnc su_op_crush_mono call su_effects_stereohelper
call su_stereo_filterhelper %define INCLUDE_EFFECTS_STEREOHELPER
%define INCLUDE_STEREO_FILTERHELPER %endif
su_op_crush_mono:
%endif
fdiv dword [edx+su_crush_ports.resolution] fdiv dword [edx+su_crush_ports.resolution]
frndint frndint
fmul dword [edx+su_crush_ports.resolution] fmul dword [edx+su_crush_ports.resolution]
@ -156,12 +150,10 @@ SECT_TEXT(sufilter)
EXPORT MANGLE_FUNC(su_op_filter,0) EXPORT MANGLE_FUNC(su_op_filter,0)
lodsb ; load the flags to al lodsb ; load the flags to al
%ifdef INCLUDE_STEREO_FILTER %ifdef INCLUDE_STEREO_FILTER
jnc su_op_filter_mono call su_effects_stereohelper
call su_stereo_filterhelper %define INCLUDE_EFFECTS_STEREOHELPER
%define INCLUDE_STEREO_FILTERHELPER %endif
su_op_filter_mono:
%endif
fld dword [edx+su_filter_ports.res] ; r x fld dword [edx+su_filter_ports.res] ; r x
fld dword [edx+su_filter_ports.freq]; f r x fld dword [edx+su_filter_ports.freq]; f r x
fmul st0, st0 ; f2 x (square the input so we never get negative and also have a smoother behaviour in the lower frequencies) fmul st0, st0 ; f2 x (square the input so we never get negative and also have a smoother behaviour in the lower frequencies)
@ -221,10 +213,8 @@ SECT_TEXT(suclip)
%if CLIP_ID > -1 %if CLIP_ID > -1
EXPORT MANGLE_FUNC(su_op_clip,0) EXPORT MANGLE_FUNC(su_op_clip,0)
%ifdef INCLUDE_STEREO_CLIP %ifdef INCLUDE_STEREO_CLIP
jnc su_op_clip_mono call su_effects_stereohelper
call su_stereo_filterhelper %define INCLUDE_EFFECTS_STEREOHELPER
%define INCLUDE_STEREO_FILTERHELPER
su_op_clip_mono:
%endif %endif
%define SU_INCLUDE_CLIP %define SU_INCLUDE_CLIP
; flow into su_doclip ; flow into su_doclip
@ -288,19 +278,21 @@ EXPORT MANGLE_FUNC(su_op_pan,0)
%endif ; SU_USE_PAN %endif ; SU_USE_PAN
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; su_stereo_filterhelper: moves the workspace to next, does the filtering for ; su_effects_stereohelper: moves the workspace to next, does the filtering for
; right channel (pulling the calling address from stack), rewinds the ; right channel (pulling the calling address from stack), rewinds the
; workspace and returns ; workspace and returns
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
%ifdef INCLUDE_STEREO_FILTERHELPER %ifdef INCLUDE_EFFECTS_STEREOHELPER
su_stereo_filterhelper: su_effects_stereohelper:
jnc su_effects_stereohelper_mono ; carry is still the stereo bit
add WRK, 16 add WRK, 16
fxch ; r l fxch ; r l
call dword [esp] ; call whoever called me... call dword [esp] ; call whoever called me...
fxch ; l r fxch ; l r
sub WRK, 16 ; move WRK back to where it was sub WRK, 16 ; move WRK back to where it was
ret su_effects_stereohelper_mono:
ret ; return to process l/mono sound
%endif %endif