diff options
author | Brad Midgley <bmidgley@xmission.com> | 2008-02-15 18:06:32 +0000 |
---|---|---|
committer | Brad Midgley <bmidgley@xmission.com> | 2008-02-15 18:06:32 +0000 |
commit | ff51f4b0b2724754184baa08b09a47cad7b7b4d5 (patch) | |
tree | f1b189d94c196b7294991a6130b8bdc497eea495 | |
parent | 0a47bd96e7953af2345b9c603db90e71d51dd39c (diff) |
fix for decoder noise at high bitpools
-rw-r--r-- | sbc/sbc.c | 12 | ||||
-rw-r--r-- | sbc/sbc_math.h | 16 |
2 files changed, 10 insertions, 18 deletions
@@ -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; |