summaryrefslogtreecommitdiffstats
path: root/sbc
diff options
context:
space:
mode:
authorBrad Midgley <bmidgley@xmission.com>2008-02-15 18:06:32 +0000
committerBrad Midgley <bmidgley@xmission.com>2008-02-15 18:06:32 +0000
commitff51f4b0b2724754184baa08b09a47cad7b7b4d5 (patch)
treef1b189d94c196b7294991a6130b8bdc497eea495 /sbc
parent0a47bd96e7953af2345b9c603db90e71d51dd39c (diff)
fix for decoder noise at high bitpools
Diffstat (limited to 'sbc')
-rw-r--r--sbc/sbc.c12
-rw-r--r--sbc/sbc_math.h16
2 files changed, 10 insertions, 18 deletions
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;