Commit Graph

3595 Commits

Author SHA1 Message Date
Erik de Castro Lopo
d9f73a8ce6 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>
2016-01-09 10:42:42 +11:00
Erik de Castro Lopo
27e00c8be0 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/
2016-01-09 10:38:48 +11:00
Erik de Castro Lopo
1a5ba624a2 changelog.html: Start on 1.3.2 changelog entry 2016-01-08 21:39:02 +11:00
Thomas Zander
93c3a3897e 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
2016-01-04 13:22:34 +11:00
Erik de Castro Lopo
a3224c0434 configure.ac: Add --enable-64-bit-words option
The old 32 bit words the default which can be overridded with this
configure option.
2016-01-04 11:47:21 +11:00
Erik de Castro Lopo
6cc1cbad2c libFLAC: Support 64bit brword/bwword
This patch allows FLAC__BYTES_PER_WORD to be set to 8, but is disabled by
default.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-01-04 10:31:35 +11:00
Erik de Castro Lopo
0a0e5363ad libFLAC: Tweak MSVC support
Visual Studio 2013 and newer has better support for C99.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2016-01-04 10:31:18 +11:00
Erik de Castro Lopo
ee06cabba5 test_libFLAC/bitwriter.c: Unify with bitwriter.c
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-31 07:37:17 +11:00
Erik de Castro Lopo
396999341a bitwriter.c: Cleanups and fixups
Assertions added, assertions simplified, unnecessary assignments
removed, mask calculations improved.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-31 07:32:39 +11:00
Erik de Castro Lopo
cf7f1b5a02 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>
2015-12-30 05:10:58 +11:00
Erik de Castro Lopo
46d3a4c6f1 Couple of minor tweaks
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-30 05:10:58 +11:00
Erik de Castro Lopo
a758365007 bitmath.h: Whitespace only
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-25 09:41:02 +11:00
Erik de Castro Lopo
e4399a02ae Whitespace only
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-25 09:39:34 +11:00
Thomas Zander
7189069e5e Explicitly use base class virtual methods; silence unnecessary warning
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2015-12-25 07:32:17 +11:00
Erik de Castro Lopo
02a9262e30 bitwriter.c: Fix undefined behaviour
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-20 19:40:40 +11:00
Erik de Castro Lopo
55910e61ac stream_encoder.c: Fix compiler warning
Remove incorrect assignment to `encoder->protected_->state`.
2015-12-13 11:33:55 +11:00
Erik de Castro Lopo
f0ee453c23 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/
2015-12-12 08:30:29 +11:00
Erik de Castro Lopo
a51b27c0ed Remove (defined _MSC_VER) from cpp workaround
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-12-10 06:12:19 +11:00
Erik de Castro Lopo
eb2af522a1 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>
2015-11-25 05:42:43 +11:00
Erik de Castro Lopo
3fdb87b935 libFLAC/stream_encoder_intrin_*.c: More refactoring II
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-11-19 18:32:35 +11:00
Erik de Castro Lopo
2319a688ec libFLAC/stream_encoder_intrin_*.c: More refactoring
Combine two intrinsic instructions into one line of code.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-11-18 19:24:48 +11:00
Erik de Castro Lopo
3c56688aa2 libFLAC/stream_encoder_intrin_*.c: Refactor abs calculation
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-11-18 19:23:05 +11:00
Erik de Castro Lopo
6ec64d3c26 libFLAC/cpu.c: Whitespace
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-11-18 18:59:30 +11:00
Erik de Castro Lopo
826b64f37d 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>
2015-11-07 07:06:26 +11:00
Erik de Castro Lopo
86b36d92d5 libFLAC: Refactoring
No functional changes.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-11-03 18:08:56 +11:00
Thomas Zander
239843e5c1 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>
2015-10-30 20:21:26 +11:00
Thomas Zander
c05b7babed 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>
2015-10-30 20:21:26 +11:00
Thomas Zander
c9128ad6a1 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
  expansion

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2015-10-30 20:21:26 +11:00
Thomas Zander
20d721e66b Fix manpage: synonyms for encoding options -0 .. -8 now match the code
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2015-10-26 07:41:13 +11:00
lvqcl
165d7b1d07 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>
2015-10-14 06:34:24 +11:00
Erik de Castro Lopo
8d43282a90 libFLAC/cpu.c: Fix un-initialized variable
Suggested-by: lvqcl <lvqcl.mail@gmail.com>
2015-10-13 20:20:33 +11:00
Thomas Zander
d20a79a8bd 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>
2015-10-12 08:15:18 +11:00
Erik de Castro Lopo
c671e1c91a flac: Error out if decoding RAW with bits != (8|16|24)
Suggested by Christopher Key.

Closes: https://sourceforge.net/p/flac/patches/43/
2015-10-04 10:52:27 +11:00
Erik de Castro Lopo
efaab3c822 test/ : Use more portable echo constructs
Fix suggested by Daniel Macks.

Closes: https://sourceforge.net/p/flac/bugs/433/
2015-10-04 09:43:38 +11:00
Tristan Matthews
33a73fcba2 microbench: remove duplicate define
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2015-09-30 18:59:05 +10:00
Tristan Matthews
ab300d4b18 microbench: add benchmarking code for Darwin
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2015-09-30 18:58:39 +10:00
Erik de Castro Lopo
d91eb4ae75 libFLAC: Fix an out-of-bounds heap read
When doing a flac to flac conversion, bad data read from the input file
was making it all the way through the encoder to cause a read past the
end of the buffer in the CRC calculation.

Fix had two parts:

* bitwriter.c: Make a debug only assert (assert bits < 32) into a proper
  failure.
* stream_encoder.c: Catch the error condition of wasted bits being greater
  that bits_pers_sample and limit it to the bits_per_sample value.

Found using the American Fuzzy Lop fuzzer.
2015-09-28 09:18:27 +10:00
Erik de Castro Lopo
5fab59f8bc src/flac/encode.c: Fix undefined behaviour
Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-09-07 15:55:32 +10:00
Erik de Castro Lopo
084bb72f78 test_flac.sh: Test unsigned as well as signed 2015-09-07 15:21:47 +10:00
Erik de Castro Lopo
a9434ddff1 src/test_streams: Generate signed and unsigned RAW files 2015-09-07 15:20:10 +10:00
Erik de Castro Lopo
bb6f643fdc test_streams.sh: Improve error message 2015-09-07 14:49:55 +10:00
Erik de Castro Lopo
9be32a538f flac/decode.c: Fix undefined behaviour 2015-09-04 00:22:48 +10:00
Erik de Castro Lopo
4591b3f2fb test_seeking: Fix undefined behaviour 2015-09-03 14:52:55 +10:00
Erik de Castro Lopo
451efca294 microbench/util.c: Win32 support 2015-09-02 16:34:22 +10:00
Erik de Castro Lopo
98cab352a0 microbench/Makefile.am: Fix 'make distcheck' 2015-09-02 16:33:54 +10:00
Erik de Castro Lopo
95fc3bf314 Add first micro-benchmark 2015-09-01 04:14:17 +10:00
Erik de Castro Lopo
e48ca8d4d7 libFLAC++/metadata.cpp: Fix undefined behaviour 2015-09-01 00:46:42 +10:00
Erik de Castro Lopo
e5ef534497 MSVC: Fix libFLAC_static.vcxproj dependencies
libFLAC_static.vcxproj was missing a dependency on win_utf8_io_static.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
2015-09-01 00:31:51 +10:00
Erik de Castro Lopo
0bea5fb964 flac/encode.c: Fix undefinoed behaviour 2015-08-31 00:22:16 +10:00
Erik de Castro Lopo
3982865e97 libFLAC/bitwriter.c: Fix undefined behaviour 2015-08-31 00:22:12 +10:00