mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Resampler: Revert and earlier experiment.
This commit is contained in:
+8
-8
@@ -59651,7 +59651,7 @@ static MA_INLINE ma_result ma_linear_resampler_process_pcm_frames_s16_no_lpf(ma_
|
|||||||
return MA_SUCCESS;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MA_INLINE ma_result ma_linear_resampler_process_pcm_frames_f32_no_lpf(ma_linear_resampler* pResampler, const float* pFramesInF32, ma_uint64* pFrameCountIn, float* pFramesOutF32, ma_uint64* pFrameCountOut, double invSampleRateOut)
|
static MA_INLINE ma_result ma_linear_resampler_process_pcm_frames_f32_no_lpf(ma_linear_resampler* pResampler, const float* pFramesInF32, ma_uint64* pFrameCountIn, float* pFramesOutF32, ma_uint64* pFrameCountOut, float invSampleRateOut)
|
||||||
{
|
{
|
||||||
ma_uint64 frameCountIn;
|
ma_uint64 frameCountIn;
|
||||||
ma_uint64 frameCountOut;
|
ma_uint64 frameCountOut;
|
||||||
@@ -59677,7 +59677,7 @@ static MA_INLINE ma_result ma_linear_resampler_process_pcm_frames_f32_no_lpf(ma_
|
|||||||
MA_ASSERT(pResampler->cachedFrameCount <= 1); /* There is at most one cached frame. */
|
MA_ASSERT(pResampler->cachedFrameCount <= 1); /* There is at most one cached frame. */
|
||||||
|
|
||||||
while (pResampler->cachedFrameCount > 0 && frameCountIn > 0 && framesProcessedOut < frameCountOut) {
|
while (pResampler->cachedFrameCount > 0 && frameCountIn > 0 && framesProcessedOut < frameCountOut) {
|
||||||
float a = (double)(pResampler->inTimeFrac * invSampleRateOut);
|
float a = pResampler->inTimeFrac * invSampleRateOut;
|
||||||
|
|
||||||
for (c = 0; c < channels; c += 1) {
|
for (c = 0; c < channels; c += 1) {
|
||||||
pFramesOutF32[c] = ma_mix_f32_fast(pResampler->x0.f32[c], pFramesInF32[c], a);
|
pFramesOutF32[c] = ma_mix_f32_fast(pResampler->x0.f32[c], pFramesInF32[c], a);
|
||||||
@@ -59972,7 +59972,7 @@ static MA_INLINE ma_result ma_linear_resampler_process_pcm_frames_f32_no_lpf(ma_
|
|||||||
|
|
||||||
while (framesProcessedOut < frameCountOut && pResampler->inTimeInt < frameCountIn) {
|
while (framesProcessedOut < frameCountOut && pResampler->inTimeInt < frameCountIn) {
|
||||||
if (pResampler->inTimeInt + 1 < frameCountIn) {
|
if (pResampler->inTimeInt + 1 < frameCountIn) {
|
||||||
float a = (float)(pResampler->inTimeFrac * invSampleRateOut);
|
float a = pResampler->inTimeFrac * invSampleRateOut;
|
||||||
|
|
||||||
for (c = 0; c < channels; c += 1) {
|
for (c = 0; c < channels; c += 1) {
|
||||||
pFramesOutF32[c] = ma_mix_f32_fast(pFramesInF32[((pResampler->inTimeInt + 0) * channels) + c], pFramesInF32[((pResampler->inTimeInt + 1) * channels) + c], a);
|
pFramesOutF32[c] = ma_mix_f32_fast(pFramesInF32[((pResampler->inTimeInt + 0) * channels) + c], pFramesInF32[((pResampler->inTimeInt + 1) * channels) + c], a);
|
||||||
@@ -60868,7 +60868,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_downsample(ma_linear
|
|||||||
/*printf("DOWN\n");*/
|
/*printf("DOWN\n");*/
|
||||||
|
|
||||||
while (framesProcessedOut < frameCountOut) {
|
while (framesProcessedOut < frameCountOut) {
|
||||||
float a = (float)(pResampler->inTimeFrac * invSampleRateOut);
|
float a = pResampler->inTimeFrac * invSampleRateOut;
|
||||||
|
|
||||||
/* Before interpolating we need to load the buffers. When doing this we need to ensure we run every input sample through the filter. */
|
/* Before interpolating we need to load the buffers. When doing this we need to ensure we run every input sample through the filter. */
|
||||||
while (pResampler->inTimeInt > 0 && frameCountIn > framesProcessedIn) {
|
while (pResampler->inTimeInt > 0 && frameCountIn > framesProcessedIn) {
|
||||||
@@ -60922,7 +60922,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r
|
|||||||
ma_uint64 framesProcessedIn;
|
ma_uint64 framesProcessedIn;
|
||||||
ma_uint64 framesProcessedOut;
|
ma_uint64 framesProcessedOut;
|
||||||
ma_uint32 c;
|
ma_uint32 c;
|
||||||
double invSampleRateOut;
|
float invSampleRateOut;
|
||||||
ma_uint32 lpfCount;
|
ma_uint32 lpfCount;
|
||||||
ma_uint32 channels;
|
ma_uint32 channels;
|
||||||
ma_uint32 inTimeInt;
|
ma_uint32 inTimeInt;
|
||||||
@@ -60938,7 +60938,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r
|
|||||||
frameCountOut = *pFrameCountOut;
|
frameCountOut = *pFrameCountOut;
|
||||||
framesProcessedIn = 0;
|
framesProcessedIn = 0;
|
||||||
framesProcessedOut = 0;
|
framesProcessedOut = 0;
|
||||||
invSampleRateOut = (1.0 / pResampler->sampleRateOut);
|
invSampleRateOut = 1.0f / pResampler->sampleRateOut;
|
||||||
lpfCount = pResampler->lpfOrder >> 1;
|
lpfCount = pResampler->lpfOrder >> 1;
|
||||||
channels = pResampler->channels;
|
channels = pResampler->channels;
|
||||||
inTimeInt = pResampler->inTimeInt;
|
inTimeInt = pResampler->inTimeInt;
|
||||||
@@ -60958,7 +60958,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r
|
|||||||
MA_ASSERT(pResampler->cachedFrameCount <= 1); /* There is at most one cached frame. */
|
MA_ASSERT(pResampler->cachedFrameCount <= 1); /* There is at most one cached frame. */
|
||||||
|
|
||||||
while (pResampler->cachedFrameCount > 0 && frameCountIn > 0 && framesProcessedOut < frameCountOut) {
|
while (pResampler->cachedFrameCount > 0 && frameCountIn > 0 && framesProcessedOut < frameCountOut) {
|
||||||
float a = (float)(inTimeFrac * invSampleRateOut);
|
float a = inTimeFrac * invSampleRateOut;
|
||||||
|
|
||||||
for (c = 0; c < channels; c += 1) {
|
for (c = 0; c < channels; c += 1) {
|
||||||
pFramesOutF32[c] = ma_mix_f32_fast(pResampler->x0.f32[c], pFramesInF32[c], a);
|
pFramesOutF32[c] = ma_mix_f32_fast(pResampler->x0.f32[c], pFramesInF32[c], a);
|
||||||
@@ -61267,7 +61267,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r
|
|||||||
|
|
||||||
while (framesProcessedOut < frameCountOut && inTimeInt < frameCountIn) {
|
while (framesProcessedOut < frameCountOut && inTimeInt < frameCountIn) {
|
||||||
if (inTimeInt + 1 < frameCountIn) {
|
if (inTimeInt + 1 < frameCountIn) {
|
||||||
float a = (float)(inTimeFrac * invSampleRateOut);
|
float a = inTimeFrac * invSampleRateOut;
|
||||||
|
|
||||||
for (c = 0; c < channels; c += 1) {
|
for (c = 0; c < channels; c += 1) {
|
||||||
pFramesOutF32[c] = ma_mix_f32_fast(pFramesInF32[((inTimeInt + 0) * channels) + c], pFramesInF32[((inTimeInt + 1) * channels) + c], a);
|
pFramesOutF32[c] = ma_mix_f32_fast(pFramesInF32[((inTimeInt + 0) * channels) + c], pFramesInF32[((inTimeInt + 1) * channels) + c], a);
|
||||||
|
|||||||
Reference in New Issue
Block a user