diff options
author | Brad Midgley <bmidgley@xmission.com> | 2007-11-27 03:15:36 +0000 |
---|---|---|
committer | Brad Midgley <bmidgley@xmission.com> | 2007-11-27 03:15:36 +0000 |
commit | 6a2bcc32bffe68e452c2ce7e0bb328b1f7b7b9bb (patch) | |
tree | a68d2b1a135c672ccb6715335dcb2eb6d987ccd5 /sbc | |
parent | 75d93a32258f2c0158c05014fce4d791660a4e45 (diff) |
combine the blk loops inside the joint conditional
Diffstat (limited to 'sbc')
-rw-r--r-- | sbc/sbc.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -1079,28 +1079,25 @@ static int sbc_pack_frame(uint8_t *data, struct sbc_frame *frame, size_t len) frame->join = 0; for (sb = 0; sb < frame->subbands - 1; sb++) { - /* Calculate joint stereo signal */ + scale_factor_j[0] = 0; + scalefactor_j[0] = 2; + scale_factor_j[1] = 0; + scalefactor_j[1] = 2; + for (blk = 0; blk < frame->blocks; blk++) { + /* Calculate joint stereo signal */ sb_sample_j[blk][0] = (frame->sb_sample_f[blk][0][sb] + frame->sb_sample_f[blk][1][sb]) >> 1; sb_sample_j[blk][1] = (frame->sb_sample_f[blk][0][sb] - frame->sb_sample_f[blk][1][sb]) >> 1; - } - /* calculate scale_factor_j and scalefactor_j for joint case */ - scale_factor_j[0] = 0; - scalefactor_j[0] = 2; - for (blk = 0; blk < frame->blocks; blk++) { + /* calculate scale_factor_j and scalefactor_j for joint case */ while (scalefactor_j[0] < fabs(sb_sample_j[blk][0])) { scale_factor_j[0]++; scalefactor_j[0] *= 2; } - } - scale_factor_j[1] = 0; - scalefactor_j[1] = 2; - for (blk = 0; blk < frame->blocks; blk++) { while (scalefactor_j[1] < fabs(sb_sample_j[blk][1])) { scale_factor_j[1]++; scalefactor_j[1] *= 2; |