vc2_conformance.level_constraints: Level constraint definitions

The vc2_conformance.level_constraints module contains definitions of constraints imposed on VC-2 bitstreams by the various VC-2 level specifications.

Sequence data unit ordering restrictions

Levels may restrict the ordering or choice of data unit types within a bitstream. These restrictions are described using symbol_re regular expressions provided in LEVEL_SEQUENCE_RESTRICTIONS.

LEVEL_SEQUENCE_RESTRICTIONS = {level: LevelSequenceRestrictions, ...}

A lookup from Levels to LevelSequenceRestrictions (loaded from vc2_conformance/level_sequence_restrictions.csv) describing the restrictions on sequences imposed by each VC-2 level.

class LevelSequenceRestrictions(sequence_restriction_explanation, sequence_restriction_regex)

Restrictions on sequence orderings for a VC-2 level.

Parameters
sequence_restriction_explanationstr

A human readable explanation of the restriction imposed (informative).

sequence_restriction_regexstr

A regular expression describing the sequence ordering allowed which can be matched using a Matcher. Each symbol is a ParseCodes name string.

Coding parameter restrictions

Levels impose various restrictions on bitstream parameters and values. These restrictions are collected into a constraint table (see constraint_table) in LEVEL_CONSTRAINTS.

LEVEL_CONSTRAINTS = <constraint table>

A constraint table (see vc2_conformance.constraint_table) loaded from vc2_conformance/level_constraints.csv.

Constraints which apply due to levels. Keys correspond to particular bitstream values or properties and are enumerated below:

  • (11.2.1)
    • level: int (from the Levels enum)

    • profile: int (from the Profiles enum)

    • major_version: int

    • minor_version: int

  • (11.1)
    • base_video_format: int (from the BaseVideoFormats enum)

  • (11.4.3)
    • custom_dimensions_flag: bool

    • frame_width: int

    • frame_height: int

  • (11.4.4)
    • custom_color_diff_format_flag: bool

    • color_diff_format_index: int (from the ColorDifferenceSamplingFormats enum)

  • (11.4.5)
    • custom_scan_format_flag: bool

    • source_sampling: int (from the SourceSamplingModes enum)

  • (11.4.6)
    • custom_frame_rate_flag: bool

    • frame_rate_index: int (from the PresetFrameRates enum, or 0)

    • frame_rate_numer: int

    • frame_rate_denom: int

  • (11.4.7)
    • custom_pixel_aspect_ratio_flag: bool

    • pixel_aspect_ratio_index: int (from the PresetPixelAspectRatios enum, or 0)

    • pixel_aspect_ratio_numer: int

    • pixel_aspect_ratio_denom: int

  • (11.4.8)
    • custom_clean_area_flag: bool

    • clean_width: int

    • clean_height: int

    • left_offset: int

    • top_offset: int

  • (11.4.9)
    • custom_signal_range_flag: bool

    • custom_signal_range_index: int (from the PresetSignalRanges enum, or 0)

    • luma_offset: int

    • luma_excursion: int

    • color_diff_offset: int

    • color_diff_excursion: int

  • (11.4.10)
    • custom_color_spec_flag: bool

    • color_spec_index: int (from the PresetColorSpecs enum)

    • custom_color_primaries_flag: bool

    • color_primaries_index: int (from the PresetColorPrimaries enum)

    • custom_color_matrix_flag: bool

    • color_matrix_index: int (from the PresetColorMatrices enum)

    • custom_transfer_function_flag: bool

    • transfer_function_index: int (from the PresetTransferFunctions enum)

  • (11.1)
    • picture_coding_mode: int (from the PictureCodingModes enum)

  • (12.4.1)
    • wavelet_index: int (from the WaveletFilters enum)

    • dwt_depth: int

  • (12.4.4.1)
    • asym_transform_index_flag: bool

    • wavelet_index_ho: int (from the WaveletFilters enum)

    • asym_transform_flag: bool

    • dwt_depth_ho: int

  • (12.4.5.2)
    • slices_x: int (giving the allowed number of slices in the x dimension)

    • slices_y: int (giving the allowed number of slices in the y dimension)

    • slices_have_same_dimensions: bool. True iff all slices contain exactly the same number of transform components.

    • slice_bytes_numerator: int

    • slice_bytes_denominator: int

    • slice_prefix_bytes: int

    • slice_size_scaler: int

  • (12.4.5.3)
    • custom_quant_matrix: bool

    • quant_matrix_values: int (giving the allowed values within a custom quantisation matrix).

  • (13.5.3)
    • qindex: int (the allowed qindex values as defined by individual slices)

  • (13.5.3.2)
    • total_slice_bytes: int (total number of bytes allowed in a high quality picture slice, including all prefix bytes and slice size fields.

See also: LEVEL_CONSTRAINT_ANY_VALUES.

LEVEL_CONSTRAINT_ANY_VALUES = {key: ValueSet, ...}

For keys in LEVEL_CONSTRAINTS which may hold AnyValue, defines an explicit ValueSet defining all valid values, for example when the key refers to an enumerated value. Where the range of allowed values is truly open ended, no value is provided in this dictionary.