3 years agolibFLAC/cpu.c: More pre-processor cleanups
Erik de Castro Lopo [Sat, 25 Jun 2016 07:02:06 +0000 (17:02 +1000)]
libFLAC/cpu.c: More pre-processor cleanups

3 years agoFix use of FLAC__HAS_X86INTRIN configure variable
Erik de Castro Lopo [Mon, 20 Jun 2016 10:29:59 +0000 (20:29 +1000)]
Fix use of FLAC__HAS_X86INTRIN configure variable

3 years agoFix use of FLAC__SSE_OS configure variable
Erik de Castro Lopo [Sun, 19 Jun 2016 11:51:31 +0000 (21:51 +1000)]
Fix use of FLAC__SSE_OS configure variable

3 years agoFix nasm compile on OS X / Darwin
Erik de Castro Lopo [Mon, 13 Jun 2016 20:27:24 +0000 (06:27 +1000)]
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/

3 years agolibFLAC: More metadata_iterators fixes
Erik de Castro Lopo [Sun, 22 May 2016 01:06:29 +0000 (11:06 +1000)]
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>

3 years agotest/Makefile.lite: Remove call to old script
Erik de Castro Lopo [Thu, 12 May 2016 20:45:54 +0000 (06:45 +1000)]
test/Makefile.lite: Remove call to old script

3 years agoMakefile.lite: Improved solution to CFLAGS from environment
Erik de Castro Lopo [Wed, 11 May 2016 20:33:22 +0000 (06:33 +1000)]
Makefile.lite: Improved solution to CFLAGS from environment

3 years agoMakefile.lite: Pick up `CFLAGS` from the environment
Erik de Castro Lopo [Thu, 12 May 2016 08:13:22 +0000 (18:13 +1000)]
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

3 years agolibFLAC: infer cpu type from compiler macros
Tim Blechmann [Wed, 11 May 2016 12:05:49 +0000 (14:05 +0200)]
libFLAC: infer cpu type from compiler macros

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agotest_libFLAC++: Fix memory leaks
Erik de Castro Lopo [Sun, 8 May 2016 07:28:56 +0000 (17:28 +1000)]
test_libFLAC++: Fix memory leaks

Memory leaks found using `cppcheck`.

3 years agolibFLAC: Add a workaround for a bug in MSVC2105 update2
Erik de Castro Lopo [Thu, 5 May 2016 07:21:20 +0000 (17:21 +1000)]
libFLAC: Add a workaround for a bug in MSVC2105 update2

MSVC2105 update2 compiles the C code:

    abs_residual_partition_sums[partition] =

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

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agometadata_iterators.c: Limit padding size
Erik de Castro Lopo [Sun, 1 May 2016 10:57:15 +0000 (20:57 +1000)]
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

b) it expands padding block during metadata changes

resulting in a corrupt FLAC file.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoWindows/MSVC: Add ENABLE_64_BIT_WORDS macro
Erik de Castro Lopo [Sun, 1 May 2016 10:55:10 +0000 (20:55 +1000)]
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

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agobitwrite.c: Tweaks
Erik de Castro Lopo [Sun, 1 May 2016 10:40:24 +0000 (20:40 +1000)]
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>

3 years agolibFLAC: Add metadata size checks to FLAC library
Erik de Castro Lopo [Sun, 1 May 2016 10:34:26 +0000 (20:34 +1000)]
libFLAC: Add metadata size checks to FLAC library

This follows on from the previous patch.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoflac/metaflac: Limit the size of metadata blocks
Erik de Castro Lopo [Sun, 1 May 2016 10:30:37 +0000 (20:30 +1000)]
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>

3 years agoFix 'make distcheck' target
Erik de Castro Lopo [Wed, 27 Apr 2016 00:19:45 +0000 (10:19 +1000)]
Fix 'make distcheck' target

Last commit added a new file which was not added to `EXTRA_DIST`.

3 years agocuesheet.c: Allow quotes around ISRC field
Erik de Castro Lopo [Tue, 26 Apr 2016 07:55:36 +0000 (17:55 +1000)]
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/

3 years agolibFLAC/stream_decoder.c: Fix typo
Erik de Castro Lopo [Sun, 20 Mar 2016 09:42:27 +0000 (20:42 +1100)]
libFLAC/stream_decoder.c: Fix typo

Introduced in 1be4f9537e.

3 years agoconfigure.ac: Force FLAC__HAS_OGG to 0 or 1
Erik de Castro Lopo [Sun, 20 Mar 2016 09:14:01 +0000 (20:14 +1100)]
configure.ac: Force FLAC__HAS_OGG to 0 or 1

3 years agolibFLAC: Reduce FLAC__HAS_OGG #ifdef crud
Erik de Castro Lopo [Sun, 20 Mar 2016 08:28:41 +0000 (19:28 +1100)]
libFLAC: Reduce FLAC__HAS_OGG #ifdef crud

3 years agolibFLAC/stream_decoder.c: Fix compiling with integer only
Erik de Castro Lopo [Sun, 20 Mar 2016 06:49:39 +0000 (17:49 +1100)]
libFLAC/stream_decoder.c: Fix compiling with integer only

Was failing to compile on IA32 with FLAC__INTEGER_ONLY_LIBRARY

Reported-by: "Joakim Landberg" <joakim.landberg@intel.com>
3 years agostream_decoder.c: Set obj->num_comments before return
Erik de Castro Lopo [Sun, 20 Mar 2016 04:49:21 +0000 (15:49 +1100)]
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>

3 years agolibFLAC/cpu.c: Use `sigemptyset` instead of `__sigemptyset`
Erik de Castro Lopo [Mon, 14 Mar 2016 07:14:31 +0000 (18:14 +1100)]
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>
3 years agoAnother Windows build fix
Erik de Castro Lopo [Thu, 11 Feb 2016 06:52:42 +0000 (17:52 +1100)]
Another Windows build fix

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agotest/: Remove two redundant scripts
Erik de Castro Lopo [Thu, 11 Feb 2016 06:50:10 +0000 (17:50 +1100)]
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
* test_wrapper.sh was trivial and un-used.

3 years agoFix autotool warnings
Erik de Castro Lopo [Wed, 10 Feb 2016 10:24:41 +0000 (21:24 +1100)]
Fix autotool warnings

3 years agomicrobench: Add fallback to gettimeofday()
Dave Yeo [Wed, 3 Feb 2016 04:19:59 +0000 (20:19 -0800)]
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>
3 years agoMore Windows fixes
Erik de Castro Lopo [Tue, 9 Feb 2016 05:56:32 +0000 (16:56 +1100)]
More Windows fixes

These fixes got lost in an earlier commit.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoMore `make distcheck` fixes
Erik de Castro Lopo [Tue, 9 Feb 2016 05:47:30 +0000 (16:47 +1100)]
More `make distcheck` fixes

* Add two missing files to repo.
* Add files to Makefile.am `EXTRA_DIST` list.

3 years agotest_libFLAC: Fix `make distcheck` target
Erik de Castro Lopo [Mon, 8 Feb 2016 20:01:29 +0000 (07:01 +1100)]
test_libFLAC: Fix `make distcheck` target

3 years agoRetire FLAC__float and FLAC__double types
Thomas Zander [Mon, 8 Feb 2016 09:43:37 +0000 (10:43 +0100)]
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

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

3 years agoMake AVX and AVX2 instructions a configure option
Dave Yeo [Mon, 25 Jan 2016 06:09:50 +0000 (22:09 -0800)]
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>
3 years agolibFLAC: Remove win_utf8_io dependency
Erik de Castro Lopo [Fri, 5 Feb 2016 00:02:44 +0000 (11:02 +1100)]
libFLAC: Remove win_utf8_io dependency

Path-from: lvqcl <lvqcl.mail@gmail.com>

3 years agosrc/share/utf8/utf8.c: Windows API usage fixes
Erik de Castro Lopo [Thu, 4 Feb 2016 02:42:33 +0000 (13:42 +1100)]
src/share/utf8/utf8.c: Windows API usage fixes

Patch-from: <lvqcl.mail@gmail.com>

3 years agoRemove src/share/utf8/Makefile.am
Erik de Castro Lopo [Tue, 2 Feb 2016 23:41:53 +0000 (10:41 +1100)]
Remove src/share/utf8/Makefile.am

This file was redundant.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agowin_utf8_io: Fix compile error
Erik de Castro Lopo [Mon, 1 Feb 2016 22:33:12 +0000 (09:33 +1100)]
win_utf8_io: Fix compile error

The function `set_filename_utf8` was defined as static, but the
prototype was missing `static`.

3 years agotest_streams: Use fopen instead of flac_fopen
Erik de Castro Lopo [Mon, 1 Feb 2016 22:19:58 +0000 (09:19 +1100)]
test_streams: Use fopen instead of flac_fopen

test_streams doesn't create/open files with non-ascii filenames,
so there's no need in unicode support.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix debug build for VS2005
Erik de Castro Lopo [Mon, 1 Feb 2016 22:16:31 +0000 (09:16 +1100)]
Fix debug build for VS2005

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoshare/utf8: Add missing check
Erik de Castro Lopo [Sun, 31 Jan 2016 23:58:47 +0000 (10:58 +1100)]
share/utf8: Add missing check

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoRefactoring of win_utf8_io
Erik de Castro Lopo [Sun, 31 Jan 2016 01:42:23 +0000 (12:42 +1100)]
Refactoring of win_utf8_io

* Simplifies *print functions.
* Improves file related functions.
* Preparation to move all file related functions into libFLAC.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agosrc/share/Makefile.am: Fix EXTRA_DIST
Erik de Castro Lopo [Sun, 31 Jan 2016 01:35:53 +0000 (12:35 +1100)]
src/share/Makefile.am: Fix EXTRA_DIST

* Remove reference to deleted file charsetmap.h.
* Move utf8/iconvert.h from EXTRA_DIST to utf8_libutf8_la_SOURCES.

Reported-by: lvqcl <lvqcl.mail@gmail.com>
3 years agolocale_hack.h: Fix comment
Erik de Castro Lopo [Sat, 30 Jan 2016 22:55:15 +0000 (09:55 +1100)]
locale_hack.h: Fix comment

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoRemove plugin_common library from MSVC build
Erik de Castro Lopo [Sat, 30 Jan 2016 22:51:52 +0000 (09:51 +1100)]
Remove plugin_common library from MSVC build

Previously src/plugin_common library was used by FLAC's own Winamp plugin
(MSVC/Windows) and by the XMMS plugin (*nix). The Winamp plugin is long
gone from FLAC tree, so plugin_common is unused on Windows.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix dependencies for MSVC
Erik de Castro Lopo [Sat, 30 Jan 2016 22:50:06 +0000 (09:50 +1100)]
Fix dependencies for MSVC

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoRemove src/share/utf8/charsetmap.h
Erik de Castro Lopo [Sat, 30 Jan 2016 22:47:30 +0000 (09:47 +1100)]
Remove src/share/utf8/charsetmap.h

It was added in 2002 but is not used anywhere.

Reported-by: lvqcl <lvqcl.mail@gmail.com>
3 years agoWindows/MSVC utf8 build fixes
Erik de Castro Lopo [Thu, 28 Jan 2016 20:39:12 +0000 (07:39 +1100)]
Windows/MSVC utf8 build fixes

Files share/utf8/charset.c and share/utf8/iconvert.c aren't needed
under Windows. This patch removes them from MSVC build system.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agomicrobench/util.c: Fix -Wshadow warning
Erik de Castro Lopo [Tue, 26 Jan 2016 05:20:00 +0000 (16:20 +1100)]
microbench/util.c: Fix -Wshadow warning

3 years agoFix ioctl/TIOCGWINSZ for OSX
Erik de Castro Lopo [Tue, 26 Jan 2016 02:35:10 +0000 (13:35 +1100)]
Fix ioctl/TIOCGWINSZ for OSX

3 years agosrc/flac/utils.c: Fix for OpenBSD
Erik de Castro Lopo [Tue, 26 Jan 2016 01:50:44 +0000 (12:50 +1100)]
src/flac/utils.c: Fix for OpenBSD

OpenBSD defineds `TIOCGWINSZ` in `termios.h` which is already being
included, so this fix should work on most POSIX systems.

Closes: https://sourceforge.net/p/flac/bugs/435/

3 years agoautogen.sh: Improve autoconf/automake detection on OpenBSD
Erik de Castro Lopo [Tue, 26 Jan 2016 01:47:58 +0000 (12:47 +1100)]
autogen.sh: Improve autoconf/automake detection on OpenBSD

OpenBSD needs the enviroment variables `AUTOCONF_VERSION` and
`AUTOMAKE_VERSION` to be set in order to find these tools.

The script now tests (individually) if they are already set and if they
aren't sets them to something that is known to work on OpenBSD 5.8

3 years agoconfigure.ac: Drop -Wunreachable-code from CFLAGS
Erik de Castro Lopo [Tue, 26 Jan 2016 01:33:01 +0000 (12:33 +1100)]
configure.ac: Drop -Wunreachable-code from CFLAGS

According to:


this warning was removed in GCC 4.5.

3 years agoconfigure.ac: Remove redundant `XIPH_ADD_CFLAGS([-Wextra])`
Erik de Castro Lopo [Sun, 24 Jan 2016 23:12:33 +0000 (10:12 +1100)]
configure.ac: Remove redundant `XIPH_ADD_CFLAGS([-Wextra])`

3 years agodoc: specify that quantized LPC shift must be non-negative
Tristan Matthews [Sun, 24 Jan 2016 16:41:50 +0000 (11:41 -0500)]
doc: specify that quantized LPC shift must be non-negative

Refs http://sourceforge.net/p/flac/bugs/424/

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoFix linking of microbenchmark program
Erik de Castro Lopo [Sat, 23 Jan 2016 21:21:23 +0000 (08:21 +1100)]
Fix linking of microbenchmark program

On some setups, benchmark_residual linkage fails with an undefined
reference to clock_gettime(). Adding -lrt fixes that.

Patch-from: Ozkan Sezer <sezeroz@gmail.com>

3 years agolibFLAC/lpc.c: Fix comments
Erik de Castro Lopo [Sat, 23 Jan 2016 21:12:55 +0000 (08:12 +1100)]
libFLAC/lpc.c: Fix comments

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoClean up #includes
Erik de Castro Lopo [Sat, 23 Jan 2016 21:08:50 +0000 (08:08 +1100)]
Clean up #includes

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix three more cppcheck warnings
Erik de Castro Lopo [Fri, 22 Jan 2016 21:29:32 +0000 (08:29 +1100)]
Fix three more cppcheck warnings

* src/flac/vorbiscomment.c:203: Uninitialized variable: converted.
* src/flac/vorbiscomment.c:210: Uninitialized variable: converted.
* src/test_libFLAC++/decoders.cpp:507: Memory leak: decoder.

3 years agoFix some cppcheck reports
Julien Nabet [Fri, 22 Jan 2016 19:57:24 +0000 (20:57 +0100)]
Fix some cppcheck reports

* src/libFLAC/metadata_iterators.c:3247: (error) va_list `va` was opened
  but not closed with va_end().
* src/share/grabbag/snprintf.c:66: (error) va_list `va` was opened but
  not closed with va_end().
* src/utils/flactimer/main.cpp:84: (warning) Either the condition `!fout`
  is redundant or there is possible null pointer dereference.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/8

3 years agomacros.h: Make FLAC_CHECK_RETURN print to stderr
Erik de Castro Lopo [Tue, 19 Jan 2016 07:16:26 +0000 (18:16 +1100)]
macros.h: Make FLAC_CHECK_RETURN print to stderr

Also comment the fact that this macro should only be used for things
that are extremely unlikely to fail.

3 years agograbbag: Fix comment in header
Erik de Castro Lopo [Tue, 19 Jan 2016 07:08:42 +0000 (18:08 +1100)]
grabbag: Fix comment in header

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoiffscan: Fix printf format strings
Erik de Castro Lopo [Tue, 19 Jan 2016 07:07:14 +0000 (18:07 +1100)]
iffscan: Fix printf format strings

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agometadata_iterators.c: Add missing check for is_writable
Erik de Castro Lopo [Fri, 15 Jan 2016 20:57:26 +0000 (07:57 +1100)]
metadata_iterators.c: Add missing check for is_writable

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoflacdiff: Improve error msg output
Erik de Castro Lopo [Sun, 10 Jan 2016 02:04:29 +0000 (13:04 +1100)]
flacdiff: Improve error msg output

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix description of --rice-partition-order in flac -H
Thomas Zander [Sat, 9 Jan 2016 10:27:29 +0000 (11:27 +0100)]
Fix description of --rice-partition-order in flac -H

This is more of a "human language versus programmer parlor" issue.
src/flac/main.c will return usage error for an argument greater
While in programming "0..16" usually means "from zero to 15", in
natural human-to-human talk, it would rather mean "from zero to 16".
This changes the wording a bit to avoid this misunderstanding.

Closes: http://sourceforge.net/p/flac/bugs/352/
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agobitwriter: Add overflow check
Erik de Castro Lopo [Fri, 8 Jan 2016 23:59:41 +0000 (10:59 +1100)]
bitwriter: Add overflow check

The old version of `FLAC__bitwriter_write_raw_uint32()` assumes that the
unused bits of the `val` argument are equal to zero, but don't check it.

This patch adds a new version of that function which does have the check
and then calls a new function `FLAC__bitwriter_write_raw_uint32_nocheck()`
which behaves like the old one.

Code updated to use these two functions as needed.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Fix total_samples_estimate
Erik de Castro Lopo [Fri, 8 Jan 2016 23:46:41 +0000 (10:46 +1100)]
libFLAC: Fix total_samples_estimate

See the SF ticket for details.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
Closes: https://sourceforge.net/p/flac/bugs/351/

3 years agoError out when asked to store an picture that is too large
Erik de Castro Lopo [Fri, 8 Jan 2016 23:42:39 +0000 (10:42 +1100)]
Error out when asked to store an picture that is too large

Picture size must be smaller than the maximum block size.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoflac/encode.c: Limit padding size
Erik de Castro Lopo [Fri, 8 Jan 2016 23:35:23 +0000 (10:35 +1100)]
flac/encode.c: Limit padding size

This prevents a too large padding value overflowing the block length.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
Closes: https://sourceforge.net/p/flac/bugs/284/

3 years agochangelog.html: Start on 1.3.2 changelog entry
Erik de Castro Lopo [Fri, 8 Jan 2016 10:33:26 +0000 (21:33 +1100)]
changelog.html: Start on 1.3.2 changelog entry

3 years agoCleanup FLAC__bitmath_silog2()
Thomas Zander [Sun, 3 Jan 2016 18:13:52 +0000 (19:13 +0100)]
Cleanup FLAC__bitmath_silog2()

- Retire 32bit variant of silog2(), since only the _wide variant is used
- Rename FLAC__bitmath_silog2_wide() to FLAC__bitmath_silog2()
- Replace existing implementation by shorter, clearer implementation
  using optimised routines from bitmath.h
- Update Copyright string to 2016 in changed files

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/6

3 years agoconfigure.ac: Add --enable-64-bit-words option
Erik de Castro Lopo [Mon, 4 Jan 2016 00:29:03 +0000 (11:29 +1100)]
configure.ac: Add --enable-64-bit-words option

The old 32 bit words the default which can be overridded with this
configure option.

3 years agolibFLAC: Support 64bit brword/bwword
Erik de Castro Lopo [Sun, 3 Jan 2016 23:30:54 +0000 (10:30 +1100)]
libFLAC: Support 64bit brword/bwword

This patch allows FLAC__BYTES_PER_WORD to be set to 8, but is disabled by

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Tweak MSVC support
Erik de Castro Lopo [Sun, 3 Jan 2016 23:28:49 +0000 (10:28 +1100)]
libFLAC: Tweak MSVC support

Visual Studio 2013 and newer has better support for C99.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agotest_libFLAC/bitwriter.c: Unify with bitwriter.c
Erik de Castro Lopo [Wed, 30 Dec 2015 20:37:09 +0000 (07:37 +1100)]
test_libFLAC/bitwriter.c: Unify with bitwriter.c

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agobitwriter.c: Cleanups and fixups
Erik de Castro Lopo [Wed, 30 Dec 2015 20:32:35 +0000 (07:32 +1100)]
bitwriter.c: Cleanups and fixups

Assertions added, assertions simplified, unnecessary assignments
removed, mask calculations improved.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agobitmath.h: Cleanups
Erik de Castro Lopo [Tue, 29 Dec 2015 10:31:24 +0000 (21:31 +1100)]
bitmath.h: Cleanups

* Drop support from MSVC earlier than 2005.
* Make types of FLAC__clz_uint32() and FLAC__clz_soft_uint32() the same.
* Remove un-needed parens.
* Cleanup FLAC__bitmath_ilog2_wide().

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoCouple of minor tweaks
Erik de Castro Lopo [Tue, 29 Dec 2015 10:17:44 +0000 (21:17 +1100)]
Couple of minor tweaks

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agobitmath.h: Whitespace only
Erik de Castro Lopo [Thu, 24 Dec 2015 22:40:59 +0000 (09:40 +1100)]
bitmath.h: Whitespace only

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoWhitespace only
Erik de Castro Lopo [Thu, 24 Dec 2015 22:39:30 +0000 (09:39 +1100)]
Whitespace only

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoExplicitly use base class virtual methods; silence unnecessary warning
Thomas Zander [Thu, 24 Dec 2015 17:49:26 +0000 (18:49 +0100)]
Explicitly use base class virtual methods; silence unnecessary warning

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agobitwriter.c: Fix undefined behaviour
Erik de Castro Lopo [Sun, 20 Dec 2015 08:40:27 +0000 (19:40 +1100)]
bitwriter.c: Fix undefined behaviour

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agostream_encoder.c: Fix compiler warning
Erik de Castro Lopo [Sun, 13 Dec 2015 00:33:52 +0000 (11:33 +1100)]
stream_encoder.c: Fix compiler warning

Remove incorrect assignment to `encoder->protected_->state`.

3 years agoWin32: Only use large buffers when writing to disk
Erik de Castro Lopo [Fri, 11 Dec 2015 21:23:22 +0000 (08:23 +1100)]
Win32: Only use large buffers when writing to disk

Windows can suffer quite badly from disk fragmentations. To avoid
this, on Windows, the FILE* buffer size was set to 10Meg. However,
this huge buffer is undesireable when writing to a eg a pipe.

This patch updates the behaviour to only use the huge buffer when
writing to disk.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
Closes: https://sourceforge.net/p/flac/feature-requests/114/

3 years agoRemove (defined _MSC_VER) from cpp workaround
Erik de Castro Lopo [Wed, 9 Dec 2015 19:12:08 +0000 (06:12 +1100)]
Remove (defined _MSC_VER) from cpp workaround

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/stream_encoder.c: Fix overflow in total_error_*
Erik de Castro Lopo [Tue, 24 Nov 2015 18:42:40 +0000 (05:42 +1100)]
libFLAC/stream_encoder.c: Fix overflow in total_error_*

lvqvl found that 32-bit total_error_* variables can overflow when the
right encoding parameters are used. This patch disables them.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/stream_encoder_intrin_*.c: More refactoring II
Erik de Castro Lopo [Thu, 19 Nov 2015 07:32:31 +0000 (18:32 +1100)]
libFLAC/stream_encoder_intrin_*.c: More refactoring II

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/stream_encoder_intrin_*.c: More refactoring
Erik de Castro Lopo [Wed, 18 Nov 2015 08:24:44 +0000 (19:24 +1100)]
libFLAC/stream_encoder_intrin_*.c: More refactoring

Combine two intrinsic instructions into one line of code.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/stream_encoder_intrin_*.c: Refactor abs calculation
Erik de Castro Lopo [Wed, 18 Nov 2015 08:23:02 +0000 (19:23 +1100)]
libFLAC/stream_encoder_intrin_*.c: Refactor abs calculation

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/cpu.c: Whitespace
Erik de Castro Lopo [Wed, 18 Nov 2015 07:59:26 +0000 (18:59 +1100)]
libFLAC/cpu.c: Whitespace

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Fix link error
Erik de Castro Lopo [Fri, 6 Nov 2015 20:06:23 +0000 (07:06 +1100)]
libFLAC: Fix link error

The function FLAC__cpu_xgetbv_x86() is declared and defined only
if FLAC__HAS_X86INTRIN is defined. However FLAC__cpu_info() was
calling it even if FLAC__HAS_X86INTRIN was undefined,

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Refactoring
Erik de Castro Lopo [Tue, 3 Nov 2015 07:08:49 +0000 (18:08 +1100)]
libFLAC: Refactoring

No functional changes.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoInclude proper headers for sysctlbyname() on Mac OS
Thomas Zander [Thu, 29 Oct 2015 13:32:03 +0000 (14:32 +0100)]
Include proper headers for sysctlbyname() on Mac OS

According to Xcode documentation[1], sysctlbyname is available on
Mac OS via the same includes as on FreeBSD/DragonFly.

[1] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/sysctlbyname.3.html

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoMakefile.lite: Include config.mk from top level build dir
Thomas Zander [Thu, 29 Oct 2015 13:22:12 +0000 (14:22 +0100)]
Makefile.lite: Include config.mk from top level build dir

Makefile.lite in libs/executables subdirs must include
top level's config.mk to allow variables defined there (OS, PROC)
to be used; otherwise e.g. EXPLICIT_LIBS is not set and link
fails on Darwin.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoMake.lite: Proper detection Darwin/x86_64
Thomas Zander [Thu, 29 Oct 2015 13:18:56 +0000 (14:18 +0100)]
Make.lite: Proper detection Darwin/x86_64

- Use uname -m for Darwin/i386 platform
  (uname -p returns i386 on Mac OS)
- Darwin does have sys/param.h; allow correct flac_min/flac_max macro

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoFix manpage: synonyms for encoding options -0 .. -8 now match the code
Thomas Zander [Sun, 25 Oct 2015 12:31:23 +0000 (13:31 +0100)]
Fix manpage: synonyms for encoding options -0 .. -8 now match the code

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agostream_encoder.c: Fix subframe_bps comparison
lvqcl [Sun, 11 Oct 2015 21:59:08 +0000 (00:59 +0300)]
stream_encoder.c: Fix subframe_bps comparison

libFLAC limits the value of qlp_coeff_precision to make sure that
32-bit math is enough for decoding of 16-bit audio.

subframe_bps can be equal to 17 for 16-bit input (for side channel)
so the value of subframe_bps should be compared with 17, not 16.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agolibFLAC/cpu.c: Fix un-initialized variable
Erik de Castro Lopo [Tue, 13 Oct 2015 09:20:29 +0000 (20:20 +1100)]
libFLAC/cpu.c: Fix un-initialized variable

Suggested-by: lvqcl <lvqcl.mail@gmail.com>
3 years agoLet Makefile.lite build succeed on FreeBSD amd64
Thomas Zander [Sun, 11 Oct 2015 15:56:13 +0000 (17:56 +0200)]
Let Makefile.lite build succeed on FreeBSD amd64

- build/config.mk: some OS call x86_64 amd64
- build/config.mk: FreeBSD needs -DHAVE_SYS_PARAM_H in CFLAGS
- build/exe.mk and lib.mk: default compilers on FreeBSD are cc/c++
- src/libFLAC++/Makefile.lite: $(OS) is not defined
- src/libFLAC++/Makefile.lite: Link -lstdc++ on FreeBSD

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoflac: Error out if decoding RAW with bits != (8|16|24)
Erik de Castro Lopo [Sat, 3 Oct 2015 23:52:23 +0000 (10:52 +1100)]
flac: Error out if decoding RAW with bits != (8|16|24)

Suggested by Christopher Key.

Closes: https://sourceforge.net/p/flac/patches/43/