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

Function ff_av1_parse_seq_header

libavformat/av1.c:336–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
337{
338 int is_av1c;
339
340 if (size <= 0)
341 return AVERROR_INVALIDDATA;
342
343 is_av1c = !!(buf[0] & 0x80);
344 if (is_av1c) {
345 GetBitContext gb;
346 int ret, version = buf[0] & 0x7F;
347
348 if (version != 1 || size < 4)
349 return AVERROR_INVALIDDATA;
350
351 ret = init_get_bits8(&gb, buf, 4);
352 if (ret < 0)
353 return ret;
354
355 memset(seq, 0, sizeof(*seq));
356
357 skip_bits(&gb, 8);
358 seq->profile = get_bits(&gb, 3);
359 seq->level = get_bits(&gb, 5);
360 seq->tier = get_bits(&gb, 1);
361 seq->bitdepth = get_bits(&gb, 1) * 2 + 8;
362 seq->bitdepth += get_bits(&gb, 1) * 2;
363 seq->monochrome = get_bits(&gb, 1);
364 seq->chroma_subsampling_x = get_bits(&gb, 1);
365 seq->chroma_subsampling_y = get_bits(&gb, 1);
366 seq->chroma_sample_position = get_bits(&gb, 2);
367 seq->color_primaries = AVCOL_PRI_UNSPECIFIED;
368 seq->transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
369 seq->matrix_coefficients = AVCOL_SPC_UNSPECIFIED;
370
371 size -= 4;
372 buf += 4;
373 }
374
375 while (size > 0) {
376 int64_t obu_size;
377 int start_pos, type, temporal_id, spatial_id;
378 int len = parse_obu_header(buf, size, &obu_size, &start_pos,
379 &type, &temporal_id, &spatial_id);
380 if (len < 0)
381 return len;
382
383 switch (type) {
384 case AV1_OBU_SEQUENCE_HEADER:
385 if (!obu_size)
386 return AVERROR_INVALIDDATA;
387
388 return parse_sequence_header(seq, buf + start_pos, obu_size);
389 default:
390 break;
391 }
392 size -= len;
393 buf += len;

Callers 2

ff_make_codec_strFunction · 0.85
extradata2psets_av1Function · 0.85

Calls 5

init_get_bits8Function · 0.85
skip_bitsFunction · 0.85
parse_obu_headerFunction · 0.85
parse_sequence_headerFunction · 0.85
get_bitsFunction · 0.50

Tested by

no test coverage detected