summaryrefslogtreecommitdiff
path: root/src/libFLAC/ia32
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2021-06-30 08:06:58 +0200
committerMartijn van Beurden <mvanb1@gmail.com>2022-04-19 20:38:37 +0200
commitee18d1b892cd476ad927d169bf6d1162beefd0dd (patch)
treeac961bb583eb06177a1271b870622f8d80130d36 /src/libFLAC/ia32
parentb19ed90a5b1711653dc959f79110117d092aba9d (diff)
downloadflac-ee18d1b892cd476ad927d169bf6d1162beefd0dd.tar.gz
Switch to autoc[] as double
This changes the calculation of autocorrelation from single precision float to double precision. With this, compression improves on average by about 0.5% with compression level 4, with some tracks (espcially material with high samplerates) seeing improvements of 10% or more. This commit removes SSE intrinsics and MMX assembler routins, adds SSE2 and changes VSX autoc[] routines and changes the regular C code.
Diffstat (limited to 'src/libFLAC/ia32')
-rw-r--r--src/libFLAC/ia32/lpc_asm-unrolled.nasm785
-rw-r--r--src/libFLAC/ia32/lpc_asm.nasm667
2 files changed, 0 insertions, 1452 deletions
diff --git a/src/libFLAC/ia32/lpc_asm-unrolled.nasm b/src/libFLAC/ia32/lpc_asm-unrolled.nasm
deleted file mode 100644
index 02c0363c..00000000
--- a/src/libFLAC/ia32/lpc_asm-unrolled.nasm
+++ /dev/null
@@ -1,785 +0,0 @@
-; vim:filetype=nasm ts=8
-
-; libFLAC - Free Lossless Audio Codec library
-; Copyright (C) 2001-2009 Josh Coalson
-; Copyright (C) 2011-2016 Xiph.Org Foundation
-;
-; Redistribution and use in source and binary forms, with or without
-; modification, are permitted provided that the following conditions
-; are met:
-;
-; - Redistributions of source code must retain the above copyright
-; notice, this list of conditions and the following disclaimer.
-;
-; - Redistributions in binary form must reproduce the above copyright
-; notice, this list of conditions and the following disclaimer in the
-; documentation and/or other materials provided with the distribution.
-;
-; - Neither the name of the Xiph.org Foundation nor the names of its
-; contributors may be used to endorse or promote products derived from
-; this software without specific prior written permission.
-;
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
-; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-; [CR] is a note to flag that the instruction can be easily reordered
-
-%include "nasm.h"
-
- data_section
-
-cglobal FLAC__lpc_compute_autocorrelation_asm
-
- code_section
-
-; **********************************************************************
-;
-; void FLAC__lpc_compute_autocorrelation_asm(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
-; {
-; FLAC__real d;
-; unsigned sample, coeff;
-; const unsigned limit = data_len - lag;
-;
-; assert(lag > 0);
-; assert(lag <= data_len);
-;
-; for(coeff = 0; coeff < lag; coeff++)
-; autoc[coeff] = 0.0;
-; for(sample = 0; sample <= limit; sample++){
-; d = data[sample];
-; for(coeff = 0; coeff < lag; coeff++)
-; autoc[coeff] += d * data[sample+coeff];
-; }
-; for(; sample < data_len; sample++){
-; d = data[sample];
-; for(coeff = 0; coeff < data_len - sample; coeff++)
-; autoc[coeff] += d * data[sample+coeff];
-; }
-; }
-;
-FLAC__lpc_compute_autocorrelation_asm:
-
- push ebp
- lea ebp, [esp + 8]
- push ebx
- push esi
- push edi
-
- mov edx, [ebp + 8] ; edx == lag
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
-
- cmp edx, 1
- ja short .lag_above_1
-.lag_eq_1:
- fldz ; will accumulate autoc[0]
- ALIGN 16
-.lag_1_loop:
- fld dword [esi]
- add esi, byte 4 ; sample++
- fmul st0, st0
- faddp st1, st0
- dec ecx
- jnz .lag_1_loop
- fstp dword [edi]
- jmp .end
-
-.lag_above_1:
- cmp edx, 2
- ja short .lag_above_2
-.lag_eq_2:
- fldz ; will accumulate autoc[1]
- dec ecx
- fldz ; will accumulate autoc[0]
- fld dword [esi]
- ALIGN 16
-.lag_2_loop:
- add esi, byte 4 ; [CR] sample++
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi]
- fmul st1, st0
- fxch
- faddp st3, st0 ; add to autoc[1]
- dec ecx
- jnz .lag_2_loop
- ; clean up the leftovers
- fmul st0, st0
- faddp st1, st0 ; add to autoc[0]
- fstp dword [edi]
- fstp dword [edi + 4]
- jmp .end
-
-.lag_above_2:
- cmp edx, 3
- ja short .lag_above_3
-.lag_eq_3:
- fldz ; will accumulate autoc[2]
- dec ecx
- fldz ; will accumulate autoc[1]
- dec ecx
- fldz ; will accumulate autoc[0]
- ALIGN 16
-.lag_3_loop:
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[2]
- dec ecx
- jnz .lag_3_loop
- ; clean up the leftovers
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st1, st0
- fxch
- faddp st3, st0 ; add to autoc[1]
- fmul st0, st0
- faddp st1, st0 ; add to autoc[0]
- fstp dword [edi]
- fstp dword [edi + 4]
- fstp dword [edi + 8]
- jmp .end
-
-.lag_above_3:
- cmp edx, 4
- ja near .lag_above_4
-.lag_eq_4:
- fldz ; will accumulate autoc[3]
- dec ecx
- fldz ; will accumulate autoc[2]
- dec ecx
- fldz ; will accumulate autoc[1]
- dec ecx
- fldz ; will accumulate autoc[0]
- ALIGN 16
-.lag_4_loop:
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[2]
- fld dword [esi + 12]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st4, st0 ; add to autoc[3]
- dec ecx
- jnz .lag_4_loop
- ; clean up the leftovers
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[2]
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st1, st0
- fxch
- faddp st3, st0 ; add to autoc[1]
- fmul st0, st0
- faddp st1, st0 ; add to autoc[0]
- fstp dword [edi]
- fstp dword [edi + 4]
- fstp dword [edi + 8]
- fstp dword [edi + 12]
- jmp .end
-
-.lag_above_4:
- cmp edx, 5
- ja near .lag_above_5
-.lag_eq_5:
- fldz ; will accumulate autoc[4]
- fldz ; will accumulate autoc[3]
- fldz ; will accumulate autoc[2]
- fldz ; will accumulate autoc[1]
- fldz ; will accumulate autoc[0]
- sub ecx, byte 4
- ALIGN 16
-.lag_5_loop:
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[2]
- fld dword [esi + 12]
- fmul st0, st1
- faddp st5, st0 ; add to autoc[3]
- fld dword [esi + 16]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st5, st0 ; add to autoc[4]
- dec ecx
- jnz .lag_5_loop
- ; clean up the leftovers
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[2]
- fld dword [esi + 12]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st4, st0 ; add to autoc[3]
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[2]
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st1, st0
- fxch
- faddp st3, st0 ; add to autoc[1]
- fmul st0, st0
- faddp st1, st0 ; add to autoc[0]
- fstp dword [edi]
- fstp dword [edi + 4]
- fstp dword [edi + 8]
- fstp dword [edi + 12]
- fstp dword [edi + 16]
- jmp .end
-
-.lag_above_5:
- cmp edx, 6
- ja .lag_above_6
-.lag_eq_6:
- fldz ; will accumulate autoc[5]
- fldz ; will accumulate autoc[4]
- fldz ; will accumulate autoc[3]
- fldz ; will accumulate autoc[2]
- fldz ; will accumulate autoc[1]
- fldz ; will accumulate autoc[0]
- sub ecx, byte 5
- ALIGN 16
-.lag_6_loop:
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[2]
- fld dword [esi + 12]
- fmul st0, st1
- faddp st5, st0 ; add to autoc[3]
- fld dword [esi + 16]
- fmul st0, st1
- faddp st6, st0 ; add to autoc[4]
- fld dword [esi + 20]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st6, st0 ; add to autoc[5]
- dec ecx
- jnz .lag_6_loop
- ; clean up the leftovers
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[2]
- fld dword [esi + 12]
- fmul st0, st1
- faddp st5, st0 ; add to autoc[3]
- fld dword [esi + 16]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st5, st0 ; add to autoc[4]
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[2]
- fld dword [esi + 12]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st4, st0 ; add to autoc[3]
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[1]
- fld dword [esi + 8]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[2]
- fld dword [esi]
- fld st0
- fmul st0, st0
- faddp st2, st0 ; add to autoc[0]
- fld dword [esi + 4]
- fmul st1, st0
- fxch
- faddp st3, st0 ; add to autoc[1]
- fmul st0, st0
- faddp st1, st0 ; add to autoc[0]
- fstp dword [edi]
- fstp dword [edi + 4]
- fstp dword [edi + 8]
- fstp dword [edi + 12]
- fstp dword [edi + 16]
- fstp dword [edi + 20]
- jmp .end
-
-.lag_above_6:
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] = 0.0;
- lea ecx, [edx * 2] ; ecx = # of dwords of 0 to write
- xor eax, eax
- rep stosd
- mov ecx, [ebp + 4] ; ecx == data_len
- mov edi, [ebp + 12] ; edi == autoc
- ; const unsigned limit = data_len - lag;
- sub ecx, edx
- inc ecx ; we are looping <= limit so we add one to the counter
- ; for(sample = 0; sample <= limit; sample++){
- ; d = data[sample];
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] += d * data[sample+coeff];
- ; }
- xor eax, eax ; eax == sample <- 0
- ALIGN 16
-.outer_loop:
- push eax ; save sample
- fld dword [esi + eax * 4] ; ST = d <- data[sample]
- mov ebx, eax ; ebx == sample+coeff <- sample
- mov edx, [ebp + 8] ; edx <- lag
- xor eax, eax ; eax == coeff <- 0
- ALIGN 16
-.inner_loop:
- fld st0 ; ST = d d
- fmul dword [esi + ebx * 4] ; ST = d*data[sample+coeff] d
- fadd dword [edi + eax * 4] ; ST = autoc[coeff]+d*data[sample+coeff] d
- fstp dword [edi + eax * 4] ; autoc[coeff]+=d*data[sample+coeff] ST = d
- inc ebx ; (sample+coeff)++
- inc eax ; coeff++
- dec edx
- jnz .inner_loop
- pop eax ; restore sample
- fstp st0 ; pop d, ST = empty
- inc eax ; sample++
- loop .outer_loop
- ; for(; sample < data_len; sample++){
- ; d = data[sample];
- ; for(coeff = 0; coeff < data_len - sample; coeff++)
- ; autoc[coeff] += d * data[sample+coeff];
- ; }
- mov ecx, [ebp + 8] ; ecx <- lag
- dec ecx ; ecx <- lag - 1
- jz .outer_end ; skip loop if 0
-.outer_loop2:
- push eax ; save sample
- fld dword [esi + eax * 4] ; ST = d <- data[sample]
- mov ebx, eax ; ebx == sample+coeff <- sample
- mov edx, [ebp + 4] ; edx <- data_len
- sub edx, eax ; edx <- data_len-sample
- xor eax, eax ; eax == coeff <- 0
-.inner_loop2:
- fld st0 ; ST = d d
- fmul dword [esi + ebx * 4] ; ST = d*data[sample+coeff] d
- fadd dword [edi + eax * 4] ; ST = autoc[coeff]+d*data[sample+coeff] d
- fstp dword [edi + eax * 4] ; autoc[coeff]+=d*data[sample+coeff] ST = d
- inc ebx ; (sample+coeff)++
- inc eax ; coeff++
- dec edx
- jnz .inner_loop2
- pop eax ; restore sample
- fstp st0 ; pop d, ST = empty
- inc eax ; sample++
- loop .outer_loop2
-.outer_end:
- jmp .end
-
-.lag_eq_6_plus_1:
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
- fldz ; will accumulate autoc[6]
- sub ecx, byte 6
- ALIGN 16
-.lag_6_1_loop:
- fld dword [esi]
- fld dword [esi + 24]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st1, st0 ; add to autoc[6]
- dec ecx
- jnz .lag_6_1_loop
- fstp dword [edi + 24]
- jmp .end
-
-.lag_eq_6_plus_2:
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
- fldz ; will accumulate autoc[7]
- fldz ; will accumulate autoc[6]
- sub ecx, byte 7
- ALIGN 16
-.lag_6_2_loop:
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st2, st0 ; add to autoc[7]
- dec ecx
- jnz .lag_6_2_loop
- ; clean up the leftovers
- fld dword [esi]
- fld dword [esi + 24]
- fmulp st1, st0
- faddp st1, st0 ; add to autoc[6]
- fstp dword [edi + 24]
- fstp dword [edi + 28]
- jmp .end
-
-.lag_eq_6_plus_3:
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
- fldz ; will accumulate autoc[8]
- fldz ; will accumulate autoc[7]
- fldz ; will accumulate autoc[6]
- sub ecx, byte 8
- ALIGN 16
-.lag_6_3_loop:
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[8]
- dec ecx
- jnz .lag_6_3_loop
- ; clean up the leftovers
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st2, st0 ; add to autoc[7]
- fld dword [esi]
- fld dword [esi + 24]
- fmulp st1, st0
- faddp st1, st0 ; add to autoc[6]
- fstp dword [edi + 24]
- fstp dword [edi + 28]
- fstp dword [edi + 32]
- jmp .end
-
-.lag_eq_6_plus_4:
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
- fldz ; will accumulate autoc[9]
- fldz ; will accumulate autoc[8]
- fldz ; will accumulate autoc[7]
- fldz ; will accumulate autoc[6]
- sub ecx, byte 9
- ALIGN 16
-.lag_6_4_loop:
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[8]
- fld dword [esi + 36]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st4, st0 ; add to autoc[9]
- dec ecx
- jnz .lag_6_4_loop
- ; clean up the leftovers
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[8]
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st2, st0 ; add to autoc[7]
- fld dword [esi]
- fld dword [esi + 24]
- fmulp st1, st0
- faddp st1, st0 ; add to autoc[6]
- fstp dword [edi + 24]
- fstp dword [edi + 28]
- fstp dword [edi + 32]
- fstp dword [edi + 36]
- jmp .end
-
-.lag_eq_6_plus_5:
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
- fldz ; will accumulate autoc[10]
- fldz ; will accumulate autoc[9]
- fldz ; will accumulate autoc[8]
- fldz ; will accumulate autoc[7]
- fldz ; will accumulate autoc[6]
- sub ecx, byte 10
- ALIGN 16
-.lag_6_5_loop:
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[8]
- fld dword [esi + 36]
- fmul st0, st1
- faddp st5, st0 ; add to autoc[9]
- fld dword [esi + 40]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st5, st0 ; add to autoc[10]
- dec ecx
- jnz .lag_6_5_loop
- ; clean up the leftovers
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[8]
- fld dword [esi + 36]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st4, st0 ; add to autoc[9]
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[8]
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st2, st0 ; add to autoc[7]
- fld dword [esi]
- fld dword [esi + 24]
- fmulp st1, st0
- faddp st1, st0 ; add to autoc[6]
- fstp dword [edi + 24]
- fstp dword [edi + 28]
- fstp dword [edi + 32]
- fstp dword [edi + 36]
- fstp dword [edi + 40]
- jmp .end
-
-.lag_eq_6_plus_6:
- mov ecx, [ebp + 4] ; ecx == data_len
- mov esi, [ebp] ; esi == data
- mov edi, [ebp + 12] ; edi == autoc
- fldz ; will accumulate autoc[11]
- fldz ; will accumulate autoc[10]
- fldz ; will accumulate autoc[9]
- fldz ; will accumulate autoc[8]
- fldz ; will accumulate autoc[7]
- fldz ; will accumulate autoc[6]
- sub ecx, byte 11
- ALIGN 16
-.lag_6_6_loop:
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[8]
- fld dword [esi + 36]
- fmul st0, st1
- faddp st5, st0 ; add to autoc[9]
- fld dword [esi + 40]
- fmul st0, st1
- faddp st6, st0 ; add to autoc[10]
- fld dword [esi + 44]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st6, st0 ; add to autoc[11]
- dec ecx
- jnz .lag_6_6_loop
- ; clean up the leftovers
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[8]
- fld dword [esi + 36]
- fmul st0, st1
- faddp st5, st0 ; add to autoc[9]
- fld dword [esi + 40]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st5, st0 ; add to autoc[10]
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmul st0, st1
- faddp st4, st0 ; add to autoc[8]
- fld dword [esi + 36]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st4, st0 ; add to autoc[9]
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmul st0, st1
- faddp st3, st0 ; add to autoc[7]
- fld dword [esi + 32]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st3, st0 ; add to autoc[8]
- fld dword [esi]
- fld dword [esi + 24]
- fmul st0, st1
- faddp st2, st0 ; add to autoc[6]
- fld dword [esi + 28]
- fmulp st1, st0
- add esi, byte 4 ; [CR] sample++
- faddp st2, st0 ; add to autoc[7]
- fld dword [esi]
- fld dword [esi + 24]
- fmulp st1, st0
- faddp st1, st0 ; add to autoc[6]
- fstp dword [edi + 24]
- fstp dword [edi + 28]
- fstp dword [edi + 32]
- fstp dword [edi + 36]
- fstp dword [edi + 40]
- fstp dword [edi + 44]
- jmp .end
-
-.end:
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-
-; end
diff --git a/src/libFLAC/ia32/lpc_asm.nasm b/src/libFLAC/ia32/lpc_asm.nasm
index 272fb7bd..b6117605 100644
--- a/src/libFLAC/ia32/lpc_asm.nasm
+++ b/src/libFLAC/ia32/lpc_asm.nasm
@@ -35,11 +35,6 @@
data_section
-cglobal FLAC__lpc_compute_autocorrelation_asm_ia32
-cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4_old
-cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8_old
-cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12_old
-cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16_old
cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32
cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx
cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_wide_asm_ia32
@@ -49,668 +44,6 @@ cglobal FLAC__lpc_restore_signal_wide_asm_ia32
code_section
-; **********************************************************************
-;
-; void FLAC__lpc_compute_autocorrelation_asm(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
-; {
-; FLAC__real d;
-; unsigned sample, coeff;
-; const unsigned limit = data_len - lag;
-;
-; FLAC__ASSERT(lag > 0);
-; FLAC__ASSERT(lag <= data_len);
-;
-; for(coeff = 0; coeff < lag; coeff++)
-; autoc[coeff] = 0.0;
-; for(sample = 0; sample <= limit; sample++) {
-; d = data[sample];
-; for(coeff = 0; coeff < lag; coeff++)
-; autoc[coeff] += d * data[sample+coeff];
-; }
-; for(; sample < data_len; sample++) {
-; d = data[sample];
-; for(coeff = 0; coeff < data_len - sample; coeff++)
-; autoc[coeff] += d * data[sample+coeff];
-; }
-; }
-;
- ALIGN 16
-cident FLAC__lpc_compute_autocorrelation_asm_ia32
- ;[esp + 28] == autoc[]
- ;[esp + 24] == lag
- ;[esp + 20] == data_len
- ;[esp + 16] == data[]
-
- ;ASSERT(lag > 0)
- ;ASSERT(lag <= 33)
- ;ASSERT(lag <= data_len)
-
-.begin:
- push esi
- push edi
- push ebx
-
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] = 0.0;
- mov edi, [esp + 28] ; edi == autoc
- mov ecx, [esp + 24] ; ecx = # of dwords (=lag) of 0 to write
- xor eax, eax
- rep stosd
-
- ; const unsigned limit = data_len - lag;
- mov eax, [esp + 24] ; eax == lag
- mov ecx, [esp + 20]
- sub ecx, eax ; ecx == limit
-
- mov edi, [esp + 28] ; edi == autoc
- mov esi, [esp + 16] ; esi == data
- inc ecx ; we are looping <= limit so we add one to the counter
-
- ; for(sample = 0; sample <= limit; sample++) {
- ; d = data[sample];
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] += d * data[sample+coeff];
- ; }
- fld dword [esi] ; ST = d <- data[sample]
- ; each iteration is 11 bytes so we need (-eax)*11, so we do (-12*eax + eax)
- lea edx, [eax + eax*2]
- neg edx
- lea edx, [eax + edx*4 + .jumper1_0 - .get_eip1]
- call .mov_eip_to_ebx
-.get_eip1:
- add edx, ebx
- inc edx ; compensate for the shorter opcode on the last iteration
- inc edx ; compensate for the shorter opcode on the last iteration
- inc edx ; compensate for the shorter opcode on the last iteration
- cmp eax, 33
- jne .loop1_start
- sub edx, byte 9 ; compensate for the longer opcodes on the first iteration
-.loop1_start:
- jmp edx
-
-.mov_eip_to_ebx:
- mov ebx, [esp]
- ret
-
- fld st0 ; ST = d d
- fmul dword [esi + (32*4)] ; ST = d*data[sample+32] d WATCHOUT: not a byte displacement here!
- fadd dword [edi + (32*4)] ; ST = autoc[32]+d*data[sample+32] d WATCHOUT: not a byte displacement here!
- fstp dword [edi + (32*4)] ; autoc[32]+=d*data[sample+32] ST = d WATCHOUT: not a byte displacement here!
- fld st0 ; ST = d d
- fmul dword [esi + (31*4)] ; ST = d*data[sample+31] d
- fadd dword [edi + (31*4)] ; ST = autoc[31]+d*data[sample+31] d
- fstp dword [edi + (31*4)] ; autoc[31]+=d*data[sample+31] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (30*4)] ; ST = d*data[sample+30] d
- fadd dword [edi + (30*4)] ; ST = autoc[30]+d*data[sample+30] d
- fstp dword [edi + (30*4)] ; autoc[30]+=d*data[sample+30] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (29*4)] ; ST = d*data[sample+29] d
- fadd dword [edi + (29*4)] ; ST = autoc[29]+d*data[sample+29] d
- fstp dword [edi + (29*4)] ; autoc[29]+=d*data[sample+29] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (28*4)] ; ST = d*data[sample+28] d
- fadd dword [edi + (28*4)] ; ST = autoc[28]+d*data[sample+28] d
- fstp dword [edi + (28*4)] ; autoc[28]+=d*data[sample+28] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (27*4)] ; ST = d*data[sample+27] d
- fadd dword [edi + (27*4)] ; ST = autoc[27]+d*data[sample+27] d
- fstp dword [edi + (27*4)] ; autoc[27]+=d*data[sample+27] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (26*4)] ; ST = d*data[sample+26] d
- fadd dword [edi + (26*4)] ; ST = autoc[26]+d*data[sample+26] d
- fstp dword [edi + (26*4)] ; autoc[26]+=d*data[sample+26] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (25*4)] ; ST = d*data[sample+25] d
- fadd dword [edi + (25*4)] ; ST = autoc[25]+d*data[sample+25] d
- fstp dword [edi + (25*4)] ; autoc[25]+=d*data[sample+25] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (24*4)] ; ST = d*data[sample+24] d
- fadd dword [edi + (24*4)] ; ST = autoc[24]+d*data[sample+24] d
- fstp dword [edi + (24*4)] ; autoc[24]+=d*data[sample+24] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (23*4)] ; ST = d*data[sample+23] d
- fadd dword [edi + (23*4)] ; ST = autoc[23]+d*data[sample+23] d
- fstp dword [edi + (23*4)] ; autoc[23]+=d*data[sample+23] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (22*4)] ; ST = d*data[sample+22] d
- fadd dword [edi + (22*4)] ; ST = autoc[22]+d*data[sample+22] d
- fstp dword [edi + (22*4)] ; autoc[22]+=d*data[sample+22] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (21*4)] ; ST = d*data[sample+21] d
- fadd dword [edi + (21*4)] ; ST = autoc[21]+d*data[sample+21] d
- fstp dword [edi + (21*4)] ; autoc[21]+=d*data[sample+21] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (20*4)] ; ST = d*data[sample+20] d
- fadd dword [edi + (20*4)] ; ST = autoc[20]+d*data[sample+20] d
- fstp dword [edi + (20*4)] ; autoc[20]+=d*data[sample+20] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (19*4)] ; ST = d*data[sample+19] d
- fadd dword [edi + (19*4)] ; ST = autoc[19]+d*data[sample+19] d
- fstp dword [edi + (19*4)] ; autoc[19]+=d*data[sample+19] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (18*4)] ; ST = d*data[sample+18] d
- fadd dword [edi + (18*4)] ; ST = autoc[18]+d*data[sample+18] d
- fstp dword [edi + (18*4)] ; autoc[18]+=d*data[sample+18] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (17*4)] ; ST = d*data[sample+17] d
- fadd dword [edi + (17*4)] ; ST = autoc[17]+d*data[sample+17] d
- fstp dword [edi + (17*4)] ; autoc[17]+=d*data[sample+17] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (16*4)] ; ST = d*data[sample+16] d
- fadd dword [edi + (16*4)] ; ST = autoc[16]+d*data[sample+16] d
- fstp dword [edi + (16*4)] ; autoc[16]+=d*data[sample+16] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (15*4)] ; ST = d*data[sample+15] d
- fadd dword [edi + (15*4)] ; ST = autoc[15]+d*data[sample+15] d
- fstp dword [edi + (15*4)] ; autoc[15]+=d*data[sample+15] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (14*4)] ; ST = d*data[sample+14] d
- fadd dword [edi + (14*4)] ; ST = autoc[14]+d*data[sample+14] d
- fstp dword [edi + (14*4)] ; autoc[14]+=d*data[sample+14] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (13*4)] ; ST = d*data[sample+13] d
- fadd dword [edi + (13*4)] ; ST = autoc[13]+d*data[sample+13] d
- fstp dword [edi + (13*4)] ; autoc[13]+=d*data[sample+13] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (12*4)] ; ST = d*data[sample+12] d
- fadd dword [edi + (12*4)] ; ST = autoc[12]+d*data[sample+12] d
- fstp dword [edi + (12*4)] ; autoc[12]+=d*data[sample+12] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (11*4)] ; ST = d*data[sample+11] d
- fadd dword [edi + (11*4)] ; ST = autoc[11]+d*data[sample+11] d
- fstp dword [edi + (11*4)] ; autoc[11]+=d*data[sample+11] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (10*4)] ; ST = d*data[sample+10] d
- fadd dword [edi + (10*4)] ; ST = autoc[10]+d*data[sample+10] d
- fstp dword [edi + (10*4)] ; autoc[10]+=d*data[sample+10] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 9*4)] ; ST = d*data[sample+9] d
- fadd dword [edi + ( 9*4)] ; ST = autoc[9]+d*data[sample+9] d
- fstp dword [edi + ( 9*4)] ; autoc[9]+=d*data[sample+9] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 8*4)] ; ST = d*data[sample+8] d
- fadd dword [edi + ( 8*4)] ; ST = autoc[8]+d*data[sample+8] d
- fstp dword [edi + ( 8*4)] ; autoc[8]+=d*data[sample+8] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 7*4)] ; ST = d*data[sample+7] d
- fadd dword [edi + ( 7*4)] ; ST = autoc[7]+d*data[sample+7] d
- fstp dword [edi + ( 7*4)] ; autoc[7]+=d*data[sample+7] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 6*4)] ; ST = d*data[sample+6] d
- fadd dword [edi + ( 6*4)] ; ST = autoc[6]+d*data[sample+6] d
- fstp dword [edi + ( 6*4)] ; autoc[6]+=d*data[sample+6] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 5*4)] ; ST = d*data[sample+4] d
- fadd dword [edi + ( 5*4)] ; ST = autoc[4]+d*data[sample+4] d
- fstp dword [edi + ( 5*4)] ; autoc[4]+=d*data[sample+4] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 4*4)] ; ST = d*data[sample+4] d
- fadd dword [edi + ( 4*4)] ; ST = autoc[4]+d*data[sample+4] d
- fstp dword [edi + ( 4*4)] ; autoc[4]+=d*data[sample+4] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 3*4)] ; ST = d*data[sample+3] d
- fadd dword [edi + ( 3*4)] ; ST = autoc[3]+d*data[sample+3] d
- fstp dword [edi + ( 3*4)] ; autoc[3]+=d*data[sample+3] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 2*4)] ; ST = d*data[sample+2] d
- fadd dword [edi + ( 2*4)] ; ST = autoc[2]+d*data[sample+2] d
- fstp dword [edi + ( 2*4)] ; autoc[2]+=d*data[sample+2] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 1*4)] ; ST = d*data[sample+1] d
- fadd dword [edi + ( 1*4)] ; ST = autoc[1]+d*data[sample+1] d
- fstp dword [edi + ( 1*4)] ; autoc[1]+=d*data[sample+1] ST = d
- fld st0 ; ST = d d
- fmul dword [esi] ; ST = d*data[sample] d WATCHOUT: no displacement byte here!
- fadd dword [edi] ; ST = autoc[0]+d*data[sample] d WATCHOUT: no displacement byte here!
- fstp dword [edi] ; autoc[0]+=d*data[sample] ST = d WATCHOUT: no displacement byte here!
-.jumper1_0:
-
- fstp st0 ; pop d, ST = empty
- add esi, byte 4 ; sample++
- dec ecx
- jz .loop1_end
- fld dword [esi] ; ST = d <- data[sample]
- jmp edx
-.loop1_end:
-
- ; for(; sample < data_len; sample++) {
- ; d = data[sample];
- ; for(coeff = 0; coeff < data_len - sample; coeff++)
- ; autoc[coeff] += d * data[sample+coeff];
- ; }
- mov ecx, [esp + 24] ; ecx <- lag
- dec ecx ; ecx <- lag - 1
- jz near .end ; skip loop if 0 (i.e. lag == 1)
-
- fld dword [esi] ; ST = d <- data[sample]
- mov eax, ecx ; eax <- lag - 1 == data_len - sample the first time through
- ; each iteration is 11 bytes so we need (-eax)*11, so we do (-12*eax + eax)
- lea edx, [eax + eax*2]
- neg edx
- lea edx, [eax + edx*4 + .jumper2_0 - .get_eip2]
- call .mov_eip_to_ebx
-.get_eip2:
- add edx, ebx
- inc edx ; compensate for the shorter opcode on the last iteration
- inc edx ; compensate for the shorter opcode on the last iteration
- inc edx ; compensate for the shorter opcode on the last iteration
- jmp edx
-
- fld st0 ; ST = d d
- fmul dword [esi + (31*4)] ; ST = d*data[sample+31] d
- fadd dword [edi + (31*4)] ; ST = autoc[31]+d*data[sample+31] d
- fstp dword [edi + (31*4)] ; autoc[31]+=d*data[sample+31] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (30*4)] ; ST = d*data[sample+30] d
- fadd dword [edi + (30*4)] ; ST = autoc[30]+d*data[sample+30] d
- fstp dword [edi + (30*4)] ; autoc[30]+=d*data[sample+30] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (29*4)] ; ST = d*data[sample+29] d
- fadd dword [edi + (29*4)] ; ST = autoc[29]+d*data[sample+29] d
- fstp dword [edi + (29*4)] ; autoc[29]+=d*data[sample+29] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (28*4)] ; ST = d*data[sample+28] d
- fadd dword [edi + (28*4)] ; ST = autoc[28]+d*data[sample+28] d
- fstp dword [edi + (28*4)] ; autoc[28]+=d*data[sample+28] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (27*4)] ; ST = d*data[sample+27] d
- fadd dword [edi + (27*4)] ; ST = autoc[27]+d*data[sample+27] d
- fstp dword [edi + (27*4)] ; autoc[27]+=d*data[sample+27] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (26*4)] ; ST = d*data[sample+26] d
- fadd dword [edi + (26*4)] ; ST = autoc[26]+d*data[sample+26] d
- fstp dword [edi + (26*4)] ; autoc[26]+=d*data[sample+26] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (25*4)] ; ST = d*data[sample+25] d
- fadd dword [edi + (25*4)] ; ST = autoc[25]+d*data[sample+25] d
- fstp dword [edi + (25*4)] ; autoc[25]+=d*data[sample+25] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (24*4)] ; ST = d*data[sample+24] d
- fadd dword [edi + (24*4)] ; ST = autoc[24]+d*data[sample+24] d
- fstp dword [edi + (24*4)] ; autoc[24]+=d*data[sample+24] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (23*4)] ; ST = d*data[sample+23] d
- fadd dword [edi + (23*4)] ; ST = autoc[23]+d*data[sample+23] d
- fstp dword [edi + (23*4)] ; autoc[23]+=d*data[sample+23] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (22*4)] ; ST = d*data[sample+22] d
- fadd dword [edi + (22*4)] ; ST = autoc[22]+d*data[sample+22] d
- fstp dword [edi + (22*4)] ; autoc[22]+=d*data[sample+22] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (21*4)] ; ST = d*data[sample+21] d
- fadd dword [edi + (21*4)] ; ST = autoc[21]+d*data[sample+21] d
- fstp dword [edi + (21*4)] ; autoc[21]+=d*data[sample+21] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (20*4)] ; ST = d*data[sample+20] d
- fadd dword [edi + (20*4)] ; ST = autoc[20]+d*data[sample+20] d
- fstp dword [edi + (20*4)] ; autoc[20]+=d*data[sample+20] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (19*4)] ; ST = d*data[sample+19] d
- fadd dword [edi + (19*4)] ; ST = autoc[19]+d*data[sample+19] d
- fstp dword [edi + (19*4)] ; autoc[19]+=d*data[sample+19] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (18*4)] ; ST = d*data[sample+18] d
- fadd dword [edi + (18*4)] ; ST = autoc[18]+d*data[sample+18] d
- fstp dword [edi + (18*4)] ; autoc[18]+=d*data[sample+18] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (17*4)] ; ST = d*data[sample+17] d
- fadd dword [edi + (17*4)] ; ST = autoc[17]+d*data[sample+17] d
- fstp dword [edi + (17*4)] ; autoc[17]+=d*data[sample+17] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (16*4)] ; ST = d*data[sample+16] d
- fadd dword [edi + (16*4)] ; ST = autoc[16]+d*data[sample+16] d
- fstp dword [edi + (16*4)] ; autoc[16]+=d*data[sample+16] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (15*4)] ; ST = d*data[sample+15] d
- fadd dword [edi + (15*4)] ; ST = autoc[15]+d*data[sample+15] d
- fstp dword [edi + (15*4)] ; autoc[15]+=d*data[sample+15] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (14*4)] ; ST = d*data[sample+14] d
- fadd dword [edi + (14*4)] ; ST = autoc[14]+d*data[sample+14] d
- fstp dword [edi + (14*4)] ; autoc[14]+=d*data[sample+14] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (13*4)] ; ST = d*data[sample+13] d
- fadd dword [edi + (13*4)] ; ST = autoc[13]+d*data[sample+13] d
- fstp dword [edi + (13*4)] ; autoc[13]+=d*data[sample+13] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (12*4)] ; ST = d*data[sample+12] d
- fadd dword [edi + (12*4)] ; ST = autoc[12]+d*data[sample+12] d
- fstp dword [edi + (12*4)] ; autoc[12]+=d*data[sample+12] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (11*4)] ; ST = d*data[sample+11] d
- fadd dword [edi + (11*4)] ; ST = autoc[11]+d*data[sample+11] d
- fstp dword [edi + (11*4)] ; autoc[11]+=d*data[sample+11] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + (10*4)] ; ST = d*data[sample+10] d
- fadd dword [edi + (10*4)] ; ST = autoc[10]+d*data[sample+10] d
- fstp dword [edi + (10*4)] ; autoc[10]+=d*data[sample+10] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 9*4)] ; ST = d*data[sample+9] d
- fadd dword [edi + ( 9*4)] ; ST = autoc[9]+d*data[sample+9] d
- fstp dword [edi + ( 9*4)] ; autoc[9]+=d*data[sample+9] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 8*4)] ; ST = d*data[sample+8] d
- fadd dword [edi + ( 8*4)] ; ST = autoc[8]+d*data[sample+8] d
- fstp dword [edi + ( 8*4)] ; autoc[8]+=d*data[sample+8] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 7*4)] ; ST = d*data[sample+7] d
- fadd dword [edi + ( 7*4)] ; ST = autoc[7]+d*data[sample+7] d
- fstp dword [edi + ( 7*4)] ; autoc[7]+=d*data[sample+7] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 6*4)] ; ST = d*data[sample+6] d
- fadd dword [edi + ( 6*4)] ; ST = autoc[6]+d*data[sample+6] d
- fstp dword [edi + ( 6*4)] ; autoc[6]+=d*data[sample+6] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 5*4)] ; ST = d*data[sample+4] d
- fadd dword [edi + ( 5*4)] ; ST = autoc[4]+d*data[sample+4] d
- fstp dword [edi + ( 5*4)] ; autoc[4]+=d*data[sample+4] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 4*4)] ; ST = d*data[sample+4] d
- fadd dword [edi + ( 4*4)] ; ST = autoc[4]+d*data[sample+4] d
- fstp dword [edi + ( 4*4)] ; autoc[4]+=d*data[sample+4] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 3*4)] ; ST = d*data[sample+3] d
- fadd dword [edi + ( 3*4)] ; ST = autoc[3]+d*data[sample+3] d
- fstp dword [edi + ( 3*4)] ; autoc[3]+=d*data[sample+3] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 2*4)] ; ST = d*data[sample+2] d
- fadd dword [edi + ( 2*4)] ; ST = autoc[2]+d*data[sample+2] d
- fstp dword [edi + ( 2*4)] ; autoc[2]+=d*data[sample+2] ST = d
- fld st0 ; ST = d d
- fmul dword [esi + ( 1*4)] ; ST = d*data[sample+1] d
- fadd dword [edi + ( 1*4)] ; ST = autoc[1]+d*data[sample+1] d
- fstp dword [edi + ( 1*4)] ; autoc[1]+=d*data[sample+1] ST = d
- fld st0 ; ST = d d
- fmul dword [esi] ; ST = d*data[sample] d WATCHOUT: no displacement byte here!
- fadd dword [edi] ; ST = autoc[0]+d*data[sample] d WATCHOUT: no displacement byte here!
- fstp dword [edi] ; autoc[0]+=d*data[sample] ST = d WATCHOUT: no displacement byte here!
-.jumper2_0:
-
- fstp st0 ; pop d, ST = empty
- add esi, byte 4 ; sample++
- dec ecx
- jz .loop2_end
- add edx, byte 11 ; adjust our inner loop counter by adjusting the jump target
- fld dword [esi] ; ST = d <- data[sample]
- jmp edx
-.loop2_end:
-
-.end:
- pop ebx
- pop edi
- pop esi
- ret
-
- ALIGN 16
-cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4_old
- ;[esp + 16] == autoc[]
- ;[esp + 12] == lag
- ;[esp + 8] == data_len
- ;[esp + 4] == data[]
-
- ;ASSERT(lag > 0)
- ;ASSERT(lag <= 4)
- ;ASSERT(lag <= data_len)
-
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] = 0.0;
- xorps xmm5, xmm5
-
- mov edx, [esp + 8] ; edx == data_len
- mov eax, [esp + 4] ; eax == &data[sample] <- &data[0]
-
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[0]
- add eax, 4
- movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0]
- shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0]
-.warmup: ; xmm2 == data[sample-3],data[sample-2],data[sample-1],data[sample]
- mulps xmm0, xmm2 ; xmm0 = xmm0 * xmm2
- addps xmm5, xmm0 ; xmm5 += xmm0 * xmm2
- dec edx
- jz .loop_end
- ALIGN 16
-.loop_start:
- ; start by reading the next sample
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample]
- add eax, 4
- shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample]
- shufps xmm2, xmm2, 93h ; 93h=2-1-0-3 => xmm2 gets rotated left by one float
- movss xmm2, xmm0
- mulps xmm0, xmm2 ; xmm0 = xmm0 * xmm2
- addps xmm5, xmm0 ; xmm5 += xmm0 * xmm2
- dec edx
- jnz .loop_start
-.loop_end:
- ; store autoc
- mov edx, [esp + 16] ; edx == autoc
- movups [edx], xmm5
-
-.end:
- ret
-
- ALIGN 16
-cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8_old
- ;[esp + 16] == autoc[]
- ;[esp + 12] == lag
- ;[esp + 8] == data_len
- ;[esp + 4] == data[]
-
- ;ASSERT(lag > 0)
- ;ASSERT(lag <= 8)
- ;ASSERT(lag <= data_len)
-
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] = 0.0;
- xorps xmm5, xmm5
- xorps xmm6, xmm6
-
- mov edx, [esp + 8] ; edx == data_len
- mov eax, [esp + 4] ; eax == &data[sample] <- &data[0]
-
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[0]
- add eax, 4
- movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0]
- shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0]
- movaps xmm1, xmm0 ; xmm1 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0]
- xorps xmm3, xmm3 ; xmm3 = 0,0,0,0
-.warmup: ; xmm3:xmm2 == data[sample-7],data[sample-6],...,data[sample]
- mulps xmm0, xmm2
- mulps xmm1, xmm3 ; xmm1:xmm0 = xmm1:xmm0 * xmm3:xmm2
- addps xmm5, xmm0
- addps xmm6, xmm1 ; xmm6:xmm5 += xmm1:xmm0 * xmm3:xmm2
- dec edx
- jz .loop_end
- ALIGN 16
-.loop_start:
- ; start by reading the next sample
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample]
- ; here we reorder the instructions; see the (#) indexes for a logical order
- shufps xmm2, xmm2, 93h ; (3) 93h=2-1-0-3 => xmm2 gets rotated left by one float
- add eax, 4 ; (0)
- shufps xmm3, xmm3, 93h ; (4) 93h=2-1-0-3 => xmm3 gets rotated left by one float
- shufps xmm0, xmm0, 0 ; (1) xmm0 = data[sample],data[sample],data[sample],data[sample]
- movss xmm3, xmm2 ; (5)
- movaps xmm1, xmm0 ; (2) xmm1 = data[sample],data[sample],data[sample],data[sample]
- movss xmm2, xmm0 ; (6)
- mulps xmm1, xmm3 ; (8)
- mulps xmm0, xmm2 ; (7) xmm1:xmm0 = xmm1:xmm0 * xmm3:xmm2
- addps xmm6, xmm1 ; (10)
- addps xmm5, xmm0 ; (9) xmm6:xmm5 += xmm1:xmm0 * xmm3:xmm2
- dec edx
- jnz .loop_start
-.loop_end:
- ; store autoc
- mov edx, [esp + 16] ; edx == autoc
- movups [edx], xmm5
- movups [edx + 16], xmm6
-
-.end:
- ret
-
- ALIGN 16
-cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12_old
- ;[esp + 16] == autoc[]
- ;[esp + 12] == lag
- ;[esp + 8] == data_len
- ;[esp + 4] == data[]
-
- ;ASSERT(lag > 0)
- ;ASSERT(lag <= 12)
- ;ASSERT(lag <= data_len)
-
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] = 0.0;
- xorps xmm5, xmm5
- xorps xmm6, xmm6
- xorps xmm7, xmm7
-
- mov edx, [esp + 8] ; edx == data_len
- mov eax, [esp + 4] ; eax == &data[sample] <- &data[0]
-
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[0]
- add eax, 4
- movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0]
- shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0]
- xorps xmm3, xmm3 ; xmm3 = 0,0,0,0
- xorps xmm4, xmm4 ; xmm4 = 0,0,0,0
-.warmup: ; xmm3:xmm2 == data[sample-7],data[sample-6],...,data[sample]
- movaps xmm1, xmm0
- mulps xmm1, xmm2
- addps xmm5, xmm1
- movaps xmm1, xmm0
- mulps xmm1, xmm3
- addps xmm6, xmm1
- mulps xmm0, xmm4
- addps xmm7, xmm0 ; xmm7:xmm6:xmm5 += xmm0:xmm0:xmm0 * xmm4:xmm3:xmm2
- dec edx
- jz .loop_end
- ALIGN 16
-.loop_start:
- ; start by reading the next sample
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample]
- add eax, 4
- shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample]
-
- ; shift xmm4:xmm3:xmm2 left by one float
- shufps xmm2, xmm2, 93h ; 93h=2-1-0-3 => xmm2 gets rotated left by one float
- shufps xmm3, xmm3, 93h ; 93h=2-1-0-3 => xmm3 gets rotated left by one float
- shufps xmm4, xmm4, 93h ; 93h=2-1-0-3 => xmm4 gets rotated left by one float
- movss xmm4, xmm3
- movss xmm3, xmm2
- movss xmm2, xmm0
-
- ; xmm7:xmm6:xmm5 += xmm0:xmm0:xmm0 * xmm4:xmm3:xmm2
- movaps xmm1, xmm0
- mulps xmm1, xmm2
- addps xmm5, xmm1
- movaps xmm1, xmm0
- mulps xmm1, xmm3
- addps xmm6, xmm1
- mulps xmm0, xmm4
- addps xmm7, xmm0
-
- dec edx
- jnz .loop_start
-.loop_end:
- ; store autoc
- mov edx, [esp + 16] ; edx == autoc
- movups [edx], xmm5
- movups [edx + 16], xmm6
- movups [edx + 32], xmm7
-
-.end:
- ret
-
- ALIGN 16
-cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16_old
- ;[ebp + 20] == autoc[]
- ;[ebp + 16] == lag
- ;[ebp + 12] == data_len
- ;[ebp + 8] == data[]
- ;[esp] == __m128
- ;[esp + 16] == __m128
-
- push ebp
- mov ebp, esp
- and esp, -16 ; stack realign for SSE instructions 'movaps' and 'addps'
- sub esp, 32
-
- ;ASSERT(lag > 0)
- ;ASSERT(lag <= 16)
- ;ASSERT(lag <= data_len)
- ;ASSERT(data_len > 0)
-
- ; for(coeff = 0; coeff < lag; coeff++)
- ; autoc[coeff] = 0.0;
- xorps xmm5, xmm5
- xorps xmm6, xmm6
- movaps [esp], xmm5
- movaps [esp + 16], xmm6
-
- mov edx, [ebp + 12] ; edx == data_len
- mov eax, [ebp + 8] ; eax == &data[sample] <- &data[0]
-
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[0]
- add eax, 4
- movaps xmm1, xmm0 ; xmm1 = 0,0,0,data[0]
- shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0]
- xorps xmm2, xmm2 ; xmm2 = 0,0,0,0
- xorps xmm3, xmm3 ; xmm3 = 0,0,0,0
- xorps xmm4, xmm4 ; xmm4 = 0,0,0,0
- movaps xmm7, xmm0
- mulps xmm7, xmm1
- addps xmm5, xmm7
- dec edx
- jz .loop_end
- ALIGN 16
-.loop_start:
- ; start by reading the next sample
- movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample]
- add eax, 4
- shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample]
-
- ; shift xmm4:xmm3:xmm2:xmm1 left by one float
- shufps xmm1, xmm1, 93h
- shufps xmm2, xmm2, 93h
- shufps xmm3, xmm3, 93h
- shufps xmm4, xmm4, 93h
- movss xmm4, xmm3
- movss xmm3, xmm2
- movss xmm2, xmm1
- movss xmm1, xmm0
-
- ; xmmB:xmmA:xmm6:xmm5 += xmm0:xmm0:xmm0:xmm0 * xmm4:xmm3:xmm2:xmm1
- movaps xmm7, xmm0
- mulps xmm7, xmm1
- addps xmm5, xmm7
- movaps xmm7, xmm0
- mulps xmm7, xmm2
- addps xmm6, xmm7
- movaps xmm7, xmm0
- mulps xmm7, xmm3
- mulps xmm0, xmm4
- addps xmm7, [esp]
- addps xmm0, [esp + 16]
- movaps [esp], xmm7
- movaps [esp + 16], xmm0
-
- dec edx
- jnz .loop_start
-.loop_end:
- ; store autoc
- mov edx, [ebp + 20] ; edx == autoc
- movups [edx], xmm5
- movups [edx + 16], xmm6
- movaps xmm5, [esp]
- movaps xmm6, [esp + 16]
- movups [edx + 32], xmm5
- movups [edx + 48], xmm6
-.end:
- mov esp, ebp
- pop ebp
- ret
-
;void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
;
; for(i = 0; i < data_len; i++) {