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

Function dca_parse_frame_header

libavcodec/dca.c:327–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327static int dca_parse_frame_header(DCAContext * s)
328{
329 int i, j;
330 static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 };
331 static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
332 static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 };
333
334 init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
335
336 /* Sync code */
337 get_bits(&s->gb, 32);
338
339 /* Frame header */
340 s->frame_type = get_bits(&s->gb, 1);
341 s->samples_deficit = get_bits(&s->gb, 5) + 1;
342 s->crc_present = get_bits(&s->gb, 1);
343 s->sample_blocks = get_bits(&s->gb, 7) + 1;
344 s->frame_size = get_bits(&s->gb, 14) + 1;
345 if (s->frame_size < 95)
346 return -1;
347 s->amode = get_bits(&s->gb, 6);
348 s->sample_rate = dca_sample_rates[get_bits(&s->gb, 4)];
349 if (!s->sample_rate)
350 return -1;
351 s->bit_rate_index = get_bits(&s->gb, 5);
352 s->bit_rate = dca_bit_rates[s->bit_rate_index];
353 if (!s->bit_rate)
354 return -1;
355
356 s->downmix = get_bits(&s->gb, 1);
357 s->dynrange = get_bits(&s->gb, 1);
358 s->timestamp = get_bits(&s->gb, 1);
359 s->aux_data = get_bits(&s->gb, 1);
360 s->hdcd = get_bits(&s->gb, 1);
361 s->ext_descr = get_bits(&s->gb, 3);
362 s->ext_coding = get_bits(&s->gb, 1);
363 s->aspf = get_bits(&s->gb, 1);
364 s->lfe = get_bits(&s->gb, 2);
365 s->predictor_history = get_bits(&s->gb, 1);
366
367 /* TODO: check CRC */
368 if (s->crc_present)
369 s->header_crc = get_bits(&s->gb, 16);
370
371 s->multirate_inter = get_bits(&s->gb, 1);
372 s->version = get_bits(&s->gb, 4);
373 s->copy_history = get_bits(&s->gb, 2);
374 s->source_pcm_res = get_bits(&s->gb, 3);
375 s->front_sum = get_bits(&s->gb, 1);
376 s->surround_sum = get_bits(&s->gb, 1);
377 s->dialog_norm = get_bits(&s->gb, 4);
378
379 /* FIXME: channels mixing levels */
380 s->output = s->amode;
381 if(s->lfe) s->output |= DCA_LFE;
382
383#ifdef TRACE
384 av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);

Callers 1

dca_decode_frameFunction · 0.85

Calls 4

init_get_bitsFunction · 0.85
get_bitsFunction · 0.85
av_logFunction · 0.85
get_arrayFunction · 0.85

Tested by

no test coverage detected