Intel® VPL Session#
Before calling any Intel® VPL functions, the application must initialize the library and create a Intel® VPL session. A Intel® VPL session maintains context for the use of any of DECODE, ENCODE, VPP, DECODE_VPP functions.
Intel® Media Software Development Kit Dispatcher (Legacy)#
The MFXInit()
or MFXInitEx()
function starts (initializes)
a session. The MFXClose()
function closes (de-initializes) the
session. To avoid memory leaks, always call MFXClose()
after
MFXInit()
.
Important
MFXInit()
and MFXInitEx()
are deprecated
starting from API 2.0. Applications must use MFXLoad()
and MFXCreateSession()
to initialize implementations.
Important
For backward compatibility with existent Intel® Media Software Development Kit
applications Intel® VPL session can be created and initialized by
the legacy dispatcher through MFXInit()
or
MFXInitEx()
calls. In this case, the reported API version
will be 1.255 on Intel® platforms with Xe architecture.
The application can initialize a session as a software-based session
(MFX_IMPL_SOFTWARE
) or a hardware-based session
(MFX_IMPL_HARDWARE
). In a software-based session, the SDK
functions execute on a CPU. In a hardware-base session, the SDK functions
use platform acceleration capabilities. For platforms that expose multiple
graphic devices, the application can initialize a session on any
alternative graphic device using the MFX_IMPL_HARDWARE
,
MFX_IMPL_HARDWARE2
, MFX_IMPL_HARDWARE3
, or
MFX_IMPL_HARDWARE4
values of mfxIMPL
.
The application can also initialize a session to be automatic (
MFX_IMPL_AUTO
or MFX_IMPL_AUTO_ANY
),
instructing the dispatcher library to detect the platform capabilities and
choose the best SDK library available. After initialization, the SDK returns the
actual implementation through the MFXQueryIMPL()
function.
Internally, the dispatcher works as follows:
Dispatcher searches for the shared library with the specific name:
OS
Name
Description
Linux*
libmfxsw64.so.1
64-bit software-based implementation
Linux
libmfxsw32.so.1
32-bit software-based implementation
Linux
libmfxhw64.so.1
64-bit hardware-based implementation
Linux
libmfxhw64.so.1
32-bit hardware-based implementation
Windows*
libmfxsw32.dll
64-bit software-based implementation
Windows
libmfxsw32.dll
32-bit software-based implementation
Windows
libmfxhw64.dll
64-bit hardware-based implementation
Windows
libmfxhw64.dll
32-bit hardware-based implementation
Once the library is loaded, the dispatcher obtains addresses for each SDK function. See the Exported Functions/API Version table for the list of functions to expose.
How the shared library is identified using the implementation search strategy will vary according to the OS.
On Windows, the dispatcher searches the following locations, in the specified order, to find the correct implementation library:
The
Driver Store
directory for the current adapter. All types of graphics drivers can install libraries in this directory. Learn more about Driver Store.The directory specified for the current hardware under the registry key
HKEY_CURRENT_USER\Software\Intel\MediaSDK\Dispatch
.The directory specified for the current hardware under the registry key
HKEY_LOCAL_MACHINE\Software\Intel\MediaSDK\Dispatch
.The directory that is stored in these registry keys:
C:Program FilesIntelMedia SDK
. This directory is where legacy graphics drivers install libraries.The directory where the current module (the module that links the dispatcher) is located (only if the current module is a dll).
After the dispatcher completes the main search, it additionally checks:
The directory of the exe file of the current process, where it looks for software implementation only, regardless of which implementation the application requested.
Default dll search. This provides loading from the directory of the application’s exe file and from the
System32
andSysWOW64
directories. Learn more about default dll search order.The
System32
andSysWOW64
directories, which is where DCH graphics drivers install libraries.
On Linux, the dispatcher searches the following locations, in the specified order, to find the correct implementation library:
Directories provided by the environment variable
LD_LIBRARY_PATH
.Content of the
/etc/ld.so.cache
cache file.Default path
/lib
, then/usr/lib
or/lib64
, and then/usr/lib64
on some 64 bit OSs. On Debian:/usr/lib/x86_64-linux-gnu
.SDK installation folder.
Intel® VPL Dispatcher#
The Intel® VPL dispatcher extends the legacy dispatcher by providing additional ability to select the appropriate implementation based on the implementation capabilities. Implementation capabilities include information about supported decoders, encoders, and VPP filters. For each supported encoder, decoder, and filter, capabilities include information about supported memory types, color formats, and image (frame) size in pixels.
The recommended approach to configure the dispatcher’s capabilities search filters and to create a session based on a suitable implementation is as follows:
Create loader with
MFXLoad()
.Create loader’s configuration with
MFXCreateConfig()
.Add configuration properties with
MFXSetConfigFilterProperty()
.Explore available implementations with
MFXEnumImplementations()
.Create a suitable session with
MFXCreateSession()
.
The procedure to terminate an application is as follows:
Destroy session with
MFXClose()
.Destroy loader with
MFXUnload()
.
Note
Multiple loader instances can be created.
Note
Each loader may have multiple configuration objects associated with it.
When a configuration object is modified through MFXSetConfigFilterProperty()
it implicitly impacts the state and configuration of the associated loader.
Important
One configuration object can handle only one filter property.
Note
Multiple sessions can be created by using one loader object.
When the dispatcher searches for the implementation, it uses the following priority rules:
Hardware implementation has priority over software implementation.
General hardware implementation has priority over VSI hardware implementation.
Highest API version has higher priority over lower API version.
Note
Implementation has priority over the API version. In other words, the dispatcher must return the implementation with the highest API priority (greater than or equal to the implementation requested).
How the shared library is identified using the implementation search strategy will vary according to the OS.
On Windows, the dispatcher searches the following locations, in the specified order, to find the correct implementation library:
The
Driver Store
directory for all available adapters. All types of graphics drivers can install libraries in this directory. Learn more about Driver Store. Applicable only for Intel implementations.The directory of the exe file of the current process.
PATH environmental variable.
For backward compatibility with older spec versions, dispatcher also checks user-defined search folders which are provided by ONEVPL_SEARCH_PATH environmental variable.
On Linux, the dispatcher searches the following locations, in the specified order, to find the correct implementation library:
Directories provided by the environment variable
LD_LIBRARY_PATH
.Default path
/lib
, then/usr/lib
or/lib64
, and then/usr/lib64
on some 64 bit OSs. On Debian:/usr/lib/x86_64-linux-gnu
.For backward compatibility with older spec versions, dispatcher also checks user-defined search folders which are provided by ONEVPL_SEARCH_PATH environmental variable.
Important
To prioritize loading of custom Intel® VPL library, users may set environment variable
ONEVPL_PRIORITY_PATH with the path to the user-defined folder.
All libraries found in the ONEVPL_PRIORITY_PATH have the same priority
(higher than any others, and HW/SW or API version rules are not applied) and
should be loaded/filtered according to MFXSetConfigFilterProperty()
.
When Intel® VPL dispatcher searchers for the legacy Intel® Media Software Development Kit
implementation it uses legacy dispatcher search order,
excluding the current working directory and /etc/ld.so.cache
.
The dispatcher supports different software implementations. The user can use
the mfxImplDescription::VendorID
field, the
mfxImplDescription::VendorImplID
field, or the
mfxImplDescription::ImplName
field to search for the specific
implementation.
Internally, the dispatcher works as follows:
Dispatcher loads all shared libraries in the given search folders, whose names match any of the patterns in the following table:
Windows 64-bit
Windows 32-bit
Linux 64-bit
Description
libvpl*.dll
libvpl*.dll
libvpl*.so*
Runtime library for any platform
libmfx64-gen.dll
libmfx32-gen.dll
libmfx-gen.so.1.2
Runtime library for Intel® VPL for Intel® platforms with Xe architecture
libmfxhw64.dll
libmfxhw32.dll
libmfxhw64.so.1
Runtime library for Intel® Media Software Development Kit
For each loaded library, the dispatcher tries to resolve address of the
MFXQueryImplsDescription()
function to collect the implementation’s capabilities.Once the user has requested to create the session based on this implementation, the dispatcher obtains addresses of each Intel® VPL function. See the Exported Functions/API Version table for the list of functions to export.
Intel® VPL Dispatcher Configuration Properties#
The Dispatcher Configuration Properties Table shows property strings supported by the dispatcher. Table organized in the hierarchy way, to create the string, go from the left to right from column to column and concatenate strings by using . (dot) as the separator.
Structure name |
Property |
Value Data Type |
Comment |
---|---|---|---|
mfxImplDescription
.Impl
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.AccelerationMode
|
MFX_VARIANT_TYPE_U32 |
The mode will be used for session initialization |
|
mfxImplDescription
.ApiVersion
.Version
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.ApiVersion
.Major
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.ApiVersion
.Minor
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.ImplName
|
MFX_VARIANT_TYPE_PTR |
Pointer to the null-terminated string. |
|
mfxImplDescription
.License
|
MFX_VARIANT_TYPE_PTR |
Pointer to the null-terminated string. |
|
mfxImplDescription
.Keywords
|
MFX_VARIANT_TYPE_PTR |
Pointer to the null-terminated string. |
|
mfxImplDescription
.VendorID
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.VendorImplID
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxSurfacePoolMode
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxDeviceDescription
.device
.DeviceID
|
MFX_VARIANT_TYPE_PTR |
Pointer to the null-terminated string. |
|
mfxImplDescription
.mfxDeviceDescription
.device
.MediaAdapterType
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.mfxDecoderDescription
.decoder
.CodecID
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxDecoderDescription
.decoder
.MaxcodecLevel
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.mfxDecoderDescription
.decoder
.decprofile
.Profile
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxDecoderDescription
.decoder
.decprofile
.Profile
.decmemdesc
.MemHandleType
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxDecoderDescription
.decoder
.decprofile
.Profile
.decmemdesc
.Width
|
MFX_VARIANT_TYPE_PTR |
Pointer to the
|
|
mfxImplDescription
.mfxDecoderDescription
.decoder
.decprofile
.Profile
.decmemdesc
.Height
|
MFX_VARIANT_TYPE_PTR |
Pointer to the
|
|
mfxImplDescription
.mfxDecoderDescription
.decoder
.decprofile
.Profile
.decmemdesc
.ColorFormats
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.CodecID
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.MaxcodecLevel
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.BiDirectionalPrediction
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.ReportedStats
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.encprofile
.Profile
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.encprofile
.Profile
.encmemdesc
.MemHandleType
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxEncoderDescription
.encoder
.encprofile
.Profile
.encmemdesc
.Width
|
MFX_VARIANT_TYPE_PTR |
Pointer to the
|
|
mfxImplDescription
.mfxEncoderDescription
.encoder
.encprofile
.Profile
.encmemdesc
.Height
|
MFX_VARIANT_TYPE_PTR |
Pointer to the
|
|
mfxImplDescription
.mfxEncoderDescription
.encoder
.encprofile
.Profile
.encmemdesc
.ColorFormats
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxVPPDescription
.filter
.FilterFourCC
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxVPPDescription
.filter
.MaxDelayInFrames
|
MFX_VARIANT_TYPE_U16 |
||
mfxImplDescription
.mfxVPPDescription
.filter
.memdesc
.MemHandleType
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxVPPDescription
.filter
.memdesc
.Width
|
MFX_VARIANT_TYPE_PTR |
Pointer to the
|
|
mfxImplDescription
.mfxVPPDescription
.filter
.memdesc
.Height
|
MFX_VARIANT_TYPE_PTR |
Pointer to the
|
|
mfxImplDescription
.mfxVPPDescription
.filter
.memdesc
.format
.InFormat
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplDescription
.mfxVPPDescription
.filter
.memdesc
.format
.OutFormats
|
MFX_VARIANT_TYPE_U32 |
||
mfxImplementedFunctions
.FunctionsName
|
MFX_VARIANT_TYPE_PTR |
Pointer to the buffer with string |
|
N/A |
DXGIAdapterIndex
|
MFX_VARIANT_TYPE_U32 |
Adapter index according to IDXGIFactory::EnumAdapters |
N/A |
AutoSelectImpl
|
MFX_VARIANT_TYPE_PTR |
Pointer to a struct for automatic implementation selection |
Important
DXGIAdapterIndex property is available for Windows only and filters only hardware implementations.
Examples of the property name strings:
mfxImplDescription.mfxDecoderDescription.decoder.decprofile.Profile
mfxImplDescription.mfxDecoderDescription.decoder.decprofile.decmemdesc.MemHandleType
mfxImplementedFunctions.FunctionsName
Following properties are supported in a special manner: they are used to send
additional data to the implementation through the dispatcher. Application needs
to use MFXSetConfigFilterProperty()
to set them up but they don’t
influence on the implementation selection. They are used during the
MFXCreateSession()
function call to fine tune the implementation.
Property Name |
Property Value |
Value data type |
---|---|---|
mfxHandleType |
||
mfxHDL |
||
NumThread |
Unsigned fixed-point integer value |
|
DeviceCopy |
||
ExtBuffer |
Pointer to the extension buffer |
Intel® VPL Dispatcher Interactions#
This sequence diagram visualize how application communicates with implementations via the dispatcher.
- Dispatcher API
This API is implemented in the dispatcher.
- Implementation API
This API is provided by the any implementation.
The Intel® VPL dispatcher is capable to load and initialize Intel® Media Software Development Kit legacy library. The sequence diagram below demonstrates the approach.
Important
The dispatcher doesn’t filter and report
mfxDeviceDescription
,
mfxDecoderDescription
,
mfxEncoderDescription
,
mfxVPPDescription
when enumerates or creates
Intel® Media Software Development Kit implementation. Once Intel® Media Software Development Kit is loaded
applications have to use legacy approach to query capabilities.
Intel® VPL Dispatcher Debug Log#
The debug output of the dispatcher is controlled with the ONEVPL_DISPATCHER_LOG environment variable. To enable log output, set the ONEVPL_DISPATCHER_LOG environment variable value equals to “ON”.
By default, Intel® VPL dispatcher prints all log messages to the console. To redirect log output to the desired file, set the ONEVPL_DISPATCHER_LOG_FILE environmental variable with the file name of the log file.
Examples of Dispatcher’s Usage#
This code illustrates simple usage of dispatcher to load first available library:
1mfxLoader loader = MFXLoad();
2MFXCreateSession(loader,0,&session);
This code illustrates simple usage of dispatcher to load first available HW accelerated library:
1mfxLoader loader = MFXLoad();
2mfxConfig cfg = MFXCreateConfig(loader);
3mfxVariant ImplValue;
4ImplValue.Type = MFX_VARIANT_TYPE_U32;
5ImplValue.Data.U32 = MFX_IMPL_TYPE_HARDWARE;
6MFXSetConfigFilterProperty(cfg,(const mfxU8 *)"mfxImplDescription.Impl",ImplValue);
7MFXCreateSession(loader,0,&session);
This code illustrates how multiple sessions from multiple loaders can be created:
1// Create session with software based implementation
2mfxLoader loader1 = MFXLoad();
3mfxConfig cfg1 = MFXCreateConfig(loader1);
4mfxVariant ImplValueSW;
5ImplValueSW.Type = MFX_VARIANT_TYPE_U32;
6ImplValueSW.Data.U32 = MFX_IMPL_TYPE_SOFTWARE;
7MFXSetConfigFilterProperty(cfg1,(const mfxU8 *)"mfxImplDescription.Impl",ImplValueSW);
8MFXCreateSession(loader1,0,&sessionSW);
9
10// Create session with hardware based implementation
11mfxLoader loader2 = MFXLoad();
12mfxConfig cfg2 = MFXCreateConfig(loader2);
13mfxVariant ImplValueHW;
14ImplValueHW.Type = MFX_VARIANT_TYPE_U32;
15ImplValueHW.Data.U32 = MFX_IMPL_TYPE_HARDWARE;
16MFXSetConfigFilterProperty(cfg2,(const mfxU8 *)"mfxImplDescription.Impl",ImplValueHW);
17MFXCreateSession(loader2,0,&sessionHW);
18
19// use both sessionSW and sessionHW
20// ...
21// Close everything
22MFXClose(sessionSW);
23MFXClose(sessionHW);
24MFXUnload(loader1); // cfg1 will be destroyed here.
25MFXUnload(loader2); // cfg2 will be destroyed here.
This code illustrates how multiple decoders from single loader can be created:
1mfxLoader loader = MFXLoad();
2
3// We want to have AVC decoder supported.
4mfxConfig cfg1 = MFXCreateConfig(loader);
5mfxVariant ImplValue;
6ImplValue.Type = MFX_VARIANT_TYPE_U32;
7ImplValue.Data.U32 = MFX_CODEC_AVC;
8MFXSetConfigFilterProperty(cfg1,
9 (const mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID",ImplValue);
10
11// And we want to have HEVC encoder supported by the same implementation.
12mfxConfig cfg2 = MFXCreateConfig(loader);
13ImplValue.Type = MFX_VARIANT_TYPE_U32;
14ImplValue.Data.U32 = MFX_CODEC_HEVC;
15MFXSetConfigFilterProperty(cfg2,
16 (const mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID",ImplValue);
17
18// To create single session with both capabilities.
19MFXCreateSession(loader,0,&session);
How To Check If Function is Implemented#
There are two ways to check if particular function is implemented or not by the implementation.
This code illustrates how application can iterate through the whole list of implemented functions:
1mfxHDL h;
2// request pointer to the list. Assume that implementation supports that.
3// Assume that `loader` is configured before.
4mfxStatus sts = MFXEnumImplementations(loader, idx, MFX_IMPLCAPS_IMPLEMENTEDFUNCTIONS, &h);
5// break if no idx
6if (sts != MFX_ERR_NOT_FOUND) {
7 // Cast typeless handle to structure pointer
8 mfxImplementedFunctions *implemented_functions = (mfxImplementedFunctions*)h;
9
10 // print out list of functions' name
11 std::for_each(implemented_functions->FunctionsName, implemented_functions->FunctionsName +
12 implemented_functions->NumFunctions,
13 [](mfxChar* functionName) {
14 std::cout << functionName << " is implemented" << std::endl;
15 });
16 // Release resource
17 MFXDispReleaseImplDescription(loader, h);
18}
This code illustrates how application can check that specific functions are implemented:
1mfxSession session_handle;
2loader = mfxLoader();
3
4// We want to search for the implementation with Decode+VPP domain functions support.
5// i.e we search for the MFXVideoDECODE_VPP_Init and MFXVideoDECODE_VPP_DecodeFrameAsync
6// implemented functions
7mfxConfig init_funct_prop = MFXCreateConfig(loader);
8mfxVariant value;
9
10// Filter property for the Init function
11value.Type = mfxVariantType::MFX_VARIANT_TYPE_PTR;
12value.Data.Ptr = (mfxHDL)"MFXVideoDECODE_VPP_Init";
13MFXSetConfigFilterProperty(init_funct_prop, (const mfxU8*)"mfxImplementedFunctions.FunctionsName",
14 value);
15
16// Filter property for the Process function
17mfxConfig process_func_prop = MFXCreateConfig(loader);
18value.Data.Ptr = (mfxHDL)"MFXVideoDECODE_VPP_DecodeFrameAsync";
19MFXSetConfigFilterProperty(process_func_prop, (const mfxU8*)"mfxImplementedFunctions.FunctionsName",
20 value);
21
22// create session from first matched implementation
23MFXCreateSession(loader, 0, &session_handle);
How To Search For The Available encoder/decoder implementation#
The CodecFormatFourCC enum specifies codec’s FourCC
values. Application needs to assign this value to the field of
mfxDecoderDescription::decoder::CodecID
to search for the decoder
or mfxEncoderDescription::encoder::CodecID
to search for the
encoder.
This code illustrates decoder’s implementation search procedure:
1mfxSession hevc_session_handle;
2loader = mfxLoader();
3
4// We want to search for the HEVC decoder implementation
5mfxConfig hevc_decoder_config = MFXCreateConfig(loader);
6mfxVariant value;
7
8// Filter property for the implementations with HEVC decoder
9value.Type = MFX_VARIANT_TYPE_U32;
10value.Data.U32 = MFX_CODEC_HEVC;
11
12MFXSetConfigFilterProperty(hevc_decoder_config
13 , (const mfxU8*)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID"
14 , value);
15
16// create session from first matched implementation
17MFXCreateSession(loader, 0, &hevc_session_handle);
How To Search For The Available VPP Filter implementation#
Each VPP filter identified by the filter ID. Filter ID is defined by
corresponding to the filter extension buffer ID value which is defined in a form
of FourCC value.
Filter ID values are subset of the general ExtendedBufferID
enum. The table references available IDs of VPP filters
to search. Application needs to assign this value to the field of
mfxVPPDescription::filter::FilterFourCC
to search for the needed
VPP filter.
Filter ID |
Description |
---|---|
Denoise filter |
|
Motion-Compensated Temporal Filter (MCTF). |
|
Detail/edge enhancement filter. |
|
Frame rate conversion filter |
|
Image stabilization filter |
|
ProcAmp filter |
|
Field processing filter |
|
Color Conversion filter |
|
Resize filter |
|
Surfaces composition filter |
|
Deinterlace filter |
|
Rotation filter |
|
Mirror filter |
|
ColorFill filter |
This code illustrates VPP mirror filter implementation search procedure:
1mfxSession mirror_session_handle;
2loader = mfxLoader();
3
4// We want to search for the VPP mirror implementation
5mfxConfig mirror_flt_config = MFXCreateConfig(loader);
6mfxVariant value;
7
8// Filter property for the implementations with VPP mirror
9value.Type = MFX_VARIANT_TYPE_U32;
10value.Data.U32 = MFX_EXTBUFF_VPP_MIRRORING;
11
12MFXSetConfigFilterProperty(mirror_flt_config
13 , (const mfxU8*)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC"
14 , value);
15
16// create session from first matched implementation
17MFXCreateSession(loader, 0, &mirror_session_handle);
How To Select Implementation Automatically From Device Handle#
Starting from API 2.9 applications may request the dispatcher to load an implementation
corresponding to a hardware acceleration device which has already been initialized
by the application. The application must initialize a structure of type
mfxAutoSelectImplDeviceHandle
with the appropriate acceleration mode,
handle type, and hardware device handle. Then this structure must be passed to the
dispatcher by calling MFXSetConfigFilterProperty()
with property name
‘AutoSelectImpl’ and property value of type MFX_VARIANT_TYPE_PTR, pointing to the
mfxAutoSelectImplDeviceHandle
structure.
This is currently an experimental API. Backward compatibility and future presence is
not guaranteed. Applications should check the error codes returned from
MFXSetConfigFilterProperty()
and MFXCreateSession()
to check
whether the feature is supported and a suitable implementation was found.
This code illustrates automatic implementation selection using an application-provided hardware device handle:
1mfxLoader loader = MFXLoad();
2
3// In actual code, application should initialize deviceHandle to a
4// hardware device handle of the type indicated in the following table.
5//
6// AccelMode DeviceHandleType DeviceHandle native type
7// -----------------------------------------------------------------------------------
8// MFX_ACCEL_MODE_VIA_D3D9 MFX_HANDLE_D3D9_DEVICE_MANAGER IDirect3DDeviceManager9*
9// MFX_ACCEL_MODE_VIA_D3D11 MFX_HANDLE_D3D11_DEVICE ID3D11Device*
10// MFX_ACCEL_MODE_VIA_VAAPI MFX_HANDLE_VA_DISPLAY VADisplay
11//
12// Example:
13// ID3D11Device *pD3D11Device;
14// D3D11CreateDevice(... , &pD3D11Device , ...);
15// mfxHDL deviceHandle = (mfxHDL)pD3D11Device;
16
17mfxHDL deviceHandle = NULL;
18
19mfxAutoSelectImplDeviceHandle autoSelectStruct;
20autoSelectStruct.AutoSelectImplType = MFX_AUTO_SELECT_IMPL_TYPE_DEVICE_HANDLE;
21autoSelectStruct.AccelMode = MFX_ACCEL_MODE_VIA_D3D11;
22autoSelectStruct.DeviceHandleType = MFX_HANDLE_D3D11_DEVICE;
23autoSelectStruct.DeviceHandle = deviceHandle;
24
25mfxConfig cfg1 = MFXCreateConfig(loader);
26mfxVariant ImplValue;
27ImplValue.Type = MFX_VARIANT_TYPE_PTR;
28ImplValue.Data.Ptr = &autoSelectStruct;
29
30MFXSetConfigFilterProperty(cfg1, (const mfxU8 *)"AutoSelectImpl", ImplValue);
31
32// Create session with implementation corresponding to deviceHandle.
33// It is not required to call MFXVideoCORE_SetHandle() in this case,
34// since the implementation already has the necessary deviceHandle.
35MFXCreateSession(loader, 0, &session);
Intel® VPL implementation on Intel® platforms with Xe architecture and Intel® Media Software Development Kit Coexistence#
Intel® VPL supersedes Intel® Media Software Development Kit and is partially binary compatible with Intel® Media Software Development Kit. Both Intel® VPL and Intel® Media Software Development Kit includes own dispatcher and implementation. Coexistence of Intel® VPL and Intel® Media Software Development Kit dispatchers and implementations on single system is allowed until Intel® Media Software Development Kit is not EOL.
Usage of the following combinations of dispatchers and implementations within the single application is permitted for the legacy purposes only. In that scenario legacy applications developed with Intel® Media Software Development Kit will continue to work on any HW supported either by Intel® Media Software Development Kit or by the Intel® VPL.
Attention
Any application to work with the Intel® VPL API starting from version 2.0 must use only Intel® VPL dispatcher.
- Intel® Media Software Development Kit API
Intel® Media Software Development Kit API of 1.x version.
- Removed API
Intel® Media Software Development Kit API which is removed from Intel® VPL.
- Core API
Intel® Media Software Development Kit API without removed API.
- Intel® VPL API
New API introduced in Intel® VPL only started from API 2.0 version.
- Intel® VPL Dispatcher API
Dispatcher API introduced in Intel® VPL in 2.0 API version. This is subset of Intel® VPL API.
Dispatcher |
Installed on the device |
Loaded |
Allowed API |
---|---|---|---|
Intel® VPL |
Intel® VPL for Intel® platforms with Xe architecture |
Intel® VPL for Intel® platforms with Xe architecture |
Usage of any API except removed API is allowed. |
Intel® VPL |
Intel® Media Software Development Kit |
Intel® Media Software Development Kit |
Usage of core API plus dispatcher API is allowed only. |
Intel® VPL |
Intel® VPL for Intel® platforms with Xe architecture and Intel® Media Software Development Kit |
Intel® VPL for Intel® platforms with Xe architecture |
Usage of any API except removed API is allowed. |
Intel® Media Software Development Kit |
Intel® VPL for Intel® platforms with Xe architecture |
Intel® VPL for Intel® platforms with Xe architecture |
Usage of core API is allowed only. |
Intel® Media Software Development Kit |
Intel® VPL for Intel® platforms with Xe architecture and Intel® Media Software Development Kit |
Intel® Media Software Development Kit |
Usage of Intel® Media Software Development Kit API is allowed. |
Intel® Media Software Development Kit |
Intel® Media Software Development Kit |
Intel® Media Software Development Kit |
Usage of Intel® Media Software Development Kit API is allowed. |
Note
if system has multiple devices the logic of selection and loading implementations will be applied to each device accordingly to the system enumeration.
Multiple Sessions#
Each Intel® VPL session can run exactly one instance of the DECODE, ENCODE, and VPP functions. This is adequate for a simple transcoding operation. If the application needs more than one instance of DECODE, ENCODE, or VPP in a complex transcoding setting or needs more simultaneous transcoding operations, the application can initialize multiple Intel® VPL sessions created from one or several Intel® VPL implementations.
The application can use multiple Intel® VPL sessions independently or run a “joined”
session. To join two sessions together, the application can use the function
MFXJoinSession()
. Alternatively, the application can use the
MFXCloneSession()
function to duplicate an existing session. Joined
Intel® VPL sessions work together as a single session, sharing all session
resources, threading control, and prioritization operations except hardware
acceleration devices and external allocators. When joined, the first session
(first join) serves as the parent session and will schedule execution resources
with all other child sessions. Child sessions rely on the parent session for
resource management.
Important
Applications can join sessions created from the same Intel® VPL implementation only.
With joined sessions, the application can set the priority of session operations
through the MFXSetPriority()
function. A lower priority session
receives fewer CPU cycles. Session priority does not affect hardware accelerated
processing.
After the completion of all session operations, the application can use the
MFXDisjoinSession()
function to remove the joined state of a session.
Do not close the parent session until all child sessions are disjoined or
closed.