diff --git a/oneapi-doc.json b/oneapi-doc.json index 2616bf8f0a..987e505c4c 100644 --- a/oneapi-doc.json +++ b/oneapi-doc.json @@ -1,5 +1,5 @@ { "version": "1.1-rev-1", - "vpl_version": "2.6.0", + "vpl_version": "2.7.0", "art_version": "1.0-rev-1" } diff --git a/releases/index.rst b/releases/index.rst index 6967633528..36dd6dfed9 100644 --- a/releases/index.rst +++ b/releases/index.rst @@ -358,8 +358,9 @@ New in this release: * Marked all deprecated fields as MFX_DEPRECATED. * Introduced priority loading option for custom libraries. * Clarified AV1 encoder behavior about writing of IVF headers. -* Removed outdated note about loading priority of Intel Media Software - Development Kit +* Removed outdated note about loading priority of |msdk_full_name|. + For loading details see + :ref:`onevpl_coexistense`. * Spelled out mfxVariant type usage for strings. * New product names for platforms: diff --git a/source/conf/common_conf.py b/source/conf/common_conf.py index d1a0043fe4..4f06f6ea5c 100644 --- a/source/conf/common_conf.py +++ b/source/conf/common_conf.py @@ -40,6 +40,7 @@ 'sphinxcontrib.plantuml', 'breathe', 'dalapi', # oneDAL API generator + 'vplapi', ] with open(join(repo_root, 'oneapi-doc.json')) as fin: # noqa: F821 diff --git a/source/elements/oneVPL/include/vpl/mfx.h b/source/elements/oneVPL/include/vpl/mfx.h index 43557a2cd0..142e4b5e29 100644 --- a/source/elements/oneVPL/include/vpl/mfx.h +++ b/source/elements/oneVPL/include/vpl/mfx.h @@ -24,4 +24,8 @@ #include "mfxsurfacepool.h" +#ifdef ONEVPL_EXPERIMENTAL +#include "mfxencodestats.h" +#endif + #endif /* __MFXDEFS_H__ */ diff --git a/source/elements/oneVPL/include/vpl/mfxcommon.h b/source/elements/oneVPL/include/vpl/mfxcommon.h index 171a86b372..042dece8be 100644 --- a/source/elements/oneVPL/include/vpl/mfxcommon.h +++ b/source/elements/oneVPL/include/vpl/mfxcommon.h @@ -29,10 +29,70 @@ typedef struct { } mfxExtBuffer; MFX_PACK_END() +#ifdef ONEVPL_EXPERIMENTAL + +#define MFX_REFINTERFACE_VERSION MFX_STRUCT_VERSION(1, 0) + +MFX_PACK_BEGIN_STRUCT_W_PTR() +/*! The structure respresents reference counted interface structure. + The memory is allocated and released by the implementation. +*/ +typedef struct mfxRefInterface { + mfxHDL Context; /*!< The context of the container interface. User should not touch (change, set, null) this pointer. */ + mfxStructVersion Version; /*!< The version of the structure. */ + /*! @brief + Increments the internal reference counter of the container. The container is not destroyed until the container + is released using the mfxRefInterface::Release function. + mfxRefInterface::AddRef should be used each time a new link to the container is created + (for example, copy structure) for proper management. + + @param[in] ref_interface Valid interface. + + @return + MFX_ERR_NONE If no error. \n + MFX_ERR_NULL_PTR If interface is NULL. \n + MFX_ERR_INVALID_HANDLE If mfxRefInterface->Context is invalid (for example NULL). \n + MFX_ERR_UNKNOWN Any internal error. + + */ + mfxStatus (MFX_CDECL *AddRef)(struct mfxRefInterface* ref_interface); + /*! @brief + Decrements the internal reference counter of the container. mfxRefInterface::Release should be called after using the + mfxRefInterface::AddRef function to add a container or when allocation logic requires it. + + @param[in] ref_interface Valid interface. + + @return + MFX_ERR_NONE If no error. \n + MFX_ERR_NULL_PTR If interface is NULL. \n + MFX_ERR_INVALID_HANDLE If mfxRefInterface->Context is invalid (for example NULL). \n + MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of container is zero before call. \n + MFX_ERR_UNKNOWN Any internal error. + */ + mfxStatus (MFX_CDECL *Release)(struct mfxRefInterface* ref_interface); + /*! @brief + Returns current reference counter of mfxRefInterface structure. + + @param[in] ref_interface Valid interface. + @param[out] counter Sets counter to the current reference counter value. + + @return + MFX_ERR_NONE If no error. \n + MFX_ERR_NULL_PTR If interface or counter is NULL. \n + MFX_ERR_INVALID_HANDLE If mfxRefInterface->Context is invalid (for example NULL). \n + MFX_ERR_UNKNOWN Any internal error. + */ + mfxStatus (MFX_CDECL *GetRefCounter)(struct mfxRefInterface* ref_interface, mfxU32* counter); + mfxHDL reserved[4]; + +}mfxRefInterface; +MFX_PACK_END() +#endif + /* Library initialization and deinitialization */ /*! This enumerator itemizes implementation types. - The implementation type is a bit OR’ed value of the base type and any decorative flags. + The implementation type is a bit OR'ed value of the base type and any decorative flags. @note This enumerator is for legacy dispatcher compatibility only. The new dispatcher does not use it. */ typedef mfxI32 mfxIMPL; @@ -129,7 +189,8 @@ typedef struct _mfxSyncPoint *mfxSyncPoint; /*! The GPUCopy enumerator controls usage of GPU accelerated copying between video and system memory in the legacy Intel(r) Media SDK components. */ enum { MFX_GPUCOPY_DEFAULT = 0, /*!< Use default mode for the legacy Intel(r) Media SDK implementation. */ - MFX_GPUCOPY_ON = 1, /*!< Enable GPU accelerated copying. */ + MFX_GPUCOPY_ON = 1, /*!< The hint to enable GPU accelerated copying when it is supported by the library. + If the library doesn't support GPU accelerated copy the operation will be made by CPU. */ MFX_GPUCOPY_OFF = 2 /*!< Disable GPU accelerated copying. */ }; @@ -141,7 +202,7 @@ MFX_PACK_BEGIN_STRUCT_W_PTR() typedef struct { mfxIMPL Implementation; /*!< Enumerator that indicates the desired legacy Intel(r) Media SDK implementation. */ mfxVersion Version; /*!< Structure which specifies minimum library version or zero, if not specified. */ - mfxU16 ExternalThreads; /*!< Desired threading mode. Value 0 means internal threading, 1 – external. */ + mfxU16 ExternalThreads; /*!< Desired threading mode. Value 0 means internal threading, 1 - external. */ /*! @internal :unnamed(union) @endinternal */ union { struct { @@ -156,7 +217,7 @@ typedef struct { MFX_PACK_END() enum { - MFX_EXTBUFF_THREADS_PARAM = MFX_MAKEFOURCC('T','H','D','P') /*!< mfxExtThreadsParam buffer ID */ + MFX_EXTBUFF_THREADS_PARAM = MFX_MAKEFOURCC('T','H','D','P') /*!< mfxExtThreadsParam buffer ID. */ }; MFX_PACK_BEGIN_USUAL_STRUCT() @@ -200,6 +261,7 @@ enum { MFX_PLATFORM_XEHP_SDV = 45, /*!< Code name XeHP SDV. */ MFX_PLATFORM_DG2 = 46, /*!< Code name DG2. */ MFX_PLATFORM_ATS_M = 46, /*!< Code name ATS-M, same media functionality as DG2. */ + MFX_PLATFORM_ALDERLAKE_N = 55, /*!< Code name Alder Lake N. */ MFX_PLATFORM_KEEMBAY = 50, /*!< Code name Keem Bay. */ }; @@ -287,7 +349,12 @@ typedef struct { mfxU32 CodecID; /*!< Encoder ID in FourCC format. */ mfxU16 MaxcodecLevel; /*!< Maximum supported codec level. See the CodecProfile enumerator for possible values. */ mfxU16 BiDirectionalPrediction; /*!< Indicates B-frames support. */ +#ifdef ONEVPL_EXPERIMENTAL + mfxU16 ReportedStats; /*!< Indicates what type of statistics can be reported: block/slice/tile/frame. */ + mfxU16 reserved[6]; /*!< Reserved for future use. */ +#else mfxU16 reserved[7]; /*!< Reserved for future use. */ +#endif mfxU16 NumProfiles; /*!< Number of supported profiles. */ /*! This structure represents the codec profile description. */ struct encprofile { @@ -514,10 +581,21 @@ MFX_PACK_BEGIN_STRUCT_W_PTR() */ typedef struct { mfxAccelerationMode AccelerationMode; /*!< Hardware acceleration stack to use. OS dependent parameter. Use VA for Linux*, DX* for Windows* or HDDL. */ +#ifdef ONEVPL_EXPERIMENTAL + mfxU16 DeviceCopy; /*!< Enables or disables device's accelerated copying between device and + host. See the GPUCopy enumerator for a list of valid values. + This parameter is the equivalent of mfxInitParam::GPUCopy. */ + mfxU16 reserved[2]; /*!< Reserved for future use. */ +#else mfxU16 reserved[3]; /*!< Reserved for future use. */ - mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to this structure. */ - mfxExtBuffer **ExtParam; /*!< Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations. */ - mfxU32 VendorImplID; /*!< Vendor specific number with given implementation ID. Represents the same field from mfxImplDescription. */ +#endif + mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to this + structure. */ + mfxExtBuffer **ExtParam; /*!< Points to an array of pointers to the extra configuration structures; + see the ExtendedBufferID enumerator for a list of extended + configurations. */ + mfxU32 VendorImplID; /*!< Vendor specific number with given implementation ID. Represents + the same field from mfxImplDescription. */ mfxU32 reserved2[3]; /*!< Reserved for future use. */ } mfxInitializationParam; MFX_PACK_END() diff --git a/source/elements/oneVPL/include/vpl/mfxdefs.h b/source/elements/oneVPL/include/vpl/mfxdefs.h index e31c6f4bc7..35bfb0fc85 100644 --- a/source/elements/oneVPL/include/vpl/mfxdefs.h +++ b/source/elements/oneVPL/include/vpl/mfxdefs.h @@ -8,7 +8,7 @@ #define __MFXDEFS_H__ #define MFX_VERSION_MAJOR 2 -#define MFX_VERSION_MINOR 6 +#define MFX_VERSION_MINOR 7 // MFX_VERSION - version of API that 'assumed' by build may be provided externally // if it omitted then latest stable API derived from Major.Minor is assumed diff --git a/source/elements/oneVPL/include/vpl/mfxencodestats.h b/source/elements/oneVPL/include/vpl/mfxencodestats.h new file mode 100644 index 0000000000..348ac9a88c --- /dev/null +++ b/source/elements/oneVPL/include/vpl/mfxencodestats.h @@ -0,0 +1,458 @@ +/*############################################################################ + # Copyright Intel Corporation + # + # SPDX-License-Identifier: MIT + ############################################################################*/ + +#ifdef ONEVPL_EXPERIMENTAL + + +#ifndef __MFXENCODESTATS_H__ +#define __MFXENCODESTATS_H__ +#include "mfxcommon.h" +#include "mfxstructures.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/*!< The enum to specify memory layout for statistics. */ +typedef enum { + MFX_ENCODESTATS_MEMORY_LAYOUT_DEFAULT = 0, /*!< The default memory layout for statistics. */ +} mfxEncodeBlkStatsMemLayout; + +/*!< The enum to specify mode to gather statistics. */ +typedef enum { + MFX_ENCODESTATS_MODE_DEFAULT = 0, /*!< Encode mode is selected by the implementation. */ + MFX_ENCODESTATS_MODE_ENCODE = 1, /*!< Full encode mode. */ +} mfxEncodeStatsMode; + +/*!< Flags to specify what statistics will be reported by the implementation. */ +enum { + MFX_ENCODESTATS_LEVEL_BLK = 0x1, /*!< Block level statistics. */ + MFX_ENCODESTATS_LEVEL_SLICE = 0x2, /*!< Slice level statistics. */ + MFX_ENCODESTATS_LEVEL_TILE = 0x4, /*!< Tile level statistics. */ + MFX_ENCODESTATS_LEVEL_FRAME = 0x8, /*!< Frame level statistics. */ +}; + + +MFX_PACK_BEGIN_USUAL_STRUCT() +/*!< Specifies H.265 CTU header. */ +typedef struct { + union { + struct { + mfxU32 CUcountminus1 : 6; /*!< Number of CU per CTU. */ + mfxU32 MaxDepth : 2; /*!< Max quad-tree depth of CU in CTU. */ + mfxU32 reserved : 24; + } bitfields0; + mfxU32 dword0; + }; + mfxU16 CurrXAddr; /*!< Horizontal address of CTU. */ + mfxU16 CurrYAddr; /*!< Vertical address of CTU. */ + mfxU32 reserved1; +} mfxCTUHeader; +MFX_PACK_END() + + +MFX_PACK_BEGIN_USUAL_STRUCT() +/*!< Specifies H.265 CU info. */ +typedef struct { + union { + struct { + mfxU32 CU_Size : 2; /*!< indicates the CU size of the current CU. 0: 8x8 1: 16x16 2: 32x32 3: 64x64 */ + mfxU32 CU_pred_mode : 1; /*!< indicates the prediction mode for the current CU. 0: intra 1: inter */ + /*! + indicates the PU partition mode for the current CU. + 0: 2Nx2N + 1: 2NxN (inter) + 2: Nx2N (inter) + 3: NXN (intra only, CU Size=8x8 only. Luma Intra Mode indicates the intra prediction mode for 4x4_0. The additional prediction modes are overloaded on 4x4_1, 4x4_2, 4x4_3 below) + 4: 2NxnT (inter only) + 5: 2NxnB (inter only) + 6: nLx2N (inter only) + 7: nRx2N (inter only). + */ + mfxU32 CU_part_mode : 3; + mfxU32 InterPred_IDC_MV0 : 2; /*!< indicates the prediction direction for PU0 of the current CU. 0: L0 1: L1 2: Bi 3: reserved */ + mfxU32 InterPred_IDC_MV1 : 2; /*!< indicates the prediction direction for PU1 of the current CU. 0: L0 1: L1 2: Bi 3: reserved */ + /*! + Final explicit Luma Intra Mode 4x4_0 for NxN. + Valid values 0..34 + Note: CU_part_mode==NxN. + */ + mfxU32 LumaIntraMode : 6; + /*! + indicates the final explicit Luma Intra Mode for the CU. + 0: DM (use Luma mode, from block 0 if NxN) + 1: reserved + 2: Planar + 3: Vertical + 4: Horizontal + 5: DC */ + mfxU32 ChromaIntraMode : 3; + mfxU32 reserved : 13; + } bitfields0; + mfxU32 dword0; + }; + + union { + struct { + /*! + Final explicit Luma Intra Mode 4x4_1. + Valid values 0..34 + Note: CU_part_mode==NxN. + */ + mfxU32 LumaIntraMode4x4_1 : 6; + /*! + Final explicit Luma Intra Mode 4x4_2. + Valid values 0..34 + Note: CU_part_mode==NxN. + */ + mfxU32 LumaIntraMode4x4_2 : 6; + /*! + Final explicit Luma Intra Mode 4x4_3. + Valid values 0..34 + Note: CU_part_mode==NxN. + */ + mfxU32 LumaIntraMode4x4_3 : 6; + mfxU32 reserved1 : 14; + } bitfields1; + mfxU32 dword1; + }; + + mfxI8 QP; // signed QP value + mfxU8 reserved2[3]; + /*! distortion measure, approximation to SAD. + Will deviate significantly (pre, post reconstruction) and due to variation in algorithm. + */ + mfxU32 SAD; + + /*! + These parameters indicate motion vectors that are associated with the PU0/PU1 winners + range [-2048.00..2047.75]. + L0/PU0 - MV[0][0] + L0/PU1 - MV[0][1] + L1/PU0 - MV[1][0] + L1/PU1 - MV[1][1] + */ + mfxI16Pair MV[2][2]; + + union { + struct { + /*! + This parameter indicates the reference index associated with the MV X/Y + that is populated in the L0_MV0.X and L0_MV0.Y fields. */ + mfxU32 L0_MV0_RefID : 4; + /*! + This parameter indicates the reference index associated with the MV X/Y + that is populated in the L0_MV1.X and L0_MV1.Y fields. */ + mfxU32 L0_MV1_RefID : 4; + /*! + This parameter indicates the reference index associated with the MV X/Y + that is populated in the L1_MV0.X and L1_MV0.Y fields. */ + mfxU32 L1_MV0_RefID : 4; + /*! + This parameter indicates the reference index associated with the MV X/Y + that is populated in the L1_MV1.X and L1_MV1.Y fields. */ + mfxU32 L1_MV1_RefID : 4; + + mfxU32 reserved3 : 16; + } bitfields8; + mfxU32 dword8; + }; + mfxU32 reserved4[10]; /*< should be minimized! */ +} mfxCUInfo; +MFX_PACK_END() + + +MFX_PACK_BEGIN_USUAL_STRUCT() +/*!< Specifies H.265 CTU. */ +typedef struct { + mfxCTUHeader CtuHeader; /*!< H.265 CTU header. */ + mfxCUInfo CuInfo[64]; /*!< Array of CU. */ + mfxU32 reserved; +} mfxCTUInfo; +MFX_PACK_END() + + + +MFX_PACK_BEGIN_USUAL_STRUCT() +/*! + The structure describes H.264 stats per MB. +*/ +typedef struct { + union { + struct { + /*! + Together with @p IntraMbFlag this parameter specifies macroblock type according to the + ISO\*\/IEC\* 14496-10 with the following difference - it stores either intra or inter + values according to @p IntraMbFlag, but not intra after inter. + Values for P-slices are mapped to B-slice values. For example P_16x8 is coded with + B_FWD_16x8 value. + */ + mfxU32 MBType : 5; + /*! + This field specifies inter macroblock mode and is ignored for intra MB. It is derived from @p MbType and has next values: + @li 0 - 16x16 mode + @li 1 - 16x8 mode + @li 2 - 8x16 mode + @li 3 - 8x8 mode + */ + mfxU32 InterMBMode : 2; + /*! + This field specifies intra macroblock mode and is ignored for inter MB. It is derived from @p MbType and has next values: + @li 0 - 16x16 mode + @li 1 - 8x8 mode + @li 2 - 4x4 mode + @li 3 - PCM + */ + mfxU32 IntraMBMode : 2; + /*! + This flag specifies intra/inter MB type and has next values: + 0 - Inter prediction MB type + 1 - Intra prediction MB type + */ + mfxU32 IntraMBFlag : 1; + /*! + This field specifies subblock shapes for the current MB. Each block is described by 2 bits starting from lower bits for block 0. + + @li 0 - 8x8 + @li 1 - 8x4 + @li 2 - 4x8 + @li 3 - 4x4 + */ + mfxU32 SubMBShapes : 8; + /*! + This field specifies prediction modes for the current MB partition blocks. Each block is described by 2 bits starting from lower bits for block 0. + @li 0 - Pred_L0 + @li 1 - Pred_L1 + @li 2 - BiPred + @li 3 - reserved + + Only one prediction value for partition is reported, the rest values are set to zero. For example: + @li 16x16 Pred_L1 - 0x01 (only 2 lower bits are used) + @li 16x8 Pred_L1 / BiPred - 0x09 (1001b) + @li 8x16 BiPred / BiPred - 0x0a (1010b) + + For P MBs this value is always zero. + */ + mfxU32 SubMBShapeMode : 8; + /*! + This value specifies chroma intra prediction mode. + @li 0 - DC + @li 1 - Horizontal + @li 2 - Vertical + @li 3 - Plane + */ + mfxU32 ChromaIntraPredMode : 2; + mfxU32 reserved : 4; + } bitfields0; + mfxU32 dword0; + } ; + /*! + Distortion measure, approximation to SAD. + Deviate significantly (pre, post reconstruction) and due to variation in algorithm. + */ + mfxU32 SAD; + mfxI8 Qp; /*!< MB QP. */ + mfxU8 reserved1[3]; + + /*! + These values specify luma intra prediction modes for current MB. Each element of the array + corresponds to 8x8 block and each holds prediction modes for four 4x4 subblocks. + Four bits per mode, lowest bits for left top subblock. + All 16 prediction modes are always specified. For 8x8 case, block prediction mode is + populated to all subblocks of the 8x8 block. For 16x16 case - to all subblocks of the MB. + + Prediction directions for 4x4 and 8x8 blocks: + @li 0 - Vertical + @li 1 - Horizontal + @li 2 - DC + @li 3 - Diagonal Down Left + @li 4 - Diagonal Down Right + @li 5 - Vertical Right + @li 6 - Horizontal Down + @li 7 - Vertical Left + @li 8 - Horizontal Up + + Prediction directions for 16x16 blocks: + @li 0 - Vertical + @li 1 - Horizontal + @li 2 - DC + @li 3 - Plane + */ + mfxU16 LumaIntraMode[4]; + + mfxU32 reserved2; +} mfxMBInfo; +MFX_PACK_END() + +/*! + The enum specifies block size. +*/ +typedef enum { + MFX_BLOCK_4X4 = 0, /*!< 4x4 block size. */ + MFX_BLOCK_16X16 = 1, /*!< 16x16 block size. */ +} mfxBlockSize; + + +MFX_PACK_BEGIN_STRUCT_W_PTR() +/*! + The structure describes H.264 and H.265 stats per MB or CTUs. +*/ +typedef struct { + union { + mfxU32 NumMB; /*!< Number of MBs per frame for H.264. */ + mfxU32 NumCTU; /*!< number of CTUs per frame for H.265. */ + }; + union { + mfxCTUInfo *HEVCCTUArray; /*!< Array of CTU statistics. */ + mfxMBInfo *AVCMBArray; /*!< Array of MB statistics. */ + }; + mfxU32 reserved[8]; + +} mfxEncodeBlkStats; +MFX_PACK_END() + + +MFX_PACK_BEGIN_STRUCT_W_L_TYPE() +/*! + The structure describes H.264/H.265 frame/slice/tile level statistics. +*/ +typedef struct { + mfxF32 PSNRLuma; /*!< PSNR for LUMA samples. */ + mfxF32 PSNRCb; /*!< PSNR for Chroma (Cb) samples. */ + mfxF32 PSNRCr; /*!< PSNR for Chroma (Cr) samples. */ + /*! distortion measure, approximation to SAD. + Will deviate significantly (pre, post reconstruction) and due to variation in algorithm. + */ + mfxU64 SADLuma; + mfxF32 Qp; /*< average frame QP, may have fractional part in case of MBQP. */ + + union { + mfxU32 NumMB; /*!< Number of MBs per frame for H.264. */ + mfxU32 NumCTU; /*!< number of CTUs per frame for H.265. */ + }; + + mfxBlockSize BlockSize; /*! For H.264 it is always 16x16 coresponding to MB size. + In H.265 it's normalized to 4x4, so for each CU we calculate number of 4x4 which belongs to the block. */ + + mfxU32 NumIntraBlock; /*! Number of intra blocks in the frame. The size of block is defined by BlockSize. + For H.265 it can be more than number of intra CU. */ + mfxU32 NumInterBlock; /*! Number of inter blocks in the frame. The size of block is defined by BlockSize. + For H.265 it can be more than number of inter CU. */ + mfxU32 NumSkippedBlock; /*! Number of skipped blocks in the frame. The size of block is defined by BlockSize. + For H.265 it can be more than number of skipped CU. */ + + mfxU32 reserved[8]; + +} mfxEncodeHighLevelStats; +MFX_PACK_END() + +/*! + Alias for the structure to describe H.264 and H.265 frame level stats. +*/ +typedef mfxEncodeHighLevelStats mfxEncodeFrameStats; + +MFX_PACK_BEGIN_STRUCT_W_PTR() +/*! + The structure describes H.264 and H.265 stats per Slice or Tile. +*/ +typedef struct { + mfxU32 NumElements; /*!< Number of Slices or Tiles per frame for H.264/H.265. */ + mfxEncodeHighLevelStats *HighLevelStatsArray; /*!< Array of CTU statistics. */ + mfxU32 reserved[8]; + +} mfxEncodeSliceStats; +MFX_PACK_END() + +/*! + Alias for the structure to describe H.264 and H.265 tile level stats. +*/ +typedef mfxEncodeSliceStats mfxEncodeTileStats; + + +#define MFX_ENCODESTATSCONTAINER_VERSION MFX_STRUCT_VERSION(1, 0) + + +MFX_PACK_BEGIN_STRUCT_W_PTR() +/*! The structure respresnts reference counted container for output after encoding operation which includes statistics + and synchronization primitive for compressed bitstream. + The memory is allocated and released by the library. +*/ +typedef struct mfxEncodeStatsContainer { + mfxStructVersion Version; /*!< The version of the structure. */ + mfxRefInterface RefInterface; /*! < Reference counting interface. */ + /*! @brief + Guarantees readiness of the statistics after a function completes. + Instead of MFXVideoCORE_SyncOperation which leads to the synchronization of all output objects, + users may directly call the mfxEncodeStatsContainer::SynchronizeStatistics function to get output statistics. + + + @param[in] ref_interface Valid interface. + @param[out] wait Wait time in milliseconds. + + + @return + MFX_ERR_NONE If no error. \n + MFX_ERR_NULL_PTR If interface is NULL. \n + MFX_ERR_INVALID_HANDLE If any of container is not valid object . \n + MFX_WRN_IN_EXECUTION If the given timeout is expired and the container is not ready. \n + MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete. \n + MFX_ERR_UNKNOWN Any internal error. + */ + mfxStatus (MFX_CDECL *SynchronizeStatistics)(mfxRefInterface* ref_interface, mfxU32 wait); + /*! @brief + Guarantees readiness of associated compressed bitstream after a function completes. + Instead of MFXVideoCORE_SyncOperation which leads to the synchronization of all output objects, + users may directly call the mfxEncodeStatsContainer::SynchronizeStatistics function to get output bitstream. + + + @param[in] ref_interface Valid interface. + @param[out] wait Wait time in milliseconds. + + + @return + MFX_ERR_NONE If no error. \n + MFX_ERR_NULL_PTR If interface is NULL. \n + MFX_ERR_INVALID_HANDLE If any of container is not valid object . \n + MFX_WRN_IN_EXECUTION If the given timeout is expired and the container is not ready. \n + MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete. \n + MFX_ERR_UNKNOWN Any internal error. + */ + mfxStatus (MFX_CDECL *SynchronizeBitstream)(mfxRefInterface* interface, mfxU32 wait); + mfxHDL reserved[4]; + mfxU32 reserved1[2]; + mfxU32 DisplayOrder; /*< To which frame number statistics belong. */ + mfxEncodeBlkStatsMemLayout MemLayout; /*< Memory layout for statistics. */ + mfxEncodeBlkStats *EncodeBlkStats; /*< Block level statistics. */ + mfxEncodeSliceStats *EncodeSliceStats; /*< Slice level statistics. */ + mfxEncodeTileStats *EncodeTileStats; /*< Tile level statistics. */ + mfxEncodeFrameStats *EncodeFrameStats; /*< Frame level statistics. */ + mfxU32 reserved2[8]; +}mfxEncodeStatsContainer; +MFX_PACK_END() + + +MFX_PACK_BEGIN_STRUCT_W_PTR() +/*! The extension buffer which should be attached by application for mfxBitstream buffer before + encode operation. As result the encoder will allocate memory for statistics and fill appropriate structures. +*/ +typedef struct { + mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODESTATS_BLK. */ + mfxU16 EncodeStatsFlags; /*! What statistics is required: block/slice/tile/frame level or any combinations. + In case of slice or tile output statistics for one slice or tile will be availbale only.*/ + mfxEncodeStatsMode Mode; /*!< What encoding mode should be used to gather statistics. */ + mfxEncodeStatsContainer *EncodeStatsContainer; /*!< encode output, filled by the implementation. */ + mfxU32 reserved[8]; +} mfxExtEncodeStatsOutput; +MFX_PACK_END() + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif + +#endif \ No newline at end of file diff --git a/source/elements/oneVPL/include/vpl/mfxjpeg.h b/source/elements/oneVPL/include/vpl/mfxjpeg.h index 9faba2666a..21e5e39ce0 100644 --- a/source/elements/oneVPL/include/vpl/mfxjpeg.h +++ b/source/elements/oneVPL/include/vpl/mfxjpeg.h @@ -62,9 +62,9 @@ enum { MFX_PACK_BEGIN_USUAL_STRUCT() /*! Specifies quantization tables. The application may specify up to 4 quantization tables. The encoder assigns an ID to each table. - That ID is equal to the table index in the Qm array. Table “0” is used for encoding of the Y component, table “1” for the U component, and table “2” + That ID is equal to the table index in the Qm array. Table "0" is used for encoding of the Y component, table "1" for the U component, and table "2" for the V component. The application may specify fewer tables than the 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. + 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. The following table illustrates this behavior. @internal @@ -94,8 +94,8 @@ MFX_PACK_END() MFX_PACK_BEGIN_USUAL_STRUCT() /*! Specifies Huffman tables. The application may specify up to 2 quantization table pairs for baseline process. The encoder - assigns an ID to each table. That ID is equal to the table index in the DCTables and ACTables arrays. Table “0” is used for encoding of the Y component and - table “1” is used for encoding of the U and V component. The application may specify only one table, in which case the table will be used for all components in the image. + assigns an ID to each table. That ID is equal to the table index in the DCTables and ACTables arrays. Table "0" is used for encoding of the Y component and + table "1" is used for encoding of the U and V component. The application may specify only one table, in which case the table will be used for all components in the image. The following table illustrates this behavior. @internal diff --git a/source/elements/oneVPL/include/vpl/mfxstructures.h b/source/elements/oneVPL/include/vpl/mfxstructures.h index 4f45fc3f82..7e3940009b 100644 --- a/source/elements/oneVPL/include/vpl/mfxstructures.h +++ b/source/elements/oneVPL/include/vpl/mfxstructures.h @@ -129,7 +129,7 @@ enum { /*! RGB 24 bit planar layout (3 separate channels, 8-bits per sample each). This format should be mapped to D3DFMT_R8G8B8 or VA_FOURCC_RGBP. */ MFX_FOURCC_RGBP = MFX_MAKEFOURCC('R','G','B','P'), MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FOURCC_RGB3) = MFX_MAKEFOURCC('R','G','B','3'), /* Deprecated. */ - MFX_FOURCC_RGB4 = MFX_MAKEFOURCC('R','G','B','4'), /*!< RGB4 (RGB32) color planes. BGRA is the order, ‘B’ is 8 MSBs, then 8 bits for ‘G’ channel, then ‘R’ and ‘A’ channels. */ + MFX_FOURCC_RGB4 = MFX_MAKEFOURCC('R','G','B','4'), /*!< RGB4 (RGB32) color planes. BGRA is the order, 'B' is 8 MSBs, then 8 bits for 'G' channel, then 'R' and 'A' channels. */ /*! Internal color format. The application should use the following functions to create a surface that corresponds to the Direct3D* version in use. @@ -149,10 +149,10 @@ enum { MFX_FOURCC_P010 = MFX_MAKEFOURCC('P','0','1','0'), /*!< P010 color format. This is 10 bit per sample format with similar to NV12 layout. This format should be mapped to DXGI_FORMAT_P010. */ MFX_FOURCC_P016 = MFX_MAKEFOURCC('P','0','1','6'), /*!< P016 color format. This is 16 bit per sample format with similar to NV12 layout. This format should be mapped to DXGI_FORMAT_P016. */ MFX_FOURCC_P210 = MFX_MAKEFOURCC('P','2','1','0'), /*!< 10 bit per sample 4:2:2 color format with similar to NV12 layout. */ - MFX_FOURCC_BGR4 = MFX_MAKEFOURCC('B','G','R','4'), /*!< RGBA color format. It is similar to MFX_FOURCC_RGB4 but with different order of channels. ‘R’ is 8 MSBs, then 8 bits for ‘G’ channel, then ‘B’ and ‘A’ channels. */ - MFX_FOURCC_A2RGB10 = MFX_MAKEFOURCC('R','G','1','0'), /*!< 10 bits ARGB color format packed in 32 bits. ‘A’ channel is two MSBs, then ‘R’, then ‘G’ and then ‘B’ channels. This format should be mapped to DXGI_FORMAT_R10G10B10A2_UNORM or D3DFMT_A2R10G10B10. */ - MFX_FOURCC_ARGB16 = MFX_MAKEFOURCC('R','G','1','6'), /*!< 10 bits ARGB color format packed in 64 bits. ‘A’ channel is 16 MSBs, then ‘R’, then ‘G’ and then ‘B’ channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_UINT or D3DFMT_A16B16G16R16 formats. */ - MFX_FOURCC_ABGR16 = MFX_MAKEFOURCC('B','G','1','6'), /*!< 10 bits ABGR color format packed in 64 bits. ‘A’ channel is 16 MSBs, then ‘B’, then ‘G’ and then ‘R’ channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_UINT or D3DFMT_A16B16G16R16 formats. */ + MFX_FOURCC_BGR4 = MFX_MAKEFOURCC('B','G','R','4'), /*!< RGBA color format. It is similar to MFX_FOURCC_RGB4 but with different order of channels. 'R' is 8 MSBs, then 8 bits for 'G' channel, then 'B' and 'A' channels. */ + MFX_FOURCC_A2RGB10 = MFX_MAKEFOURCC('R','G','1','0'), /*!< 10 bits ARGB color format packed in 32 bits. 'A' channel is two MSBs, then 'R', then 'G' and then 'B' channels. This format should be mapped to DXGI_FORMAT_R10G10B10A2_UNORM or D3DFMT_A2R10G10B10. */ + MFX_FOURCC_ARGB16 = MFX_MAKEFOURCC('R','G','1','6'), /*!< 10 bits ARGB color format packed in 64 bits. 'A' channel is 16 MSBs, then 'R', then 'G' and then 'B' channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_UINT or D3DFMT_A16B16G16R16 formats. */ + MFX_FOURCC_ABGR16 = MFX_MAKEFOURCC('B','G','1','6'), /*!< 10 bits ABGR color format packed in 64 bits. 'A' channel is 16 MSBs, then 'B', then 'G' and then 'R' channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_UINT or D3DFMT_A16B16G16R16 formats. */ MFX_FOURCC_R16 = MFX_MAKEFOURCC('R','1','6','U'), /*!< 16 bits single channel color format. This format should be mapped to DXGI_FORMAT_R16_TYPELESS or D3DFMT_R16F. */ MFX_FOURCC_AYUV = MFX_MAKEFOURCC('A','Y','U','V'), /*!< YUV 4:4:4, AYUV color format. This format should be mapped to DXGI_FORMAT_AYUV. */ MFX_FOURCC_AYUV_RGB4 = MFX_MAKEFOURCC('A','V','U','Y'), /*!< RGB4 stored in AYUV surface. This format should be mapped to DXGI_FORMAT_AYUV. */ @@ -170,6 +170,10 @@ enum { MFX_FOURCC_BGRA = MFX_FOURCC_RGB4, /*!< Alias for the RGB4 color format. */ /*! BGR 24 bit planar layout (3 separate channels, 8-bits per sample each). This format should be mapped to VA_FOURCC_BGRP. */ MFX_FOURCC_BGRP = MFX_MAKEFOURCC('B','G','R','P'), +#ifdef ONEVPL_EXPERIMENTAL + /*! 8bit per sample 4:4:4 format packed in 32 bits, X=unused/undefined, 'X' channel is 8 MSBs, then 'Y', then 'U', and then 'V' channels. This format should be mapped to VA_FOURCC_XYUV. */ + MFX_FOURCC_XYUV = MFX_MAKEFOURCC('X','Y','U','V'), +#endif }; /* PicStruct */ @@ -353,9 +357,7 @@ typedef enum { MFX_HANDLE_VA_CONTEXT_ID = 7, /*!< Pointer to VAContextID interface. It represents external VA context for Common Encryption usage model. */ MFX_HANDLE_CM_DEVICE = 8, /*!< Pointer to CmDevice interface ( Intel(r) C for Metal Runtime ). */ MFX_HANDLE_HDDLUNITE_WORKLOADCONTEXT = 9, /*!< Pointer to HddlUnite::WorkloadContext interface. */ -#ifdef ONEVPL_EXPERIMENTAL MFX_HANDLE_PXP_CONTEXT = 10, /*!< Pointer to PXP context for protected content support. */ -#endif } mfxHandleType; /*! The mfxMemoryFlags enumerator specifies memory access mode. */ @@ -571,6 +573,8 @@ typedef struct mfxFrameSurfaceInterface { @attention This is callback function and intended to be called by the library only. + + @note The library calls this callback only when this surface is used as the output surface. It is expected that the function is low-intrusive designed otherwise it may impact performance. @@ -786,9 +790,9 @@ typedef struct { all components are encoded in one scan. See the JPEG Scan Type enumerator for details. */ mfxU16 Interleaved; /*! Specifies the image quality if the application does not specified quantization table. - The value is from 1 to 100 inclusive. “100” is the best quality. */ + The value is from 1 to 100 inclusive. "100" is the best quality. */ mfxU16 Quality; - /*! Specifies the number of MCU in the restart interval. “0” means no restart interval. */ + /*! Specifies the number of MCU in the restart interval. "0" means no restart interval. */ mfxU16 RestartInterval; mfxU16 reserved5[10]; }; @@ -1246,7 +1250,7 @@ MFX_PACK_END() enum { MFX_B_REF_UNKNOWN = 0, /*!< Default value, it is up to the encoder to use B-frames as reference. */ MFX_B_REF_OFF = 1, /*!< Do not use B-frames as reference. */ - MFX_B_REF_PYRAMID = 2 /*!< Arrange B-frames in so-called “B pyramid” reference structure. */ + MFX_B_REF_PYRAMID = 2 /*!< Arrange B-frames in so-called "B pyramid" reference structure. */ }; /*! The LookAheadDownSampling enumerator is used to control down sampling in look ahead bitrate control mode in AVC encoder. */ @@ -1481,7 +1485,7 @@ enum { enum { MFX_P_REF_DEFAULT = 0, /*!< Allow encoder to decide. */ MFX_P_REF_SIMPLE = 1, /*!< Regular sliding window used for DPB removal process. */ - MFX_P_REF_PYRAMID = 2 /*!< Let N be the max reference list’s size. Encoder treats each N’s frame as a 'strong' + MFX_P_REF_PYRAMID = 2 /*!< Let N be the max reference list's size. Encoder treats each N's frame as a 'strong' reference and the others as 'weak' references. The encoder uses a 'weak' reference only for prediction of the next frame and removes it from DPB immediately after use. 'Strong' references are removed from DPB by a sliding window. */ @@ -2146,6 +2150,10 @@ enum { the mfxEncodeCtrl structure for per-frame encoding configuration. */ MFX_EXTBUFF_UNIVERSAL_REFLIST_CTRL = MFX_EXTBUFF_AVC_REFLIST_CTRL, + /*! + See the mfxExtEncodeStats structure for details. + */ + MFX_EXTBUFF_ENCODESTATS = MFX_MAKEFOURCC('E','N','S','B'), #endif /*! See the mfxExtVPP3DLut structure for more details. @@ -2161,7 +2169,7 @@ enum { /* VPP Conf: Do not use certain algorithms */ MFX_PACK_BEGIN_STRUCT_W_PTR() /*! - Tells the VPP not to use certain filters in pipeline. See “Configurable VPP filters” table for complete + 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. */ typedef struct { @@ -2392,7 +2400,7 @@ typedef struct { }; }; MFX_DEPRECATED mfxU16 SceneChangeRate; /* Deprecated */ - MFX_DEPRECATED mfxU16 RepeatedFrame; /* Deprecated */ + mfxU16 RepeatedFrame; /*!< The flag signalizes that the frame is identical to the previous one. */ } mfxExtVppAuxData; MFX_PACK_END() @@ -2706,7 +2714,7 @@ MFX_PACK_BEGIN_STRUCT_W_PTR() @li Attaching a filter configuration structure directly to the mfxVideoParam structure. In this method, adding filter ID to the mfxExtVPPDoUse structure is optional. - See Table “Configurable VPP filters” for complete list of + 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. @@ -2830,7 +2838,7 @@ enum { MFX_PACK_BEGIN_USUAL_STRUCT() /*! - Configures the HDR SEI message. + Handle the HDR SEI message. If the application attaches this structure to the mfxEncodeCtrl structure at runtime, the encoder inserts the HDR SEI message for the current frame and ignores InsertPayloadToggle. @@ -2840,6 +2848,12 @@ MFX_PACK_BEGIN_USUAL_STRUCT() If the application attaches this structure for video processing, InsertPayloadToggle will be ignored. + If the application attaches this structure to the mfxFrameSurface1 structure at runtime + which will seed to the MFXVideoDECODE_DecodeFrameAsync() as surface_work parameter, + the decoder will parse the HDR SEI message if the bitstream include HDR SEI message per frame. + The parsed HDR SEI will be attached to the ExtendBuffer of surface_out parameter of MFXVideoDECODE_DecodeFrameAsync(). + This function is support for HEVC only now. + Field semantics are defined in ITU-T* H.265 Annex D. */ typedef struct { @@ -2864,7 +2878,7 @@ MFX_PACK_END() MFX_PACK_BEGIN_USUAL_STRUCT() /*! - Configures the HDR SEI message. + Handle the HDR SEI message. If the application attaches this structure to the mfxEncodeCtrl structure at runtime, the encoder inserts the HDR SEI message for the current frame and ignores InsertPayloadToggle. @@ -2875,6 +2889,12 @@ MFX_PACK_BEGIN_USUAL_STRUCT() If the application attaches this structure for video processing, InsertPayloadToggle will be ignored. + If the application attaches this structure to the mfxFrameSurface1 structure at runtime + which will seed to the MFXVideoDECODE_DecodeFrameAsync() as surface_work parameter, + the decoder will parse the HDR SEI message if the bitstream include HDR SEI message per frame. + The parsed HDR SEI will be attached to the ExtendBuffer of surface_out parameter of MFXVideoDECODE_DecodeFrameAsync(). + This function is support for HEVC only now. + Field semantics are defined in ITU-T* H.265 Annex D. */ typedef struct { @@ -3324,7 +3344,7 @@ MFX_PACK_BEGIN_USUAL_STRUCT() Specifies reference lists for the encoder. It may be used together with the mfxExtAVCRefListCtrl structure to create customized reference lists. If both structures are used together, then the encoder takes reference lists from the mfxExtAVCRefLists structure and modifies them according to the mfxExtAVCRefListCtrl instructions. In case of interlaced coding, - the first mfxExtAVCRefLists structure affects TOP field and the second – BOTTOM field. + the first mfxExtAVCRefLists structure affects TOP field and the second - BOTTOM field. @note Not all implementations of the encoder support this structure. The application must use the Query API function to determine if it is supported. */ @@ -3490,7 +3510,7 @@ typedef struct { For AVC, the valid range is 1 to 51. - For HEVC, the valid range is 1 to 51. Application’s provided QP values should be valid. Otherwise invalid QP values may cause undefined behavior. + For HEVC, the valid range is 1 to 51. Application's provided QP values should be valid. Otherwise invalid QP values may cause undefined behavior. MBQP map should be aligned for 16x16 block size. The alignment rule is (width +15 /16) && (height +15 /16). For MPEG2, QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification and has a valid range of 1 to 112. @@ -3645,7 +3665,6 @@ enum { MFX_ERROR_SLICEHEADER = (1 << 2), /*!< Invalid/corrupted slice header. */ MFX_ERROR_SLICEDATA = (1 << 3), /*!< Invalid/corrupted slice data. */ MFX_ERROR_FRAME_GAP = (1 << 4), /*!< Missed frames. */ -#ifdef ONEVPL_EXPERIMENTAL MFX_ERROR_JPEG_APP0_MARKER = (1 << 5), /*!< Invalid/corrupted APP0 marker. */ MFX_ERROR_JPEG_APP1_MARKER = (1 << 6), /*!< Invalid/corrupted APP1 marker. */ MFX_ERROR_JPEG_APP2_MARKER = (1 << 7), /*!< Invalid/corrupted APP2 marker. */ @@ -3667,7 +3686,6 @@ enum { MFX_ERROR_JPEG_DRI_MARKER = (1 << 23), /*!< Invalid/corrupted DRI marker. */ MFX_ERROR_JPEG_SOS_MARKER = (1 << 24), /*!< Invalid/corrupted SOS marker. */ MFX_ERROR_JPEG_UNKNOWN_MARKER = (1 << 25), /*!< Unknown Marker. */ -#endif }; @@ -3755,8 +3773,8 @@ typedef struct { mfxU16 LumaLog2WeightDenom; /*!< Base 2 logarithm of the denominator for all luma weighting factors. Value must be in the range of 0 to 7, inclusive. */ mfxU16 ChromaLog2WeightDenom; /*!< Base 2 logarithm of the denominator for all chroma weighting factors. Value must be in the range of 0 to 7, inclusive. */ - mfxU16 LumaWeightFlag[2][32]; /*!< LumaWeightFlag[L][R] equal to 1 specifies that the weighting factors for the luma component are specified for R’s entry of RefPicList L. */ - mfxU16 ChromaWeightFlag[2][32]; /*!< ChromaWeightFlag[L][R] equal to 1 specifies that the weighting factors for the chroma component are specified for R’s entry of RefPicList L. */ + 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 @@ -3993,7 +4011,7 @@ typedef struct { MFX_PACK_END() -/*! The ChromaSiting enumerator defines chroma location. Use bit-OR’ed values to specify the desired location. */ +/*! The ChromaSiting enumerator defines chroma location. Use bit-OR'ed values to specify the desired location. */ enum { MFX_CHROMA_SITING_UNKNOWN = 0x0000, /*!< Unspecified. */ MFX_CHROMA_SITING_VERTICAL_TOP = 0x0001, /*!< Chroma samples are co-sited vertically on the top with the luma samples. */ @@ -4054,9 +4072,9 @@ MFX_PACK_BEGIN_USUAL_STRUCT() */ typedef struct { mfxU16 FeatureEnabled; /*!< Indicates which features are enabled for the segment. See the SegmentFeature enumerator for values for this - option. Values from the enumerator can be bit-OR’ed. Support of a particular feature depends on underlying + option. Values from the enumerator can be bit-OR'ed. Support of a particular feature depends on underlying hardware platform. Application can check which features are supported by calling Query. */ - mfxI16 QIndexDelta; /*!< Quantization index delta for the segment. Ignored if MFX_VP9_SEGMENT_FEATURE_QINDEX isn’t set in FeatureEnabled. + 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. */ @@ -4065,7 +4083,7 @@ typedef struct { 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. */ + if MFX_VP9_SEGMENT_FEATURE_REFERENCE isn't set in FeatureEnabled. */ mfxU16 reserved[12]; } mfxVP9SegmentParam; MFX_PACK_END() @@ -4073,13 +4091,13 @@ MFX_PACK_END() MFX_PACK_BEGIN_STRUCT_W_L_TYPE() /*! In the VP9 encoder it is possible to divide a frame into up to 8 segments and apply particular features (like delta for quantization index or for - loop filter level) on a per-segment basis. “Uncompressed header” of every frame indicates if segmentation is enabled for the current frame, - and (if segmentation enabled) contains full information about features applied to every segment. Every “Mode info block” of a coded + loop filter level) on a per-segment basis. "Uncompressed header" of every frame indicates if segmentation is enabled for the current frame, + and (if segmentation enabled) contains full information about features applied to every segment. Every "Mode info block" of a coded frame has segment_id in the range of 0 to 7. To enable Segmentation, the mfxExtVP9Segmentation structure with correct settings should be passed to the encoder. It can be attached to the - mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtVP9Segmentation buffer isn’t - attached during initialization, segmentation is disabled for static configuration. If the buffer isn’t attached for the Reset call, the encoder + mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtVP9Segmentation buffer isn't + attached during initialization, segmentation is disabled for static configuration. If the buffer isn't attached for the Reset call, the encoder continues to use static configuration for segmentation which was the default before this Reset call. If the mfxExtVP9Segmentation buffer with NumSegments=0 is provided during initialization or Reset call, segmentation becomes disabled for static configuration. @@ -4102,7 +4120,7 @@ typedef struct { Entries with indexes bigger than NumSegments-1 are ignored. See the mfxVP9SegmentParam structure for definitions of segment features and their parameters. */ mfxU16 SegmentIdBlockSize; /*!< Size of block (NxN) for segmentation map. See SegmentIdBlockSize enumerator for values for this - option. An encoded block that is bigger than SegmentIdBlockSize uses segment_id taken from it’s + option. An encoded block that is bigger than SegmentIdBlockSize uses segment_id taken from it's top-left sub-block from the segmentation map. The application can check if a particular block size is supported by calling Query. */ mfxU32 NumSegmentIdAlloc; /*!< Size of buffer allocated for segmentation map (in bytes). Application must assure that @@ -4129,7 +4147,7 @@ MFX_PACK_BEGIN_USUAL_STRUCT() */ typedef struct { mfxU16 FrameRateScale; /*!< The ratio between the frame rates of the current temporal layer and the base layer. The library treats a particular - temporal layer as “defined” if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the + temporal layer as "defined" if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the FrameRateScale value of previous layer. */ mfxU16 TargetKbps; /*!< Target bitrate for the current temporal layer. Ignored if RateControlMethod is CQP. If RateControlMethod is not CQP, the application must provide TargetKbps for every defined temporal layer. TargetKbps of each subsequent layer (if defined) @@ -4140,17 +4158,17 @@ MFX_PACK_END() MFX_PACK_BEGIN_USUAL_STRUCT() /*! - API allows the encoding of VP9 bitstreams that contain several subset bitstreams that differ in frame rates, also called “temporal layers”. + API allows the encoding of VP9 bitstreams that contain several subset bitstreams that differ in frame rates, also called "temporal layers". When decoding, each temporal layer can be extracted from the coded stream and decoded separately. The mfxExtVP9TemporalLayers structure configures the temporal layers for the VP9 encoder. It can be attached to the mfxVideoParam structure during initialization or the - MFXVideoENCODE_Reset call. If the mfxExtVP9TemporalLayers buffer isn’t attached during initialization, temporal scalability is disabled. If the buffer isn’t attached for the Reset call, the encoder continues to use the temporal scalability configuration that was defined before the Reset call. + MFXVideoENCODE_Reset call. If the mfxExtVP9TemporalLayers buffer isn't attached during initialization, temporal scalability is disabled. If the buffer isn't attached for the Reset call, the encoder continues to use the temporal scalability configuration that was defined before the Reset call. In the API, temporal layers are ordered by their frame rates in ascending order. Temporal layer 0 (having the lowest frame rate) is called the base layer. Each subsequent temporal layer includes all previous layers. The temporal scalability feature requires a minimum number of allocated reference - frames (controlled by the NumRefFrame parameter). If the NumRefFrame value set by the application isn’t enough to build the reference structure for the requested + frames (controlled by the NumRefFrame parameter). If the NumRefFrame value set by the application isn't enough to build the reference structure for the requested number of temporal layers, the library corrects the NumRefFrame value. The temporal layer structure is reset (re-started) after key-frames. */ typedef struct { @@ -4159,7 +4177,7 @@ typedef struct { The array of temporal layers. Layer[0] specifies the base layer. The library reads layers from the array when they are defined (FrameRateScale > 0). - All layers starting from first layer with FrameRateScale = 0 are ignored. The last layer that is not ignored is considered the “highest layer”. + All layers starting from first layer with FrameRateScale = 0 are ignored. The last layer that is not ignored is considered the "highest layer". The frame rate of the highest layer is specified in the mfxVideoParam structure. Frame rates of lower layers are calculated using their FrameRateScale. @@ -4394,7 +4412,7 @@ typedef struct { /*! Mask array. Every bit represents sub-device (or thread for CPU). "1" means execution is allowed. "0" means that execution is prohibited on this sub-device (or thread). Length of the array is equal to the: - "max_subdevices / 8" and rounded to the closest (from the right) integer. + "NumSubDevices / 8" and rounded to the closest (from the right) integer. Bits order within each entry of the mask array is LSB: bit 0 holds data for sub device with index 0 and bit 8 for sub device with index 8. Index of sub device is defined by the mfxDeviceDescription structure. */ @@ -4476,9 +4494,9 @@ MFX_PACK_BEGIN_USUAL_STRUCT() */ typedef struct { mfxU16 FeatureEnabled; /*!< Indicates which features are enabled for the segment. See the AV1 SegmentFeature enumerator for values for - this option. Values from the enumerator can be bit-OR’ed. Support of a particular feature depends on underlying + this option. Values from the enumerator can be bit-OR'ed. Support of a particular feature depends on underlying hardware platform. Application can check which features are supported by calling Query. */ - mfxI16 AltQIndex; /*!< Quantization index delta for the segment. Ignored if MFX_AV1_SEGMENT_FEATURE_ALT_QINDEX isn’t set in FeatureEnabled. + mfxI16 AltQIndex; /*!< Quantization index delta for the segment. Ignored if MFX_AV1_SEGMENT_FEATURE_ALT_QINDEX isn't set in FeatureEnabled. Valid range for this parameter is [-255, 255]. If AltQIndex is out of this range, it will be ignored. If AltQIndex is within valid range, but sum of base quantization index and AltQIndex is out of [0, 255], AltQIndex will be clamped. */ mfxU16 reserved[30]; @@ -4488,12 +4506,12 @@ MFX_PACK_END() MFX_PACK_BEGIN_STRUCT_W_PTR() /*! In the AV1 encoder it is possible to divide a frame into up to 8 segments and apply particular features (like delta for quantization index or for - loop filter level) on a per-segment basis. “Uncompressed header” of every frame indicates if segmentation is enabled for the current frame, - and (if segmentation enabled) contains full information about features applied to every segment. Every “Mode info block” of a coded + loop filter level) on a per-segment basis. "Uncompressed header" of every frame indicates if segmentation is enabled for the current frame, + and (if segmentation enabled) contains full information about features applied to every segment. Every "Mode info block" of a coded frame has segment_id in the range of 0 to 7. To enable Segmentation, the mfxExtAV1Segmentation structure with correct settings should be passed to the encoder. It can be attached to the - mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtAV1Segmentation buffer isn’t - attached during initialization, segmentation is disabled for static configuration. If the buffer isn’t attached for the Reset call, the encoder + mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtAV1Segmentation buffer isn't + attached during initialization, segmentation is disabled for static configuration. If the buffer isn't attached for the Reset call, the encoder continues to use static configuration for segmentation which was the default before this Reset call. If the mfxExtAV1Segmentation buffer with NumSegments=0 is provided during initialization or Reset call, segmentation becomes disabled for static configuration. The buffer can be attached to the mfxEncodeCtrl structure during runtime (dynamic configuration). Dynamic configuration is applied to the @@ -4516,7 +4534,7 @@ typedef struct { Entries with indexes bigger than NumSegments-1 are ignored. See the mfxAV1SegmentParam structure for definitions of segment features and their parameters. */ mfxU16 SegmentIdBlockSize;/*!< Size of block (NxN) for segmentation map. See AV1 SegmentIdBlockSize enumerator for values for this - option. An encoded block that is bigger than AV1 SegmentIdBlockSize uses segment_id taken from it’s + option. An encoded block that is bigger than AV1 SegmentIdBlockSize uses segment_id taken from it's top-left sub-block from the segmentation map. The application can check if a particular block size is supported by calling Query. */ mfxU16 reserved2; @@ -4571,7 +4589,7 @@ typedef struct { mfxAV1FilmGrainPoint PointCb[10]; /*!< The array of points for Cb component. */ mfxAV1FilmGrainPoint PointCr[10]; /*!< The array of points for Cr component. */ - mfxU8 GrainScalingMinus8; /*!< The shift – 8 applied to the values of the chroma component. The grain_scaling_minus_8 can take values of 0..3 and + mfxU8 GrainScalingMinus8; /*!< The shift - 8 applied to the values of the chroma component. The grain_scaling_minus_8 can take values of 0..3 and determines the range and quantization step of the standard deviation of film grain.*/ mfxU8 ArCoeffLag; /*!< The number of auto-regressive coefficients for luma and chroma.*/ @@ -4709,7 +4727,7 @@ MFX_PACK_BEGIN_USUAL_STRUCT() /*! The structure is used for universal temporal layer description. */ typedef struct { mfxU16 FrameRateScale; /*!< The ratio between the frame rates of the current temporal layer and the base layer. The library treats a particular - temporal layer as “defined” if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. + temporal layer as "defined" if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the FrameRateScale value of previous layer. */ mfxU16 reserved[3]; /*!< Reserved for future use. */ diff --git a/source/elements/oneVPL/include/vpl/mfxvideo++.h b/source/elements/oneVPL/include/vpl/mfxvideo++.h index 3c3ce4564f..afcfa3d2b6 100644 --- a/source/elements/oneVPL/include/vpl/mfxvideo++.h +++ b/source/elements/oneVPL/include/vpl/mfxvideo++.h @@ -9,7 +9,106 @@ #include "mfxvideo.h" -class MFXVideoSession { +class MFXVideoSessionBase { +public: + virtual ~MFXVideoSessionBase() {} + + virtual mfxStatus Init(mfxIMPL impl, mfxVersion* ver) = 0; + virtual mfxStatus InitEx(mfxInitParam par) = 0; + virtual mfxStatus Close(void) = 0; + + virtual mfxStatus QueryIMPL(mfxIMPL* impl) = 0; + virtual mfxStatus QueryVersion(mfxVersion* version) = 0; + + virtual mfxStatus JoinSession(mfxSession child_session) = 0; + virtual mfxStatus DisjoinSession() = 0; + virtual mfxStatus CloneSession(mfxSession* clone) = 0; + virtual mfxStatus SetPriority(mfxPriority priority) = 0; + virtual mfxStatus GetPriority(mfxPriority* priority) = 0; + + virtual mfxStatus SetFrameAllocator(mfxFrameAllocator* allocator) = 0; + virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) = 0; + virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL* hdl) = 0; + virtual mfxStatus QueryPlatform(mfxPlatform* platform) = 0; + + virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) = 0; + + virtual mfxStatus GetSurfaceForEncode(mfxFrameSurface1** output_surf) = 0; + virtual mfxStatus GetSurfaceForDecode(mfxFrameSurface1** output_surf) = 0; + virtual mfxStatus GetSurfaceForVPP(mfxFrameSurface1** output_surf) = 0; + virtual mfxStatus GetSurfaceForVPPOut(mfxFrameSurface1** output_surf) = 0; + + virtual operator mfxSession(void) = 0; +}; + +class MFXVideoENCODEBase { +public: + virtual ~MFXVideoENCODEBase() {} + + virtual mfxStatus Query(mfxVideoParam* in, mfxVideoParam* out) = 0; + virtual mfxStatus QueryIOSurf(mfxVideoParam* par, mfxFrameAllocRequest* request) = 0; + virtual mfxStatus Init(mfxVideoParam* par) = 0; + virtual mfxStatus Reset(mfxVideoParam* par) = 0; + virtual mfxStatus Close(void) = 0; + + virtual mfxStatus GetVideoParam(mfxVideoParam* par) = 0; + virtual mfxStatus GetEncodeStat(mfxEncodeStat* stat) = 0; + + virtual mfxStatus EncodeFrameAsync(mfxEncodeCtrl* ctrl, + mfxFrameSurface1* surface, + mfxBitstream* bs, + mfxSyncPoint* syncp) = 0; + + virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) = 0; +}; + +class MFXVideoDECODEBase { +public: + virtual ~MFXVideoDECODEBase() {} + + virtual mfxStatus Query(mfxVideoParam* in, mfxVideoParam* out) = 0; + virtual mfxStatus DecodeHeader(mfxBitstream* bs, mfxVideoParam* par) = 0; + virtual mfxStatus QueryIOSurf(mfxVideoParam* par, mfxFrameAllocRequest* request) = 0; + virtual mfxStatus Init(mfxVideoParam* par) = 0; + virtual mfxStatus Reset(mfxVideoParam* par) = 0; + virtual mfxStatus Close(void) = 0; + + virtual mfxStatus GetVideoParam(mfxVideoParam* par) = 0; + + virtual mfxStatus GetDecodeStat(mfxDecodeStat* stat) = 0; + virtual mfxStatus GetPayload(mfxU64* ts, mfxPayload* payload) = 0; + virtual mfxStatus SetSkipMode(mfxSkipMode mode) = 0; + virtual mfxStatus DecodeFrameAsync(mfxBitstream* bs, + mfxFrameSurface1* surface_work, + mfxFrameSurface1** surface_out, + mfxSyncPoint* syncp) = 0; + + virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) = 0; +}; + +class MFXVideoVPPBase { +public: + virtual ~MFXVideoVPPBase() {} + + virtual mfxStatus Query(mfxVideoParam* in, mfxVideoParam* out) = 0; + virtual mfxStatus QueryIOSurf(mfxVideoParam* par, mfxFrameAllocRequest request[2]) = 0; + virtual mfxStatus Init(mfxVideoParam* par) = 0; + virtual mfxStatus Reset(mfxVideoParam* par) = 0; + virtual mfxStatus Close(void) = 0; + + virtual mfxStatus GetVideoParam(mfxVideoParam* par) = 0; + virtual mfxStatus GetVPPStat(mfxVPPStat* stat) = 0; + virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1* in, + mfxFrameSurface1* out, + mfxExtVppAuxData* aux, + mfxSyncPoint* syncp) = 0; + + virtual mfxStatus GetSurfaceIn(mfxFrameSurface1** output_surf) = 0; + virtual mfxStatus GetSurfaceOut(mfxFrameSurface1** output_surf) = 0; + virtual mfxStatus ProcessFrameAsync(mfxFrameSurface1* in, mfxFrameSurface1** out) = 0; +}; + +class MFXVideoSession : public MFXVideoSessionBase { public: MFXVideoSession(void) { m_session = (mfxSession)0; @@ -18,73 +117,73 @@ class MFXVideoSession { Close(); } - virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) { + virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) override { return MFXInit(impl, ver, &m_session); } - virtual mfxStatus InitEx(mfxInitParam par) { + virtual mfxStatus InitEx(mfxInitParam par) override { return MFXInitEx(par, &m_session); } - virtual mfxStatus Close(void) { + virtual mfxStatus Close(void) override { mfxStatus mfxRes; mfxRes = MFXClose(m_session); m_session = (mfxSession)0; return mfxRes; } - virtual mfxStatus QueryIMPL(mfxIMPL *impl) { + virtual mfxStatus QueryIMPL(mfxIMPL *impl) override { return MFXQueryIMPL(m_session, impl); } - virtual mfxStatus QueryVersion(mfxVersion *version) { + virtual mfxStatus QueryVersion(mfxVersion *version) override { return MFXQueryVersion(m_session, version); } - virtual mfxStatus JoinSession(mfxSession child_session) { + virtual mfxStatus JoinSession(mfxSession child_session) override { return MFXJoinSession(m_session, child_session); } - virtual mfxStatus DisjoinSession() { + virtual mfxStatus DisjoinSession() override { return MFXDisjoinSession(m_session); } - virtual mfxStatus CloneSession(mfxSession *clone) { + virtual mfxStatus CloneSession(mfxSession *clone) override { return MFXCloneSession(m_session, clone); } - virtual mfxStatus SetPriority(mfxPriority priority) { + virtual mfxStatus SetPriority(mfxPriority priority) override { return MFXSetPriority(m_session, priority); } - virtual mfxStatus GetPriority(mfxPriority *priority) { + virtual mfxStatus GetPriority(mfxPriority *priority) override { return MFXGetPriority(m_session, priority); } - virtual mfxStatus SetFrameAllocator(mfxFrameAllocator *allocator) { + virtual mfxStatus SetFrameAllocator(mfxFrameAllocator *allocator) override { return MFXVideoCORE_SetFrameAllocator(m_session, allocator); } - virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) { + virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) override { return MFXVideoCORE_SetHandle(m_session, type, hdl); } - virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *hdl) { + virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *hdl) override { return MFXVideoCORE_GetHandle(m_session, type, hdl); } - virtual mfxStatus QueryPlatform(mfxPlatform *platform) { + virtual mfxStatus QueryPlatform(mfxPlatform *platform) override { return MFXVideoCORE_QueryPlatform(m_session, platform); } - virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) { + virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) override { return MFXVideoCORE_SyncOperation(m_session, syncp, wait); } - virtual mfxStatus GetSurfaceForEncode(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurfaceForEncode(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForEncode(m_session, output_surf); } - virtual mfxStatus GetSurfaceForDecode(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurfaceForDecode(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForDecode(m_session, output_surf); } - virtual mfxStatus GetSurfaceForVPP (mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurfaceForVPP (mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForVPP (m_session, output_surf); } - virtual mfxStatus GetSurfaceForVPPOut(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurfaceForVPPOut(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf); } - virtual operator mfxSession(void) { + virtual operator mfxSession(void) override { return m_session; } @@ -95,7 +194,7 @@ class MFXVideoSession { void operator=(MFXVideoSession &); }; -class MFXVideoENCODE { +class MFXVideoENCODE : public MFXVideoENCODEBase { public: explicit MFXVideoENCODE(mfxSession session) { m_session = session; @@ -104,37 +203,37 @@ class MFXVideoENCODE { Close(); } - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { + virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override { return MFXVideoENCODE_Query(m_session, in, out); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { + virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override { return MFXVideoENCODE_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { + virtual mfxStatus Init(mfxVideoParam *par) override { return MFXVideoENCODE_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { + virtual mfxStatus Reset(mfxVideoParam *par) override { return MFXVideoENCODE_Reset(m_session, par); } - virtual mfxStatus Close(void) { + virtual mfxStatus Close(void) override { return MFXVideoENCODE_Close(m_session); } - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { + virtual mfxStatus GetVideoParam(mfxVideoParam *par) override { return MFXVideoENCODE_GetVideoParam(m_session, par); } - virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) { + virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) override { return MFXVideoENCODE_GetEncodeStat(m_session, stat); } virtual mfxStatus EncodeFrameAsync(mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, - mfxSyncPoint *syncp) { + mfxSyncPoint *syncp) override { return MFXVideoENCODE_EncodeFrameAsync(m_session, ctrl, surface, bs, syncp); } - virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForEncode(m_session, output_surf); } @@ -142,7 +241,7 @@ class MFXVideoENCODE { mfxSession m_session; // (mfxSession) handle to the owning session }; -class MFXVideoDECODE { +class MFXVideoDECODE : public MFXVideoDECODEBase { public: explicit MFXVideoDECODE(mfxSession session) { m_session = session; @@ -151,46 +250,46 @@ class MFXVideoDECODE { Close(); } - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { + virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override { return MFXVideoDECODE_Query(m_session, in, out); } - virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) { + virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) override { return MFXVideoDECODE_DecodeHeader(m_session, bs, par); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { + virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override { return MFXVideoDECODE_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { + virtual mfxStatus Init(mfxVideoParam *par) override { return MFXVideoDECODE_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { + virtual mfxStatus Reset(mfxVideoParam *par) override { return MFXVideoDECODE_Reset(m_session, par); } - virtual mfxStatus Close(void) { + virtual mfxStatus Close(void) override { return MFXVideoDECODE_Close(m_session); } - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { + virtual mfxStatus GetVideoParam(mfxVideoParam *par) override { return MFXVideoDECODE_GetVideoParam(m_session, par); } - virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) { + virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) override { return MFXVideoDECODE_GetDecodeStat(m_session, stat); } - virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) { + virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) override { return MFXVideoDECODE_GetPayload(m_session, ts, payload); } - virtual mfxStatus SetSkipMode(mfxSkipMode mode) { + virtual mfxStatus SetSkipMode(mfxSkipMode mode) override { return MFXVideoDECODE_SetSkipMode(m_session, mode); } virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, - mfxSyncPoint *syncp) { + mfxSyncPoint *syncp) override { return MFXVideoDECODE_DecodeFrameAsync(m_session, bs, surface_work, surface_out, syncp); } - virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForDecode(m_session, output_surf); } @@ -198,7 +297,7 @@ class MFXVideoDECODE { mfxSession m_session; // (mfxSession) handle to the owning session }; -class MFXVideoVPP { +class MFXVideoVPP : public MFXVideoVPPBase { public: explicit MFXVideoVPP(mfxSession session) { m_session = session; @@ -207,43 +306,43 @@ class MFXVideoVPP { Close(); } - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { + virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override { return MFXVideoVPP_Query(m_session, in, out); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest request[2]) { + virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest request[2]) override { return MFXVideoVPP_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { + virtual mfxStatus Init(mfxVideoParam *par) override { return MFXVideoVPP_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { + virtual mfxStatus Reset(mfxVideoParam *par) override { return MFXVideoVPP_Reset(m_session, par); } - virtual mfxStatus Close(void) { + virtual mfxStatus Close(void) override { return MFXVideoVPP_Close(m_session); } - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { + virtual mfxStatus GetVideoParam(mfxVideoParam *par) override { return MFXVideoVPP_GetVideoParam(m_session, par); } - virtual mfxStatus GetVPPStat(mfxVPPStat *stat) { + virtual mfxStatus GetVPPStat(mfxVPPStat *stat) override { return MFXVideoVPP_GetVPPStat(m_session, stat); } virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, - mfxSyncPoint *syncp) { + mfxSyncPoint *syncp) override { return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp); } - virtual mfxStatus GetSurfaceIn(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurfaceIn(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForVPP(m_session, output_surf); } - virtual mfxStatus GetSurfaceOut(mfxFrameSurface1** output_surf) { + virtual mfxStatus GetSurfaceOut(mfxFrameSurface1** output_surf) override { return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf); } - virtual mfxStatus ProcessFrameAsync(mfxFrameSurface1 *in, mfxFrameSurface1 **out) { + virtual mfxStatus ProcessFrameAsync(mfxFrameSurface1 *in, mfxFrameSurface1 **out) override { return MFXVideoVPP_ProcessFrameAsync(m_session, in, out); } diff --git a/source/elements/oneVPL/include/vpl/mfxvideo.h b/source/elements/oneVPL/include/vpl/mfxvideo.h index 9852ff13bc..c72d17df80 100755 --- a/source/elements/oneVPL/include/vpl/mfxvideo.h +++ b/source/elements/oneVPL/include/vpl/mfxvideo.h @@ -303,7 +303,7 @@ mfxStatus MFX_CDECL MFXMemory_GetSurfaceForDecode(mfxSession session, mfxFrameSu @brief Works in either of four modes: - @li If the @p in parameter is zero, the function returns the class configurability in the output structure. The output structure has a non-zero value in each field that the implementation can configure using Init. + @li If the @p in parameter is zero, the function returns the class configurability in the output structure. The application must set to zero the fields it wants to check for support. If the field is supported, function sets non-zero value to this field, otherwise it would be ignored. It indicates that the SDK implementation can configure the field with Init. @li If the @p in parameter is non-zero, the function checks the validity of the fields in the input structure. Then the function returns the corrected values in the output structure. If there is insufficient information to determine the validity or correction is impossible, the function zeroes the fields. diff --git a/source/elements/oneVPL/source/API_ref/VPL_defines.rst b/source/elements/oneVPL/source/API_ref/VPL_defines.rst index 7ab5c1b117..748190fa24 100644 --- a/source/elements/oneVPL/source/API_ref/VPL_defines.rst +++ b/source/elements/oneVPL/source/API_ref/VPL_defines.rst @@ -65,3 +65,9 @@ API .. doxygendefine::MFX_EXTENDEDDEVICEID_VERSION :project: oneVPL +.. doxygendefine::MFX_ENCODESTATSCONTAINER_VERSION + :project: oneVPL + +.. doxygendefine::MFX_REFINTERFACE_VERSION + :project: oneVPL + \ No newline at end of file diff --git a/source/elements/oneVPL/source/API_ref/VPL_enums.rst b/source/elements/oneVPL/source/API_ref/VPL_enums.rst index 3b5192ccf7..e2ccaee42d 100644 --- a/source/elements/oneVPL/source/API_ref/VPL_enums.rst +++ b/source/elements/oneVPL/source/API_ref/VPL_enums.rst @@ -672,6 +672,9 @@ The ColorFourCC enumerator itemizes color formats. .. doxygenenumvalue:: MFX_FOURCC_BGRP :project: oneVPL +.. doxygenenumvalue:: MFX_FOURCC_XYUV + :project: oneVPL + ----------- ContentInfo ----------- @@ -1107,6 +1110,9 @@ extended buffers or video processing algorithm identifiers. .. doxygenenumvalue:: MFX_EXTBUFF_UNIVERSAL_REFLIST_CTRL :project: oneVPL +.. doxygenenumvalue:: MFX_EXTBUFF_ENCODESTATS + :project: oneVPL + ---------------- ExtMemBufferType ---------------- @@ -1300,6 +1306,8 @@ Pictures) sequence. .. doxygenenumvalue:: MFX_GOP_STRICT :project: oneVPL +.. _gpu_copy: + ------- GPUCopy ------- @@ -1944,6 +1952,9 @@ PlatformCodeName .. doxygenenumvalue:: MFX_PLATFORM_ALDERLAKE_P :project: oneVPL +.. doxygenenumvalue:: MFX_PLATFORM_ALDERLAKE_N + :project: oneVPL + .. doxygenenumvalue:: MFX_PLATFORM_XEHP_SDV :project: oneVPL @@ -2448,3 +2459,29 @@ The AV1SegmentFeature enumerator indicates features enabled for the segment. .. doxygenenumvalue:: MFX_AV1_SEGMENT_FEATURE_GLOBALMV :project: oneVPL + +-------------------------- +mfxEncodeBlkStatsMemLayout +-------------------------- + +.. doxygenenum:: mfxEncodeBlkStatsMemLayout + :project: oneVPL + +------------------ +mfxEncodeStatsMode +------------------ + +.. doxygenenum:: mfxEncodeStatsMode + :project: oneVPL + +---------------- +EncodeStatsLevel +---------------- + +Flags to specify what statistics will be reported by the implementation. + +.. doxygenenumvalue:: MFX_ENCODESTATS_LEVEL_BLK + :project: oneVPL + +.. doxygenenumvalue:: MFX_ENCODESTATS_LEVEL_FRAME + :project: oneVPL diff --git a/source/elements/oneVPL/source/API_ref/VPL_structs_cross_component.rst b/source/elements/oneVPL/source/API_ref/VPL_structs_cross_component.rst index 093d02c869..b18efb6919 100644 --- a/source/elements/oneVPL/source/API_ref/VPL_structs_cross_component.rst +++ b/source/elements/oneVPL/source/API_ref/VPL_structs_cross_component.rst @@ -290,3 +290,27 @@ mfxExtAllocationHints :project: oneVPL :members: :protected-members: + +mfxRefInterface +--------------- +.. doxygenstruct:: mfxRefInterface + :project: oneVPL + :members: + :protected-members: + +mfxExtMasteringDisplayColourVolume +---------------------------------- + +.. doxygenstruct:: mfxExtMasteringDisplayColourVolume + :project: oneVPL + :members: + :protected-members: + + +mfxExtContentLightLevelInfo +--------------------------- + +.. doxygenstruct:: mfxExtContentLightLevelInfo + :project: oneVPL + :members: + :protected-members: diff --git a/source/elements/oneVPL/source/API_ref/VPL_structs_encode.rst b/source/elements/oneVPL/source/API_ref/VPL_structs_encode.rst index 6eb38140db..3b4c2311b2 100644 --- a/source/elements/oneVPL/source/API_ref/VPL_structs_encode.rst +++ b/source/elements/oneVPL/source/API_ref/VPL_structs_encode.rst @@ -177,14 +177,6 @@ mfxExtCodingOptionVPS :members: :protected-members: -mfxExtContentLightLevelInfo ---------------------------- - -.. doxygenstruct:: mfxExtContentLightLevelInfo - :project: oneVPL - :members: - :protected-members: - mfxExtDirtyRect --------------- @@ -258,14 +250,6 @@ mfxExtInsertHeaders :protected-members: :undoc-members: -mfxExtMasteringDisplayColourVolume ----------------------------------- - -.. doxygenstruct:: mfxExtMasteringDisplayColourVolume - :project: oneVPL - :members: - :protected-members: - mfxExtMBDisableSkipMap ---------------------- @@ -413,7 +397,7 @@ mfxExtAV1TileParam :project: oneVPL :members: :protected-members: - + mfxExtAV1Segmentation --------------------- @@ -421,4 +405,105 @@ mfxExtAV1Segmentation :project: oneVPL :members: :protected-members: - \ No newline at end of file + +mfxCTUHeader +------------ + +.. doxygenstruct:: mfxCTUHeader + :project: oneVPL + :members: + :protected-members: + +mfxCUInfo +--------- + +.. doxygenstruct:: mfxCUInfo + :project: oneVPL + :members: + :protected-members: + +mfxCTUInfo +---------- + +.. doxygenstruct:: mfxCTUInfo + :project: oneVPL + :members: + :protected-members: + +mfxMBInfo +--------- + +.. doxygenstruct:: mfxMBInfo + :project: oneVPL + :members: + :protected-members: + +mfxEncodeBlkStats +----------------- + +.. doxygenstruct:: mfxEncodeBlkStats + :project: oneVPL + :members: + :protected-members: + +mfxEncodeHighLevelStats +----------------------- + +.. doxygenstruct:: mfxEncodeHighLevelStats + :project: oneVPL + :members: + :protected-members: + +mfxEncodeFrameStats +------------------- + +.. doxygentypedef:: mfxEncodeFrameStats + :project: oneVPL + +mfxEncodeSliceStats +------------------- + +.. doxygenstruct:: mfxEncodeSliceStats + :project: oneVPL + :members: + :protected-members: + +mfxEncodeTileStats +------------------ + +.. doxygentypedef:: mfxEncodeTileStats + :project: oneVPL + +mfxEncodeStatsContainer +----------------------- + +.. doxygenstruct:: mfxEncodeStatsContainer + :project: oneVPL + :members: + :protected-members: + +mfxExtEncodeStatsOutput +----------------------- + +.. doxygenstruct:: mfxExtEncodeStatsOutput + :project: oneVPL + :members: + :protected-members: + +mfxExtHEVCRefListCtrl +--------------------- + +.. doxygentypedef:: mfxExtHEVCRefListCtrl + :project: oneVPL + +mfxExtHEVCRefLists +------------------ + +.. doxygentypedef:: mfxExtHEVCRefLists + :project: oneVPL + +mfxExtHEVCTemporalLayers +------------------------ + +.. doxygentypedef:: mfxExtHEVCTemporalLayers + :project: oneVPL diff --git a/source/elements/oneVPL/source/Experimental.rst b/source/elements/oneVPL/source/Experimental.rst index 4fef6ec5f4..52d9220528 100644 --- a/source/elements/oneVPL/source/Experimental.rst +++ b/source/elements/oneVPL/source/Experimental.rst @@ -36,13 +36,22 @@ The following is a list of experimental interfaces, starting from API version - * - :cpp:type:`mfxExtRefListCtrl` - 2.6 - - - - + - 2.7 + - Moved to production * - Extended enum for :cpp:member:`mfxExtDecodeErrorReport::ErrorTypes` - 2.6 - - - - + - 2.7 + - Moved to production * - :cpp:enumerator:`mfxHandleType::MFX_HANDLE_PXP_CONTEXT` - 2.6 + - 2.7 + - Moved to production + * - :cpp:struct:`mfxRefInterface` + - 2.7 - - + * - All definitions in mfxencodestats.h + - 2.7 + - + - + diff --git a/source/elements/oneVPL/source/VPL_change_log.rst b/source/elements/oneVPL/source/VPL_change_log.rst index 49474a7848..7eab2ab6f8 100644 --- a/source/elements/oneVPL/source/VPL_change_log.rst +++ b/source/elements/oneVPL/source/VPL_change_log.rst @@ -12,6 +12,35 @@ This section describes the API evolution from version to version. :local: :depth: 1 +----------- +Version 2.7 +----------- + +New in this release: + +* :cpp:member:`mfxExtVppAuxData::RepeatedFrame` flag is actual again and returned back from deprecation state. +* Clarified GPUCopy control behavior. +* Introduced MFX_FOURCC_XYUV FourCC for non-alpha packed 4:4:4 format. +* Notice added to the :cpp:member:`mfxFrameSurfaceInterface::OnComplete` to claify when + library can call this callback. +* New product names for platforms: + + * Code name Alder Lake N. + +* Annotated missed aliases :cpp:type:`mfxExtHEVCRefListCtrl`, :cpp:type:`mfxExtHEVCRefLists`, :cpp:type:`mfxExtHEVCTemporalLayers`. +* New dispatcher's config properties: + + * Pass through extension buffer to :cpp:struct:`mfxInitializationParam`. + * Select host or device responsible for the memory copy between host and device. + +* Refined description of struct `mfxExtMasteringDisplayColourVolume` and `mfxExtContentLightLevelInfo` for HDR SEI decoder usage. +* Experimental API: introduced interface to get statistics after encode. + +Bug Fixes: + +* Fixed missprint in the :cpp:struct:`mfxExtDeviceAffinityMask` description. +* MFXVideoENCODE_Query description fixed for query mode 1. + ----------- Version 2.6 ----------- diff --git a/source/elements/oneVPL/source/VPL_deprecation.rst b/source/elements/oneVPL/source/VPL_deprecation.rst index 0a975658f3..1a0c29192c 100644 --- a/source/elements/oneVPL/source/VPL_deprecation.rst +++ b/source/elements/oneVPL/source/VPL_deprecation.rst @@ -73,8 +73,3 @@ The following is a list of deprecated interfaces, starting from API version 2.0. - - Field is not filled by the library - No change - * - :cpp:member:`mfxExtVppAuxData::RepeatedFrame` - - 2.0 - - - - Field is not filled by the library - - No change diff --git a/source/elements/oneVPL/source/programming_guide/VPL_prg_session.rst b/source/elements/oneVPL/source/programming_guide/VPL_prg_session.rst index 9d4eb2fe51..ac50269ed0 100644 --- a/source/elements/oneVPL/source/programming_guide/VPL_prg_session.rst +++ b/source/elements/oneVPL/source/programming_guide/VPL_prg_session.rst @@ -162,7 +162,7 @@ will vary according to the OS. * On Windows, the dispatcher searches the following locations, in the specified order, to find the correct implementation library: - #. The :file:`Driver Store` directory for all available adapters. + #. The :file:`Driver Store` directory for all avialable adapters. All types of graphics drivers can install libraries in this directory. `Learn more about Driver Store `__. Applicable only for Intel implementations. #. The directory of the exe file of the current process. @@ -337,6 +337,11 @@ left to right from column to column and concatenate strings by using `.` (dot) a | | | .encoder | | | | | | .BiDirectionalPrediction | | | | +----------------------------+----------------------+---------------------------+ + | | | mfxImplDescription | MFX_VARIANT_TYPE_U16 | | + | | | .mfxEncoderDescription | | | + | | | .encoder | | | + | | | .ReportedStats | | | + | +----------------------------+----------------------+---------------------------+ | | | mfxImplDescription | MFX_VARIANT_TYPE_U32 | | | | | .mfxEncoderDescription | | | | | | .encoder | | | @@ -441,16 +446,26 @@ influence on the implementation selection. They are used during the .. list-table:: Dispatcher's Special Properties :header-rows: 1 - :widths: 50 50 + :widths: auto - * - **Property** + * - **Property Name** + - **Property Value** - **Value data type** - * - :cpp:enum:`mfxHandleType` + * - mfxHandleType + - :cpp:enum:`mfxHandleType` - :cpp:enumerator:`mfxVariantType::MFX_VARIANT_TYPE_U32` - * - :cpp:type:`mfxHDL` + * - mfxHDL + - :cpp:type:`mfxHDL` - :cpp:enumerator:`mfxVariantType::MFX_VARIANT_TYPE_PTR` - * - :cpp:type:`NumThread` + * - NumThread + - Unsigned fixed-point integer value - :cpp:enumerator:`mfxVariantType::MFX_VARIANT_TYPE_U32` + * - DeviceCopy + - :ref:`Device copy ` + - :cpp:enumerator:`mfxVariantType::MFX_VARIANT_TYPE_U16` + * - ExtBuffer + - Pointer to the extension buffer + - :cpp:enumerator:`mfxVariantType::MFX_VARIANT_TYPE_PTR` ------------------------------ oneVPL Dispatcher Interactions diff --git a/source/elements/oneVPL/source/snippets/prg_encoding.c b/source/elements/oneVPL/source/snippets/prg_encoding.c index c6286882e6..b1de95b9c7 100644 --- a/source/elements/oneVPL/source/snippets/prg_encoding.c +++ b/source/elements/oneVPL/source/snippets/prg_encoding.c @@ -443,5 +443,145 @@ for (;;) { /* close encoder */ MFXVideoENCODE_Close(session); +} /*end4*/ + +#include "mfxencodestats.h" + +static void AttachBuffer(mfxBitstream* bs, mfxExtEncodeStatsOutput* stats) +{ + UNUSED_PARAM(bs); + UNUSED_PARAM(stats); + return; +} + +static void prg_encoding5() { +/*beg5*/ +mfxExtEncodeStatsOutput stats; +stats.EncodeStatsFlags = MFX_ENCODESTATS_LEVEL_FRAME|MFX_ENCODESTATS_LEVEL_BLK; // or MFX_ENCODESTATS_LEVEL_DEFAULT can be used +AttachBuffer(bits, &stats); + +/* perform encoding and gathering stats. */ +sts = MFXVideoENCODE_EncodeFrameAsync(session, NULL, surface, bits, &syncp); +if (sts == MFX_ERR_NONE) { + /* to synchronize everything. */ + MFXVideoCORE_SyncOperation(session, syncp, INFINITE); + /* process stats */ + + /* release memory */ + stats.EncodeStatsContainer->RefInterface.Release(&stats.EncodeStatsContainer->RefInterface); + +} + +} +/*end5*/ + +static void prg_encoding6() { +/*beg6*/ +mfxExtEncodeStatsOutput stats_frame; +mfxExtEncodeStatsOutput stats_blk; +stats_frame.EncodeStatsFlags = MFX_ENCODESTATS_LEVEL_FRAME; +stats_blk.EncodeStatsFlags = MFX_ENCODESTATS_LEVEL_BLK; +AttachBuffer(bits, &stats_frame); +AttachBuffer(bits, &stats_blk); + +/* perform encoding and gathering stats. */ +sts = MFXVideoENCODE_EncodeFrameAsync(session, NULL, surface, bits, &syncp); + +if (MFX_ERR_NONE == sts) { + /* to synchronize bitstream. */ + stats_frame.EncodeStatsContainer->SynchronizeBitstream(&stats_frame.EncodeStatsContainer->RefInterface, INFINITE); + + /* to synchronize frame level statistics. */ + stats_frame.EncodeStatsContainer->SynchronizeStatistics(&stats_frame.EncodeStatsContainer->RefInterface, INFINITE); + + /* to synchronize block level statistics. */ + stats_blk.EncodeStatsContainer->SynchronizeStatistics(&stats_blk.EncodeStatsContainer->RefInterface, INFINITE); + + /* process stats */ + + stats_frame.EncodeStatsContainer->RefInterface.Release(&stats_frame.EncodeStatsContainer->RefInterface); + stats_blk.EncodeStatsContainer->RefInterface.Release(&stats_blk.EncodeStatsContainer->RefInterface); + +} + } +/*end6*/ + +static void prg_encoding7() { +/*beg7*/ +mfxExtEncodeStatsOutput stats; +stats.EncodeStatsFlags = MFX_ENCODESTATS_LEVEL_FRAME|MFX_ENCODESTATS_LEVEL_BLK; // or MFX_ENCODESTATS_LEVEL_DEFAULT can be used +AttachBuffer(bits, &stats); + +/* perform encoding and gathering stats. */ +sts = MFXVideoENCODE_EncodeFrameAsync(session, NULL, surface, bits, &syncp); +if (MFX_ERR_NONE == sts) { + /* to synchronize bitstream. */ + stats.EncodeStatsContainer->SynchronizeBitstream(&stats.EncodeStatsContainer->RefInterface, INFINITE); + + /* to synchronize frame and block level statistics. */ + stats.EncodeStatsContainer->SynchronizeStatistics(&stats.EncodeStatsContainer->RefInterface, INFINITE); + + /* process stats */ + + /* release memory */ + stats.EncodeStatsContainer->RefInterface.Release(&stats.EncodeStatsContainer->RefInterface); +} + +} +/*end7*/ + +#if defined(LINUX32) || defined(LINUX64) + +#include + +pthread_t pt[3]; + +static void* SynchronizeBitstream(void *args) +{ + mfxExtEncodeStats *stats = (mfxExtEncodeStatsOutput*)args; + stats->EncodeStatsContainer->SynchronizeBitstream(&stats->EncodeStatsContainer->RefInterface, INFINITE); + stats->EncodeStatsContainer->RefInterface.Release(&stats->EncodeStatsContainer->RefInterface); + pthread_exit(NULL); + return NULL; +} + +static void* SynchronizeStats(void *args) +{ + mfxExtEncodeStats *stats = (mfxExtEncodeStats*)args; + stats->EncodeStatsContainer->SynchronizeStatistics(&stats->EncodeStatsContainer->RefInterface, INFINITE); + stats->EncodeStatsContainer->RefInterface.Release(&stats->EncodeStatsContainer->RefInterface); + pthread_exit(NULL); + return NULL; +} + +static void prg_encoding8() { +/*beg8*/ +mfxExtEncodeStats stats_frame; +mfxExtEncodeStats stats_blk; +stats_frame.EncodeStatsFlags = MFX_ENCODESTATS_LEVEL_FRAME; +stats_blk.EncodeStatsFlags = MFX_ENCODESTATS_LEVEL_BLK; +AttachBuffer(bits, &stats_frame); +AttachBuffer(bits, &stats_blk); + +/* perform encoding and gathering stats. */ +MFXVideoENCODE_EncodeFrameAsync(session, NULL, surface, bits, &syncp); + +if (MFX_ERR_NONE) { + + /* thread to synchronize frame level statistics. */ + pthread_create(&(pt[0]), NULL, &SynchronizeStats, (void*)&stats_frame); + + /* thread to synchronize block level statistics. */ + pthread_create(&(pt[1]), NULL, &SynchronizeStats, (void*)&stats_blk); + + /* thread to synchronize bitstream. */ + pthread_create(&(pt[2]), NULL, &SynchronizeBitstream, (void*)stats_frame); + +} + +} +/*end8*/ +#endif +