Commit Graph

174 Commits

Author SHA1 Message Date
Miroslav Lichvar
f081524c19 stream_encoder : Improve selection of residual accumulator width
In the precompute_partition_info_sums_ function, instead of selecting
64-bit accumulator when the signal bps is larger than 16, revert to the
original approach based on partition size, but make room for few extra
bits to not overflow with unusual signals where the average residual
magnitude may be larger than bps.

It slightly improves the performance with standard encoding levels and
16-bit files as the 17-bit side channel can still be processed with the
32-bit accumulator and correctly selects the 64-bit accumulator with
very large 16-bit partitions.

This is related to commits 6f7ec60c and 187e596e.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2014-07-04 21:22:44 +10:00
Erik de Castro Lopo
7590d99b29 libFLAC/md5: Fix for cast-align warnings on ARM.
Rather than the buffer into format_input_() as a FLAC__byte pointer, pass
it as a pointer to a union of three pointers, one each for for FLAC__byte,
FLAC__int16 and FLAC_int32.
This should have zero measurable performance impact.
2014-06-29 21:53:01 +10:00
Erik de Castro Lopo
a8567d4b4e libFLAC/bitmath : Restore an ASSERT that was removed some time after 1.2.1.
Restore a FLAC__ASSERT() to bitmath functions FLAC__bitmath_ilog2 and
FLAC__bitmath_ilog2_wide functions. This prevents the return of an
"undefined" value.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-06-28 22:25:18 +10:00
Erik de Castro Lopo
b8d58e327c Revert "Replace FLAC__CPU_X86_64 with FLaC__CPU_X86_64."
This reverts commit 151739921b.

This patch only when part way to replace all FLAC_* with FLaC_*
and its really not worth going all the way.
2014-06-15 20:29:34 +10:00
Erik de Castro Lopo
151739921b Replace FLAC__CPU_X86_64 with FLaC__CPU_X86_64.
Previous autorconf versions had problems with variable begining witj
'FLAC_' (autoconf uses 'AC_').

Reported-by: lvqcl <lvqcl.mail@gmail.com>
2014-06-01 17:33:54 +10:00
Erik de Castro Lopo
93f6109c90 Add intrinsics version of two lpc functions.
Functions:
- FLAC__fixed_compute_best_predictor
- FLAC__fixed_compute_best_predictor_wide

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-04-11 06:21:15 +10:00
Erik de Castro Lopo
1a6df83163 Use _M_X64 instead of _WIN64.
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-04-11 06:16:37 +10:00
Erik de Castro Lopo
3f5208c300 Fix clang compiler warnings.
These were most arising from -Wenum-conversion where an enum of
one type was being assigned to a variable on another.

Originally reported by Lenny Maiorani <lenny@colorado.edu> on the
flac-dev mailing list.
2014-04-09 18:09:03 +10:00
Erik de Castro Lopo
15e28a4b94 src/libFLAC/ : CPU feature detection improvements.
CPU detection used to depend on ASM code. Now CPU features are
also detected when only FLAC__HAS_X86INTRIN is defined.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-03-02 21:36:45 +11:00
Erik de Castro Lopo
71c9555366 bitmath.h : Fixes for FLAC__bitmath_ilog2_wide().
Existing version had a number of problems:
1) it didn't compile with MSVS
2) it returned correct results only when compiles with GNUC
3) it mentioned LGPL which isn't good for a BSD-licensed library

LGPL -> BSD issue documented here:
http://lists.xiph.org/pipermail/flac-dev/2013-September/004356.html

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-02-02 10:42:20 +11:00
Erik de Castro Lopo
26b9546149 Add sse2 intrinscics code for lpc_restore_signal_...()
The new functions are analogous to FLAC__lpc_restore_signal_asm_ia32_mmx.
FLAC uses them for x86-64 arch and also for ia32 if NASM is not available.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-02-02 08:55:56 +11:00
Erik de Castro Lopo
1d920993f1 Remove redundant inline macro def.
The inline macro already exists in include/share/compat.h.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-01-30 21:57:21 +11:00
Erik de Castro Lopo
d40e986a1e Add FLAC__SSE_SUPPORTED and FLAC__SSE2_SUPPORTED flags.
* Allow compiling using GCC GCC w/o SSE support.
* Allow SSE4.1 intrinsic functions to be enabled.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-01-30 21:49:55 +11:00
Erik de Castro Lopo
7e9278934e libFLAC : Add asm versions for two _wide() functions.
GCC generates slow ia32 code for FLAC__lpc_restore_signal_wide() and
FLAC__lpc_compute_residual_from_qlp_coefficients_wide() so 24-bit
encoding/decoding is slower for GCC compile than for MSVS or ICC
compile. This patch adds ia32 asm versions of these functions.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-01-07 21:35:08 +11:00
Erik de Castro Lopo
6cd8b42438 Add FLAC__ prefix to precompute_partition_info_sums....
Most non-static functions have FLAC__ prefix, but they were missing
from the precompute_partition_info_sums_* functions.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2014-01-07 21:27:00 +11:00
Erik de Castro Lopo
ecd0acba75 Improve x86 instrinsic implementation.
* Splits lpc_x86intrin.c to lpc_intrin_sse.c and lpc_intrin_sse2.c
* Add FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2()
  function to lpc_intrin_sse2.c
* Add lpc_intrin_sse41.c with two ..._wide_intrin_sse41() functions
  (useful for 24-bit en-/decoding)
* Add precompute_partition_info_sums_intrin_sse2() / ...ssse3() and
  disables precompute_partition_info_sums_32bit_asm_ia32_().
  SSE2 version uses 4 SSE2 instructions instead of 1 SSSE3 instruction
  PABSD so it is slightly slower.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2013-10-04 01:41:48 +10:00
Erik de Castro Lopo
4a78cd4e4c Remove union data from FLAC__CPUInfo.
Before this patch it was possible to set or get data.ia32.sse3 value
from x86-64 code, etc which is a potential source of errors.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2013-09-25 23:07:46 +10:00
Erik de Castro Lopo
8fe2c23e31 Add SSE4.1/SSE4.2 detection.
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2013-09-25 23:05:17 +10:00
Erik de Castro Lopo
ae4d720417 Fix/re-enable SSE/SSE2 lpc optimisations. 2013-09-17 06:14:50 +10:00
Erik de Castro Lopo
bd9770ffd1 Only allow SSE2 intrinsics for x86_64. 2013-09-15 19:37:53 +10:00
Erik de Castro Lopo
5e5ee2720c Adds SSE-accelerated lpc functions.
New functions are:
    FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4()
    FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8()
    FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12()
    FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16()
    FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2()

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2013-09-15 10:29:19 +10:00
Erik de Castro Lopo
84c3e3d52c Add CPU features (sse3, ssse3) detection code for x86-64.
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2013-09-15 09:46:20 +10:00
Erik de Castro Lopo
d11c66ffce bitmath.h : Minor improvements.
This is part of a larger patch from lvqcl.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2013-09-08 12:15:57 +10:00
Erik de Castro Lopo
deb209906c Add ASM function FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16.
For the 32 bit x86 ASM functions there were already versions of this
function for lags (N = 4, 8, 12). They require lpc_order less than N.
The best compression preset (flac -8) uses lpc_order up to 12; it
means that during encoding FLAC also uses unaccelerated C function.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2013-08-31 13:53:37 +10:00
Erik de Castro Lopo
b1982fbc5f Set version to 1.3.0 and update coyprights throughout. 2013-05-26 19:17:53 +10:00
Ulrich Klauer
d672efaa05 Fix gcc version check for private macros
Use Benjamin Stiglitz' MIN macros from gcc 4.3 (according to the
changelog, __COUNTER__ was introduced in this version). Previously,
the macros weren't used on any existing gcc version; the first one
would have been 5.5.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2013-05-26 08:26:45 +10:00
Robert Kausch
bb79a59a9f Fix mistyped variable name
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2013-05-26 07:42:19 +10:00
Erik de Castro Lopo
fc21768d44 Fix compile when compiling with FLAC__INTEGER_ONLY_LIBRARY.
Problem reported by Martijn van Beurden <mvanb1@gmail.com>.
2013-04-21 19:51:56 +10:00
Erik de Castro Lopo
2de567fb11 src/libFLAC/include/private/macros.h : Add default MIN/MAX macros. 2013-04-07 20:21:24 +10:00
Erik de Castro Lopo
03a9e6064d src/libFLAC/include/private/macros.h : Check GNUC version for MIN macro. 2013-04-07 20:15:09 +10:00
Erik de Castro Lopo
0a2b901e99 src/libFLAC/include/private/macros.h : Fix flac_min.
The existing flac_min macro was generating -Wshadow compiler warnings
when nested.
2013-03-11 06:06:34 +11:00
Erik de Castro Lopo
a4c321e492 Large patch from Ben Allison fixing the MSVC build.
Patch tweaked a little to fix Linux build and clean up minor problems.
2013-03-06 22:17:51 +11:00
Timothy B. Terriberry
0920bc1ffb Fix a copy & paste error in a comment. 2012-12-09 13:13:12 +11:00
Miroslav Lichvar
7b37472a2f Add new clz function which works with input 0.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2012-08-28 21:17:15 +10:00
Miroslav Lichvar
d69e807e10 Make FLAC__clz_soft_uint32 static.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2012-08-28 21:17:12 +10:00
Erik de Castro Lopo
8749dc278d Fix building when configured with --disable-shared.
The problem was that the function safe_malloc_mul_2op_() was originally
defined as static inline in inclide/share/alloc.h but had to be moved
because GCC was refusing to inline it. Once moved however, static linking
would fail when building the flac executable because the function ended
up beiong linked twice.
2012-06-22 14:23:56 +10:00
Cristian Rodríguez
387b72731d bitmath: Finish up optimizations
This patch adds support for other compilers and systems
including MSVC, Intel C compiler etc..

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2012-06-08 19:58:29 +10:00
Cristian Rodríguez
9b7cb22f84 Update and improve autotools build
- INCLUDES is deprecated, and CPPFLAGS is an user-defined
  variable, use the proper AM_CPPFLAGS instead

- Remove FLAC__INLINE definition, providing proper
  replacement for MSVC compilers.

- Detect if we have C99 's lround and provide a replacement
  for windows...
2012-04-08 09:03:03 +10:00
Cristian Rodríguez
f13ad37519 Fix make distcheck 2012-04-07 08:36:27 +10:00
Erik de Castro Lopo
425d39b5f8 src/libFLAC/include/private/macros.h : Add copyright header. 2012-04-06 09:58:23 +10:00
Cristian Rodríguez
f029625591 V2: Use a single definition of MIN and MAX in sources 2012-04-06 09:52:06 +10:00
Erik de Castro Lopo
5c44cd7d0c Add GCC specific optimisation for log base 2 operations.
Based on a patch from Cristian Rodríguez.
2012-03-30 21:55:08 +11:00
Erik de Castro Lopo
b48909780b Fix a couple 'inlining failed' warning messages. 2012-02-26 20:00:36 +11:00
Erik de Castro Lopo
587e118bfc Fix a bunch of -Wtype-limits warnings. 2012-02-17 17:52:12 +11:00
Josh Coalson
dea0f5a044 add 2009 copyright 2009-01-07 07:31:28 +00:00
Josh Coalson
f7df1154ce const-ify FLAC__crc16_table[] 2008-02-29 01:57:22 +00:00
Josh Coalson
82b128050e update copyright for 2008 2008-02-28 05:34:21 +00:00
Josh Coalson
0f008d2e9e extra checking on memory allocation sizes to prevent a class of overflow attacks 2007-09-11 04:49:56 +00:00
Josh Coalson
b592b49140 minor comments 2007-07-11 04:14:43 +00:00
Josh Coalson
00da5ae8ec add internal FLAC__stream_encoder_set/get_do_md5() 2007-06-14 05:19:46 +00:00