# Structs¶

## mfxRange32U¶

struct mfxRange32U

This structure represents a range of unsigned values

Public Members

mfxU32 Min

Minimal value of the range.

mfxU32 Max

Maximal value of the range.

mfxU32 Step

Value incrementation step.

## mfxI16Pair¶

struct mfxI16Pair

Thus structure represents a pair of numbers of type mfxI16.

Public Members

mfxI16 x

First number.

mfxI16 y

Second number.

## mfxHDLPair¶

struct mfxHDLPair

Thus structure represents pair of handles of type mfxHDL.

Public Members

mfxHDL first

First handle.

mfxHDL second

Second handle.

## mfxVersion¶

union mfxVersion
#include <mfxcommon.h>

The mfxVersion union describes the version of the SDK implementation.

Public Members

mfxU16 Minor

Minor number of the SDK implementation.

mfxU16 Major

Major number of the SDK implementation.

struct mfxVersion::[anonymous] [anonymous]
mfxU32 Version

SDK implementation version number.

## mfxStructVersion¶

union mfxStructVersion
#include <mfxdefs.h>

Introduce field Version for any structures. Minor number is incremented when reserved fields are used, major number is incremented when size of structure is increased. Assumed that any structure changes are backward binary compatible. mfxStructVersion starts from {1,0} for any new API structures, if mfxStructVersion is added to the existent legacy structure (replacing reserved fields) it starts from {1, 1}.

Public Members

mfxU8 Minor

Minor number of the correspondent structure.

mfxU8 Major

Major number of the correspondent structure.

struct mfxStructVersion::[anonymous] [anonymous]
mfxU16 Version

Structure version number

## mfxPlatform¶

struct mfxPlatform

The mfxPlatform structure contains information about hardware platform.

Public Members

mfxU16 CodeName

Microarchitecture code name. See the PlatformCodeName enumerator for a list of possible values.

mfxU16 DeviceId

Unique identifier of graphics device.

mfxU16 MediaAdapterType

Description of graphics adapter type. See the mfxMediaAdapterType enumerator for a list of possible values.

mfxU16 reserved[13]

Reserved for future use.

## mfxInitParam¶

struct mfxInitParam

This structure specifies advanced initialization parameters. A zero value in any of the fields indicates that the corresponding field is not explicitly specified.

Public Members

mfxIMPL Implementation

mfxIMPL enumerator that indicates the desired SDK implementation.

mfxVersion Version

Structure which specifies minimum library version or zero, if not specified.

mfxU16 ExternalThreads

mfxExtBuffer **ExtParam

Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations.

mfxU16 NumExtParam

The number of extra configuration structures attached to this structure.

mfxU16 GPUCopy

Enables or disables GPU accelerated copying between video and system memory in the SDK components. See the GPUCopy enumerator for a list of valid values.

## mfxInfoMFX¶

struct mfxInfoMFX

The mfxInfoMFX structure specifies configurations for decoding, encoding and transcoding processes. A zero value in any of these fields indicates that the field is not explicitly specified.

Public Members

mfxU32 reserved[7]

Reserved for future use.

mfxU16 LowPower

For encoders set this flag to ON to reduce power consumption and GPU usage. See the CodingOptionValue enumerator for values of this option. Use Query function to check if this feature is supported.

mfxU16 BRCParamMultiplier

Specifies a multiplier for bitrate control parameters. Affects next four variables InitialDelayInKB, BufferSizeInKB, TargetKbps, MaxKbps. If this value is not equal to zero encoder calculates BRC parameters as value * BRCParamMultiplier.

mfxFrameInfo FrameInfo

mfxFrameInfo structure that specifies frame parameters

mfxU32 CodecId

Specifies the codec format identifier in the FourCC code; see the CodecFormatFourCC enumerator for details. This is a mandated input parameter for QueryIOSurf and Init functions.

mfxU16 CodecProfile

Specifies the codec profile; see the CodecProfile enumerator for details. Specify the codec profile explicitly or the SDK functions will determine the correct profile from other sources, such as resolution and bitrate.

mfxU16 CodecLevel

Codec level; see the CodecLevel enumerator for details. Specify the codec level explicitly or the SDK functions will determine the correct level from other sources, such as resolution and bitrate.

mfxU16 TargetUsage

Target usage model that guides the encoding process; see the TargetUsage enumerator for details.

mfxU16 GopPicSize

Number of pictures within the current GOP (Group of Pictures); if GopPicSize = 0, then the GOP size is unspecified. If GopPicSize = 1, only I-frames are used. Pseudo-code that demonstrates how SDK uses this parameter.

mfxU16 get_gop_sequence (...) {
pos=display_frame_order;
if (pos == 0)
return MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF;

If (GopPicSize == 1) // Only I-frames
return MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;

if (GopPicSize == 0)
frameInGOP = pos;    //Unlimited GOP
else
frameInGOP = pos%GopPicSize;

if (frameInGOP == 0)
return MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;

if (GopRefDist == 1 || GopRefDist == 0)    // Only I,P frames
return MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF;

frameInPattern = (frameInGOP-1)%GopRefDist;
if (frameInPattern == GopRefDist - 1)
return MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF;

return MFX_FRAMETYPE_B;
}


mfxU16 GopRefDist

Distance between I- or P (or GPB) - key frames; if it is zero, the GOP structure is unspecified. Note: If GopRefDist = 1, there are no regular B-frames used (only P or GPB); if mfxExtCodingOption3::GPB is ON, GPB frames (B without backward references) are used instead of P.

mfxU16 GopOptFlag

ORs of the GopOptFlag enumerator indicate the additional flags for the GOP specification.

mfxU16 IdrInterval

For H.264, IdrInterval specifies IDR-frame interval in terms of I-frames; if IdrInterval = 0, then every I-frame is an IDR-frame. If IdrInterval = 1, then every other I-frame is an IDR-frame, etc.

For HEVC, if IdrInterval = 0, then only first I-frame is an IDR-frame. If IdrInterval = 1, then every I-frame is an IDR-frame. If IdrInterval = 2, then every other I-frame is an IDR-frame, etc.

For MPEG2, IdrInterval defines sequence header interval in terms of I-frames. If IdrInterval = N, SDK inserts the sequence header before every Nth I-frame. If IdrInterval = 0 (default), SDK inserts the sequence header once at the beginning of the stream.

If GopPicSize or GopRefDist is zero, IdrInterval is undefined.

mfxU16 InitialDelayInKB

Initial size of the Video Buffering Verifier (VBV) buffer.

Note

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

mfxU16 QPI

Quantization Parameter (QP) for I frames for constant QP mode (CQP). Zero QP is not valid and means that 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.

mfxU16 Accuracy

Specifies accuracy range in the unit of tenth of percent.

mfxU16 BufferSizeInKB

BufferSizeInKB represents the maximum possible size of any compressed frames.

mfxU16 TargetKbps

Constant bitrate TargetKbps. Used to estimate the targeted frame size by dividing the frame rate by the bitrate.

mfxU16 QPP

Quantization Parameter (QP) for P frames for constant QP mode (CQP). Zero QP is not valid and means that 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.

mfxU16 ICQQuality

This parameter is for Intelligent Constant Quality (ICQ) bitrate control algorithm. It is value in the 1…51 range, where 1 corresponds the best quality.

mfxU16 MaxKbps

the maximum bitrate at which the encoded data enters the Video Buffering Verifier (VBV) buffer.

mfxU16 QPB

Quantization Parameter (QP) for B frames for constant QP mode (CQP). Zero QP is not valid and means that 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 Convergence

Convergence period in the unit of 100 frames.

mfxU16 NumSlice

Number of slices in each video frame; each slice contains one or more macro-block rows. If NumSlice equals zero, the encoder may choose any slice partitioning allowed by the codec standard. See also mfxExtCodingOption2::NumMbPerSlice.

mfxU16 NumRefFrame

Max number of all available reference frames (for AVC/HEVC NumRefFrame defines DPB size); if NumRefFrame = 0, this parameter is not specified. See also mfxExtCodingOption3::NumRefActiveP, NumRefActiveBL0 and NumRefActiveBL1 which set a number of active references.

mfxU16 EncodedOrder

If not zero, EncodedOrder specifies that ENCODE takes the input surfaces in the encoded order and uses explicit frame type control. Application still must provide GopRefDist and mfxExtCodingOption2::BRefType so SDK can pack headers and build reference lists correctly.

mfxU16 DecodedOrder

For AVC and HEVC, used to instruct the decoder to return output frames in the decoded order. Must be zero for all other decoders. When enabled, correctness of mfxFrameData::TimeStamp and FrameOrder for output surface is not guaranteed, the application should ignore them.

mfxU16 ExtendedPicStruct

Instructs DECODE to output extended picture structure values for additional display attributes. See the PicStruct description for details.

mfxU16 TimeStampCalc

Time stamp calculation method; see the TimeStampCalc description for details.

mfxU16 SliceGroupsPresent

Nonzero value indicates that slice groups are present in the bitstream. Only AVC decoder uses this field.

mfxU16 MaxDecFrameBuffering

Nonzero value specifies the maximum required size of the decoded picture buffer in frames for AVC and HEVC decoders.

mfxU16 EnableReallocRequest

For decoders supporting dynamic resolution change (VP9), set this option to ON to allow MFXVideoDECODE_DecodeFrameAsync return MFX_ERR_REALLOC_SURFACE. See the CodingOptionValue enumerator for values of this option. Use Query function to check if this feature is supported.

mfxU16 JPEGChromaFormat

Specify the chroma sampling format that has been used to encode JPEG picture. See the ChromaFormat enumerator.

mfxU16 Rotation

Rotation option of the output JPEG picture; see the Rotation enumerator for details.

mfxU16 JPEGColorFormat

Specify the color format that has been used to encode JPEG picture. See the JPEGColorFormat enumerator for details.

mfxU16 InterleavedDec

Specify JPEG scan type for decoder. See the JPEGScanType enumerator for details.

mfxU8 SamplingFactorH[4]

Horizontal sampling factor.

mfxU8 SamplingFactorV[4]

Vertical sampling factor.

mfxU16 Interleaved

Non-interleaved or interleaved scans. If it is equal to MFX_SCANTYPE_INTERLEAVED then the image is encoded as interleaved, all components are encoded in one scan. See the JPEG Scan Type enumerator for details.

mfxU16 Quality

Specifies the image quality if the application does not specified quantization table. This is the value from 1 to 100 inclusive. “100” is the best quality.

mfxU16 RestartInterval

Specifies the number of MCU in the restart interval. “0” means no restart interval.

Note

The mfxInfoMFX::InitialDelayInKB, mfxInfoMFX::TargetKbps, mfxInfoMFX::MaxKbps parameters are for the constant bitrate (CBR), variable bitrate control (VBR), and CQP HRD algorithms.

The SDK encoders follow the Hypothetical Reference Decoding (HRD) model. The HRD model assumes that data flows into a buffer of the fixed size BufferSizeInKB with a constant bitrate TargetKbps. (Estimate the targeted frame size by dividing the frame rate by the bitrate.)

The decoder starts decoding after the buffer reaches the initial size InitialDelayInKB, which is equivalent to reaching an initial delay of InitialDelayInKB*8000/TargetKbpsms. In this context, KB is 1000 bytes and Kbps is 1000 bps.

If InitialDelayInKB or BufferSizeInKB is equal to zero, the value is calculated using bitrate, frame rate, profile, level, and so on.

TargetKbps must be specified for encoding initialization.

For variable bitrate control, the MaxKbps parameter specifies the maximum bitrate at which the encoded data enters the Video Buffering Verifier (VBV) buffer. If MaxKbps is equal to zero, the value is calculated from bitrate, frame rate, profile, and level.

Note

The mfxInfoMFX::TargetKbps, mfxInfoMFX::Accuracy, mfxInfoMFX::Convergence parameters are for the average variable bitrate control (AVBR) algorithm. The algorithm focuses on overall encoding quality while meeting the specified bitrate, TargetKbps, within the accuracy range, Accuracy, after a Convergence period. This method does not follow HRD and the instant bitrate is not capped or padded.

## mfxFrameId¶

struct mfxFrameId

The mfxFrameId structure describes the view and layer of a frame picture.

Public Members

mfxU16 TemporalId

The temporal identifier as defined in the annex H of the ITU*-T H.264 specification.

mfxU16 PriorityId

Reserved and must be zero.

mfxU16 DependencyId

Reserved for future use.

mfxU16 QualityId

Reserved for future use.

mfxU16 ViewId

The view identifier as defined in the annex H of the ITU-T H.264 specification.

## mfxFrameInfo¶

struct mfxFrameInfo

The mfxFrameInfo structure specifies properties of video frames. See also “Configuration Parameter Constraints” chapter.

FrameRate

Specify the frame rate by the formula: FrameRateExtN / FrameRateExtD.

For encoding, frame rate must be specified. For decoding, frame rate may be unspecified (FrameRateExtN and FrameRateExtD are all zeros.) In this case, the frame rate is default to 30 frames per second.

mfxU32 FrameRateExtN

Numerator.

mfxU32 FrameRateExtD

Denominator.

AspectRatio

These parameters specify the sample aspect ratio. If sample aspect ratio is explicitly defined by the standards (see Table 6-3 in the MPEG-2 specification or Table E-1 in the H.264 specification), AspectRatioW and AspectRatioH should be the defined values. Otherwise, the sample aspect ratio can be derived as follows:

AspectRatioW=display_aspect_ratio_width*display_height;

AspectRatioH=display_aspect_ratio_height*display_width;

For MPEG-2, the above display aspect ratio must be one of the defined values in Table 6-3. For H.264, there is no restriction on display aspect ratio values.

If both parameters are zero, the encoder uses default value of sample aspect ratio.

mfxU16 AspectRatioW

Ratio for width.

mfxU16 AspectRatioH

Ratio for height.

ROI

Display the region of interest of the frame; specify the display width and height in mfxVideoParam.

mfxU16 CropX

X coordinate.

mfxU16 CropY

Y coordinate.

mfxU16 CropW

Width in pixels.

mfxU16 CropH

Height in pixels.

Public Members

mfxU32 reserved[4]

Reserved for future use.

mfxU16 reserved4

Reserved for future use.

mfxU16 BitDepthLuma

Number of bits used to represent luma samples.

Note

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

mfxU16 BitDepthChroma

Number of bits used to represent chroma samples.

Note

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

mfxU16 Shift

When not zero indicates that values of luma and chroma samples are shifted. Use BitDepthLuma and BitDepthChroma to calculate shift size. Use zero value to indicate absence of shift.

Note

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

mfxFrameId FrameId

Frame ID. Describes the view and layer of a frame picture.

mfxU32 FourCC

FourCC code of the color format; see the ColorFourCC enumerator for details.

mfxU16 Width

Width of the video frame in pixels. Must be a multiple of 16.

mfxU16 Height

Height of the video frame in pixels. Must be a multiple of 16 for progressive frame sequence and a multiple of 32 otherwise.

mfxU64 BufferSize

Size of frame buffer in bytes. Valid only for plain formats (when FourCC is P8); Width, Height and crops in this case are invalid.

mfxU16 PicStruct

Picture type as specified in the PicStruct enumerator.

mfxU16 ChromaFormat

Color sampling method; the value of ChromaFormat is the same as that of ChromaFormatIdc. ChromaFormat is not defined if FourCC is zero.

Note

Data alignment for Shift = 0

Data alignment for Shift != 0

## mfxVideoParam¶

struct mfxVideoParam

The mfxVideoParam structure contains configuration parameters for encoding, decoding, transcoding and video processing.

Public Members

mfxU32 AllocId

Unique component ID that will be passed by SDK to mfxFrameAllocRequest. Useful in pipelines where several components of the same type share the same allocator.

mfxU16 AsyncDepth

Specifies how many asynchronous operations an application performs before the application explicitly synchronizes the result. If zero, the value is not specified.

mfxInfoMFX mfx

Configurations related to encoding, decoding and transcoding; see the definition of the mfxInfoMFX structure for details.

mfxInfoVPP vpp

Configurations related to video processing; see the definition of the mfxInfoVPP structure for details.

mfxU16 Protected

Specifies the content protection mechanism; see the Protected enumerator for a list of supported protection schemes.

mfxU16 IOPattern

Input and output memory access types for SDK functions; see the enumerator IOPattern for details. The Query functions return the natively supported IOPattern if the Query input argument is NULL. This parameter is a mandated input for QueryIOSurf and Init functions. For DECODE, the output pattern must be specified; for ENCODE, the input pattern must be specified; and for VPP, both input and output pattern must be specified.

mfxExtBuffer **ExtParam

The number of extra configuration structures attached to this structure.

mfxU16 NumExtParam

Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations. The list of extended buffers should not contain duplicated entries, i.e. entries of the same type. If mfxVideoParam structure is used to query the SDK capability, then list of extended buffers attached to input and output mfxVideoParam structure should be equal, i.e. should contain the same number of extended buffers of the same type.

## mfxFrameData¶

struct mfxY410

The mfxY410 structure specifies “pixel” in Y410 color format

Public Members

mfxU32 U

U component.

mfxU32 Y

Y component.

mfxU32 V

V component.

mfxU32 A

A component.

struct mfxA2RGB10

The mfxA2RGB10 structure specifies “pixel” in A2RGB10 color format

Public Members

mfxU32 B

B component.

mfxU32 G

G component.

mfxU32 R

R component.

mfxU32 A

A component.

struct mfxFrameData

The mfxFrameData structure describes frame buffer pointers.

Extension Buffers

mfxU16 NumExtParam

The number of extra configuration structures attached to this structure.

General members

mfxU16 reserved[9]

Reserved for future use

mfxU16 MemType

Allocated memory type; see the ExtMemFrameType enumerator for details. Used for better integration of] 3rd party plugins into SDK pipeline.

mfxU16 PitchHigh

Distance in bytes between the start of two consecutive rows in a frame.

mfxU64 TimeStamp

Time stamp of the video frame in units of 90KHz (divide TimeStamp by 90,000 (90 KHz) to obtain the time in seconds). A value of MFX_TIMESTAMP_UNKNOWN indicates that there is no time stamp.

mfxU32 FrameOrder

Current frame counter for the top field of the current frame; an invalid value of MFX_FRAMEORDER_UNKNOWN indicates that SDK functions that generate the frame output do not use this frame.

mfxU16 Locked

Counter flag for the application; if Locked is greater than zero then the application locks the frame or field pair. Do not move, alter or delete the frame.

Color Planes

Data pointers to corresponding color channels (planes). The frame buffer pointers must be 16-byte aligned. The application has to specify pointers to all color channels even for packed formats. For example, for YUY2 format the application has to specify Y, U and V pointers. For RGB32 – R, G, B and A pointers.

mfxU8 *A

A channel.

mfxMemId MemId

Memory ID of the data buffers; if any of the preceding data pointers is non-zero then the SDK ignores MemId.

mfxU16 Corrupted

Some part of the frame or field pair is corrupted. See the Corruption enumerator for details.

mfxU16 DataFlag

Additional flags to indicate frame data properties. See the FrameDataFlag enumerator for details.

Public Members

mfxExtBuffer **ExtParam

Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations.

mfxU16 PitchLow

Distance in bytes between the start of two consecutive rows in a frame.

mfxU8 *Y

Y channel.

mfxU16 *Y16

Y16 channel.

mfxU8 *R

R channel.

mfxU8 *UV

UV channel for UV merged formats.

mfxU8 *VU

YU channel for VU merged formats.

mfxU8 *CbCr

CbCr channel for CbCr merged formats.

mfxU8 *CrCb

CrCb channel for CrCb merged formats.

mfxU8 *Cb

Cb channel.

mfxU8 *U

U channel.

mfxU16 *U16

U16 channel.

mfxU8 *G

G channel.

mfxY410 *Y410

T410 channel for Y410 format (merged AVYU).

mfxU8 *Cr

Cr channel.

mfxU8 *V

V channel.

mfxU16 *V16

V16 channel.

mfxU8 *B

B channel.

mfxA2RGB10 *A2RGB10

A2RGB10 channel for A2RGB10 format (merged ARGB).

## mfxFrameSurfaceInterface¶

struct mfxFrameSurfaceInterface

Public Members

mfxHDL Context

This context of memory interface. User should not touch (change, set, null) this pointer.

mfxStructVersion Version

The version of the structure.

mfxStatus (*AddRef)(mfxFrameSurface1 *surface)

This function increments the internal reference counter of the surface, so user is going to keep the surface. The surface cannot be destroyed until user wouldn’t call (*Release). It’s expected that users would call (*AddRef)() each time when they create new links (copy structure, etc) to the surface for proper management.

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if surface is NULL.

MFX_ERR_INVALID_HANDLE if mfxFrameSurfaceInterface->Context is invalid (for example NULL).

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface.

mfxStatus (*Release)(mfxFrameSurface1 *surface)

This function decrements the internal reference counter of the surface, users have to care about calling of (*Release) after (*AddRef) or when it’s required according to the allocation logic. For instance, users have to call (*Release) to release a surface obtained with GetSurfaceForXXX function.

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if surface is NULL.

MFX_ERR_INVALID_HANDLE if mfxFrameSurfaceInterface->Context is invalid (for example NULL).

MFX_ERR_UNDEFINED_BEHAVIOR if Reference Counter of surface is zero before call.

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface.

mfxStatus (*GetRefCounter)(mfxFrameSurface1 *surface, mfxU32 *counter)

This function returns current reference counter of mfxFrameSurface1 structure.

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if surface or counter is NULL.

MFX_ERR_INVALID_HANDLE if mfxFrameSurfaceInterface->Context is invalid (for example NULL).

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface.

• [out] counter: sets counter to the current reference counter value.

mfxStatus (*Map)(mfxFrameSurface1 *surface, mfxU32 flags)

This function set pointers of surface->Info.Data to actual pixel data, providing read-write access. In case of video memory, actual surface with data in video memory becomes mapped to system memory. An application can map a surface for read with any value of mfxFrameSurface1::Data.Locked, but for write only when mfxFrameSurface1::Data.Locked equals to 0. Note: surface allows shared read access, but exclusive write access.Let consider the following cases: -Map with Write or Read|Write flags. Request during active another read or write access returns MFX_ERR_LOCK_MEMORY error immediately, without waiting. MFX_MAP_NOWAIT doesn’t impact behavior. Such request doesn’t lead to any implicit synchronizations. -Map with Read flag. Request during active write access will wait for resource to become free, or exits immediately with error if MFX_MAP_NOWAIT flag was set. This request may lead to the implicit synchronization (with same logic as Synchronize call) waiting for surface to become ready to use (all dependencies should be resolved and upstream components finished writing to this surface). It is guaranteed that read access will be acquired right after synchronization without allowing other thread to acquire this surface for writing. If MFX_MAP_NOWAIT was set and surface isn’t ready yet (has some unresolved data dependencies or active processing) read access request exits immediately with error. Read-write access with MFX_MAP_READ_WRITE provides exclusive simultaneous reading and writing access.

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if surface is NULL.

MFX_ERR_INVALID_HANDLE if mfxFrameSurfaceInterface->Context is invalid (for example NULL).

MFX_ERR_UNSUPPORTED if flags are invalid.

MFX_ERR_LOCK_MEMORY if user wants to map the surface for write and surface->Data.Locked doesn’t equal to 0.

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface.

• [out] flags: to specify mapping mode.

• [out] surface->Info.Data: - pointers set to actual pixel data.

mfxStatus (*Unmap)(mfxFrameSurface1 *surface)

This function invalidates pointers of surface->Info.Data and sets them to NULL. In case of video memory, actual surface with data in video memory becomes unmapped.

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if surface is NULL.

MFX_ERR_INVALID_HANDLE if mfxFrameSurfaceInterface->Context is invalid (for example NULL).

MFX_ERR_UNSUPPORTED if surface is already unmapped.

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface

• [out] surface->Info.Data: - pointers set to NULL

mfxStatus (*GetNativeHandle)(mfxFrameSurface1 *surface, mfxHDL *resource, mfxResourceType *resource_type)

This function returns a native resource’s handle and type. The handle is returned as-is that means the reference counter of base resources is not incremented. Native resource is not detached from surface, the library still owns the resource. User must not anyhow destroy native resource or rely that this resource will be alive after (*Release).

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if any of surface, resource or resource_type is NULL.

MFX_ERR_INVALID_HANDLE if any of surface, resource or resource_type is not valid object (no native resource was allocated).

MFX_ERR_UNSUPPORTED if surface is in system memory.

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface.

• [out] resource: - pointer is set to the native handle of the resource.

• [out] resource_type: - type of native resource (see mfxResourceType enumeration).

mfxStatus (*GetDeviceHandle)(mfxFrameSurface1 *surface, mfxHDL *device_handle, mfxHandleType *device_type)

This function returns a device abstraction which was used to create that resource. The handle is returned as-is that means the reference counter for device abstraction is not incremented. Native resource is not detached from surface, the library still has a reference to the resource. User must not anyhow destroy device or rely that this device will be alive after (*Release).

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if any of surface, devic_handle or device_type is NULL.

MFX_ERR_INVALID_HANDLE if any of surface, resource or resource_type is not valid object (no native resource was allocated).

MFX_ERR_UNSUPPORTED if surface is in system memory.

MFX_ERR_UNKNOWN in case of any internal error.

Parameters
• [in] surface: valid surface.

• [out] device_handle: - pointer is set to the device which created the resource

• [out] device_type: - type of device (see mfxHandleType enumeration).

mfxStatus (*Synchronize)(mfxFrameSurface1 *surface, mfxU32 wait)

This function guarantees readiness both of the data (pixels) and any frame’s meta information (e.g. corruption flags) after function complete. Instead of MFXVideoCORE_SyncOperation users may directly call (*Synchronize) after correspondent Decode/VPP function calls (MFXVideoDECODE_DecodeFrameAsync or MFXVideoVPP_RunFrameVPPAsync). The prerequisites to call the functions are: main processing functions returned MFX_ERR_NONE and valid mfxFrameSurface1 object.

Return

MFX_ERR_NONE if no error.

MFX_ERR_NULL_PTR if surface is NULL.

MFX_ERR_INVALID_HANDLE if any of surface is not valid object .

MFX_WRN_IN_EXECUTION if the given timeout is expired and the surface 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 in case of any internal error.

Parameters
• [in] surface: - valid surface.

• [out] wait: - wait time in milliseconds.

## mfxFrameSurface1¶

struct mfxFrameSurface1

The mfxFrameSurface1 structure defines the uncompressed frames surface information and data buffers. The frame surface is in the frame or complementary field pairs of pixels up to four color-channels, in two parts: mfxFrameInfo and mfxFrameData.

Public Members

struct mfxFrameSurfaceInterface *FrameInterface

mfxFrameSurfaceInterface specifies interface to work with surface.

mfxFrameInfo Info

mfxFrameInfo structure specifies surface properties.

mfxFrameData Data

mfxFrameData structure describes the actual frame buffer.

## mfxBitstream¶

struct mfxBitstream

The mfxBitstream structure defines the buffer that holds compressed video data.

Public Members

mfxEncryptedData *EncryptedData

Reserved and must be zero.

mfxExtBuffer **ExtParam

Array of extended buffers for additional bitstream configuration. See the ExtendedBufferID enumerator for a complete list of extended buffers.

mfxU16 NumExtParam

The number of extended buffers attached to this structure.

mfxI64 DecodeTimeStamp

Decode time stamp of the compressed bitstream in units of 90KHz. A value of MFX_TIMESTAMP_UNKNOWN indicates that there is no time stamp. This value is calculated by the SDK encoder from the presentation time stamp provided by the application in mfxFrameSurface1 structure and from the frame rate provided by the application during the SDK encoder initialization.

mfxU64 TimeStamp

Time stamp of the compressed bitstream in units of 90KHz. A value of MFX_TIMESTAMP_UNKNOWN indicates that there is no time stamp.

mfxU8 *Data

Bitstream buffer pointer, 32-bytes aligned.

mfxU32 DataOffset

Next reading or writing position in the bitstream buffer.

mfxU32 DataLength

Size of the actual bitstream data in bytes.

mfxU32 MaxLength

Allocated bitstream buffer size in bytes.

mfxU16 PicStruct

Type of the picture in the bitstream; this is an output parameter.

mfxU16 FrameType

Frame type of the picture in the bitstream; this is an output parameter.

mfxU16 DataFlag

Indicates additional bitstream properties; see the BitstreamDataFlag enumerator for details.

mfxU16 reserved2

Reserved for future use.

## mfxEncodeStat¶

struct mfxEncodeStat

The mfxEncodeStat structure 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.

## mfxDecodeStat¶

struct mfxDecodeStat

The mfxDecodeStat structure returns statistics collected during decoding.

Public Members

mfxU32 NumFrame

Number of total decoded frames.

mfxU32 NumSkippedFrame

Number of skipped frames.

mfxU32 NumError

Number of errors recovered.

mfxU32 NumCachedFrame

Number of internally cached frames.

struct mfxPayload

The mfxPayload structure describes user data payload in MPEG-2 or SEI message payload in H.264. For encoding, these payloads can be inserted into the bitstream. The payload buffer must contain a valid formatted payload. For H.264, this is the sei_message() as specified in the section 7.3.2.3.1 ‘Supplemental enhancement information message syntax’ of the ISO/IEC 14496-10 specification. For MPEG-2, this is the section 6.2.2.2.2 ‘User data’ of the ISO/IEC 13818-2 specification, excluding the user data start_code. For decoding, these payloads can be retrieved as the decoder parses the bitstream and caches them in an internal buffer.

Public Members

mfxU32 CtrlFlags

mfxU8 *Data

Pointer to the actual payload data buffer.

mfxU32 NumBit

Number of bits in the payload data

mfxU16 Type

MPEG-2 user data start code or H.264 SEI message type.

mfxU16 BufSize

Codec

Supported Types

MPEG2

0x01B2 //User Data

AVC

02 //pan_scan_rect

04 //user_data_registered_itu_t_t35

05 //user_data_unregistered

06 //recovery_point

09 //scene_info

13 //full_frame_freeze

14 //full_frame_freeze_release

15 //full_frame_snapshot

16 //progressive_refinement_segment_start

17 //progressive_refinement_segment_end

19 //film_grain_characteristics

20 //deblocking_filter_display_preference

21 //stereo_video_info

45 //frame_packing_arrangement

HEVC

All

## mfxEncodeCtrl¶

struct mfxEncodeCtrl

The mfxEncodeCtrl structure contains parameters for per-frame based encoding control.

Public Members

mfxExtBuffer Header

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 SDK 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 SDK encoder silently ignores it.

mfxU16 SkipFrame

Indicates that current frame should be skipped or number of missed frames before the current frame. See the 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 usage 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.

## mfxFrameAllocRequest¶

struct mfxFrameAllocRequest

The mfxFrameAllocRequest structure describes multiple frame allocations when initializing encoders, decoders and video preprocessors. A range specifies the number of video frames. Applications are free to allocate additional frames. In any case, the minimum number of frames must be at least NumFrameMin or the called function will return an error.

Public Members

mfxU32 AllocId

Unique (within the session) ID of component requested the allocation.

mfxFrameInfo Info

Describes the properties of allocated frames.

mfxU16 Type

Allocated memory type; see the ExtMemFrameType enumerator for details.

mfxU16 NumFrameMin

Minimum number of allocated frames.

mfxU16 NumFrameSuggested

Suggested number of allocated frames.

## mfxFrameAllocResponse¶

struct mfxFrameAllocResponse

The mfxFrameAllocResponse structure describes the response to multiple frame allocations. The calling function returns the number of video frames actually allocated and pointers to their memory IDs.

Public Members

mfxU32 AllocId

Unique (within the session) ID of component requested the allocation.

mfxMemId *mids

Pointer to the array of the returned memory IDs; the application allocates or frees this array.

mfxU16 NumFrameActual

Number of frames actually allocated.

## mfxFrameAllocator¶

struct mfxFrameAllocator

The mfxFrameAllocator structure describes the callback functions Alloc, Lock, Unlock, GetHDL and Free that the SDK implementation might use for allocating internal frames. Applications that operate on OS-specific video surfaces must implement these callback functions.

Using the default allocator implies that frame data passes in or out of SDK functions through pointers, as opposed to using memory IDs.

The SDK behavior is undefined when using an incompletely defined external allocator. See the section Memory Allocation and External Allocators for additional information.

Public Members

mfxHDL pthis

Pointer to the allocator object.

mfxStatus (*Alloc)(mfxHDL pthis, mfxFrameAllocRequest *request, mfxFrameAllocResponse *response)

This function allocates surface frames. For decoders, MFXVideoDECODE_Init calls Alloc only once. That call includes all frame allocation requests. For encoders, MFXVideoENCODE_Init calls Alloc twice: once for the input surfaces and again for the internal reconstructed surfaces.

If two SDK components must share DirectX* surfaces, this function should pass the pre-allocated surface chain to SDK instead of allocating new DirectX surfaces. See the Surface Pool Allocation section for additional information.

Return

MFX_ERR_NONE The function successfully allocated the memory block.

MFX_ERR_MEMORY_ALLOC The function failed to allocate the video frames.

MFX_ERR_UNSUPPORTED The function does not support allocating the specified type of memory.

Parameters
• [in] pthis: Pointer to the allocator object.

• [in] request: Pointer to the mfxFrameAllocRequest structure that specifies the type and number of required frames.

• [out] response: Pointer to the mfxFrameAllocResponse structure that retrieves frames actually allocated.

mfxStatus (*Lock)(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)

This function locks a frame and returns its pointer.

Return

MFX_ERR_NONE The function successfully locked the memory block.

MFX_ERR_LOCK_MEMORY This function failed to lock the frame.

Parameters
• [in] pthis: Pointer to the allocator object.

• [in] mid: Memory block ID.

• [out] ptr: Pointer to the returned frame structure.

mfxStatus (*Unlock)(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)

This function unlocks a frame and invalidates the specified frame structure.

Return

MFX_ERR_NONE The function successfully locked the memory block.

Parameters
• [in] pthis: Pointer to the allocator object.

• [in] mid: Memory block ID.

• [out] ptr: Pointer to the frame structure; This pointer can be NULL.

mfxStatus (*GetHDL)(mfxHDL pthis, mfxMemId mid, mfxHDL *handle)

This function returns the OS-specific handle associated with a video frame. If the handle is a COM interface, the reference counter must increase. The SDK will release the interface afterward.

Return

MFX_ERR_NONE The function successfully returned the OS-specific handle.

MFX_ERR_UNSUPPORTED The function does not support obtaining OS-specific handle..

Parameters
• [in] pthis: Pointer to the allocator object.

• [in] mid: Memory block ID.

• [out] handle: Pointer to the returned OS-specific handle.

mfxStatus (*Free)(mfxHDL pthis, mfxFrameAllocResponse *response)

This function de-allocates all allocated frames.

Return

MFX_ERR_NONE The function successfully de-allocated the memory block.

Parameters
• [in] pthis: Pointer to the allocator object.

• [in] response: Pointer to the mfxFrameAllocResponse structure returned by the Alloc function.

## mfxComponentInfo¶

struct mfxComponentInfo

The mfxComponentInfo structure contains workload description, which is accepted by MFXQueryAdapters function.

Public Members

mfxComponentType Type

Type of workload: Encode, Decode, VPP. See mfxComponentType enumerator for possible values.

mfxVideoParam Requirements

Detailed description of workload, see mfxVideoParam for details.

struct mfxAdapterInfo

Public Members

mfxPlatform Platform

Platform type description, see mfxPlatform for details.

mfxU32 Number

Value which uniquely characterizes media adapter. On Windows* this number can be used for initialization through DXVA interface (see example).

struct mfxAdaptersInfo

The mfxAdaptersInfo structure contains description of all graphics adapters available on the current system.

Public Members

mfxAdapterInfo *Adapters

Pointer to array of mfxAdapterInfo structs allocated by user.

mfxU32 NumAlloc

mfxU32 NumActual

## mfxQPandMode¶

struct mfxQPandMode

The mfxQPandMode structure 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 valid range is 1..51. For HEVC valid range is 1..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. (align rule is (width +15 /16) && (height +15 /16)) For MPEG2 QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification and have valid range 1..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.

mfxU16 Mode

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

## VPP Structures¶

### mfxInfoVPP¶

struct mfxInfoVPP

Public Members

mfxFrameInfo In

Input format for video processing.

mfxFrameInfo Out

Output format for video processing.

### mfxVPPStat¶

struct mfxVPPStat

The mfxVPPStat structure returns statistics collected during video processing.

Public Members

mfxU32 NumFrame

Total number of frames processed.

mfxU32 NumCachedFrame

Number of internally cached frames.

## Extension buffers structures¶

### mfxExtBuffer¶

struct mfxExtBuffer

This structure is the common header definition for external buffers and video processing hints.

Public Members

mfxU32 BufferId

Identifier of the buffer content. See the ExtendedBufferID enumerator for a complete list of extended buffers.

mfxU32 BufferSz

Size of the buffer.

### mfxExtCodingOption¶

struct mfxExtCodingOption

The mfxExtCodingOption structure specifies additional options for encoding.

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

Public Members

mfxExtBuffer Header

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 SDK Reference Manual for Multi-View Video Coding for more details about usage of this flag.

mfxU16 NalHrdConformance

If this option is turned ON, then AVC encoder produces HRD conformant bitstream. If it is turned OFF, then AVC encoder may, but not necessary does, violate HRD conformance. I.e. this option can force encoder to produce HRD conformant stream, but cannot force it to produce 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 both kinds of messages, provided by application and created by encoder. It is three states option, see CodingOptionValue enumerator for values of this option:

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 identical to NAL HRD parameters content. 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

The mfxExtCodingOption2 structure together with mfxExtCodingOption structure specifies 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

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 SDK encoder achieves this by encoding part of each frame in refresh cycle using intra MBs. MFX_REFRESH_NO means no refresh. MFX_REFRESH_VERTICAL means vertical refresh, by column of MBs. MFX_REFRESH_HORIZONTAL means horizontal refresh, by rows of MBs. MFX_REFRESH_SLICE means horizontal refresh by slices without overlapping. In case of MFX_REFRESH_SLICE SDK ignores IntRefCycleSize (size of refresh cycle equals number slices). This parameter is valid during initialization and runtime. When used with temporal scalability, intra refresh applied only to base layer.

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. This is signed value in [-51, 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 SDK 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/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 SDK implementations support this value. Use Query function to check if this feature is supported.

mfxU16 BitrateLimit

Modifies bitrate to be in the range imposed by the SDK encoder. Setting this flag off may lead to violation of HRD conformance. Mind that specifying bitrate below the SDK encoder range might significantly affect quality. If on this option takes effect in non CQP modes: if TargetKbps is not in the range imposed by the SDK encoder, it will be changed to be in the range. See the CodingOptionValue enumerator for values of this option. The default value is ON, i.e. bitrate is limited. This parameter is valid only during initialization. Flag works with MFX_CODEC_AVC only, it is ignored with other codecs.

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

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

mfxU16 LookAheadDepth

Specifies the depth of look ahead rate control algorithm. It is the number of frames that SDK encoder analyzes before encoding. Valid value range is from 10 to 100 inclusive. To instruct the SDK encoder to use the default value the application should zero this field.

mfxU16 Trellis

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

mfxU16 RepeatPPS

This flag controls picture parameter set repetition in AVC encoder. Turn ON this flag 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

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

mfxU16 AdaptiveI

This flag controls insertion of I frames by the SDK encoder. Turn ON this flag 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

This flag controls changing of frame type from B to P. Turn ON this flag to allow such changing. 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

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

mfxU16 NumMbPerSlice

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

mfxU16 SkipFrame

This option enables usage of mfxEncodeCtrl::SkipFrameparameter. See the SkipFrame enumerator for values of this option.

Note

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

mfxU8 MinQPI

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

Note

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

mfxU8 MaxQPI

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

Note

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

mfxU8 MinQPP

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

Note

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

mfxU8 MaxQPP

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

Note

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

mfxU8 MinQPB

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

Note

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

mfxU8 MaxQPB

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

Note

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

mfxU16 FixedFrameRate

This option sets fixed_frame_rate_flag in VUI.

Note

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

mfxU16 DisableDeblockingIdc

This option disables deblocking.

Note

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

mfxU16 DisableVUI

This option completely disables VUI in output bitstream.

Note

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

mfxU16 BufferingPeriodSEI

This option 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

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

mfxU16 UseRawRef

Turn ON this flag 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 SDK implementations support this value. Use Query function to check if this feature is supported.

### mfxExtCodingOption3¶

struct mfxExtCodingOption3

The mfxExtCodingOption3 structure together with mfxExtCodingOption and mfxExtCodingOption2 structures specifies 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

mfxU16 NumSliceI

The number of slices for I frames.

Note

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

mfxU16 NumSliceP

The number of slices for P frames.

Note

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

mfxU16 NumSliceB

The number of slices for B frames.

Note

Not all codecs and SDK implementations support these values. Use Query 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.It is a value in the 1,…,51 range, where 1 corresponds to the best quality.

mfxU16 EnableMBQP

Turn ON this option 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

Turn ON this option 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

Turn ON this option 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 Log2MaxMvLengthHorizontal
mfxU16 Log2MaxMvLengthVertical
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.

mfxI16 DeblockingAlphaTcOffset
mfxI16 DeblockingBetaOffset
mfxU16 GPB

Turn this option 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 SDK 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.

mfxU32 reserved3[3]
mfxU16 EnableQPOffset

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

mfxI16 QPOffset[8]

When EnableQPOffset set to ON and RateControlMethod is CQP specifies QP offset per pyramid layer. 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 and B frames in reference picture lists 0 and 1 correspondingly. Array index is pyramid layer. 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 ConstrainedIntraPredFlag
mfxU16 TransformSkip

For HEVC if this option turned ON, 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 source one. TargetChromaFormatPlus1 = 0 mean 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 one. 0 mean default target bit-depth which is equal to source (mfxVideoParam::mfx::FrameInfo::BitDepthLuma).

mfxU16 TargetBitDepthChroma

Target encoding bit-depth for chroma samples. May differ from source one. 0 mean default target bit-depth which 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, e.g. cases when MaxFrameSize == (MaxKbps*1000)/(8* FrameRateExtN/FrameRateExtD). Also MaxFrameSizeI and MaxFrameSizeP can be set separately.

mfxU16 EnableMBForceIntra

Turn ON this option 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 option is 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, MFX_CODINGOPTION_OFF forces encoder to favor performance.

mfxU16 QuantScaleType
mfxU16 IntraVLCFormat
mfxU16 ScanType
mfxU16 EncodedUnitsInfo

Turn this option ON to make encoded units info available in mfxExtEncodedUnitsInfo.

mfxU16 EnableNalUnitType

If this option is turned ON, then HEVC encoder uses NAL unit type provided by application in mfxEncodeCtrl::MfxNalUnitType field.

Note

This parameter is valid only during initialization.

Note

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

mfxU16 ExtBrcAdaptiveLTR

Turn OFF to prevent Adaptive marking of Long Term Reference Frames when using ExtBRC. When ON and using ExtBRC, encoders will mark, modify, or remove LTR frames based on encoding parameters and content properties. The application must set each input frame’s mfxFrameData::FrameOrder for correct operation of LTR.

mfxU16 reserved[163]

### mfxExtCodingOptionSPSPPS¶

struct mfxExtCodingOptionSPSPPS

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

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 SDK 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

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.

struct mfxExtInsertHeaders

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

Public Members

mfxExtBuffer Header

mfxU16 SPS

tri-state option to insert SPS

mfxU16 PPS

tri-state option to insert PPS

mfxU16 reserved[8]

### mfxExtCodingOptionVPS¶

struct mfxExtCodingOptionVPS

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

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

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.

struct mfxExtThreadsParam

Attached to the mfxInitParam structure during the SDK session initialization, mfxExtThreadsParam structure specifies options for threads created by this session.

Public Members

mfxExtBuffer Header

mfxU16 NumThread

mfxI32 SchedulingType

mfxI32 Priority

mfxU16 reserved[55]

Reserved for future use

### mfxExtVideoSignalInfo¶

struct mfxExtVideoSignalInfo

The mfxExtVideoSignalInfo structure defines the video signal information.

For H.264, see Annex E of the ISO/IEC 14496-10 specification for the definition of these parameters.

For MPEG-2, see section 6.3.6 of the ITU* H.262 specification for the definition of these parameters. The field VideoFullRange is ignored.

For VC-1, see section 6.1.14.5 of the SMPTE* 421M specification. The fields VideoFormat and VideoFullRange are ignored.

Note

If ColourDescriptionPresent is zero, the color description information (including ColourPrimaries, TransferCharacteristics, and MatrixCoefficients) will/does not present in the bitstream.

Public Members

mfxExtBuffer Header

mfxU16 VideoFormat
mfxU16 VideoFullRange
mfxU16 ColourDescriptionPresent
mfxU16 ColourPrimaries
mfxU16 TransferCharacteristics
mfxU16 MatrixCoefficients

### mfxExtAVCRefListCtrl¶

struct mfxExtAVCRefListCtrl

The mfxExtAVCRefListCtrl structure configures reference frame options for the H.264 encoder. See Reference List Selection and Long-term Reference frame chapters for more details.

mfxExtAVCRefListCtrl::PreferredRefList Specify list of frames that should be used to predict the current frame.

Note

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

mfxExtAVCRefListCtrl::RejectedRefList Specify list of frames that should not be used for prediction.

mfxExtAVCRefListCtrl::LongTermRefList Specify list of frames that should be marked as long-term reference frame.

Public Members

mfxExtBuffer Header

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.

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 SDK encoder to mark long-term reference frame.

mfxU16 reserved[3]

Reserved

struct mfxExtAVCRefListCtrl::[anonymous] PreferredRefList[32]
struct mfxExtAVCRefListCtrl::[anonymous] RejectedRefList[16]
struct mfxExtAVCRefListCtrl::[anonymous] LongTermRefList[16]
mfxU16 ApplyLongTermIdx

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

### mfxExtMasteringDisplayColourVolume¶

struct mfxExtMasteringDisplayColourVolume

The mfxExtMasteringDisplayColourVolume configures the HDR SEI message. If application attaches this structure to the mfxEncodeCtrl at runtime, the encoder inserts the HDR SEI message for current frame and ignores InsertPayloadToggle. If application attaches this structure to the mfxVideoParam during initialization or reset, the encoder inserts HDR SEI message based on InsertPayloadToggle. Fields semantic defined in ITU-T* H.265 Annex D.

Public Members

mfxExtBuffer Header

mfxU16 InsertPayloadToggle

mfxU16 DisplayPrimariesX[3]

Color primaries for a video source in increments of 0.00002. Consist of RGB x coordinates and define how to convert colors from RGB color space to CIE XYZ color space. These fields belong to the [0..50000] range.

mfxU16 DisplayPrimariesY[3]

Color primaries for a video source in increments of 0.00002. Consist of RGB y coordinates and define how to convert colors from RGB color space to CIE XYZ color space. These fields belong to the [0..50000] range.

mfxU16 WhitePointX

White point X coordinate.

mfxU16 WhitePointY

White point Y coordinate.

mfxU32 MaxDisplayMasteringLuminance

Specify maximum luminance of the display on which the content was authored in units of 0.00001 candelas per square meter. These fields belong to the [1..65535] range.

mfxU32 MinDisplayMasteringLuminance

Specify minimum luminance of the display on which the content was authored in units of 0.00001 candelas per square meter. These fields belong to the [1..65535] range.

### mfxExtContentLightLevelInfo¶

struct mfxExtContentLightLevelInfo

The mfxExtContentLightLevelInfo structure configures the HDR SEI message. If application attaches this structure to the mfxEncodeCtrl structure at runtime, the encoder inserts the HDR SEI message for current frame and ignores InsertPayloadToggle. If application attaches this structure to the mfxVideoParam structure during initialization or reset, the encoder inserts HDR SEI message based on InsertPayloadToggle. Fields semantic defined in ITU-T* H.265 Annex D.

Public Members

mfxExtBuffer Header

mfxU16 InsertPayloadToggle

mfxU16 MaxContentLightLevel

Maximum luminance level of the content. The field belongs to the [1..65535] range.

mfxU16 MaxPicAverageLightLevel

Maximum average per-frame luminance level of the content. The field belongs to the [1..65535] range.

### mfxExtPictureTimingSEI¶

struct mfxExtPictureTimingSEI

The mfxExtPictureTimingSEI structure configures the H.264 picture timing SEI message. The encoder ignores it if HRD information in stream is absent and PicTimingSEI option in 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

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]

### mfxExtAvcTemporalLayers¶

struct mfxExtAvcTemporalLayers

The mfxExtAvcTemporalLayers structure configures the H.264 temporal layers hierarchy. If application attaches it to the mfxVideoParam structure during initialization, the SDK 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

mfxU16 BaseLayerPID

The priority ID of the base layer; the SDK 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.

### mfxExtEncoderCapability¶

struct mfxExtEncoderCapability

The mfxExtEncoderCapability structure is used to retrieve SDK encoder capability. See description of mode 4 of the MFXVideoENCODE_Query function for details how to use this structure.

Note

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

Public Members

mfxExtBuffer Header

mfxU32 MBPerSec

Specify the maximum processing rate in macro blocks per second.

### mfxExtEncoderResetOption¶

struct mfxExtEncoderResetOption

The mfxExtEncoderResetOption structure is used to control the SDK encoder behavior during reset. By using this structure, the application instructs the SDK encoder to start new coded sequence after reset or continue encoding of current sequence.

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

Using this structure may cause next status codes from MFXVideoENCODE_Reset and MFXVideoENCODE_Queryfunctions:

• MFX_ERR_INVALID_VIDEO_PARAM - if such 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 set StartNewSequence to on and requests resolution change to bigger than initialization value.

• MFX_ERR_NONE - if such reset is possible.

There is limited list of parameters that can be changed without starting a new coded sequence:

• Bitrate parameters, TargetKbps and MaxKbps in the mfxInfoMFX structure.

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

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

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

As it is described in Configuration Change chapter, the application should retrieve all cached frames before calling reset. When query 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 SDK encoder, then query result may differ from reset one, because the SDK encoder may insert IDR frame to produce valid coded sequence.

Note

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

Public Members

mfxExtBuffer Header

mfxU16 StartNewSequence

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

MFX_CODINGOPTION_ON – the SDK 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 SDK 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 SDK encoder may or may not start new coded sequence. This value is also used to query reset outcome.

### mfxExtAVCEncodedFrameInfo¶

struct mfxExtAVCEncodedFrameInfo

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

Note

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

Public Members

mfxExtBuffer Header

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.

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] UsedRefListL1[32]

Reference lists that have been used to encode picture.

### mfxExtEncoderROI¶

struct mfxExtEncoderROI

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

Public Members

mfxExtBuffer Header

mfxU16 NumROI

Number of ROI descriptions in array. The Query 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.

mfxU32 Left

Left ROI’s coordinate.

mfxU32 Top

Top ROI’s coordinate.

mfxU32 Right

Right ROI’s coordinate.

mfxU32 Bottom

Bottom ROI’s coordinate.

mfxI16 DeltaQP

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

struct mfxExtEncoderROI::[anonymous] ROI[256]

ROI location rectangle. ROI rectangle definition is using 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 SDK 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. Array of ROIs. Different ROI may overlap each other. If macroblock belongs to several ROI, Priority from ROI with lowest index is used.

### mfxExtEncoderIPCMArea¶

struct mfxExtEncoderIPCMArea

Public Members

mfxExtBuffer Header

mfxU32 Left

Left Area’s coordinate.

mfxU32 Top

Top Area’s coordinate.

mfxU32 Right

Right Area’s coordinate.

mfxU32 Bottom

Bottom Area’s coordinate.

struct mfxExtEncoderIPCMArea::[anonymous] Area[64]

Number of Area’s

### mfxExtAVCRefLists¶

struct mfxExtAVCRefLists

The mfxExtAVCRefLists structure specifies reference lists for the SDK encoder. It may be used together with the mfxExtAVCRefListCtrl structure to create customized reference lists. If both structures are used together, then the SDK encoder takes reference lists from 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 SDK encoder support this structure. The application has to use query function to determine if it is supported

Public Members

mfxExtBuffer Header

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 mfxExtAVCRefLists::mfxRefPic RefPicList1[32]

Specify L0 and L1 reference lists.

struct mfxRefPic

Public Members

mfxU32 FrameOrder

Together these fields are used to identify reference picture. Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry. Use PicStruct = MFX_PICSTRUCT_FIELD_TFF for TOP field, PicStruct = MFX_PICSTRUCT_FIELD_BFF for BOTTOM field.

mfxU16 PicStruct

Together these fields are used to identify reference picture. Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry. Use PicStruct = MFX_PICSTRUCT_FIELD_TFF for TOP field, PicStruct = MFX_PICSTRUCT_FIELD_BFF for BOTTOM field.

### mfxExtChromaLocInfo¶

struct mfxExtChromaLocInfo

The mfxExtChromaLocInfo structure defines the location of chroma samples information.

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

mfxU16 ChromaLocInfoPresentFlag
mfxU16 ChromaSampleLocTypeTopField
mfxU16 ChromaSampleLocTypeBottomField
mfxU16 reserved[9]

### mfxExtMBForceIntra¶

struct mfxExtMBForceIntra

The mfxExtMBForceIntra structure 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 during runtime.

Public Members

mfxExtBuffer Header

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 – bottom field.

### mfxExtMBQP¶

struct mfxExtMBQP

The mfxExtMBQP structure 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 during runtime.

Public Members

mfxExtBuffer Header

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 top field and the second – bottom field. Valid when Mode = MFX_MBQP_MODE_QP_VALUE

For AVC valid range is 1..51.

For HEVC valid range is 1..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. (align rule is (width +15 /16) && (height +15 /16))

For MPEG2 QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification and have valid range 1..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.

### mfxExtHEVCTiles¶

struct mfxExtHEVCTiles

The mfxExtHEVCTiles structure 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

mfxU16 NumTileRows

Number of tile rows.

mfxU16 NumTileColumns

Number of tile columns.

### mfxExtMBDisableSkipMap¶

struct mfxExtMBDisableSkipMap

The mfxExtMBDisableSkipMap structure 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 during runtime.

Public Members

mfxExtBuffer Header

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 top field and the second – bottom field.

### mfxExtHEVCParam¶

struct mfxExtHEVCParam

Public Members

mfxExtBuffer Header

mfxU16 PicWidthInLumaSamples

Specifies the width of each coded picture in units of luma samples.

mfxU16 PicHeightInLumaSamples

Specifies the height of each coded picture in units of luma samples.

mfxU64 GeneralConstraintFlags

Additional flags to specify exact profile/constraints. See the GeneralConstraintFlags enumerator for values of this field.

mfxU16 SampleAdaptiveOffset

Controls SampleAdaptiveOffset encoding feature. See enum SampleAdaptiveOffset for supported values (bit-ORed). Valid during encoder Init and Runtime.

mfxU16 LCUSize

Specifies largest coding unit size (max luma coding block). Valid during encoder Init.

### mfxExtDecodeErrorReport¶

struct mfxExtDecodeErrorReport

This structure is used by the SDK decoders to report bitstream error information right after DecodeHeader or DecodeFrameAsync. The application can attach this extended buffer to the mfxBitstream structure at runtime.

Public Members

mfxExtBuffer Header

mfxU32 ErrorTypes

Bitstream error types (bit-ORed values). See ErrorTypes enumerator for the list of possible types.

### mfxExtDecodedFrameInfo¶

struct mfxExtDecodedFrameInfo

This structure is used by the SDK decoders to report additional information about decoded frame. The application can attach this extended buffer to the mfxFrameSurface1::mfxFrameData structure at runtime.

Public Members

mfxExtBuffer Header

mfxU16 FrameType

Frame type. See FrameType enumerator for the list of possible types.

### mfxExtTimeCode¶

struct mfxExtTimeCode

This structure is used by the SDK to pass MPEG 2 specific timing information.

See ISO/IEC 13818-2 and ITU-T H.262, MPEG-2 Part 2 for the definition of these parameters.

Public Members

mfxExtBuffer Header

mfxU16 DropFrameFlag

Indicated dropped frame.

mfxU16 TimeCodeHours

Hours.

mfxU16 TimeCodeMinutes

Minutes.

mfxU16 TimeCodeSeconds

Seconds.

mfxU16 TimeCodePictures

Pictures.

### mfxExtHEVCRegion¶

struct mfxExtHEVCRegion

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

Public Members

mfxExtBuffer Header

mfxU32 RegionId

ID of region.

mfxU16 RegionType

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

mfxU16 RegionEncoding

Set to MFX_HEVC_REGION_ENCODING_ON to encode only specified region.

### mfxExtPredWeightTable¶

struct mfxExtPredWeightTable

When mfxExtCodingOption3::WeightedPred was set to explicit during encoder Init or Reset and the current frame is P-frame or mfxExtCodingOption3::WeightedBiPred was set to explicit during encoder Init or Reset and the current frame is B-frame, attached to mfxEncodeCtrl, this structure specifies weighted prediction table for current frame.

Public Members

mfxExtBuffer Header

mfxU16 LumaLog2WeightDenom

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

mfxU16 ChromaLog2WeightDenom

Base 2 logarithm of the denominator for all chroma weighting factors. Value shall 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

### mfxExtAVCRoundingOffset¶

struct mfxExtAVCRoundingOffset

This structure is used by the SDK 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

mfxU16 EnableRoundingIntra

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

mfxU16 RoundingOffsetIntra

Intra rounding offset. Value shall 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 shall be in the range of 0 to 7, inclusive.

### 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 by SDK to minimal-area block-aligned Dirty rectangle, enclosing the original one. For example (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 frame is not changed.

Public Members

mfxExtBuffer Header

mfxU16 NumRect

Number of dirty rectangles.

mfxU32 Left

Dirty region coordinate.

mfxU32 Top

Dirty region coordinate.

mfxU32 Right

Dirty region coordinate.

mfxU32 Bottom

Dirty region coordinate.

struct mfxExtDirtyRect::[anonymous] Rect[256]

Array of dirty rectangles.

### 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 SDK encoder truncates it to MB boundaries, for example, both 17 and 31 will be truncated to 16.

Public Members

mfxExtBuffer Header

mfxU16 NumRect

Number of moving rectangles.

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.

struct mfxExtMoveRect::[anonymous] Rect[256]

Array of moving rectangles.

### mfxExtMVOverPicBoundaries¶

struct mfxExtMVOverPicBoundaries

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

Public Members

mfxExtBuffer Header

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.

### mfxVP9SegmentParam¶

struct mfxVP9SegmentParam

The mfxVP9SegmentParam structure contains features and parameters for the segment.

Public Members

mfxU16 FeatureEnabled

Indicates which features are enabled for the segment. See SegmentFeature enumerator for values for this option. Values from the enumerator can be bit-OR’ed. Support of particular feature depends on underlying HW platform. Application can check which features are supported by calling of Query.

mfxI16 QIndexDelta

Quantization index delta for the segment. Ignored if MFX_VP9_SEGMENT_FEATURE_QINDEX isn’t set in FeatureEnabled. Valid range for this parameter is [-255, 255]. If QIndexDelta is out of this range, it will be ignored. If QIndexDelta is within valid range, but sum of base quantization index and QIndexDelta is out of [0, 255], QIndexDelta will be clamped.

mfxI16 LoopFilterLevelDelta

Loop filter level delta for the segment. Ignored if MFX_VP9_SEGMENT_FEATURE_LOOP_FILTER isn’t set in FeatureEnabled. Valid range for this parameter is [-63, 63]. If LoopFilterLevelDelta is out of this range, it will be ignored. If LoopFilterLevelDelta is within valid range, but sum of base loop filter level and LoopFilterLevelDelta is out of [0, 63], LoopFilterLevelDelta will be clamped.

mfxU16 ReferenceFrame

Reference frame for the segment. See VP9ReferenceFrame enumerator for values for this option. Ignored if MFX_VP9_SEGMENT_FEATURE_REFERENCE isn’t set in FeatureEnabled.

### mfxExtVP9Segmentation¶

struct mfxExtVP9Segmentation

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

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

Also the buffer can be attached to the mfxEncodeCtrl structure during runtime (dynamic configuration). Dynamic configuration is applied to current frame only (after encoding of current frame SDK Encoder will switch to next dynamic configuration, or to static configuration if dynamic isn’t provided for next frame).

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

Public Members

mfxExtBuffer Header

mfxU16 NumSegments

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

mfxVP9SegmentParam Segment[8]

Array of structures mfxVP9SegmentParam 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. Encoded block which is bigger than SegmentIdBlockSize uses segment_id taken from it’s top-left sub-block from segmentation map. Application can check if particular block size is supported by calling of Query.

mfxU32 NumSegmentIdAlloc

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

mfxU8 *SegmentId

Pointer to segmentation map buffer which holds array of segment_ids in raster scan order. Application is responsible for allocation and release of this memory. Buffer pointed 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 call of MFXVideoENCODE_Close. Buffer pointed by SegmentId provided with mfxEncodeCtrl should be considered in use while input surface is locked by SDK. Every segment_id in the map should be in the range of [0, NumSegments-1]. If some segment_id is out of valid range, segmentation map cannot be applied. If buffer mfxExtVP9Segmentation is attached to mfxEncodeCtrl in runtime, SegmentId can be zero. In this case segmentation map from static configuration will be used.

### mfxVP9TemporalLayer¶

struct mfxVP9TemporalLayer

The mfxVP9TemporalLayer structure specifies temporal layer.

Public Members

mfxU16 FrameRateScale

The ratio between the frame rates of the current temporal layer and the base layer. The SDK treats particular temporal layer as “defined” if it has FrameRateScale > 0. If base layer defined, it must have FrameRateScale equal to 1. FrameRateScale of each next layer (if defined) must be multiple of and greater than FrameRateScale of previous layer.

mfxU16 TargetKbps

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

### mfxExtVP9TemporalLayers¶

struct mfxExtVP9TemporalLayers

The SDK allows to encode VP9 bitstream that contains several subset bitstreams that differ in frame rates also called “temporal layers”. On decoder side each temporal layer can be extracted from coded stream and decoded separately. The mfxExtVP9TemporalLayers structure configures the temporal layers for SDK VP9 encoder. It can be attached to the mfxVideoParam structure during initialization or MFXVideoENCODE_Reset call. If mfxExtVP9TemporalLayers buffer isn’t attached during initialization, temporal scalability is disabled. If the buffer isn’t attached for Reset call, encoder continues to use temporal scalability configuration which was actual before this Reset call. In SDK API temporal layers are ordered by their frame rates in ascending order. Temporal layer 0 (having lowest frame rate) is called base layer. Each next temporal layer includes all previous layers. Temporal scalability feature has requirements for minimum number of allocated reference frames (controlled by SDK API parameter NumRefFrame). If NumRefFrame set by application isn’t enough to build reference structure for requested number of temporal layers, the SDK corrects NumRefFrame. Temporal layer structure is reset (re-started) after key-frames.

Public Members

mfxExtBuffer Header

mfxVP9TemporalLayer Layer[8]

The array of temporal layers. Layer[0] specifies base layer. The SDK reads layers from the array while they are defined (have FrameRateScale>0). All layers starting from first layer with FrameRateScale=0 are ignored. Last layer which is not ignored is “highest layer”. Highest layer has frame rate specified in mfxVideoParam. Frame rates of lower layers are calculated using their FrameRateScale. TargetKbps of highest layer should be equal to TargetKbps specified in mfxVideoParam. If it’s not true, TargetKbps of highest temporal layers has priority. If there are no defined layers in Layer array, temporal scalability feature is disabled. E.g. to disable temporal scalability in runtime, application should pass to Reset call mfxExtVP9TemporalLayers buffer with all FrameRateScale set to 0.

### mfxExtVP9Param¶

struct mfxExtVP9Param

Attached to the mfxVideoParam structure extends it with VP9-specific parameters. Used by both decoder and encoder.

Public Members

mfxExtBuffer Header

mfxU16 FrameWidth

Width of the coded frame in pixels.

mfxU16 FrameHeight

Height of the coded frame in pixels.

mfxU16 WriteIVFHeaders

Turn this option ON to make encoder insert IVF container headers to output stream. NumFrame field of IVF sequence header will be zero, it’s responsibility of application to update it with correct value. See the CodingOptionValue enumerator for values of this option.

mfxI16 QIndexDeltaLumaDC

Specifies an offset for a particular quantization parameter.

mfxI16 QIndexDeltaChromaAC

Specifies an offset for a particular quantization parameter.

mfxI16 QIndexDeltaChromaDC

Specifies an offset for a particular quantization parameter.

mfxU16 NumTileRows

Number of tile rows. Should be power of two. Maximum number of tile rows is 4 (per VP9 specification). In addition maximum supported number of tile rows may depend on underlying hardware platform. Use Query function to check if particular pair of values (NumTileRows, NumTileColumns) is supported. In VP9 tile rows have dependencies and cannot be encoded/decoded in parallel. So tile rows are always encoded by the SDK in serial mode (one-by-one).

mfxU16 NumTileColumns

Number of tile columns. Should be power of two. Restricted with maximum and minimum tile width in luma pixels defined in VP9 specification (4096 and 256 respectively). In addition maximum supported number of tile columns may depend on underlying hardware platform. Use Query function to check if particular pair of values (NumTileRows, NumTileColumns) is supported. In VP9 tile columns don’t have dependencies and can be encoded/decoded in parallel. So tile columns can be encoded by the SDK in both parallel and serial modes. Parallel mode is automatically utilized by the SDK when NumTileColumns exceeds 1 and doesn’t exceed number of tile coding engines on the platform. In other cases serial mode is used. Parallel mode is capable to encode more than 1 tile row (within limitations provided by VP9 specification and particular platform). Serial mode supports only tile grids 1xN and Nx1.

### mfxEncodedUnitInfo¶

struct mfxEncodedUnitInfo

The structure mfxEncodedUnitInfo is used to report encoded unit info.

Public Members

mfxU16 Type

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

mfxU32 Offset

Offset relatively to associated mfxBitstream::DataOffset.

mfxU32 Size

Unit size including delimiter.

### mfxExtEncodedUnitsInfo¶

struct mfxExtEncodedUnitsInfo

If mfxExtCodingOption3::EncodedUnitsInfo was set to MFX_CODINGOPTION_ON during encoder initialization, structure mfxExtEncodedUnitsInfo attached to the mfxBitstream structure during encoding 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 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 AVC encoder supports it.

Public Members

mfxExtBuffer Header

mfxEncodedUnitInfo *UnitInfo

Pointer to an array of structures mfxEncodedUnitsInfo of size 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, UnitInfo array will contain information only for the first NumUnitsAlloc units; user may consider to reallocate UnitInfo array to avoid this for consequent frames.

### mfxExtPartialBitstreamParam¶

struct mfxExtPartialBitstreamParam

This structure is used by an encoder to output parts of bitstream as soon as they ready. The application can attach this extended buffer to the mfxVideoParam structure at init time. If this option is turned ON (Granularity != MFX_PARTIAL_BITSTREAM_NONE), then encoder can output bitstream by part based with 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 SDK implementations support this feature. Use Query function to check if this feature is supported.

Public Members

mfxExtBuffer Header

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.

## VPP Extension Buffers¶

### mfxExtVPPDoNotUse¶

struct mfxExtVPPDoNotUse

The mfxExtVPPDoNotUse structure tells the VPP not to use certain filters in pipeline. See “Configurable VPP filters” table for complete list of configurable filters. The user can attach this structure to the mfxVideoParam structure when initializing video processing.

Public Members

mfxExtBuffer Header

mfxU32 NumAlg

Number of filters (algorithms) not to use

mfxU32 *AlgList

Pointer to a list of filters (algorithms) not to use

### mfxExtVPPDoUse¶

struct mfxExtVPPDoUse

The mfxExtVPPDoUse structure tells the VPP to include certain filters in pipeline.

Each filter may be included in pipeline by two different ways. First one, by adding filter ID to this structure. In this case, default filter parameters are used. Second one, by attaching filter configuration structure directly to the mfxVideoParam structure. In this case, adding filter ID to mfxExtVPPDoUse structure is optional. See Table “Configurable VPP filters” for complete list of configurable filters, their IDs and configuration structures.

The user can attach this structure to the mfxVideoParam structure when initializing video processing.

Note

MFX_EXTBUFF_VPP_COMPOSITE cannot be enabled using mfxExtVPPDoUse because default parameters are undefined for this filter. Application must attach appropriate filter configuration structure directly to the mfxVideoParam structure to enable it.

Public Members

mfxExtBuffer Header

mfxU32 NumAlg

Number of filters (algorithms) to use

mfxU32 *AlgList

Pointer to a list of filters (algorithms) to use

### mfxExtVPPDenoise¶

struct mfxExtVPPDenoise

The mfxExtVPPDenoise structure is a hint structure that configures the VPP denoise filter algorithm.

Public Members

mfxExtBuffer Header

mfxU16 DenoiseFactor

Value of 0-100 (inclusive) indicates the level of noise to remove.

### mfxExtVPPDetail¶

struct mfxExtVPPDetail

The mfxExtVPPDetail structure is a hint structure that configures the VPP detail/edge enhancement filter algorithm.

Public Members

mfxExtBuffer Header

mfxU16 DetailFactor

0-100 value (inclusive) to indicate the level of details to be enhanced.

### mfxExtVPPProcAmp¶

struct mfxExtVPPProcAmp

The mfxExtVPPProcAmp structure is a hint structure that configures the VPP ProcAmp filter algorithm. The structure parameters will be clipped to their corresponding range and rounded by their corresponding increment.

Note

There are no default values for fields in this structure, all settings must be explicitly specified every time this buffer is submitted for processing.

Public Members

mfxExtBuffer Header

mfxF64 Brightness

The brightness parameter is in the range of -100.0F to 100.0F, in increments of 0.1F. Setting this field to 0.0F will disable brightness adjustment.

mfxF64 Contrast

The contrast parameter in the range of 0.0F to 10.0F, in increments of 0.01F, is used for manual contrast adjustment. Setting this field to 1.0F will disable contrast adjustment. If the parameter is negative, contrast will be adjusted automatically.

mfxF64 Hue

The hue parameter is in the range of -180F to 180F, in increments of 0.1F. Setting this field to 0.0F will disable hue adjustment.

mfxF64 Saturation

The saturation parameter is in the range of 0.0F to 10.0F, in increments of 0.01F. Setting this field to 1.0F will disable saturation adjustment.

### mfxExtVPPDeinterlacing¶

struct mfxExtVPPDeinterlacing

This structure is used by the application to specify different deinterlacing algorithms

Public Members

mfxExtBuffer Header

mfxU16 Mode

Deinterlacing algorithm. See the DeinterlacingMode enumerator for details.

mfxU16 TelecinePattern

Specifies telecine pattern when Mode = MFX_DEINTERLACING_FIXED_TELECINE_PATTERN. See the TelecinePattern enumerator for details.

mfxU16 TelecineLocation

Specifies position inside a sequence of 5 frames where the artifacts start when TelecinePattern = MFX_TELECINE_POSITION_PROVIDED

mfxU16 reserved[9]

Reserved for the future use

### mfxExtEncodedSlicesInfo¶

struct mfxExtEncodedSlicesInfo

The mfxExtEncodedSlicesInfo is used by the SDK encoder to report additional information about encoded slices. The application can attach this buffer to the mfxBitstream structure before calling MFXVideoENCODE_EncodeFrameAsync function.

Note

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

Public Members

mfxExtBuffer Header

mfxU16 SliceSizeOverflow

When mfxExtCodingOption2::MaxSliceSize is used, indicates the requested slice size was not met for one or more generated slices.

mfxU16 NumSliceNonCopliant

When mfxExtCodingOption2::MaxSliceSize is used, indicates the number of generated slices exceeds specification limits.

mfxU16 NumEncodedSlice

Number of encoded slices.

mfxU16 NumSliceSizeAlloc

SliceSize array allocation size. Must be specified by application.

mfxU16 *SliceSize

Slice size in bytes. Array must be allocated by application.

### mfxExtVppAuxData¶

struct mfxExtVppAuxData

The mfxExtVppAuxData structure returns auxiliary data generated by the video processing pipeline. The encoding process may use the auxiliary data by attaching this structure to the mfxEncodeCtrl structure.

Public Members

mfxExtBuffer Header

mfxU16 PicStruct

Detected picture structure - top field first, bottom field first, progressive or unknown if video processor cannot detect picture structure. See the PicStruct enumerator for definition of these values.

By default, detection is turned off and the application should explicitly enable it by using mfxExtVPPDoUse buffer and MFX_EXTBUFF_VPP_PICSTRUCT_DETECTION algorithm.

### mfxExtVPPFrameRateConversion¶

struct mfxExtVPPFrameRateConversion

The mfxExtVPPFrameRateConversion structure configures the VPP frame rate conversion filter. The user can attach this structure to the mfxVideoParam structure when initializing video processing, resetting it or query its capability.

On some platforms advanced frame rate conversion algorithm, algorithm based on frame interpolation, is not supported. To query its support the application should add MFX_FRCALGM_FRAME_INTERPOLATION flag to Algorithm value in mfxExtVPPFrameRateConversion structure, attach it to structure and call MFXVideoVPP_Query function. If filter is supported the function returns MFX_ERR_NONE status and copies content of input structure to output one. If advanced filter is not supported then simple filter will be used and function returns MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, copies content of input structure to output one and corrects Algorithm value.

If advanced FRC algorithm is not supported both MFXVideoVPP_Init and MFXVideoVPP_Reset functions returns MFX_WRN_INCOMPATIBLE_VIDEO_PARAM status.

Public Members

mfxExtBuffer Header

mfxU16 Algorithm

See the FrcAlgm enumerator for a list of frame rate conversion algorithms.

### mfxExtVPPImageStab¶

struct mfxExtVPPImageStab

The mfxExtVPPImageStab structure is a hint structure that configures the VPP image stabilization filter.

On some platforms this filter is not supported. To query its support, the application should use the same approach that it uses to configure VPP filters - by adding filter ID to mfxExtVPPDoUse structure or by attaching mfxExtVPPImageStab structure directly to the mfxVideoParam structure and calling MFXVideoVPP_Query function. If this filter is supported function returns MFX_ERR_NONE status and copies content of input structure to output one. If filter is not supported function returns MFX_WRN_FILTER_SKIPPED, removes filter from mfxExtVPPDoUse structure and zeroes mfxExtVPPImageStab structure.

If image stabilization filter is not supported, both MFXVideoVPP_Init and MFXVideoVPP_Reset functions returns MFX_WRN_FILTER_SKIPPED status.

The application can retrieve list of active filters by attaching mfxExtVPPDoUse structure to mfxVideoParam structure and calling MFXVideoVPP_GetVideoParam function. The application must allocate enough memory for filter list.

Public Members

mfxExtBuffer Header

mfxU16 Mode

Image stabilization mode. See ImageStabMode enumerator for possible values.

### mfxVPPCompInputStream¶

struct mfxVPPCompInputStream

The mfxVPPCompInputStream structure is used to specify input stream details for composition of several input surfaces in the one output.

Public Members

mfxU32 DstX

X coordinate of location of input stream in output surface.

mfxU32 DstY

Y coordinate of location of input stream in output surface.

mfxU32 DstW

Width of of location of input stream in output surface.

mfxU32 DstH

Height of of location of input stream in output surface.

mfxU16 LumaKeyEnable

None zero value enables luma keying for the input stream. Luma keying is used to mark some of the areas of the frame with specified luma values as transparent. It may be used for closed captioning, for example.

mfxU16 LumaKeyMin

Minimum value of luma key, inclusive. Pixels whose luma values fit in this range are rendered transparent.

mfxU16 LumaKeyMax

Maximum value of luma key, inclusive. Pixels whose luma values fit in this range are rendered transparent.

mfxU16 GlobalAlphaEnable

None zero value enables global alpha blending for this input stream.

mfxU16 GlobalAlpha

Alpha value for this stream in [0..255] range. 0 – transparent, 255 – opaque.

mfxU16 PixelAlphaEnable

None zero value enables per pixel alpha blending for this input stream. The stream should have RGB color format.

mfxU16 TileId

Specify the tile this video stream assigned to. Should be in range [0..NumTiles). Valid only if NumTiles > 0.

### mfxExtVPPComposite¶

struct mfxExtVPPComposite

The mfxExtVPPComposite structure is used to control composition of several input surfaces in the one output. In this mode, the VPP skips any other filters. The VPP returns error if any mandatory filter is specified and filter skipped warning for optional filter. The only supported filters are deinterlacing and interlaced scaling. The only supported combinations of input and output color formats are:

• RGB to RGB,

• NV12 to NV12,

• RGB and NV12 to NV12, for per pixel alpha blending use case.

The VPP returns MFX_ERR_MORE_DATA for additional input until an output is ready. When the output is ready, VPP returns MFX_ERR_NONE. The application must process the output frame after synchronization.

Composition process is controlled by:

• mfxFrameInfo::CropXYWH in input surface- defines location of picture in the input frame,

• InputStream[i].DstXYWH defines location of the cropped input picture in the output frame,

• mfxFrameInfo::CropXYWH in output surface - defines actual part of output frame. All pixels in output frame outside this region will be filled by specified color.

If the application uses composition process on video streams with different frame sizes, the application should provide maximum frame size in mfxVideoParam during initialization, reset or query operations.

If the application uses composition process, MFXVideoVPP_QueryIOSurf function returns cumulative number of input surfaces, i.e. number required to process all input video streams. The function sets frame size in the mfxFrameAllocRequest equal to the size provided by application in the mfxVideoParam.

Composition process supports all types of surfaces

All input surfaces should have the same type and color format, except per pixel alpha blending case, where it is allowed to mix NV12 and RGB surfaces.

There are three different blending use cases:

• Luma keying. In this case, all input surfaces should have NV12 color format specified during VPP initialization. Part of each surface, including first one, may be rendered transparent by using LumaKeyEnable, LumaKeyMin and LumaKeyMax values.

• Global alpha blending. In this case, all input surfaces should have the same color format specified during VPP initialization. It should be either NV12 or RGB. Each input surface, including first one, can be blended with underling surfaces by using GlobalAlphaEnable and GlobalAlpha values.

• Per pixel alpha blending. In this case, it is allowed to mix NV12 and RGB input surfaces. Each RGB input surface, including first one, can be blended with underling surfaces by using PixelAlphaEnable value.

It is not allowed to mix different blending use cases in the same function call.

In special case where destination region of the output surface defined by output crops is fully covered with destination sub-regions of the surfaces, the fast compositing mode can be enabled. The main use case for this mode is a video-wall scenario with fixed destination surface partition into sub-regions of potentially different size.

In order to trigger this mode, application must cluster input surfaces into tiles, defining at least one tile by setting the NumTiles field to be greater then 0 and assigning surfaces to the corresponding tiles setting TileId field to the value within [0..NumTiles) range per input surface. Tiles should also satisfy following additional constraints:

• each tile should not have more than 8 surfaces assigned to it;

• tile bounding boxes, as defined by the enclosing rectangles of a union of a surfaces assigned to this tile, should not intersect;

Background color may be changed dynamically through Reset. No default value. YUV black is (0;128;128) or (16;128;128) depending on the sample range. The SDK uses YUV or RGB triple depending on output color format.

Public Members

mfxExtBuffer Header

mfxU16 Y

Y value of the background color.

mfxU16 R

R value of the background color.

mfxU16 U

U value of the background color.

mfxU16 G

G value of the background color.

mfxU16 V

V value of the background color.

mfxU16 B

B value of the background color.

mfxU16 NumTiles

Number of input surface clusters grouped together to enable fast compositing. May be changed dynamically at runtime through Reset.

mfxU16 NumInputStream

Number of input surfaces to compose one output. May be changed dynamically at runtime through Reset. Number of surfaces can be decreased or increased, but should not exceed number specified during initialization. Query mode 2 should be used to find maximum supported number.

mfxVPPCompInputStream *InputStream

This array of mfxVPPCompInputStream structures describes composition of input video streams. It should consist of exactly NumInputStream elements.

### mfxExtVPPVideoSignalInfo¶

struct mfxExtVPPVideoSignalInfo

The mfxExtVPPVideoSignalInfo structure is used to control transfer matrix and nominal range of YUV frames. The application should provide it during initialization. It is supported for all kinds of conversion YUV->YUV, YUV->RGB, RGB->YUV.

Note

This structure is used by VPP only and is not compatible with mfxExtVideoSignalInfo.

Public Members

mfxExtBuffer Header

mfxU16 TransferMatrix

Transfer matrix.

mfxU16 NominalRange

Nominal range.

### mfxExtVPPFieldProcessing¶

struct mfxExtVPPFieldProcessing

The mfxExtVPPFieldProcessing structure configures the VPP field processing algorithm. The application can attach this extended buffer to the mfxVideoParam structure to configure initialization and/or to the mfxFrameData during runtime, runtime configuration has priority over initialization configuration. If field processing algorithm was activated via mfxExtVPPDoUse structure and mfxExtVPPFieldProcessing extended buffer was not provided during initialization, this buffer must be attached to mfxFrameData of each input surface.

Public Members

mfxExtBuffer Header

mfxU16 Mode

Specifies the mode of field processing algorithm. See the VPPFieldProcessingMode enumerator for values of this option.

mfxU16 InField

When Mode is MFX_VPP_COPY_FIELD specifies input field. See the PicType enumerator for values of this parameter.

mfxU16 OutField

When Mode is MFX_VPP_COPY_FIELD specifies output field. See the PicType enumerator for values of this parameter.

### mfxExtDecVideoProcessing¶

struct mfxExtDecVideoProcessing

If attached to the mfxVideoParam structure during the Init stage this buffer will instruct decoder to resize output frames via fixed function resize engine (if supported by HW) utilizing direct pipe connection bypassing intermediate memory operations. Main benefits of this mode of pipeline operation are offloading resize operation to dedicated engine reducing power consumption and memory traffic.

Public Members

mfxExtBuffer Header

struct mfxExtDecVideoProcessing::mfxIn In

Input surface description.

struct mfxExtDecVideoProcessing::mfxOut Out

Output surface description.

struct mfxIn

Input surface description.

Public Members

mfxU16 CropX

X coordinate of region of interest of the input surface.

mfxU16 CropY

Y coordinate of region of interest of the input surface.

mfxU16 CropW

Width coordinate of region of interest of the input surface.

mfxU16 CropH

Height coordinate of region of interest of the input surface.

struct mfxOut

Output surface description.

Public Members

mfxU32 FourCC

FourCC of output surface Note: Should be MFX_FOURCC_NV12.

mfxU16 ChromaFormat

Chroma Format of output surface.

Note

Should be MFX_CHROMAFORMAT_YUV420

mfxU16 Width

Width of output surface

mfxU16 Height

Height of output surface

mfxU16 CropX

X coordinate of region of interest of the output surface.

mfxU16 CropY

Y coordinate of region of interest of the output surface.

mfxU16 CropW

Width coordinate of region of interest of the output surface.

mfxU16 CropH

Height coordinate of region of interest of the output surface.

### mfxExtVPPRotation¶

struct mfxExtVPPRotation

The mfxExtVPPRotation structure configures the VPP Rotation filter algorithm.

Public Members

mfxExtBuffer Header

mfxU16 Angle

Rotation angle. See Angle enumerator for supported values.

### mfxExtVPPScaling¶

struct mfxExtVPPScaling

The mfxExtVPPScaling structure configures the VPP Scaling filter algorithm. Not all combinations of ScalingMode and InterpolationMethod are supported in the SDK. The application has to use query function to determine if a combination is supported.

Public Members

mfxExtBuffer Header

mfxU16 ScalingMode

Scaling mode. See ScalingMode for possible values.

mfxU16 InterpolationMethod

Interpolation mode for scaling algorithm. See InterpolationMode for possible values.

### mfxExtVPPMirroring¶

struct mfxExtVPPMirroring

The mfxExtVPPMirroring structure configures the VPP Mirroring filter algorithm.

Public Members

mfxExtBuffer Header

mfxU16 Type

Mirroring type. See MirroringType for possible values.

### mfxExtVPPColorFill¶

struct mfxExtVPPColorFill

The mfxExtVPPColorFill structure configures the VPP ColorFill filter algorithm.

Public Members

mfxExtBuffer Header

mfxU16 Enable

Set to ON makes VPP fill the area between Width/Height and Crop borders. See the CodingOptionValue enumerator for values of this option.

### mfxExtColorConversion¶

struct mfxExtColorConversion

The mfxExtColorConversion structure is a hint structure that tunes the VPP Color Conversion algorithm, when attached to the mfxVideoParam structure during VPP Init.

Public Members

mfxExtBuffer Header

mfxU16 ChromaSiting

See ChromaSiting enumerator for details.

ChromaSiting is applied on input or output surface depending on the scenario:

VPP Input

VPP Output

ChromaSiting indicates

MFX_CHROMAFORMAT_YUV420

MFX_CHROMAFORMAT_YUV422

MFX_CHROMAFORMAT_YUV444

The input chroma location.

MFX_CHROMAFORMAT_YUV444

MFX_CHROMAFORMAT_YUV420

MFX_CHROMAFORMAT_YUV422

The output chroma location.

MFX_CHROMAFORMAT_YUV420

MFX_CHROMAFORMAT_YUV420

Chroma location for both input and output.

MFX_CHROMAFORMAT_YUV420

MFX_CHROMAFORMAT_YUV422

Horizontal location for both input and output. Vertical location for input.

### mfxExtVppMctf¶

struct mfxExtVppMctf

The mfxExtVppMctf structure allows to setup Motion-Compensated Temporal Filter (MCTF) during the VPP initialization and to control parameters at runtime. By default, MCTF is off; an application may enable it by adding MFX_EXTBUFF_VPP_MCTF to mfxExtVPPDoUse buffer or by attaching mfxExtVppMctf to mfxVideoParam during initialization or reset.

Public Members

mfxExtBuffer Header

mfxU16 FilterStrength

0..20 value (inclusive) to indicate the filter-strength of MCTF. A strength of MCTF process controls degree of possible changes of pixel values eligible for MCTF; the bigger the strength the larger the change is; it is a dimensionless quantity, values 1..20 inclusively imply strength; value 0 stands for AUTO mode and is valid during initialization or reset only; if invalid value is given, it is fixed to default value which is 0. If this field is 1..20 inclusive, MCTF operates in fixed-strength mode with the given strength of MCTF process. At runtime, value 0 and values greater than 20 are ignored.

## Bitrate Control Extension Buffers¶

### mfxBRCFrameParam¶

struct mfxBRCFrameParam

The mfxBRCFrameParam structure 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

See FrameType enumerator

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:

### mfxBRCFrameCtrl¶

struct mfxBRCFrameCtrl

The mfxBRCFrameCtrl structure 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, 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 encoder.

mfxU16 MaxNumRepak

Number of possible repacks in driver if current frame size > maxFrameSize. Ignored if maxFrameSize==0. See maxFrameSize description. Possible values are [0,8].

mfxU16 NumExtParam

Reserved for future use.

mfxExtBuffer **ExtParam

Reserved for future use.

### mfxBRCFrameStatus¶

struct mfxBRCFrameStatus

The mfxBRCFrameStatus structure specifies instructions for the SDK 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

See BRCStatus enumerator.

### mfxExtBRC¶

struct mfxExtBRC

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

Public Members

mfxExtBuffer Header

mfxHDL pthis

Pointer to the BRC object.

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

This function 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.

Return

MFX_ERR_NONE The function completed successfully.

MFX_ERR_UNSUPPORTED The function detected unsupported video parameters.

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

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

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

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

Return

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.

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

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

mfxStatus (*Close)(mfxHDL pthis)

This function de-allocates any internal resources acquired in Init for this BRC session. Invoked during MFXVideoENCODE_Close.

Return

MFX_ERR_NONE The function completed successfully.

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

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

This function 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.

Return

MFX_ERR_NONE The function completed successfully.

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

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

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

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

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

Return

MFX_ERR_NONE The function completed successfully.

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

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

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

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

## VP8 Extension Buffers¶

### mfxExtVP8CodingOption¶

struct mfxExtVP8CodingOption

Public Members

mfxExtBuffer Header

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

Selecting 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

## JPEG Extension Buffers¶

### mfxExtJPEGQuantTables¶

struct mfxExtJPEGQuantTables

The mfxExtJPEGQuantTables structure specifies quantization tables. The application may specify up to 4 quantization tables. The SDK encoder assigns ID to each table. That ID is equal to table index in Qm array. Table “0” is used for encoding of Y component, table “1” for U component and table “2” for V component. The application may specify fewer tables than number of components in the image. If two tables are specified, then table “1” is used for both U and V components. If only one table is specified then it is used for all components in the image. Table below illustrate this behavior.

Public Members

mfxExtBuffer Header

mfxU16 NumTable

Number of quantization tables defined in Qmarray.

mfxU16 Qm[4][64]

Quantization table values.

Table ID

0

1

2

Number of tables

0

Y, U, V

1

Y

U, V

2

Y

U

V

### mfxExtJPEGHuffmanTables¶

struct mfxExtJPEGHuffmanTables

The mfxExtJPEGHuffmanTables structure specifies Huffman tables. The application may specify up to 2 quantization table pairs for baseline process. The SDK encoder assigns ID to each table. That ID is equal to table index in DCTables and ACTables arrays. Table “0” is used for encoding of Y component, table “1” for U and V component. The application may specify only one table in this case it will be used for all components in the image. Table below illustrate this behavior.

Public Members

mfxExtBuffer Header

mfxU16 NumDCTable

Number of DC quantization table in DCTables array.

mfxU16 NumACTable

Number of AC quantization table in ACTables array.

mfxU8 Bits[16]

Number of codes for each code length.

mfxU8 Values[12]

List of the 8-bit symbol values.

Array of AC tables.

struct mfxExtJPEGHuffmanTables::[anonymous] DCTables[4]

Array of DC tables.

struct mfxExtJPEGHuffmanTables::[anonymous] ACTables[4]

List of the 8-bit symbol values.

Table ID

0

1

Number of tables

0

Y, U, V

1

Y

U, V

## MVC Extension Buffers¶

### mfxMVCViewDependency¶

struct mfxMVCViewDependency

This structure describes MVC view dependencies.

Public Members

mfxU16 ViewId

View identifier of this dependency structure.

mfxU16 NumAnchorRefsL0

Number of view components for inter-view prediction in the initial reference picture list RefPicList0 for anchor view components.

mfxU16 NumAnchorRefsL1

Number of view components for inter-view prediction in the initial reference picture list RefPicList1 for anchor view components.

mfxU16 AnchorRefL0[16]

View identifiers of the view components for inter-view prediction in the initial reference picture list RefPicList0 for anchor view components.

mfxU16 AnchorRefL1[16]

View identifiers of the view components for inter-view prediction in the initial reference picture list RefPicList1 for anchor view components.

mfxU16 NumNonAnchorRefsL0

Number of view components for inter-view prediction in the initial reference picture list RefPicList0 for non-anchor view components.

mfxU16 NumNonAnchorRefsL1

Number of view components for inter-view prediction in the initial reference picture list RefPicList1 for non-anchor view components.

mfxU16 NonAnchorRefL0[16]

View identifiers of the view components for inter-view prediction in the initial reference picture list RefPicList0 for non-anchor view components.

### mfxMVCOperationPoint¶

struct mfxMVCOperationPoint

The mfxMVCOperationPoint structure describes the MVC operation point.

Public Members

mfxU16 TemporalId

Temporal identifier of the operation point.

mfxU16 LevelIdc

Level value signaled for the operation point.

mfxU16 NumViews

Number of views required for decoding the target output views corresponding to the operation point.

mfxU16 NumTargetViews

Number of target output views for the operation point.

mfxU16 *TargetViewId

View identifiers of the target output views for operation point.

### mfxExtMVCSeqDesc¶

struct mfxExtMVCSeqDesc

The mfxExtMVCSeqDesc structure describes the MVC stream information of view dependencies, view identifiers, and operation points. See the ITU*-T H.264 specification chapter H.7.3.2.1.4 for details.

Public Members

mfxExtBuffer Header

mfxU32 NumView

Number of views.

mfxU32 NumViewAlloc

The allocated view dependency array size.

mfxMVCViewDependency *View

Pointer to a list of the mfxMVCViewDependency.

mfxU32 NumViewId

Number of view identifiers.

mfxU32 NumViewIdAlloc

The allocated view identifier array size.

mfxU16 *ViewId

Pointer to the list of view identifier.

mfxU32 NumOP

Number of operation points.

mfxU32 NumOPAlloc

The allocated operation point array size.

mfxMVCOperationPoint *OP

Pointer to a list of the mfxMVCOperationPoint structure.

mfxU16 NumRefsTotal

Total number of reference frames in all views required to decode the stream. This value is returned from the MFXVideoDECODE_Decodeheader function. Do not modify this value.

### mfxExtMVCTargetViews¶

struct mfxExtMVCTargetViews

The mfxExtMvcTargetViews structure configures views for the decoding output.

Public Members

mfxExtBuffer Header

mfxU16 TemporalId

The temporal identifier to be decoded.

mfxU32 NumView

The number of views to be decoded.

mfxU16 ViewId[1024]

List of view identifiers to be decoded.

## PCP Extension Buffers¶

struct _mfxExtCencParam

This structure is used to pass decryption status report index for Common Encryption usage model. The application can attach this extended buffer to the mfxBitstream structure at runtime.

Public Members

mfxExtBuffer Header

mfxU32 StatusReportIndex