Commit Graph

2488 Commits

Author SHA1 Message Date
Anton Blanchard
8e1796b91a Add runtime detection of POWER8 and POWER9
Use getauxval() to determine if we are on POWER8 or POWER9 or newer.
POWER8 is represented by version 2.07 and POWER9 by version 3.00.

Signed-off-by: Anton Blanchard <anton@ozlabs.org>
2018-08-20 18:16:34 +10:00
lvqcl
9fa2b5edba move CreateFile function outside of libFLAC 2018-08-19 15:12:26 +10:00
Erik de Castro Lopo
a8e9857e38 windows_unicode_filenames.c: Fix a missing return statement 2018-08-18 09:44:24 +10:00
evpobr
6892e7c8a2 Improve SIMD detection with Visual Studio
Visual Studio can use GCC (for Android) and Clang (supported toolset) so they must be checked before native compiler.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-06-13 06:21:54 +10:00
orbea
5dff53c0cc Fix --output-prefix with input-files in sub-directories
And make sure to reserve the whole file path when not using --output-prefix.

Fixes https://sourceforge.net/p/flac/bugs/463/
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-06-11 09:57:09 +10:00
luz.paz
01eb19708c Fix miscellaneous typos.
Found via `codespell -q 3`
2018-05-24 07:20:19 +10:00
Robert Kausch
c2673dafb1 Add unit tests for word-wise CRC16 functions
Update FLAC__BitReader structure in unit test.
2018-05-21 10:19:28 +10:00
Robert Kausch
65c2796402 Fix CRC calculation for small blocks. 2018-05-21 10:19:03 +10:00
Robert Kausch
8874ecc082 Update CRC16 for larger data blocks when decoding. 2018-05-21 10:19:03 +10:00
Robert Kausch
5579f2922f Implement slicing-by-8 CRC16 algorithm. 2018-05-21 10:19:03 +10:00
Robert Kausch
1aff2348cd Add bitreader unit test. 2018-05-20 10:29:48 +10:00
Robert Kausch
f01a3aa77a Minor fixes for bitwriter unit test. 2018-05-20 10:29:48 +10:00
Robert Kausch
096a63d36a Add unit tests for CRC calculation. 2018-05-20 10:29:48 +10:00
Robert Kausch
fcec829b2e Remove unused CRC8 functions. 2018-05-20 10:29:48 +10:00
Erik de Castro Lopo
85fca3c9ec Fix more GCC warnings about case fall-through
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2018-05-06 15:40:07 +10:00
Erik de Castro Lopo
aaaaa0deb9 More generic version of MSVC bug workaround
This is an updtate to the fix for an MSVC 2015 bug in 94a61241b0.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2018-05-06 15:25:14 +10:00
Jeffrey Espiritu
98deaf1d46 replaygain_synthesis.c: Fix compile issue in MSVS
The `inline` keyword is only available in C++ so include `share/compat.h`.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-04-09 07:42:12 +10:00
Erik de Castro Lopo
45f7d41a8a Fix for missing WINAPI_FAMILY_PARTITION
This is macro identifier is not defined, define it to `0`.
2018-02-10 13:37:55 +11:00
Christophe DUMONT
a0027fadfa libFLAC : new function returns client_data from decoder
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-01-08 19:23:20 +11:00
Alberto Fustinoni
972454edf8 UWP build fix
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-01-06 17:49:14 +11:00
Erik de Castro Lopo
20a2100d7d replaygain_synthesis.c: Fix a cppcheck warning
Cppcheck was incorrectly warning that `doubletmp` was being used
un-initialized. This was due to the fact that it was being used
and initialized in a pre-processor macro. Chaning the macro to
an inline function stops cppcheck from raising a warning.
2017-07-21 07:10:13 +10:00
Erik de Castro Lopo
f7cd466c24 Revert "Add Clang support for FLAC__SSE_TARGET"
This reverts commit b52fa0ec6d.

See: b52fa0ec6d
2017-07-19 19:41:24 +10:00
C.W. Betts
b52fa0ec6d Add Clang support for FLAC__SSE_TARGET
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-07-15 08:41:24 +10:00
Thomas Zander
68c5886db9 Correct flattop window coefficients
The window amplitude is now  normalised to 1.0.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-07-01 15:43:46 +10:00
Erik de Castro Lopo
1b5c09e4c6 Fix GCC 7 case fall through warnings
GCC 7 warns about `case` statements which are not separated by a
`break` statement. This warning can be fixed by adding a comment.
2017-06-26 19:22:31 +10:00
Shark64
ed84746dca Update lpc_intrin_sse.c
Remove redundant assignment before broadcasting into xmm registers.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-06-26 18:32:40 +10:00
Erik de Castro Lopo
bb75073428 flac: Use WAVEFORMATEXTENSIBLE when bps != (8|16)
When decoding to WAV, the legacy wFormatTag of WAVE_FORMAT_PCM should
only be used if the bitwidth is 8 or 16. For all other bitwidths,
use WAVEFORMATEXTENSIBLE.

Two of the test programs/scripts also needed updating.
2017-05-27 17:22:19 +10:00
Erik de Castro Lopo
b762a20ace Fix missing SIZE_MAX definition on Android 2017-05-03 18:37:12 +10:00
Erik de Castro Lopo
64f47c2d71 libFLAC: Fix default flac_max/min
There were a number of specialized versions, but the default case
defined `MAX` and `MIN` instead of `flac_max` and `flac_min`.
2017-04-19 18:14:39 +10:00
Erik de Castro Lopo
59bedcf228 flac: Fix usage message
Patch-from: "Michael W. Bombardieri" <mb@ii.net>
2017-04-17 07:31:13 +10:00
Erik de Castro Lopo
952c93b2d7 metaflac: Fix a memory leak 2017-04-09 15:17:06 +10:00
Erik de Castro Lopo
4f47b63e9c stream_decoder.c: Fix a memory leak
Leak reported by Secunia Research.
2017-04-08 19:15:37 +10:00
Erik de Castro Lopo
f7f2164725 cpu.c: Fix LLVM compile
Switch from `asm` to `__asm__` which is better supported.

Patch-from: Olivier Tristan <o.tristan@uvi.net>
2017-03-02 06:40:28 +11:00
Erik de Castro Lopo
61e7dfa8bb cpu.c: Merge ia32 and x86_64 CPU info functions
After the removal of the OS SSE detection stuff ia32_cpu_info()
and x86_64_cpu_info() became very similar. Merging them makes
sense.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-02-27 20:41:25 +11:00
Erik de Castro Lopo
172146bd8a cpu.c: Fix debug Windows w32 build issue
Was failing to build without NASM.

Patch-from: Olivier Tristan <o.tristan@uvi.net>
2017-02-23 18:58:53 +11:00
Erik de Castro Lopo
f80652a8fa stream_decoder.c: Comments
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-02-22 06:17:16 +11:00
Erik de Castro Lopo
5ae578ff0e SIMD: remove outdated SSE2 code
Removes FLAC__lpc_restore_signal_16_intrin_sse2() which was faster
than than C code, but not faster than MMX-accelerated ASM functions.
It's also slower than the new SSE4.1 functions that were added by
the previous patch.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-02-21 20:27:07 +11:00
Erik de Castro Lopo
ec795695ff SIMD: Accelerate decoding of 16 bit FLAC
This patch removes FLAC__lpc_restore_signal_16_intrin_sse2().

It's faster than C code, but not faster than MMX-accelerated
ASM functions. It's also slower than the new SSE4.1 functions
that were added by the previous patch.
So this function wasn't very useful before, and now it's
even less useful. I don't see a reason to keep it.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-02-19 22:19:44 +11:00
Erik de Castro Lopo
f9f5646a6d SIMD: Improve decoding of some 24 bit files
Accelerates decoding of non-Subset 24-bit FLAC files (where lpc_order
> 12).

The improved function is FLAC__lpc_restore_signal_wide_intrin_sse41().
It requires SSE4.1 and it's used only by 32-bit libFLAC.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-02-19 19:49:59 +11:00
Erik de Castro Lopo
086b493a82 SIMD: Add const qualifier where appropriate
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-02-19 19:49:59 +11:00
Erik de Castro Lopo
25c6cbe2a7 cpu.h: Another CPP fixup
CPP is minefield. We should simplify CPP wherever possible and work
to minimise nesting.
2017-02-19 06:33:35 +11:00
Erik de Castro Lopo
c4bdd6fd7d cpu.h: Fix compiler detection
GCC version 4.6 was throwing an error on `__has_attribute` which
seems to be Clang specific. Solution was to un-nest the CPP code
so that Clang is confirmed before the `__has_attribute` is hit.
2017-02-15 20:16:01 +11:00
Erik de Castro Lopo
3a7884bf53 flac/encode.c: Fix an integer overflow
When encoding a 24 bit multichannel W64 file on a 32 bit system, a
calculation could overflow resulting in a "got partial sample"
error and early termination of the encoding process.

The fix was to replace the cast to `size_t` (which is only 32 bits
on a 32 bit system) with a cast to `uin64_t`.

Thanks to Janne Hyvärinen for helping to track down the problem.

Closes: https://sourceforge.net/p/flac/bugs/453
2017-02-14 21:26:43 +11:00
Erik de Castro Lopo
67ea8badad cpu.h: Add #defines so Clang compiles AVX2
Patch-from: <lvqcl.mail@gmail.com>
2017-02-12 22:38:14 +11:00
Rosen Penev
c669249e4c Fix compile with cygwin
The underscores are wrong. The comment is also correct.

Also remove the configure.ac option. Otherwise it tries to compile the
windows unicode stuff which POSIX(cygwin) does not understand.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-02-09 20:02:18 +11:00
Erik de Castro Lopo
62a3b0910f libFLAC/lpc_intrin_sse41.c: Change usage of _mm_alignr_epi8
Replace
     a = _mm_alignr_epi8(b, a, n);
with
     a = _mm_alignr_epi8(a, b, n);

The resulting code is very slightly faster and the binaries slightly
smaller.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-01-31 20:37:50 +11:00
Erik de Castro Lopo
ee2433a367 libFLAC/lpc_intrin_sse*: Formatting cleanup
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-01-31 20:36:00 +11:00
Erik de Castro Lopo
006dcfbe23 FLAC__stream_encoder_finish: Sanity improvement
Previously this function would abort or crash if passed `NULL` for
the encoder. Now it just returns without crashing or aborting which
is far more sane behaviour (ie much like FLAC__stream_encoder_delete).
2017-01-30 21:50:51 +11:00
David Seifert
b3ece71334 Do not override CFLAGS, as CFLAGS is a user flag.
* Furthermore, use NDEBUG globally to detect the presence
  of building with more debug output information.
  AX_CHECK_ENABLE_DEBUG is easier to use, and nowadays
  Gnome has also switched to it from its own custom solution.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-19 20:47:26 +11:00
Rosen Penev
09b8224804 Fix cppcheck warnings
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-19 20:45:13 +11:00