;**************************************************************************
;*                     This file is part of the                           *
;*                      Mpxplay - audio player.                           *
;*                  The source code of Mpxplay is                         *
;*        (C) copyright 1998-2011 by PDSoft (Attila Padar)                *
;*                  http://mpxplay.sourceforge.net                        *
;*                    email: mpxplay@freemail.hu                          *
;**************************************************************************
;*  This program is distributed in the hope that it will be useful,       *
;*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *
;*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  *
;*  Please contact with the author (with me) if you want to use           *
;*  or modify this source.                                                *
;**************************************************************************
;integer fft calculation from the OpenCP

.387
.386p
.model flat

		PUBLIC	aumixer_analiser_fftcalc_

_TEXT		SEGMENT	DWORD PUBLIC USE32 'CODE'

;eax=long *xi edx=long *cos ebx=unsigned long d2
aumixer_analiser_fftcalc_:
 push ecx
 push edi
 push esi
 push ebp
 mov  ebp,esp
 mov  esi,eax
 mov  edi,edx
 mov  edx,ebx
 shl  edx, 2

 mov  ebx, [esi]
 mov  ecx, [esi+edx]
 mov  eax, ebx
 add  ebx, ecx
 sub  eax, ecx
 sar  ebx, 1
 push eax
 push eax
 mov  [esi], ebx

 mov  ecx, [esi+edx+4]
 mov  ebx, [esi+4]
 mov  eax, ebx
 add  ebx, ecx
 sub  eax, ecx
 sar  ebx, 1
 mov  ecx, eax
 mov  [esi+4], ebx

 add  esi, edx

 mov  edx, [edi+4]
 xor  ebx, ebx
 imul edx
 shrd eax, edx, 29
 mov  edx, [edi]
 sub  ebx, eax
 pop  eax
 imul edx
 shrd eax, edx, 29
 add  ebx, eax
 mov  edx, [edi+4]
 pop  eax
 mov  [esi], ebx
 imul edx
 shrd eax, edx, 29
 mov  ebx, eax
 mov  eax, [edi]
 imul ecx
 shrd eax, edx, 29
 add  ebx, eax
 mov  [esi+4], ebx

 mov  esp,ebp
 pop  ebp
 pop  esi
 pop  edi
 pop  ecx
 ret

aumixer_analiser_fftcalc proc c public
 push eax
 push edx
 push ebx
 mov eax,dword ptr [esp+ 4+12];
 mov edx,dword ptr [esp+ 8+12];
 mov ebx,dword ptr [esp+12+12];
 call aumixer_analiser_fftcalc_
 pop ebx
 pop edx
 pop eax
 ret
aumixer_analiser_fftcalc endp


_TEXT		ENDS
		END
