Use a span to hold the cubic table reference

This commit is contained in:
Chris Robinson 2023-02-10 01:57:54 -08:00
parent 1564cfe48f
commit eb5e48f133
3 changed files with 4 additions and 3 deletions

View File

@ -273,7 +273,7 @@ ResamplerFunc PrepareResampler(Resampler resampler, uint increment, InterpState
case Resampler::Linear:
break;
case Resampler::Cubic:
state->cubic.filter = gCubicSpline.Tab;
state->cubic.filter = gCubicSpline.Tab.data();
break;
case Resampler::FastBSinc12:
case Resampler::BSinc12:

View File

@ -49,7 +49,7 @@ struct SplineFilterArray {
mTable[pi].mDeltas[3] = -mTable[pi].mCoeffs[3];
}
constexpr const CubicCoefficients *getTable() const noexcept { return mTable; }
constexpr auto getTable() const noexcept { return al::as_span(mTable); }
};
constexpr SplineFilterArray SplineFilter{};

View File

@ -1,11 +1,12 @@
#ifndef CORE_CUBIC_TABLES_H
#define CORE_CUBIC_TABLES_H
#include "alspan.h"
#include "cubic_defs.h"
struct CubicTable {
const CubicCoefficients *Tab;
al::span<const CubicCoefficients,CubicPhaseCount> Tab;
};
/* A Catmull-Rom spline. The spline passes through the center two samples,