MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / dca_subframe_header

Function dca_subframe_header

libavcodec/dca.c:504–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504static int dca_subframe_header(DCAContext * s)
505{
506 /* Primary audio coding side information */
507 int j, k;
508
509 s->subsubframes = get_bits(&s->gb, 2) + 1;
510 s->partial_samples = get_bits(&s->gb, 3);
511 for (j = 0; j < s->prim_channels; j++) {
512 for (k = 0; k < s->subband_activity[j]; k++)
513 s->prediction_mode[j][k] = get_bits(&s->gb, 1);
514 }
515
516 /* Get prediction codebook */
517 for (j = 0; j < s->prim_channels; j++) {
518 for (k = 0; k < s->subband_activity[j]; k++) {
519 if (s->prediction_mode[j][k] > 0) {
520 /* (Prediction coefficient VQ address) */
521 s->prediction_vq[j][k] = get_bits(&s->gb, 12);
522 }
523 }
524 }
525
526 /* Bit allocation index */
527 for (j = 0; j < s->prim_channels; j++) {
528 for (k = 0; k < s->vq_start_subband[j]; k++) {
529 if (s->bitalloc_huffman[j] == 6)
530 s->bitalloc[j][k] = get_bits(&s->gb, 5);
531 else if (s->bitalloc_huffman[j] == 5)
532 s->bitalloc[j][k] = get_bits(&s->gb, 4);
533 else if (s->bitalloc_huffman[j] == 7) {
534 av_log(s->avctx, AV_LOG_ERROR,
535 "Invalid bit allocation index\n");
536 return -1;
537 } else {
538 s->bitalloc[j][k] =
539 get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]);
540 }
541
542 if (s->bitalloc[j][k] > 26) {
543// av_log(s->avctx,AV_LOG_DEBUG,"bitalloc index [%i][%i] too big (%i)\n",
544// j, k, s->bitalloc[j][k]);
545 return -1;
546 }
547 }
548 }
549
550 /* Transition mode */
551 for (j = 0; j < s->prim_channels; j++) {
552 for (k = 0; k < s->subband_activity[j]; k++) {
553 s->transition_mode[j][k] = 0;
554 if (s->subsubframes > 1 &&
555 k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) {
556 s->transition_mode[j][k] =
557 get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]);
558 }
559 }
560 }
561

Callers 1

dca_decode_blockFunction · 0.85

Calls 5

get_bitsFunction · 0.85
av_logFunction · 0.85
get_bitallocFunction · 0.85
get_scaleFunction · 0.85
get_sbitsFunction · 0.85

Tested by

no test coverage detected