diff options
author | Chris Robinson <[email protected]> | 2023-12-10 22:15:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-10 22:15:17 -0800 |
commit | bb3387b0fc5d3071a30c6d003b415dc6e77f3d62 (patch) | |
tree | 1645291391b412040ce55ae8dc34232cde5d22e0 /core/converter.cpp | |
parent | cf37d92442ccf3c7f4b979bd97282dcbe28ca64a (diff) |
Much more clang-tidy cleanup
Diffstat (limited to 'core/converter.cpp')
-rw-r--r-- | core/converter.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/core/converter.cpp b/core/converter.cpp index 5b2f3e15..fb293ee2 100644 --- a/core/converter.cpp +++ b/core/converter.cpp @@ -9,7 +9,7 @@ #include <cstddef> #include <cstdint> #include <iterator> -#include <limits.h> +#include <climits> #include "albit.h" #include "alnumeric.h" @@ -51,7 +51,7 @@ template<DevFmtType T> inline void LoadSampleArray(float *RESTRICT dst, const void *src, const size_t srcstep, const size_t samples) noexcept { - const DevFmtType_t<T> *ssrc = static_cast<const DevFmtType_t<T>*>(src); + auto *ssrc = static_cast<const DevFmtType_t<T>*>(src); for(size_t i{0u};i < samples;i++) dst[i] = LoadSample<T>(ssrc[i*srcstep]); } @@ -99,7 +99,7 @@ template<DevFmtType T> inline void StoreSampleArray(void *dst, const float *RESTRICT src, const size_t dststep, const size_t samples) noexcept { - DevFmtType_t<T> *sdst = static_cast<DevFmtType_t<T>*>(dst); + auto *sdst = static_cast<DevFmtType_t<T>*>(dst); for(size_t i{0u};i < samples;i++) sdst[i*dststep] = StoreSample<T>(src[i]); } @@ -127,7 +127,7 @@ void StoreSamples(void *dst, const float *src, const size_t dststep, const DevFm template<DevFmtType T> void Mono2Stereo(float *RESTRICT dst, const void *src, const size_t frames) noexcept { - const DevFmtType_t<T> *ssrc = static_cast<const DevFmtType_t<T>*>(src); + auto *ssrc = static_cast<const DevFmtType_t<T>*>(src); for(size_t i{0u};i < frames;i++) dst[i*2 + 1] = dst[i*2 + 0] = LoadSample<T>(ssrc[i]) * 0.707106781187f; } @@ -136,7 +136,7 @@ template<DevFmtType T> void Multi2Mono(uint chanmask, const size_t step, const float scale, float *RESTRICT dst, const void *src, const size_t frames) noexcept { - const DevFmtType_t<T> *ssrc = static_cast<const DevFmtType_t<T>*>(src); + auto *ssrc = static_cast<const DevFmtType_t<T>*>(src); std::fill_n(dst, frames, 0.0f); for(size_t c{0};chanmask;++c) { @@ -243,8 +243,8 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint break; } - float *RESTRICT SrcData{mSrcSamples}; - float *RESTRICT DstData{mDstSamples}; + float *RESTRICT SrcData{mSrcSamples.data()}; + float *RESTRICT DstData{mDstSamples.data()}; uint DataPosFrac{mFracOffset}; uint64_t DataSize64{prepcount}; DataSize64 += readable; @@ -271,13 +271,13 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint /* Load the previous samples into the source data first, then the * new samples from the input buffer. */ - std::copy_n(mChan[chan].PrevSamples, prepcount, SrcData); + std::copy_n(mChan[chan].PrevSamples.cbegin(), prepcount, SrcData); LoadSamples(SrcData + prepcount, SrcSamples, mChan.size(), mSrcType, readable); /* Store as many prep samples for next time as possible, given the * number of output samples being generated. */ - std::copy_n(SrcData+SrcDataEnd, nextprep, mChan[chan].PrevSamples); + std::copy_n(SrcData+SrcDataEnd, nextprep, mChan[chan].PrevSamples.begin()); std::fill(std::begin(mChan[chan].PrevSamples)+nextprep, std::end(mChan[chan].PrevSamples), 0.0f); @@ -338,8 +338,8 @@ uint SampleConverter::convertPlanar(const void **src, uint *srcframes, void *con break; } - float *RESTRICT SrcData{mSrcSamples}; - float *RESTRICT DstData{mDstSamples}; + float *RESTRICT SrcData{mSrcSamples.data()}; + float *RESTRICT DstData{mDstSamples.data()}; uint DataPosFrac{mFracOffset}; uint64_t DataSize64{prepcount}; DataSize64 += readable; @@ -363,13 +363,13 @@ uint SampleConverter::convertPlanar(const void **src, uint *srcframes, void *con /* Load the previous samples into the source data first, then the * new samples from the input buffer. */ - std::copy_n(mChan[chan].PrevSamples, prepcount, SrcData); + std::copy_n(mChan[chan].PrevSamples.cbegin(), prepcount, SrcData); LoadSamples(SrcData + prepcount, src[chan], 1, mSrcType, readable); /* Store as many prep samples for next time as possible, given the * number of output samples being generated. */ - std::copy_n(SrcData+SrcDataEnd, nextprep, mChan[chan].PrevSamples); + std::copy_n(SrcData+SrcDataEnd, nextprep, mChan[chan].PrevSamples.begin()); std::fill(std::begin(mChan[chan].PrevSamples)+nextprep, std::end(mChan[chan].PrevSamples), 0.0f); |