# GstVp9Parser

For more details about the structures, you can refer to the specifications:

## Functions

### gst_vp9_parser_free

    void
    gst_vp9_parser_free (GstVp9Parser * parser)

Frees parser.

Parameters:

`parser` –

the GstVp9Parser to free

Returns ( void ) –
No description available

Since : 1.8

### gst_vp9_parser_new

    GstVp9Parser *
    gst_vp9_parser_new ()

Creates a new GstVp9Parser. It should be freed with gst_vp9_parser_free after use.

Returns ( GstVp9Parser * ) –

a new GstVp9Parser

Since : 1.8

### gst_vp9_parser_parse_frame_header

    GstVp9ParserResult
    gst_vp9_parser_parse_frame_header (GstVp9Parser * parser,
                                       GstVp9FrameHdr * frame_hdr,
                                       const guint8 * data,
                                       gsize size)

Parses the VP9 bitstream contained in data, and fills in frame_hdr with the information. The size argument represent the whole frame size.

Parameters:

`parser` –

The GstVp9Parser

`frame_hdr` –

The GstVp9FrameHdr to fill

`data` –

The data to parse

`size` –

The size of the data to parse

Returns ( GstVp9ParserResult ) –

a GstVp9ParserResult

Since : 1.8

### gst_vp9_parser_parse_superframe_info

    GstVp9ParserResult
    gst_vp9_parser_parse_superframe_info (GstVp9Parser * parser,
                                          GstVp9SuperframeInfo * superframe_info,
                                          const guint8 * data,
                                          gsize size)

Parses the VP9 bitstream contained in data, and fills in superframe_info with the information. The size argument represent the whole superframe size. If data is not superframe but normal frame, the parser returns GST_VP9_PARSER_OK, frame_size[0] is set to size and frames_in_superframe is set to 1. Also this method does not validate vp9frame header and verifying the frame header is caller's responsibility.

Parameters:

`parser` –

The GstVp9Parser

`superframe_info` –

The GstVp9SuperframeInfo to fill

`data` –

The data to parse

`size` –

The size of the data to parse

Returns ( GstVp9ParserResult ) –

a GstVp9ParserResult

Since : 1.18

## Structures

### GstVp9FrameHdr

    struct _GstVp9FrameHdr
    {
      guint profile;
      guint8 show_existing_frame;
      gint  frame_to_show;
      guint frame_type;
      guint8 show_frame;
      guint8 error_resilient_mode;
      guint32 width;
      guint32 height;
      guint8 display_size_enabled;
      guint32 display_width;
      guint32 display_height;
      guint frame_context_idx;

      guint8 intra_only;
      gint reset_frame_context;
      gint refresh_frame_flags;

      gint ref_frame_indices[GST_VP9_REFS_PER_FRAME];
      gint ref_frame_sign_bias[GST_VP9_REFS_PER_FRAME];
      gint allow_high_precision_mv;
      guint8 mcomp_filter_type;

      gint refresh_frame_context;
      /* frame_parallel_decoding_mode in vp9 code*/
      gint frame_parallel_decoding_mode;

      GstVp9LoopFilter loopfilter;
      GstVp9QuantIndices quant_indices;
      GstVp9SegmentationInfo segmentation;

      gint log2_tile_rows;
      gint log2_tile_columns;

      guint32 first_partition_size;

      /* calculated values */
      guint lossless_flag;
      guint32 frame_header_length_in_bytes;
    };

Frame header

#### Fields

`profile` (guint) –

encoded profile

`show_existing_frame` (guint8) –

display already decoded frame instead of doing the decoding

`frame_to_show` (gint) –

which frame to show if show_existing_frame is true

`frame_type` (guint) –

frame type

`show_frame` (guint8) –

indicate whether it is a displayable frame or not

`error_resilient_mode` (guint8) –

error resilent mode

`width` (guint32) –

frame width

`height` (guint32) –

frame height

`display_size_enabled` (guint8) –

display size enabled (cropping)

`display_width` (guint32) –

display width

`display_height` (guint32) –

display height

`frame_context_idx` (guint) –

frame context index

`intra_only` (guint8) –

intra only frame

`reset_frame_context` (gint) –

reset frame context

`refresh_frame_flags` (gint) –

refresh reference frame flags

`ref_frame_indices` (gint [3] ) –

reference frame index

`ref_frame_sign_bias` (gint [3] ) –

sign bias for selecting altref,last and golden frames

`allow_high_precision_mv` (gint) –

allow hight precision motion vector

`mcomp_filter_type` (guint8) –

interpolation filter type

`refresh_frame_context` (gint) –

refresh frame context indicator

`frame_parallel_decoding_mode` (gint) –

enable or disable parallel decoding support.

`loopfilter` (GstVp9LoopFilter) –

loopfilter values

`quant_indices` (GstVp9QuantIndices) –

quantization indices

`segmentation` (GstVp9SegmentationInfo) –

segmentation info

`log2_tile_rows` (gint) –

tile row indicator

`log2_tile_columns` (gint) –

tile column indicator

`first_partition_size` (guint32) –

first partition size (after the uncompressed header)

`lossless_flag` (guint) –

lossless mode decode

`frame_header_length_in_bytes` (guint32) –

length of uncompressed header

### GstVp9LoopFilter

    struct _GstVp9LoopFilter {
      gint filter_level;
      gint sharpness_level;

      guint8 mode_ref_delta_enabled;
      guint8 mode_ref_delta_update;
      guint8 update_ref_deltas[GST_VP9_MAX_REF_LF_DELTAS];
      gint8 ref_deltas[GST_VP9_MAX_REF_LF_DELTAS];
      guint8 update_mode_deltas[GST_VP9_MAX_MODE_LF_DELTAS];
      gint8 mode_deltas[GST_VP9_MAX_MODE_LF_DELTAS];
    };

Loop filter values

#### Fields

`filter_level` (gint) –

indicates loop filter level for the current frame

`sharpness_level` (gint) –

indicates sharpness level for thecurrent frame

`mode_ref_delta_enabled` (guint8) –

indicate if filter adjust is on

`mode_ref_delta_update` (guint8) –

indicates if the delta values used in an adjustment are updated in the current frame

`update_ref_deltas` (guint8 [4] ) –

indicate which ref deltas are updated

`ref_deltas` (gint8 [4] ) –

Loop filter strength adjustments based on frame type (intra, inter)

`update_mode_deltas` (guint8 [2] ) –

indicate with mode deltas are updated

`mode_deltas` (gint8 [2] ) –

Loop filter strength adjustments based on mode (zero, new mv)

### GstVp9Parser

    struct _GstVp9Parser
    {
      /* private struct for tracking state variables across frames */
      void *priv;

      gint subsampling_x;
      gint subsampling_y;
      guint bit_depth;
      guint color_space;
      guint color_range;

      guint8 mb_segment_tree_probs[GST_VP9_SEG_TREE_PROBS];
      guint8 segment_pred_probs[GST_VP9_PREDICTION_PROBS];
      GstVp9Segmentation segmentation[GST_VP9_MAX_SEGMENTS];
    };

Parser context that needs to be live across frames

#### Fields

`priv` (void *) –

GstVp9ParserPrivate struct to keep track of state variables

`subsampling_x` (gint) –

horizontal subsampling

`subsampling_y` (gint) –

vertical subsampling

`bit_depth` (guint) –

bit depth of the stream

`color_space` (guint) –

color space standard

`color_range` (guint) –

color range standard

`mb_segment_tree_probs` (guint8 [7] ) –

decoding tree probabilities

`segment_pred_probs` (guint8 [3] ) –

segment prediction probabiilties

`segmentation` (GstVp9Segmentation [8] ) –

Segmentation info

### GstVp9QuantIndices

    struct _GstVp9QuantIndices
    {
      guint8 y_ac_qi;
      gint8 y_dc_delta;
      gint8 uv_dc_delta;
      gint8 uv_ac_delta;
    };

Dequantization indices.

#### Fields

`y_ac_qi` (guint8) –

indicates the dequantization table index used for the luma AC coefficients

`y_dc_delta` (gint8) –

indicates the delta value that is added to the baseline index to obtain the luma DC coefficient dequantization index

`uv_dc_delta` (gint8) –

indicates the delta value that is added to the baseline index to obtain the chroma DC coefficient dequantization index

`uv_ac_delta` (gint8) –

indicates the delta value that is added to the baseline index to obtain the chroma AC coefficient dequantization index

### GstVp9Segmentation

    struct _GstVp9Segmentation
    {
      guint8 filter_level[4][2];
      gint16 luma_ac_quant_scale;
      gint16 luma_dc_quant_scale;
      gint16 chroma_ac_quant_scale;
      gint16 chroma_dc_quant_scale;

      guint8 reference_frame_enabled;
      gint reference_frame;

      guint8 reference_skip;
    };

Segmentation info kept across multiple frames

#### Fields

`filter_level` (guint8 [4][2] ) –

loop filter level

`luma_ac_quant_scale` (gint16) –

AC quant scale for luma(Y) component

`luma_dc_quant_scale` (gint16) –

DC quant scale for luma(Y) component chroma_ac_quant_scale AC quant scale for chroma(U/V) component

`chroma_ac_quant_scale` (gint16) –
No description available
`chroma_dc_quant_scale` (gint16) –

DC quant scale for chroma (U/V) component

`reference_frame_enabled` (guint8) –

alternate reference frame enablement

`reference_frame` (gint) –

alternate reference frame

`reference_skip` (guint8) –

a block skip mode that implies both the use of a (0,0) motion vector and that no residual will be coded

### GstVp9SegmentationInfo

    struct _GstVp9SegmentationInfo {
      /* enable in setup_segmentation*/
      guint8  enabled;
      /* update_map in setup_segmentation*/
      guint8 update_map;
      /* tree_probs exist or not*/
      guint8 update_tree_probs[GST_VP9_SEG_TREE_PROBS];
      guint8 tree_probs[GST_VP9_SEG_TREE_PROBS];
      /* pred_probs exist or not*/
      guint8 update_pred_probs[GST_VP9_PREDICTION_PROBS];
      guint8 pred_probs[GST_VP9_PREDICTION_PROBS];

      /* abs_delta in setup_segmentation */
      guint8 abs_delta;
      /* temporal_update in setup_segmentation */
      guint8 temporal_update;

      /* update_data in setup_segmentation*/
      guint8 update_data;
      GstVp9SegmentationInfoData data[GST_VP9_MAX_SEGMENTS];
    };

Segmentation info

#### Fields

`enabled` (guint8) –

enables the segmentation feature for the current frame

`update_map` (guint8) –

determines if segmentation is updated in the current frame

`update_tree_probs` (guint8 [7] ) –

determines if tree probabilities updated or not

`tree_probs` (guint8 [7] ) –

segment tree probabilities

`update_pred_probs` (guint8 [3] ) –

determines if prediction probabilities updated or not

`pred_probs` (guint8 [3] ) –

prediction probabilities

`abs_delta` (guint8) –

interpretation of segment data values

`temporal_update` (guint8) –

type of map update

`update_data` (guint8) –

indicates if the segment feature data is updated in the current frame

`data` (GstVp9SegmentationInfoData [8] ) –

segment feature data

### GstVp9SegmentationInfoData

    struct _GstVp9SegmentationInfoData {
      /* SEG_LVL_ALT_Q */
      guint8 alternate_quantizer_enabled;
      gint16 alternate_quantizer;

      /* SEG_LVL_ALT_LF */
      guint8 alternate_loop_filter_enabled;
      gint8 alternate_loop_filter;

      /* SEG_LVL_REF_FRAME */
      guint8 reference_frame_enabled;
      gint reference_frame;

      guint8 reference_skip;
    };

Segmentation info for each segment

#### Fields

`alternate_quantizer_enabled` (guint8) –

indicate alternate quantizer enabled at segment level

`alternate_quantizer` (gint16) –

alternate quantizer value

`alternate_loop_filter_enabled` (guint8) –

indicate alternate loop filter enabled at segment level

`alternate_loop_filter` (gint8) –

alternate loop filter

`reference_frame_enabled` (guint8) –

indicate alternate reference frame at segment level

`reference_frame` (gint) –

alternate reference frame

`reference_skip` (guint8) –

a block skip mode that implies both the use of a (0,0) motion vector and that no residual will be coded.

### GstVp9SuperframeInfo

    struct _GstVp9SuperframeInfo {
      guint32 bytes_per_framesize;
      guint32 frames_in_superframe;
      guint32 frame_sizes[GST_VP9_MAX_FRAMES_IN_SUPERFRAME];
      guint32 superframe_index_size;
    };

Superframe info

#### Fields

`bytes_per_framesize` (guint32) –

indicates the number of bytes needed to code each frame size

`frames_in_superframe` (guint32) –

indicates the number of frames within this superframe

`frame_sizes` (guint32 [8] ) –

specifies the size in bytes of frame number i (zero indexed) within this superframe

`superframe_index_size` (guint32) –

indicates the total size of the superframe_index

## Enumerations

### GstVP9Profile

    typedef enum {
      GST_VP9_PROFILE_0,
      GST_VP9_PROFILE_1,
      GST_VP9_PROFILE_2,
      GST_VP9_PROFILE_3,
      GST_VP9_PROFILE_UNDEFINED
    } GstVP9Profile;

#### Members

`GST_VP9_PROFILE_0` (0) –
No description available
`GST_VP9_PROFILE_1` (1) –
No description available
`GST_VP9_PROFILE_2` (2) –
No description available
`GST_VP9_PROFILE_3` (3) –
No description available
`GST_VP9_PROFILE_UNDEFINED` (4) –
No description available

### GstVp9BitDepth

    typedef enum {
      GST_VP9_BIT_DEPTH_8  = 8,
      GST_VP9_BIT_DEPTH_10 = 10,
      GST_VP9_BIT_DEPTH_12 = 12
    } GstVp9BitDepth;

Bit depths of encoded frames

#### Members

`GST_VP9_BIT_DEPTH_8` (8) –

Bit depth is 8 GST_VP9_BIT_DEPTH_10 Bit depth is 10

`GST_VP9_BIT_DEPTH_10` (10) –
No description available
`GST_VP9_BIT_DEPTH_12` (12) –

Bit depth is 12

### GstVp9ColorRange

    typedef enum {
      GST_VP9_CR_LIMITED,
      GST_VP9_CR_FULL
    } GstVp9ColorRange;

Possible color value ranges

#### Members

`GST_VP9_CR_LIMITED` (0) –

Y range is [16-235], UV range is [16-240]

`GST_VP9_CR_FULL` (1) –

Full range for Y,U and V [0-255]

### GstVp9ColorSpace

    typedef enum {
      GST_VP9_CS_UNKNOWN               = 0,
      GST_VP9_CS_BT_601                = 1,
      GST_VP9_CS_BT_709                = 2,
      GST_VP9_CS_SMPTE_170             = 3,
      GST_VP9_CS_SMPTE_240             = 4,
      GST_VP9_CS_BT_2020               = 5,
      GST_VP9_CS_RESERVED_2            = 6,
      GST_VP9_CS_SRGB                  = 7
    } GstVp9ColorSpace;

Supported ColorSpace standards

#### Members

`GST_VP9_CS_UNKNOWN` (0) –

Unknown color space

`GST_VP9_CS_BT_601` (1) –

BT.601

`GST_VP9_CS_BT_709` (2) –

BT.709

`GST_VP9_CS_SMPTE_170` (3) –

SMPTE.170

`GST_VP9_CS_SMPTE_240` (4) –

SMPTE.240

`GST_VP9_CS_BT_2020` (5) –

BT.2020

`GST_VP9_CS_RESERVED_2` (6) –
No description available
`GST_VP9_CS_SRGB` (7) –

sRGB

### GstVp9FrameType

    typedef enum {
      GST_VP9_KEY_FRAME   = 0,
      GST_VP9_INTER_FRAME = 1
    } GstVp9FrameType;

VP9 frame types

#### Members

`GST_VP9_KEY_FRAME` (0) –

Key frame, only have intra blocks

`GST_VP9_INTER_FRAME` (1) –

Inter frame, both intra and inter blocks

### GstVp9InterpolationFilter

    typedef enum {
      GST_VP9_INTERPOLATION_FILTER_EIGHTTAP        = 0,
      GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
      GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP  = 2,
      GST_VP9_INTERPOLATION_FILTER_BILINEAR        = 3,
      GST_VP9_INTERPOLATION_FILTER_SWITCHABLE      = 4
    } GstVp9InterpolationFilter;

Interpolation Filters Types

#### Members

`GST_VP9_INTERPOLATION_FILTER_EIGHTTAP` (0) –

EightTap interpolation filter

`GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH` (1) –

Smooth interpolation filter

`GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP` (2) –

Shart interpolation filter

`GST_VP9_INTERPOLATION_FILTER_BILINEAR` (3) –

Bilinear interpolation filter

`GST_VP9_INTERPOLATION_FILTER_SWITCHABLE` (4) –

Selectable interpolation filter

### GstVp9ParserResult

    typedef enum
    {
      GST_VP9_PARSER_OK,
      GST_VP9_PARSER_BROKEN_DATA,
      GST_VP9_PARSER_ERROR,
    } GstVp9ParserResult;

#### Members

`GST_VP9_PARSER_OK` (0) –
No description available
`GST_VP9_PARSER_BROKEN_DATA` (1) –
No description available
`GST_VP9_PARSER_ERROR` (2) –
No description available

### GstVp9RefFrameType

    typedef enum {
      GST_VP9_REF_FRAME_INTRA  = 0,
      GST_VP9_REF_FRAME_LAST   = 1,
      GST_VP9_REF_FRAME_GOLDEN = 2,
      GST_VP9_REF_FRAME_ALTREF = 3,
      GST_VP9_REF_FRAME_MAX    = 4
    } GstVp9RefFrameType;

Reference Frame types

#### Members

`GST_VP9_REF_FRAME_INTRA` (0) –

Intra reference frame

`GST_VP9_REF_FRAME_LAST` (1) –

Last Reference frame

`GST_VP9_REF_FRAME_GOLDEN` (2) –

Golden Reference frame

`GST_VP9_REF_FRAME_ALTREF` (3) –

Alternate Reference frame

`GST_VP9_REF_FRAME_MAX` (4) –
No description available

The results of the search are