From a563c8ed5a5d5004f4270dd8836f4257c1da2fe8 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Thu, 29 Jan 2009 02:17:36 +0200 Subject: SBC encoder scale factors calculation optimized with __builtin_clz Count leading zeros operation is often implemented using a special instruction for it on various architectures (at least this is true for ARM and x86). Using __builtin_clz gcc intrinsic allows to eliminate innermost loop in scale factors calculation and improve performance. Also scale factors calculation can be optimized even more using SIMD instructions. --- sbc/sbc_primitives.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sbc/sbc_primitives.h') diff --git a/sbc/sbc_primitives.h b/sbc/sbc_primitives.h index 5b7c9acb..2708c829 100644 --- a/sbc/sbc_primitives.h +++ b/sbc/sbc_primitives.h @@ -58,6 +58,10 @@ struct sbc_encoder_state { 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); + /* Scale factors calculation */ + void (*sbc_calc_scalefactors)(int32_t sb_sample_f[16][2][8], + uint32_t scale_factor[2][8], + int blocks, int channels, int subbands); }; /* -- cgit