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

Function hvcc_parse_sps

libavformat/hevc.c:628–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628static int hvcc_parse_sps(GetBitContext *gb, HVCCNALUnit *nal,
629 HEVCDecoderConfigurationRecord *hvcc)
630{
631 unsigned int i, sps_max_sub_layers_minus1, log2_max_pic_order_cnt_lsb_minus4;
632 unsigned int num_short_term_ref_pic_sets, num_delta_pocs[HEVC_MAX_SHORT_TERM_REF_PIC_SETS];
633 unsigned int sps_ext_or_max_sub_layers_minus1, multi_layer_ext_sps_flag;
634
635 unsigned int sps_video_parameter_set_id = get_bits(gb, 4);
636
637 if (nal->nuh_layer_id == 0) {
638 sps_ext_or_max_sub_layers_minus1 = 0;
639 sps_max_sub_layers_minus1 = get_bits(gb, 3);
640 } else {
641 sps_ext_or_max_sub_layers_minus1 = get_bits(gb, 3);
642 if (sps_ext_or_max_sub_layers_minus1 == 7) {
643 const HVCCNALUnitArray *array = &hvcc->arrays[VPS_INDEX];
644 const HVCCNALUnit *vps = NULL;
645
646 for (i = 0; i < array->numNalus; i++)
647 if (sps_video_parameter_set_id == array->nal[i].parameter_set_id) {
648 vps = &array->nal[i];
649 break;
650 }
651 if (!vps)
652 return AVERROR_INVALIDDATA;
653
654 sps_max_sub_layers_minus1 = vps->vps_max_sub_layers_minus1;
655 } else
656 sps_max_sub_layers_minus1 = sps_ext_or_max_sub_layers_minus1;
657 }
658 multi_layer_ext_sps_flag = nal->nuh_layer_id &&
659 sps_ext_or_max_sub_layers_minus1 == 7;
660
661 /*
662 * numTemporalLayers greater than 1 indicates that the stream to which this
663 * configuration record applies is temporally scalable and the contained
664 * number of temporal layers (also referred to as temporal sub-layer or
665 * sub-layer in ISO/IEC 23008-2) is equal to numTemporalLayers. Value 1
666 * indicates that the stream is not temporally scalable. Value 0 indicates
667 * that it is unknown whether the stream is temporally scalable.
668 */
669 hvcc->numTemporalLayers = FFMAX(hvcc->numTemporalLayers,
670 sps_max_sub_layers_minus1 + 1);
671
672 if (!multi_layer_ext_sps_flag) {
673 hvcc->temporalIdNested = get_bits1(gb);
674 hvcc_parse_ptl(gb, hvcc, 1, sps_max_sub_layers_minus1);
675 }
676
677 nal->parameter_set_id = get_ue_golomb_long(gb);
678
679 if (multi_layer_ext_sps_flag) {
680 if (get_bits1(gb)) // update_rep_format_flag
681 skip_bits(gb, 8); // sps_rep_format_idx
682 } else {
683 hvcc->chromaFormat = get_ue_golomb_long(gb);
684
685 if (hvcc->chromaFormat == 3)

Callers 1

hvcc_add_nal_unitFunction · 0.85

Calls 10

get_bits1Function · 0.85
hvcc_parse_ptlFunction · 0.85
get_ue_golomb_longFunction · 0.85
skip_bitsFunction · 0.85
skip_bits1Function · 0.85
skip_scaling_list_dataFunction · 0.85
parse_rpsFunction · 0.85
hvcc_parse_vuiFunction · 0.85
get_bitsFunction · 0.50

Tested by

no test coverage detected