vvc

package
v0.51.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// VCL NAL unit types
	NALU_TRAIL      = NaluType(0)  // Coded slice of a trailing picture or subpicture
	NALU_STSA       = NaluType(1)  // Coded slice of an STSA picture or subpicture
	NALU_RADL       = NaluType(2)  // Coded slice of a RADL picture or subpicture
	NALU_RASL       = NaluType(3)  // Coded slice of a RASL picture or subpicture
	NALU_RSV_VCL_4  = NaluType(4)  // Reserved non-IRAP VCL NAL unit type
	NALU_RSV_VCL_5  = NaluType(5)  // Reserved non-IRAP VCL NAL unit type
	NALU_RSV_VCL_6  = NaluType(6)  // Reserved non-IRAP VCL NAL unit type
	NALU_IDR_W_RADL = NaluType(7)  // Coded slice of an IDR picture or subpicture
	NALU_IDR_N_LP   = NaluType(8)  // Coded slice of an IDR picture or subpicture
	NALU_CRA        = NaluType(9)  // Coded slice of a CRA picture or subpicture
	NALU_GDR        = NaluType(10) // Coded slice of a GDR picture or subpicture
	NALU_RSV_IRAP   = NaluType(11) // Reserved IRAP VCL NAL unit type

	// Non-VCL NAL unit types
	NALU_OPI         = NaluType(12) // Operating point information
	NALU_DCI         = NaluType(13) // Decoding capability information
	NALU_VPS         = NaluType(14) // Video parameter set
	NALU_SPS         = NaluType(15) // Sequence parameter set
	NALU_PPS         = NaluType(16) // Picture parameter set
	NALU_PREFIX_APS  = NaluType(17) // Adaptation parameter set
	NALU_SUFFIX_APS  = NaluType(18) // Adaptation parameter set
	NALU_PH          = NaluType(19) // Picture header
	NALU_AUD         = NaluType(20) // AU delimiter
	NALU_EOS         = NaluType(21) // End of sequence
	NALU_EOB         = NaluType(22) // End of bitstream
	NALU_SEI_PREFIX  = NaluType(23) // Supplemental enhancement information
	NALU_SEI_SUFFIX  = NaluType(24) // Supplemental enhancement information
	NALU_FD          = NaluType(25) // Filler data
	NALU_RSV_NVCL_26 = NaluType(26) // Reserved non-VCL NAL unit type
	NALU_RSV_NVCL_27 = NaluType(27) // Reserved non-VCL NAL unit type
	NALU_UNSPEC_28   = NaluType(28) // Unspecified non-VCL NAL unit type
	NALU_UNSPEC_29   = NaluType(29) // Unspecified non-VCL NAL unit type
	NALU_UNSPEC_30   = NaluType(30) // Unspecified non-VCL NAL unit type
	NALU_UNSPEC_31   = NaluType(31) // Unspecified non-VCL NAL unit type
)

VVC NAL unit types (0-31)

Variables

This section is empty.

Functions

func NaluTypeName

func NaluTypeName(naluType uint8) string

NaluTypeName returns the name of the NAL unit type (backward compatibility)

Types

type DecConfRec

type DecConfRec struct {
	LengthSizeMinusOne uint8
	PtlPresentFlag     bool
	OlsIdx             uint16
	NumSublayers       uint8
	ConstantFrameRate  uint8
	ChromaFormatIDC    uint8
	BitDepthMinus8     uint8
	NativePTL          PTL
	MaxPictureWidth    uint16
	MaxPictureHeight   uint16
	AvgFrameRate       uint16
	NaluArrays         []NaluArray
}

DecConfRec represents VVC decoder configuration record, 11.2.4.2.2

aligned(8) class VvcDecoderConfigurationRecord {
	bit(5) reserved = '11111'b;
	unsigned int(2) LengthSizeMinusOne;
	unsigned int(1) ptl_present_flag;
	if (ptl_present_flag) {
		unsigned int(9) ols_idx;
		unsigned int(3) num_sublayers;
		unsigned int(2) constant_frame_rate;
		unsigned int(2) chroma_format_idc;
		unsigned int(3) bit_depth_minus8;
		bit(5) reserved = '11111'b;
		VvcPTLRecord(num_sublayers) native_ptl;
		unsigned_int(16) max_picture_width;
		unsigned_int(16) max_picture_height;
		unsigned int(16) avg_frame_rate;
	}
	unsigned int(8) num_of_arrays;
	for (j=0; j < num_of_arrays; j++) {
		unsigned int(1) array_completeness;
		bit(2) reserved = 0;
		unsigned int(5) NAL_unit_type;
		if (NAL_unit_type != DCI_NUT && NAL_unit_type != OPI_NUT)
			unsigned int(16) num_nalus;
		for (i=0; i< num_nalus; i++) {
			unsigned int(16) nal_unit_length;
			bit(8*nal_unit_length) nal_unit;
		}
	}
}

func DecodeVVCDecConfRec

func DecodeVVCDecConfRec(data []byte) (DecConfRec, error)

DecodeVVCDecConfRec decodes a VVC decoder configuration record

func (*DecConfRec) Encode

func (d *DecConfRec) Encode(w io.Writer) error

Encode writes the decoder configuration record to w

func (*DecConfRec) EncodeSW

func (d *DecConfRec) EncodeSW(sw bits.SliceWriter) error

EncodeSW writes the decoder configuration record to sw

func (*DecConfRec) Size

func (d *DecConfRec) Size() int

Size returns the size of the decoder configuration record

type NaluArray

type NaluArray struct {
	NaluType NaluType
	Complete bool
	Nalus    [][]byte
}

NaluArray represents an array of NAL units of the same type

func NewNaluArray

func NewNaluArray(complete bool, naluType NaluType, nalus [][]byte) NaluArray

NewNaluArray creates a new NaluArray

func (NaluArray) NaluTypeName

func (n NaluArray) NaluTypeName() string

NaluTypeName returns the NAL unit type name

type NaluHeader

type NaluHeader struct {
	NuhLayerId         uint8 // NAL unit header layer ID
	NaluType           NaluType
	NuhTemporalIdPlus1 uint8 // NAL unit header temporal ID plus 1
}

NaluHeader is VVC NAL unit header

func ParseNaluHeader

func ParseNaluHeader(rawBytes []byte) (NaluHeader, error)

ParseNaluHeader parses the NAL unit header from raw bytes

type NaluType

type NaluType uint8

NaluType - VVC NAL unit type according to ISO/IEC 23090-3 Table 5

func (NaluType) String

func (n NaluType) String() string

type PTL

type PTL struct {
	NumBytesConstraintInfo      uint8
	GeneralProfileIDC           uint8
	GeneralTierFlag             bool
	GeneralLevelIDC             uint8
	PtlFrameOnlyConstraintFlag  bool
	PtlMultiLayerEnabledFlag    bool
	GeneralConstraintInfo       []byte
	PtlSublayerLevelPresentFlag []bool
	SublayerLevelIDC            []uint8
	PtlNumSubProfiles           uint8
	GeneralSubProfileIDC        []uint32
}

PTL represents profile-tier-level information (VvcPTLRecord) Section 11.2.4.1.2

aligned(8) class VvcPTLRecord(num_sublayers) {
	bit(2) reserved = 0;
	unsigned int(6) num_bytes_constraint_info;
	unsigned int(7) general_profile_idc;
	unsigned int(1) general_tier_flag;
	unsigned int(8) general_level_idc;
	unsigned int(1) ptl_frame_only_constraint_flag;
	unsigned int(1) ptl_multi_layer_enabled_flag;
	unsigned int(8*num_bytes_constraint_info - 2) general_constraint_info;
	for (i=num_sublayers - 2; i >= 0; i--)
		unsigned int(1) ptl_sublayer_level_present_flag[i];
	for (j=num_sublayers; j<=8 && num_sublayers > 1; j++)
		bit(1) ptl_reserved_zero_bit = 0;
	for (i=num_sublayers-2; i >= 0; i--)
		if (ptl_sublayer_level_present_flag[i])
			unsigned int(8) sublayer_level_idc[i];
	unsigned int(8) ptl_num_sub_profiles;
	for (j=0; j < ptl_num_sub_profiles; j++)
	unsigned int(32) general_sub_profile_idc[j];
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL