1
0
Fork 0
forked from len0rd/rockbox

Refinement of initial lowmem handling for libwmapro (r27593). Set maximum supported channels to 2 instead of 8 for low memory targets. This solution saves more RAM than the former solution and does avoid possible NULLPTR access. As add-on remove tabs.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27602 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2010-07-28 19:01:45 +00:00
parent c6af50b787
commit 2fefcdf31c

View file

@ -124,8 +124,14 @@
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
/** current decoder limitations */
/* Enable multichannel for large-memory targets only */
#if (MEMORYSIZE > 2)
#define WMAPRO_MAX_CHANNELS 8 ///< max number of handled channels
#else
#define WMAPRO_MAX_CHANNELS 2 ///< max number of handled channels
#endif
/* Current decoder limitations */
#define MAX_SUBFRAMES 32 ///< max number of subframes per channel
#define MAX_BANDS 29 ///< max number of scale factor bands
#define MAX_FRAMESIZE 32768 ///< maximum compressed frame size
@ -156,10 +162,8 @@ static VLC coef_vlc[2]; ///< coefficient run length vlc codes
static int32_t g_tmp[WMAPRO_BLOCK_MAX_SIZE] IBSS_ATTR_WMAPRO_LARGE_IRAM;
static int32_t g_out_ch0[WMAPRO_OUT_BUF_SIZE] IBSS_ATTR;
static int32_t g_out_ch1[WMAPRO_OUT_BUF_SIZE] IBSS_ATTR_WMAPRO_LARGE_IRAM;
#if MEMORYSIZE > 2
/* Enable multichannel for large-memory targets only */
#if (WMAPRO_MAX_CHANNELS > 2)
static int32_t g_out_multichannel[WMAPRO_MAX_CHANNELS-2][WMAPRO_OUT_BUF_SIZE];
# define MC_ENABLED
#endif
/**
@ -305,7 +309,7 @@ int decode_init(asf_waveformatex_t *wfx)
/* Use globally defined arrays. Allows IRAM usage for up to 2 channels. */
s->channel[0].out = g_out_ch0;
s->channel[1].out = g_out_ch1;
#ifdef MC_ENABLED
#if (WMAPRO_MAX_CHANNELS > 2)
for (i=2; i<WMAPRO_MAX_CHANNELS; ++i)
s->channel[i].out = g_out_multichannel[i-2];
#endif