Encode Structures#

Structures used by Encode only.

API#

mfxBRCFrameCtrl#

struct mfxBRCFrameCtrl#

Specifies controls for next frame encoding provided by external BRC functions.

Public Members

mfxI32 QpY#

Frame-level Luma QP.

mfxU32 InitialCpbRemovalDelay#

See initial_cpb_removal_delay in codec standard. Ignored if no HRD control: mfxExtCodingOption::VuiNalHrdParameters = MFX_CODINGOPTION_OFF. Calculated by encoder if initial_cpb_removal_delay==0 && initial_cpb_removal_offset == 0 && HRD control is switched on.

mfxU32 InitialCpbRemovalOffset#

See initial_cpb_removal_offset in codec standard. Ignored if no HRD control: mfxExtCodingOption::VuiNalHrdParameters = MFX_CODINGOPTION_OFF. Calculated by encoder if initial_cpb_removal_delay==0 && initial_cpb_removal_offset == 0 && HRD control is switched on.

mfxU32 MaxFrameSize#

Max frame size in bytes. Option for repack feature. Driver calls PAK until current frame size is less than or equal to MaxFrameSize, or number of repacking for this frame is equal to MaxNumRePak. Repack is available if there is driver support, MaxFrameSize !=0, and MaxNumRePak != 0. Ignored if MaxNumRePak == 0.

mfxU8 DeltaQP[8]#

Option for repack feature. Ignored if MaxNumRePak == 0 or MaxNumRePak==0. If current frame size > MaxFrameSize and/or number of repacking (nRepack) for this frame <= MaxNumRePak, PAK is called with QP = mfxBRCFrameCtrl::QpY + Sum(DeltaQP[i]), where i = [0,nRepack]. Non zero DeltaQP[nRepack] are ignored if nRepack > MaxNumRePak. If repacking feature is on ( MaxFrameSize & MaxNumRePak are not zero), it is calculated by the encoder.

mfxU16 MaxNumRepak#

Number of possible repacks in driver if current frame size > MaxFrameSize. Ignored if MaxFrameSize==0. See MaxFrameSize description. Possible values are in the range of 0 to 8.

mfxU16 NumExtParam#

Reserved for future use.

mfxExtBuffer **ExtParam#

Reserved for future use.

mfxBRCFrameParam#

struct mfxBRCFrameParam#

Describes frame parameters required for external BRC functions.

Public Members

mfxU16 SceneChange#

Frame belongs to a new scene if non zero.

mfxU16 LongTerm#

Frame is a Long Term Reference frame if non zero.

mfxU32 FrameCmplx#

Frame Complexity Frame spatial complexity if non zero. Zero if complexity is not available.

mfxU32 EncodedOrder#

The frame number in a sequence of reordered frames starting from encoder Init.

mfxU32 DisplayOrder#

The frame number in a sequence of frames in display order starting from last IDR.

mfxU32 CodedFrameSize#

Size of the frame in bytes after encoding.

mfxU16 FrameType#

Frame type. See FrameType enumerator for possible values.

mfxU16 PyramidLayer#

B-pyramid or P-pyramid layer that the frame belongs to.

mfxU16 NumRecode#

Number of recodings performed for this frame.

mfxU16 NumExtParam#

Reserved for future use.

mfxExtBuffer **ExtParam#

Reserved for future use.

Frame spatial complexity is calculated according to the following formula:

Frame spatial complexity

mfxBRCFrameStatus#

struct mfxBRCFrameStatus#

Specifies instructions for the encoder provided by external BRC after each frame encoding. See the BRCStatus enumerator for details.

Public Members

mfxU32 MinFrameSize#

Size in bytes, coded frame must be padded to when Status = MFX_BRC_PANIC_SMALL_FRAME.

mfxU16 BRCStatus#

BRC status. See the BRCStatus enumerator for possible values.

mfxEncodeCtrl#

struct mfxEncodeCtrl#

Contains parameters for per-frame based encoding control.

Public Members

mfxExtBuffer Header#

This extension buffer doesn’t have assigned buffer ID. Ignored.

mfxU16 MfxNalUnitType#

Type of NAL unit that contains encoding frame. All supported values are defined by MfxNalUnitType enumerator. Other values defined in ITU-T H.265 specification are not supported.

The encoder uses this field only if application sets mfxExtCodingOption3::EnableNalUnitType option to ON during encoder initialization.

Note

Only encoded order is supported. If application specifies this value in display order or uses value inappropriate for current frame or invalid value, then the encoder silently ignores it.

mfxU16 SkipFrame#

Indicates that current frame should be skipped or the number of missed frames before the current frame. See mfxExtCodingOption2::SkipFrame for details.

mfxU16 QP#

If nonzero, this value overwrites the global QP value for the current frame in the constant QP mode.

mfxU16 FrameType#

Encoding frame type. See the FrameType enumerator for details. If the encoder works in the encoded order, the application must specify the frame type. If the encoder works in the display order, only key frames are enforceable.

mfxU16 NumExtParam#

Number of extra control buffers.

mfxU16 NumPayload#

Number of payload records to insert into the bitstream.

mfxExtBuffer **ExtParam#

Pointer to an array of pointers to external buffers that provide additional information or control to the encoder for this frame or field pair. A typical use is to pass the VPP auxiliary data generated by the video processing pipeline to the encoder. See the ExtendedBufferID for the list of extended buffers.

mfxPayload **Payload#

Pointer to an array of pointers to user data (MPEG-2) or SEI messages (H.264) for insertion into the bitstream. For field pictures, odd payloads are associated with the first field and even payloads are associated with the second field. See the mfxPayload structure for payload definitions.

mfxEncodedUnitInfo#

struct mfxEncodedUnitInfo#

Used to report encoded unit information.

Public Members

mfxU16 Type#

Codec-dependent coding unit type (NALU type for AVC/HEVC, start_code for MPEG2 etc).

mfxU32 Offset#

Offset relative to the associated mfxBitstream::DataOffset.

mfxU32 Size#

Unit size, including delimiter.

mfxEncodeStat#

struct mfxEncodeStat#

Returns statistics collected during encoding.

Public Members

mfxU32 NumFrame#

Number of encoded frames.

mfxU64 NumBit#

Number of bits for all encoded frames.

mfxU32 NumCachedFrame#

Number of internally cached frames.

mfxExtAVCEncodedFrameInfo#

struct mfxExtAVCEncodedFrameInfo#

Used by the encoder to report additional information about the encoded picture. The application can attach this buffer to the mfxBitstream structure before calling MFXVideoENCODE_EncodeFrameAsync function. For interlaced content the encoder requires two such structures. They correspond to fields in encoded order.

Note

Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE then the functionality is supported.

Reference Lists

The following structure members are used by the reference lists contained in the parent structure.

mfxU32 FrameOrder#

Frame order of encoded picture.

Frame order of reference picture.

mfxU16 PicStruct#

Picture structure of encoded picture.

Picture structure of reference picture.

mfxU16 LongTermIdx#

Long term index of encoded picture if applicable.

Long term index of reference picture if applicable.

mfxU16 reserved[2]#

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_FRAME_INFO.

mfxU32 MAD#

Mean Absolute Difference between original pixels of the frame and motion compensated (for inter macroblocks) or spatially predicted (for intra macroblocks) pixels. Only luma component, Y plane, is used in calculation.

mfxU16 BRCPanicMode#

Bitrate control was not able to allocate enough bits for this frame. Frame quality may be unacceptably low.

mfxU16 QP#

Luma QP.

mfxU32 SecondFieldOffset#

Offset to second field. Second field starts at mfxBitstream::Data + mfxBitstream::DataOffset + mfxExtAVCEncodedFrameInfo::SecondFieldOffset.

struct mfxExtAVCEncodedFrameInfo::[anonymous] UsedRefListL0[32]#

Reference list that has been used to encode picture.

struct mfxExtAVCEncodedFrameInfo::[anonymous] UsedRefListL1[32]#

Reference list that has been used to encode picture.

mfxExtAVCRefListCtrl#

struct mfxExtAVCRefListCtrl#

Configures reference frame options for the H.264 encoder.

See the Reference List Selection and Long Term Reference Frame sections for more details.

Note

Not all implementations of the encoder support LongTermIdx and ApplyLongTermIdx fields in this structure. The application must use query mode 1 to determine if such functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE and these fields were set to one, then the functionality is supported. If the function fails or sets fields to zero, then the functionality is not supported.

Reference Lists

The following structure members are used by the reference lists contained in the parent structure.

mfxU32 FrameOrder#

Together FrameOrder and PicStruct fields are used to identify reference picture. Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry.

mfxU16 PicStruct#

Together FrameOrder and PicStruct fields are used to identify reference picture. Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry.

mfxU16 ViewId#

Reserved and must be zero.

mfxU16 LongTermIdx#

Index that should be used by the encoder to mark long-term reference frame.

mfxU16 reserved[3]#

Reserved

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_REFLIST_CTRL.

mfxU16 NumRefIdxL0Active#

Specify the number of reference frames in the active reference list L0. This number should be less or equal to the NumRefFrame parameter from encoding initialization.

mfxU16 NumRefIdxL1Active#

Specify the number of reference frames in the active reference list L1. This number should be less or equal to the NumRefFrame parameter from encoding initialization.

struct mfxExtAVCRefListCtrl::[anonymous] PreferredRefList[32]#

Reference list that specifies the list of frames that should be used to predict the current frame.

struct mfxExtAVCRefListCtrl::[anonymous] RejectedRefList[16]#

Reference list that specifies the list of frames that should not be used for prediction.

struct mfxExtAVCRefListCtrl::[anonymous] LongTermRefList[16]#

Reference list that specifies the list of frames that should be marked as long-term reference frame.

mfxU16 ApplyLongTermIdx#

If it is equal to zero, the encoder assigns long-term index according to internal algorithm. If it is equal to one, the encoder uses LongTermIdx value as long-term index.

mfxExtAVCRefLists#

struct mfxExtAVCRefLists#

Specifies reference lists for the encoder. It may be used together with the mfxExtAVCRefListCtrl structure to create customized reference lists. If both structures are used together, then the encoder takes reference lists from the mfxExtAVCRefLists structure and modifies them according to the mfxExtAVCRefListCtrl instructions. In case of interlaced coding, the first mfxExtAVCRefLists structure affects TOP field and the second - BOTTOM field.

Note

Not all implementations of the encoder support this structure. The application must use the Query API function to determine if it is supported.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_REFLISTS.

mfxU16 NumRefIdxL0Active#

Specify the number of reference frames in the active reference list L0. This number should be less than or equal to the NumRefFrame parameter from encoding initialization.

mfxU16 NumRefIdxL1Active#

Specify the number of reference frames in the active reference list L1. This number should be less than or equal to the NumRefFrame parameter from encoding initialization.

struct mfxExtAVCRefLists::mfxRefPic RefPicList0[32]#

Specify L0 reference list.

struct mfxExtAVCRefLists::mfxRefPic RefPicList1[32]#

Specify L1 reference list.

struct mfxRefPic#

Used by the reference lists contained in the parent structure. Together these fields are used to identify reference picture.

Public Members

mfxU32 FrameOrder#

Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry.

mfxU16 PicStruct#

Use PicStruct = MFX_PICSTRUCT_FIELD_TFF for TOP field, PicStruct = MFX_PICSTRUCT_FIELD_BFF for BOTTOM field.

mfxExtAVCRoundingOffset#

struct mfxExtAVCRoundingOffset#

Used by encoders to set rounding offset parameters for quantization. It is per-frame based encoding control, and can be attached to some frames and skipped for others. When the extension buffer is set the application can attach it to the mfxEncodeCtrl during runtime.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_ROUNDING_OFFSET.

mfxU16 EnableRoundingIntra#

Enable rounding offset for intra blocks. See the CodingOptionValue enumerator for values of this option.

mfxU16 RoundingOffsetIntra#

Intra rounding offset. Value must be in the range of 0 to 7, inclusive.

mfxU16 EnableRoundingInter#

Enable rounding offset for inter blocks. See the CodingOptionValue enumerator for values of this option.

mfxU16 RoundingOffsetInter#

Inter rounding offset. Value must be in the range of 0 to 7, inclusive.

mfxExtAvcTemporalLayers#

struct mfxExtAvcTemporalLayers#

Configures the H.264 temporal layers hierarchy.

If the application attaches it to the mfxVideoParam structure during initialization, the encoder generates the temporal layers and inserts the prefix NAL unit before each slice to indicate the temporal and priority IDs of the layer.

This structure can be used with the display-order encoding mode only.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_TEMPORAL_LAYERS.

mfxU16 BaseLayerPID#

The priority ID of the base layer. The encoder increases the ID for each temporal layer and writes to the prefix NAL unit.

mfxU16 Scale#

The ratio between the frame rates of the current temporal layer and the base layer.

mfxExtBRC#

struct mfxExtBRC#

Contains a set of callbacks to perform external bitrate control. Can be attached to the mfxVideoParam structure during encoder initialization. Set the mfxExtCodingOption2::ExtBRC option to ON to make the encoder use the external BRC instead of the native one.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_BRC.

mfxHDL pthis#

Pointer to the BRC object.

mfxStatus (*Init)(mfxHDL pthis, mfxVideoParam *par)#

Initializes the BRC session according to parameters from input mfxVideoParam and attached structures. It does not modify the input mfxVideoParam and attached structures. Invoked during MFXVideoENCODE_Init.

Parameters
  • pthis[in] Pointer to the BRC object.

  • par[in] Pointer to the mfxVideoParam structure that was used for the encoder initialization.

Returns

MFX_ERR_NONE The function completed successfully.

MFX_ERR_UNSUPPORTED The function detected unsupported video parameters.

mfxStatus (*Reset)(mfxHDL pthis, mfxVideoParam *par)#

Resets BRC session according to new parameters. It does not modify the input mfxVideoParam and attached structures. Invoked during MFXVideoENCODE_Reset.

Parameters
  • pthis[in] Pointer to the BRC object.

  • par[in] Pointer to the mfxVideoParam structure that was used for the encoder initialization.

Returns

MFX_ERR_NONE The function completed successfully.

MFX_ERR_UNSUPPORTED The function detected unsupported video parameters.

MFX_ERR_INCOMPATIBLE_VIDEO_PARAM The function detected that the video parameters provided by the application are incompatible with initialization parameters. Reset requires additional memory allocation and cannot be executed.

mfxStatus (*Close)(mfxHDL pthis)#

Deallocates any internal resources acquired in Init for this BRC session. Invoked during MFXVideoENCODE_Close.

Parameters

pthis[in] Pointer to the BRC object.

Returns

MFX_ERR_NONE The function completed successfully.

mfxStatus (*GetFrameCtrl)(mfxHDL pthis, mfxBRCFrameParam *par, mfxBRCFrameCtrl *ctrl)#

Returns controls (ctrl) to encode next frame based on info from input mfxBRCFrameParam structure (par) and internal BRC state. Invoked asynchronously before each frame encoding or recoding.

Parameters
  • pthis[in] Pointer to the BRC object.

  • par[in] Pointer to the mfxVideoParam structure that was used for the encoder initialization.

  • ctrl[out] Pointer to the output mfxBRCFrameCtrl structure.

Returns

MFX_ERR_NONE The function completed successfully.

mfxStatus (*Update)(mfxHDL pthis, mfxBRCFrameParam *par, mfxBRCFrameCtrl *ctrl, mfxBRCFrameStatus *status)#

Updates internal BRC state and returns status to instruct encoder whether it should recode the previous frame, skip the previous frame, do padding, or proceed to next frame based on info from input mfxBRCFrameParam and mfxBRCFrameCtrl structures. Invoked asynchronously after each frame encoding or recoding.

Parameters
  • pthis[in] Pointer to the BRC object.

  • par[in] Pointer to the mfxVideoParam structure that was used for the encoder initialization.

  • ctrl[in] Pointer to the output mfxBRCFrameCtrl structure.

  • status[in] Pointer to the output mfxBRCFrameStatus structure.

Returns

MFX_ERR_NONE The function completed successfully.

mfxExtChromaLocInfo#

struct mfxExtChromaLocInfo#

Members of this structure define the location of chroma samples information.

See Annex E of the ISO*\/IEC* 14496-10 specification for the definition of these parameters.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CHROMA_LOC_INFO.

mfxU16 ChromaLocInfoPresentFlag#
mfxU16 ChromaSampleLocTypeTopField#
mfxU16 ChromaSampleLocTypeBottomField#
mfxU16 reserved[9]#

mfxExtCodingOption#

struct mfxExtCodingOption#

Specifies additional options for encoding.

The application can attach this extended buffer to the mfxVideoParam structure to configure initialization.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION.

mfxU16 RateDistortionOpt#

Set this flag if rate distortion optimization is needed. See the CodingOptionValue enumerator for values of this option.

mfxU16 MECostType#

Motion estimation cost type. This value is reserved and must be zero.

mfxU16 MESearchType#

Motion estimation search algorithm. This value is reserved and must be zero.

mfxI16Pair MVSearchWindow#

Rectangular size of the search window for motion estimation. This parameter is reserved and must be (0, 0).

mfxU16 FramePicture#

Set this flag to encode interlaced fields as interlaced frames. This flag does not affect progressive input frames. See the CodingOptionValue enumerator for values of this option.

mfxU16 CAVLC#

If set, CAVLC is used; if unset, CABAC is used for encoding. See the CodingOptionValue enumerator for values of this option.

mfxU16 RecoveryPointSEI#

Set this flag to insert the recovery point SEI message at the beginning of every intra refresh cycle. See the description of IntRefType in mfxExtCodingOption2 structure for details on how to enable and configure intra refresh.

If intra refresh is not enabled then this flag is ignored.

See the CodingOptionValue enumerator for values of this option.

mfxU16 ViewOutput#

Set this flag to instruct the MVC encoder to output each view in separate bitstream buffer. See the CodingOptionValue enumerator for values of this option and the Multi-View Video Coding section for more details about usage of this flag.

mfxU16 NalHrdConformance#

If this option is turned ON, then AVC encoder produces an HRD conformant bitstream. If it is turned OFF, then the AVC encoder may (but not necessarily) violate HRD conformance. That is, this option can force the encoder to produce an HRD conformant stream, but cannot force it to produce a non-conformant stream.

See the CodingOptionValue enumerator for values of this option.

mfxU16 SingleSeiNalUnit#

If set, encoder puts all SEI messages in the singe NAL unit. It includes messages provided by application and created by encoder. It is a three-states option. See CodingOptionValue enumerator for values of this option. The three states are:

  • UNKNOWN Put each SEI in its own NAL unit.

  • ON Put all SEI messages in the same NAL unit.

  • OFF The same as unknown.

mfxU16 VuiVclHrdParameters#

If set and VBR rate control method is used, then VCL HRD parameters are written in bitstream with values identical to the values of the NAL HRD parameters. See the CodingOptionValue enumerator for values of this option.

mfxU16 RefPicListReordering#

Set this flag to activate reference picture list reordering. This value is reserved and must be zero.

mfxU16 ResetRefList#

Set this flag to reset the reference list to non-IDR I-frames of a GOP sequence. See the CodingOptionValue enumerator for values of this option.

mfxU16 RefPicMarkRep#

Set this flag to write the reference picture marking repetition SEI message into the output bitstream. See the CodingOptionValue enumerator for values of this option.

mfxU16 FieldOutput#

Set this flag to instruct the AVC encoder to output bitstreams immediately after the encoder encodes a field, in the field-encoding mode. See the CodingOptionValue enumerator for values of this option.

mfxU16 IntraPredBlockSize#

Minimum block size of intra-prediction. This value is reserved and must be zero.

mfxU16 InterPredBlockSize#

Minimum block size of inter-prediction. This value is reserved and must be zero.

mfxU16 MVPrecision#

Specify the motion estimation precision. This parameter is reserved and must be zero.

mfxU16 MaxDecFrameBuffering#

Specifies the maximum number of frames buffered in a DPB. A value of zero means unspecified.

mfxU16 AUDelimiter#

Set this flag to insert the Access Unit Delimiter NAL. See the CodingOptionValue enumerator for values of this option.

mfxU16 PicTimingSEI#

Set this flag to insert the picture timing SEI with pic_struct syntax element. See sub-clauses D.1.2 and D.2.2 of the ISO/IEC 14496-10 specification for the definition of this syntax element. See the CodingOptionValue enumerator for values of this option. The default value is ON.

mfxU16 VuiNalHrdParameters#

Set this flag to insert NAL HRD parameters in the VUI header. See the CodingOptionValue enumerator for values of this option.

mfxExtCodingOption2#

struct mfxExtCodingOption2#

Used with the mfxExtCodingOption structure to specify additional options for encoding.

The application can attach this extended buffer to the mfxVideoParam structure to configure initialization and to the mfxEncodeCtrl during runtime.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION2.

mfxU16 IntRefType#

Specifies intra refresh type. See the IntraRefreshTypes. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I-frames. The encoder achieves this by encoding part of each frame in the refresh cycle using intra MBs.

This parameter is valid during initialization and runtime. When used with temporal scalability, intra refresh applied only to base layer.

MFX_REFRESH_NO No refresh.

MFX_REFRESH_VERTICAL Vertical refresh, by column of MBs.

MFX_REFRESH_HORIZONTAL Horizontal refresh, by rows of MBs.

MFX_REFRESH_SLICE Horizontal refresh by slices without overlapping.

MFX_REFRESH_SLICE Library ignores IntRefCycleSize (size of refresh cycle equals number slices).

mfxU16 IntRefCycleSize#

Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are invalid values. This parameter is valid only during initialization.

mfxI16 IntRefQPDelta#

Specifies QP difference for inserted intra MBs. Signed values are in the -51 to 51 range. This parameter is valid during initialization and runtime.

mfxU32 MaxFrameSize#

Specify maximum encoded frame size in byte. This parameter is used in VBR based bitrate control modes and ignored in others. The encoder tries to keep frame size below specified limit but minor overshoots are possible to preserve visual quality. This parameter is valid during initialization and runtime. It is recommended to set MaxFrameSize to 5x-10x target frame size ((TargetKbps*1000)/(8* FrameRateExtN/FrameRateExtD)) for I-frames and 2x-4x target frame size for P- and B-frames.

mfxU32 MaxSliceSize#

Specify maximum slice size in bytes. If this parameter is specified other controls over number of slices are ignored.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU16 BitrateLimit#

Modifies bitrate to be in the range imposed by the encoder. The default value is ON, that is, bitrate is limited. Setting this flag to OFF may lead to violation of HRD conformance.Specifying bitrate below the encoder range might significantly affect quality.

If set to ON, this option takes effect in non CQP modes: if TargetKbps is not in the range imposed by the encoder, it will be changed to be in the range.

This parameter is valid only during initialization. Flag works with MFX_CODEC_AVC only, it is ignored with other codecs. See the CodingOptionValue enumerator for values of this option.

mfxU16 MBBRC#

Setting this flag enables macroblock level bitrate control that generally improves subjective visual quality. Enabling this flag may have negative impact on performance and objective visual quality metric. See the CodingOptionValue enumerator for values of this option. The default value depends on target usage settings.

mfxU16 ExtBRC#

Set this option to ON to enable external BRC. See the CodingOptionValue enumerator for values of this option. Use the Query API function to check if this feature is supported.

mfxU16 LookAheadDepth#

Specifies the depth of the look ahead rate control algorithm. The depth value is the number of frames that the encoder analyzes before encoding. Values are in the 10 to 100 range, inclusive. To instruct the encoder to use the default value the application should zero this field.

mfxU16 Trellis#

Used to control trellis quantization in AVC encoder. See TrellisControl enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 RepeatPPS#

Controls picture parameter set repetition in AVC encoder. Set this flag to ON to repeat PPS with each frame. See the CodingOptionValue enumerator for values of this option. The default value is ON. This parameter is valid only during initialization.

mfxU16 BRefType#

Controls usage of B-frames as reference. See BRefControl enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 AdaptiveI#

Controls insertion of I-frames by the encoder. Set this flag to ON to allow changing of frame type from P and B to I. This option is ignored if GopOptFlag in mfxInfoMFX structure is equal to MFX_GOP_STRICT. See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 AdaptiveB#

Controls changing of frame type from B to P. Set this flag to ON enable changing of frame type from B to P. This option is ignored if GopOptFlag in mfxInfoMFX structure is equal to MFX_GOP_STRICT. See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 LookAheadDS#

Controls down sampling in look ahead bitrate control mode. See LookAheadDownSampling enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 NumMbPerSlice#

Specifies suggested slice size in number of macroblocks. The library can adjust this number based on platform capability. If this option is specified, that is, if it is not equal to zero, the library ignores mfxInfoMFX::NumSlice parameter.

mfxU16 SkipFrame#

Enables usage of mfxEncodeCtrl::SkipFrame parameter. See the SkipFrame enumerator for values of this option.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU8 MinQPI#

Minimum allowed QP value for I-frame types. Valid range is 1 to 51 inclusive. Zero means default value, that is, no limitations on QP.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU8 MaxQPI#

Maximum allowed QP value for I-frame types. Valid range is 1 to 51 inclusive. Zero means default value, that is, no limitations on QP.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU8 MinQPP#

Minimum allowed QP value for P-frame types. Valid range is 1 to 51 inclusive. Zero means default value, that is, no limitations on QP.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU8 MaxQPP#

Maximum allowed QP value for P-frame types. Valid range is 1 to 51 inclusive. Zero means default value, that is, no limitations on QP.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU8 MinQPB#

Minimum allowed QP value for B-frame types. Valid range is 1 to 51 inclusive. Zero means default value, that is, no limitations on QP.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU8 MaxQPB#

Maximum allowed QP value for B-frame types. Valid range is 1 to 51 inclusive. Zero means default value, that is, no limitations on QP.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU16 FixedFrameRate#

Sets fixed_frame_rate_flag in VUI.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU16 DisableDeblockingIdc#

Disables deblocking.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU16 DisableVUI#

Completely disables VUI in the output bitstream.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU16 BufferingPeriodSEI#

Controls insertion of buffering period SEI in the encoded bitstream. It should be one of the following values:

MFX_BPSEI_DEFAULT Encoder decides when to insert BP SEI,

MFX_BPSEI_IFRAME BP SEI should be inserted with every I-frame.

mfxU16 EnableMAD#

Set this flag to ON to enable per-frame reporting of Mean Absolute Difference. This parameter is valid only during initialization.

mfxU16 UseRawRef#

Set this flag to ON to use raw frames for reference instead of reconstructed frames. This parameter is valid during initialization and runtime (only if was turned ON during initialization).

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxExtCodingOption3#

struct mfxExtCodingOption3#

Used with mfxExtCodingOption and mfxExtCodingOption2 structures to specify additional options for encoding. The application can attach this extended buffer to the mfxVideoParam structure to configure initialization and to the mfxEncodeCtrl during runtime.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION3.

mfxU16 NumSliceI#

The number of slices for I-frames.

Note

Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported

mfxU16 NumSliceP#

The number of slices for P-frames.

Note

Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported

mfxU16 NumSliceB#

The number of slices for B-frames.

Note

Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported

mfxU16 WinBRCMaxAvgKbps#

When rate control method is MFX_RATECONTROL_VBR, MFX_RATECONTROL_LA, MFX_RATECONTROL_LA_HRD, or MFX_RATECONTROL_QVBR this parameter specifies the maximum bitrate averaged over a sliding window specified by WinBRCSize. For MFX_RATECONTROL_CBR this parameter is ignored and equals TargetKbps.

mfxU16 WinBRCSize#

When rate control method is MFX_RATECONTROL_CBR, MFX_RATECONTROL_VBR, MFX_RATECONTROL_LA, MFX_RATECONTROL_LA_HRD, or MFX_RATECONTROL_QVBR this parameter specifies sliding window size in frames. Set this parameter to zero to disable sliding window.

mfxU16 QVBRQuality#

When rate control method is MFX_RATECONTROL_QVBR, this parameter specifies quality factor. Values are in the 1 to 51 range, where 1 corresponds to the best quality.

mfxU16 EnableMBQP#

Set this flag to ON to enable per-macroblock QP control. Rate control method must be MFX_RATECONTROL_CQP. See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 IntRefCycleDist#

Distance between the beginnings of the intra-refresh cycles in frames. Zero means no distance between cycles.

mfxU16 DirectBiasAdjustment#

Set this flag to ON to enable the ENC mode decision algorithm to bias to fewer B Direct/Skip types. Applies only to B-frames, all other frames will ignore this setting. See the CodingOptionValue enumerator for values of this option.

mfxU16 GlobalMotionBiasAdjustment#

Enables global motion bias. See the CodingOptionValue enumerator for values of this option.

mfxU16 MVCostScalingFactor#

Values are:

  • 0: Set MV cost to be 0.

  • 1: Scale MV cost to be 1/2 of the default value.

  • 2: Scale MV cost to be 1/4 of the default value.

  • 3: Scale MV cost to be 1/8 of the default value.

mfxU16 MBDisableSkipMap#

Set this flag to ON to enable usage of mfxExtMBDisableSkipMap. See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 WeightedPred#

Weighted prediction mode. See the WeightedPred enumerator for values of these options.

mfxU16 WeightedBiPred#

Weighted prediction mode. See the WeightedPred enumerator for values of these options.

mfxU16 AspectRatioInfoPresent#

Instructs encoder whether aspect ratio info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.

mfxU16 OverscanInfoPresent#

Instructs encoder whether overscan info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.

mfxU16 OverscanAppropriate#

ON indicates that the cropped decoded pictures output are suitable for display using overscan. OFF indicates that the cropped decoded pictures output contain visually important information in the entire region out to the edges of the cropping rectangle of the picture. See the CodingOptionValue enumerator for values of this option.

mfxU16 TimingInfoPresent#

Instructs encoder whether frame rate info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.

mfxU16 BitstreamRestriction#

Instructs encoder whether bitstream restriction info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.

mfxU16 LowDelayHrd#

Corresponds to AVC syntax element low_delay_hrd_flag (VUI). See the CodingOptionValue enumerator for values of this option.

mfxU16 MotionVectorsOverPicBoundaries#

When set to OFF, no sample outside the picture boundaries and no sample at a fractional sample position for which the sample value is derived using one or more samples outside the picture boundaries is used for inter prediction of any sample.

When set to ON, one or more samples outside picture boundaries may be used in inter prediction.

See the CodingOptionValue enumerator for values of this option.

mfxU16 ScenarioInfo#

Provides a hint to encoder about the scenario for the encoding session. See the ScenarioInfo enumerator for values of this option.

mfxU16 ContentInfo#

Provides a hint to encoder about the content for the encoding session. See the ContentInfo enumerator for values of this option.

mfxU16 PRefType#

When GopRefDist=1, specifies the model of reference list construction and DPB management. See the PRefType enumerator for values of this option.

mfxU16 FadeDetection#

Instructs encoder whether internal fade detection algorithm should be used for calculation of weigh/offset values for pred_weight_table unless application provided mfxExtPredWeightTable for this frame. See the CodingOptionValue enumerator for values of this option.

mfxU16 GPB#

Set this flag to OFF to make HEVC encoder use regular P-frames instead of GPB. See the CodingOptionValue enumerator for values of this option.

mfxU32 MaxFrameSizeI#

Same as mfxExtCodingOption2::MaxFrameSize but affects only I-frames. MaxFrameSizeI must be set if MaxFrameSizeP is set. If MaxFrameSizeI is not specified or greater than spec limitation, spec limitation will be applied to the sizes of I-frames.

mfxU32 MaxFrameSizeP#

Same as mfxExtCodingOption2::MaxFrameSize but affects only P/B-frames. If MaxFrameSizeP equals 0, the library sets MaxFrameSizeP equal to MaxFrameSizeI. If MaxFrameSizeP is not specified or greater than spec limitation, spec limitation will be applied to the sizes of P/B-frames.

mfxU16 EnableQPOffset#

Enables QPOffset control. See the CodingOptionValue enumerator for values of this option.

mfxI16 QPOffset[8]#

Specifies QP offset per pyramid layer when EnableQPOffset is set to ON and RateControlMethod is CQP.

For B-pyramid, B-frame QP = QPB + QPOffset[layer].

For P-pyramid, P-frame QP = QPP + QPOffset[layer].

mfxU16 NumRefActiveP[8]#

Max number of active references for P-frames. Array index is pyramid layer.

mfxU16 NumRefActiveBL0[8]#

Max number of active references for B-frames in reference picture list 0. Array index is pyramid layer.

mfxU16 NumRefActiveBL1[8]#

Max number of active references for B-frames in reference picture list 1. Array index is pyramid layer.

mfxU16 TransformSkip#

For HEVC if this option is turned ON, the transform_skip_enabled_flag will be set to 1 in PPS. OFF specifies that transform_skip_enabled_flag will be set to 0.

mfxU16 TargetChromaFormatPlus1#

Minus 1 specifies target encoding chroma format (see ChromaFormatIdc enumerator). May differ from the source format. TargetChromaFormatPlus1 = 0 specifies the default target chroma format which is equal to source (mfxVideoParam::mfx::FrameInfo::ChromaFormat + 1), except RGB4 source format. In case of RGB4 source format default target , chroma format is 4:2:0 (instead of 4:4:4) for the purpose of backward compatibility.

mfxU16 TargetBitDepthLuma#

Target encoding bit-depth for luma samples. May differ from source bit-depth. 0 specifies a default target bit-depth that is equal to source (mfxVideoParam::mfx::FrameInfo::BitDepthLuma).

mfxU16 TargetBitDepthChroma#

Target encoding bit-depth for chroma samples. May differ from source bit-depth. 0 specifies a default target bit-depth that is equal to source (mfxVideoParam::mfx::FrameInfo::BitDepthChroma).

mfxU16 BRCPanicMode#

Controls panic mode in AVC and MPEG2 encoders.

mfxU16 LowDelayBRC#

When rate control method is MFX_RATECONTROL_VBR, MFX_RATECONTROL_QVBR or MFX_RATECONTROL_VCM this parameter specifies frame size tolerance. Set this parameter to MFX_CODINGOPTION_ON to allow strictly obey average frame size set by MaxKbps, for example cases when MaxFrameSize == (MaxKbps*1000)/(8* FrameRateExtN/FrameRateExtD). Also MaxFrameSizeI and MaxFrameSizeP can be set separately.

mfxU16 EnableMBForceIntra#

Set this flag to ON to enable usage of mfxExtMBForceIntra for AVC encoder. See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.

mfxU16 AdaptiveMaxFrameSize#

If this flag is set to ON, BRC may decide a larger P- or B-frame size than what MaxFrameSizeP dictates when the scene change is detected. It may benefit the video quality. AdaptiveMaxFrameSize feature is not supported with LowPower ON or if the value of MaxFrameSizeP = 0.

mfxU16 RepartitionCheckEnable#

Controls AVC encoder attempts to predict from small partitions. Default value allows encoder to choose preferred mode. MFX_CODINGOPTION_ON forces encoder to favor quality and MFX_CODINGOPTION_OFF forces encoder to favor performance.

mfxU16 EncodedUnitsInfo#

Set this flag to ON to make encoded units info available in mfxExtEncodedUnitsInfo.

mfxU16 EnableNalUnitType#

If this flag is set to ON, the HEVC encoder uses the NAL unit type provided by the application in the mfxEncodeCtrl::MfxNalUnitType field. This parameter is valid only during initialization.

Note

Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.

mfxU16 AdaptiveLTR#

If this flag is set to ON, encoder will mark, modify, or remove LTR frames based on encoding parameters and content

properties. Turn OFF to prevent Adaptive marking of Long Term Reference Frames.

mfxU16 AdaptiveCQM#

If this flag is set to ON, encoder adaptively selects one of implementation-defined quantization matrices for each frame. Non-default quantization matrices aim to improve subjective visual quality under certain conditions. Their number and definitions are API implementation specific. If this flag is set to OFF, default quantization matrix is used for all frames. This parameter is valid only during initialization.

mfxU16 AdaptiveRef#

If this flag is set to ON, encoder adaptively selects list of reference frames to improve encoding quality. Enabling of the flag can increase computation complexity and introduce additional delay. If this flag is set to OFF, regular reference frames are used for encoding.

mfxU16 CPUEncToolsProcessing#

The tri-state option specifies hint for the library to execute encoding tools processing on CPU. It may give better encoding quality, but leads to higher CPU utilization. The library can ignore MFX_CODINGOPTION_ON if processing on CPU is not supported.

mfxExtCodingOptionSPSPPS#

struct mfxExtCodingOptionSPSPPS#

Attach this structure as part of the extended buffers to configure the encoder during MFXVideoENCODE_Init. The sequence or picture parameters specified by this structure overwrite any parameters specified by the structure or any other attached extended buffers attached.

For H.264, SPSBuffer and PPSBuffer must point to valid bitstreams that contain the sequence parameter set and picture parameter set, respectively.

For MPEG-2, SPSBuffer must point to valid bitstreams that contain the sequence header followed by any sequence header extension. The PPSBuffer pointer is ignored.

The encoder imports parameters from these buffers. If the encoder does not support the specified parameters, the encoder does not initialize and returns the status code MFX_ERR_INCOMPATIBLE_VIDEO_PARAM.

Check with the MFXVideoENCODE_Query function for the support of this multiple segment encoding feature. If this feature is not supported, the query returns MFX_ERR_UNSUPPORTED.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION_SPSPPS.

mfxU8 *SPSBuffer#

Pointer to a valid bitstream that contains the SPS (sequence parameter set for H.264 or sequence header followed by any sequence header extension for MPEG-2) buffer. Can be NULL to skip specifying the SPS.

mfxU8 *PPSBuffer#

Pointer to a valid bitstream that contains the PPS (picture parameter set for H.264 or picture header followed by any picture header extension for MPEG-2) buffer. Can be NULL to skip specifying the PPS.

mfxU16 SPSBufSize#

Size of the SPS in bytes.

mfxU16 PPSBufSize#

Size of the PPS in bytes.

mfxU16 SPSId#

SPS identifier. The value is reserved and must be zero.

mfxU16 PPSId#

PPS identifier. The value is reserved and must be zero.

mfxExtCodingOptionVPS#

struct mfxExtCodingOptionVPS#

Attach this structure as part of the extended buffers to configure the encoder during MFXVideoENCODE_Init. The sequence or picture parameters specified by this structure overwrite any parameters specified by the structure or any other attached extended buffers attached.

If the encoder does not support the specified parameters, the encoder does not initialize and returns the status code MFX_ERR_INCOMPATIBLE_VIDEO_PARAM.

Check with the MFXVideoENCODE_Query function for the support of this multiple segment encoding feature. If this feature is not supported, the query returns MFX_ERR_UNSUPPORTED.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION_VPS.

mfxU8 *VPSBuffer#

Pointer to a valid bitstream that contains the VPS (video parameter set for HEVC) buffer.

mfxU16 VPSBufSize#

Size of the VPS in bytes.

mfxU16 VPSId#

VPS identifier; the value is reserved and must be zero.

mfxExtDirtyRect#

struct mfxExtDirtyRect#

Used by the application to specify dirty regions within a frame during encoding. It may be used at initialization or at runtime.

Dirty rectangle definition is using end-point exclusive notation. In other words, the pixel with (Right, Bottom) coordinates lies immediately outside of the dirty rectangle. Left, Top, Right, Bottom should be aligned by codec-specific block boundaries (should be dividable by 16 for AVC, or by block size (8, 16, 32 or 64, depends on platform) for HEVC).

Every dirty rectangle with unaligned coordinates will be expanded to a minimal-area block-aligned dirty rectangle, enclosing the original one. For example, a (5, 5, 15, 31) dirty rectangle will be expanded to (0, 0, 16, 32) for AVC encoder, or to (0, 0, 32, 32) for HEVC, if block size is 32.

Dirty rectangle (0, 0, 0, 0) is a valid dirty rectangle and means that the frame is not changed.

Dirty rectangle coordinates

The following structure members are used by the Rect array contained in the parent structure.

mfxU32 Left#

Dirty region left coordinate.

mfxU32 Top#

Dirty region top coordinate.

mfxU32 Right#

Dirty region right coordinate.

mfxU32 Bottom#

Dirty region bottom coordinate.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_DIRTY_RECTANGLES.

mfxU16 NumRect#

Number of dirty rectangles.

struct mfxExtDirtyRect::[anonymous] Rect[256]#

Array of dirty rectangles.

mfxExtEncodedUnitsInfo#

struct mfxExtEncodedUnitsInfo#

If mfxExtCodingOption3::EncodedUnitsInfo was set to MFX_CODINGOPTION_ON during encoder initialization, the mfxExtEncodedUnitsInfo structure is attached to the mfxBitstream structure during encoding. It is used to report information about coding units in the resulting bitstream.

The number of filled items in UnitInfo is min(NumUnitsEncoded, NumUnitsAlloc).

For counting a minimal amount of encoded units you can use the following algorithm:

nSEI = amountOfApplicationDefinedSEI;
if (CodingOption3.NumSlice[IPB] != 0 || mfxVideoParam.mfx.NumSlice != 0)
  ExpectedAmount = 10 + nSEI + Max(CodingOption3.NumSlice[IPB], mfxVideoParam.mfx.NumSlice);
else if (CodingOption2.NumMBPerSlice != 0)
  ExpectedAmount = 10 + nSEI + (FrameWidth * FrameHeight) / (256 * CodingOption2.NumMBPerSlice);
else if (CodingOption2.MaxSliceSize != 0)
  ExpectedAmount = 10 + nSEI + Round(MaxBitrate / (FrameRate*CodingOption2.MaxSliceSize));
else
  ExpectedAmount = 10 + nSEI;

if (mfxFrameInfo.PictStruct != MFX_PICSTRUCT_PROGRESSIVE)
  ExpectedAmount = ExpectedAmount * 2;

if (temporalScaleabilityEnabled)
  ExpectedAmount = ExpectedAmount * 2;

Note

Only supported by the AVC encoder.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_UNITS_INFO.

mfxEncodedUnitInfo *UnitInfo#

Pointer to an array of mfxEncodedUnitsInfo structures whose size is equal to or greater than NumUnitsAlloc.

mfxU16 NumUnitsAlloc#

UnitInfo array size.

mfxU16 NumUnitsEncoded#

Output field. Number of coding units to report. If NumUnitsEncoded is greater than NumUnitsAlloc, the UnitInfo array will contain information only for the first NumUnitsAlloc units. User may consider reallocating the UnitInfo array to avoid this for subsequent frames.

mfxExtEncoderCapability#

struct mfxExtEncoderCapability#

Used to retrieve encoder capability. See the description of mode 4 of the MFXVideoENCODE_Query function for details on how to use this structure.

Note

Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE then the functionality is supported.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_CAPABILITY.

mfxU32 MBPerSec#

Specify the maximum processing rate in macro blocks per second.

mfxExtEncoderIPCMArea#

struct mfxExtEncoderIPCMArea#

Specifies rectangle areas for IPCM coding mode.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_IPCM_AREA.

struct mfxExtEncoderIPCMArea::area *Areas#

Array of areas.

struct area#

Number of areas

Public Members

mfxU32 Left#

Left area coordinate.

mfxU32 Top#

Top area coordinate.

mfxU32 Right#

Right area coordinate.

mfxU32 Bottom#

Bottom area coordinate.

mfxExtEncoderResetOption#

struct mfxExtEncoderResetOption#

Used to control the encoder behavior during reset. By using this structure, the application instructs the encoder to start a new coded sequence after reset or to continue encoding of the current sequence.

This structure is also used in mode 3 of the MFXVideoENCODE_Query function to check for reset outcome before actual reset. The application should set StartNewSequence to the required behavior and call the query function. If the query fails (see status codes below), then reset is not possible in current encoder state. If the application sets StartNewSequence to MFX_CODINGOPTION_UNKNOWN, then the query function replaces the coding option with the actual reset type: MFX_CODINGOPTION_ON if the encoder will begin a new sequence after reset or MFX_CODINGOPTION_OFF if the encoder will continue the current sequence.

Using this structure may cause one of the following status codes from the MFXVideoENCODE_Reset and MFXVideoENCODE_Queryfunctions:

  • MFX_ERR_INVALID_VIDEO_PARAM If a reset is not possible. For example, the application sets StartNewSequence to off and requests resolution change.

  • MFX_ERR_INCOMPATIBLE_VIDEO_PARAM If the application requests change that leads to memory allocation. For example, the application sets StartNewSequence to on and requests resolution change to greater than the initialization value.

  • MFX_ERR_NONE If reset is possible.

The following limited list of parameters can be changed without starting a new coded sequence:

  • The bitrate parameters, TargetKbps and MaxKbps, in the mfxInfoMFX structure.

  • The number of slices, NumSlice, in the mfxInfoMFX structure. Number of slices should be equal to or less than the number of slices during initialization.

  • The number of temporal layers in the mfxExtAvcTemporalLayers structure. Reset should be called immediately before encoding of frame from base layer and number of reference frames should be large enough for the new temporal layers structure.

  • The quantization parameters, QPI, QPP and QPB, in the mfxInfoMFX structure.

The application should retrieve all cached frames before calling reset. When the Query API function checks for reset outcome, it expects that this requirement be satisfied. If it is not true and there are some cached frames inside the encoder, then the query result may differ from the reset result, because the encoder may insert an IDR frame to produce valid coded sequence.

See the Configuration Change section for more information.

See the Streaming and Video Conferencing Features section for more information.

Note

Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE, then the functionality is supported.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_RESET_OPTION.

mfxU16 StartNewSequence#

Instructs encoder to start new sequence after reset. Use one of the CodingOptionValue options:

  • MFX_CODINGOPTION_ON The encoder completely reset internal state and begins new coded sequence after reset, including insertion of IDR frame, sequence, and picture headers.

  • MFX_CODINGOPTION_OFF The encoder continues encoding of current coded sequence after reset, without insertion of IDR frame.

  • MFX_CODINGOPTION_UNKNOWN Depending on the current encoder state and changes in configuration parameters, the encoder may or may not start new coded sequence. This value is also used to query reset outcome.

mfxExtEncoderROI#

struct mfxExtEncoderROI#

Used by the application to specify different Region Of Interests during encoding. It may be used at initialization or at runtime.

ROI location rectangle

The ROI rectangle definition uses end-point exclusive notation. In other words, the pixel with (Right, Bottom) coordinates lies immediately outside of the ROI. Left, Top, Right, Bottom should be aligned by codec-specific block boundaries (should be dividable by 16 for AVC, or by 32 for HEVC). Every ROI with unaligned coordinates will be expanded by the library to minimal-area block-aligned ROI, enclosing the original one. For example (5, 5, 15, 31) ROI will be expanded to (0, 0, 16, 32) for AVC encoder, or to (0, 0, 32, 32) for HEVC.

mfxU32 Left#

Left ROI’s coordinate.

mfxU32 Top#

Top ROI’s coordinate.

mfxU32 Right#

Right ROI’s coordinate.

mfxU32 Bottom#

Bottom ROI’s coordinate.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_ROI.

mfxU16 NumROI#

Number of ROI descriptions in array. The Query API function mode 2 returns maximum supported value (set it to 256 and query will update it to maximum supported value).

mfxU16 ROIMode#

QP adjustment mode for ROIs. Defines if Priority or DeltaQP is used during encoding.

mfxI16 Priority#

Priority of ROI. Used if ROIMode = MFX_ROI_MODE_PRIORITY.This is an absolute value in the range of -3 to 3, which will be added to the MB QP. Priority is deprecated mode and is used only for backward compatibility. Bigger value produces better quality.

mfxI16 DeltaQP#

Delta QP of ROI. Used if ROIMode = MFX_ROI_MODE_QP_DELTA. This is an absolute value in the range of -51 to 51, which will be added to the MB QP. Lesser value produces better quality.

struct mfxExtEncoderROI::[anonymous] ROI[256]#

Array of ROIs. Different ROI may overlap each other. If macroblock belongs to several ROI, Priority from ROI with lowest index is used.

mfxExtHEVCRegion#

struct mfxExtHEVCRegion#

Attached to the mfxVideoParam structure during HEVC encoder initialization. Specifies the region to encode.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_HEVC_REGION.

mfxU32 RegionId#

ID of region.

mfxU16 RegionType#

Type of region. See HEVCRegionType enumerator for the list of types.

mfxU16 RegionEncoding#

Set to MFX_HEVC_REGION_ENCODING_ON to encode only specified region.

mfxExtHEVCTiles#

struct mfxExtHEVCTiles#

Configures tiles options for the HEVC encoder. The application can attach this extended buffer to the mfxVideoParam structure to configure initialization.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_HEVC_TILES.

mfxU16 NumTileRows#

Number of tile rows.

mfxU16 NumTileColumns#

Number of tile columns.

mfxExtInsertHeaders#

struct mfxExtInsertHeaders#

Runtime ctrl buffer for SPS/PPS insertion with current encoding frame.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_INSERT_HEADERS.

mfxU16 SPS#

Tri-state option to insert SPS.

mfxU16 PPS#

Tri-state option to insert PPS.

mfxU16 reserved[8]#

mfxExtMBDisableSkipMap#

struct mfxExtMBDisableSkipMap#

Specifies macroblock map for current frame which forces specified macroblocks to be non-skip if mfxExtCodingOption3::MBDisableSkipMap was turned ON during encoder initialization. The application can attach this extended buffer to the mfxEncodeCtrl structure during runtime.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MB_DISABLE_SKIP_MAP.

mfxU32 MapSize#

Macroblock map size.

mfxU8 *Map#

Pointer to a list of non-skip macroblock flags in raster scan order. Each flag is one byte in map. Set flag to 1 to force corresponding macroblock to be non-skip. In case of interlaced encoding, the first half of map affects the top field and the second half of map affects the bottom field.

mfxExtMBForceIntra#

struct mfxExtMBForceIntra#

Specifies macroblock map for current frame which forces specified macroblocks to be encoded as intra if mfxExtCodingOption3::EnableMBForceIntra was turned ON during encoder initialization. The application can attach this extended buffer to the mfxEncodeCtrl structure during runtime.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MB_FORCE_INTRA.

mfxU32 MapSize#

Macroblock map size.

mfxU8 *Map#

Pointer to a list of force intra macroblock flags in raster scan order. Each flag is one byte in map. Set flag to 1 to force corresponding macroblock to be encoded as intra. In case of interlaced encoding, the first half of map affects top field and the second half of map affects the bottom field.

mfxExtMBQP#

struct mfxExtMBQP#

Specifies per-macroblock QP for current frame if mfxExtCodingOption3::EnableMBQP was turned ON during encoder initialization. The application can attach this extended buffer to the mfxEncodeCtrl structure during runtime.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MBQP.

mfxU32 Pitch#

Distance in bytes between the start of two consecutive rows in the QP array.

mfxU16 Mode#

Defines QP update mode. See MBQPMode enumerator for more details.

mfxU16 BlockSize#

QP block size, valid for HEVC only during Init and Runtime.

mfxU32 NumQPAlloc#

Size of allocated by application QP or DeltaQP array.

mfxU8 *QP#

Pointer to a list of per-macroblock QP in raster scan order. In case of interlaced encoding the first half of QP array affects the top field and the second half of QP array affects the bottom field. Valid when Mode = MFX_MBQP_MODE_QP_VALUE.

For AVC, the valid range is 1 to 51.

For HEVC, the valid range is 1 to 51. Application’s provided QP values should be valid. Otherwise invalid QP values may cause undefined behavior. MBQP map should be aligned for 16x16 block size. The alignment rule is (width +15 /16) && (height +15 /16).

For MPEG2, QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification and has a valid range of 1 to 112.

mfxI8 *DeltaQP#

Pointer to a list of per-macroblock QP deltas in raster scan order. For block i: QP[i] = BrcQP[i] + DeltaQP[i]. Valid when Mode = MFX_MBQP_MODE_QP_DELTA.

mfxQPandMode *QPmode#

Block-granularity modes when MFX_MBQP_MODE_QP_ADAPTIVE is set.

mfxExtMoveRect#

struct mfxExtMoveRect#

Used by the application to specify moving regions within a frame during encoding.

Destination rectangle location should be aligned to MB boundaries (should be dividable by 16). If not, the encoder truncates it to MB boundaries, for example, both 17 and 31 will be truncated to 16.

Destination and source rectangle location

The following structure members are used by the Rect array contained in the parent structure.

mfxU32 DestLeft#

Destination rectangle location.

mfxU32 DestTop#

Destination rectangle location.

mfxU32 DestRight#

Destination rectangle location.

mfxU32 DestBottom#

Destination rectangle location.

mfxU32 SourceLeft#

Source rectangle location.

mfxU32 SourceTop#

Source rectangle location.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MOVING_RECTANGLE.

mfxU16 NumRect#

Number of moving rectangles.

struct mfxExtMoveRect::[anonymous] Rect[256]#

Array of moving rectangles.

mfxExtMVOverPicBoundaries#

struct mfxExtMVOverPicBoundaries#

Instructs encoder to use or not use samples over specified picture border for inter prediction. Attached to the mfxVideoParam structure.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES.

mfxU16 StickTop#

When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction. See the CodingOptionValue enumerator for values of this option.

mfxU16 StickBottom#

When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction. See the CodingOptionValue enumerator for values of this option.

mfxU16 StickLeft#

When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction. See the CodingOptionValue enumerator for values of this option.

mfxU16 StickRight#

When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction. See the CodingOptionValue enumerator for values of this option.

mfxExtPartialBitstreamParam#

struct mfxExtPartialBitstreamParam#

Used by an encoder to output parts of the bitstream as soon as they are ready. The application can attach this extended buffer to the mfxVideoParam structure at initialization. If this option is turned ON (Granularity != MFX_PARTIAL_BITSTREAM_NONE), then the encoder can output bitstream by part based on the required granularity.

This parameter is valid only during initialization and reset. Absence of this buffer means default or previously configured bitstream output behavior.

Note

Not all codecs and implementations support this feature. Use the Query API function to check if this feature is supported.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_PARTIAL_BITSTREAM_PARAM.

mfxU32 BlockSize#

Output block granularity for PartialBitstreamGranularity. Valid only for MFX_PARTIAL_BITSTREAM_BLOCK.

mfxU16 Granularity#

Granularity of the partial bitstream: slice/block/any, all types of granularity state in PartialBitstreamOutput enum.

mfxExtPictureTimingSEI#

struct mfxExtPictureTimingSEI#

Configures the H.264 picture timing SEI message. The encoder ignores it if HRD information in the stream is absent and the PicTimingSEI option in the mfxExtCodingOption structure is turned off. See mfxExtCodingOption for details.

If the application attaches this structure to the mfxVideoParam structure during initialization, the encoder inserts the picture timing SEI message based on provided template in every access unit of coded bitstream.

If application attaches this structure to the mfxEncodeCtrl structure at runtime, the encoder inserts the picture timing SEI message based on provided template in access unit that represents current frame.

These parameters define the picture timing information. An invalid value of 0xFFFF indicates that application does not set the value and encoder must calculate it.

See Annex D of the ISO*\/IEC* 14496-10 specification for the definition of these parameters.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_PICTURE_TIMING_SEI.

mfxU32 reserved[14]#
mfxU16 ClockTimestampFlag#
mfxU16 CtType#
mfxU16 NuitFieldBasedFlag#
mfxU16 CountingType#
mfxU16 FullTimestampFlag#
mfxU16 DiscontinuityFlag#
mfxU16 CntDroppedFlag#
mfxU16 NFrames#
mfxU16 SecondsFlag#
mfxU16 MinutesFlag#
mfxU16 HoursFlag#
mfxU16 SecondsValue#
mfxU16 MinutesValue#
mfxU16 HoursValue#
mfxU32 TimeOffset#
struct mfxExtPictureTimingSEI::[anonymous] TimeStamp[3]#

mfxExtPredWeightTable#

struct mfxExtPredWeightTable#

Specifies weighted prediction table for current frame when all of the following conditions are met:

  • The current frame is B-frame and is attached to the mfxEncodeCtrl structure.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_PRED_WEIGHT_TABLE.

mfxU16 LumaLog2WeightDenom#

Base 2 logarithm of the denominator for all luma weighting factors. Value must be in the range of 0 to 7, inclusive.

mfxU16 ChromaLog2WeightDenom#

Base 2 logarithm of the denominator for all chroma weighting factors. Value must be in the range of 0 to 7, inclusive.

mfxU16 LumaWeightFlag[2][32]#

LumaWeightFlag[L][R] equal to 1 specifies that the weighting factors for the luma component are specified for R’s entry of RefPicList L.

mfxU16 ChromaWeightFlag[2][32]#

ChromaWeightFlag[L][R] equal to 1 specifies that the weighting factors for the chroma component are specified for R’s entry of RefPicList L.

mfxI16 Weights[2][32][3][2]#

The values of the weights and offsets used in the encoding processing. The value of Weights[i][j][k][m] is interpreted as: i refers to reference picture list 0 or 1; j refers to reference list entry 0-31; k refers to data for the luma component when it is 0, the Cb chroma component when it is 1 and the Cr chroma component when it is 2; m refers to weight when it is 0 and offset when it is 1

mfxExtVP8CodingOption#

struct mfxExtVP8CodingOption#

Describes VP8 coding options.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP8_CODING_OPTION.

mfxU16 Version#

Determines the bitstream version. Corresponds to the same VP8 syntax element in frame_tag.

mfxU16 EnableMultipleSegments#

Set this option to ON to enable segmentation. This is tri-state option. See the CodingOptionValue enumerator for values of this option.

mfxU16 LoopFilterType#

Select the type of filter (normal or simple). Corresponds to VP8 syntax element filter_type.

mfxU16 LoopFilterLevel[4]#

Controls the filter strength. Corresponds to VP8 syntax element loop_filter_level.

mfxU16 SharpnessLevel#

Controls the filter sensitivity. Corresponds to VP8 syntax element sharpness_level.

mfxU16 NumTokenPartitions#

Specifies number of token partitions in the coded frame.

mfxI16 LoopFilterRefTypeDelta[4]#

Loop filter level delta for reference type (intra, last, golden, altref).

mfxI16 LoopFilterMbModeDelta[4]#

Loop filter level delta for MB modes.

mfxI16 SegmentQPDelta[4]#

QP delta for segment.

mfxI16 CoeffTypeQPDelta[5]#

QP delta for coefficient type (YDC, Y2AC, Y2DC, UVAC, UVDC).

mfxU16 WriteIVFHeaders#

Set this option to ON to enable insertion of IVF container headers into bitstream. This is tri-state option. See the CodingOptionValue enumerator for values of this option

mfxU32 NumFramesForIVFHeader#

Specifies number of frames for IVF header when WriteIVFHeaders is ON.

mfxExtVP9Segmentation#

struct mfxExtVP9Segmentation#

In the VP9 encoder it is possible to divide a frame into up to 8 segments and apply particular features (like delta for quantization index or for loop filter level) on a per-segment basis. “Uncompressed header” of every frame indicates if segmentation is enabled for the current frame, and (if segmentation enabled) contains full information about features applied to every segment. Every “Mode info block” of a coded frame has segment_id in the range of 0 to 7.

To enable Segmentation, the mfxExtVP9Segmentation structure with correct settings should be passed to the encoder. It can be attached to the mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtVP9Segmentation buffer isn’t attached during initialization, segmentation is disabled for static configuration. If the buffer isn’t attached for the Reset call, the encoder continues to use static configuration for segmentation which was the default before this Reset call. If the mfxExtVP9Segmentation buffer with NumSegments=0 is provided during initialization or Reset call, segmentation becomes disabled for static configuration.

The buffer can be attached to the mfxEncodeCtrl structure during runtime (dynamic configuration). Dynamic configuration is applied to the current frame only. After encoding of the current frame, the encoder will switch to the next dynamic configuration or to static configuration if dynamic configuration is not provided for next frame).

The SegmentIdBlockSize, NumSegmentIdAlloc, and SegmentId parameters represent a segmentation map. Here, the segmentation map is an array of segment_ids (one byte per segment_id) for blocks of size NxN in raster scan order. The size NxN is specified by the application and is constant for the whole frame. If mfxExtVP9Segmentation is attached during initialization and/or during runtime, all three parameters should be set to proper values that do not conflict with each other and with NumSegments. If any of the parameters are not set or any conflict or error in these parameters is detected by the library, the segmentation map will be discarded.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP9_SEGMENTATION.

mfxU16 NumSegments#

Number of segments for frame. Value 0 means that segmentation is disabled. Sending 0 for a particular frame will disable segmentation for this frame only. Sending 0 to the Reset API function will disable segmentation permanently. Segmentation can be enabled again by a subsequent Reset call.

mfxVP9SegmentParam Segment[8]#

Array of mfxVP9SegmentParam structures containing features and parameters for every segment. Entries with indexes bigger than NumSegments-1 are ignored. See the mfxVP9SegmentParam structure for definitions of segment features and their parameters.

mfxU16 SegmentIdBlockSize#

Size of block (NxN) for segmentation map. See SegmentIdBlockSize enumerator for values for this option. An encoded block that is bigger than SegmentIdBlockSize uses segment_id taken from it’s top-left sub-block from the segmentation map. The application can check if a particular block size is supported by calling Query.

mfxU32 NumSegmentIdAlloc#

Size of buffer allocated for segmentation map (in bytes). Application must assure that NumSegmentIdAlloc is large enough to cover frame resolution with blocks of size SegmentIdBlockSize. Otherwise the segmentation map will be discarded.

mfxU8 *SegmentId#

Pointer to the segmentation map buffer which holds the array of segment_ids in raster scan order. The application is responsible for allocation and release of this memory. The buffer pointed to by SegmentId, provided during initialization or Reset call should be considered in use until another SegmentId is provided via Reset call (if any), or until MFXVideoENCODE_Close is called. The buffer pointed to by SegmentId provided with mfxEncodeCtrl should be considered in use while the input surface is locked by the library. Every segment_id in the map should be in the range of 0 to NumSegments-1. If some segment_id is out of valid range, the segmentation map cannot be applied. If the mfxExtVP9Segmentation buffer is attached to the mfxEncodeCtrl structure in runtime, SegmentId can be zero. In this case, the segmentation map from static configuration will be used.

mfxExtVP9TemporalLayers#

struct mfxExtVP9TemporalLayers#

API allows the encoding of VP9 bitstreams that contain several subset bitstreams that differ in frame rates, also called “temporal layers”.

When decoding, each temporal layer can be extracted from the coded stream and decoded separately. The mfxExtVP9TemporalLayers structure configures the temporal layers for the VP9 encoder. It can be attached to the mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call. If the mfxExtVP9TemporalLayers buffer isn’t attached during initialization, temporal scalability is disabled. If the buffer isn’t attached for the Reset call, the encoder continues to use the temporal scalability configuration that was defined before the Reset call.

In the API, temporal layers are ordered by their frame rates in ascending order. Temporal layer 0 (having the lowest frame rate) is called the base layer. Each subsequent temporal layer includes all previous layers.

The temporal scalability feature requires a minimum number of allocated reference frames (controlled by the NumRefFrame parameter). If the NumRefFrame value set by the application isn’t enough to build the reference structure for the requested number of temporal layers, the library corrects the NumRefFrame value. The temporal layer structure is reset (re-started) after key-frames.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP9_TEMPORAL_LAYERS.

mfxVP9TemporalLayer Layer[8]#

The array of temporal layers. Layer[0] specifies the base layer.

The library reads layers from the array when they are defined (FrameRateScale > 0). All layers starting from first layer with FrameRateScale = 0 are ignored. The last layer that is not ignored is considered the “highest layer”.

The frame rate of the highest layer is specified in the mfxVideoParam structure. Frame rates of lower layers are calculated using their FrameRateScale.

TargetKbps of the highest layer should be equal to the TargetKbps value specified in the mfxVideoParam structure. If it is not true, TargetKbps of highest temporal layers has priority.

If there are no defined layers in the Layer array, the temporal scalability feature is disabled. For example, to disable temporal scalability in runtime, the application should pass mfxExtVP9TemporalLayers buffer to Reset with all FrameRateScales set to 0.

mfxQPandMode#

struct mfxQPandMode#

Specifies per-MB or per-CU mode and QP or DeltaQP value depending on the mode type.

Public Members

mfxU8 QP#

QP for MB or CU. Valid when Mode = MFX_MBQP_MODE_QP_VALUE.

For AVC, the valid range is 1 to 51.

For HEVC, the valid range is 1 to 51. The application’s provided QP values should be valid, otherwise invalid QP values may cause undefined behavior.

MBQP map should be aligned for 16x16 block size. The align rule is: (width +15 /16) && (height +15 /16).

For MPEG2, the valid range is 1 to 112. QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification.

mfxI8 DeltaQP#

Per-macroblock QP delta. Valid when Mode = MFX_MBQP_MODE_QP_DELTA.

mfxU16 Mode#

Defines QP update mode. Can be equal to MFX_MBQP_MODE_QP_VALUE or MFX_MBQP_MODE_QP_DELTA.

mfxVP9TemporalLayer#

struct mfxVP9TemporalLayer#

Specifies temporal layer.

Public Members

mfxU16 FrameRateScale#

The ratio between the frame rates of the current temporal layer and the base layer. The library treats a particular temporal layer as “defined” if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the FrameRateScale value of previous layer.

mfxU16 TargetKbps#

Target bitrate for the current temporal layer. Ignored if RateControlMethod is CQP. If RateControlMethod is not CQP, the application must provide TargetKbps for every defined temporal layer. TargetKbps of each subsequent layer (if defined) must be greater than the TargetKbps value of the previous layer.

mfxTemporalLayer#

struct mfxTemporalLayer#

The structure is used for universal temporal layer description.

Public Members

mfxU16 FrameRateScale#

The ratio between the frame rates of the current temporal layer and the base layer. The library treats a particular temporal layer as “defined” if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the FrameRateScale value of previous layer.

mfxU16 reserved[3]#

Reserved for future use.

mfxU32 InitialDelayInKB#

Initial size of the Video Buffering Verifier (VBV) buffer for the current temporal layer.

Note

In this context, KB is 1000 bytes and Kbps is 1000 bps.

mfxU32 BufferSizeInKB#

Represents the maximum possible size of any compressed frames for the current temporal layer.

mfxU32 TargetKbps#

Target bitrate for the current temporal layer. If RateControlMethod is not CQP, the application can provide TargetKbps for every defined temporal layer. If TargetKbps per temporal layer is not set then encoder doesn’t apply any special bitrate limitations for the layer.

mfxU32 MaxKbps#

The maximum bitrate at which the encoded data enters the Video Buffering Verifier (VBV) buffer for the current temporal layer.

mfxU32 reserved1[16]#

Reserved for future use.

mfxI32 QPI#

Quantization Parameter (QP) for I-frames for constant QP mode (CQP) for the current temporal layer. Zero QP is not valid and means that the default value is assigned by the library. Non-zero QPI might be clipped to supported QPI range.

Note

Default QPI value is implementation dependent and subject to change without additional notice in this document.

mfxI32 QPP#

Quantization Parameter (QP) for P-frames for constant QP mode (CQP) for the current temporal layer. Zero QP is not valid and means that the default value is assigned by the library. Non-zero QPP might be clipped to supported QPI range.

Note

Default QPP value is implementation dependent and subject to change without additional notice in this document.

mfxI32 QPB#

Quantization Parameter (QP) for B-frames for constant QP mode (CQP) for the current temporal layer. Zero QP is not valid and means that the default value is assigned by the library. Non-zero QPI might be clipped to supported QPB range.

Note

Default QPB value is implementation dependent and subject to change without additional notice in this document.

mfxU16 reserved2[4]#

Reserved for future use.

mfxExtTemporalLayers#

struct mfxExtTemporalLayers#

The structure is used for universal temporal layers description.

Public Members

mfxU16 NumLayers#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_UNIVERSAL_TEMPORAL_LAYERS. The number of temporal layers.

mfxU16 BaseLayerPID#

The priority ID of the base layer. The encoder increases the ID for each temporal layer and writes to the prefix NAL unit for AVC and HEVC.

mfxU16 reserved[2]#

Reserved for future use.

mfxTemporalLayer *Layers#

The array of temporal layers.

mfxU16 reserved1[8]#

Reserved for future use.

mfxExtAV1BitstreamParam#

struct mfxExtAV1BitstreamParam#

The structure is used by AV1 encoder with more parameter control to encode frame.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_BITSTREAM_PARAM.

mfxU16 WriteIVFHeaders#

Tri-state option to control IVF headers insertion, default is ON. Writing IVF headers is enabled in the encoder when mfxExtAV1BitstreamParam is attached and its value is ON or zero. Writing IVF headers is disabled by default in the encoder when mfxExtAV1BitstreamParam is not attached.

mfxExtAV1ResolutionParam#

struct mfxExtAV1ResolutionParam#

The structure is used by AV1 encoder with more parameter control to encode frame.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_RESOLUTION_PARAM.

mfxU32 FrameWidth#

Width of the coded frame in pixels, default value is from mfxFrameInfo.

mfxU32 FrameHeight#

Height of the coded frame in pixels, default value is from mfxFrameInfo.

mfxExtAV1TileParam#

struct mfxExtAV1TileParam#

The structure is used by AV1 encoder with more parameter control to encode frame.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_TILE_PARAM.

mfxU16 NumTileRows#

Number of tile rows, default value is 1.

mfxU16 NumTileColumns#

Number of tile columns, default value is 1.

mfxU16 NumTileGroups#

Number of tile groups, it will be ignored if the tile groups num is invalid, default value is 1.

mfxExtAV1Segmentation#

struct mfxExtAV1Segmentation#

In the AV1 encoder it is possible to divide a frame into up to 8 segments and apply particular features (like delta for quantization index or for loop filter level) on a per-segment basis. “Uncompressed header” of every frame indicates if segmentation is enabled for the current frame, and (if segmentation enabled) contains full information about features applied to every segment. Every “Mode info block” of a coded frame has segment_id in the range of 0 to 7. To enable Segmentation, the mfxExtAV1Segmentation structure with correct settings should be passed to the encoder. It can be attached to the mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtAV1Segmentation buffer isn’t attached during initialization, segmentation is disabled for static configuration. If the buffer isn’t attached for the Reset call, the encoder continues to use static configuration for segmentation which was the default before this Reset call. If the mfxExtAV1Segmentation buffer with NumSegments=0 is provided during initialization or Reset call, segmentation becomes disabled for static configuration. The buffer can be attached to the mfxEncodeCtrl structure during runtime (dynamic configuration). Dynamic configuration is applied to the current frame only. After encoding of the current frame, the encoder will switch to the next dynamic configuration or to static configuration if dynamic configuration is not provided for next frame). The SegmentIdBlockSize, NumSegmentIdAlloc, and SegmentId parameters represent a segmentation map. Here, the segmentation map is an array of segment_ids (one byte per segment_id) for blocks of size NxN in raster scan order. The size NxN is specified by the application and is constant for the whole frame. If mfxExtAV1Segmentation is attached during initialization and/or during runtime, all three parameters should be set to proper values that do not conflict with each other and with NumSegments. If any of the parameters are not set or any conflict or error in these parameters is detected by the library, the segmentation map will be discarded.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_SEGMENTATION.

mfxU8 NumSegments#

Number of segments for frame. Value 0 means that segmentation is disabled. Sending 0 for a particular frame will disable segmentation for this frame only. Sending 0 to the Reset API function will disable segmentation permanently. Segmentation can be enabled again by a subsequent Reset call.

mfxAV1SegmentParam Segment[8]#

Array of mfxAV1SegmentParam structures containing features and parameters for every segment. Entries with indexes bigger than NumSegments-1 are ignored. See the mfxAV1SegmentParam structure for definitions of segment features and their parameters.

mfxU16 SegmentIdBlockSize#

Size of block (NxN) for segmentation map. See AV1 SegmentIdBlockSize enumerator for values for this option. An encoded block that is bigger than AV1 SegmentIdBlockSize uses segment_id taken from it’s top-left sub-block from the segmentation map. The application can check if a particular block size is supported by calling Query.

mfxU32 NumSegmentIdAlloc#

Size of buffer allocated for segmentation map (in bytes). Application must assure that NumSegmentIdAlloc is large enough to cover frame resolution with blocks of size SegmentIdBlockSize. Otherwise the segmentation map will be discarded.

mfxU8 *SegmentIds#

Pointer to the segmentation map buffer which holds the array of segment_ids in raster scan order. The application is responsible for allocation and release of this memory. The buffer pointed to by SegmentId, provided during initialization or Reset call should be considered in use until another SegmentId is provided via Reset call (if any), or until MFXVideoENCODE_Close is called. The buffer pointed to by SegmentId provided with mfxEncodeCtrl should be considered in use while the input surface is locked by the library. Every segment_id in the map should be in the range of 0 to NumSegments-1. If some segment_id is out of valid range, the segmentation map cannot be applied. If the mfxExtAV1Segmentation buffer is attached to the mfxEncodeCtrl structure in runtime, SegmentId can be zero. In this case, the segmentation map from static configuration will be used.

mfxCTUHeader#

struct mfxCTUHeader#

Public Members

mfxU32 CUcountminus1#

Number of CU per CTU.

mfxU32 MaxDepth#

Max quad-tree depth of CU in CTU.

mfxU16 CurrXAddr#

Horizontal address of CTU.

mfxU16 CurrYAddr#

Vertical address of CTU.

mfxCUInfo#

struct mfxCUInfo#

Public Members

mfxU32 CU_Size#

indicates the CU size of the current CU. 0: 8x8 1: 16x16 2: 32x32 3: 64x64

mfxU32 CU_pred_mode#

indicates the prediction mode for the current CU. 0: intra 1: inter

mfxU32 CU_part_mode#

indicates the PU partition mode for the current CU. 0: 2Nx2N 1: 2NxN (inter) 2: Nx2N (inter) 3: NXN (intra only, CU Size=8x8 only. Luma Intra Mode indicates the intra prediction mode for 4x4_0. The additional prediction modes are overloaded on 4x4_1, 4x4_2, 4x4_3 below) 4: 2NxnT (inter only) 5: 2NxnB (inter only) 6: nLx2N (inter only) 7: nRx2N (inter only).

mfxU32 InterPred_IDC_MV0#

indicates the prediction direction for PU0 of the current CU. 0: L0 1: L1 2: Bi 3: reserved

mfxU32 InterPred_IDC_MV1#

indicates the prediction direction for PU1 of the current CU. 0: L0 1: L1 2: Bi 3: reserved

mfxU32 LumaIntraMode#

Final explicit Luma Intra Mode 4x4_0 for NxN. Valid values 0..34 Note: CU_part_mode==NxN.

mfxU32 ChromaIntraMode#

indicates the final explicit Luma Intra Mode for the CU. 0: DM (use Luma mode, from block 0 if NxN) 1: reserved 2: Planar 3: Vertical 4: Horizontal 5: DC

mfxU32 LumaIntraMode4x4_1#

Final explicit Luma Intra Mode 4x4_1. Valid values 0..34 Note: CU_part_mode==NxN.

mfxU32 LumaIntraMode4x4_2#

Final explicit Luma Intra Mode 4x4_2. Valid values 0..34 Note: CU_part_mode==NxN.

mfxU32 LumaIntraMode4x4_3#

Final explicit Luma Intra Mode 4x4_3. Valid values 0..34 Note: CU_part_mode==NxN.

mfxU32 SAD#

distortion measure, approximation to SAD.

Will deviate significantly (pre, post reconstruction) and due to variation in algorithm.

mfxI16Pair MV[2][2]#

These parameters indicate motion vectors that are associated with the PU0/PU1 winners range [-2048.00..2047.75]. L0/PU0 - MV[0][0] L0/PU1 - MV[0][1] L1/PU0 - MV[1][0] L1/PU1 - MV[1][1]

mfxU32 L0_MV0_RefID#

This parameter indicates the reference index associated with the MV X/Y that is populated in the L0_MV0.X and L0_MV0.Y fields.

mfxU32 L0_MV1_RefID#

This parameter indicates the reference index associated with the MV X/Y that is populated in the L0_MV1.X and L0_MV1.Y fields.

mfxU32 L1_MV0_RefID#

This parameter indicates the reference index associated with the MV X/Y that is populated in the L1_MV0.X and L1_MV0.Y fields.

mfxU32 L1_MV1_RefID#

This parameter indicates the reference index associated with the MV X/Y that is populated in the L1_MV1.X and L1_MV1.Y fields.

mfxCTUInfo#

struct mfxCTUInfo#

Public Members

mfxCTUHeader CtuHeader#

H.265 CTU header.

mfxCUInfo CuInfo[64]#

Array of CU.

mfxMBInfo#

struct mfxMBInfo#

The structure describes H.264 stats per MB.

Public Members

mfxU32 MBType#

Together with IntraMbFlag this parameter specifies macroblock type according to the ISO*\/IEC* 14496-10 with the following difference - it stores either intra or inter values according to IntraMbFlag, but not intra after inter. Values for P-slices are mapped to B-slice values. For example P_16x8 is coded with B_FWD_16x8 value.

mfxU32 InterMBMode#

This field specifies inter macroblock mode and is ignored for intra MB. It is derived from MbType and has next values:

  • 0 - 16x16 mode

  • 1 - 16x8 mode

  • 2 - 8x16 mode

  • 3 - 8x8 mode

mfxU32 IntraMBMode#

This field specifies intra macroblock mode and is ignored for inter MB. It is derived from MbType and has next values:

  • 0 - 16x16 mode

  • 1 - 8x8 mode

  • 2 - 4x4 mode

  • 3 - PCM

mfxU32 IntraMBFlag#

This flag specifies intra/inter MB type and has next values: 0 - Inter prediction MB type 1 - Intra prediction MB type

mfxU32 SubMBShapes#

This field specifies subblock shapes for the current MB. Each block is described by 2 bits starting from lower bits for block 0.

  • 0 - 8x8

  • 1 - 8x4

  • 2 - 4x8

  • 3 - 4x4

mfxU32 SubMBShapeMode#

This field specifies prediction modes for the current MB partition blocks. Each block is described by 2 bits starting from lower bits for block 0.

  • 0 - Pred_L0

  • 1 - Pred_L1

  • 2 - BiPred

  • 3 - reserved

Only one prediction value for partition is reported, the rest values are set to zero. For example:
  • 16x16 Pred_L1 - 0x01 (only 2 lower bits are used)

  • 16x8 Pred_L1 / BiPred - 0x09 (1001b)

  • 8x16 BiPred / BiPred - 0x0a (1010b)

For P MBs this value is always zero.

mfxU32 ChromaIntraPredMode#

This value specifies chroma intra prediction mode.

  • 0 - DC

  • 1 - Horizontal

  • 2 - Vertical

  • 3 - Plane

mfxU32 SAD#

Distortion measure, approximation to SAD.

Deviate significantly (pre, post reconstruction) and due to variation in algorithm.

mfxI8 Qp#

MB QP.

mfxU16 LumaIntraMode[4]#

These values specify luma intra prediction modes for current MB. Each element of the array corresponds to 8x8 block and each holds prediction modes for four 4x4 subblocks. Four bits per mode, lowest bits for left top subblock. All 16 prediction modes are always specified. For 8x8 case, block prediction mode is populated to all subblocks of the 8x8 block. For 16x16 case - to all subblocks of the MB.

Prediction directions for 4x4 and 8x8 blocks:

  • 0 - Vertical

  • 1 - Horizontal

  • 2 - DC

  • 3 - Diagonal Down Left

  • 4 - Diagonal Down Right

  • 5 - Vertical Right

  • 6 - Horizontal Down

  • 7 - Vertical Left

  • 8 - Horizontal Up

Prediction directions for 16x16 blocks:
  • 0 - Vertical

  • 1 - Horizontal

  • 2 - DC

  • 3 - Plane

mfxEncodeBlkStats#

struct mfxEncodeBlkStats#

The structure describes H.264 and H.265 stats per MB or CTUs.

Public Members

mfxU32 NumMB#

Number of MBs per frame for H.264.

mfxU32 NumCTU#

number of CTUs per frame for H.265.

mfxCTUInfo *HEVCCTUArray#

Array of CTU statistics.

mfxMBInfo *AVCMBArray#

Array of MB statistics.

mfxEncodeHighLevelStats#

struct mfxEncodeHighLevelStats#

The structure describes H.264/H.265 frame/slice/tile level statistics.

Public Members

mfxF32 PSNRLuma#

PSNR for LUMA samples.

mfxF32 PSNRCb#

PSNR for Chroma (Cb) samples.

mfxF32 PSNRCr#

PSNR for Chroma (Cr) samples.

mfxU64 SADLuma#

distortion measure, approximation to SAD.

Will deviate significantly (pre, post reconstruction) and due to variation in algorithm.

mfxU32 NumMB#

Number of MBs per frame for H.264.

mfxU32 NumCTU#

number of CTUs per frame for H.265.

mfxU32 NumIntraBlock#

For H.264 it is always 16x16 corresponding to MB size. In H.265 it’s normalized to 4x4, so for each CU we calculate number of 4x4 which belongs to the block.

mfxU32 NumInterBlock#

Number of intra blocks in the frame. The size of block is defined by BlockSize. For H.265 it can be more than number of intra CU.

mfxU32 NumSkippedBlock#

Number of inter blocks in the frame. The size of block is defined by BlockSize. For H.265 it can be more than number of inter CU.

mfxU32 reserved[8]#

Number of skipped blocks in the frame. The size of block is defined by BlockSize. For H.265 it can be more than number of skipped CU.

mfxEncodeFrameStats#

typedef mfxEncodeHighLevelStats mfxEncodeFrameStats#

Alias for the structure to describe H.264 and H.265 frame level stats.

mfxEncodeSliceStats#

struct mfxEncodeSliceStats#

The structure describes H.264 and H.265 stats per Slice or Tile.

Public Members

mfxU32 NumElements#

Number of Slices or Tiles per frame for H.264/H.265.

mfxEncodeHighLevelStats *HighLevelStatsArray#

Array of CTU statistics.

mfxEncodeTileStats#

typedef mfxEncodeSliceStats mfxEncodeTileStats#

Alias for the structure to describe H.264 and H.265 tile level stats.

mfxEncodeStatsContainer#

struct mfxEncodeStatsContainer#

The structure represents reference counted container for output after encoding operation which includes statistics and synchronization primitive for compressed bitstream. The memory is allocated and released by the library.

Public Members

mfxStructVersion Version#

The version of the structure.

mfxStatus (*SynchronizeStatistics)(mfxRefInterface *ref_interface, mfxU32 wait)#

Guarantees readiness of the statistics after a function completes. Instead of MFXVideoCORE_SyncOperation which leads to the synchronization of all output objects, users may directly call the mfxEncodeStatsContainer::SynchronizeStatistics function to get output statistics.

< Reference counting interface.

Parameters
  • ref_interface[in] Valid interface.

  • wait[out] Wait time in milliseconds.

Returns

MFX_ERR_NONE If no error.

MFX_ERR_NULL_PTR If interface is NULL.

MFX_ERR_INVALID_HANDLE If any of container is not valid object .

MFX_WRN_IN_EXECUTION If the given timeout is expired and the container is not ready.

MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete.

MFX_ERR_UNKNOWN Any internal error.

mfxStatus (*SynchronizeBitstream)(mfxRefInterface *ref_interface, mfxU32 wait)#

Guarantees readiness of associated compressed bitstream after a function completes. Instead of MFXVideoCORE_SyncOperation which leads to the synchronization of all output objects, users may directly call the mfxEncodeStatsContainer::SynchronizeStatistics function to get output bitstream.

Parameters
  • ref_interface[in] Valid interface.

  • wait[out] Wait time in milliseconds.

Returns

MFX_ERR_NONE If no error.

MFX_ERR_NULL_PTR If interface is NULL.

MFX_ERR_INVALID_HANDLE If any of container is not valid object .

MFX_WRN_IN_EXECUTION If the given timeout is expired and the container is not ready.

MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete.

MFX_ERR_UNKNOWN Any internal error.

mfxExtEncodeStatsOutput#

struct mfxExtEncodeStatsOutput#

The extension buffer which should be attached by application for mfxBitstream buffer before encode operation. As result the encoder will allocate memory for statistics and fill appropriate structures.

Public Members

mfxExtBuffer Header#

Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODESTATS_BLK.

mfxEncodeStatsMode Mode#

What statistics is required: block/slice/tile/frame level or any combinations. In case of slice or tile output statistics for one slice or tile will be available only. What encoding mode should be used to gather statistics.

mfxEncodeStatsContainer *EncodeStatsContainer#

encode output, filled by the implementation.

mfxExtHEVCRefListCtrl#

typedef mfxExtAVCRefListCtrl mfxExtHEVCRefListCtrl#

mfxExtHEVCRefLists#

typedef mfxExtAVCRefLists mfxExtHEVCRefLists#

mfxExtHEVCTemporalLayers#

typedef mfxExtAvcTemporalLayers mfxExtHEVCTemporalLayers#