Using exact comparison ("a == b") when comparing expected with computed
test data fails the test-suite on many architectures (including, but not
limited to armhf and arm64).
Instead, use epsilon(for now, FLT_EPSILON and DBL_EPSILON) to compare
floating point numbers for equality.
Closes: https://github.com/libsndfile/libsndfile/issues/866
Signed-off-by: IOhannes m zmölnig <zmoelnig@iem.at>
libmpg123 supports decoding MPEG Layers I, II, and III, but we only have
encode support for Layer III. Skip checks for I and II as they don't
have write support.
When two tests share a temporary filename they can cause ctest to fail
when run in parallel mode since both would attempt to operate on the
same file if scheduled to run at the same time.
To fix this, filenames in the smaller tests have been individually
renamed, and for the bigger tests a prefix has been added to make them
unique.
The complete list of conflicting filenames (which were then manually
inspected) was generated by running the following command in 'tests':
for file in $(grep -hoER \"\\w+\\.\\w+\" | sort | uniq -d)
do echo $file
grep -Rn $file
echo
done | less
Use standard `_WIN32` define instead. Any sane compiler on Windows
platfrom defines `_WIN32`.
The `wpath` parameter type has been changed to an equivalent type that
does not require the inclusion of the `windows.h` header.
* Fix warnings about incorrect format specifiers.
GCC only wants to see void pointers for %p formatters, so cast as appropriate.
* Fix a warning about an invalid enum value.
The following warning was observed when compiling with -pedantic:
warning: ISO C restricts enumerator values to range of 'int' (2147483648 is too large)
The values of these enums don't escape wav_read_header() and are only used to set bits in a bitmask, so simply use the next bit rather than jumping to a huge number.
* Give anonymous unions a name.
This fixes the 'anonymous unions are a C11 extension' warning when compiling with -pedantic.
* Use flexible array members rather than zero sized arrays.
This flagged up the following warning when compiling with -pedantic:
warning: zero size arrays are an extension [-Wzero-length-array]
* Safely return the smallest value of a short.
GCC gives the following warning when compiling with -pedantic:
warning: overflow in conversion from 'int' to 'short int' changes value from '32768' to '-32768' [-Woverflow]
This looks intentional from the surrounding code, so return -32768 in a legal way rather than depending on undefined behaviour.
* Use the same min/max approach with all compilers.
The GCC specific code gives the following warning from GCC when compiled with -pedantic:
warning: ISO C forbids braced-groups within expressions [-pedantic]
This code was also a fundamentally different way of calculating min/max since it didn't evaluate the inputs more than once, which meant there was potentially a difference in behaviour when the library was built with different compilers if the evaluation of 'a' or 'b' had side effects.
* Use the correct scale when normalising an integer read on the fallback floating point path.
Without this the values were only being scaled to a short's max value.
* Add a second pass over the floating point tests that enables the replacement read functionality.
These cover the issue fixed by the previous commit.
* Add an entry to CHANGELOG.md for #702.
Ogg: Introduce new functions ogg_sync_fseek(), ogg_ftell(), ogg_next_page(),
ogg_stream_next_page(), ogg_sync_last_page_before(), and
ogg_stream_unpack_page(). Use ogg_sync_* for ogg_read_first_page(). Bump libogg
version requirement from 1.1.3 to 1.3.0 as LibOgg 1.3.0 is required for
ogg_stream_pageout_fill() and ogg_stream_flush_fill().
Opus: Add opus support. Document added commands
SFC_(GET|SET)_ORIGINAL_SAMPLERATE. Added or extended tests ogg_opus_test,
compression_size_test, floating_point_test, lossy_comp_test, string_test,
external_libs_test. Change Opus to non-experimental.
While experimenting, determined that Vobis' analysis stops working on
non-normalized floating point input outside the range of [2000.0, -2000.0], and
seems to get worse the larger the magnitude. As the sdlcomp_test_float and
sldcomp_test_double tests work with non-normalized floats with a magnitude of
32000.0, this explains why they do not work for Vorbis.
This patch fixes the test by reducing the magnitude of the test data at encode
and restoring it at decode if it detects Vorbis, mantaining the same 32000.0
overall magnitude so the envelope values for the test are the same as they are
for other tests and format.
It is unknown at this time if the input range magnitude of 2000.0 is a
limitation of Vorbis or libvorbis.
Fix parsing of instrument fine tuning instrument field. There is still
a possible rounding error involved which might require further
investigation at some stage.
Update the test as well.
Currently, libsndfile requires in-tree bootstrapping and creation
of the tarball. For Gentoo, some users might want to build the
latest git checkout. This commit makes out-of-tree building of all
the necessary dependencies possible.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Explicitly writing the header with SFC_UPDATE_HEADER_NOW before
the first sf_write() was making sf_write() calls fail. This is a
test to verify that the fix works.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
This code had egregious errors in the way things were being passed
to psf_binheader_writef and neither the compiler nor the tests
caught it. It was however found when adding safety macros to enforce
correct type being passed to psf_binheader_writef.