initial import
This commit is contained in:
parent
955a767d57
commit
87f5a56dfe
94
src/libFLAC/i386/lpc_asm.nasm
Normal file
94
src/libFLAC/i386/lpc_asm.nasm
Normal file
@ -0,0 +1,94 @@
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001 Josh Coalson
|
||||
;
|
||||
; This library is free software; you can redistribute it and/or
|
||||
; modify it under the terms of the GNU Library General Public
|
||||
; License as published by the Free Software Foundation; either
|
||||
; version 2 of the License, or (at your option) any later version.
|
||||
;
|
||||
; This library 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. See the GNU
|
||||
; Library General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU Library General Public
|
||||
; License along with this library; if not, write to the
|
||||
; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
; Boston, MA 02111-1307, USA.
|
||||
|
||||
%include "nasm.h"
|
||||
|
||||
data_section
|
||||
|
||||
cglobal FLAC__lpc_compute_autocorrelation_asm
|
||||
|
||||
code_section
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; void FLAC__lpc_compute_autocorrelation_asm(const real data[], unsigned data_len, unsigned lag, real autoc[])
|
||||
;
|
||||
FLAC__lpc_compute_autocorrelation_asm:
|
||||
|
||||
push ebp
|
||||
lea ebp, [esp + 8]
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov edx, [ebp + 8] ; edx == lag
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
|
||||
.outer_loop:
|
||||
test edx, edx
|
||||
jz .outer_end
|
||||
dec edx ; lag--
|
||||
|
||||
mov ebx, edx ; ebx == i <- lag
|
||||
xor eax, eax ; eax == i-lag
|
||||
fldz ; ST = d <- 0.0
|
||||
.inner_loop:
|
||||
cmp ebx, ecx
|
||||
jae short .inner_end
|
||||
fld qword [esi + ebx * 8] ; ST = data[i] d
|
||||
fmul qword [esi + eax * 8] ; ST = data[i]*data[i-lag] d
|
||||
faddp st1 ; d += data[i]*data[i-lag] ST = d
|
||||
inc eax
|
||||
inc ebx
|
||||
jmp .inner_loop
|
||||
.inner_end:
|
||||
|
||||
fstp qword [edi + edx * 8]
|
||||
|
||||
jmp .outer_loop
|
||||
.outer_end:
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
end
|
||||
; void FLAC__lpc_compute_autocorrelation_asm(const real data[], unsigned data_len, unsigned lag, real autoc[])
|
||||
; {
|
||||
; real d;
|
||||
; unsigned i;
|
||||
;
|
||||
; assert(lag > 0);
|
||||
; assert(lag <= data_len);
|
||||
;
|
||||
; while(lag--) {
|
||||
; for(i = lag, d = 0.0; i < data_len; i++)
|
||||
; d += data[i] * data[i - lag];
|
||||
; autoc[lag] = d;
|
||||
; }
|
||||
; }
|
51
src/libFLAC/i386/nasm.h
Normal file
51
src/libFLAC/i386/nasm.h
Normal file
@ -0,0 +1,51 @@
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001 Josh Coalson
|
||||
;
|
||||
; This library is free software; you can redistribute it and/or
|
||||
; modify it under the terms of the GNU Library General Public
|
||||
; License as published by the Free Software Foundation; either
|
||||
; version 2 of the License, or (at your option) any later version.
|
||||
;
|
||||
; This library 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. See the GNU
|
||||
; Library General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU Library General Public
|
||||
; License along with this library; if not, write to the
|
||||
; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
; Boston, MA 02111-1307, USA.
|
||||
|
||||
bits 32
|
||||
|
||||
%ifdef WIN32
|
||||
%define FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%idefine code_section section .text align=16 class=CODE use32
|
||||
%idefine data_section section .data align=16 class=DATA use32
|
||||
%idefine bss_section section .bss align=16 class=DATA use32
|
||||
%elifdef AOUT
|
||||
%define FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%idefine code_section section .text
|
||||
%idefine data_section section .data
|
||||
%idefine bss_section section .bss
|
||||
%elifdef ELF
|
||||
%idefine code_section section .text class=CODE use32
|
||||
%idefine data_section section .data class=DATA use32
|
||||
%idefine bss_section section .bss class=DATA use32
|
||||
%else
|
||||
%error unsupported object format!
|
||||
%endif
|
||||
|
||||
%imacro cglobal 1
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%define %1 _%1
|
||||
%endif
|
||||
global %1
|
||||
%endmacro
|
||||
|
||||
%imacro cextern 1
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%define %1 _%1
|
||||
%endif
|
||||
extern %1
|
||||
%endmacro
|
Loading…
Reference in New Issue
Block a user