feat(encode): native QSV backend — libvpl-sys + qsv.rs (Phases 0-3 of design/native-qsv-encoder.md)

Vendored MIT VPL dispatcher (static, trimmed tree, pin 674d015b/v2.17.0) built
via cmake+bindgen behind new feature 'qsv' (pf-encode + punktfunk-host forward).
qsv.rs: dispatcher session on the capture adapter (LUID-matched), SetHandle
D3D11, AsyncDepth=1/GopRefDist=1/VDEnc/CBR + HRD-off low-latency config,
GetSurfaceForEncode + GPU CopySubresourceRegion input (zero-copy, no readback
path), bounded sync-point poll, in-place reset with teardown escalation, no-IDR
bitrate retarget (Reset + StartNewSequence=OFF), 10-bit P010 HEVC-Main10/AV1,
HDR mastering/CLL SEI-OBU at IDR + BT.2020/PQ VSI, LTR-RFI via mfxExtRefListCtrl
(AMF slot policy port, Query-gated per codec, wire-index FrameOrder pinning).
Dispatch: native-first with ffmpeg fallback + PUNKTFUNK_QSV_FFMPEG hatch;
probes (can_encode_10bit / windows_codec_support / windows_backend_is_probed)
now answer natively for QSV.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 19:34:18 +02:00
parent bbe4380b41
commit 55e7f3fca9
88 changed files with 29515 additions and 16 deletions
+31
View File
@@ -0,0 +1,31 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFX_H__
#define __MFX_H__
#include "mfxdefs.h"
#include "mfxcommon.h"
#include "mfxstructures.h"
#include "mfxdispatcher.h"
#include "mfximplcaps.h"
#include "mfxsession.h"
#include "mfxvideo.h"
#include "mfxadapter.h"
#include "mfxbrc.h"
#include "mfxmvc.h"
#include "mfxpcp.h"
#include "mfxvp8.h"
#include "mfxjpeg.h"
#include "mfxsurfacepool.h"
#ifdef ONEVPL_EXPERIMENTAL
#include "mfxencodestats.h"
#endif
#endif /* __MFXDEFS_H__ */
+85
View File
@@ -0,0 +1,85 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#include "mfxdefs.h"
#ifndef __MFXADAPTER_H__
#define __MFXADAPTER_H__
#include "mfxstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*!
@brief
Returns a list of adapters that are suitable to handle workload @p input_info. The list is sorted in priority order, with iGPU given the highest precedence.
This rule may change in the future. If the @p input_info pointer is NULL, the list of all available adapters will be returned.
@param[in] input_info Pointer to workload description. See mfxComponentInfo description for details.
@param[out] adapters Pointer to output description of all suitable adapters for input workload. See mfxAdaptersInfo description for details.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_NULL_PTR
@p input_info or adapters pointer is NULL. \n
MFX_ERR_NOT_FOUND No suitable adapters found. \n
MFX_WRN_OUT_OF_RANGE Not enough memory to report back entire list of adapters. In this case as many adapters as possible will be returned.
@since This function is available since API version 1.31.
@deprecated Deprecated in API version 2.9. Use MFXEnumImplementations and MFXSetConfigFilterProperty to query adapter capabilities and
to select a suitable adapter for the input workload.
Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
*/
MFX_DEPRECATED mfxStatus MFX_CDECL MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapters);
/*!
@brief
Returns list of adapters that are suitable to decode the input bitstream. The list is sorted in priority order, with iGPU given the highest precedence. This rule may change in the future. This function is a simplification of MFXQueryAdapters, because bitstream is a description of the workload itself.
@param[in] bitstream Pointer to bitstream with input data.
@param[in] codec_id Codec ID to determine the type of codec for the input bitstream.
@param[out] adapters Pointer to the output list of adapters. Memory should be allocated by user. See mfxAdaptersInfo description for details.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_NULL_PTR bitstream or @p adapters pointer is NULL. \n
MFX_ERR_NOT_FOUND No suitable adapters found. \n
MFX_WRN_OUT_OF_RANGE Not enough memory to report back entire list of adapters. In this case as many adapters as possible will be returned.
@since This function is available since API version 1.31.
@deprecated Deprecated in API version 2.9. Use MFXEnumImplementations and MFXSetConfigFilterProperty to query adapter capabilities and
to select a suitable adapter for the input workload.
Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
*/
MFX_DEPRECATED mfxStatus MFX_CDECL MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAdaptersInfo* adapters);
/*!
@brief
Returns the number of detected graphics adapters. It can be used before calling MFXQueryAdapters to determine the size of input data that the user will need to allocate.
@param[out] num_adapters Pointer for the output number of detected graphics adapters.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_NULL_PTR num_adapters pointer is NULL.
@since This function is available since API version 1.31.
@deprecated Deprecated in API version 2.9. Use MFXEnumImplementations and MFXSetConfigFilterProperty to query adapter capabilities and
to select a suitable adapter for the input workload.
Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
*/
MFX_DEPRECATED mfxStatus MFX_CDECL MFXQueryAdaptersNumber(mfxU32* num_adapters);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __MFXADAPTER_H__
+175
View File
@@ -0,0 +1,175 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXBRC_H__
#define __MFXBRC_H__
#include "mfxstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*! See the mfxExtBRC structure for details. */
enum {
MFX_EXTBUFF_BRC = MFX_MAKEFOURCC('E','B','R','C')
};
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Describes frame parameters required for external BRC functions.
*/
typedef struct {
mfxU32 reserved[23];
mfxU16 SceneChange; /*!< Frame belongs to a new scene if non zero. */
mfxU16 LongTerm; /*!< Frame is a Long Term Reference frame if non zero. */
mfxU32 FrameCmplx; /*!< Frame Complexity Frame spatial complexity if non zero. Zero if complexity is not available. */
mfxU32 EncodedOrder; /*!< The frame number in a sequence of reordered frames starting from encoder Init. */
mfxU32 DisplayOrder; /*!< The frame number in a sequence of frames in display order starting from last IDR. */
mfxU32 CodedFrameSize; /*!< Size of the frame in bytes after encoding. */
mfxU16 FrameType; /*!< Frame type. See FrameType enumerator for possible values. */
mfxU16 PyramidLayer; /*!< B-pyramid or P-pyramid layer that the frame belongs to. */
mfxU16 NumRecode; /*!< Number of recodings performed for this frame. */
mfxU16 NumExtParam; /*!< Reserved for future use. */
mfxExtBuffer** ExtParam;/*!< Reserved for future use. */
} mfxBRCFrameParam;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Specifies controls for next frame encoding provided by external BRC functions.
*/
typedef struct {
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 reserved1[7];
mfxU32 MaxFrameSize; /*!< Max frame size in bytes. Option for repack feature. Driver calls PAK until current frame size is
less than or equal to MaxFrameSize, or number of repacking for this frame is equal to MaxNumRePak. Repack is available
if there is driver support, MaxFrameSize !=0, and MaxNumRePak != 0. Ignored if MaxNumRePak == 0. */
mfxU8 DeltaQP[8]; /*!< Option for repack feature. Ignored if MaxNumRePak == 0 or MaxNumRePak==0. If current
frame size > MaxFrameSize and/or number of repacking (nRepack) for this frame <= MaxNumRePak,
PAK is called with QP = mfxBRCFrameCtrl::QpY + Sum(DeltaQP[i]), where i = [0,nRepack].
Non zero DeltaQP[nRepack] are ignored if nRepack > MaxNumRePak.
If repacking feature is on ( MaxFrameSize & MaxNumRePak are not zero), it is calculated by the encoder. */
mfxU16 MaxNumRepak; /*!< Number of possible repacks in driver if current frame size > MaxFrameSize. Ignored if MaxFrameSize==0.
See MaxFrameSize description. Possible values are in the range of 0 to 8. */
mfxU16 NumExtParam; /*!< Reserved for future use. */
mfxExtBuffer** ExtParam; /*!< Reserved for future use. */
} mfxBRCFrameCtrl;
MFX_PACK_END()
/*! The BRCStatus enumerator itemizes instructions to the encoder by mfxExtBrc::Update. */
enum {
MFX_BRC_OK = 0, /*!< CodedFrameSize is acceptable, no further recoding/padding/skip required, proceed to next frame. */
MFX_BRC_BIG_FRAME = 1, /*!< Coded frame is too big, recoding required. */
MFX_BRC_SMALL_FRAME = 2, /*!< Coded frame is too small, recoding required. */
MFX_BRC_PANIC_BIG_FRAME = 3, /*!< Coded frame is too big, no further recoding possible - skip frame. */
MFX_BRC_PANIC_SMALL_FRAME = 4 /*!< Coded frame is too small, no further recoding possible - required padding to mfxBRCFrameStatus::MinFrameSize. */
};
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Specifies instructions for the encoder provided by external BRC after each frame encoding. See the BRCStatus enumerator for details.
*/
typedef struct {
mfxU32 MinFrameSize; /*!< Size in bytes, coded frame must be padded to when Status = MFX_BRC_PANIC_SMALL_FRAME. */
mfxU16 BRCStatus; /*!< BRC status. See the BRCStatus enumerator for possible values. */
mfxU16 reserved[25];
mfxHDL reserved1;
} mfxBRCFrameStatus;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Contains a set of callbacks to perform external bitrate control. Can be attached to the mfxVideoParam structure during
encoder initialization. Set the mfxExtCodingOption2::ExtBRC option to ON to make the encoder use the external BRC instead of the native one.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_BRC. */
mfxU32 reserved[14];
mfxHDL pthis; /*!< Pointer to the BRC object. */
/*!
@brief 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.
@param[in] pthis Pointer to the BRC object.
@param[in] par Pointer to the mfxVideoParam structure that was used for the encoder initialization.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_UNSUPPORTED The function detected unsupported video parameters.
*/
mfxStatus (MFX_CDECL *Init) (mfxHDL pthis, mfxVideoParam* par);
/*!
@brief Resets BRC session according to new parameters. It does not modify the input mfxVideoParam and attached structures. Invoked during MFXVideoENCODE_Reset.
@param[in] pthis Pointer to the BRC object.
@param[in] par Pointer to the mfxVideoParam structure that was used for the encoder initialization.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_UNSUPPORTED The function detected unsupported video parameters. \n
MFX_ERR_INCOMPATIBLE_VIDEO_PARAM The function detected that the video parameters provided by the application are incompatible with
initialization parameters. Reset requires additional memory allocation and cannot be executed.
*/
mfxStatus (MFX_CDECL *Reset) (mfxHDL pthis, mfxVideoParam* par);
/*!
@brief Deallocates any internal resources acquired in Init for this BRC session. Invoked during MFXVideoENCODE_Close.
@param[in] pthis Pointer to the BRC object.
@return
MFX_ERR_NONE The function completed successfully.
*/
mfxStatus (MFX_CDECL *Close) (mfxHDL pthis);
/*! @brief Returns controls (@p ctrl) to encode next frame based on info from input mfxBRCFrameParam structure (@p par) and
internal BRC state. Invoked asynchronously before each frame encoding or recoding.
@param[in] pthis Pointer to the BRC object.
@param[in] par Pointer to the mfxVideoParam structure that was used for the encoder initialization.
@param[out] ctrl Pointer to the output mfxBRCFrameCtrl structure.
@return
MFX_ERR_NONE The function completed successfully.
*/
mfxStatus (MFX_CDECL* GetFrameCtrl) (mfxHDL pthis, mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl);
/*!
@brief Updates internal BRC state and returns status to instruct encoder whether it should recode the previous frame,
skip the previous frame, do padding, or proceed to next frame based on info from input mfxBRCFrameParam and mfxBRCFrameCtrl structures.
Invoked asynchronously after each frame encoding or recoding.
@param[in] pthis Pointer to the BRC object.
@param[in] par Pointer to the mfxVideoParam structure that was used for the encoder initialization.
@param[in] ctrl Pointer to the output mfxBRCFrameCtrl structure.
@param[in] status Pointer to the output mfxBRCFrameStatus structure.
@return
MFX_ERR_NONE The function completed successfully.
*/
mfxStatus (MFX_CDECL* Update) (mfxHDL pthis, mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl, mfxBRCFrameStatus* status);
mfxHDL reserved1[10];
} mfxExtBRC;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif
+375
View File
@@ -0,0 +1,375 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXCAMERA_H__
#define __MFXCAMERA_H__
#include "mfxcommon.h"
#if !defined(__GNUC__)
#pragma warning(disable : 4201)
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*!
The ExtendedBufferID enumerator itemizes and defines identifiers (BufferId) for extended buffers in camera processing.
The application should attach these extended buffers to the mfxVideoParam structure to configure camera processing through VideoVPP functions.
And Implementation capabilities of camera processing features can be delivered by the function MFXQueryImplsDescription via VPP configuration
mfxVPPDescription.
*/
enum {
/*!
This extended buffer is mandatory for camera raw accelerator initialization. See the mfxExtCamPipeControl structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_PIPECONTROL = MFX_MAKEFOURCC('C', 'P', 'P', 'C'),
/*!
This extended buffer defines control parameters for the Camera White Balance filter algorithm. See mfxExtCamWhiteBalance structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_WHITE_BALANCE = MFX_MAKEFOURCC('C', 'W', 'B', 'L'),
/*!
This extended buffer defines control parameters for the Camera Hot Pixel Removal filter algorithm. See mfxExtCamHotPixelRemoval structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_HOT_PIXEL_REMOVAL = MFX_MAKEFOURCC('C', 'H', 'P', 'R'),
/*!
This extended buffer defines control parameters for the Camera Black Level Correction filter algorithm. See mfxExtCamBlackLevelCorrection structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_BLACK_LEVEL_CORRECTION = MFX_MAKEFOURCC('C', 'B', 'L', 'C'),
/*!
This extended buffer defines control parameters for the Camera Vignette Correction filter algorithm. See mfxCamVignetteCorrectionParam structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_VIGNETTE_CORRECTION = MFX_MAKEFOURCC('C', 'V', 'G', 'T'),
/*!
This extended buffer defines control parameters for the Camera Bayer Denoise filter algorithm. See mfxExtCamBayerDenoise structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_BAYER_DENOISE = MFX_MAKEFOURCC('C', 'D', 'N', 'S'),
/*!
This extended buffer defines control parameters for the Camera Color Correction filter algorithm. See mfxExtCamColorCorrection3x3 structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_COLOR_CORRECTION_3X3 = MFX_MAKEFOURCC('C', 'C', '3', '3'),
/*!
This extended buffer defines control parameters for the Camera Padding. See mfxExtCamPadding structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_PADDING = MFX_MAKEFOURCC('C', 'P', 'A', 'D'),
/*!
This extended buffer defines control parameters for the Camera Forward Gamma Correction filter algorithm. See mfxExtCamFwdGamma structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_FORWARD_GAMMA_CORRECTION =
MFX_MAKEFOURCC('C', 'F', 'G', 'C'),
/*!
This extended buffer defines control parameters for the Camera Lens Geometry Distortion and Chroma Aberration Correction filter algorithm. See mfxExtCamLensGeomDistCorrection structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION =
MFX_MAKEFOURCC('C', 'L', 'G', 'D'),
/*!
This extended buffer defines control parameters for the Camera 3DLUT filter algorithm. See mfxExtCam3DLut structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_3DLUT = MFX_MAKEFOURCC('C', 'L', 'U', 'T'),
/*!
This extended buffer defines control parameters for the Camera Total Color Control algorithm. See mfxExtCamTotalColorControl structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL = MFX_MAKEFOURCC('C', 'T', 'C', 'C'),
/*!
This extended buffer defines control parameters for the Camera YUV to RGB conversion algorithm. See mfxExtCamCscYuvRgb structure for details.
The application should attach this extended buffer to the mfxVideoParam structure to configure camera processing initialization.
*/
MFX_EXTBUF_CAM_CSC_YUV_RGB = MFX_MAKEFOURCC('C', 'C', 'Y', 'R')
};
/*!
A enumeration that defines white balance mode.
*/
typedef enum {
MFX_CAM_WHITE_BALANCE_MANUAL = 0x0001, /*!< White balance manual mode.*/
MFX_CAM_WHITE_BALANCE_AUTO = 0x0002 /*!< White balance auto mode.*/
} mfxCamWhiteBalanceMode;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera White Balance filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_WHITE_BALANCE. */
mfxU32 Mode; /*!< Specifies one of White Balance operation modes defined in enumeration mfxCamWhiteBalanceMode. */
mfxF64 R; /*!< White Balance Red correction.*/
mfxF64 G0; /*!< White Balance Green Top correction.*/
mfxF64 B; /*!< White Balance Blue correction.*/
mfxF64 G1; /*!< White Balance Green Bottom correction. */
mfxU32 reserved[8]; /*!< Reserved for future extension. */
} mfxExtCamWhiteBalance;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera Total Color Control filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL. */
mfxU16 R; /*!< Red element.*/
mfxU16 G; /*!< Green element.*/
mfxU16 B; /*!< Blue element.*/
mfxU16 C; /*!< Cyan element.*/
mfxU16 M; /*!< Magenta element.*/
mfxU16 Y; /*!< Yellow element.*/
mfxU16 reserved[6]; /*!< Reserved for future extension.*/
} mfxExtCamTotalColorControl;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera YUV to RGB format conversion.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_CSC_YUV_RGB. */
mfxF32 PreOffset[3]; /*!< Specifies offset for conversion from full range RGB input to limited range YUV for input color coordinate.*/
mfxF32 Matrix[3][3]; /*!< Specifies conversion matrix with CSC coefficients.*/
mfxF32 PostOffset[3]; /*!< Specifies offset for conversion from full range RGB input to limited range YUV for output color coordinate.*/
mfxU16 reserved[30]; /*!< Reserved for future extension.*/
} mfxExtCamCscYuvRgb;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera Hot Pixel Removal filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_HOT_PIXEL_REMOVAL. */
mfxU16 PixelThresholdDifference; /*!< Threshold for Hot Pixel difference. */
mfxU16 PixelCountThreshold; /*!< Count pixel detection.*/
mfxU16 reserved[32]; /*!< Reserved for future extension.*/
} mfxExtCamHotPixelRemoval;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
typedef struct {
/*!
A hint structure that configures Camera black level correction.
*/
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_BLACK_LEVEL_CORRECTION. */
mfxU16 R; /*!< Black Level Red correction.*/
mfxU16 G0; /*!< Black Level Green Top correction.*/
mfxU16 B; /*!< Black Level Blue correction.*/
mfxU16 G1; /*!< Black Level Green Bottom correction.*/
mfxU32 reserved[4]; /*!< Reserved for future extension.*/
} mfxExtCamBlackLevelCorrection;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A structure that defines Camera Vignette Correction Element.
*/
typedef struct {
mfxU8 integer; /*!< Integer part of correction element.*/
mfxU8 mantissa; /*!< Fractional part of correction element.*/
mfxU8 reserved[6]; /*!< Reserved for future extension.*/
} mfxCamVignetteCorrectionElement;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A structure that defines Camera Vignette Correction Parameters.
*/
typedef struct {
mfxCamVignetteCorrectionElement R; /*!< Red correction element.*/
mfxCamVignetteCorrectionElement G0; /*!< Green top correction element.*/
mfxCamVignetteCorrectionElement B; /*!< Blue Correction element.*/
mfxCamVignetteCorrectionElement G1; /*!< Green bottom correction element.*/
mfxU32 reserved[4]; /*!< Reserved for future extension.*/
} mfxCamVignetteCorrectionParam;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
A hint structure that configures Camera Vignette Correction filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_VIGNETTE_CORRECTION. */
mfxU32 Width; /*!< Width of Correction Map 2D buffer in mfxCamVignetteCorrectionParam elements. */
mfxU32 Height; /*!< Height of Correction Map 2D buffer in mfxCamVignetteCorrectionParam elements. */
mfxU32 Pitch; /*!< Pitch of Correction Map 2D buffer in mfxCamVignetteCorrectionParam elements. */
mfxU32 reserved[7]; /*!< Reserved for future extension.*/
union {
mfxCamVignetteCorrectionParam* CorrectionMap; /*!< 2D buffer of mfxCamVignetteCorrectionParam elements.*/
mfxU64 reserved1; /*!< Reserved for alignment on 32bit and 64bit.*/
};
} mfxExtCamVignetteCorrection;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera Bayer denoise filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_BAYER_DENOISE. */
mfxU16 Threshold; /*!< Level of denoise, legal values: [0:63].*/
mfxU16 reserved[27]; /*!< Reserved for future extension.*/
} mfxExtCamBayerDenoise;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
A hint structure that configures Camera Color correction filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_COLOR_CORRECTION_3X3. */
mfxF32 CCM[3][3]; /*!< 3x3 dimension matrix providing RGB Color Correction coefficients.*/
mfxU32 reserved[32]; /*!< Reserved for future extension.*/
} mfxExtCamColorCorrection3x3;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera Padding.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_PADDING. */
mfxU16 Top; /*!< Specify number of padded columns respectively. Currently only 8 pixels supported for all dimensions. */
mfxU16 Bottom; /*!< Specify number of padded columns respectively. Currently only 8 pixels supported for all dimensions. */
mfxU16 Left; /*!< Specify number of padded rows respectively. Currently only 8 pixels supported for all dimensions. */
mfxU16 Right; /*!< Specify number of padded rows respectively. Currently only 8 pixels supported for all dimensions. */
mfxU32 reserved[4]; /*!< Reserved for future extension.*/
} mfxExtCamPadding;
MFX_PACK_END()
/*!
A enumeration that defines Bayer mode.
*/
typedef enum {
/*!
Pixel Representation BG
GR.
*/
MFX_CAM_BAYER_BGGR = 0x0000,
/*!
Pixel Representation RG
GB.
*/
MFX_CAM_BAYER_RGGB = 0x0001,
/*!
Pixel Representation GB
RG.
*/
MFX_CAM_BAYER_GBRG = 0x0002,
/*!
Pixel Representation GR
BG.
*/
MFX_CAM_BAYER_GRBG = 0x0003
} mfxCamBayerFormat;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures camera pipe control.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_PIPECONTROL. */
mfxU16 RawFormat; /*!< Specifies one of the four Bayer patterns defined in mfxCamBayerFormat enumeration. */
mfxU16 reserved1; /*!< Reserved for future extension.*/
mfxU32 reserved[5]; /*!< Reserved for future extension.*/
} mfxExtCamPipeControl;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A structure that specifies forward gamma segment.
*/
typedef struct {
mfxU16 Pixel; /*!< Pixel value.*/
mfxU16 Red; /*!< Corrected Red value.*/
mfxU16 Green; /*!< Corrected Green value.*/
mfxU16 Blue; /*!< Corrected Blue value.*/
} mfxCamFwdGammaSegment;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
A hint structure that configures Camera Forward Gamma Correction filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_FORWARD_GAMMA_CORRECTION. */
mfxU16 reserved[19]; /*!< Reserved for future extension.*/
mfxU16 NumSegments; /*!< Number of Gamma segments.*/
union {
mfxCamFwdGammaSegment* Segment; /*!< Pointer to Gamma segments array.*/
mfxU64 reserved1; /*!< Reserved for future extension.*/
};
} mfxExtCamFwdGamma;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures Camera Lens Geometry Distortion and Chroma Aberration Correction filter.
*/
typedef struct {
mfxExtBuffer
Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION. */
mfxF32 a[3]; /*!< Polynomial coefficients a for R/G/B*/
mfxF32 b[3]; /*!< Polynomial coefficients b for R/G/B*/
mfxF32 c[3]; /*!< Polynomial coefficients c for R/G/B*/
mfxF32 d[3]; /*!< Polynomial coefficients d for R/G/B*/
mfxU16 reserved[36]; /*!< Reserved for future extension.*/
} mfxExtCamLensGeomDistCorrection;
MFX_PACK_END()
/*!
A enumeration that defines 3DLUT size.
*/
enum {
MFX_CAM_3DLUT17_SIZE = (17 * 17 * 17), /*!< 17^3 LUT size*/
MFX_CAM_3DLUT33_SIZE = (33 * 33 * 33), /*!< 33^3 LUT size*/
MFX_CAM_3DLUT65_SIZE = (65 * 65 * 65) /*!< 65^3 LUT size*/
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A structure that defines 3DLUT entry.
*/
typedef struct {
mfxU16 R; /*!< R channel*/
mfxU16 G; /*!< G channel*/
mfxU16 B; /*!< B channel*/
mfxU16 Reserved; /*!< Reserved for future extension.*/
} mfxCam3DLutEntry;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
A hint structure that configures Camera 3DLUT filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUF_CAM_3DLUT. */
mfxU16 reserved[10]; /*!< Reserved for future extension.*/
mfxU32 Size; /*!< LUT size, defined in MFX_CAM_3DLUT17/33/65_SIZE enumeration.*/
union {
mfxCam3DLutEntry* Table; /*!< Pointer to mfxCam3DLutEntry, size of each dimension depends on LUT size, e.g. LUT[17][17][17] for 17x17x17 look up table.*/
mfxU64 reserved1; /*!< Reserved for future extension.*/
};
} mfxExtCam3DLut;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __MFXCAMERA_H__
+740
View File
@@ -0,0 +1,740 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXCOMMON_H__
#define __MFXCOMMON_H__
#include "mfxdefs.h"
#if !defined (__GNUC__)
#pragma warning(disable: 4201)
#endif
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#define MFX_MAKEFOURCC(A,B,C,D) ((((int)A))+(((int)B)<<8)+(((int)C)<<16)+(((int)D)<<24))
/* Extended Configuration Header Structure */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The common header definition for external buffers and video
processing hints. */
typedef struct {
mfxU32 BufferId; /*!< Identifier of the buffer content. See the ExtendedBufferID enumerator for a complete list of extended buffers. */
mfxU32 BufferSz; /*!< Size of the buffer. */
} mfxExtBuffer;
MFX_PACK_END()
#define MFX_REFINTERFACE_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The structure represents 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()
/* 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.
@note This enumerator is for legacy dispatcher compatibility only. The new dispatcher does not use it.
*/
typedef mfxI32 mfxIMPL;
/*!
The application can use the macro MFX_IMPL_BASETYPE(x) to obtain the base implementation type.
*/
#define MFX_IMPL_BASETYPE(x) (0x00ff & (x))
enum {
MFX_IMPL_AUTO = 0x0000, /*!< Auto Selection/In or Not Supported/Out. */
MFX_IMPL_SOFTWARE = 0x0001, /*!< Pure software implementation. */
MFX_IMPL_HARDWARE = 0x0002, /*!< Hardware accelerated implementation (default device). */
MFX_IMPL_AUTO_ANY = 0x0003, /*!< Auto selection of any hardware/software implementation. */
MFX_IMPL_HARDWARE_ANY = 0x0004, /*!< Auto selection of any hardware implementation. */
MFX_IMPL_HARDWARE2 = 0x0005, /*!< Hardware accelerated implementation (2nd device). */
MFX_IMPL_HARDWARE3 = 0x0006, /*!< Hardware accelerated implementation (3rd device). */
MFX_IMPL_HARDWARE4 = 0x0007, /*!< Hardware accelerated implementation (4th device). */
MFX_IMPL_RUNTIME = 0x0008, /*!< This value cannot be used for session initialization. It may be returned by the MFXQueryIMPL
function to show that the session has been initialized in run-time mode. */
MFX_IMPL_VIA_ANY = 0x0100, /*!< Hardware acceleration can go through any supported OS infrastructure. This is the default value. The default value
is used by the legacy Intel(r) Media SDK if none of the MFX_IMPL_VIA_xxx flags are specified by the application. */
MFX_IMPL_VIA_D3D9 = 0x0200, /*!< Hardware acceleration goes through the Microsoft* Direct3D* 9 infrastructure. */
MFX_IMPL_VIA_D3D11 = 0x0300, /*!< Hardware acceleration goes through the Microsoft* Direct3D* 11 infrastructure. */
MFX_IMPL_VIA_VAAPI = 0x0400, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure. */
MFX_IMPL_VIA_HDDLUNITE = 0x0500, /*!< Hardware acceleration goes through the HDDL* Unite*. */
MFX_IMPL_UNSUPPORTED = 0x0000 /*!< One of the MFXQueryIMPL returns. */
};
/* Version Info */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The mfxVersion union describes the version of the implementation.*/
typedef union {
/*! @brief Structure with Major and Minor fields. */
/*! @struct Anonymous */
struct {
/*! @{
@name Major and Minor fields
Anonymous structure with Major and Minor fields.
*/
mfxU16 Minor; /*!< Minor number of the implementation. */
mfxU16 Major; /*!< Major number of the implementation. */
/*! @} */
};
mfxU32 Version; /*!< Implementation version number. */
} mfxVersion;
MFX_PACK_END()
/*! The mfxPriority enumerator describes the session priority. */
typedef enum
{
MFX_PRIORITY_LOW = 0, /*!< Low priority: the session operation halts when high priority tasks are executing and more than 75% of the CPU is being used for normal priority tasks.*/
MFX_PRIORITY_NORMAL = 1, /*!< Normal priority: the session operation is halted if there are high priority tasks.*/
MFX_PRIORITY_HIGH = 2 /*!< High priority: the session operation blocks other lower priority session operations.*/
} mfxPriority;
typedef struct _mfxEncryptedData mfxEncryptedData;
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*! Defines the buffer that holds compressed video data. */
typedef struct {
/*! @internal :unnamed(union) @endinternal */
union {
struct {
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. */
mfxU16 reserved1; /*!< Reserved for future use. */
mfxU32 CodecId; /*!< Specifies the codec format identifier in the FourCC code. See the CodecFormatFourCC enumerator for details. This optional parameter is required for the simplified decode initialization. */
};
mfxU32 reserved[6];
};
/*! 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 encoder from the presentation time stamp provided by the application in the mfxFrameSurface1 structure and
from the frame rate provided by the application during the encoder initialization. */
mfxI64 DecodeTimeStamp;
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. Output parameter. */
mfxU16 FrameType; /*!< Frame type of the picture in the bitstream. Output parameter. */
mfxU16 DataFlag; /*!< Indicates additional bitstream properties. See the BitstreamDataFlag enumerator for details. */
mfxU16 reserved2; /*!< Reserved for future use. */
} mfxBitstream;
MFX_PACK_END()
/*! Synchronization point object handle. */
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, /*!< 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.
Buffer caching usage decision is up to runtime to decide, for explicit hints please use MFX_GPUCOPY_SAFE or MFX_GPUCOPY_FAST */
MFX_GPUCOPY_OFF = 2, /*!< Disable GPU accelerated copying. */
MFX_GPUCOPY_SAFE = 3, /*!< The hint to disable buffer caching for GPU accelerated copying. Actual when GPU accelerated copying is supported by the library. */
#ifdef ONEVPL_EXPERIMENTAL
MFX_GPUCOPY_FAST = 4 /*!< The hint to enable buffer caching for GPU accelerated copying. Actual when GPU accelerated copying is supported by the library. */
#endif
};
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Specifies advanced initialization parameters.
A zero value in any of the fields indicates that the corresponding field
is not explicitly specified.
*/
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. */
/*! @internal :unnamed(union) @endinternal */
union {
struct {
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 reserved2[5];
};
mfxU16 GPUCopy; /*!< Enables or disables GPU accelerated copying between video and system memory in legacy Intel(r) Media SDK components. See the GPUCopy enumerator for a list of valid values. */
mfxU16 reserved[21];
} mfxInitParam;
MFX_PACK_END()
enum {
MFX_EXTBUFF_THREADS_PARAM = MFX_MAKEFOURCC('T','H','D','P') /*!< mfxExtThreadsParam buffer ID. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies options for threads created by this session. Attached to the
mfxInitParam structure during legacy Intel(r) Media SDK session initialization
or to mfxInitializationParam by the dispatcher in MFXCreateSession function. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_THREADS_PARAM. */
mfxU16 NumThread; /*!< The number of threads. */
mfxI32 SchedulingType; /*!< Scheduling policy for all threads.*/
mfxI32 Priority; /*!< Priority for all threads. */
mfxU16 reserved[55]; /*!< Reserved for future use. */
} mfxExtThreadsParam;
MFX_PACK_END()
/*! Deprecated. */
enum {
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_UNKNOWN) = 0, /*!< Unknown platform. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_SANDYBRIDGE) = 1, /*!< Intel(r) microarchitecture code name Sandy Bridge. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_IVYBRIDGE) = 2, /*!< Intel(r) microarchitecture code name Ivy Bridge. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_HASWELL) = 3, /*!< Code name Haswell. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_BAYTRAIL) = 4, /*!< Code name Bay Trail. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_BROADWELL) = 5, /*!< Intel(r) microarchitecture code name Broadwell. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_CHERRYTRAIL) = 6, /*!< Code name Cherry Trail. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_SKYLAKE) = 7, /*!< Intel(r) microarchitecture code name Skylake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_APOLLOLAKE) = 8, /*!< Code name Apollo Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_KABYLAKE) = 9, /*!< Code name Kaby Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_GEMINILAKE) = 10, /*!< Code name Gemini Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_COFFEELAKE) = 11, /*!< Code name Coffee Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_CANNONLAKE) = 20, /*!< Code name Cannon Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ICELAKE) = 30, /*!< Code name Ice Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_JASPERLAKE) = 32, /*!< Code name Jasper Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ELKHARTLAKE) = 33, /*!< Code name Elkhart Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_TIGERLAKE) = 40, /*!< Code name Tiger Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ROCKETLAKE) = 42, /*!< Code name Rocket Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ALDERLAKE_S) = 43, /*!< Code name Alder Lake S. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ALDERLAKE_P) = 44, /*!< Code name Alder Lake P. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ARCTICSOUND_P) = 45,
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_XEHP_SDV) = 45, /*!< Code name XeHP SDV. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_DG2) = 46, /*!< Code name DG2. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ATS_M) = 46, /*!< Code name ATS-M, same media functionality as DG2. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ALDERLAKE_N) = 55, /*!< Code name Alder Lake N. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_KEEMBAY) = 50, /*!< Code name Keem Bay. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_METEORLAKE) = 51, /*!< Code name Meteor Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_BATTLEMAGE) = 52, /*!< Code name Battlemage. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_LUNARLAKE) = 53, /*!< Code name Lunar Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_ARROWLAKE) = 54, /*!< Code name Arrow Lake. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLATFORM_MAXIMUM) = 65535, /*!< General code name. */
};
/*! The mfxMediaAdapterType enumerator itemizes types of graphics adapters. */
typedef enum
{
MFX_MEDIA_UNKNOWN = 0xffff, /*!< Unknown type. */
MFX_MEDIA_INTEGRATED = 0, /*!< Integrated graphics adapter. */
MFX_MEDIA_DISCRETE = 1 /*!< Discrete graphics adapter. */
} mfxMediaAdapterType;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Contains information about hardware platform for the Legacy mode. */
typedef struct {
MFX_DEPRECATED mfxU16 CodeName; /*!< Deprecated. */
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. */
} mfxPlatform;
MFX_PACK_END()
/*! The mfxResourceType enumerator specifies types of different native data frames and buffers. */
typedef enum {
MFX_RESOURCE_SYSTEM_SURFACE = 1, /*!< System memory. */
MFX_RESOURCE_VA_SURFACE_PTR = 2, /*!< Pointer to VA surface index. */
MFX_RESOURCE_VA_SURFACE = MFX_RESOURCE_VA_SURFACE_PTR, /*!< Pointer to VA surface index. */
MFX_RESOURCE_VA_BUFFER_PTR = 3, /*!< Pointer to VA buffer index. */
MFX_RESOURCE_VA_BUFFER = MFX_RESOURCE_VA_BUFFER_PTR, /*!< Pointer to VA buffer index. */
MFX_RESOURCE_DX9_SURFACE = 4, /*!< Pointer to IDirect3DSurface9. */
MFX_RESOURCE_DX11_TEXTURE = 5, /*!< Pointer to ID3D11Texture2D. */
MFX_RESOURCE_DX12_RESOURCE = 6, /*!< Pointer to ID3D12Resource. */
MFX_RESOURCE_DMA_RESOURCE = 7, /*!< DMA resource. */
MFX_RESOURCE_HDDLUNITE_REMOTE_MEMORY = 8, /*!< HDDL Unite Remote memory handle. */
} mfxResourceType;
/*! Maximum allowed length of the implementation name. */
#define MFX_IMPL_NAME_LEN 32
/*! Maximum allowed length of the implementation name. */
#define MFX_STRFIELD_LEN 128
#ifdef ONEVPL_EXPERIMENTAL
#define MFX_DECEXTDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxDecExtDescription structure represents the extended description of a decoder. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[14]; /*!< Reserved for future use. */
mfxU16 NumExtBufferIDs; /*!< Number of supported extended buffer IDs. */
mfxU32* ExtBufferIDs; /*!< Pointer to the array of supported extended buffer IDs. */
} mfxDecExtDescription;
MFX_PACK_END()
#define MFX_DECMEMEXTDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxDecMemExtDescription structure represents the extended description for decoder memory. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[13]; /*!< Reserved for future use. */
mfxU16 MaxBitDepth; /*!< Maximum supported bit depth. */
mfxU16 NumChromaSubsamplings; /*!< Number of supported output chroma subsamplings. */
mfxU16* ChromaSubsamplings; /*!< Pointer to the array of supported output chroma subsamplings. */
} mfxDecMemExtDescription;
MFX_PACK_END()
#endif
#ifdef ONEVPL_EXPERIMENTAL
#define MFX_DECODERDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 1)
#else
#define MFX_DECODERDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
#endif
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxDecoderDescription structure represents the description of a decoder. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumCodecs; /*!< Number of supported decoders. */
/*! This structure represents the decoder description. */
struct decoder {
mfxU32 CodecID; /*!< Decoder ID in FourCC format. */
#ifdef ONEVPL_EXPERIMENTAL
mfxU16 reserved[2]; /*!< Reserved for future use. */
union {
mfxDecExtDescription* DecExtDesc; /*!< Pointer to the extended descriptions of the decoder. */
mfxU16 reserved2[4]; /*!< Reserved for future use. */
};
mfxU16 reserved3[2]; /*!< Reserved for future use. */
#else
mfxU16 reserved[8]; /*!< Reserved for future use. */
#endif
mfxU16 MaxcodecLevel; /*!< Maximum supported codec level. See the CodecProfile enumerator for possible values. */
mfxU16 NumProfiles; /*!< Number of supported profiles. */
/*! This structure represents the codec profile description. */
struct decprofile {
mfxU32 Profile; /*!< Profile ID. See the CodecProfile enumerator for possible values.*/
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumMemTypes; /*!< Number of supported memory types. */
/*! This structure represents the underlying details of the memory type. */
struct decmemdesc {
mfxResourceType MemHandleType; /*!< Memory handle type. */
mfxRange32U Width; /*!< Range of supported image widths. */
mfxRange32U Height; /*!< Range of supported image heights. */
#ifdef ONEVPL_EXPERIMENTAL
mfxU16 reserved[2]; /*!< Reserved for future use. */
union {
mfxDecMemExtDescription* MemExtDesc; /*!< Pointer to the extended descriptions for decoder memory. */
mfxU16 reserved2[4]; /*!< Reserved for future use. */
};
mfxU16 reserved3; /*!< Reserved for future use. */
#else
mfxU16 reserved[7]; /*!< Reserved for future use. */
#endif
mfxU16 NumColorFormats; /*!< Number of supported output color formats. */
mfxU32* ColorFormats; /*!< Pointer to the array of supported output color formats (in FOURCC). */
} * MemDesc; /*!< Pointer to the array of memory types. */
} * Profiles; /*!< Pointer to the array of profiles supported by the codec. */
} * Codecs; /*!< Pointer to the array of decoders. */
} mfxDecoderDescription;
MFX_PACK_END()
#ifdef ONEVPL_EXPERIMENTAL
#define MFX_ENCEXTDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxEncExtDescription structure represents the extended description of an encoder. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[10]; /*!< Reserved for future use. */
mfxU16 NumRateControlMethods; /*!< Number of supported bitrate control methods. */
mfxU16* RateControlMethods; /*!< Pointer to the array of supported bitrate control methods. */
mfxU16 reserved2[11]; /*!< Reserved for future use. */
mfxU16 NumExtBufferIDs; /*!< Number of supported extended buffer IDs. */
mfxU32* ExtBufferIDs; /*!< Pointer to the array of supported extended buffer IDs. */
} mfxEncExtDescription;
MFX_PACK_END()
#define MFX_ENCMEMEXTDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxEncMemExtDescription structure represents the extended description for encoder memory. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[13]; /*!< Reserved for future use. */
mfxU16 TargetMaxBitDepth; /*!< Maximum supported bit depth. */
mfxU16 NumTargetChromaSubsamplings; /*!< Number of supported target chroma subsamplings. */
mfxU16* TargetChromaSubsamplings; /*!< Pointer to the array of supported target chroma subsamplings. */
} mfxEncMemExtDescription;
MFX_PACK_END()
#endif
#ifdef ONEVPL_EXPERIMENTAL
#define MFX_ENCODERDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 1)
#else
#define MFX_ENCODERDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
#endif
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents an encoder description. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumCodecs; /*!< Number of supported encoders. */
/*! This structure represents encoder description. */
struct encoder {
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
union {
mfxEncExtDescription* EncExtDesc; /*!< Pointer to the extended descriptions of the encoder. */
mfxU16 reserved2[4]; /*!< Reserved for future use. */
};
mfxU16 reserved[3]; /*!< 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 {
mfxU32 Profile; /*!< Profile ID. See the CodecProfile enumerator for possible values.*/
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumMemTypes; /*!< Number of supported memory types. */
/*! This structure represents the underlying details of the memory type. */
struct encmemdesc {
mfxResourceType MemHandleType; /*!< Memory handle type. */
mfxRange32U Width; /*!< Range of supported image widths. */
mfxRange32U Height; /*!< Range of supported image heights. */
#ifdef ONEVPL_EXPERIMENTAL
mfxU16 reserved[2]; /*!< Reserved for future use. */
union {
mfxEncMemExtDescription* MemExtDesc; /*!< Pointer to the extended descriptions for encoder memory. */
mfxU16 reserved2[4]; /*!< Reserved for future use. */
};
mfxU16 reserved3; /*!< Reserved for future use. */
#else
mfxU16 reserved[7]; /*!< Reserved for future use. */
#endif
mfxU16 NumColorFormats; /*!< Number of supported input color formats. */
mfxU32* ColorFormats; /*!< Pointer to the array of supported input color formats (in FOURCC). */
} * MemDesc; /*!< Pointer to the array of memory types. */
} * Profiles; /*!< Pointer to the array of profiles supported by the codec. */
} * Codecs; /*!< Pointer to the array of encoders. */
} mfxEncoderDescription;
MFX_PACK_END()
#define MFX_VPPDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents VPP description. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumFilters; /*!< Number of supported VPP filters. */
/*! This structure represents the VPP filters description. */
struct filter {
mfxU32 FilterFourCC; /*!< Filter ID in FourCC format. */
mfxU16 MaxDelayInFrames; /*!< Introduced output delay in frames. */
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumMemTypes; /*!< Number of supported memory types. */
/*! This structure represents the underlying details of the memory type. */
struct memdesc {
mfxResourceType MemHandleType; /*!< Memory handle type. */
mfxRange32U Width; /*!< Range of supported image widths. */
mfxRange32U Height; /*!< Range of supported image heights. */
mfxU16 reserved[7]; /*!< Reserved for future use. */
mfxU16 NumInFormats; /*!< Number of supported input color formats. */
/*! This structure represents the input color format description. */
struct format {
mfxU32 InFormat; /*!< Input color in FourCC format. */
mfxU16 reserved[5]; /*!< Reserved for future use. */
mfxU16 NumOutFormat; /*!< Number of supported output color formats. */
mfxU32* OutFormats; /*!< Pointer to the array of supported output color formats (in FOURCC). */
} * Formats; /*!< Pointer to the array of supported formats. */
} * MemDesc; /*!< Pointer to the array of memory types. */
} * Filters; /*!< Pointer to the array of supported filters. */
} mfxVPPDescription;
MFX_PACK_END()
/*! The current version of mfxDeviceDescription structure. */
#define MFX_DEVICEDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 1)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents device description. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[6]; /*!< reserved for future use. */
mfxU16 MediaAdapterType; /*!< Graphics adapter type. See the mfxMediaAdapterType enumerator for a list of possible values. */
mfxChar DeviceID[MFX_STRFIELD_LEN]; /*!< Null terminated string with device ID. */
mfxU16 NumSubDevices; /*!< Number of available uniform sub-devices. Pure software implementation can report 0. */
/*! This structure represents sub-device description. */
struct subdevices {
mfxU32 Index; /*!< Index of the sub-device, started from 0 and increased by 1.*/
mfxChar SubDeviceID[MFX_STRFIELD_LEN]; /*!< Null terminated string with unique sub-device ID, mapped to the system ID. */
mfxU32 reserved[7]; /*!< reserved for future use. */
} * SubDevices; /*!< Pointer to the array of available sub-devices. */
} mfxDeviceDescription;
MFX_PACK_END()
/*! This enum itemizes implementation type. */
typedef enum {
MFX_IMPL_TYPE_SOFTWARE = 0x0001, /*!< Pure Software Implementation. */
MFX_IMPL_TYPE_HARDWARE = 0x0002, /*!< Hardware Accelerated Implementation. */
} mfxImplType;
/*! This enum itemizes hardware acceleration stack to use. */
typedef enum {
MFX_ACCEL_MODE_NA = 0, /*!< Hardware acceleration is not applicable. */
MFX_ACCEL_MODE_VIA_D3D9 = 0x0200, /*!< Hardware acceleration goes through the Microsoft* Direct3D9* infrastructure. */
MFX_ACCEL_MODE_VIA_D3D11 = 0x0300, /*!< Hardware acceleration goes through the Microsoft* Direct3D11* infrastructure. */
MFX_ACCEL_MODE_VIA_VAAPI = 0x0400, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure. */
MFX_ACCEL_MODE_VIA_VAAPI_DRM_RENDER_NODE
= MFX_ACCEL_MODE_VIA_VAAPI, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure with DRM RENDER MODE as default acceleration access point. */
MFX_ACCEL_MODE_VIA_VAAPI_DRM_MODESET = 0x0401, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure with DRM MODESET as default acceleration access point. */
MFX_ACCEL_MODE_VIA_VAAPI_GLX = 0x0402, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure with OpenGL Extension to the X Window System
as default acceleration access point. */
MFX_ACCEL_MODE_VIA_VAAPI_X11 = 0x0403, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure with X11 as default acceleration access point. */
MFX_ACCEL_MODE_VIA_VAAPI_WAYLAND = 0x0404, /*!< Hardware acceleration goes through the Linux* VA-API infrastructure with Wayland as default acceleration access point. */
MFX_ACCEL_MODE_VIA_HDDLUNITE = 0x0500, /*!< Hardware acceleration goes through the HDDL* Unite*. */
} mfxAccelerationMode;
#define MFX_ACCELERATIONMODESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents acceleration modes description. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[2]; /*!< reserved for future use. */
mfxU16 NumAccelerationModes; /*!< Number of supported acceleration modes. */
mfxAccelerationMode* Mode; /*!< Pointer to the array of supported acceleration modes. */
} mfxAccelerationModeDescription;
MFX_PACK_END()
/*! Specifies the surface pool allocation policies. */
typedef enum {
/*! Recommends to limit max pool size by sum of requested surfaces asked by components. */
MFX_ALLOCATION_OPTIMAL = 0,
/*! Dynamic allocation with no limit. */
MFX_ALLOCATION_UNLIMITED = 1,
/*! Max pool size is limited by NumberToPreAllocate + DeltaToAllocateOnTheFly. */
MFX_ALLOCATION_LIMITED = 2,
} mfxPoolAllocationPolicy;
/*! The current version of mfxPoolPolicyDescription structure. */
#define MFX_POOLPOLICYDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents pool policy description. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 reserved[2]; /*!< reserved for future use. */
mfxU16 NumPoolPolicies; /*!< Number of supported pool policies. */
mfxPoolAllocationPolicy* Policy; /*!< Pointer to the array of supported pool policies. */
} mfxPoolPolicyDescription;
MFX_PACK_END()
/*! The current version of mfxImplDescription structure. */
#define MFX_IMPLDESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 2)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents the implementation description. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxImplType Impl; /*!< Impl type: software/hardware. */
mfxAccelerationMode AccelerationMode; /*!< Default Hardware acceleration stack to use. OS dependent parameter. Use VA for Linux* and DX* for Windows*. */
mfxVersion ApiVersion; /*!< Supported API version. */
mfxChar ImplName[MFX_IMPL_NAME_LEN]; /*!< Null-terminated string with implementation name given by vendor. */
mfxChar License[MFX_STRFIELD_LEN]; /*!< Null-terminated string with comma-separated list of license names of the implementation. */
mfxChar Keywords[MFX_STRFIELD_LEN]; /*!< Null-terminated string with comma-separated list of keywords specific to this implementation that dispatcher can search for. */
mfxU32 VendorID; /*!< Standard vendor ID 0x8086 - Intel. */
mfxU32 VendorImplID; /*!< Vendor specific number with given implementation ID. */
mfxDeviceDescription Dev; /*!< Supported device. */
mfxDecoderDescription Dec; /*!< Decoder configuration. */
mfxEncoderDescription Enc; /*!< Encoder configuration. */
mfxVPPDescription VPP; /*!< VPP configuration. */
union
{
mfxAccelerationModeDescription AccelerationModeDescription; /*!< Supported acceleration modes. */
mfxU32 reserved3[4];
};
mfxPoolPolicyDescription PoolPolicies; /*!< Supported surface pool polices. */
mfxU32 reserved[8]; /*!< Reserved for future use. */
mfxU32 NumExtParam; /*!< Number of extension buffers. Reserved for future use. Must be 0. */
union {
mfxExtBuffer **ExtParam; /*!< Array of extension buffers. */
mfxU64 Reserved2; /*!< Reserved for future use. */
} ExtParams; /*!< Extension buffers. Reserved for future. */
} mfxImplDescription;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure represents the list of names of implemented functions. */
typedef struct {
mfxU16 NumFunctions; /*!< Number of function names in the FunctionsName array. */
mfxChar** FunctionsName; /*!< Array of the null-terminated strings. Each string contains name of the implemented function. */
} mfxImplementedFunctions;
MFX_PACK_END()
#define MFX_EXTENDEDDEVICEID_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies various physical device properties for device matching and identification outside of oneAPI Video Processing Library (oneVPL). */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 VendorID; /*!< PCI vendor ID. */
mfxU16 DeviceID; /*!< PCI device ID. */
mfxU32 PCIDomain; /*!< PCI bus domain. Equals to '0' if OS doesn't support it or
has sequential numbering of buses across domains. */
mfxU32 PCIBus; /*!< The number of the bus that the physical device is located on. */
mfxU32 PCIDevice; /*!< The index of the physical device on the bus. */
mfxU32 PCIFunction; /*!< The function number of the device on the physical device. */
mfxU8 DeviceLUID[8]; /*!< LUID of DXGI adapter. */
mfxU32 LUIDDeviceNodeMask; /*!< Bitfield identifying the node within a linked
device adapter corresponding to the device. */
mfxU32 LUIDValid; /*!< Boolean value that will be 1 if DeviceLUID contains a valid LUID
and LUIDDeviceNodeMask contains a valid node mask,
and 0 if they do not. */
mfxU32 DRMRenderNodeNum; /*!< Number of the DRM render node from the path /dev/dri/RenderD\<num\>.
Value equals to 0 means that this field doesn't contain valid DRM Render
Node number.*/
mfxU32 DRMPrimaryNodeNum; /*!< Number of the DRM primary node from the path /dev/dri/card\<num\>.
Value equals to 0x7FFFFFFF means that this field doesn't contain valid DRM Primary
Node number.*/
mfxU16 RevisionID; /*!< PCI revision ID. The value contains microarchitecture version. */
mfxU8 reserved1[18]; /*!< Reserved for future use. */
mfxChar DeviceName[MFX_STRFIELD_LEN]; /*!< Null-terminated string in utf-8 with the name of the device. */
} mfxExtendedDeviceId;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Cross domain structure to define device UUID. It is defined here to check backward compatibility.*/
typedef struct {
mfxU16 vendor_id; /*!< PCI vendor ID. Same as mfxExtendedDeviceId::VendorID. */
mfxU16 device_id; /*!< PCI device ID. Same as mfxExtendedDeviceId::DeviceID. */
mfxU16 revision_id; /*!< PCI revision ID. Same as mfxExtendedDeviceId::RevisionID. */
mfxU16 pci_domain; /*!< PCI bus domain. Same as mfxExtendedDeviceId::PCIDomain. */
mfxU8 pci_bus; /*!< The number of the bus that the physical device is located on. Same as mfxExtendedDeviceId::PCIBus. */
mfxU8 pci_dev; /*!< The index of the physical device on the bus. Same as mfxExtendedDeviceId::PCIDevice. */
mfxU8 pci_func; /*!< The function number of the device on the physical device. Same as mfxExtendedDeviceId::PCIFunction. */
mfxU8 reserved[4]; /*!< Reserved for future use. */
mfxU8 sub_device_id; /*!< SubDevice ID.*/
} extDeviceUUID;
MFX_PACK_END()
/*! The mfxImplCapsDeliveryFormat enumerator specifies delivery format of the implementation capability. */
typedef enum {
MFX_IMPLCAPS_IMPLDESCSTRUCTURE = 1, /*!< Deliver capabilities as mfxImplDescription structure. */
MFX_IMPLCAPS_IMPLEMENTEDFUNCTIONS = 2, /*!< Deliver capabilities as mfxImplementedFunctions structure. */
MFX_IMPLCAPS_IMPLPATH = 3, /*!< Deliver pointer to the null-terminated string with the path to the
implementation. String is delivered in a form of buffer of
mfxChar type. */
MFX_IMPLCAPS_DEVICE_ID_EXTENDED = 4, /*!< Deliver extended device ID information as mfxExtendedDeviceId
structure.*/
#ifdef ONEVPL_EXPERIMENTAL
MFX_IMPLCAPS_SURFACE_TYPES = 5, /*!< Deliver capabilities as mfxSurfaceTypesSupported structure. */
#endif
} mfxImplCapsDeliveryFormat;
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Specifies initialization parameters for API version starting from 2.0.
*/
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. */
#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()
#ifdef ONEVPL_EXPERIMENTAL
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Represents a name/value pair to indicate requested properties. For use with MFXQueryImplsProperties() */
typedef struct {
mfxU8* PropName; /*!< Property name string to indicate the requested Property. */
mfxVariant PropVar; /*!< Property value corresponding to the property name. */
} mfxQueryProperty;
MFX_PACK_END()
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
+349
View File
@@ -0,0 +1,349 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXDEFS_H__
#define __MFXDEFS_H__
#define MFX_VERSION_MAJOR 2
#define MFX_VERSION_MINOR 17
// 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
#if !defined(MFX_VERSION)
#define MFX_VERSION (MFX_VERSION_MAJOR * 1000 + MFX_VERSION_MINOR)
#else
#undef MFX_VERSION_MAJOR
#define MFX_VERSION_MAJOR ((MFX_VERSION) / 1000)
#undef MFX_VERSION_MINOR
#define MFX_VERSION_MINOR ((MFX_VERSION) % 1000)
#endif
/*! The corresponding version of the Intel(r) Media SDK legacy API that is used as a basis
for the current API. */
#define MFX_LEGACY_VERSION 1035
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* In preprocessor syntax # symbol has stringize meaning,
so to expand some macro to preprocessor pragma we need to use
special compiler dependent construction */
#if defined(_MSC_VER)
#define MFX_PRAGMA_IMPL(x) __pragma(x)
#else
#define MFX_PRAGMA_IMPL(x) _Pragma(#x)
#endif
#define MFX_PACK_BEGIN_X(x) MFX_PRAGMA_IMPL(pack(push, x))
#define MFX_PACK_END() MFX_PRAGMA_IMPL(pack(pop))
/* The general rule for alignment is following:
- structures with pointers have 4/8 bytes alignment on 32/64 bit systems
- structures with fields of type mfxU64/mfxF64 (unsigned long long / double)
have alignment 8 bytes on 64 bit and 32 bit Windows, on Linux alignment is 4 bytes
- all the rest structures are 4 bytes aligned
- there are several exceptions: some structs which had 4-byte alignment were extended
with pointer / long type fields; such structs have 4-byte alignment to keep binary
compatibility with previously release API */
#define MFX_PACK_BEGIN_USUAL_STRUCT() MFX_PACK_BEGIN_X(4)
/* 64-bit LP64 data model */
#if defined(_WIN64) || defined(__LP64__)
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(8)
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
/* 32-bit ILP32 data model Windows* (Intel(r) architecture) */
#elif defined(_WIN32) || defined(_M_IX86) && !defined(__linux__)
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4)
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
/* 32-bit ILP32 data model Linux* */
#elif defined(__ILP32__) || defined(__arm__)
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4)
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(4)
#else
#error Unknown packing
#endif
#ifdef _WIN32
#define MFX_CDECL __cdecl
#define MFX_STDCALL __stdcall
#else
#define MFX_CDECL
#define MFX_STDCALL
#endif /* _WIN32 */
#define MFX_INFINITE 0xFFFFFFFF
#ifndef MFX_DEPRECATED_OFF
#if defined(__cplusplus) && __cplusplus >= 201402L
#define MFX_DEPRECATED [[deprecated]]
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg [[deprecated]]
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#elif defined(__clang__)
#define MFX_DEPRECATED __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#elif defined(__INTEL_COMPILER)
#if (defined(_WIN32) || defined(_WIN64))
#define MFX_DEPRECATED __declspec(deprecated)
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
#elif defined(__linux__)
#define MFX_DEPRECATED __attribute__((deprecated))
#if defined(__cplusplus)
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
#else
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#endif
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#endif
#elif defined(_MSC_VER) && _MSC_VER > 1200 // VS 6 doesn't support deprecation
#define MFX_DEPRECATED __declspec(deprecated)
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
#elif defined(__GNUC__)
#define MFX_DEPRECATED __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#else
#define MFX_DEPRECATED
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#endif
#else
#define MFX_DEPRECATED
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#endif
typedef unsigned char mfxU8; /*!< Unsigned integer, 8 bit type. */
typedef char mfxI8; /*!< Signed integer, 8 bit type. */
typedef short mfxI16; /*!< Signed integer, 16 bit type. */
typedef unsigned short mfxU16; /*!< Unsigned integer, 16 bit type. */
typedef unsigned int mfxU32; /*!< Unsigned integer, 32 bit type. */
typedef int mfxI32; /*!< Signed integer, 32 bit type. */
#if defined( _WIN32 ) || defined ( _WIN64 )
typedef unsigned long mfxUL32; /*!< Unsigned integer, 32 bit type. */
typedef long mfxL32; /*!< Signed integer, 32 bit type. */
#else
typedef unsigned int mfxUL32; /*!< Unsigned integer, 32 bit type. */
typedef int mfxL32; /*!< Signed integer, 32 bit type. */
#endif
typedef float mfxF32; /*!< Single-precision floating point, 32 bit type. */
typedef double mfxF64; /*!< Double-precision floating point, 64 bit type. */
typedef unsigned long long mfxU64; /*!< Unsigned integer, 64 bit type. */
typedef long long mfxI64; /*!< Signed integer, 64 bit type. */
typedef void* mfxHDL; /*!< Handle type. */
typedef mfxHDL mfxMemId; /*!< Memory ID type. */
typedef void* mfxThreadTask; /*!< Thread task type. */
typedef char mfxChar; /*!< UTF-8 byte. */
typedef unsigned short mfxFP16; /*!< Half precision floating point, 16 bit type. */
/* MFX structures version info */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Introduce the field Version for any structure.
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}.
*/
typedef union {
/*! Structure with Major and Minor fields. */
/*! @struct Anonymous */
struct {
/*! @{
@name Major and Minor fields
Anonymous structure with Major and Minor fields. Minor number is incremented when reserved fields are used. Major number is incremented when the size of structure is increased. */
mfxU8 Minor; /*!< Minor number of the correspondent structure. */
mfxU8 Major; /*!< Major number of the correspondent structure. */
/*! @} */
};
mfxU16 Version; /*!< Structure version number. */
} mfxStructVersion;
MFX_PACK_END()
#define MFX_STRUCT_VERSION(MAJOR, MINOR) (256*(MAJOR) + (MINOR))
#define MFX_VARIANT_VERSION MFX_STRUCT_VERSION(1, 1)
/*! The mfxDataType enumerates data type for mfxDataType. */
typedef enum {
MFX_DATA_TYPE_UNSET = 0, /*!< Undefined type. */
MFX_DATA_TYPE_U8, /*!< 8-bit unsigned integer. */
MFX_DATA_TYPE_I8, /*!< 8-bit signed integer. */
MFX_DATA_TYPE_U16, /*!< 16-bit unsigned integer. */
MFX_DATA_TYPE_I16, /*!< 16-bit signed integer. */
MFX_DATA_TYPE_U32, /*!< 32-bit unsigned integer. */
MFX_DATA_TYPE_I32, /*!< 32-bit signed integer. */
MFX_DATA_TYPE_U64, /*!< 64-bit unsigned integer. */
MFX_DATA_TYPE_I64, /*!< 64-bit signed integer. */
MFX_DATA_TYPE_F32, /*!< 32-bit single precision floating point. */
MFX_DATA_TYPE_F64, /*!< 64-bit double precision floating point. */
MFX_DATA_TYPE_PTR, /*!< Generic type pointer. */
MFX_DATA_TYPE_FP16, /*!< 16-bit half precision floating point. */
}mfxDataType;
/*! The mfxVariantType enumerator data types for mfxVariantType. */
typedef enum {
MFX_VARIANT_TYPE_UNSET = MFX_DATA_TYPE_UNSET, /*!< Undefined type. */
MFX_VARIANT_TYPE_U8 = MFX_DATA_TYPE_U8, /*!< 8-bit unsigned integer. */
MFX_VARIANT_TYPE_I8 = MFX_DATA_TYPE_I8, /*!< 8-bit signed integer. */
MFX_VARIANT_TYPE_U16 = MFX_DATA_TYPE_U16, /*!< 16-bit unsigned integer. */
MFX_VARIANT_TYPE_I16 = MFX_DATA_TYPE_I16, /*!< 16-bit signed integer. */
MFX_VARIANT_TYPE_U32 = MFX_DATA_TYPE_U32, /*!< 32-bit unsigned integer. */
MFX_VARIANT_TYPE_I32 = MFX_DATA_TYPE_I32, /*!< 32-bit signed integer. */
MFX_VARIANT_TYPE_U64 = MFX_DATA_TYPE_U64, /*!< 64-bit unsigned integer. */
MFX_VARIANT_TYPE_I64 = MFX_DATA_TYPE_I64, /*!< 64-bit signed integer. */
MFX_VARIANT_TYPE_F32 = MFX_DATA_TYPE_F32, /*!< 32-bit single precision floating point. */
MFX_VARIANT_TYPE_F64 = MFX_DATA_TYPE_F64, /*!< 64-bit double precision floating point. */
MFX_VARIANT_TYPE_PTR = MFX_DATA_TYPE_PTR, /*!< Generic type pointer. */
MFX_VARIANT_TYPE_FP16 = MFX_DATA_TYPE_FP16, /*!< 16-bit half precision floating point. */
#ifdef ONEVPL_EXPERIMENTAL
MFX_VARIANT_TYPE_QUERY = 0x00000100, /*!< Bitmask to OR with other variant types when using property-based query API */
#endif
} mfxVariantType;
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxVariantType enumerator data types for mfxVariant type. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxVariantType Type; /*!< Value type. */
/*! Value data holder. */
union data {
mfxU8 U8; /*!< mfxU8 data. */
mfxI8 I8; /*!< mfxI8 data. */
mfxU16 U16; /*!< mfxU16 data. */
mfxI16 I16; /*!< mfxI16 data. */
mfxU32 U32; /*!< mfxU32 data. */
mfxI32 I32; /*!< mfxI32 data. */
mfxU64 U64; /*!< mfxU64 data. */
mfxI64 I64; /*!< mfxI64 data. */
mfxF32 F32; /*!< mfxF32 data. */
mfxF64 F64; /*!< mfxF64 data. */
mfxFP16 FP16; /*!< mfxFP16 data. */
mfxHDL Ptr; /*!< Pointer. When this points to a string the string must be null terminated. */
} Data; /*!< Value data member. */
} mfxVariant;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Represents a range of unsigned values. */
typedef struct {
mfxU32 Min; /*!< Minimal value of the range. */
mfxU32 Max; /*!< Maximal value of the range. */
mfxU32 Step; /*!< Value increment. */
} mfxRange32U;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Represents a pair of numbers of type mfxI16. */
typedef struct {
mfxI16 x; /*!< First number. */
mfxI16 y; /*!< Second number. */
} mfxI16Pair;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Represents pair of handles of type mfxHDL. */
typedef struct {
mfxHDL first; /*!< First handle. */
mfxHDL second; /*!< Second handle. */
} mfxHDLPair;
MFX_PACK_END()
/*********************************************************************************\
Error message
\*********************************************************************************/
/*! @enum mfxStatus Itemizes status codes returned by API functions. */
typedef enum
{
/* no error */
MFX_ERR_NONE = 0, /*!< No error. */
/* reserved for unexpected errors */
MFX_ERR_UNKNOWN = -1, /*!< Unknown error. */
/* error codes <0 */
MFX_ERR_NULL_PTR = -2, /*!< Null pointer. */
MFX_ERR_UNSUPPORTED = -3, /*!< Unsupported feature. */
MFX_ERR_MEMORY_ALLOC = -4, /*!< Failed to allocate memory. */
MFX_ERR_NOT_ENOUGH_BUFFER = -5, /*!< Insufficient buffer at input/output. */
MFX_ERR_INVALID_HANDLE = -6, /*!< Invalid handle. */
MFX_ERR_LOCK_MEMORY = -7, /*!< Failed to lock the memory block. */
MFX_ERR_NOT_INITIALIZED = -8, /*!< Member function called before initialization. */
MFX_ERR_NOT_FOUND = -9, /*!< The specified object is not found. */
MFX_ERR_MORE_DATA = -10, /*!< Expect more data at input. */
MFX_ERR_MORE_SURFACE = -11, /*!< Expect more surface at output. */
MFX_ERR_ABORTED = -12, /*!< Operation aborted. */
MFX_ERR_DEVICE_LOST = -13, /*!< Lose the hardware acceleration device. */
MFX_ERR_INCOMPATIBLE_VIDEO_PARAM = -14, /*!< Incompatible video parameters. */
MFX_ERR_INVALID_VIDEO_PARAM = -15, /*!< Invalid video parameters. */
MFX_ERR_UNDEFINED_BEHAVIOR = -16, /*!< Undefined behavior. */
MFX_ERR_DEVICE_FAILED = -17, /*!< Device operation failure. */
MFX_ERR_MORE_BITSTREAM = -18, /*!< Expect more bitstream buffers at output. */
MFX_ERR_GPU_HANG = -21, /*!< Device operation failure caused by GPU hang. */
MFX_ERR_REALLOC_SURFACE = -22, /*!< Bigger output surface required. */
MFX_ERR_RESOURCE_MAPPED = -23, /*!< Write access is already acquired and user requested
another write access, or read access with MFX_MEMORY_NO_WAIT flag. */
MFX_ERR_NOT_IMPLEMENTED = -24, /*!< Feature or function not implemented. */
MFX_ERR_MORE_EXTBUFFER = -25, /*!< Expect additional extended configuration buffer. */
/* warnings >0 */
MFX_WRN_IN_EXECUTION = 1, /*!< The previous asynchronous operation is in execution. */
MFX_WRN_DEVICE_BUSY = 2, /*!< The hardware acceleration device is busy. */
MFX_WRN_VIDEO_PARAM_CHANGED = 3, /*!< The video parameters are changed during decoding. */
MFX_WRN_PARTIAL_ACCELERATION = 4, /*!< Software acceleration is used. */
MFX_WRN_INCOMPATIBLE_VIDEO_PARAM = 5, /*!< Incompatible video parameters. */
MFX_WRN_VALUE_NOT_CHANGED = 6, /*!< The value is saturated based on its valid range. */
MFX_WRN_OUT_OF_RANGE = 7, /*!< The value is out of valid range. */
MFX_WRN_FILTER_SKIPPED = 10, /*!< One of requested filters has been skipped. */
/* low-delay partial output */
MFX_ERR_NONE_PARTIAL_OUTPUT = 12, /*!< Frame is not ready, but bitstream contains partial output. */
MFX_WRN_ALLOC_TIMEOUT_EXPIRED = 13, /*!< Timeout expired for internal frame allocation. */
/* threading statuses */
MFX_TASK_DONE = MFX_ERR_NONE, /*!< Task has been completed. */
MFX_TASK_WORKING = 8, /*!< There is some more work to do. */
MFX_TASK_BUSY = 9, /*!< Task is waiting for resources. */
/* plug-in statuses */
MFX_ERR_MORE_DATA_SUBMIT_TASK = -10000, /*!< Return MFX_ERR_MORE_DATA but submit internal asynchronous task. */
} mfxStatus;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Represents Globally Unique Identifier (GUID) with memory layout
compliant to RFC 4122. See https://www.rfc-editor.org/info/rfc4122 for details. */
typedef struct
{
mfxU8 Data[16]; /*!< Array to keep GUID. */
} mfxGUID;
MFX_PACK_END()
// Application
#if defined(MFX_DISPATCHER_EXPOSED_PREFIX)
#include "mfxdispatcherprefixedfunctions.h"
#endif // MFX_DISPATCHER_EXPOSED_PREFIX
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MFXDEFS_H__ */
+271
View File
@@ -0,0 +1,271 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXDISPATCHER_H__
#define __MFXDISPATCHER_H__
#include "mfxdefs.h"
#include "mfxcommon.h"
#include "mfxsession.h"
#ifdef __cplusplus
extern "C" {
#endif
/*! Loader handle. */
typedef struct _mfxLoader *mfxLoader;
/*! Config handle. */
typedef struct _mfxConfig *mfxConfig;
/*!
@brief Creates the loader.
@return Loader Loader handle or NULL if failed.
@since This function is available since API version 2.0.
*/
mfxLoader MFX_CDECL MFXLoad(void);
/*!
@brief Destroys the dispatcher.
@param[in] loader Loader handle.
@since This function is available since API version 2.0.
*/
void MFX_CDECL MFXUnload(mfxLoader loader);
/*!
@brief Creates dispatcher configuration.
@details Creates the dispatcher internal configuration, which is used to filter out available implementations.
This configuration is used to walk through selected implementations to gather more details and select the appropriate
implementation to load. The loader object remembers all created mfxConfig objects and destroys them during the mfxUnload
function call.
Multiple configurations per single mfxLoader object are possible.
Usage example:
@code
mfxLoader loader = MFXLoad();
mfxConfig cfg = MFXCreateConfig(loader);
MFXCreateSession(loader,0,&session);
@endcode
@param[in] loader Loader handle.
@return Config handle or NULL pointer is failed.
@since This function is available since API version 2.0.
*/
mfxConfig MFX_CDECL MFXCreateConfig(mfxLoader loader);
/*!
@brief Adds additional filter properties (any fields of the mfxImplDescription structure) to the configuration of the loader object.
@note Each new call with the same parameter name will overwrite the previously set value. This may invalidate other properties.
@param[in] config Config handle.
@param[in] name Name of the parameter (see mfxImplDescription structure and example).
@param[in] value Value of the parameter.
@return
MFX_ERR_NONE The function completed successfully.
MFX_ERR_NULL_PTR If config is NULL. \n
MFX_ERR_NULL_PTR If name is NULL. \n
MFX_ERR_NOT_FOUND If name contains unknown parameter name.
MFX_ERR_UNSUPPORTED If value data type does not equal the parameter with provided name.
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXSetConfigFilterProperty(mfxConfig config, const mfxU8* name, mfxVariant value);
/*!
@brief Iterates over filtered out implementations to gather their details. This function allocates memory to store
a structure or string corresponding to the type specified by format. For example, if format is set to
MFX_IMPLCAPS_IMPLDESCSTRUCTURE, then idesc will return a pointer to a structure of type mfxImplDescription.
Use the MFXDispReleaseImplDescription function to free memory allocated to this structure or string.
@param[in] loader Loader handle.
@param[in] i Index of the implementation.
@param[in] format Format in which capabilities need to be delivered. See the mfxImplCapsDeliveryFormat enumerator for more details.
@param[out] idesc Pointer to the structure or string corresponding to the requested format.
@return
MFX_ERR_NONE The function completed successfully. The idesc contains valid information.\n
MFX_ERR_NULL_PTR If loader is NULL. \n
MFX_ERR_NULL_PTR If idesc is NULL. \n
MFX_ERR_NOT_FOUND Provided index is out of possible range. \n
MFX_ERR_UNSUPPORTED If requested format is not supported.
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXEnumImplementations(mfxLoader loader, mfxU32 i, mfxImplCapsDeliveryFormat format, mfxHDL* idesc);
/*!
@brief Loads and initializes the implementation.
@code
mfxLoader loader = MFXLoad();
int i=0;
while(1) {
mfxImplDescription *idesc;
MFXEnumImplementations(loader, i, MFX_IMPLCAPS_IMPLDESCSTRUCTURE, (mfxHDL*)&idesc);
if(is_good(idesc)) {
MFXCreateSession(loader, i,&session);
// ...
MFXDispReleaseImplDescription(loader, idesc);
}
else
{
MFXDispReleaseImplDescription(loader, idesc);
break;
}
}
@endcode
@param[in] loader Loader handle.
@param[in] i Index of the implementation.
@param[out] session Pointer to the session handle.
@return
MFX_ERR_NONE The function completed successfully. The session contains a pointer to the session handle.\n
MFX_ERR_NULL_PTR If loader is NULL. \n
MFX_ERR_NULL_PTR If session is NULL. \n
MFX_ERR_NOT_FOUND Provided index is out of possible range.
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXCreateSession(mfxLoader loader, mfxU32 i, mfxSession* session);
/*!
@brief
Destroys handle allocated by the MFXEnumImplementations function.
@param[in] loader Loader handle.
@param[in] hdl Handle to destroy. Can be equal to NULL.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_NULL_PTR If loader is NULL. \n
MFX_ERR_INVALID_HANDLE Provided hdl handle is not associated with this loader.
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXDispReleaseImplDescription(mfxLoader loader, mfxHDL hdl);
/*!
@brief
Macro help to return UUID in the common oneAPI format.
@param[in] devinfo Handle to mfxExtendedDeviceId.
@param[in] sub_dev_num SubDevice number. Can be obtained from mfxDeviceDescription::SubDevices::Index. Set to zero if no SubDevices.
@param[out] uuid Pointer to UUID.
*/
#define MFX_UUID_COMPUTE_DEVICE_ID(devinfo, sub_dev_num, uuid) \
{ \
extDeviceUUID t_uuid = { 0 }; \
extDeviceUUID* shared_uuid = (extDeviceUUID*)(uuid); \
t_uuid.vendor_id = (devinfo)->VendorID; \
t_uuid.device_id = (devinfo)->DeviceID; \
t_uuid.revision_id = (devinfo)->RevisionID; \
t_uuid.pci_domain = (devinfo)->PCIDomain; \
t_uuid.pci_bus = (mfxU8)(devinfo)->PCIBus; \
t_uuid.pci_dev = (mfxU8)(devinfo)->PCIDevice; \
t_uuid.pci_func = (mfxU8)(devinfo)->PCIFunction; \
t_uuid.sub_device_id = (mfxU8)(sub_dev_num); \
*shared_uuid = t_uuid; \
}
/* Helper macro definitions to add config filter properties. */
/*! Adds single property of mfxU32 type.
@param[in] loader Valid mfxLoader object
@param[in] name Property name string
@param[in] value Property value
*/
#define MFX_ADD_PROPERTY_U32(loader, name, value) \
{ \
mfxVariant impl_value; \
mfxConfig cfg = MFXCreateConfig(loader); \
impl_value.Version.Version = MFX_VARIANT_VERSION; \
impl_value.Type = MFX_VARIANT_TYPE_U32; \
impl_value.Data.U32 = value; \
MFXSetConfigFilterProperty(cfg, (mfxU8 *)name, impl_value); \
}
/*! Adds single property of mfxU16 type.
@param[in] loader Valid mfxLoader object
@param[in] name Property name string
@param[in] value Property value
*/
#define MFX_ADD_PROPERTY_U16(loader, name, value) \
{ \
mfxVariant impl_value = { 0 }; \
mfxConfig cfg = MFXCreateConfig(loader); \
impl_value.Version.Version = MFX_VARIANT_VERSION; \
impl_value.Type = MFX_VARIANT_TYPE_U16; \
impl_value.Data.U16 = value; \
MFXSetConfigFilterProperty(cfg, (mfxU8 *)name, impl_value); \
}
/*! Adds single property of pointer type.
@param[in] loader Valid mfxLoader object
@param[in] name Property name string
@param[in] value Property value
*/
#define MFX_ADD_PROPERTY_PTR(loader, name, value) \
{ \
mfxVariant impl_value = { 0 }; \
mfxConfig cfg = MFXCreateConfig(loader); \
impl_value.Version.Version = MFX_VARIANT_VERSION; \
impl_value.Type = MFX_VARIANT_TYPE_PTR; \
impl_value.Data.Ptr = (mfxHDL)value; \
MFXSetConfigFilterProperty(cfg, (mfxU8 *)name, impl_value); \
}
/*! Update existing property of mfxU32 type.
@param[in] loader Valid mfxLoader object
@param[in] config Valid mfxConfig object
@param[in] name Property name string
@param[in] value Property value
*/
#define MFX_UPDATE_PROPERTY_U32(loader, config, name, value) \
{ \
mfxVariant impl_value; \
impl_value.Version.Version = MFX_VARIANT_VERSION; \
impl_value.Type = MFX_VARIANT_TYPE_U32; \
impl_value.Data.U32 = value; \
MFXSetConfigFilterProperty(config, (mfxU8 *)name, impl_value); \
}
/*! Update existing property of mfxU16 type.
@param[in] loader Valid mfxLoader object
@param[in] config Valid mfxConfig object
@param[in] name Property name string
@param[in] value Property value
*/
#define MFX_UPDATE_PROPERTY_U16(loader, config, name, value) \
{ \
mfxVariant impl_value; \
impl_value.Version.Version = MFX_VARIANT_VERSION; \
impl_value.Type = MFX_VARIANT_TYPE_U16; \
impl_value.Data.U16 = value; \
MFXSetConfigFilterProperty(config, (mfxU8 *)name, impl_value); \
}
/*! Update existing property of pointer type.
@param[in] loader Valid mfxLoader object
@param[in] config Valid mfxConfig object
@param[in] name Property name string
@param[in] value Property value
*/
#define MFX_UPDATE_PROPERTY_PTR(loader, config, name, value) \
{ \
mfxVariant impl_value; \
impl_value.Version.Version = MFX_VARIANT_VERSION; \
impl_value.Type = MFX_VARIANT_TYPE_PTR; \
impl_value.Data.Ptr = (mfxHDL)value; \
MFXSetConfigFilterProperty(config, (mfxU8 *)name, impl_value); \
}
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,154 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXDISPATCHERPREFIXEDFUNCTIONS_H__
#define __MFXDISPATCHERPREFIXEDFUNCTIONS_H__
// API 1.0 functions
#define MFXInit disp_MFXInit
#define MFXClose disp_MFXClose
#define MFXQueryIMPL disp_MFXQueryIMPL
#define MFXQueryVersion disp_MFXQueryVersion
#define MFXJoinSession disp_MFXJoinSession
#define MFXDisjoinSession disp_MFXDisjoinSession
#define MFXCloneSession disp_MFXCloneSession
#define MFXSetPriority disp_MFXSetPriority
#define MFXGetPriority disp_MFXGetPriority
#define MFXVideoCORE_SetFrameAllocator disp_MFXVideoCORE_SetFrameAllocator
#define MFXVideoCORE_SetHandle disp_MFXVideoCORE_SetHandle
#define MFXVideoCORE_GetHandle disp_MFXVideoCORE_GetHandle
#define MFXVideoCORE_SyncOperation disp_MFXVideoCORE_SyncOperation
#define MFXVideoENCODE_Query disp_MFXVideoENCODE_Query
#define MFXVideoENCODE_QueryIOSurf disp_MFXVideoENCODE_QueryIOSurf
#define MFXVideoENCODE_Init disp_MFXVideoENCODE_Init
#define MFXVideoENCODE_Reset disp_MFXVideoENCODE_Reset
#define MFXVideoENCODE_Close disp_MFXVideoENCODE_Close
#define MFXVideoENCODE_GetVideoParam disp_MFXVideoENCODE_GetVideoParam
#define MFXVideoENCODE_GetEncodeStat disp_MFXVideoENCODE_GetEncodeStat
#define MFXVideoENCODE_EncodeFrameAsync disp_MFXVideoENCODE_EncodeFrameAsync
#define MFXVideoDECODE_Query disp_MFXVideoDECODE_Query
#define MFXVideoDECODE_DecodeHeader disp_MFXVideoDECODE_DecodeHeader
#define MFXVideoDECODE_QueryIOSurf disp_MFXVideoDECODE_QueryIOSurf
#define MFXVideoDECODE_Init disp_MFXVideoDECODE_Init
#define MFXVideoDECODE_Reset disp_MFXVideoDECODE_Reset
#define MFXVideoDECODE_Close disp_MFXVideoDECODE_Close
#define MFXVideoDECODE_GetVideoParam disp_MFXVideoDECODE_GetVideoParam
#define MFXVideoDECODE_GetDecodeStat disp_MFXVideoDECODE_GetDecodeStat
#define MFXVideoDECODE_SetSkipMode disp_MFXVideoDECODE_SetSkipMode
#define MFXVideoDECODE_GetPayload disp_MFXVideoDECODE_GetPayload
#define MFXVideoDECODE_DecodeFrameAsync disp_MFXVideoDECODE_DecodeFrameAsync
#define MFXVideoVPP_Query disp_MFXVideoVPP_Query
#define MFXVideoVPP_QueryIOSurf disp_MFXVideoVPP_QueryIOSurf
#define MFXVideoVPP_Init disp_MFXVideoVPP_Init
#define MFXVideoVPP_Reset disp_MFXVideoVPP_Reset
#define MFXVideoVPP_Close disp_MFXVideoVPP_Close
#define MFXVideoVPP_GetVideoParam disp_MFXVideoVPP_GetVideoParam
#define MFXVideoVPP_GetVPPStat disp_MFXVideoVPP_GetVPPStat
#define MFXVideoVPP_RunFrameVPPAsync disp_MFXVideoVPP_RunFrameVPPAsync
// API 1.1 functions
#define MFXVideoUSER_Register disp_MFXVideoUSER_Register
#define MFXVideoUSER_Unregister disp_MFXVideoUSER_Unregister
#define MFXVideoUSER_ProcessFrameAsync disp_MFXVideoUSER_ProcessFrameAsync
// API 1.10 functions
#define MFXVideoENC_Query disp_MFXVideoENC_Query
#define MFXVideoENC_QueryIOSurf disp_MFXVideoENC_QueryIOSurf
#define MFXVideoENC_Init disp_MFXVideoENC_Init
#define MFXVideoENC_Reset disp_MFXVideoENC_Reset
#define MFXVideoENC_Close disp_MFXVideoENC_Close
#define MFXVideoENC_ProcessFrameAsync disp_MFXVideoENC_ProcessFrameAsync
#define MFXVideoVPP_RunFrameVPPAsyncEx disp_MFXVideoVPP_RunFrameVPPAsyncEx
#define MFXVideoUSER_Load disp_MFXVideoUSER_Load
#define MFXVideoUSER_UnLoad disp_MFXVideoUSER_UnLoad
// API 1.11 functions
#define MFXVideoPAK_Query disp_MFXVideoPAK_Query
#define MFXVideoPAK_QueryIOSurf disp_MFXVideoPAK_QueryIOSurf
#define MFXVideoPAK_Init disp_MFXVideoPAK_Init
#define MFXVideoPAK_Reset disp_MFXVideoPAK_Reset
#define MFXVideoPAK_Close disp_MFXVideoPAK_Close
#define MFXVideoPAK_ProcessFrameAsync disp_MFXVideoPAK_ProcessFrameAsync
// API 1.13 functions
#define MFXVideoUSER_LoadByPath disp_MFXVideoUSER_LoadByPath
// API 1.14 functions
#define MFXInitEx disp_MFXInitEx
// Audio library functions
// API 1.8 functions
#define MFXAudioCORE_SyncOperation disp_MFXAudioCORE_SyncOperation
#define MFXAudioENCODE_Query disp_MFXAudioENCODE_Query
#define MFXAudioENCODE_QueryIOSize disp_MFXAudioENCODE_QueryIOSize
#define MFXAudioENCODE_Init disp_MFXAudioENCODE_Init
#define MFXAudioENCODE_Reset disp_MFXAudioENCODE_Reset
#define MFXAudioENCODE_Close disp_MFXAudioENCODE_Close
#define MFXAudioENCODE_GetAudioParam disp_MFXAudioENCODE_GetAudioParam
#define MFXAudioENCODE_EncodeFrameAsync disp_MFXAudioENCODE_EncodeFrameAsync
#define MFXAudioDECODE_Query disp_MFXAudioDECODE_Query
#define MFXAudioDECODE_DecodeHeader disp_MFXAudioDECODE_DecodeHeader
#define MFXAudioDECODE_Init disp_MFXAudioDECODE_Init
#define MFXAudioDECODE_Reset disp_MFXAudioDECODE_Reset
#define MFXAudioDECODE_Close disp_MFXAudioDECODE_Close
#define MFXAudioDECODE_QueryIOSize disp_MFXAudioDECODE_QueryIOSize
#define MFXAudioDECODE_GetAudioParam disp_MFXAudioDECODE_GetAudioParam
#define MFXAudioDECODE_DecodeFrameAsync disp_MFXAudioDECODE_DecodeFrameAsync
// API 1.9 functions
#define MFXAudioUSER_Register disp_MFXAudioUSER_Register
#define MFXAudioUSER_Unregister disp_MFXAudioUSER_Unregister
#define MFXAudioUSER_ProcessFrameAsync disp_MFXAudioUSER_ProcessFrameAsync
#define MFXAudioUSER_Load disp_MFXAudioUSER_Load
#define MFXAudioUSER_UnLoad disp_MFXAudioUSER_UnLoad
// API 1.19 functions
#define MFXVideoENC_GetVideoParam disp_MFXVideoENC_GetVideoParam
#define MFXVideoPAK_GetVideoParam disp_MFXVideoPAK_GetVideoParam
#define MFXVideoCORE_QueryPlatform disp_MFXVideoCORE_QueryPlatform
#define MFXVideoUSER_GetPlugin disp_MFXVideoUSER_GetPlugin
// API 2.0 functions
#define MFXMemory_GetSurfaceForVPP disp_MFXMemory_GetSurfaceForVPP
#define MFXMemory_GetSurfaceForEncode disp_MFXMemory_GetSurfaceForEncode
#define MFXMemory_GetSurfaceForDecode disp_MFXMemory_GetSurfaceForDecode
#define MFXQueryImplsDescription disp_MFXQueryImplsDescription
#define MFXReleaseImplDescription disp_MFXReleaseImplDescription
#define MFXInitialize disp_MFXInitialize
// API 2.1 functions
#define MFXMemory_GetSurfaceForVPPOut disp_MFXMemory_GetSurfaceForVPPOut
#define MFXVideoDECODE_VPP_Init disp_MFXVideoDECODE_VPP_Init
#define MFXVideoDECODE_VPP_DecodeFrameAsync disp_MFXVideoDECODE_VPP_DecodeFrameAsync
#define MFXVideoDECODE_VPP_Reset disp_MFXVideoDECODE_VPP_Reset
#define MFXVideoDECODE_VPP_GetChannelParam disp_MFXVideoDECODE_VPP_GetChannelParam
#define MFXVideoDECODE_VPP_Close disp_MFXVideoDECODE_VPP_Close
#define MFXVideoVPP_ProcessFrameAsync disp_MFXVideoVPP_ProcessFrameAsync
// API 2.15 functions
#ifdef ONEVPL_EXPERIMENTAL
#define MFXQueryImplsProperties disp_MFXQueryImplsProperties
#endif
#endif
+458
View File
@@ -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];
} 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 corresponding to MB size.
In H.265 it's normalized to 4x4, so for each CU we calculate number of 4x4 which belongs to the block. */
mfxU32 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 represents reference counted container for output after encoding operation which includes statistics
and synchronization primitive for compressed bitstream.
The memory is allocated and released by the library.
*/
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* ref_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 available 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
+78
View File
@@ -0,0 +1,78 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#include "mfxdefs.h"
#ifndef __MFXIMPLCAPS_H__
#define __MFXIMPLCAPS_H__
#include "mfxstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*!
@brief
Delivers implementation capabilities in the requested format according to the format value. Calling this
function directly is not recommended. Instead, applications must call the MFXEnumImplementations function.
@param[in] format Format in which capabilities must be delivered. See mfxImplCapsDeliveryFormat for more details.
@param[out] num_impls Number of the implementations.
@return
Array of handles to the capability report or NULL in case of unsupported format or NULL num_impls pointer.
Length of array is equal to num_impls.
@since This function is available since API version 2.0.
*/
mfxHDL* MFX_CDECL MFXQueryImplsDescription(mfxImplCapsDeliveryFormat format, mfxU32* num_impls);
/*!
@brief
Destroys the handle allocated by the MFXQueryImplsDescription function or the MFXQueryImplsProperties function.
Implementation must remember which handles are released. Once the last handle is released, this function must release memory
allocated for the array of handles. Calling this function directly is not recommended. Instead, applications must call
the MFXDispReleaseImplDescription function.
@param[in] hdl Handle to destroy. Can be equal to NULL.
@return
MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXReleaseImplDescription(mfxHDL hdl);
#ifdef ONEVPL_EXPERIMENTAL
/*!
@brief
Delivers implementation capabilities for configured properties.
The returned capability report will be sparsely filled out, with only properties available which
were set via MFXSetConfigFilterProperty(). Calling this function directly is not recommended.
Instead, applications must call the MFXEnumImplementations function.
@param[in] properties Array of property name/value pairs indicating which properties to populate in the capability report.
@param[in] num_properties Number of property name/value pairs.
@param[out] num_impls Number of the implementations.
@return
Array of handles to the capability report or NULL in case of NULL properties pointer or zero num_properties or NULL num_impls pointer.
Length of array is equal to num_impls.
@since This function is available since API version 2.15.
*/
mfxHDL* MFX_CDECL MFXQueryImplsProperties(mfxQueryProperty** properties, mfxU32 num_properties, mfxU32* num_impls);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __MFXIMPLCAPS_H__
+136
View File
@@ -0,0 +1,136 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFX_JPEG_H__
#define __MFX_JPEG_H__
#include "mfxdefs.h"
#include "mfxstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* CodecId */
enum {
MFX_CODEC_JPEG = MFX_MAKEFOURCC('J','P','E','G') /*!< JPEG codec */
};
/* CodecProfile, CodecLevel */
enum
{
MFX_PROFILE_JPEG_BASELINE = 1 /*!< Baseline JPEG profile. */
};
/*! The Rotation enumerator itemizes the JPEG rotation options. */
enum
{
MFX_ROTATION_0 = 0, /*!< No rotation. */
MFX_ROTATION_90 = 1, /*!< 90 degree rotation. */
MFX_ROTATION_180 = 2, /*!< 180 degree rotation. */
MFX_ROTATION_270 = 3 /*!< 270 degree rotation. */
};
enum {
MFX_EXTBUFF_JPEG_QT = MFX_MAKEFOURCC('J','P','G','Q'), /*!< This extended buffer defines quantization tables for JPEG encoder. */
MFX_EXTBUFF_JPEG_HUFFMAN = MFX_MAKEFOURCC('J','P','G','H') /*!< This extended buffer defines Huffman tables for JPEG encoder. */
};
/*! The JPEGColorFormat enumerator itemizes the JPEG color format options. */
enum {
MFX_JPEG_COLORFORMAT_UNKNOWN = 0, /*! Unknown color format. The decoder tries to determine color format from available in bitstream information.
If such information is not present, then MFX_JPEG_COLORFORMAT_YCbCr color format is assumed. */
MFX_JPEG_COLORFORMAT_YCbCr = 1, /*! Bitstream contains Y, Cb and Cr components. */
MFX_JPEG_COLORFORMAT_RGB = 2 /*! Bitstream contains R, G and B components. */
};
/*! The JPEGScanType enumerator itemizes the JPEG scan types. */
enum {
MFX_SCANTYPE_UNKNOWN = 0, /*!< Unknown scan type. */
MFX_SCANTYPE_INTERLEAVED = 1, /*!< Interleaved scan. */
MFX_SCANTYPE_NONINTERLEAVED = 2 /*!< Non-interleaved scan. */
};
enum {
MFX_CHROMAFORMAT_JPEG_SAMPLING = 6 /*!< Color sampling specified via mfxInfoMFX::SamplingFactorH and SamplingFactorV. */
};
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"
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.
The following table illustrates this behavior.
@internal
+------------------+---------+------+---+
| Table ID | 0 | 1 | 2 |
+------------------+---------+------+---+
| Number of tables | | | |
+==================+=========+======+===+
| 0 | Y, U, V | | |
+------------------+---------+------+---+
| 1 | Y | U, V | |
+------------------+---------+------+---+
| 2 | Y | U | V |
+------------------+---------+------+---+
@endinternal
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_JPEG_QT. */
mfxU16 reserved[7];
mfxU16 NumTable; /*!< Number of quantization tables defined in Qm array. */
mfxU16 Qm[4][64]; /*!< Quantization table values. */
} mfxExtJPEGQuantTables;
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.
The following table illustrates this behavior.
@internal
+------------------+---------+------+
| Table ID | 0 | 1 |
+------------------+---------+------+
| Number of tables | | |
+==================+=========+======+
| 0 | Y, U, V | |
+------------------+---------+------+
| 1 | Y | U, V |
+------------------+---------+------+
@endinternal
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_JPEG_HUFFMAN. */
mfxU16 reserved[2];
mfxU16 NumDCTable; /*!< Number of DC quantization table in DCTables array. */
mfxU16 NumACTable; /*!< Number of AC quantization table in ACTables array. */
struct {
mfxU8 Bits[16]; /*!< Number of codes for each code length. */
mfxU8 Values[12]; /*!< List of the 8-bit symbol values. */
} DCTables[4]; /*!< Array of DC tables. */
struct {
mfxU8 Bits[16]; /*!< Number of codes for each code length. */
mfxU8 Values[162]; /*!< Array of AC tables. */
} ACTables[4]; /*!< List of the 8-bit symbol values. */
} mfxExtJPEGHuffmanTables;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif // __MFX_JPEG_H__
+348
View File
@@ -0,0 +1,348 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXMEMORY_H__
#define __MFXMEMORY_H__
#include "mfxsession.h"
#include "mfxstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*!
@brief
Returns surface which can be used as input for VPP.
VPP should be initialized before this call.
Surface should be released with mfxFrameSurface1::FrameInterface.Release(...) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.
@param[in] session Session handle.
@param[out] surface Pointer is set to valid mfxFrameSurface1 object.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_NULL_PTR If double-pointer to the @p surface is NULL. \n
MFX_ERR_INVALID_HANDLE If @p session was not initialized. \n
MFX_ERR_NOT_INITIALIZED If VPP was not initialized (allocator needs to know surface size from somewhere). \n
MFX_ERR_MEMORY_ALLOC In case of any other internal allocation error. \n
MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with mfxExtAllocationHints).
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXMemory_GetSurfaceForVPP(mfxSession session, mfxFrameSurface1** surface);
/*!
@brief
Returns surface which can be used as output of VPP.
VPP should be initialized before this call.
Surface should be released with mfxFrameSurface1::FrameInterface.Release(...) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.
@param[in] session Session handle.
@param[out] surface Pointer is set to valid mfxFrameSurface1 object.
@return
MFX_ERR_NONE The function completed successfully. \n
MFX_ERR_NULL_PTR If double-pointer to the @p surface is NULL. \n
MFX_ERR_INVALID_HANDLE If @p session was not initialized. \n
MFX_ERR_NOT_INITIALIZED If VPP was not initialized (allocator needs to know surface size from somewhere). \n
MFX_ERR_MEMORY_ALLOC In case of any other internal allocation error. \n
MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with mfxExtAllocationHints).
@since This function is available since API version 2.1.
*/
mfxStatus MFX_CDECL MFXMemory_GetSurfaceForVPPOut(mfxSession session, mfxFrameSurface1** surface);
/*! Alias for MFXMemory_GetSurfaceForVPP function. */
#define MFXMemory_GetSurfaceForVPPIn MFXMemory_GetSurfaceForVPP
/*!
@brief
Returns a surface which can be used as input for the encoder.
Encoder should be initialized before this call.
Surface should be released with mfxFrameSurface1::FrameInterface.Release(...) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.
@param[in] session Session handle.
@param[out] surface Pointer is set to valid mfxFrameSurface1 object.
@return
MFX_ERR_NONE The function completed successfully.\n
MFX_ERR_NULL_PTR If surface is NULL.\n
MFX_ERR_INVALID_HANDLE If session was not initialized.\n
MFX_ERR_NOT_INITIALIZED If the encoder was not initialized (allocator needs to know surface size from somewhere).\n
MFX_ERR_MEMORY_ALLOC In case of any other internal allocation error. \n
MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with mfxExtAllocationHints).
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXMemory_GetSurfaceForEncode(mfxSession session, mfxFrameSurface1** surface);
/*!
@brief
Returns a surface which can be used as output of the decoder.
Decoder should be initialized before this call.
Surface should be released with mfxFrameSurface1::FrameInterface.Release(...) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.'
@note This function was added to simplify transition from legacy surface management to the proposed internal allocation approach.
Previously, the user allocated surfaces for the working pool and fed them to the decoder using DecodeFrameAsync calls. With MFXMemory_GetSurfaceForDecode
it is possible to change the existing pipeline by just changing the source of work surfaces.
Newly developed applications should prefer direct usage of DecodeFrameAsync with internal allocation.
@param[in] session Session handle.
@param[out] surface Pointer is set to valid mfxFrameSurface1 object.
@return
MFX_ERR_NONE The function completed successfully.\n
MFX_ERR_NULL_PTR If surface is NULL.\n
MFX_ERR_INVALID_HANDLE If session was not initialized.\n
MFX_ERR_NOT_INITIALIZED If the decoder was not initialized (allocator needs to know surface size from somewhere).\n
MFX_ERR_MEMORY_ALLOC Other internal allocation error. \n
MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with mfxExtAllocationHints).
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXMemory_GetSurfaceForDecode(mfxSession session, mfxFrameSurface1** surface);
#ifdef ONEVPL_EXPERIMENTAL
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxSurfaceInterface SurfaceInterface;
mfxHDL texture2D; /*!< Pointer to texture, type ID3D11Texture2D* */
mfxHDL reserved[7];
} mfxSurfaceD3D11Tex2D;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxSurfaceInterface SurfaceInterface;
mfxHDL vaDisplay; /*!< Object of type VADisplay. */
mfxU32 vaSurfaceID; /*!< Object of type VASurfaceID. */
mfxU32 reserved1;
mfxHDL reserved[6];
} mfxSurfaceVAAPI;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Optional extension buffer, which can be attached to mfxSurfaceHeader::ExtParam
(second parameter of mfxFrameSurfaceInterface::Export) in order to pass OCL parameters
during mfxFrameSurface1 exporting to OCL surface.
If buffer is not provided all resources will be created by oneAPI Video Processing Library (oneVPL) RT internally.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_EXPORT_SHARING_DESC_OCL. */
mfxHDL ocl_context; /*!< Object of type cl_context (OpenCL context). */
mfxHDL ocl_command_queue; /*!< Object of type cl_command_queue (OpenCL command queue). */
mfxHDL reserved[8];
} mfxExtSurfaceOpenCLImg2DExportDescription;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxSurfaceInterface SurfaceInterface;
mfxHDL ocl_context; /*!< Object of type cl_context (OpenCL context). */
mfxHDL ocl_command_queue; /*!< Object of type cl_command_queue (OpenCL command queue). */
mfxHDL ocl_image[4]; /*!< Object of type cl_mem[4] (array of 4 OpenCL 2D images). */
mfxU32 ocl_image_num; /*!< Number of valid images (planes), depends on color format. */
mfxHDL reserved[8];
} mfxSurfaceOpenCLImg2D;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Optional extension buffer, which can be attached to mfxSurfaceHeader::ExtParam
(second parameter of mfxFrameSurfaceInterface::Export) in order to pass D3D12 parameters
during mfxFrameSurface1 exporting to D3D12 resource.
If buffer is not provided all resources will be created by oneAPI Video Processing Library (oneVPL) RT internally.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_EXPORT_SHARING_DESC_D3D12. */
mfxHDL d3d12Device; /*!< Pointer to D3D12 Device, type ID3D12Device*. */
mfxHDL reserved[9];
} mfxExtSurfaceD3D12Tex2DExportDescription;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxSurfaceInterface SurfaceInterface;
mfxHDL texture2D; /*!< Pointer to D3D12 resource, type ID3D12Resource*. */
mfxHDL reserved[7];
} mfxSurfaceD3D12Tex2D;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Optional extension buffer, which can be attached to mfxSurfaceHeader::ExtParam
(second parameter of mfxFrameSurfaceInterface::Export) in order to pass Vulkan parameters
during mfxFrameSurface1 exporting to Vulkan surface.
If buffer is not provided all resources will be created by oneAPI Video Processing Library (oneVPL) RT internally.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_EXPORT_SHARING_DESC_VULKAN. */
mfxHDL instance; /*!< Object of type VkInstance (Vulkan instance). */
mfxHDL physicalDevice; /*!< Object of type VkPhysicalDevice (Vulkan physical device). */
mfxHDL device; /*!< Object of type VkDevice (Vulkan device). */
mfxHDL reserved[7];
} mfxExtSurfaceVulkanImg2DExportDescription;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxSurfaceInterface SurfaceInterface;
mfxHDL instance; /*!< Object of type VkInstance (Vulkan instance). */
mfxHDL physicalDevice; /*!< Object of type VkPhysicalDevice (Vulkan physical device). */
mfxHDL device; /*!< Object of type VkDevice (Vulkan device). */
mfxHDL image2D; /*!< Object of type VkImage (Vulkan 2D images). */
mfxHDL image2DMemory; /*!< Object of type VkDeviceMemory (Vulkan device memory). */
mfxHDL reserved[10];
} mfxSurfaceVulkanImg2D;
MFX_PACK_END()
/*! The mfxSurfaceComponent enumerator specifies the internal surface pool to use when importing surfaces. */
typedef enum {
MFX_SURFACE_COMPONENT_UNKNOWN = 0, /*!< Unknown surface component. */
MFX_SURFACE_COMPONENT_ENCODE = 1, /*!< Shared surface for encoding. */
MFX_SURFACE_COMPONENT_DECODE = 2, /*!< Shared surface for decoding. */
MFX_SURFACE_COMPONENT_VPP_INPUT = 3, /*!< Shared surface for VPP input. */
MFX_SURFACE_COMPONENT_VPP_OUTPUT = 4, /*!< Shared surface for VPP output. */
} mfxSurfaceComponent;
/*! The current version of mfxSurfaceTypesSupported structure. */
#define MFX_SURFACETYPESSUPPORTED_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! This structure describes the supported surface types and modes. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxU16 NumSurfaceTypes; /*!< Number of supported surface types. */
struct surftype {
mfxSurfaceType SurfaceType; /*!< Supported surface type. */
mfxU32 reserved[6]; /*!< Reserved for future use. */
mfxU16 NumSurfaceComponents; /*!< Number of supported surface components. */
struct surfcomp {
mfxSurfaceComponent SurfaceComponent; /*!< Supported surface component. */
mfxU32 SurfaceFlags; /*!< Supported surface flags for this component (may be OR'd). */
mfxU32 reserved[7]; /*!< Reserved for future use. */
} *SurfaceComponents;
} *SurfaceTypes;
mfxU32 reserved[4]; /*!< Reserved for future use. */
} mfxSurfaceTypesSupported;
MFX_PACK_END()
#define MFX_MEMORYINTERFACE_VERSION MFX_STRUCT_VERSION(1, 1)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/* Specifies memory interface. */
typedef struct mfxMemoryInterface {
mfxHDL Context; /*!< The context of the memory interface. User should not touch (change, set, null) this pointer. */
mfxStructVersion Version; /*!< The version of the structure. */
/*!
@brief
Imports an application-provided surface into mfxFrameSurface1 which may be used as input for encoding or video processing.
@param[in] memory_interface Valid memory interface.
@param[in] surf_component Surface component type. Required for allocating new surfaces from the appropriate pool.
@param[in,out] external_surface Pointer to the mfxSurfaceXXX object describing the surface to be imported. All fields in
mfxSurfaceHeader must be set by the application. mfxSurfaceHeader::SurfaceType is
read by oneVPL runtime to determine which particular mfxSurfaceXXX structure is supplied.
For example, if mfxSurfaceXXX::SurfaceType == MFX_SURFACE_TYPE_D3D11_TEX2D, then the handle
will be interpreted as an object of type mfxSurfaceD3D11Tex2D. The application should
set or clear other fields as specified in the corresponding structure description.
After successful import, the value of mfxSurfaceHeader::SurfaceFlags will be replaced with the actual
import type. It can be used to determine which import type (with or without copy) took place in the case
of initial default setting, or if multiple import flags were OR'ed.
All external sync operations on the ext_surface must be completed before calling this function.
@param[out] imported_surface Pointer to a valid mfxFrameSurface1 object containing the imported frame.
imported_surface may be passed as an input to Encode or VPP processing operations.
@return
MFX_ERR_NONE The function completed successfully.\n
MFX_ERR_NULL_PTR If ext_surface or imported_surface are NULL.\n
MFX_ERR_INVALID_HANDLE If the corresponding session was not initialized.\n
MFX_ERR_UNSUPPORTED If surf_component is not one of [MFX_SURFACE_COMPONENT_ENCODE, MFX_SURFACE_COMPONENT_VPP_INPUT], or if
mfxSurfaceHeader::SurfaceType is not supported by oneVPL runtime for this operation.\n
@since This function is available since API version 2.10.
*/
/* For reference with Export flow please search for mfxFrameSurfaceInterface::Export. */
mfxStatus (MFX_CDECL *ImportFrameSurface)(struct mfxMemoryInterface* memory_interface, mfxSurfaceComponent surf_component, mfxSurfaceHeader* external_surface, mfxFrameSurface1** imported_surface);
/*!
@brief
Get a buffer in video memory into mfxBitstream which is used to store bitstream data for video decoding.
@param[in] memory_interface Valid memory interface.
@param[in,out] queried_bsBuffer Pointer to a valid mfxBitstream object.
When the call succeeds, the Data, DataOffset, DataLength, MaxLength, DataFlag of the queried_bsBuffer will be updated.
@return
MFX_ERR_NONE The function completed successfully. The Data, DataOffset, DataLength, MaxLength, DataFlag of the queried_bsBuffer will be updated.\n
MFX_ERR_NOT_INITIALIZED The function is called before MFXVideoDECODE_Init.\n
MFX_ERR_INVALID_HANDLE The input memory_interface is an invalid interface.\n
MFX_ERR_NULL_PTR The input queried_bsBuffer is a null pointer.\n
MFX_ERR_UNSUPPORTED The function is not supported for this codec.\n
MFX_ERR_DEVICE_FAILED The function fails to get the bitstream buffer in video memory.\n
@note This function should be called after MFXVideoDECODE_Init succeeds.
The bitstream buffer returned in queried_bsBuffer will be managed by the runtime and has been mapped for CPU access. The application does not need to allocate or delete memory for this buffer.
It will be allocated by runtime when the codec supports this function. It will be released automatically when the corresponding DecodeFrameAsync succeeds.
The mfxBitstream::Data will be reset to nullptr by DecodeFrameAsync when the buffer is released internally.
The MFX_BITSTREAM_IN_VIDEO_MEMORY bit of mfxBitstream::DataFlag will be set if this function succeeds, indicating the bitstream buffer is in video memory.
It is required for app to ensure the bitstream is a single complete frame (set the MFX_BITSTREAM_COMPLETE_FRAME of queried_bsBuffer->DataFlag) when using this function.
If the bitstream is not a complete frame, the mfxFrameData::Corrupted of the output surface will be set with MFX_CORRUPTION_MAJOR or MFX_CORRUPTION_MINOR according to the hardware decoding status.
@since This function is available since API version 2.17.
*/
mfxStatus (MFX_CDECL* GetBitstreamBuffer)(struct mfxMemoryInterface* memory_interface, mfxBitstream* queried_bsBuffer);
mfxHDL reserved[15];
} mfxMemoryInterface;
MFX_PACK_END()
/*! Alias for returning interface of type mfxMemoryInterface. */
#define MFXGetMemoryInterface(session, piface) MFXVideoCORE_GetHandle((session), MFX_HANDLE_MEMORY_INTERFACE, (mfxHDL *)(piface))
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif
+105
View File
@@ -0,0 +1,105 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXMVC_H__
#define __MFXMVC_H__
#include "mfxdefs.h"
#ifdef __cplusplus
extern "C" {
#endif
/* CodecProfile, CodecLevel */
enum {
/* MVC profiles */
MFX_PROFILE_AVC_MULTIVIEW_HIGH = 118, /*!< Multi-view high profile. The encoding of VDEnc or LowPower ON is not supported. */
MFX_PROFILE_AVC_STEREO_HIGH = 128 /*!< Stereo high profile. The encoding of VDEnc or LowPower ON is not supported. */
};
/* Extended Buffer Ids */
enum {
MFX_EXTBUFF_MVC_SEQ_DESC = MFX_MAKEFOURCC('M','V','C','D'), /*!< This extended buffer 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. */
MFX_EXTBUFF_MVC_TARGET_VIEWS = MFX_MAKEFOURCC('M','V','C','T') /*!< This extended buffer defines target views at the decoder output.*/
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Describes MVC view dependencies.
*/
typedef struct {
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. */
mfxU16 NonAnchorRefL1[16]; /*!< View identifiers of the view components for inter-view prediction in the initial reference picture list RefPicList0 for non-anchor view components. */
} mfxMVCViewDependency;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Describes the MVC operation point.
*/
typedef struct {
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 that correspond to the operation point. */
mfxU16 NumTargetViews; /*!< Number of target output views for the operation point. */
mfxU16 *TargetViewId; /*!< Target output view identifiers for operation point. */
} mfxMVCOperationPoint;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
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.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MVC_SEQUENCE_DESCRIPTION. */
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. */
mfxU32 Reserved[16];
} mfxExtMVCSeqDesc;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures views for the decoding output.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MVC_TARGET_VIEWS. */
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. */
} mfxExtMVCTargetViews ;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif
#endif
+45
View File
@@ -0,0 +1,45 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXPCP_H__
#define __MFXPCP_H__
#include "mfxstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*! The Protected enumerator describes the protection schemes. */
enum {
MFX_PROTECTION_CENC_WV_CLASSIC = 0x0004, /*!< The protection scheme is based on the Widevine* DRM from Google*. */
MFX_PROTECTION_CENC_WV_GOOGLE_DASH = 0x0005, /*!< The protection scheme is based on the Widevine* Modular DRM* from Google*. */
};
/* Extended Buffer Ids */
enum {
MFX_EXTBUFF_CENC_PARAM = MFX_MAKEFOURCC('C','E','N','P') /*!< This structure is used to pass decryption status report index for Common
Encryption usage model. See the mfxExtCencParam structure for more details. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used to pass the decryption status report index for the Common Encryption usage model. The application can
attach this extended buffer to the mfxBitstream structure at runtime.
*/
typedef struct _mfxExtCencParam{
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CENC_PARAM. */
mfxU32 StatusReportIndex; /*!< Decryption status report index. */
mfxU32 reserved[15];
} mfxExtCencParam;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif
+234
View File
@@ -0,0 +1,234 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXSESSION_H__
#define __MFXSESSION_H__
#include "mfxcommon.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Global Functions */
/*! Session handle. */
typedef struct _mfxSession *mfxSession;
/*!
@brief
Creates and initializes a session in the legacy mode for compatibility with Intel(r) Media SDK applications.
This function is deprecated starting from API version 2.0, applications must use MFXLoad with mfxCreateSession
to select the implementation and initialize the session.
Call this function before calling
any other API function. If the desired implementation specified by ``impl`` is MFX_IMPL_AUTO,
the function will search for the platform-specific implementation.
If the function cannot find the platform-specific implementation, it will use the software implementation instead.
The ``ver`` argument indicates the desired version of the library implementation.
The loaded implementation will have an API version compatible to the specified version (equal in
the major version number, and no less in the minor version number.) If the desired version
is not specified, the default is to use the API version from the library release with
which an application is built.
Production applications should always specify the minimum API version that meets the
functional requirements. For example, if an application uses only H.264 decoding as described
in API v1.0, the application should initialize the library with API v1.0. This ensures
backward compatibility.
@param[in] impl mfxIMPL enumerator that indicates the desired legacy Intel(r) Media SDK implementation.
@param[in] ver Pointer to the minimum library version or zero, if not specified.
@param[out] session Pointer to the legacy Intel(r) Media SDK session handle.
@return
MFX_ERR_NONE The function completed successfully. The output parameter contains the handle of the session.\n
MFX_ERR_UNSUPPORTED The function cannot find the desired legacy Intel(r) Media SDK implementation or version.
@since This function is available since API version 1.0.
@deprecated Deprecated in API version 2.3. Use MFXLoad and MFXCreateSession to initialize the session.
Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
*/
MFX_DEPRECATED mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session);
/*!
@brief
Creates and initializes a session in the legacy mode for compatibility with Intel(r) Media SDK applications.
This function is deprecated starting from API version 2.0, applications must use MFXLoad with mfxCreateSession
to select the implementation and initialize the session.
Call this function before calling any other API functions.
If the desired implementation specified by ``par`` is MFX_IMPL_AUTO, the function will search for
the platform-specific implementation. If the function cannot find the platform-specific implementation, it will use the software implementation instead.
The argument ``par.Version`` indicates the desired version of the implementation. The loaded implementation will have an API
version compatible to the specified version (equal in the major version number, and no less in the minor version number.)
If the desired version is not specified, the default is to use the API version from the library release with
which an application is built.
Production applications should always specify the minimum API version that meets the functional requirements.
For example, if an application uses only H.264 decoding as described in API v1.0, the application should initialize the library with API v1.0. This ensures backward compatibility.
The argument ``par.ExternalThreads`` specifies threading mode. Value 0 means that the implementation should create and
handle work threads internally (this is essentially the equivalent of the regular MFXInit).
@param[in] par mfxInitParam structure that indicates the desired implementation, minimum library version and desired threading mode.
@param[out] session Pointer to the session handle.
@return
MFX_ERR_NONE The function completed successfully. The output parameter contains the handle of the session.\n
MFX_ERR_UNSUPPORTED The function cannot find the desired implementation or version.
@since This function is available since API version 1.14.
@deprecated Deprecated in API version 2.3. Use MFXLoad and MFXCreateSession to initialize the session.
Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
*/
MFX_DEPRECATED mfxStatus MFX_CDECL MFXInitEx(mfxInitParam par, mfxSession *session);
/*!
@brief
Creates and initializes a session starting from API version 2.0. This function is used by the dispatcher.
The dispatcher creates and fills the mfxInitializationParam structure according to mfxConfig values set by an application.
Calling this function directly is not recommended. Instead, applications must call the MFXCreateSession function.
@param[in] par mfxInitializationParam structure that indicates the minimum library version and acceleration type.
@param[out] session Pointer to the session handle.
@return
MFX_ERR_NONE The function completed successfully. The output parameter contains the handle of the session.\n
MFX_ERR_UNSUPPORTED The function cannot find the desired implementation or version.
@since This function is available since API version 2.0.
*/
mfxStatus MFX_CDECL MFXInitialize(mfxInitializationParam par, mfxSession *session);
/*!
@brief Completes and deinitializes a session. Any active tasks in execution or
in queue are aborted. The application cannot call any API function after calling this function.
All child sessions must be disjoined before closing a parent session.
@param[in] session session handle.
@return MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 1.0.
*/
mfxStatus MFX_CDECL MFXClose(mfxSession session);
/*!
@brief Returns the implementation type of a given session.
@param[in] session Session handle.
@param[out] impl Pointer to the implementation type
@return MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 1.0.
*/
mfxStatus MFX_CDECL MFXQueryIMPL(mfxSession session, mfxIMPL *impl);
/*!
@brief Returns the implementation version.
@param[in] session Session handle.
@param[out] version Pointer to the returned implementation version.
@return MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 1.0.
*/
mfxStatus MFX_CDECL MFXQueryVersion(mfxSession session, mfxVersion *version);
/*!
@brief Joins the child session to the current session.
After joining, the two sessions share thread and resource scheduling for asynchronous
operations. However, each session still maintains its own device manager and buffer/frame
allocator. Therefore, the application must use a compatible device manager and buffer/frame
allocator to share data between two joined sessions.
The application can join multiple sessions by calling this function multiple times. When joining
the first two sessions, the current session becomes the parent responsible for thread and
resource scheduling of any later joined sessions.
Joining of two parent sessions is not supported.
@param[in,out] session The current session handle.
@param[in] child The child session handle to be joined
@return MFX_ERR_NONE The function completed successfully. \n
MFX_WRN_IN_EXECUTION Active tasks are executing or in queue in one of the
sessions. Call this function again after all tasks are completed. \n
MFX_ERR_UNSUPPORTED The child session cannot be joined with the current session.
@since This function is available since API version 1.1.
*/
mfxStatus MFX_CDECL MFXJoinSession(mfxSession session, mfxSession child);
/*!
@brief Removes the joined state of the current session.
After disjoining, the current session becomes independent. The application must ensure there is no active task running in the session before calling this API function.
@param[in,out] session The current session handle.
@return MFX_ERR_NONE The function completed successfully. \n
MFX_WRN_IN_EXECUTION Active tasks are executing or in queue in one of the
sessions. Call this function again after all tasks are completed. \n
MFX_ERR_UNDEFINED_BEHAVIOR The session is independent, or this session is the parent of all joined sessions.
@since This function is available since API version 1.1.
*/
mfxStatus MFX_CDECL MFXDisjoinSession(mfxSession session);
/*!
@brief Creates a clean copy of the current session.
The cloned session is an independent session and does not inherit any user-defined buffer, frame allocator, or device manager handles from the current session.
This function is a light-weight equivalent of MFXJoinSession after MFXInit.
@param[in] session The current session handle.
@param[out] clone Pointer to the cloned session handle.
@return MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 1.1.
*/
mfxStatus MFX_CDECL MFXCloneSession(mfxSession session, mfxSession *clone);
/*!
@brief Sets the current session priority.
@param[in] session The current session handle.
@param[in] priority Priority value.
@return MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 1.1.
*/
mfxStatus MFX_CDECL MFXSetPriority(mfxSession session, mfxPriority priority);
/*!
@brief Returns the current session priority.
@param[in] session The current session handle.
@param[out] priority Pointer to the priority value.
@return MFX_ERR_NONE The function completed successfully.
@since This function is available since API version 1.1.
*/
mfxStatus MFX_CDECL MFXGetPriority(mfxSession session, mfxPriority *priority);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
File diff suppressed because it is too large Load Diff
+184
View File
@@ -0,0 +1,184 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFX_SURFACE_POOL_H__
#define __MFX_SURFACE_POOL_H__
#include "mfxstructures.h"
/*! GUID to obtain mfxSurfacePoolInterface. */
static const mfxGUID MFX_GUID_SURFACE_POOL = {{0x35, 0x24, 0xf3, 0xda, 0x96, 0x4e, 0x47, 0xf1, 0xaf, 0xb4, 0xec, 0xb1, 0x15, 0x08, 0x06, 0xb1}};
/*! Specifies type of pool for VPP component. */
typedef enum {
MFX_VPP_POOL_IN = 0, /*!< Input pool. */
MFX_VPP_POOL_OUT = 1 /*!< Output pool. */
} mfxVPPPoolType;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The extension buffer specifies surface pool management policy.
Absence of the attached buffer means MFX_ALLOCATION_UNLIMITED policy:
each call of GetSurfaceForXXX leads to surface allocation.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ALLOCATION_HINTS. */
mfxPoolAllocationPolicy AllocationPolicy; /*!< Allocation policy. */
/*! How many surfaces to allocate during Init.
It's applicable for any polices set by mfxPoolAllocationPolicy::AllocationPolicy
even if the requested number exceeds recommended size of the pool. */
mfxU32 NumberToPreAllocate;
/*! DeltaToAllocateOnTheFly specifies how many surfaces are allocated
in addition to NumberToPreAllocate in MFX_ALLOCATION_LIMITED mode.
Maximum number of allocated frames will be
NumberToPreAllocate + DeltaToAllocateOnTheFly.
*/
mfxU32 DeltaToAllocateOnTheFly;
union {
mfxVPPPoolType VPPPoolType; /*!< Defines what VPP pool is targeted - input or output. Ignored for other components. */
mfxU32 reserved;
};
mfxU32 Wait; /*!< Time in milliseconds for GetSurfaceForXXX() and DecodeFrameAsync functions to wait until surface will be available. */
mfxU32 reserved1[4]; /*!< Reserved for future use */
} mfxExtAllocationHints;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Specifies the surface pool interface. */
typedef struct mfxSurfacePoolInterface
{
mfxHDL Context; /*!< The context of the surface pool interface. User should not touch (change, set, null) this pointer. */
/*! @brief
Increments the internal reference counter of the mfxSurfacePoolInterface. The mfxSurfacePoolInterface is not destroyed until the
mfxSurfacePoolInterface is destroyed with mfxSurfacePoolInterface::Release function. mfxSurfacePoolInterface::AddRef should be used each time a new link to the
mfxSurfacePoolInterface is created for proper management.
@param[in] pool Valid pool.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *AddRef)(struct mfxSurfacePoolInterface *pool);
/*! @brief
Decrements the internal reference counter of the mfxSurfacePoolInterface. mfxSurfacePoolInterface::Release
should be called after using the mfxSurfacePoolInterface::AddRef function to add a mfxSurfacePoolInterface or when allocation logic requires it.
For example, call mfxSurfacePoolInterface::Release to release a mfxSurfacePoolInterface obtained with
the mfxFrameSurfaceInterface::QueryInterface function.
@param[in] pool Valid pool.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of mfxSurfacePoolInterface is zero before call. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Release)(struct mfxSurfacePoolInterface *pool);
/*! @brief
Returns current reference counter of mfxSurfacePoolInterface structure.
@param[in] pool Valid pool.
@param[out] counter Sets counter to the current reference counter value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool or counter is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetRefCounter)(struct mfxSurfacePoolInterface *pool, mfxU32* counter);
/*! @brief
The function should be called by oneAPI Video Processing Library (oneVPL) components or application to specify how many surfaces
it will use concurrently.
Internally, oneVPL allocates surfaces in the shared pool according to the component's policy set by mfxPoolAllocationPolicy.
The exact moment of surfaces allocation is defined by the component and generally independent from that call.
@param[in] pool Valid pool.
@param[in] num_surfaces The number of surfaces required by the component.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_WRN_INCOMPATIBLE_VIDEO_PARAM If pool has MFX_ALLOCATION_UNLIMITED or MFX_ALLOCATION_LIMITED policy. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *SetNumSurfaces)(struct mfxSurfacePoolInterface *pool, mfxU32 num_surfaces);
/*! @brief
The function should be called by oneVPL components when component is closed or reset and doesn't need to use pool more. It helps
to manage memory accordingly and release redundant memory. Important to specify the same number of surfaces which is requested
during SetNumSurfaces call, otherwise it may lead to the pipeline stalls.
@param[in] pool Valid pool.
@param[in] num_surfaces The number of surfaces used by the component.
@return
MFX_ERR_NONE If no error. \n
MFX_WRN_OUT_OF_RANGE If num_surfaces doesn't equal to num_surfaces requested during SetNumSurfaces call. \n
MFX_ERR_NULL_PTR If pool is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_WRN_INCOMPATIBLE_VIDEO_PARAM If pool has MFX_ALLOCATION_UNLIMITED or MFX_ALLOCATION_LIMITED policy. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *RevokeSurfaces)(struct mfxSurfacePoolInterface *pool, mfxU32 num_surfaces);
/*! @brief
Returns current allocation policy.
@param[in] pool Valid pool.
@param[out] policy Sets policy to the current allocation policy value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool or policy is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetAllocationPolicy)(struct mfxSurfacePoolInterface *pool, mfxPoolAllocationPolicy *policy);
/*! @brief
Returns maximum pool size. In case of mfxPoolAllocationPolicy::MFX_ALLOCATION_UNLIMITED policy 0xFFFFFFFF will be returned.
@param[in] pool Valid pool.
@param[out] size Sets size to the maximum pool size value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool or size is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetMaximumPoolSize)(struct mfxSurfacePoolInterface *pool, mfxU32 *size);
/*! @brief
Returns current pool size.
@param[in] pool Valid pool.
@param[out] size Sets size to the current pool size value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If pool or size is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfacePoolInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetCurrentPoolSize)(struct mfxSurfacePoolInterface *pool, mfxU32 *size);
mfxHDL reserved[4]; /*!< Reserved for future use. */
} mfxSurfacePoolInterface;
MFX_PACK_END()
#endif /* __MFX_SURFACE_POOL_H__ */
+594
View File
@@ -0,0 +1,594 @@
/*###########################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
###########################################################################*/
#ifndef __MFXVIDEOPLUSPLUS_H
#define __MFXVIDEOPLUSPLUS_H
#ifdef MFXVIDEO_CPP_ENABLE_MFXLOAD
#include "vpl/mfx.h"
#define MFX_IMPL_ACCELMODE(x) (0xff00 & (x))
#else
#include "mfxvideo.h"
#endif
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;
#ifdef MFXVIDEO_CPP_ENABLE_MFXLOAD
m_loader = (mfxLoader)0;
#endif
}
virtual ~MFXVideoSession(void) {
Close();
}
virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) override {
#ifdef MFXVIDEO_CPP_ENABLE_MFXLOAD
mfxInitParam par = {};
par.Implementation = impl;
par.Version = *ver;
return InitSession(par);
#else
return MFXInit(impl, ver, &m_session);
#endif
}
virtual mfxStatus InitEx(mfxInitParam par) override {
#ifdef MFXVIDEO_CPP_ENABLE_MFXLOAD
return InitSession(par);
#else
return MFXInitEx(par, &m_session);
#endif
}
virtual mfxStatus Close(void) override {
#ifdef MFXVIDEO_CPP_ENABLE_MFXLOAD
if (m_session) {
mfxStatus mfxRes;
mfxRes = MFXClose(m_session);
m_session = (mfxSession)0;
if (m_loader) {
MFXUnload(m_loader);
m_loader = (mfxLoader)0;
}
return mfxRes;
}
else {
return MFX_ERR_NONE;
}
#else
mfxStatus mfxRes;
mfxRes = MFXClose(m_session);
m_session = (mfxSession)0;
return mfxRes;
#endif
}
virtual mfxStatus QueryIMPL(mfxIMPL *impl) override {
return MFXQueryIMPL(m_session, impl);
}
virtual mfxStatus QueryVersion(mfxVersion *version) override {
return MFXQueryVersion(m_session, version);
}
virtual mfxStatus JoinSession(mfxSession child_session) override {
return MFXJoinSession(m_session, child_session);
}
virtual mfxStatus DisjoinSession() override {
return MFXDisjoinSession(m_session);
}
virtual mfxStatus CloneSession(mfxSession *clone) override {
return MFXCloneSession(m_session, clone);
}
virtual mfxStatus SetPriority(mfxPriority priority) override {
return MFXSetPriority(m_session, priority);
}
virtual mfxStatus GetPriority(mfxPriority *priority) override {
return MFXGetPriority(m_session, priority);
}
virtual mfxStatus SetFrameAllocator(mfxFrameAllocator *allocator) override {
return MFXVideoCORE_SetFrameAllocator(m_session, allocator);
}
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) override {
return MFXVideoCORE_SetHandle(m_session, type, hdl);
}
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *hdl) override {
return MFXVideoCORE_GetHandle(m_session, type, hdl);
}
virtual mfxStatus QueryPlatform(mfxPlatform *platform) override {
return MFXVideoCORE_QueryPlatform(m_session, platform);
}
virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) override {
return MFXVideoCORE_SyncOperation(m_session, syncp, wait);
}
virtual mfxStatus GetSurfaceForEncode(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForEncode(m_session, output_surf);
}
virtual mfxStatus GetSurfaceForDecode(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForDecode(m_session, output_surf);
}
virtual mfxStatus GetSurfaceForVPP (mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPP (m_session, output_surf);
}
virtual mfxStatus GetSurfaceForVPPOut(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf);
}
virtual operator mfxSession(void) override {
return m_session;
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
#ifdef MFXVIDEO_CPP_ENABLE_MFXLOAD
mfxLoader m_loader;
inline void InitVariant(mfxVariant *var, mfxU32 data) {
var->Version.Version = (mfxU16)MFX_VARIANT_VERSION;
var->Type = MFX_VARIANT_TYPE_U32;
var->Data.U32 = data;
}
inline void InitVariant(mfxVariant *var, mfxU16 data) {
var->Version.Version = (mfxU16)MFX_VARIANT_VERSION;
var->Type = MFX_VARIANT_TYPE_U16;
var->Data.U16 = data;
}
inline void InitVariant(mfxVariant *var, mfxHDL data) {
var->Version.Version = (mfxU16)MFX_VARIANT_VERSION;
var->Type = MFX_VARIANT_TYPE_PTR;
var->Data.Ptr = data;
}
template <typename varDataType>
mfxStatus CreateConfig(varDataType data, const char *propertyName) {
mfxConfig cfg = MFXCreateConfig(m_loader);
if (cfg == nullptr)
return MFX_ERR_NULL_PTR;
mfxVariant variant;
InitVariant(&variant, data);
return MFXSetConfigFilterProperty(cfg, (mfxU8 *)propertyName, variant);
}
mfxStatus InitSession(mfxInitParam par) {
// already initialized
if (m_session)
return MFX_ERR_NONE;
m_loader = MFXLoad();
if (!m_loader)
return MFX_ERR_NOT_FOUND;
mfxStatus mfxRes = MFX_ERR_NONE;
mfxU32 implBaseType = MFX_IMPL_BASETYPE(par.Implementation);
// select implementation type
switch (implBaseType) {
case MFX_IMPL_AUTO:
case MFX_IMPL_AUTO_ANY:
break;
case MFX_IMPL_SOFTWARE:
mfxRes = CreateConfig<mfxU32>(MFX_IMPL_TYPE_SOFTWARE, "mfxImplDescription.Impl");
break;
case MFX_IMPL_HARDWARE:
case MFX_IMPL_HARDWARE_ANY:
case MFX_IMPL_HARDWARE2:
case MFX_IMPL_HARDWARE3:
case MFX_IMPL_HARDWARE4:
mfxRes = CreateConfig<mfxU32>(MFX_IMPL_TYPE_HARDWARE, "mfxImplDescription.Impl");
break;
default:
mfxRes = MFX_ERR_UNSUPPORTED;
break;
}
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
// select adapter index (if specified)
// see notes below about how VendorImplID is interpreted for each acceleration mode
switch (implBaseType) {
case MFX_IMPL_HARDWARE:
mfxRes = CreateConfig<mfxU32>(0, "mfxImplDescription.VendorImplID");
break;
case MFX_IMPL_HARDWARE2:
mfxRes = CreateConfig<mfxU32>(1, "mfxImplDescription.VendorImplID");
break;
case MFX_IMPL_HARDWARE3:
mfxRes = CreateConfig<mfxU32>(2, "mfxImplDescription.VendorImplID");
break;
case MFX_IMPL_HARDWARE4:
mfxRes = CreateConfig<mfxU32>(3, "mfxImplDescription.VendorImplID");
break;
}
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
mfxU32 implAccelMode = MFX_IMPL_ACCELMODE(par.Implementation);
if (implAccelMode == MFX_IMPL_VIA_D3D9) {
// D3D9 - because VendorImplID corresponds to DXGI adapter index (DX11 enumeration),
// this may not map directly to D3D9 index in multi-adapter/multi-monitor configurations
mfxRes = CreateConfig<mfxU32>(MFX_ACCEL_MODE_VIA_D3D9,
"mfxImplDescription.AccelerationMode");
}
else if (implAccelMode == MFX_IMPL_VIA_D3D11) {
// D3D11 - VendorImplID corresponds to DXGI adapter index
mfxRes = CreateConfig<mfxU32>(MFX_ACCEL_MODE_VIA_D3D11,
"mfxImplDescription.AccelerationMode");
}
else if (implAccelMode == MFX_IMPL_VIA_VAAPI) {
// VAAPI - in general MFXInitEx treats any HARDWAREn the same way (relies on application to pass
// correct VADisplay via SetHandle), but 2.x RT only reports actual number of adapters
mfxRes = CreateConfig<mfxU32>(MFX_ACCEL_MODE_VIA_VAAPI,
"mfxImplDescription.AccelerationMode");
}
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
// set required API level
mfxRes =
CreateConfig<mfxU32>(par.Version.Version, "mfxImplDescription.ApiVersion.Version");
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
// set GPUCopy parameter
if (par.GPUCopy) {
mfxRes = CreateConfig<mfxU16>(par.GPUCopy, "DeviceCopy");
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
}
// ExternalThreads was deprecated in API 2.x along with MFXDoWork()
if (par.ExternalThreads) {
return MFX_ERR_UNSUPPORTED;
}
// pass extBufs
if (par.NumExtParam) {
for (mfxU32 idx = 0; idx < par.NumExtParam; idx++) {
mfxRes = CreateConfig<mfxHDL>(par.ExtParam[idx], "ExtBuffer");
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
}
}
// create session with highest priority implementation remaining after filters
mfxRes = MFXCreateSession(m_loader, 0, &m_session);
return mfxRes;
}
#endif
private:
MFXVideoSession(const MFXVideoSession &);
void operator=(MFXVideoSession &);
};
class MFXVideoENCODE : public MFXVideoENCODEBase {
public:
explicit MFXVideoENCODE(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoENCODE(void) {
Close();
}
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
return MFXVideoENCODE_Query(m_session, in, out);
}
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override {
return MFXVideoENCODE_QueryIOSurf(m_session, par, request);
}
virtual mfxStatus Init(mfxVideoParam *par) override {
return MFXVideoENCODE_Init(m_session, par);
}
virtual mfxStatus Reset(mfxVideoParam *par) override {
return MFXVideoENCODE_Reset(m_session, par);
}
virtual mfxStatus Close(void) override {
return MFXVideoENCODE_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
return MFXVideoENCODE_GetVideoParam(m_session, par);
}
virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) override {
return MFXVideoENCODE_GetEncodeStat(m_session, stat);
}
virtual mfxStatus EncodeFrameAsync(mfxEncodeCtrl *ctrl,
mfxFrameSurface1 *surface,
mfxBitstream *bs,
mfxSyncPoint *syncp) override {
return MFXVideoENCODE_EncodeFrameAsync(m_session, ctrl, surface, bs, syncp);
}
virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForEncode(m_session, output_surf);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
private:
MFXVideoENCODE(const MFXVideoENCODE& other);
MFXVideoENCODE& operator=(const MFXVideoENCODE& other);
};
class MFXVideoDECODE : public MFXVideoDECODEBase {
public:
explicit MFXVideoDECODE(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoDECODE(void) {
Close();
}
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
return MFXVideoDECODE_Query(m_session, in, out);
}
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) override {
return MFXVideoDECODE_DecodeHeader(m_session, bs, par);
}
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override {
return MFXVideoDECODE_QueryIOSurf(m_session, par, request);
}
virtual mfxStatus Init(mfxVideoParam *par) override {
return MFXVideoDECODE_Init(m_session, par);
}
virtual mfxStatus Reset(mfxVideoParam *par) override {
return MFXVideoDECODE_Reset(m_session, par);
}
virtual mfxStatus Close(void) override {
return MFXVideoDECODE_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
return MFXVideoDECODE_GetVideoParam(m_session, par);
}
virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) override {
return MFXVideoDECODE_GetDecodeStat(m_session, stat);
}
virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) override {
return MFXVideoDECODE_GetPayload(m_session, ts, payload);
}
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) override {
return MFXVideoDECODE_DecodeFrameAsync(m_session, bs, surface_work, surface_out, syncp);
}
virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForDecode(m_session, output_surf);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
private:
MFXVideoDECODE(const MFXVideoDECODE& other);
MFXVideoDECODE& operator=(const MFXVideoDECODE& other);
};
class MFXVideoVPP : public MFXVideoVPPBase {
public:
explicit MFXVideoVPP(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoVPP(void) {
Close();
}
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
return MFXVideoVPP_Query(m_session, in, out);
}
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest request[2]) override {
return MFXVideoVPP_QueryIOSurf(m_session, par, request);
}
virtual mfxStatus Init(mfxVideoParam *par) override {
return MFXVideoVPP_Init(m_session, par);
}
virtual mfxStatus Reset(mfxVideoParam *par) override {
return MFXVideoVPP_Reset(m_session, par);
}
virtual mfxStatus Close(void) override {
return MFXVideoVPP_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
return MFXVideoVPP_GetVideoParam(m_session, par);
}
virtual mfxStatus GetVPPStat(mfxVPPStat *stat) override {
return MFXVideoVPP_GetVPPStat(m_session, stat);
}
virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in,
mfxFrameSurface1 *out,
mfxExtVppAuxData *aux,
mfxSyncPoint *syncp) override {
return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp);
}
virtual mfxStatus GetSurfaceIn(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPP(m_session, output_surf);
}
virtual mfxStatus GetSurfaceOut(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf);
}
virtual mfxStatus ProcessFrameAsync(mfxFrameSurface1 *in, mfxFrameSurface1 **out) override {
return MFXVideoVPP_ProcessFrameAsync(m_session, in, out);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
private:
MFXVideoVPP(const MFXVideoVPP& other);
MFXVideoVPP& operator=(const MFXVideoVPP& other);
};
class MFXVideoDECODE_VPP
{
public:
explicit MFXVideoDECODE_VPP(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoDECODE_VPP(void) {
Close();
}
virtual mfxStatus Init(mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) {
return MFXVideoDECODE_VPP_Init(m_session, decode_par, vpp_par_array, num_channel_par);
}
virtual mfxStatus Reset(mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) {
return MFXVideoDECODE_VPP_Reset(m_session, decode_par, vpp_par_array, num_channel_par);
}
virtual mfxStatus GetChannelParam(mfxVideoChannelParam *par, mfxU32 channel_id) {
return MFXVideoDECODE_VPP_GetChannelParam(m_session, par, channel_id);
}
virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxU32* skip_channels, mfxU32 num_skip_channels, mfxSurfaceArray **surf_array_out) {
return MFXVideoDECODE_VPP_DecodeFrameAsync(m_session, bs, skip_channels, num_skip_channels, surf_array_out);
}
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) {
return MFXVideoDECODE_VPP_DecodeHeader(m_session, bs, par);
}
virtual mfxStatus Close(void) {
return MFXVideoDECODE_VPP_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) {
return MFXVideoDECODE_VPP_GetVideoParam(m_session, par);
}
virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) {
return MFXVideoDECODE_VPP_GetDecodeStat(m_session, stat);
}
virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) {
return MFXVideoDECODE_VPP_GetPayload(m_session, ts, payload);
}
virtual mfxStatus SetSkipMode(mfxSkipMode mode) {
return MFXVideoDECODE_VPP_SetSkipMode(m_session, mode);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
private:
MFXVideoDECODE_VPP(const MFXVideoDECODE_VPP& other);
MFXVideoDECODE_VPP& operator=(const MFXVideoDECODE_VPP& other);
};
#endif //__MFXVIDEOPLUSPLUS_H
File diff suppressed because it is too large Load Diff
+65
View File
@@ -0,0 +1,65 @@
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXVP8_H__
#define __MFXVP8_H__
#include "mfxdefs.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
MFX_CODEC_VP8 = MFX_MAKEFOURCC('V','P','8',' '),
};
/* VP8 CodecProfile*/
enum {
MFX_PROFILE_VP8_0 = 0+1,
MFX_PROFILE_VP8_1 = 1+1,
MFX_PROFILE_VP8_2 = 2+1,
MFX_PROFILE_VP8_3 = 3+1,
};
/* Extended Buffer Ids */
enum {
/*!
This extended buffer describes VP8 encoder configuration parameters. See the mfxExtVP8CodingOption structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding initialization.
*/
MFX_EXTBUFF_VP8_CODING_OPTION = MFX_MAKEFOURCC('V','P','8','E'),
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Describes VP8 coding options. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP8_CODING_OPTION. */
mfxU16 Version; /*!< Determines the bitstream version. Corresponds to the same VP8 syntax element in frame_tag. */
mfxU16 EnableMultipleSegments; /*!< Set this option to ON to enable segmentation. This is tri-state option. See the CodingOptionValue
enumerator for values of this option. */
mfxU16 LoopFilterType; /*!< Select the type of filter (normal or simple). Corresponds to VP8 syntax element filter_type. */
mfxU16 LoopFilterLevel[4]; /*!< Controls the filter strength. Corresponds to VP8 syntax element loop_filter_level. */
mfxU16 SharpnessLevel; /*!< Controls the filter sensitivity. Corresponds to VP8 syntax element sharpness_level. */
mfxU16 NumTokenPartitions; /*!< Specifies number of token partitions in the coded frame. */
mfxI16 LoopFilterRefTypeDelta[4]; /*!< Loop filter level delta for reference type (intra, last, golden, altref). */
mfxI16 LoopFilterMbModeDelta[4]; /*!< Loop filter level delta for MB modes. */
mfxI16 SegmentQPDelta[4]; /*!< QP delta for segment. */
mfxI16 CoeffTypeQPDelta[5]; /*!< QP delta for coefficient type (YDC, Y2AC, Y2DC, UVAC, UVDC). */
mfxU16 WriteIVFHeaders; /*!< Set this option to ON to enable insertion of IVF container headers into bitstream. This is tri-state
option. See the CodingOptionValue enumerator for values of this option */
mfxU32 NumFramesForIVFHeader; /*!< Specifies number of frames for IVF header when WriteIVFHeaders is ON. */
mfxU16 reserved[223];
} mfxExtVP8CodingOption;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif
#endif
@@ -0,0 +1,2 @@
The files in this preview folder are provided as a preview of upcoming features.
The content of this folder may be changed or removed without respect for backward compatibility.
@@ -0,0 +1,25 @@
The file preview/legacy/mfxvideo++.h is a preview implementation of "class
MFXVideoSession" which takes advantage of API 2.0 functions of the
Intel® Video Processing Library (Intel® VPL) for implementation selection and
session creation.
Known limitations:
- The parameter mfxInitParam.ExternalThreads is not supported.
- The API version returned by MFXVideoSession::QueryVersion() may be different
on platforms for which libmfx-gen is the default runtime implementation.
- On Windows, accelerators selected using MFX_IMPL_HARDWARE, MFX_IMPL_HARDWARE2,
MFX_IMPL_HARDWARE3, or MFX_IMPL_HARDWARE4 are always enumerated according to
IDXGIFactory::EnumAdapters (i.e. D3D11) indexes, regardless of the
acceleration mode selected. On a multi-monitor or multi-adapter system, D3D9
and D3D11 adapter indexing may not match. Applications needing to create a
session on a specific D3D9 adapter should instead use the Dispatcher
Configuration Property mfxExtendedDeviceId.DeviceLUID to select the desired
adapter.
- Identical behavior between the production implementation of mfxvideo++.h and
the preview is not guaranteed. Applications may however define
MFXVIDEO_CPP_USE_DEPRECATED when compiling the preview application to build
with the previous implementation.
@@ -0,0 +1,581 @@
/*###########################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
###########################################################################*/
#ifndef __MFXVIDEOPLUSPLUS_H
#define __MFXVIDEOPLUSPLUS_H
#include "vpl/mfx.h"
#define MFX_IMPL_ACCELMODE(x) (0xff00 & (x))
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;
#ifndef MFXVIDEO_CPP_USE_DEPRECATED
m_loader = (mfxLoader)0;
#endif
}
virtual ~MFXVideoSession(void) {
Close();
}
virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) override {
#ifndef MFXVIDEO_CPP_USE_DEPRECATED
mfxInitParam par = {};
par.Implementation = impl;
par.Version = *ver;
return InitSession(par);
#else
return MFXInit(impl, ver, &m_session);
#endif
}
virtual mfxStatus InitEx(mfxInitParam par) override {
#ifndef MFXVIDEO_CPP_USE_DEPRECATED
return InitSession(par);
#else
return MFXInitEx(par, &m_session);
#endif
}
virtual mfxStatus Close(void) override {
#ifndef MFXVIDEO_CPP_USE_DEPRECATED
if (m_session) {
mfxStatus mfxRes;
mfxRes = MFXClose(m_session);
m_session = (mfxSession)0;
if (m_loader) {
MFXUnload(m_loader);
m_loader = (mfxLoader)0;
}
return mfxRes;
}
else {
return MFX_ERR_NONE;
}
#else
mfxStatus mfxRes;
mfxRes = MFXClose(m_session);
m_session = (mfxSession)0;
return mfxRes;
#endif
}
virtual mfxStatus QueryIMPL(mfxIMPL *impl) override {
return MFXQueryIMPL(m_session, impl);
}
virtual mfxStatus QueryVersion(mfxVersion *version) override {
return MFXQueryVersion(m_session, version);
}
virtual mfxStatus JoinSession(mfxSession child_session) override {
return MFXJoinSession(m_session, child_session);
}
virtual mfxStatus DisjoinSession() override {
return MFXDisjoinSession(m_session);
}
virtual mfxStatus CloneSession(mfxSession *clone) override {
return MFXCloneSession(m_session, clone);
}
virtual mfxStatus SetPriority(mfxPriority priority) override {
return MFXSetPriority(m_session, priority);
}
virtual mfxStatus GetPriority(mfxPriority *priority) override {
return MFXGetPriority(m_session, priority);
}
virtual mfxStatus SetFrameAllocator(mfxFrameAllocator *allocator) override {
return MFXVideoCORE_SetFrameAllocator(m_session, allocator);
}
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) override {
return MFXVideoCORE_SetHandle(m_session, type, hdl);
}
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *hdl) override {
return MFXVideoCORE_GetHandle(m_session, type, hdl);
}
virtual mfxStatus QueryPlatform(mfxPlatform *platform) override {
return MFXVideoCORE_QueryPlatform(m_session, platform);
}
virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) override {
return MFXVideoCORE_SyncOperation(m_session, syncp, wait);
}
virtual mfxStatus GetSurfaceForEncode(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForEncode(m_session, output_surf);
}
virtual mfxStatus GetSurfaceForDecode(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForDecode(m_session, output_surf);
}
virtual mfxStatus GetSurfaceForVPP (mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPP (m_session, output_surf);
}
virtual mfxStatus GetSurfaceForVPPOut(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf);
}
virtual operator mfxSession(void) override {
return m_session;
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
#ifndef MFXVIDEO_CPP_USE_DEPRECATED
mfxLoader m_loader;
inline void InitVariant(mfxVariant *var, mfxU32 data) {
var->Version.Version = (mfxU16)MFX_VARIANT_VERSION;
var->Type = MFX_VARIANT_TYPE_U32;
var->Data.U32 = data;
}
inline void InitVariant(mfxVariant *var, mfxU16 data) {
var->Version.Version = (mfxU16)MFX_VARIANT_VERSION;
var->Type = MFX_VARIANT_TYPE_U16;
var->Data.U16 = data;
}
inline void InitVariant(mfxVariant *var, mfxHDL data) {
var->Version.Version = (mfxU16)MFX_VARIANT_VERSION;
var->Type = MFX_VARIANT_TYPE_PTR;
var->Data.Ptr = data;
}
template <typename varDataType>
mfxStatus CreateConfig(varDataType data, const char *propertyName) {
mfxConfig cfg = MFXCreateConfig(m_loader);
if (cfg == nullptr)
return MFX_ERR_NULL_PTR;
mfxVariant variant;
InitVariant(&variant, data);
return MFXSetConfigFilterProperty(cfg, (mfxU8 *)propertyName, variant);
}
mfxStatus InitSession(mfxInitParam par) {
// already initialized
if (m_session)
return MFX_ERR_NONE;
m_loader = MFXLoad();
if (!m_loader)
return MFX_ERR_NOT_FOUND;
mfxStatus mfxRes = MFX_ERR_NONE;
mfxU32 implBaseType = MFX_IMPL_BASETYPE(par.Implementation);
// select implementation type
switch (implBaseType) {
case MFX_IMPL_AUTO:
case MFX_IMPL_AUTO_ANY:
break;
case MFX_IMPL_SOFTWARE:
mfxRes = CreateConfig<mfxU32>(MFX_IMPL_TYPE_SOFTWARE, "mfxImplDescription.Impl");
break;
case MFX_IMPL_HARDWARE:
case MFX_IMPL_HARDWARE_ANY:
case MFX_IMPL_HARDWARE2:
case MFX_IMPL_HARDWARE3:
case MFX_IMPL_HARDWARE4:
mfxRes = CreateConfig<mfxU32>(MFX_IMPL_TYPE_HARDWARE, "mfxImplDescription.Impl");
break;
default:
mfxRes = MFX_ERR_UNSUPPORTED;
break;
}
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
// select adapter index (if specified)
// see notes below about how VendorImplID is interpreted for each acceleration mode
switch (implBaseType) {
case MFX_IMPL_HARDWARE:
mfxRes = CreateConfig<mfxU32>(0, "mfxImplDescription.VendorImplID");
break;
case MFX_IMPL_HARDWARE2:
mfxRes = CreateConfig<mfxU32>(1, "mfxImplDescription.VendorImplID");
break;
case MFX_IMPL_HARDWARE3:
mfxRes = CreateConfig<mfxU32>(2, "mfxImplDescription.VendorImplID");
break;
case MFX_IMPL_HARDWARE4:
mfxRes = CreateConfig<mfxU32>(3, "mfxImplDescription.VendorImplID");
break;
}
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
mfxU32 implAccelMode = MFX_IMPL_ACCELMODE(par.Implementation);
if (implAccelMode == MFX_IMPL_VIA_D3D9) {
// D3D9 - because VendorImplID corresponds to DXGI adapter index (DX11 enumeration),
// this may not map directly to D3D9 index in multi-adapter/multi-monitor configurations
mfxRes = CreateConfig<mfxU32>(MFX_ACCEL_MODE_VIA_D3D9,
"mfxImplDescription.AccelerationMode");
}
else if (implAccelMode == MFX_IMPL_VIA_D3D11) {
// D3D11 - VendorImplID corresponds to DXGI adapter index
mfxRes = CreateConfig<mfxU32>(MFX_ACCEL_MODE_VIA_D3D11,
"mfxImplDescription.AccelerationMode");
}
else if (implAccelMode == MFX_IMPL_VIA_VAAPI) {
// VAAPI - in general MFXInitEx treats any HARDWAREn the same way (relies on application to pass
// correct VADisplay via SetHandle), but 2.x RT only reports actual number of adapters
mfxRes = CreateConfig<mfxU32>(MFX_ACCEL_MODE_VIA_VAAPI,
"mfxImplDescription.AccelerationMode");
}
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
// set required API level
mfxRes =
CreateConfig<mfxU32>(par.Version.Version, "mfxImplDescription.ApiVersion.Version");
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
// set GPUCopy parameter
if (par.GPUCopy) {
mfxRes = CreateConfig<mfxU16>(par.GPUCopy, "DeviceCopy");
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
}
// set ExternalThreads parameter
if (par.ExternalThreads) {
// TO DO - need to add this as config filter property and member of mfxInitializationParam
return MFX_ERR_UNSUPPORTED;
}
// pass extBufs
if (par.NumExtParam) {
for (mfxU32 idx = 0; idx < par.NumExtParam; idx++) {
mfxRes = CreateConfig<mfxHDL>(par.ExtParam[idx], "ExtBuffer");
if (MFX_ERR_NONE != mfxRes)
return MFX_ERR_UNSUPPORTED;
}
}
// create session with highest priority implementation remaining after filters
mfxRes = MFXCreateSession(m_loader, 0, &m_session);
return mfxRes;
}
#endif
private:
MFXVideoSession(const MFXVideoSession &);
void operator=(MFXVideoSession &);
};
class MFXVideoENCODE : public MFXVideoENCODEBase {
public:
explicit MFXVideoENCODE(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoENCODE(void) {
Close();
}
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
return MFXVideoENCODE_Query(m_session, in, out);
}
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override {
return MFXVideoENCODE_QueryIOSurf(m_session, par, request);
}
virtual mfxStatus Init(mfxVideoParam *par) override {
return MFXVideoENCODE_Init(m_session, par);
}
virtual mfxStatus Reset(mfxVideoParam *par) override {
return MFXVideoENCODE_Reset(m_session, par);
}
virtual mfxStatus Close(void) override {
return MFXVideoENCODE_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
return MFXVideoENCODE_GetVideoParam(m_session, par);
}
virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) override {
return MFXVideoENCODE_GetEncodeStat(m_session, stat);
}
virtual mfxStatus EncodeFrameAsync(mfxEncodeCtrl *ctrl,
mfxFrameSurface1 *surface,
mfxBitstream *bs,
mfxSyncPoint *syncp) override {
return MFXVideoENCODE_EncodeFrameAsync(m_session, ctrl, surface, bs, syncp);
}
virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForEncode(m_session, output_surf);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
};
class MFXVideoDECODE : public MFXVideoDECODEBase {
public:
explicit MFXVideoDECODE(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoDECODE(void) {
Close();
}
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
return MFXVideoDECODE_Query(m_session, in, out);
}
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) override {
return MFXVideoDECODE_DecodeHeader(m_session, bs, par);
}
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override {
return MFXVideoDECODE_QueryIOSurf(m_session, par, request);
}
virtual mfxStatus Init(mfxVideoParam *par) override {
return MFXVideoDECODE_Init(m_session, par);
}
virtual mfxStatus Reset(mfxVideoParam *par) override {
return MFXVideoDECODE_Reset(m_session, par);
}
virtual mfxStatus Close(void) override {
return MFXVideoDECODE_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
return MFXVideoDECODE_GetVideoParam(m_session, par);
}
virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) override {
return MFXVideoDECODE_GetDecodeStat(m_session, stat);
}
virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) override {
return MFXVideoDECODE_GetPayload(m_session, ts, payload);
}
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) override {
return MFXVideoDECODE_DecodeFrameAsync(m_session, bs, surface_work, surface_out, syncp);
}
virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForDecode(m_session, output_surf);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
};
class MFXVideoVPP : public MFXVideoVPPBase {
public:
explicit MFXVideoVPP(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoVPP(void) {
Close();
}
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
return MFXVideoVPP_Query(m_session, in, out);
}
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest request[2]) override {
return MFXVideoVPP_QueryIOSurf(m_session, par, request);
}
virtual mfxStatus Init(mfxVideoParam *par) override {
return MFXVideoVPP_Init(m_session, par);
}
virtual mfxStatus Reset(mfxVideoParam *par) override {
return MFXVideoVPP_Reset(m_session, par);
}
virtual mfxStatus Close(void) override {
return MFXVideoVPP_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
return MFXVideoVPP_GetVideoParam(m_session, par);
}
virtual mfxStatus GetVPPStat(mfxVPPStat *stat) override {
return MFXVideoVPP_GetVPPStat(m_session, stat);
}
virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in,
mfxFrameSurface1 *out,
mfxExtVppAuxData *aux,
mfxSyncPoint *syncp) override {
return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp);
}
virtual mfxStatus GetSurfaceIn(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPP(m_session, output_surf);
}
virtual mfxStatus GetSurfaceOut(mfxFrameSurface1** output_surf) override {
return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf);
}
virtual mfxStatus ProcessFrameAsync(mfxFrameSurface1 *in, mfxFrameSurface1 **out) override {
return MFXVideoVPP_ProcessFrameAsync(m_session, in, out);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
};
class MFXVideoDECODE_VPP
{
public:
explicit MFXVideoDECODE_VPP(mfxSession session) {
m_session = session;
}
virtual ~MFXVideoDECODE_VPP(void) {
Close();
}
virtual mfxStatus Init(mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) {
return MFXVideoDECODE_VPP_Init(m_session, decode_par, vpp_par_array, num_channel_par);
}
virtual mfxStatus Reset(mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) {
return MFXVideoDECODE_VPP_Reset(m_session, decode_par, vpp_par_array, num_channel_par);
}
virtual mfxStatus GetChannelParam(mfxVideoChannelParam *par, mfxU32 channel_id) {
return MFXVideoDECODE_VPP_GetChannelParam(m_session, par, channel_id);
}
virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxU32* skip_channels, mfxU32 num_skip_channels, mfxSurfaceArray **surf_array_out) {
return MFXVideoDECODE_VPP_DecodeFrameAsync(m_session, bs, skip_channels, num_skip_channels, surf_array_out);
}
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) {
return MFXVideoDECODE_VPP_DecodeHeader(m_session, bs, par);
}
virtual mfxStatus Close(void) {
return MFXVideoDECODE_VPP_Close(m_session);
}
virtual mfxStatus GetVideoParam(mfxVideoParam *par) {
return MFXVideoDECODE_VPP_GetVideoParam(m_session, par);
}
virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) {
return MFXVideoDECODE_VPP_GetDecodeStat(m_session, stat);
}
virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) {
return MFXVideoDECODE_VPP_GetPayload(m_session, ts, payload);
}
virtual mfxStatus SetSkipMode(mfxSkipMode mode) {
return MFXVideoDECODE_VPP_SetSkipMode(m_session, mode);
}
protected:
mfxSession m_session; // (mfxSession) handle to the owning session
};
#endif //__MFXVIDEOPLUSPLUS_H