Commit Graph

3914 Commits

Author SHA1 Message Date
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
Christian Stadelmann
841ed1aef9 stream encoder: fix documentation inconsistencies
Fixes https://sourceforge.net/p/flac/bugs/452/

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-02-13 19:42:46 +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
d2cb0d1eb2 configure.ac: Clean up CFLAGS code
Also moves _FORTIFY_SOURCE detection to an M4 macro.

Patchfrom: David Seifert <soap@gentoo.org>
2017-02-06 19:54:15 +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
Erik de Castro Lopo
33f093ae2f include/share/compat.h: Only define inline for C
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-01-24 06:20:06 +11:00
Stephen
0c741d5948 Create .travis.yml
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/28
2017-01-22 13:31:50 +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
Erik de Castro Lopo
ada48f59f5 share/utf8/charset.c: Cleanup realloc() usage
This version should be logically identical to the previous version
but prevents a false-positive from the cppcheck static analysis
tool.
2017-01-19 20:31:34 +11:00
Erik de Castro Lopo
3be455142b Add missing file include/share/msvc2005_int.h 2017-01-19 11:17:01 +11:00
Erik de Castro Lopo
1e9e707c6f stdint.h fixes for MSVS 2005/2008
This adds a new msvc2005_int.h header file which is "force included"
as needed by the MSVS project file.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-01-19 06:33:33 +11:00
Erik de Castro Lopo
89a6c52067 metadata.h: Fix search/replace typo in comments 2017-01-17 19:41:44 +11:00
Erik de Castro Lopo
78d67ff870 getopt.c: Pointer comparison fix
* Remove <stdint.h> because MSVC 2005 (and probably 2008) don't have it.
* Fix pointer difference caclulation between `nameend` and `nextchar`.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2017-01-17 19:41:31 +11:00
David Seifert
c80a819bd7 Only compile and run tests when running 'make check'
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-17 06:36:10 +11:00
Erik de Castro Lopo
64b7142a36 Final unsigned fixes
Found using the Makefile.lite build system.
2017-01-16 19:31:25 +11:00
Erik de Castro Lopo
9bb7a7e0f5 Yet more unsigned fixes 2017-01-16 18:28:31 +11:00
Erik de Castro Lopo
f60a8ccc5c bitmath.h: MSVS unsigned fix
The orignal code had `unsigned long` inside `#ifdef MSVC`. It was then changed
to `uint64_t` which was incorrect because on Windows `sizze long == 4`.
Change it now to `uint32_t` which is always correct regardless of OS, compiler
or architecture.
2017-01-15 16:28:16 +11:00
sezero
d178058028 libFLAC/cpu.c: Replace memory.h include with string.h
cpu.c was the only source to use memory.h instead of string.h.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-15 13:19:01 +11:00
David Seifert
052cd4b6e3 Honor user's $(htmldir) and do not override GNU defaults for $(docdir)
* HTML files should be installed to $(htmldir), and $(docdir) should
  not be changed, as this is a user flag in the GNU conventions.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-15 13:15:53 +11:00
David Seifert
ce6ab95db3 When using libtool, use LTLIBICONV instead.
* This is required, as otherwise -Wl,--as-needed could fail.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-15 12:38:56 +11:00
David Seifert
cc08bebaaa Make building/installing examples optional
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-15 12:34:03 +11:00
Erik de Castro Lopo
8967db0cb0 bitmath.h: More unsigned fixes 2017-01-15 12:20:52 +11:00
Erik de Castro Lopo
71b909b7a4 Yet more purging of unsigned type 2017-01-15 09:48:42 +11:00
Erik de Castro Lopo
588689b138 include/FLAC: More unsigned fixes
These fixes are in the public API, but FLAC would have been extremely
unlikely to work in any system where `unsigned` was not 32 bits.
Therefore we do not treat this as an API change.
2017-01-14 20:24:13 +11:00
sezero
733afdbe68 flac/utils.c: Workaround for DJGPP missing wcswidth()
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-14 18:33:03 +11:00
sezero
31b219f0bf Support nasm coff obj format for djgpp
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-14 18:32:49 +11:00
Erik de Castro Lopo
c6318e9dd3 Purge usage of unsigned type
As pointed out by Ozkan Sezer, on some platforms `int32_t` is actually
a typedef for `long` so `unsigned` cannot be used interchangably with
`FLAC__uint32`. Fix is to switch from `unsigned` to explicit sized ISO
C types defined in <stdint.h>.
2017-01-14 17:46:02 +11:00
Peter Korsgaard
5572155616 configure.ac: relax linux OS detection
Not all linux hosts match the *-pc-linux-gnu wildcard, causing build
failures for older glibc versions where we need to link with -lrt for
clock_gettime - E.G.:

 - arm-unknown-linux-musleabihf
 - powerpc-unknown-linux-gnuspe
 - bfin-linux-linux-uclibc
 ..

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-13 21:32:29 +11:00
Erik de Castro Lopo
6ecd1a2607 libFLAC/cpu.c: Fix build issue on OpenBSD/i386
Patch-from: Christian Weisgerber <naddy@mips.inka.de>
2017-01-13 21:31:00 +11:00
Erik de Castro Lopo
8f25d680ac stream_encoder.c: Make compression_levels_ array const
As pointed out by github user @randomascii, the `compression_levels_`
struct could and should be const.

Closes: https://github.com/xiph/flac/issues/26
2017-01-06 20:01:22 +11:00
Erik de Castro Lopo
58a81cf678 Fix build with MSVC if UNICODE is enabled
Patch-from: "lvqcl.mail" <lvqcl.mail@gmail.com>
Closes: https://sourceforge.net/p/flac/bugs/447/
2017-01-04 06:31:52 +11:00
Erik de Castro Lopo
230cffe08f libFLAC/cpu.c: Fix CPU detecton
Patch-from: Janne Hyvärinen <cse@sci.fi>
2017-01-03 04:46:24 +11:00
Erik de Castro Lopo
ac39d3719f Version 1.3.2 2017-01-01 14:54:28 +11:00
Erik de Castro Lopo
1366367d1f test/test_metaflac.sh: Comment only 2017-01-01 11:52:04 +11:00
Erik de Castro Lopo
b799a823b9 libFLAC: Remove commented out assert
Pointed out by c.helmrich@ecodis.de. It was added during debugging
in commit c06a44969, but was never meant to stay.
2016-12-24 22:05:22 +11:00
Erik de Castro Lopo
e64ac79798 Makefile.lite: Fix running of tests
* Generate `test/common.sh` from `test/common.sh.in`.
* Move `is_win` setting to `test_common.sh`.
2016-12-21 20:49:52 +11:00
Erik de Castro Lopo
23ca12850c libFLAC/cpu.c: Add CPP guard 2016-12-21 16:16:13 +11:00