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

Function parse_x96_subframe_header

libavcodec/dca_core.c:1306–1388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304}
1305
1306static int parse_x96_subframe_header(DCACoreDecoder *s, int xch_base)
1307{
1308 int ch, band, ret;
1309
1310 if (get_bits_left(&s->gb) < 0)
1311 return AVERROR_INVALIDDATA;
1312
1313 // Prediction mode
1314 for (ch = xch_base; ch < s->x96_nchannels; ch++)
1315 for (band = s->x96_subband_start; band < s->nsubbands[ch]; band++)
1316 s->prediction_mode[ch][band] = get_bits1(&s->gb);
1317
1318 // Prediction coefficients VQ address
1319 for (ch = xch_base; ch < s->x96_nchannels; ch++)
1320 for (band = s->x96_subband_start; band < s->nsubbands[ch]; band++)
1321 if (s->prediction_mode[ch][band])
1322 s->prediction_vq_index[ch][band] = get_bits(&s->gb, 12);
1323
1324 // Bit allocation index
1325 for (ch = xch_base; ch < s->x96_nchannels; ch++) {
1326 int sel = s->bit_allocation_sel[ch];
1327 int abits = 0;
1328
1329 for (band = s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1330 // If Huffman code was used, the difference of abits was encoded
1331 if (sel < 7)
1332 abits += dca_get_vlc(&s->gb, &ff_dca_vlc_quant_index[5 + 2 * s->x96_high_res][sel]);
1333 else
1334 abits = get_bits(&s->gb, 3 + s->x96_high_res);
1335
1336 if (abits < 0 || abits > 7 + 8 * s->x96_high_res) {
1337 av_log(s->avctx, AV_LOG_ERROR, "Invalid X96 bit allocation index\n");
1338 return AVERROR_INVALIDDATA;
1339 }
1340
1341 s->bit_allocation[ch][band] = abits;
1342 }
1343 }
1344
1345 // Scale factors
1346 for (ch = xch_base; ch < s->x96_nchannels; ch++) {
1347 int sel = s->scale_factor_sel[ch];
1348 int scale_index = 0;
1349
1350 // Extract scales for subbands which are transmitted even for
1351 // unallocated subbands
1352 for (band = s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1353 if ((ret = parse_scale(s, &scale_index, sel)) < 0)
1354 return ret;
1355 s->scale_factors[ch][band >> 1][band & 1] = ret;
1356 }
1357 }
1358
1359 // Joint subband codebook select
1360 for (ch = xch_base; ch < s->x96_nchannels; ch++) {
1361 if (s->joint_intensity_index[ch]) {
1362 s->joint_scale_sel[ch] = get_bits(&s->gb, 3);
1363 if (s->joint_scale_sel[ch] == 7) {

Callers 1

parse_x96_frame_dataFunction · 0.85

Calls 8

get_bits_leftFunction · 0.85
get_bits1Function · 0.85
dca_get_vlcFunction · 0.85
av_logFunction · 0.85
parse_scaleFunction · 0.85
parse_joint_scaleFunction · 0.85
skip_bitsFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected