Infinity without MMX+ instructions

git-svn-id: svn://kolibrios.org@1916 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Asper 2011-04-02 16:47:56 +00:00
parent 3cf149de61
commit 918d343097

View File

@ -962,6 +962,26 @@ proc SetBufferVol stdcall, str:dword,l_vol:dword,r_vol:dword
ret ret
endp endp
proc minw stdcall, arg1:dword, arg2:dword
mov ax, word [arg1]
cmp ax, word [arg2]
jle @f
mov eax, [arg2]
@@:
ret
endp
proc maxw stdcall, arg1:dword, arg2:dword
mov ax, word [arg1]
cmp ax, word [arg2]
jge @f
mov eax, [arg2]
@@:
ret
endp
proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
locals locals
_600 dd ? _600 dd ?
@ -975,31 +995,34 @@ proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
lea ebx, [state] lea ebx, [state]
fnsave [ebx] fnsave [ebx]
movq mm0, qword [l_vol] stdcall minw, [l_vol], [vol_max]
pminsw mm0, qword [vol_max] stdcall maxw, eax, [vol_min]
pmaxsw mm0, qword [vol_min] mov [l_vol], eax
movq qword [l_vol], mm0 mov [edx+STREAM.l_vol], eax
movq qword [edx+STREAM.l_vol], mm0 stdcall minw, [r_vol], [vol_max+4]
stdcall maxw, eax, [vol_min+4]
mov [r_vol], eax
mov [edx+STREAM.r_vol], eax
movd mm1,[pan] stdcall minw, [pan], [pan_max]
pminsw mm1, qword [pan_max] stdcall maxw, eax, [vol_min]
pmaxsw mm1, qword [vol_min] mov [edx+STREAM.pan], eax
movd [edx+STREAM.pan], mm1
cmp word [edx+STREAM.pan], 0 cmp word [edx+STREAM.pan], 0
jl @F jl .@f
psubsw mm0,mm1 mov ebx, [l_vol]
pminsw mm0, qword [vol_max] sub ebx, eax
pmaxsw mm0, qword [vol_min] stdcall minw, ebx, [vol_max]
movd [l_vol],mm0 stdcall maxw, eax, [vol_min]
mov [l_vol], eax
jmp .calc_amp jmp .calc_amp
@@: @@:
punpckhdq mm0,mm0 mov ebx, [r_vol]
paddsw mm0,mm1 add ebx, [pan]
pminsw mm0, qword [vol_max] stdcall minw, ebx, [vol_max+4]
pmaxsw mm0, qword [vol_min] stdcall maxw, eax, [vol_min+4]
movd [r_vol], mm0 mov [r_vol], eax
.calc_amp: .calc_amp:
emms emms
fild word [l_vol] fild word [l_vol]
@ -1040,6 +1063,7 @@ proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
ret 0 ret 0
endp endp
align 4 align 4
proc GetBufferVol stdcall, str:dword,p_lvol:dword,p_rvol:dword proc GetBufferVol stdcall, str:dword,p_lvol:dword,p_rvol:dword