Hello community,
here is the log from the commit of package libebur128 for openSUSE:Factory checked in at 2018-02-26 23:27:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libebur128 (Old)
and /work/SRC/openSUSE:Factory/.libebur128.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libebur128"
Mon Feb 26 23:27:27 2018 rev:3 rq:580339 version:1.2.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/libebur128/libebur128.changes 2018-01-10 23:38:17.931209760 +0100
+++ /work/SRC/openSUSE:Factory/.libebur128.new/libebur128.changes 2018-02-26 23:27:36.921018400 +0100
@@ -1,0 +2,9 @@
+Mon Feb 26 19:11:35 UTC 2018 - tom.mbrt@googlemail.com
+
+- Update to 1.2.4:
+ * Fix broken ebur128_loudness_global_multiple() function
+ * Add more tests
+ * Fix some minor build issues
+ * Fix uninitialized memory in ebur128_init()
+
+-------------------------------------------------------------------
Old:
----
libebur128-1.2.3.tar.gz
New:
----
libebur128-1.2.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libebur128.spec ++++++
--- /var/tmp/diff_new_pack.a2ttoJ/_old 2018-02-26 23:27:37.612993512 +0100
+++ /var/tmp/diff_new_pack.a2ttoJ/_new 2018-02-26 23:27:37.612993512 +0100
@@ -18,7 +18,7 @@
%define sover 1
Name: libebur128
-Version: 1.2.3
+Version: 1.2.4
Release: 0
Summary: A library implementing the EBU R128 loudness standard
License: MIT
++++++ libebur128-1.2.3.tar.gz -> libebur128-1.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.3/CMakeLists.txt new/libebur128-1.2.4/CMakeLists.txt
--- old/libebur128-1.2.3/CMakeLists.txt 2017-11-16 20:10:58.000000000 +0100
+++ new/libebur128-1.2.4/CMakeLists.txt 2018-01-28 15:46:10.000000000 +0100
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(libebur128 C)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
-set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
-set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
+set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
include(utils)
include(GNUInstallDirs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.3/README.md new/libebur128-1.2.4/README.md
--- old/libebur128-1.2.3/README.md 2017-11-16 20:10:58.000000000 +0100
+++ new/libebur128-1.2.4/README.md 2018-01-28 15:46:10.000000000 +0100
@@ -12,6 +12,15 @@
News
----
+v1.2.4 released:
+ * Fix broken `ebur128_loudness_global_multiple()` function. Since v1.1.0 it
+ calculated the relative threshold just from the last state given to it,
+ resulting in wrong values.
+ * More tests
+ * Fix some minor build issues
+ * Fix uninitialized memory in `ebur128_init()`, possibly resulting in wrong
+ values
+
v1.2.3 released:
* Fix uninitialized memory access during true peak scanning (bug #72)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.3/ebur128/CMakeLists.txt new/libebur128-1.2.4/ebur128/CMakeLists.txt
--- old/libebur128-1.2.3/ebur128/CMakeLists.txt 2017-11-16 20:10:58.000000000 +0100
+++ new/libebur128-1.2.4/ebur128/CMakeLists.txt 2018-01-28 15:46:10.000000000 +0100
@@ -23,12 +23,14 @@
set(EBUR128_VERSION_MAJOR 1)
-set(EBUR128_VERSION 1.2.3)
+set(EBUR128_VERSION 1.2.4)
#### static
if(BUILD_STATIC_LIBS)
add_library(ebur128_static STATIC ebur128.c)
- set_property(TARGET ebur128_static PROPERTY OUTPUT_NAME ebur128)
+ if(NOT MSVC)
+ set_property(TARGET ebur128_static PROPERTY OUTPUT_NAME ebur128)
+ endif()
endif()
if(WITH_STATIC_PIC)
@@ -47,8 +49,9 @@
SOVERSION ${EBUR128_VERSION_MAJOR}
VERSION ${EBUR128_VERSION})
-if(UNIX)
- target_link_libraries(ebur128 m)
+find_library(MATH_LIBRARY m)
+if(MATH_LIBRARY)
+ target_link_libraries(ebur128 ${MATH_LIBRARY})
endif()
set(EBUR128_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.3/ebur128/ebur128.c new/libebur128-1.2.4/ebur128/ebur128.c
--- old/libebur128-1.2.3/ebur128/ebur128.c 2017-11-16 20:10:58.000000000 +0100
+++ new/libebur128-1.2.4/ebur128/ebur128.c 2018-01-28 15:46:10.000000000 +0100
@@ -404,7 +404,7 @@
sizeof(double));
CHECK_ERROR(!st->d->audio_data, 0, free_true_peak)
for (j = 0; j < st->d->audio_data_frames * st->channels; ++j) {
- st->d->audio_data[i] = 0.0;
+ st->d->audio_data[j] = 0.0;
}
ebur128_init_filter(st);
@@ -955,8 +955,6 @@
double* relative_threshold) {
struct ebur128_dq_entry* it;
size_t i;
- *relative_threshold = 0.0;
- *above_thresh_counter = 0;
if (st->d->use_histogram) {
for (i = 0; i < 1000; ++i) {
@@ -971,11 +969,6 @@
}
}
- if (*above_thresh_counter != 0) {
- *relative_threshold /= (double) *above_thresh_counter;
- *relative_threshold *= relative_gate_factor;
- }
-
return EBUR128_SUCCESS;
}
@@ -1004,6 +997,9 @@
return EBUR128_SUCCESS;
}
+ relative_threshold /= (double)above_thresh_counter;
+ relative_threshold *= relative_gate_factor;
+
above_thresh_counter = 0;
if (relative_threshold < histogram_energy_boundaries[0]) {
start_index = 0;
@@ -1042,8 +1038,8 @@
}
int ebur128_relative_threshold(ebur128_state* st, double* out) {
- double relative_threshold;
- size_t above_thresh_counter;
+ double relative_threshold = 0.0;
+ size_t above_thresh_counter = 0;
if ((st->mode & EBUR128_MODE_I) != EBUR128_MODE_I) {
return EBUR128_ERROR_INVALID_MODE;
@@ -1056,6 +1052,9 @@
return EBUR128_SUCCESS;
}
+ relative_threshold /= (double)above_thresh_counter;
+ relative_threshold *= relative_gate_factor;
+
*out = ebur128_energy_to_loudness(relative_threshold);
return EBUR128_SUCCESS;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.3/ebur128/ebur128.h new/libebur128-1.2.4/ebur128/ebur128.h
--- old/libebur128-1.2.3/ebur128/ebur128.h 2017-11-16 20:10:58.000000000 +0100
+++ new/libebur128-1.2.4/ebur128/ebur128.h 2018-01-28 15:46:10.000000000 +0100
@@ -14,7 +14,7 @@
#define EBUR128_VERSION_MAJOR 1
#define EBUR128_VERSION_MINOR 2
-#define EBUR128_VERSION_PATCH 3
+#define EBUR128_VERSION_PATCH 4
#include /* for size_t */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.3/test/tests.c new/libebur128-1.2.4/test/tests.c
--- old/libebur128-1.2.3/test/tests.c 2017-11-16 20:10:58.000000000 +0100
+++ new/libebur128-1.2.4/test/tests.c 2018-01-28 15:46:10.000000000 +0100
@@ -7,7 +7,7 @@
#include "ebur128.h"
-double test_global_loudness(const char* filename) {
+double test_global_loudness(const char* filename, ebur128_state** out_state) {
SF_INFO file_info;
SNDFILE* file;
sf_count_t nr_frames_read;
@@ -40,8 +40,7 @@
ebur128_loudness_global(st, &gated_loudness);
- /* clean up */
- ebur128_destroy(&st);
+ *out_state = st;
free(buffer);
buffer = NULL;
@@ -144,6 +143,108 @@
return 20 * log10(max_true_peak);
}
+double test_max_momentary(const char* filename) {
+ SF_INFO file_info;
+ SNDFILE* file;
+ sf_count_t nr_frames_read;
+ sf_count_t total_frames_read;
+ ebur128_state* st = NULL;
+ double momentary;
+ double max_momentary = -HUGE_VAL;
+ double* buffer;
+
+ memset(&file_info, '\0', sizeof(file_info));
+ file = sf_open(filename, SFM_READ, &file_info);
+ if (!file) {
+ fprintf(stderr, "Could not open file %s!\n", filename);
+ return 0.0;
+ }
+ st = ebur128_init((unsigned) file_info.channels,
+ (unsigned) file_info.samplerate,
+ EBUR128_MODE_M);
+ if (file_info.channels == 5) {
+ ebur128_set_channel(st, 0, EBUR128_LEFT);
+ ebur128_set_channel(st, 1, EBUR128_RIGHT);
+ ebur128_set_channel(st, 2, EBUR128_CENTER);
+ ebur128_set_channel(st, 3, EBUR128_LEFT_SURROUND);
+ ebur128_set_channel(st, 4, EBUR128_RIGHT_SURROUND);
+ }
+ /* 10 ms buffer/ 100 Hz refresh rate as 10 Hz refresh rate fails on several tests */
+ buffer = (double*) malloc(st->samplerate / 100 * st->channels * sizeof(double));
+ while ((nr_frames_read = sf_readf_double(file, buffer,
+ (sf_count_t) st->samplerate / 100))) {
+ ebur128_add_frames_double(st, buffer, (size_t) nr_frames_read);
+ total_frames_read += nr_frames_read;
+ /* invalid results before the first 400 ms */
+ if (total_frames_read >= 4 * st->samplerate / 10) {
+ ebur128_loudness_momentary(st, &momentary);
+ if (momentary > max_momentary)
+ max_momentary = momentary;
+ }
+ }
+
+ /* clean up */
+ ebur128_destroy(&st);
+
+ free(buffer);
+ buffer = NULL;
+ if (sf_close(file)) {
+ fprintf(stderr, "Could not close input file!\n");
+ }
+ return max_momentary;
+}
+
+double test_max_shortterm(const char* filename) {
+ SF_INFO file_info;
+ SNDFILE* file;
+ sf_count_t nr_frames_read;
+ sf_count_t total_frames_read;
+ ebur128_state* st = NULL;
+ double shortterm;
+ double max_shortterm = -HUGE_VAL;
+ double* buffer;
+
+ memset(&file_info, '\0', sizeof(file_info));
+ file = sf_open(filename, SFM_READ, &file_info);
+ if (!file) {
+ fprintf(stderr, "Could not open file %s!\n", filename);
+ return 0.0;
+ }
+ st = ebur128_init((unsigned) file_info.channels,
+ (unsigned) file_info.samplerate,
+ EBUR128_MODE_S);
+ if (file_info.channels == 5) {
+ ebur128_set_channel(st, 0, EBUR128_LEFT);
+ ebur128_set_channel(st, 1, EBUR128_RIGHT);
+ ebur128_set_channel(st, 2, EBUR128_CENTER);
+ ebur128_set_channel(st, 3, EBUR128_LEFT_SURROUND);
+ ebur128_set_channel(st, 4, EBUR128_RIGHT_SURROUND);
+ }
+ /* 100 ms buffer / 10 Hz refresh rate */
+ buffer = (double*) malloc(st->samplerate / 10 * st->channels * sizeof(double));
+ while ((nr_frames_read = sf_readf_double(file, buffer,
+ (sf_count_t) st->samplerate / 10))) {
+ ebur128_add_frames_double(st, buffer, (size_t) nr_frames_read);
+ total_frames_read += nr_frames_read;
+ /* invalid results before the first 3 s */
+ if (total_frames_read >= 3 * st->samplerate) {
+ ebur128_loudness_shortterm(st, &shortterm);
+ if (shortterm > max_shortterm)
+ max_shortterm = shortterm;
+ }
+ }
+
+ /* clean up */
+ ebur128_destroy(&st);
+
+ free(buffer);
+ buffer = NULL;
+ if (sf_close(file)) {
+ fprintf(stderr, "Could not close input file!\n");
+ }
+ return max_shortterm;
+}
+
double gr[] = {-23.0,
-33.0,
-23.0,
@@ -178,13 +279,15 @@
int main() {
double result;
+ ebur128_state* states[9] = {0};
+ int i;
fprintf(stderr, "Note: the tests do not have to pass with EXACT_PASSED.\n"
"Passing these tests does not mean that the library is "
"100%% EBU R 128 compliant!\n\n");
-#define TEST_GLOBAL_LOUDNESS(filename, i) \
- result = test_global_loudness(filename); \
+#define TEST_GLOBAL_LOUDNESS(filename, i, state_array) \
+ result = test_global_loudness(filename, &state_array[i]); \
if (result == result) { \
printf("%s, %s - %s: %1.16e\n", \
(result <= gr[i] + 0.1 && result >= gr[i] - 0.1) ? "PASSED" : "FAILED", \
@@ -192,16 +295,40 @@
filename, result); \
}
- TEST_GLOBAL_LOUDNESS("seq-3341-1-16bit.wav", 0)
- TEST_GLOBAL_LOUDNESS("seq-3341-2-16bit.wav", 1)
- TEST_GLOBAL_LOUDNESS("seq-3341-3-16bit-v02.wav", 2)
- TEST_GLOBAL_LOUDNESS("seq-3341-4-16bit-v02.wav", 3)
- TEST_GLOBAL_LOUDNESS("seq-3341-5-16bit-v02.wav", 4)
- TEST_GLOBAL_LOUDNESS("seq-3341-6-5channels-16bit.wav", 5)
- TEST_GLOBAL_LOUDNESS("seq-3341-6-6channels-WAVEEX-16bit.wav", 6)
- TEST_GLOBAL_LOUDNESS("seq-3341-7_seq-3342-5-24bit.wav", 7)
- TEST_GLOBAL_LOUDNESS("seq-3341-2011-8_seq-3342-6-24bit-v02.wav", 8)
+ TEST_GLOBAL_LOUDNESS("seq-3341-1-16bit.wav", 0, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-2-16bit.wav", 1, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-3-16bit-v02.wav", 2, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-4-16bit-v02.wav", 3, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-5-16bit-v02.wav", 4, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-6-5channels-16bit.wav", 5, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-6-6channels-WAVEEX-16bit.wav", 6, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-7_seq-3342-5-24bit.wav", 7, states)
+ TEST_GLOBAL_LOUDNESS("seq-3341-2011-8_seq-3342-6-24bit-v02.wav", 8, states)
+
+ /* Move some states around, to make the bug where
+ * ebur128_loudness_global_multiple() calculated the relative threshold just
+ * from the last state easier to reproduce. Don't care for leaks, etc. */
+ states[5] = states[0];
+ states[0] = states[8];
+
+ for (i = 0; i < 6; ++i) {
+ if (states[i] == NULL) {
+ printf("FAILED, ebur128_loudness_global_multiple needs all states of seq-3341-1 until seq-3341-5 (inclusive) and seq-3341-2011-8_seq-3342-6-24bit\n");
+ goto after_multiple_test;
+ }
+ }
+
+ result = 0;
+ ebur128_loudness_global_multiple(states, 6, &result);
+ fprintf(stderr, "multiple output: %f\n", result);
+ if (result >= -23.18758 - 0.05 && result <= -23.18758 + 0.05) {
+ printf("PASSED, ebur128_loudness_global_multiple\n");
+ } else {
+ printf("FAILED, ebur128_loudness_global_multiple\n");
+ }
+after_multiple_test:
+ ;
#define TEST_LRA(filename, i) \
result = test_loudness_range(filename); \
@@ -237,5 +364,63 @@
TEST_MAX_TRUE_PEAK("seq-3341-22-24bit.wav.wav", 0.0)
TEST_MAX_TRUE_PEAK("seq-3341-23-24bit.wav.wav", 0.0)
+#define TEST_MAX_MOMENTARY(filename, expected) \
+ result = test_max_momentary(filename); \
+ if (result == result) { \
+ printf("%s - %s: %1.16e\n", \
+ (result <= expected + 0.1 && result >= expected - 0.1) ? "PASSED" : "FAILED", \
+ filename, result); \
+ }
+
+ TEST_MAX_MOMENTARY("seq-3341-13-1-24bit.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-2-24bit.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-3-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-4-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-5-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-6-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-7-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-8-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-9-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-10-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-11-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-12-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-13-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-14-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-15-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-16-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-17-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-18-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-19-24bit.wav.wav", -23.0)
+ TEST_MAX_MOMENTARY("seq-3341-13-20-24bit.wav.wav", -23.0)
+
+#define TEST_MAX_SHORTTERM(filename, expected) \
+ result = test_max_shortterm(filename); \
+ if (result == result) { \
+ printf("%s - %s: %1.16e\n", \
+ (result <= expected + 0.1 && result >= expected - 0.1) ? "PASSED" : "FAILED", \
+ filename, result); \
+ }
+
+ TEST_MAX_SHORTTERM("seq-3341-10-1-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-2-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-3-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-4-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-5-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-6-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-7-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-8-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-9-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-10-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-11-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-12-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-13-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-14-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-15-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-16-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-17-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-18-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-19-24bit.wav", -23.0)
+ TEST_MAX_SHORTTERM("seq-3341-10-20-24bit.wav", -23.0)
+
return 0;
}