summaryrefslogtreecommitdiffstats
path: root/sbc
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@nokia.com>2009-01-29 18:15:31 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-01-29 18:01:05 +0100
commitf7c622b6c214a74a226ca85decdf5091d4b365bc (patch)
tree75f04de23b863100310dafb29db33113e07763e9 /sbc
parent9c0b5859e6cc4b7a0e925fde8665990281b265d3 (diff)
Fix for SBC encoding with block sizes other than 16
Thanks to Christian Hoene for finding and reporting the problem. This regression was intruduced in commit 19af3c49e61aa046375497108e05a3a0605da158
Diffstat (limited to 'sbc')
-rw-r--r--sbc/sbc.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sbc/sbc.c b/sbc/sbc.c
index 8a2d7825..29f1d14c 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -651,30 +651,37 @@ static int sbc_analyze_audio(struct sbc_encoder_state *state,
struct sbc_frame *frame)
{
int ch, blk;
+ int16_t *x;
switch (frame->subbands) {
case 4:
- for (ch = 0; ch < frame->channels; ch++)
+ for (ch = 0; ch < frame->channels; ch++) {
+ x = &state->X[ch][state->position - 16 +
+ frame->blocks * 4];
for (blk = 0; blk < frame->blocks; blk += 4) {
state->sbc_analyze_4b_4s(
- &state->X[ch][state->position +
- 48 - blk * 4],
+ x,
frame->sb_sample_f[blk][ch],
frame->sb_sample_f[blk + 1][ch] -
frame->sb_sample_f[blk][ch]);
+ x -= 16;
}
+ }
return frame->blocks * 4;
case 8:
- for (ch = 0; ch < frame->channels; ch++)
+ for (ch = 0; ch < frame->channels; ch++) {
+ x = &state->X[ch][state->position - 32 +
+ frame->blocks * 8];
for (blk = 0; blk < frame->blocks; blk += 4) {
state->sbc_analyze_4b_8s(
- &state->X[ch][state->position +
- 96 - blk * 8],
+ x,
frame->sb_sample_f[blk][ch],
frame->sb_sample_f[blk + 1][ch] -
frame->sb_sample_f[blk][ch]);
+ x -= 32;
}
+ }
return frame->blocks * 8;
default: