From ff51f4b0b2724754184baa08b09a47cad7b7b4d5 Mon Sep 17 00:00:00 2001 From: Brad Midgley Date: Fri, 15 Feb 2008 18:06:32 +0000 Subject: fix for decoder noise at high bitpools --- sbc/sbc.c | 12 ++---------- sbc/sbc_math.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 18 deletions(-) (limited to 'sbc') diff --git a/sbc/sbc.c b/sbc/sbc.c index 642a7676..bc0b771c 100644 --- a/sbc/sbc.c +++ b/sbc/sbc.c @@ -543,16 +543,8 @@ static int sbc_unpack_frame(const uint8_t *data, struct sbc_frame *frame, for (sb = 0; sb < frame->subbands; sb++) { if (levels[ch][sb] > 0) { frame->sb_sample[blk][ch][sb] = - (((frame->audio_sample[blk][ch][sb] << 16) | 0x8000) / - levels[ch][sb]) - 0x8000; - - frame->sb_sample[blk][ch][sb] >>= 3; - - /* Q13 */ - frame->sb_sample[blk][ch][sb] = - (frame->sb_sample[blk][ch][sb] << - (frame->scale_factor[ch][sb] + 1)); - + (((frame->audio_sample[blk][ch][sb] << 1) | 1) << frame->scale_factor[ch][sb])/ + levels[ch][sb] - (1 << frame->scale_factor[ch][sb]); } else frame->sb_sample[blk][ch][sb] = 0; } diff --git a/sbc/sbc_math.h b/sbc/sbc_math.h index 007a1e9c..6c3fe2f2 100644 --- a/sbc/sbc_math.h +++ b/sbc/sbc_math.h @@ -40,14 +40,14 @@ #define SCALE_NPROTO4_TBL 10 #define SCALE_NPROTO8_TBL 12 #define SCALE_SAMPLES 14 -#define SCALE4_STAGE1_BITS 10 -#define SCALE4_STAGE2_BITS 21 -#define SCALE4_STAGED1_BITS 18 -#define SCALE4_STAGED2_BITS 23 -#define SCALE8_STAGE1_BITS 8 -#define SCALE8_STAGE2_BITS 24 -#define SCALE8_STAGED1_BITS 18 -#define SCALE8_STAGED2_BITS 23 +#define SCALE4_STAGE1_BITS 16 +#define SCALE4_STAGE2_BITS 16 +#define SCALE4_STAGED1_BITS 14 +#define SCALE4_STAGED2_BITS 14 +#define SCALE8_STAGE1_BITS 16 +#define SCALE8_STAGE2_BITS 16 +#define SCALE8_STAGED1_BITS 14 +#define SCALE8_STAGED2_BITS 14 typedef int32_t sbc_fixed_t; typedef long long sbc_extended_t; -- cgit