- 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
* 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>
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/
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>
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>
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>
- 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>
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>
- 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>
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.
Left shift if a negative integer such that the sign bit is affected is
(according to the C spec) undefined behaviour and the residual
calculations using the shift operator were hitting this.
Fortunately these same calculations using plain multiplication do not
invoke UB and according to benchmarking (on x86_64 linux) have the same
performance as the bit shift version.
In the case where seek_table->num_points is zero, seek_table->points
will be NULL and passing that to qsort() invokes undefined behaviour.
Since seek_table->num_points is zero, the only sensible thing to do
is to short circuit return 0.