diff options
author | Siarhei Siamashka <siarhei.siamashka@nokia.com> | 2009-01-29 18:15:31 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-07-29 19:48:28 -0700 |
commit | 16ab8cd762c5d74d813c30696cc868471781f276 (patch) | |
tree | e6743626c411cdf03f7d8aead2ff52a478843b05 | |
parent | 7b2f9e65c03cb0336a250e33a9f28c00cab72c5d (diff) | |
download | sbc-16ab8cd762c5d74d813c30696cc868471781f276.tar.gz |
sbc: 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
-rw-r--r-- | sbc/sbc.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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: |