mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Add a deinterleaving code path for unaligned buffers.
This commit is contained in:
+24
-2
@@ -52970,6 +52970,17 @@ MA_API void ma_deinterleave_pcm_frames(ma_format format, ma_uint32 channels, ma_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
ma_uint8* pDstU8_0 = (ma_uint8*)ppDeinterleavedPCMFrames[0];
|
||||||
|
ma_uint8* pDstU8_1 = (ma_uint8*)ppDeinterleavedPCMFrames[1];
|
||||||
|
const ma_uint8* pSrcU8Running = (const ma_uint8*)pSrcU8;
|
||||||
|
|
||||||
|
for (iPCMFrame = 0; iPCMFrame < frameCount; iPCMFrame += 1) {
|
||||||
|
pDstU8_0[iPCMFrame] = pSrcU8Running[0];
|
||||||
|
pDstU8_1[iPCMFrame] = pSrcU8Running[1];
|
||||||
|
|
||||||
|
pSrcU8Running += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53041,6 +53052,17 @@ MA_API void ma_deinterleave_pcm_frames(ma_format format, ma_uint32 channels, ma_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
ma_int16* pDstS16_0 = (ma_int16*)ppDeinterleavedPCMFrames[0];
|
||||||
|
ma_int16* pDstS16_1 = (ma_int16*)ppDeinterleavedPCMFrames[1];
|
||||||
|
const ma_int16* pSrcS16Running = (const ma_int16*)pSrcS16;
|
||||||
|
|
||||||
|
for (iPCMFrame = 0; iPCMFrame < frameCount; iPCMFrame += 1) {
|
||||||
|
pDstS16_0[iPCMFrame] = pSrcS16Running[0];
|
||||||
|
pDstS16_1[iPCMFrame] = pSrcS16Running[1];
|
||||||
|
|
||||||
|
pSrcS16Running += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53348,9 +53370,9 @@ MA_API void ma_interleave_pcm_frames(ma_format format, ma_uint32 channels, ma_ui
|
|||||||
{
|
{
|
||||||
ma_uint32 sampleSizeInBytes = ma_get_bytes_per_sample(format);
|
ma_uint32 sampleSizeInBytes = ma_get_bytes_per_sample(format);
|
||||||
ma_uint64 iPCMFrame;
|
ma_uint64 iPCMFrame;
|
||||||
for (iPCMFrame = 0; iPCMFrame < frameCount; ++iPCMFrame) {
|
for (iPCMFrame = 0; iPCMFrame < frameCount; iPCMFrame += 1) {
|
||||||
ma_uint32 iChannel;
|
ma_uint32 iChannel;
|
||||||
for (iChannel = 0; iChannel < channels; ++iChannel) {
|
for (iChannel = 0; iChannel < channels; iChannel += 1) {
|
||||||
void* pDst = ma_offset_ptr(pInterleavedPCMFrames, (iPCMFrame*channels+iChannel)*sampleSizeInBytes);
|
void* pDst = ma_offset_ptr(pInterleavedPCMFrames, (iPCMFrame*channels+iChannel)*sampleSizeInBytes);
|
||||||
const void* pSrc = ma_offset_ptr(ppDeinterleavedPCMFrames[iChannel], iPCMFrame*sampleSizeInBytes);
|
const void* pSrc = ma_offset_ptr(ppDeinterleavedPCMFrames[iChannel], iPCMFrame*sampleSizeInBytes);
|
||||||
memcpy(pDst, pSrc, sampleSizeInBytes);
|
memcpy(pDst, pSrc, sampleSizeInBytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user