mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
Optimize compressor size.
This commit is contained in:
parent
55d9ca0ffc
commit
1eb6974d5d
@ -459,26 +459,19 @@ EXPORT MANGLE_FUNC(su_op_compressor,0)
|
|||||||
su_op_compressor_mono:
|
su_op_compressor_mono:
|
||||||
%endif
|
%endif
|
||||||
fld dword [WRK+su_compres_wrk.level] ; l x^2 x
|
fld dword [WRK+su_compres_wrk.level] ; l x^2 x
|
||||||
mov al,1 ; high bits are zero so this is ok. eax = 1 => release
|
fucomi st0, st1
|
||||||
fucomi st0, st1 ; if l > x^2 // we're releasing
|
setnb al ; if (st0 >= st1) al = 1; else al = 0;
|
||||||
jnb su_op_compressor_releasing
|
|
||||||
xor eax, eax ; eax = 0 => attacking
|
|
||||||
su_op_compressor_releasing:
|
|
||||||
fsub st1, st0 ; l x^2-l x
|
fsub st1, st0 ; l x^2-l x
|
||||||
call su_env_map ; c l x^2-l x, c is either attack or release parameter mapped in a nonlinear way
|
call su_env_map ; c l x^2-l x, c is either attack or release parameter mapped in a nonlinear way
|
||||||
fmulp st2, st0 ; l c*(x^2-l) x
|
fmulp st2, st0 ; l c*(x^2-l) x
|
||||||
faddp st1, st0 ; l+c*(x^2-l) x
|
faddp st1, st0 ; l+c*(x^2-l) x
|
||||||
fst dword [WRK+su_compres_wrk.level] ; l'=l+c*(x^2-l), l' x
|
fst dword [WRK+su_compres_wrk.level] ; l'=l+c*(x^2-l), l' x
|
||||||
fld dword [INP+su_compres_ports.threshold] ; t l' x
|
fld dword [INP+su_compres_ports.threshold] ; t l' x
|
||||||
fmul st0, st0 ; t*t
|
fmul st0, st0 ; t*t l' x
|
||||||
fucomi st0, st1 ; if threshold < l'
|
fxch ; l' t*t x
|
||||||
jb su_op_compressor_compress ; then we actually do compression
|
fucomi st0, st1 ; if l' < t*t
|
||||||
fstp st0 ; l' x
|
fcmovb st0, st1 ; l'=t*t
|
||||||
fstp st0 ; x
|
fdivp st1, st0 ; t*t/l' x
|
||||||
fld1 ; 1 x
|
|
||||||
ret ; return unity gain when we are below threshold
|
|
||||||
su_op_compressor_compress: ; l' x
|
|
||||||
fdivrp st1, st0 ; t*t/l' x
|
|
||||||
fld dword [INP+su_compres_ports.ratio] ; r t*t/l' x
|
fld dword [INP+su_compres_ports.ratio] ; r t*t/l' x
|
||||||
do fmul dword [,c_0_5,] ; p=r/2 t*t/l' x
|
do fmul dword [,c_0_5,] ; p=r/2 t*t/l' x
|
||||||
fxch ; t*t/l' p x
|
fxch ; t*t/l' p x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user