forked from len0rd/rockbox
Maintenance and minor speedup of libwmapro. Comment unused arrays, fix comment, remove tabs and introduce WMAPRO_FRACT to wma.h to remove magic numbers. Swap operands of fixmul16-call for minor speedup on ARM (+1%).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27617 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e63e19b507
commit
aa2fca384a
7 changed files with 17 additions and 12 deletions
|
|
@ -116,7 +116,7 @@ int ff_wma_run_level_decode(GetBitContext* gb,
|
|||
offset += run_table[code];
|
||||
sign = !get_bits1(gb);
|
||||
ptr[offset & coef_mask] = sign ? -level_table[code] : level_table[code];
|
||||
ptr[offset & coef_mask] <<= 17;
|
||||
ptr[offset & coef_mask] <<= WMAPRO_FRACT;
|
||||
} else if (code == 1) {
|
||||
/** EOB */
|
||||
break;
|
||||
|
|
@ -144,7 +144,7 @@ int ff_wma_run_level_decode(GetBitContext* gb,
|
|||
}
|
||||
sign = !get_bits1(gb);
|
||||
ptr[offset & coef_mask] = sign ? -level : level;
|
||||
ptr[offset & coef_mask] <<=17;
|
||||
ptr[offset & coef_mask] <<= WMAPRO_FRACT;
|
||||
}
|
||||
}
|
||||
/** NOTE: EOB can be omitted */
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#include "ffmpeg_get_bits.h"
|
||||
#include "ffmpeg_put_bits.h"
|
||||
|
||||
#define WMAPRO_FRACT (17)
|
||||
|
||||
/* size of blocks */
|
||||
#define BLOCK_MIN_BITS 7
|
||||
#define BLOCK_MAX_BITS 11
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0,
|
|||
dst[i+1] = fixmul24(src[i+1], mul); \
|
||||
dst[i+2] = fixmul24(src[i+2], mul); \
|
||||
dst[i+3] = fixmul24(src[i+3], mul);
|
||||
#endif /* CPU_ARM */
|
||||
#endif /* CPU_ARM, CPU_COLDFIRE */
|
||||
|
||||
static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src,
|
||||
int32_t mul, int len)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* rockbox: not used
|
||||
const int32_t fixed_sin64[33] = {
|
||||
0x00000000, 0xF9B82685, 0xF3742CA3, 0xED37EF92, 0xE70747C5, 0xE0E60686,
|
||||
0xDAD7F3A3, 0xD4E0CB16, 0xCF043AB4, 0xC945DFED, 0xC3A94591, 0xBE31E19C,
|
||||
|
|
@ -39,7 +40,7 @@ const int32_t fixed_sin64[33] = {
|
|||
0x89BE50C4, 0x877B7BED, 0x8582FAA6, 0x83D60413, 0x8275A0C1, 0x8162AA05,
|
||||
0x809DC972, 0x80277873, 0x80000001,
|
||||
};
|
||||
|
||||
*/
|
||||
/**
|
||||
* @brief frequencies to divide the frequency spectrum into scale factor bands
|
||||
*/
|
||||
|
|
@ -50,7 +51,6 @@ static const uint16_t critical_freq[] = {
|
|||
9500, 12000, 15500, 20675, 28575, 41375, 63875,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @name Huffman tables for DPCM-coded scale factors
|
||||
* @{
|
||||
|
|
@ -581,6 +581,7 @@ static const uint8_t symbol_to_vec2[HUFF_VEC2_SIZE] = {
|
|||
/**
|
||||
* @brief decorrelation matrix for multichannel streams
|
||||
**/
|
||||
/* rockbox: not used
|
||||
static const float default_decorrelation_matrices[] = {
|
||||
1.000000, 0.707031, -0.707031, 0.707031, 0.707031, 0.578125, 0.707031,
|
||||
0.410156, 0.578125, -0.707031, 0.410156, 0.578125, 0.000000, -0.816406,
|
||||
|
|
@ -596,10 +597,11 @@ static const float default_decorrelation_matrices[] = {
|
|||
0.289062, -0.558594, 0.410156, -0.410156, 0.000000, 0.410156, -0.578125,
|
||||
0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438,
|
||||
};
|
||||
|
||||
*/
|
||||
/**
|
||||
* @brief default decorrelation matrix offsets
|
||||
*/
|
||||
/* rockbox: not used
|
||||
static const float * const default_decorrelation[] = {
|
||||
NULL,
|
||||
&default_decorrelation_matrices[0],
|
||||
|
|
@ -609,5 +611,5 @@ static const float * const default_decorrelation[] = {
|
|||
&default_decorrelation_matrices[30],
|
||||
&default_decorrelation_matrices[55]
|
||||
};
|
||||
|
||||
*/
|
||||
#endif /* AVCODEC_WMAPRODATA_H */
|
||||
|
|
|
|||
|
|
@ -877,7 +877,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
|
|||
for (i = 0; i < 4; i++) {
|
||||
if (vals[i]) {
|
||||
int sign = get_bits1(&s->gb) - 1;
|
||||
ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<<17 : vals[i]<<17;
|
||||
ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<<WMAPRO_FRACT : vals[i]<<WMAPRO_FRACT;
|
||||
num_zeros = 0;
|
||||
} else {
|
||||
ci->coeffs[cur_coeff] = 0;
|
||||
|
|
@ -1035,7 +1035,7 @@ static void inverse_channel_transform(WMAProDecodeCtx *s)
|
|||
data_ptr = data;
|
||||
|
||||
while (data_ptr < data_end)
|
||||
sum += fixmul16(*data_ptr++, *mat++);
|
||||
sum += fixmul16(*mat++, *data_ptr++);
|
||||
|
||||
(*ch)[y] = sum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "codeclib.h"
|
||||
#include "wma.h"
|
||||
#include "../libasf/asf.h"
|
||||
|
||||
#if (CONFIG_CPU == MCF5250) || defined(CPU_S5L870X)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ enum codec_status codec_main(void)
|
|||
int packetlength = 0; /* Logical packet size (minus the header size) */
|
||||
int outlen = 0; /* Number of bytes written to the output buffer */
|
||||
int pktcnt = 0; /* Count of the packets played */
|
||||
uint8_t *data; /* Pointer to decoder input buffer */
|
||||
int size; /* Size of the input frame to the decoder */
|
||||
uint8_t *data; /* Pointer to decoder input buffer */
|
||||
int size; /* Size of the input frame to the decoder */
|
||||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 17);
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, WMAPRO_FRACT);
|
||||
|
||||
|
||||
next_track:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue