Commit Graph

3826 Commits

Author SHA1 Message Date
Julian Calaby
42c5de6e44 libFLAC/cpu.c: Inline *_disable_avx()
Also only print out OS AVX status if AVX is actually enabled.
2016-06-28 18:08:12 +10:00
Julian Calaby
eae338e0e6 libFLAC/cpu.c: Move cpu_id_ex into cpu_info_x86()
This simplifies the C code without complexifying the preprocessor
code.
2016-06-28 18:08:12 +10:00
Julian Calaby
79ca23ece3 libFLAC/cpu.c: Eliminate a branch in cpu_info_x86
Inverting all the if statements allows us to move the common code of
setting all the registers to zero outside the #if statement.
2016-06-28 18:08:12 +10:00
Julian Calaby
e58a6e7549 libFLAC/cpu.c: Remove a layer of cpp conditionals 2016-06-28 18:08:12 +10:00
Julian Calaby
7394ad85b8 libFLAC/cpu.c: Drop some unnecessary returns 2016-06-28 18:08:12 +10:00
Julian Calaby
078c631d73 libFLAC/cpu.c: Get rid of OS_IS_ANDROID function 2016-06-28 18:08:12 +10:00
Julian Calaby
828e33b38f libFLAC/cpu.c: Move stdio.h include under DEBUG 2016-06-28 18:08:12 +10:00
Julian Calaby
601c051df4 libFLAC/cpu.c: Use a dummy function for debugging
This saves 5 if statements that would have had to have been
optimised away.
2016-06-28 18:08:12 +10:00
Erik de Castro Lopo
85c902fbbc libFLAC/cpu.c: More MSVC fixes
With help from lvqcl <lvqcl.mail@gmail.com>
2016-06-27 05:46:21 +10:00
Erik de Castro Lopo
a08e90c425 libFLAC/cpu.c: Fixes for MSVC
MSVC is strange and perverse.
2016-06-26 21:58:54 +10:00
Erik de Castro Lopo
162a44923c libFLAC/cpu.c: Fix build on non-Intel CPUs 2016-06-26 17:28:27 +10:00
Erik de Castro Lopo
7a8f3591d6 libFLAC/cpu.c: More cleanup and refactoring
* Split `FLAC__cpu_info` into CPU specific functions. We now have
  `ia32_cpi_info` and `x86_64_cpu_info` and a simple obvious way
  to add support for other CPUs.
* Improve handling of Android OS.
* Remove more #ifdefs where possible.
* Compile (syntax and type check) DEBUG output code even when debugging
  is disabled.
* Remove build support for ancient NetBSD version 1.5 (version 1.6 was
  released in 2002).
2016-06-26 17:05:36 +10:00
Erik de Castro Lopo
936e968c3a libFLAC/cpu.[ch]: More pre-processor cleanups 2016-06-26 12:14:02 +10:00
Erik de Castro Lopo
fa24613ad9 libFLAC/cpu.c: More refactoring and cleanups
* Make `FLAC__cpu_xgetbv_x86` private to cpu.c (and rename it to
  `cpu_xgetbv_x86` (it wasn't being used anywhere else).
* Remove `FLAC__cpu_have_cpuid_x86` altogether as it wasn't actually
  being used but that was difficult to tell because of all the #ifdef
  nonsense.
2016-06-26 10:43:29 +10:00
Erik de Castro Lopo
23778a3a60 libFLAC/cpu.c: More pre-processor cleanups 2016-06-25 17:02:06 +10:00
Erik de Castro Lopo
36a0ab100d Fix use of FLAC__HAS_X86INTRIN configure variable 2016-06-20 20:42:44 +10:00
Erik de Castro Lopo
e120037f3c Fix use of FLAC__SSE_OS configure variable 2016-06-20 20:42:44 +10:00
Erik de Castro Lopo
e58b36c8ea Fix nasm compile on OS X / Darwin
Apparently this had been fixes in Audacity and other projects
but no one had bothered to feed them back upstream. Thanks to
lvqcl for researching this and finding the relevant patches.
Thanks to Ozkan Sezer for validating them.

Closes:  https://sourceforge.net/p/flac/bugs/438/
2016-06-14 06:31:25 +10:00
Erik de Castro Lopo
fdc1ccf2bd libFLAC: More metadata_iterators fixes
The previous fixes for metadata_iterators didn't completely fix the problem.

The behavior of chain_prepare_for_write_() must always be the same as the
behavior of FLAC__metadata_chain_check_if_tempfile_needed(). Before this
fix, one check was missing in FLAC__metadata_chain_check_if_tempfile_needed(),
and also chain_prepare_for_write_() checked the sizes of the metadata blocks
*after* making the changes to the chain, while
FLAC__metadata_chain_check_if_tempfile_needed() does it *before* the changes.

This patch changes FLAC__metadata_chain_check_if_tempfile_needed() so that it
keeps some info (lbs_state, lbs_size) about estimated changes and then uses
it to check the block sizes.

It also simplifies FLAC__metadata_chain_check_if_tempfile_needed() a little.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-22 11:06:32 +10:00
Erik de Castro Lopo
0b9bcebd78 test/Makefile.lite: Remove call to old script 2016-05-13 06:50:49 +10:00
Erik de Castro Lopo
089caeae8e Makefile.lite: Improved solution to CFLAGS from environment 2016-05-13 06:50:18 +10:00
Erik de Castro Lopo
2a47450d05 Makefile.lite: Pick up CFLAGS from the environment
This allows extra CFLAGS to be set on the command line. Eg

     CFLAGS=Werror make -f Makefile.lite
2016-05-12 19:22:56 +10:00
Tim Blechmann
912bff442e libFLAC: infer cpu type from compiler macros
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2016-05-12 08:06:26 +10:00
Erik de Castro Lopo
bbf1e3eaef test_libFLAC++: Fix memory leaks
Memory leaks found using `cppcheck`.
2016-05-08 17:29:00 +10:00
Erik de Castro Lopo
94a61241b0 libFLAC: Add a workaround for a bug in MSVC2105 update2
MSVC2105 update2 compiles the C code:

    abs_residual_partition_sums[partition] =
                  (FLAC__uint32)_mm_cvtsi128_si32(mm_sum);

into this:

    movq    QWORD PTR [rsi], xmm2

while it should be:

    movd    eax, xmm2
    mov     QWORD PTR [rsi], rax

With this patch, MSVC emits:

    movq    QWORD PTR [rsi], xmm2
    mov     DWORD PTR [rsi+4], r9d

so the price of this workaround is 1 extra write instruction per
partition.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-05 17:23:52 +10:00
Erik de Castro Lopo
387992bd64 metadata_iterators.c: Limit padding size
Without this fix, its possible for libFLAC to create an oversized
padding metadata block when:

a) it merges existing padding blocks

or
b) it expands padding block during metadata changes

resulting in a corrupt FLAC file.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-01 20:57:18 +10:00
Erik de Castro Lopo
94ff346ad0 Windows/MSVC: Add ENABLE_64_BIT_WORDS macro
Allow setting of ENABLE_64_BIT_WORDS preprocessor variable for
libFLAC_dynamic, libFLAC_static and test_libFLAC projects and x64
platform.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-01 20:55:15 +10:00
Erik de Castro Lopo
f3a16f85cf bitwrite.c: Tweaks
* Removes unused FLAC__WORD_ALL_ONES definition.
* Add comment that unused bits of accumulator can contain garbage.
* Turn assert inside FLAC__bitwriter_write_utf8_uint32 into runtime
  check (similar to FLAC__bitwriter_write_utf8_uint64() function).

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-01 20:40:28 +10:00
Erik de Castro Lopo
94386fdea5 libFLAC: Add metadata size checks to FLAC library
This follows on from the previous patch.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-01 20:36:43 +10:00
Erik de Castro Lopo
516a7ad4d9 flac/metaflac: Limit the size of metadata blocks
Limit allow image file size to slightly less than 2^24 bytes so that
the file size plus extra house keeping data is strictly less that
2^24 bytes in size.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-05-01 20:36:25 +10:00
Erik de Castro Lopo
cf0a6ec709 Fix 'make distcheck' target
Last commit added a new file which was not added to `EXTRA_DIST`.
2016-04-27 10:23:38 +10:00
Erik de Castro Lopo
3de7413a36 cuesheet.c: Allow quotes around ISRC field
With this change, flac now accepts cuesheets where the ISRC field is
enclosed in double quotes. Added a test for this as well.

Closes: https://sourceforge.net/p/flac/bugs/436/
2016-04-26 18:06:16 +10:00
Erik de Castro Lopo
50af1bcf63 libFLAC/stream_decoder.c: Fix typo
Introduced in 1be4f9537e.
2016-03-20 20:49:31 +11:00
Erik de Castro Lopo
9548d4b953 configure.ac: Force FLAC__HAS_OGG to 0 or 1 2016-03-20 20:44:59 +11:00
Erik de Castro Lopo
1be4f9537e libFLAC: Reduce FLAC__HAS_OGG #ifdef crud 2016-03-20 19:28:41 +11:00
Erik de Castro Lopo
eae85ee766 libFLAC/stream_decoder.c: Fix compiling with integer only
Was failing to compile on IA32 with FLAC__INTEGER_ONLY_LIBRARY
defined.

Reported-by: "Joakim Landberg" <joakim.landberg@intel.com>
2016-03-20 17:49:44 +11:00
Erik de Castro Lopo
61607377ed stream_decoder.c: Set obj->num_comments before return
Make sure obj-num_comments gets set on failure conditions.

Patch-from: Robert Shih <robertshih@google.com>
2016-03-20 15:49:23 +11:00
Erik de Castro Lopo
a9f84425cf libFLAC/cpu.c: Use sigemptyset instead of __sigemptyset
The former is POSIX while the later is a GNU glibc-ism that does not
exist in (for example) the Musl C library that is used in OpenWrt.

Reported-by: <neheb@hushmail.com>
2016-03-14 11:27:34 +11:00
Erik de Castro Lopo
c4141f6132 Another Windows build fix
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-02-11 18:23:34 +11:00
Erik de Castro Lopo
1531034202 test/: Remove two redundant scripts
* test_bin.sh looks like it was a personal use script for the original
  developer Josh Coalson and referenced directories outside the actual
  repository.
* test_wrapper.sh was trivial and un-used.
2016-02-11 09:37:20 +11:00
Erik de Castro Lopo
9cf42fe5e0 Fix autotool warnings 2016-02-10 21:24:41 +11:00
Dave Yeo
50e7aea808 microbench: Add fallback to gettimeofday()
Some operating systems such as OS/2 don't have any of the CLOCK* API
functions so add gettimeofday() as a fallback.

Signed-off-by: Dave Yeo <dave.r.yeo@gmail.com>
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2016-02-09 20:30:29 +11:00
Erik de Castro Lopo
ab61102209 More Windows fixes
These fixes got lost in an earlier commit.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-02-09 17:56:55 +11:00
Erik de Castro Lopo
52522f3a71 More make distcheck fixes
* Add two missing files to repo.
* Add files to Makefile.am `EXTRA_DIST` list.
2016-02-09 14:05:50 +11:00
Erik de Castro Lopo
0bb06dc182 test_libFLAC: Fix make distcheck target 2016-02-09 07:01:29 +11:00
Thomas Zander
e5498e87ea Retire FLAC__float and FLAC__double types
Usage of internal aliases for float and double do not provide
substantial value. For integer-only libs, the macro
FLAC__INTEGER_ONLY_LIBRARY is used in the appropriate places
already.

Also, adapt copyright messages to include 2016.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/10
2016-02-09 06:50:27 +11:00
Dave Yeo
0435a231c8 Make AVX and AVX2 instructions a configure option
Handy for toolchains or operating systems that don't support AVX or AVX2
like OS/2.

Signed-off-by: Dave Yeo <dave.r.yeo@gmail.com>
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2016-02-08 22:12:37 +11:00
Erik de Castro Lopo
d40a6bc695 libFLAC: Remove win_utf8_io dependency
Path-from: lvqcl <lvqcl.mail@gmail.com>
2016-02-08 22:04:12 +11:00
Erik de Castro Lopo
a5c8e8e14d src/share/utf8/utf8.c: Windows API usage fixes
Patch-from: <lvqcl.mail@gmail.com>
2016-02-08 13:43:00 +11:00
Erik de Castro Lopo
b821ac2dad Remove src/share/utf8/Makefile.am
This file was redundant.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-02-03 10:45:38 +11:00