Commit c4369158 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

libFLAC : Remove FLAC__precompute_partition_info_sums_32bit_asm_ia32_().

This function offer no speed up from the C version of the function and were
commented out after the release of 1.3.0. We will now drop them completely.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
parent f081524c
......@@ -71,8 +71,7 @@ SRCS_NASM = \
ia32/bitreader_asm.nasm \
ia32/cpu_asm.nasm \
ia32/fixed_asm.nasm \
ia32/lpc_asm.nasm \
ia32/stream_encoder_asm.nasm
ia32/lpc_asm.nasm
endif
endif
......
......@@ -42,5 +42,4 @@ libFLAC_asm_la_SOURCES = \
cpu_asm.nasm \
fixed_asm.nasm \
lpc_asm.nasm \
nasm.h \
stream_encoder_asm.nasm
nasm.h
; vim:filetype=nasm ts=8
; libFLAC - Free Lossless Audio Codec library
; Copyright (C) 2001-2009 Josh Coalson
; Copyright (C) 2011-2013 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.
%include "nasm.h"
data_section
cglobal FLAC__precompute_partition_info_sums_32bit_asm_ia32_
code_section
; **********************************************************************
;
; void precompute_partition_info_sums_32bit_(
; const FLAC__int32 residual[],
; FLAC__uint64 abs_residual_partition_sums[],
; unsigned blocksize,
; unsigned predictor_order,
; unsigned min_partition_order,
; unsigned max_partition_order
; )
;
ALIGN 16
cident FLAC__precompute_partition_info_sums_32bit_asm_ia32_
;; peppered throughout the code at major checkpoints are keys like this as to where things are at that point in time
;; [esp + 4] const FLAC__int32 residual[]
;; [esp + 8] FLAC__uint64 abs_residual_partition_sums[]
;; [esp + 12] unsigned blocksize
;; [esp + 16] unsigned predictor_order
;; [esp + 20] unsigned min_partition_order
;; [esp + 24] unsigned max_partition_order
push ebp
push ebx
push esi
push edi
sub esp, 8
;; [esp + 28] const FLAC__int32 residual[]
;; [esp + 32] FLAC__uint64 abs_residual_partition_sums[]
;; [esp + 36] unsigned blocksize
;; [esp + 40] unsigned predictor_order
;; [esp + 44] unsigned min_partition_order
;; [esp + 48] unsigned max_partition_order
;; [esp] partitions
;; [esp + 4] default_partition_samples
mov ecx, [esp + 48]
mov eax, 1
shl eax, cl
mov [esp], eax ; [esp] <- partitions = 1u << max_partition_order;
mov eax, [esp + 36]
shr eax, cl
mov [esp + 4], eax ; [esp + 4] <- default_partition_samples = blocksize >> max_partition_order;
;
; first do max_partition_order
;
mov edi, [esp + 4]
sub edi, [esp + 40] ; edi <- end = (unsigned)(-(int)predictor_order) + default_partition_samples
xor esi, esi ; esi <- residual_sample = 0
xor ecx, ecx ; ecx <- partition = 0
mov ebp, [esp + 28] ; ebp <- residual[]
xor ebx, ebx ; ebx <- abs_residual_partition_sum = 0;
; note we put the updates to 'end' and 'abs_residual_partition_sum' at the end of loop0 and in the initialization above so we could align loop0 and loop1
ALIGN 16
.loop0: ; for(partition = residual_sample = 0; partition < partitions; partition++) {
.loop1: ; for( ; residual_sample < end; residual_sample++)
mov eax, [ebp + esi * 4]
cdq
xor eax, edx
sub eax, edx
add ebx, eax ; abs_residual_partition_sum += abs(residual[residual_sample]);
;@@@@@@ check overflow flag and abort here?
add esi, byte 1
cmp esi, edi ; /* since the loop will always run at least once, we can put the loop check down here */
jb .loop1
.next1:
add edi, [esp + 4] ; end += default_partition_samples;
mov eax, [esp + 32]
mov [eax + ecx * 8], ebx ; abs_residual_partition_sums[partition] = abs_residual_partition_sum;
mov [eax + ecx * 8 + 4], dword 0
xor ebx, ebx ; abs_residual_partition_sum = 0;
add ecx, byte 1
cmp ecx, [esp] ; /* since the loop will always run at least once, we can put the loop check down here */
jb .loop0
.next0: ; }
;
; now merge partitions for lower orders
;
mov esi, [esp + 32] ; esi <- abs_residual_partition_sums[from_partition==0];
mov eax, [esp]
lea edi, [esi + eax * 8] ; edi <- abs_residual_partition_sums[to_partition==partitions];
mov ecx, [esp + 48]
sub ecx, byte 1 ; ecx <- partition_order = (int)max_partition_order - 1;
ALIGN 16
.loop2: ; for(; partition_order >= (int)min_partition_order; partition_order--) {
cmp ecx, [esp + 44]
jl .next2
mov edx, 1
shl edx, cl ; const unsigned partitions = 1u << partition_order;
ALIGN 16
.loop3: ; for(i = 0; i < partitions; i++) {
mov eax, [esi]
mov ebx, [esi + 4]
add eax, [esi + 8]
adc ebx, [esi + 12]
mov [edi], eax
mov [edi + 4], ebx ; a_r_p_s[to_partition] = a_r_p_s[from_partition] + a_r_p_s[from_partition+1];
add esi, byte 16
add edi, byte 8
sub edx, byte 1
jnz .loop3 ; }
sub ecx, byte 1
jmp .loop2 ; }
.next2:
add esp, 8
pop edi
pop esi
pop ebx
pop ebp
ret
; end
......@@ -535,30 +535,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\ia32\stream_encoder_asm.nasm"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj&#x0D;&#x0A;"
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
Outputs="ia32/stream_encoder_asm.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj&#x0D;&#x0A;"
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
Outputs="ia32/stream_encoder_asm.obj"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
......
......@@ -508,30 +508,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\ia32\stream_encoder_asm.nasm"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj&#x0D;&#x0A;"
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
Outputs="ia32/stream_encoder_asm.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj&#x0D;&#x0A;"
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
Outputs="ia32/stream_encoder_asm.obj"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
......
......@@ -3845,17 +3845,6 @@ unsigned find_best_partition_order_(
return best_residual_bits;
}
#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM && 0
extern void FLAC__precompute_partition_info_sums_32bit_asm_ia32_(
const FLAC__int32 residual[],
FLAC__uint64 abs_residual_partition_sums[],
unsigned blocksize,
unsigned predictor_order,
unsigned min_partition_order,
unsigned max_partition_order
);
#endif
void precompute_partition_info_sums_(
const FLAC__int32 residual[],
FLAC__uint64 abs_residual_partition_sums[],
......@@ -3871,15 +3860,6 @@ void precompute_partition_info_sums_(
FLAC__ASSERT(default_partition_samples > predictor_order);
#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM && 0
/* WATCHOUT: "+ bps + FLAC__MAX_EXTRA_RESIDUAL_BPS" is the maximum
* assumed size of the average residual magnitude */
if(FLAC__bitmath_ilog2(default_partition_samples) + bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < 32) {
FLAC__precompute_partition_info_sums_32bit_asm_ia32_(residual, abs_residual_partition_sums, residual_samples + predictor_order, predictor_order, min_partition_order, max_partition_order);
return;
}
#endif
/* first do max_partition_order */
{
unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment