Skip to content

ebur128_init_resampler unexpected oversample rates #133

@evan314159

Description

@evan314159

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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions