Home | History | Annotate | Download | only in sbc

Lines Matching refs:ch

6  *  Copyright (C) 2004-2005  Henryk Ploetz <henryk@ploetzli.ch>
168 int ch, sb;
170 for (ch = 0; ch < frame->channels; ch++) {
174 bitneed[ch][sb] = frame->scale_factor[ch][sb];
175 if (bitneed[ch][sb] > max_bitneed)
176 max_bitneed = bitneed[ch][sb];
180 if (frame->scale_factor[ch][sb] == 0)
181 bitneed[ch][sb] = -5;
184 loudness = frame->scale_factor[ch][sb] - sbc_offset4[sf][sb];
186 loudness = frame->scale_factor[ch][sb] - sbc_offset8[sf][sb];
188 bitneed[ch][sb] = loudness / 2;
190 bitneed[ch][sb] = loudness;
192 if (bitneed[ch][sb] > max_bitneed)
193 max_bitneed = bitneed[ch][sb];
205 if ((bitneed[ch][sb] > bitslice + 1) && (bitneed[ch][sb] < bitslice + 16))
207 else if (bitneed[ch][sb] == bitslice + 1)
218 if (bitneed[ch][sb] < bitslice + 2)
219 bits[ch][sb] = 0;
221 bits[ch][sb] = bitneed[ch][sb] - bitslice;
222 if (bits[ch][sb] > 16)
223 bits[ch][sb] = 16;
228 if ((bits[ch][sb] >= 2) && (bits[ch][sb] < 16)) {
229 bits[ch][sb]++;
231 } else if ((bitneed[ch][sb] == bitslice + 1) && (frame->bitpool > bitcount + 1)) {
232 bits[ch][sb] = 2;
238 if (bits[ch][sb] < 16) {
239 bits[ch][sb]++;
248 int ch, sb;
252 for (ch = 0; ch < 2; ch++) {
254 bitneed[ch][sb] = frame->scale_factor[ch][sb];
255 if (bitneed[ch][sb] > max_bitneed)
256 max_bitneed = bitneed[ch][sb];
260 for (ch = 0; ch < 2; ch++) {
262 if (frame->scale_factor[ch][sb] == 0)
263 bitneed[ch][sb] = -5;
266 loudness = frame->scale_factor[ch][sb] - sbc_offset4[sf][sb];
268 loudness = frame->scale_factor[ch][sb] - sbc_offset8[sf][sb];
270 bitneed[ch][sb] = loudness / 2;
272 bitneed[ch][sb] = loudness;
274 if (bitneed[ch][sb] > max_bitneed)
275 max_bitneed = bitneed[ch][sb];
287 for (ch = 0; ch < 2; ch++) {
289 if ((bitneed[ch][sb] > bitslice + 1) && (bitneed[ch][sb] < bitslice + 16))
291 else if (bitneed[ch][sb] == bitslice + 1)
302 for (ch = 0; ch < 2; ch++) {
304 if (bitneed[ch][sb] < bitslice + 2) {
305 bits[ch][sb] = 0;
307 bits[ch][sb] = bitneed[ch][sb] - bitslice;
308 if (bits[ch][sb] > 16)
309 bits[ch][sb] = 16;
314 ch = 0;
317 if ((bits[ch][sb] >= 2) && (bits[ch][sb] < 16)) {
318 bits[ch][sb]++;
320 } else if ((bitneed[ch][sb] == bitslice + 1) && (frame->bitpool > bitcount + 1)) {
321 bits[ch][sb] = 2;
324 if (ch == 1) {
325 ch = 0;
329 ch = 1;
332 ch = 0;
335 if (bits[ch][sb] < 16) {
336 bits[ch][sb]++;
339 if (ch == 1) {
340 ch = 0;
344 ch = 1;
373 int ch, sb, blk, bit; /* channel, subband, block and bit standard
456 for (ch = 0; ch < frame->channels; ch++) {
459 frame->scale_factor[ch][sb] =
462 frame->scale_factor[ch][sb] << (4 - (crc_pos & 0x7));
474 for (ch = 0; ch < frame->channels; ch++) {
476 levels[ch][sb] = (1 << bits[ch][sb]) - 1;
480 for (ch = 0; ch < frame->channels; ch++) {
482 if (levels[ch][sb] > 0) {
484 for (bit = 0; bit < bits[ch][sb]; bit++) {
489 audio_sample |= 1 << (bits[ch][sb] - bit - 1);
494 frame->sb_sample[blk][ch][sb] =
495 (((audio_sample << 1) | 1) << frame->scale_factor[ch][sb]) /
496 levels[ch][sb] - (1 << frame->scale_factor[ch][sb]);
498 frame->sb_sample[blk][ch][sb] = 0;
527 int i, ch;
532 for (ch = 0; ch < 2; ch++)
534 state->offset[ch][i] = (10 * i + 10);
548 struct sbc_frame *frame, int ch, int blk)
551 int32_t *v = state->V[ch];
552 int *offset = state->offset[ch];
564 MULA(synmatrix4[i][0], frame->sb_sample[blk][ch][0],
565 MULA(synmatrix4[i][1], frame->sb_sample[blk][ch][1],
566 MULA(synmatrix4[i][2], frame->sb_sample[blk][ch][2],
567 MUL (synmatrix4[i][3], frame->sb_sample[blk][ch][3])))));
575 frame->pcm_sample[ch][blk * 4 + i] = sbc_clip16(SCALE4_STAGED1(
590 struct sbc_frame *frame, int ch, int blk)
593 int *offset = state->offset[ch];
601 state->V[ch][j + 160] = state->V[ch][j];
605 state->V[ch][offset[i]] = SCALE8_STAGED1(
606 MULA(synmatrix8[i][0], frame->sb_sample[blk][ch][0],
607 MULA(synmatrix8[i][1], frame->sb_sample[blk][ch][1],
608 MULA(synmatrix8[i][2], frame->sb_sample[blk][ch][2],
609 MULA(synmatrix8[i][3], frame->sb_sample[blk][ch][3],
610 MULA(synmatrix8[i][4], frame->sb_sample[blk][ch][4],
611 ch][5],
612 MULA(synmatrix8[i][6], frame->sb_sample[blk][ch][6],
613 MUL( synmatrix8[i][7], frame->sb_sample[blk][ch][7])))))))));
621 frame->pcm_sample[ch][blk * 8 + i] = sbc_clip16(SCALE8_STAGED1(
622 MULA(state->V[ch][offset[i] + 0], sbc_proto_8_80m0[idx + 0],
623 MULA(state->V[ch][offset[k] + 1], sbc_proto_8_80m1[idx + 0],
624 MULA(state->V[ch][offset[i] + 2], sbc_proto_8_80m0[idx + 1],
625 MULA(state->V[ch][offset[k] + 3], sbc_proto_8_80m1[idx + 1],
626 MULA(state->V[ch][offset[i] + 4], sbc_proto_8_80m0[idx + 2],
627 MULA(state->V[ch][offset[k] + 5], sbc_proto_8_80m1[idx + 2],
628 MULA(state->V[ch][offset[i] + 6], sbc_proto_8_80m0[idx + 3],
629 MULA(state->V[ch][offset[k] + 7], sbc_proto_8_80m1[idx + 3],
630 MULA(state->V[ch][offset[i] + 8], sbc_proto_8_80m0[idx + 4],
631 MUL( state->V[ch][offset[k] + 9], sbc_proto_8_80m1[idx + 4]))))))))))));
638 int ch, blk;
642 for (ch = 0; ch < frame->channels; ch++) {
644 sbc_synthesize_four(state, frame, ch, blk);
649 for (ch = 0; ch < frame->channels; ch++) {
651 sbc_synthesize_eight(state, frame, ch, blk);
663 int ch, blk;
668 for (ch = 0; ch < frame->channels; ch++) {
669 x = &state->X[ch][state->position - 16 +
674 frame->sb_sample_f[blk][ch],
675 frame->sb_sample_f[blk + 1][ch] -
676 frame->sb_sample_f[blk][ch]);
683 for (ch = 0; ch < frame->channels; ch++) {
684 x = &state->X[ch][state->position - 32 +
689 frame->sb_sample_f[blk][ch],
690 frame->sb_sample_f[blk + 1][ch] -
691 frame->sb_sample_f[blk][ch]);
760 int ch, sb, blk; /* channel, subband, block and bit counters */
867 for (ch = 0; ch < frame_channels; ch++) {
870 frame->scale_factor[ch][sb] & 0x0F, 4);
872 crc_header[crc_pos >> 3] |= frame->scale_factor[ch][sb] & 0x0F;
885 for (ch = 0; ch < frame_channels; ch++) {
887 levels[ch][sb] = ((1 << bits[ch][sb]) - 1) <<
888 (32 - (frame->scale_factor[ch][sb] +
890 sb_sample_delta[ch][sb] = (uint32_t) 1 <<
891 (frame->scale_factor[ch][sb] +
897 for (ch = 0; ch < frame_channels; ch++) {
900 if (bits[ch][sb] == 0)
903 audio_sample = ((uint64_t) levels[ch][sb] *
904 (sb_sample_delta[ch][sb] +
905 frame->sb_sample_f[blk][ch][sb])) >> 32;
908 audio_sample, bits[ch][sb]);
996 int i, ch, framelen, samples;
1037 for (ch = 0; ch < priv->frame.channels; ch++) {
1039 s = priv->frame.pcm_sample[ch][i];