aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alBuffer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-03 20:02:15 -0800
committerChris Robinson <[email protected]>2014-03-03 20:02:15 -0800
commita6eb38ea7f89ae21d6621570a148aa3aed5edf54 (patch)
tree82e0c556b1c1e7f6023a39f6da9d707bea341849 /OpenAL32/alBuffer.c
parenta2d9133ffca3bbd6f44b83bedc2021866d0237e6 (diff)
Use alloca for temp space decoding/encoding IMA4 blocks
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r--OpenAL32/alBuffer.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 3e125327..bbc1da05 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -24,6 +24,12 @@
#include <stdio.h>
#include <assert.h>
#include <limits.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
#include "alMain.h"
#include "alu.h"
@@ -1598,11 +1604,11 @@ DECL_TEMPLATE2(ALubyte3)
static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \
ALuint len) \
{ \
- ALshort tmp[65*MAX_INPUT_CHANNELS]; /* Max samples an IMA4 frame can be */\
ALuint i, j, k; \
+ ALshort *tmp; \
\
- i = 0; \
- while(i < len) \
+ tmp = alloca(65*numchans); \
+ for(i = 0;i < len;) \
{ \
DecodeIMA4Block(tmp, src, numchans); \
src += 36*numchans; \
@@ -1634,11 +1640,12 @@ DECL_TEMPLATE(ALubyte3)
static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \
ALuint len) \
{ \
- ALshort tmp[65*MAX_INPUT_CHANNELS]; /* Max samples an IMA4 frame can be */\
ALint sample[MaxChannels] = {0,0,0,0,0,0,0,0}; \
ALint index[MaxChannels] = {0,0,0,0,0,0,0,0}; \
+ ALshort *tmp; \
ALuint i, j; \
\
+ tmp = alloca(65*numchans); \
for(i = 0;i < len;i += 65) \
{ \
for(j = 0;j < 65*numchans;j++) \