commit libebur128 for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package libebur128 for openSUSE:Factory checked in at 2018-01-10 23:38:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libebur128 (Old) and /work/SRC/openSUSE:Factory/.libebur128.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libebur128" Wed Jan 10 23:38:16 2018 rev:2 rq:563285 version:1.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libebur128/libebur128.changes 2017-11-03 16:27:48.393754660 +0100 +++ /work/SRC/openSUSE:Factory/.libebur128.new/libebur128.changes 2018-01-10 23:38:17.931209760 +0100 @@ -1,0 +2,8 @@ +Wed Jan 10 11:25:28 UTC 2018 - tom.mbrt@googlemail.com + +- Update to 1.2.3: + * Fix uninitialized memory access during true peak scanning (bug #72) + * A pkg-config file was added +- remove speexdsp dependency (became redundant in 1.2.0) + +------------------------------------------------------------------- Old: ---- libebur128-1.2.2.tar.gz New: ---- libebur128-1.2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libebur128.spec ++++++ --- /var/tmp/diff_new_pack.E5Te54/_old 2018-01-10 23:38:18.459184990 +0100 +++ /var/tmp/diff_new_pack.E5Te54/_new 2018-01-10 23:38:18.459184990 +0100 @@ -18,7 +18,7 @@ %define sover 1 Name: libebur128 -Version: 1.2.2 +Version: 1.2.3 Release: 0 Summary: A library implementing the EBU R128 loudness standard License: MIT @@ -27,7 +27,6 @@ Source0: https://github.com/jiixyj/libebur128/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: cmake >= 2.8.12 BuildRequires: pkgconfig -BuildRequires: pkgconfig(speexdsp) %description This library implements the EBU R 128 standard for loudness normalisation. @@ -72,5 +71,6 @@ %files -n %{name}-devel %{_includedir}/ebur128.h %{_libdir}/%{name}.so +%{_libdir}/pkgconfig/%{name}.pc %changelog ++++++ libebur128-1.2.2.tar.gz -> libebur128-1.2.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.2/CMakeLists.txt new/libebur128-1.2.3/CMakeLists.txt --- old/libebur128-1.2.2/CMakeLists.txt 2017-02-08 18:19:13.000000000 +0100 +++ new/libebur128-1.2.3/CMakeLists.txt 2017-11-16 20:10:58.000000000 +0100 @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) project(libebur128 C) -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.2/README.md new/libebur128-1.2.3/README.md --- old/libebur128-1.2.2/README.md 2017-02-08 18:19:13.000000000 +0100 +++ new/libebur128-1.2.3/README.md 2017-11-16 20:10:58.000000000 +0100 @@ -12,7 +12,10 @@ News ---- -v1.2.1 released: +v1.2.3 released: + * Fix uninitialized memory access during true peak scanning (bug #72) + +v1.2.2 released (v1.2.1 was mistagged): * Fix a null pointer dereference when doing true peak scanning of 192kHz data v1.2.0 released: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.2/ebur128/CMakeLists.txt new/libebur128-1.2.3/ebur128/CMakeLists.txt --- old/libebur128-1.2.2/ebur128/CMakeLists.txt 2017-02-08 18:19:13.000000000 +0100 +++ new/libebur128-1.2.3/ebur128/CMakeLists.txt 2017-11-16 20:10:58.000000000 +0100 @@ -23,7 +23,7 @@ set(EBUR128_VERSION_MAJOR 1) -set(EBUR128_VERSION 1.2.2) +set(EBUR128_VERSION 1.2.3) #### static if(BUILD_STATIC_LIBS) @@ -59,3 +59,9 @@ else() install(TARGETS ebur128 DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() + +#### pkg-config +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libebur128.pc.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libebur128.pc @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libebur128.pc" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.2/ebur128/ebur128.c new/libebur128-1.2.3/ebur128/ebur128.c --- old/libebur128-1.2.2/ebur128/ebur128.c 2017-02-08 18:19:13.000000000 +0100 +++ new/libebur128-1.2.3/ebur128/ebur128.c 2017-11-16 20:10:58.000000000 +0100 @@ -25,18 +25,18 @@ #define ALMOST_ZERO 0.000001 -typedef struct { // Data structure for polyphase FIR interpolator - unsigned int factor; // Interpolation factor of the interpolator - unsigned int taps; // Taps (prefer odd to increase zero coeffs) - unsigned int channels; // Number of channels - unsigned int delay; // Size of delay buffer +typedef struct { /* Data structure for polyphase FIR interpolator */ + unsigned int factor; /* Interpolation factor of the interpolator */ + unsigned int taps; /* Taps (prefer odd to increase zero coeffs) */ + unsigned int channels; /* Number of channels */ + unsigned int delay; /* Size of delay buffer */ struct { - unsigned int count; // Number of coefficients in this subfilter - unsigned int* index; // Delay index of corresponding filter coeff - double* coeff; // List of subfilter coefficients - }* filter; // List of subfilters (one for each factor) - float** z; // List of delay buffers (one for each channel) - unsigned int zi; // Current delay buffer index + unsigned int count; /* Number of coefficients in this subfilter */ + unsigned int* index; /* Delay index of corresponding filter coeff */ + double* coeff; /* List of subfilter coefficients */ + }* filter; /* List of subfilters (one for each factor) */ + float** z; /* List of delay buffers (one for each channel) */ + unsigned int zi; /* Current delay buffer index */ } interpolator; struct ebur128_state_internal { @@ -106,32 +106,32 @@ interp->channels = channels; interp->delay = (interp->taps + interp->factor - 1) / interp->factor; - // Initialize the filter memory - // One subfilter per interpolation factor. + /* Initialize the filter memory + * One subfilter per interpolation factor. */ interp->filter = calloc(interp->factor, sizeof(*interp->filter)); for (j = 0; j < interp->factor; j++) { interp->filter[j].index = calloc(interp->delay, sizeof(unsigned int)); interp->filter[j].coeff = calloc(interp->delay, sizeof(double)); } - // One delay buffer per channel. + /* One delay buffer per channel. */ interp->z = calloc(interp->channels, sizeof(float*)); for (j = 0; j < interp->channels; j++) { interp->z[j] = calloc( interp->delay, sizeof(float) ); } - // Calculate the filter coefficients + /* Calculate the filter coefficients */ for (j = 0; j < interp->taps; j++) { - // Calculate sinc + /* Calculate sinc */ double m = (double)j - (double)(interp->taps - 1) / 2.0; double c = 1.0; if (fabs(m) > ALMOST_ZERO) { c = sin(m * M_PI / interp->factor) / (m * M_PI / interp->factor); } - // Apply Hanning window + /* Apply Hanning window */ c *= 0.5 * (1 - cos(2 * M_PI * j / (interp->taps - 1))); - if (fabs(c) > ALMOST_ZERO) { // Ignore any zero coeffs. - // Put the coefficient into the correct subfilter + if (fabs(c) > ALMOST_ZERO) { /* Ignore any zero coeffs. */ + /* Put the coefficient into the correct subfilter */ unsigned int f = j % interp->factor; unsigned int t = interp->filter[f].count++; interp->filter[f].coeff[t] = c; @@ -143,7 +143,9 @@ static void interp_destroy(interpolator* interp) { unsigned int j = 0; - if (!interp) return; + if (!interp) { + return; + } for (j = 0; j < interp->factor; j++) { free(interp->filter[j].index); free(interp->filter[j].coeff); @@ -156,7 +158,7 @@ free(interp); } -static void interp_process(interpolator* interp, size_t frames, float* in, float* out) { +static size_t interp_process(interpolator* interp, size_t frames, float* in, float* out) { size_t frame = 0; unsigned int chan = 0; unsigned int f = 0; @@ -165,17 +167,20 @@ float* outp = 0; double acc = 0; double c = 0; + for (frame = 0; frame < frames; frame++) { for (chan = 0; chan < interp->channels; chan++) { - // Add sample to delay buffer + /* Add sample to delay buffer */ interp->z[chan][interp->zi] = *in++; - // Apply coefficients + /* Apply coefficients */ outp = out + chan; for (f = 0; f < interp->factor; f++) { acc = 0.0; for (t = 0; t < interp->filter[f].count; t++) { int i = (int)interp->zi - (int)interp->filter[f].index[t]; - if (i < 0) i += interp->delay; + if (i < 0) { + i += interp->delay; + } c = interp->filter[f].coeff[t]; acc += interp->z[chan][i] * c; } @@ -185,8 +190,12 @@ } out += out_stride; interp->zi++; - if (interp->zi == interp->delay) interp->zi = 0; + if (interp->zi == interp->delay) { + interp->zi = 0; + } } + + return frames * interp->factor; } static void ebur128_init_filter(ebur128_state* st) { @@ -246,7 +255,9 @@ static int ebur128_init_channel_map(ebur128_state* st) { size_t i; st->d->channel_map = (int*) malloc(st->channels * sizeof(int)); - if (!st->d->channel_map) return EBUR128_ERROR_NOMEM; + if (!st->d->channel_map) { + return EBUR128_ERROR_NOMEM; + } if (st->channels == 4) { st->d->channel_map[0] = EBUR128_LEFT; st->d->channel_map[1] = EBUR128_RIGHT; @@ -341,6 +352,10 @@ unsigned int i; size_t j; + if (channels == 0 || samplerate < 5) { + return NULL; + } + st = (ebur128_state*) malloc(sizeof(ebur128_state)); CHECK_ERROR(!st, 0, exit) st->d = (struct ebur128_state_internal*) @@ -494,20 +509,20 @@ } static void ebur128_check_true_peak(ebur128_state* st, size_t frames) { - size_t c, i; - interp_process(st->d->interp, frames, + size_t c, i, frames_out; + + frames_out = interp_process(st->d->interp, frames, st->d->resampler_buffer_input, st->d->resampler_buffer_output); - for (c = 0; c < st->channels; ++c) { - for (i = 0; i < st->d->resampler_buffer_output_frames; ++i) { - if (st->d->resampler_buffer_output[i * st->channels + c] > - st->d->prev_true_peak[c]) { - st->d->prev_true_peak[c] = - st->d->resampler_buffer_output[i * st->channels + c]; - } else if (-st->d->resampler_buffer_output[i * st->channels + c] > - st->d->prev_true_peak[c]) { - st->d->prev_true_peak[c] = - -st->d->resampler_buffer_output[i * st->channels + c]; + + for (i = 0; i < frames_out; ++i) { + for (c = 0; c < st->channels; ++c) { + float val = st->d->resampler_buffer_output[i * st->channels + c]; + + if (val > st->d->prev_true_peak[c]) { + st->d->prev_true_peak[c] = val; + } else if (-val > st->d->prev_true_peak[c]) { + st->d->prev_true_peak[c] = -val; } } } @@ -534,8 +549,9 @@ #define EBUR128_FILTER(type, min_scale, max_scale) \ static void ebur128_filter_##type(ebur128_state* st, const type* src, \ size_t frames) { \ - static double scaling_factor = -((double) min_scale) > (double) max_scale ? \ - -((double) min_scale) : (double) max_scale; \ + static double scaling_factor = \ + -((double) (min_scale)) > (double) (max_scale) ? \ + -((double) (min_scale)) : (double) (max_scale); \ double* audio_data = st->d->audio_data + st->d->audio_data_index; \ size_t i, c; \ \ @@ -622,7 +638,9 @@ double sum = 0.0; double channel_sum; for (c = 0; c < st->channels; ++c) { - if (st->d->channel_map[c] == EBUR128_UNUSED) continue; + if (st->d->channel_map[c] == EBUR128_UNUSED) { + continue; + } channel_sum = 0.0; if (st->d->audio_data_index < frames_per_block * st->channels) { for (i = 0; i < st->d->audio_data_index / st->channels; ++i) { @@ -670,7 +688,9 @@ STAILQ_REMOVE_HEAD(&st->d->block_list, entries); } else { block = (struct ebur128_dq_entry*) malloc(sizeof(struct ebur128_dq_entry)); - if (!block) return EBUR128_ERROR_NOMEM; + if (!block) { + return EBUR128_ERROR_NOMEM; + } st->d->block_list_size++; } block->z = sum; @@ -703,10 +723,15 @@ int errcode = EBUR128_SUCCESS; size_t j; + if (channels == 0 || samplerate < 5) { + return EBUR128_ERROR_NOMEM; + } + if (channels == st->channels && samplerate == st->samplerate) { return EBUR128_ERROR_NO_CHANGE; } + free(st->d->audio_data); st->d->audio_data = NULL; @@ -871,8 +896,8 @@ if (st->d->short_term_frame_counter == st->d->samples_in_100ms * 30) { \ struct ebur128_dq_entry* block; \ double st_energy; \ - ebur128_energy_shortterm(st, &st_energy); \ - if (st_energy >= histogram_energy_boundaries[0]) { \ + if (ebur128_energy_shortterm(st, &st_energy) == EBUR128_SUCCESS && \ + st_energy >= histogram_energy_boundaries[0]) { \ if (st->d->use_histogram) { \ ++st->d->short_term_block_energy_histogram[ \ find_histogram_index(st_energy)];\ @@ -969,7 +994,9 @@ } for (i = 0; i < size; i++) { - if (!sts[i]) continue; + if (!sts[i]) { + continue; + } ebur128_calc_relative_threshold(sts[i], &above_thresh_counter, &relative_threshold); } if (!above_thresh_counter) { @@ -987,7 +1014,9 @@ } } for (i = 0; i < size; i++) { - if (!sts[i]) continue; + if (!sts[i]) { + continue; + } if (sts[i]->d->use_histogram) { for (j = start_index; j < 1000; ++j) { gated_loudness += sts[i]->d->block_energy_histogram[j] * @@ -1016,8 +1045,9 @@ double relative_threshold; size_t above_thresh_counter; - if (st && (st->mode & EBUR128_MODE_I) != EBUR128_MODE_I) + if ((st->mode & EBUR128_MODE_I) != EBUR128_MODE_I) { return EBUR128_ERROR_INVALID_MODE; + } ebur128_calc_relative_threshold(st, &above_thresh_counter, &relative_threshold); @@ -1137,7 +1167,9 @@ stl_size = 0; stl_power = 0.0; for (i = 0; i < size; ++i) { - if (!sts[i]) continue; + if (!sts[i]) { + continue; + } for (j = 0; j < 1000; ++j) { hist[j] += sts[i]->d->short_term_block_energy_histogram[j]; stl_size += sts[i]->d->short_term_block_energy_histogram[j]; @@ -1189,7 +1221,9 @@ } else { stl_size = 0; for (i = 0; i < size; ++i) { - if (!sts[i]) continue; + if (!sts[i]) { + continue; + } STAILQ_FOREACH(it, &sts[i]->d->short_term_block_list, entries) { ++stl_size; } @@ -1199,11 +1233,15 @@ return EBUR128_SUCCESS; } stl_vector = (double*) malloc(stl_size * sizeof(double)); - if (!stl_vector) + if (!stl_vector) { return EBUR128_ERROR_NOMEM; + } - for (j = 0, i = 0; i < size; ++i) { - if (!sts[i]) continue; + j = 0; + for (i = 0; i < size; ++i) { + if (!sts[i]) { + continue; + } STAILQ_FOREACH(it, &sts[i]->d->short_term_block_list, entries) { stl_vector[j] = it->z; ++j; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.2/ebur128/ebur128.h new/libebur128-1.2.3/ebur128/ebur128.h --- old/libebur128-1.2.2/ebur128/ebur128.h 2017-02-08 18:19:13.000000000 +0100 +++ new/libebur128-1.2.3/ebur128/ebur128.h 2017-11-16 20:10:58.000000000 +0100 @@ -14,7 +14,7 @@ #define EBUR128_VERSION_MAJOR 1 #define EBUR128_VERSION_MINOR 2 -#define EBUR128_VERSION_PATCH 2 +#define EBUR128_VERSION_PATCH 3 #include <stddef.h> /* for size_t */ @@ -24,16 +24,16 @@ */ enum channel { EBUR128_UNUSED = 0, /**< unused channel (for example LFE channel) */ - EBUR128_LEFT, - EBUR128_Mp030 = 1, /**< itu M+030 */ - EBUR128_RIGHT, - EBUR128_Mm030 = 2, /**< itu M-030 */ - EBUR128_CENTER, - EBUR128_Mp000 = 3, /**< itu M+000 */ - EBUR128_LEFT_SURROUND, - EBUR128_Mp110 = 4, /**< itu M+110 */ - EBUR128_RIGHT_SURROUND, - EBUR128_Mm110 = 5, /**< itu M-110 */ + EBUR128_LEFT = 1, + EBUR128_Mp030 = 1, /**< itu M+030 */ + EBUR128_RIGHT = 2, + EBUR128_Mm030 = 2, /**< itu M-030 */ + EBUR128_CENTER = 3, + EBUR128_Mp000 = 3, /**< itu M+000 */ + EBUR128_LEFT_SURROUND = 4, + EBUR128_Mp110 = 4, /**< itu M+110 */ + EBUR128_RIGHT_SURROUND = 5, + EBUR128_Mm110 = 5, /**< itu M-110 */ EBUR128_DUAL_MONO, /**< a channel that is counted twice */ EBUR128_MpSC, /**< itu M+SC */ EBUR128_MmSC, /**< itu M-SC */ @@ -122,7 +122,7 @@ * @param channels the number of channels. * @param samplerate the sample rate. * @param mode see the mode enum for possible values. - * @return an initialized library state. + * @return an initialized library state, or NULL on error. */ ebur128_state* ebur128_init(unsigned int channels, unsigned long samplerate, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libebur128-1.2.2/ebur128/libebur128.pc.cmake new/libebur128-1.2.3/ebur128/libebur128.pc.cmake --- old/libebur128-1.2.2/ebur128/libebur128.pc.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/libebur128-1.2.3/ebur128/libebur128.pc.cmake 2017-11-16 20:10:58.000000000 +0100 @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +includedir=${prefix}/include +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ + +Name: libebur128 +Description: EBU R 128 standard for loudness normalisation +Version: @EBUR128_VERSION@ +URL: https://github.com/jiixyj/libebur128 +Libs: -L${libdir} -lebur128 +Libs.private: -lm +Cflags: -I${includedir}
participants (1)
-
root@hilbert.suse.de