mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-26 13:44:23 +08:00
combine the blk loops inside the joint conditional
This commit is contained in:
parent
75d93a3225
commit
6a2bcc32bf
17
sbc/sbc.c
17
sbc/sbc.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user