libebur128 icon indicating copy to clipboard operation
libebur128 copied to clipboard

ebur128_init_resampler unexpected oversample rates

Open evan314159 opened this issue 7 months ago • 5 comments

In ebur128_init_resampler, oversampling rates are changed at <96000 and <192000. This creates unexpected oversample rates with standard audio rates from 44.1kHz, and expected oversampling up to 176.4/192kHz.

input rate  libebur128 oversample rate  expected oversample rate
44100       176400 (4x)                 176400 (4x)
48000       192000 (4x)                 192000 (4x)
88200       352800 (4x)                 176400 (2x)
96000       192000 (2x)                 192000 (2x)
176400      352800 (2x)                 no oversample
192000      no oversample               no oversample


The oversample rates should instead change at <88200 and <176400. Original code:

static int ebur128_init_resampler(ebur128_state* st) {
  int errcode = EBUR128_SUCCESS;

  if (st->samplerate < 96000) { // should be 88200
    st->d->interp = interp_create(49, 4, st->channels);
    CHECK_ERROR(!st->d->interp, EBUR128_ERROR_NOMEM, exit)
  } else if (st->samplerate < 192000) { // should be 176400
    st->d->interp = interp_create(49, 2, st->channels);
    CHECK_ERROR(!st->d->interp, EBUR128_ERROR_NOMEM, exit)
  } else {

evan314159 avatar Jun 03 '25 23:06 evan314159