Add some asserts to verify block alignment for conversion

This commit is contained in:
Chris Robinson 2014-05-20 09:16:54 -07:00
parent cd983245f1
commit f313ce2a96

View File

@ -920,6 +920,7 @@ static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \
DECL_VLA(ALshort, tmp, align*numchans); \
ALuint i, j, k; \
\
assert(align > 0 && (len%align) == 0); \
for(i = 0;i < len;i += align) \
{ \
DecodeIMA4Block(tmp, src, numchans, align); \
@ -941,6 +942,7 @@ static void Convert_ALshort_ALima4(ALshort *dst, const ALima4 *src, ALuint numch
ALsizei byte_align = ((align-1)/2 + 4) * numchans;
ALuint i;
assert(align > 0 && (len%align) == 0);
for(i = 0;i < len;i += align)
{
DecodeIMA4Block(dst, src, numchans, align);
@ -970,6 +972,7 @@ static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \
DECL_VLA(ALshort, tmp, align*numchans); \
ALuint i, j, k; \
\
assert(align > 0 && (len%align) == 0); \
for(i = 0;i < len;i += align) \
{ \
for(j = 0;j < align;j++) \
@ -992,6 +995,7 @@ static void Convert_ALima4_ALshort(ALima4 *dst, const ALshort *src,
ALsizei byte_align = ((align-1)/2 + 4) * numchans;
ALuint i;
assert(align > 0 && (len%align) == 0);
for(i = 0;i < len;i += align)
{
EncodeIMA4Block(dst, src, sample, index, numchans, align);
@ -1021,6 +1025,7 @@ static void Convert_##T##_ALmsadpcm(T *dst, const ALmsadpcm *src, \
DECL_VLA(ALshort, tmp, align*numchans); \
ALuint i, j, k; \
\
assert(align > 1 && (len%align) == 0); \
for(i = 0;i < len;i += align) \
{ \
DecodeMSADPCMBlock(tmp, src, numchans, align); \
@ -1043,6 +1048,7 @@ static void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALmsadpcm *src,
ALsizei byte_align = ((align-2)/2 + 7) * numchans;
ALuint i;
assert(align > 1 && (len%align) == 0);
for(i = 0;i < len;i += align)
{
DecodeMSADPCMBlock(dst, src, numchans, align);
@ -1071,6 +1077,7 @@ static void Convert_ALmsadpcm_##T(ALmsadpcm *dst, const T *src, \
DECL_VLA(ALshort, tmp, align*numchans); \
ALuint i, j, k; \
\
assert(align > 1 && (len%align) == 0); \
for(i = 0;i < len;i += align) \
{ \
for(j = 0;j < align;j++) \
@ -1092,6 +1099,7 @@ static void Convert_ALmsadpcm_ALshort(ALmsadpcm *dst, const ALshort *src,
ALsizei byte_align = ((align-2)/2 + 7) * numchans;
ALuint i;
assert(align > 1 && (len%align) == 0);
for(i = 0;i < len;i += align)
{
EncodeMSADPCMBlock(dst, src, sample, numchans, align);