diff options
author | Brad Midgley <bmidgley@xmission.com> | 2007-12-14 00:13:07 +0000 |
---|---|---|
committer | Brad Midgley <bmidgley@xmission.com> | 2007-12-14 00:13:07 +0000 |
commit | c5e43eefcc34641b875f2565c1c4b5b4616d3f58 (patch) | |
tree | 14d246b847f2ee061c6c55b302e6aabe30123e46 /sbc | |
parent | f77777a5ab50a1f49f0717776d92e1337f09422b (diff) |
roll back the shift-in-place bitpack optimization while we figure out if
it tickles a bug or creates a bug for 4 subbands
Diffstat (limited to 'sbc')
-rw-r--r-- | sbc/sbc.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1154,20 +1154,19 @@ static int sbc_pack_frame(uint8_t *data, struct sbc_frame *frame, size_t len) (uint16_t) ((((frame->sb_sample_f[blk][ch][sb]*levels[ch][sb]) >> (frame->scale_factor[ch][sb] + 1)) + levels[ch][sb]) >> 1); - audio_sample <<= 16 - bits[ch][sb]; for (bit = 0; bit < bits[ch][sb]; bit++) { - data[produced >> 3] <<= 1; - if(audio_sample & 0x8000) - data[produced >> 3] |= 0x1; - audio_sample <<= 1; + int b; /* A bit */ + if (produced % 8 == 0) + data[produced >> 3] = 0; + b = ((audio_sample) >> + (bits[ch][sb] - bit - 1)) & 0x01; + data[produced >> 3] |= b << (7 - (produced % 8)); produced++; } } } } } - /* align the last byte */ - if(produced % 8) data[produced >> 3] <<= 8 - (produced % 8); return (produced + 7) >> 3; } |