From 054192e26d55d9dceb22d81b44abcc78cbfabac7 Mon Sep 17 00:00:00 2001 From: saratoga Date: Mon, 22 Nov 2010 07:04:32 +0000 Subject: [PATCH] Align various libwma buffers. Saves about 1 MHz on the Gigabeat S. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28640 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libwma/wmadec.h | 6 +++--- apps/codecs/libwma/wmadeci.c | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/codecs/libwma/wmadec.h b/apps/codecs/libwma/wmadec.h index d84485ca0..d7fa79d26 100644 --- a/apps/codecs/libwma/wmadec.h +++ b/apps/codecs/libwma/wmadec.h @@ -130,7 +130,7 @@ typedef struct WMADecodeContext uint8_t ms_stereo; /* true if mid/side stereo mode */ uint8_t channel_coded[MAX_CHANNELS]; /* true if channel is coded */ int exponents_bsize[MAX_CHANNELS]; // log2 ratio frame/exp. length - fixed32 exponents[MAX_CHANNELS][BLOCK_MAX_SIZE]; + fixed32 exponents[MAX_CHANNELS][BLOCK_MAX_SIZE] MEM_ALIGN_ATTR; fixed32 max_exponent[MAX_CHANNELS]; int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; fixed32 (*coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; @@ -139,14 +139,14 @@ typedef struct WMADecodeContext fixed32 (*frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE*2]; /* last frame info */ - uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */ + uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4] MEM_ALIGN_ATTR; /* padding added */ int last_bitoffset; int last_superframe_len; fixed32 *noise_table; int noise_index; fixed32 noise_mult; /* XXX: suppress that and integrate it in the noise array */ /* lsp_to_curve tables */ - fixed32 lsp_cos_table[BLOCK_MAX_SIZE]; + fixed32 lsp_cos_table[BLOCK_MAX_SIZE] MEM_ALIGN_ATTR; void *lsp_pow_m_table1; void *lsp_pow_m_table2; diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index 9333f19ff..98c10e486 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c @@ -33,17 +33,19 @@ static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); /*declarations of statically allocated variables used to remove malloc calls*/ -fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR; +fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR MEM_ALIGN_ATTR; /*decode and window into IRAM on targets with at least 80KB of codec IRAM*/ -fixed32 frame_out_buf[MAX_CHANNELS][BLOCK_MAX_SIZE * 2] IBSS_ATTR_WMA_LARGE_IRAM; +fixed32 frame_out_buf[MAX_CHANNELS][BLOCK_MAX_SIZE * 2] IBSS_ATTR_WMA_LARGE_IRAM MEM_ALIGN_ATTR; /*MDCT reconstruction windows*/ -fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; +fixed32 stat0[2048] MEM_ALIGN_ATTR, stat1[1024] MEM_ALIGN_ATTR, + stat2[512] MEM_ALIGN_ATTR, stat3[256] MEM_ALIGN_ATTR, stat4[128] MEM_ALIGN_ATTR; /*VLC lookup tables*/ uint16_t *runtabarray[2], *levtabarray[2]; -uint16_t runtab_big[1336], runtab_small[1072], levtab_big[1336], levtab_small[1072]; +uint16_t runtab_big[1336] MEM_ALIGN_ATTR, runtab_small[1072] MEM_ALIGN_ATTR, + levtab_big[1336] MEM_ALIGN_ATTR, levtab_small[1072] MEM_ALIGN_ATTR; #define VLCBUF1SIZE 4598 #define VLCBUF2SIZE 3574 @@ -52,11 +54,11 @@ uint16_t runtab_big[1336], runtab_small[1072], levtab_big[1336], levtab_small[10 /*putting these in IRAM actually makes PP slower*/ -VLC_TYPE vlcbuf1[VLCBUF1SIZE][2]; -VLC_TYPE vlcbuf2[VLCBUF2SIZE][2]; +VLC_TYPE vlcbuf1[VLCBUF1SIZE][2] MEM_ALIGN_ATTR; +VLC_TYPE vlcbuf2[VLCBUF2SIZE][2] MEM_ALIGN_ATTR; /* This buffer gets reused for lsp tables */ -VLC_TYPE vlcbuf3[VLCBUF3SIZE][2] __attribute__((aligned (sizeof(fixed32)))); -VLC_TYPE vlcbuf4[VLCBUF4SIZE][2]; +VLC_TYPE vlcbuf3[VLCBUF3SIZE][2] MEM_ALIGN_ATTR; +VLC_TYPE vlcbuf4[VLCBUF4SIZE][2] MEM_ALIGN_ATTR; @@ -1232,7 +1234,7 @@ static int wma_decode_block(WMADecodeContext *s) for(ch = 0; ch < s->nb_channels; ++ch) { /* BLOCK_MAX_SIZE is 2048 (samples) and MAX_CHANNELS is 2. */ - static uint32_t scratch_buf[BLOCK_MAX_SIZE * MAX_CHANNELS] IBSS_ATTR; + static uint32_t scratch_buf[BLOCK_MAX_SIZE * MAX_CHANNELS] IBSS_ATTR MEM_ALIGN_ATTR; if (s->channel_coded[ch]) { int n4, index; -- 2.11.4.GIT