diff options
author | Siarhei Siamashka <siarhei.siamashka@nokia.com> | 2009-01-27 18:57:35 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-01-28 06:42:10 +0100 |
commit | 19af3c49e61aa046375497108e05a3a0605da158 (patch) | |
tree | e7f5b52ce31dfa3fdf4d3ec0e649a95b9dd22eb8 /sbc/sbc_primitives.h | |
parent | 836c502d8adf137c586ffe6a5733d61ba2f57482 (diff) |
Performance optimizations for input data processing in SBC encoder
Channels deinterleaving, endian conversion and samples reordering
is done in one pass, avoiding the use of intermediate buffer. Also
this code is implemented as a new "performance primitive", which
allows further platform specific optimizations (ARMv6 and ARM NEON
should gain quite a lot from assembly optimizations here).
Diffstat (limited to 'sbc/sbc_primitives.h')
-rw-r--r-- | sbc/sbc_primitives.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sbc/sbc_primitives.h b/sbc/sbc_primitives.h index a418ed8a..5b7c9acb 100644 --- a/sbc/sbc_primitives.h +++ b/sbc/sbc_primitives.h @@ -27,6 +27,7 @@ #define __SBC_PRIMITIVES_H #define SCALE_OUT_BITS 15 +#define SBC_X_BUFFER_SIZE 328 #ifdef __GNUC__ #define SBC_ALWAYS_INLINE __attribute__((always_inline)) @@ -35,17 +36,28 @@ #endif struct sbc_encoder_state { - int subbands; - int position[2]; - int16_t SBC_ALIGNED X[2][256]; + int position; + int16_t SBC_ALIGNED X[2][SBC_X_BUFFER_SIZE]; /* Polyphase analysis filter for 4 subbands configuration, * it handles 4 blocks at once */ - void (*sbc_analyze_4b_4s)(int16_t *pcm, int16_t *x, - int32_t *out, int out_stride); + void (*sbc_analyze_4b_4s)(int16_t *x, int32_t *out, int out_stride); /* Polyphase analysis filter for 8 subbands configuration, * it handles 4 blocks at once */ - void (*sbc_analyze_4b_8s)(int16_t *pcm, int16_t *x, - int32_t *out, int out_stride); + void (*sbc_analyze_4b_8s)(int16_t *x, int32_t *out, int out_stride); + /* Process input data (deinterleave, endian conversion, reordering), + * depending on the number of subbands and input data byte order */ + int (*sbc_enc_process_input_4s_le)(int position, + const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); + int (*sbc_enc_process_input_4s_be)(int position, + const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); + int (*sbc_enc_process_input_8s_le)(int position, + const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); + int (*sbc_enc_process_input_8s_be)(int position, + const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); }; /* |