From b3399635671a0f3664d09bb04ec954bc65b4a986 Mon Sep 17 00:00:00 2001 From: Mohamed Tarek Date: Sat, 17 Jul 2010 08:00:13 +0000 Subject: libwmapro : Rename all FIXED occurrances to int32_t and remove types.h git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27454 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libwmapro/types.h | 8 ------ apps/codecs/libwmapro/wmapro_math.h | 19 ++++++------- apps/codecs/libwmapro/wmaprodec.c | 57 ++++++++++++++++++------------------- 3 files changed, 37 insertions(+), 47 deletions(-) delete mode 100644 apps/codecs/libwmapro/types.h (limited to 'apps/codecs') diff --git a/apps/codecs/libwmapro/types.h b/apps/codecs/libwmapro/types.h deleted file mode 100644 index 01359fc1b1..0000000000 --- a/apps/codecs/libwmapro/types.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _TYPES_H_ -#define _TYPES_H_ - -#include - -#define FIXED int32_t - -#endif diff --git a/apps/codecs/libwmapro/wmapro_math.h b/apps/codecs/libwmapro/wmapro_math.h index 4614bcbe56..823c002c09 100644 --- a/apps/codecs/libwmapro/wmapro_math.h +++ b/apps/codecs/libwmapro/wmapro_math.h @@ -2,14 +2,13 @@ #define _WMAPRO_MATH_H_ #include -#include "types.h" #define fixtof16(x) (float)((float)(x) / (float)(1 << 16)) #define fixtof31(x) (float)((float)(x) / (float)(1 << 31)) #define ftofix16(x) ((int32_t)((x) * (float)(1 << 16) + ((x) < 0 ? -0.5:0.5))) #define ftofix31(x) ((int32_t)((x) * (float)(1 << 31) + ((x) < 0 ? -0.5:0.5))) -static inline FIXED fixmulshift(FIXED x, FIXED y, int shamt) +static inline int32_t fixmulshift(int32_t x, int32_t y, int shamt) { int64_t temp; temp = x; @@ -21,26 +20,26 @@ static inline FIXED fixmulshift(FIXED x, FIXED y, int shamt) } -static inline void vector_fixmul_window(FIXED *dst, const FIXED *src0, - const FIXED *src1, const FIXED *win, - FIXED add_bias, int len) +static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0, + const int32_t *src1, const int32_t *win, + int32_t add_bias, int len) { int i, j; dst += len; win += len; src0+= len; for(i=-len, j=len-1; i<0; i++, j--) { - FIXED s0 = src0[i]; - FIXED s1 = src1[j]; - FIXED wi = win[i]; - FIXED wj = win[j]; + int32_t s0 = src0[i]; + int32_t s1 = src1[j]; + int32_t wi = win[i]; + int32_t wj = win[j]; dst[i] = fixmulshift(s0,-1*wj,31) - fixmulshift(s1,-1*wi,31) + (add_bias<<16); dst[j] = fixmulshift(s0,-1*wi,31) + fixmulshift(s1,-1*wj,31) + (add_bias<<16); } } -static inline void vector_fixmul_scalar(FIXED *dst, const FIXED *src, FIXED mul, +static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src, int32_t mul, int len, int shift) { int i; diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c index ea4cbe3a44..8b2043a682 100644 --- a/apps/codecs/libwmapro/wmaprodec.c +++ b/apps/codecs/libwmapro/wmaprodec.c @@ -94,7 +94,6 @@ #include "wmapro_mdct.h" #include "mdct_tables.h" #include "quant.h" -#include "types.h" #include "wmapro_math.h" #include "codecs.h" #include "codeclib.h" @@ -172,8 +171,8 @@ typedef struct { int8_t scale_factor_idx; ///< index for the transmitted scale factor values (used for resampling) int* scale_factors; ///< pointer to the scale factor values used for decoding uint8_t table_idx; ///< index in sf_offsets for the scale factor reference block - FIXED* coeffs; ///< pointer to the subframe decode buffer - DECLARE_ALIGNED(16, FIXED, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer + int32_t* coeffs; ///< pointer to the subframe decode buffer + DECLARE_ALIGNED(16, int32_t, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer } WMAProChannelCtx; /** @@ -184,8 +183,8 @@ typedef struct { int8_t transform; ///< transform on / off int8_t transform_band[MAX_BANDS]; ///< controls if the transform is enabled for a certain band //float decorrelation_matrix[WMAPRO_MAX_CHANNELS*WMAPRO_MAX_CHANNELS]; - FIXED* channel_data[WMAPRO_MAX_CHANNELS]; ///< transformation coefficients - FIXED fixdecorrelation_matrix[WMAPRO_MAX_CHANNELS*WMAPRO_MAX_CHANNELS]; + int32_t* channel_data[WMAPRO_MAX_CHANNELS]; ///< transformation coefficients + int32_t fixdecorrelation_matrix[WMAPRO_MAX_CHANNELS*WMAPRO_MAX_CHANNELS]; } WMAProChannelGrp; /** @@ -196,7 +195,7 @@ typedef struct WMAProDecodeCtx { uint8_t frame_data[MAX_FRAMESIZE + FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data PutBitContext pb; ///< context for filling the frame_data buffer - DECLARE_ALIGNED(16, FIXED, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT input buffer + DECLARE_ALIGNED(16, int32_t, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT input buffer /* frame size dependent frame information (set during initialization) */ uint32_t decode_flags; ///< used compression features @@ -230,8 +229,8 @@ typedef struct WMAProDecodeCtx { uint32_t frame_num; ///< current frame number GetBitContext gb; ///< bitstream reader context int buf_bit_size; ///< buffer size in bits - FIXED* samples; - FIXED* samples_end; ///< maximum samplebuffer pointer + int32_t* samples; + int32_t* samples_end; ///< maximum samplebuffer pointer uint8_t drc_gain; ///< gain for the DRC tool int8_t skip_frame; ///< skip output step int8_t parsed_all_subframes; ///< all subframes decoded? @@ -629,13 +628,13 @@ static void decode_decorrelation_matrix(WMAProDecodeCtx *s, for (y = 0; y < i + 1; y++) { float v1 = chgroup->decorrelation_matrix[x * chgroup->num_channels + y]; float v2 = chgroup->decorrelation_matrix[i * chgroup->num_channels + y]; - FIXED f1 = chgroup->fixdecorrelation_matrix[x * chgroup->num_channels + y]; - FIXED f2 = chgroup->fixdecorrelation_matrix[i * chgroup->num_channels + y]; + int32_t f1 = chgroup->fixdecorrelation_matrix[x * chgroup->num_channels + y]; + int32_t f2 = chgroup->fixdecorrelation_matrix[i * chgroup->num_channels + y]; int n = rotation_offset[offset + x]; float sinv; float cosv; - FIXED fixsinv; - FIXED fixcosv; + int32_t fixsinv; + int32_t fixcosv; if (n < 32) { sinv = sin64[n]; @@ -691,7 +690,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s) for (s->num_chgroups = 0; remaining_channels && s->num_chgroups < s->channels_for_cur_subframe; s->num_chgroups++) { WMAProChannelGrp* chgroup = &s->chgroup[s->num_chgroups]; - FIXED** channel_data = chgroup->channel_data; + int32_t** channel_data = chgroup->channel_data; chgroup->num_channels = 0; chgroup->transform = 0; @@ -794,7 +793,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c) int cur_coeff = 0; int num_zeros = 0; const uint16_t* run; - const FIXED* level; + const int32_t* level; DEBUGF("decode coefficients for channel %i\n", c); @@ -980,9 +979,9 @@ static void inverse_channel_transform(WMAProDecodeCtx *s) for (i = 0; i < s->num_chgroups; i++) { if (s->chgroup[i].transform) { const int num_channels = s->chgroup[i].num_channels; - FIXED data[WMAPRO_MAX_CHANNELS]; - FIXED** ch_data = s->chgroup[i].channel_data; - FIXED** ch_end = ch_data + num_channels; + int32_t data[WMAPRO_MAX_CHANNELS]; + int32_t** ch_data = s->chgroup[i].channel_data; + int32_t** ch_end = ch_data + num_channels; const int8_t* tb = s->chgroup[i].transform_band; int16_t* sfb; @@ -993,16 +992,16 @@ static void inverse_channel_transform(WMAProDecodeCtx *s) if (*tb++ == 1) { /** multiply values with the decorrelation_matrix */ for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) { - const FIXED* mat = s->chgroup[i].fixdecorrelation_matrix; - const FIXED* data_end = data + num_channels; - FIXED* data_ptr = data; - FIXED** ch; + const int32_t* mat = s->chgroup[i].fixdecorrelation_matrix; + const int32_t* data_end = data + num_channels; + int32_t* data_ptr = data; + int32_t** ch; for (ch = ch_data; ch < ch_end; ch++) *data_ptr++ = (*ch)[y]; for (ch = ch_data; ch < ch_end; ch++) { - FIXED sum = 0; + int32_t sum = 0; data_ptr = data; while (data_ptr < data_end) @@ -1037,9 +1036,9 @@ static void wmapro_window(WMAProDecodeCtx *s) for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; - const FIXED* window; + const int32_t* window; int winlen = s->channel[c].prev_block_len; - FIXED *xstart= s->channel[c].coeffs - (winlen >> 1); + int32_t *xstart= s->channel[c].coeffs - (winlen >> 1); if (s->subframe_len < winlen) { xstart += (winlen - s->subframe_len) >> 1; @@ -1253,7 +1252,7 @@ static int decode_subframe(WMAProDecodeCtx *s) DEBUGF("in wmaprodec.c : unhandled value for exp, please report sample.\n"); return -1; } - const FIXED quant = QUANT(exp); + const int32_t quant = QUANT(exp); int start = s->cur_sfb_offsets[b]; vector_fixmul_scalar(s->tmp+start, @@ -1372,10 +1371,10 @@ static int decode_frame(WMAProDecodeCtx *s) /** interleave samples and write them to the output buffer */ for (i = 0; i < s->num_channels; i++) { - FIXED* ptr = s->samples + i; + int32_t* ptr = s->samples + i; int incr = s->num_channels; - FIXED* iptr = s->channel[i].out; - FIXED* iend = iptr + s->samples_per_frame; + int32_t* iptr = s->channel[i].out; + int32_t* iend = iptr + s->samples_per_frame; while (iptr < iend) { *ptr = *iptr++ << 1; @@ -1493,7 +1492,7 @@ int decode_packet(asf_waveformatex_t *wfx, void *data, int *data_size, int packet_sequence_number; s->samples = data; - s->samples_end = (FIXED*)((int8_t*)data + *data_size); + s->samples_end = (int32_t*)((int8_t*)data + *data_size); *data_size = 0; if (s->packet_done || s->packet_loss) { -- cgit v1.2.3