Intel® Media SDK
Dispatcher
Overview
SDK Implementation Registration
Software SDK Implementations
Platform-Specific SDK Implementations
The Dispatching Procedure
Additional Recommendations
Legal Information

Overview
This document describes the design of the Intel® Media SDK dispatcher.
The dispatcher is a layer that lies between applications and Intel Media SDK implementations. Upon initialization, the dispatcher locates the appropriate platform-specific SDK implementation. If there is none, it will select the software SDK implementation. The dispatcher will redirect subsequent function calls to the same functions in the selected SDK implementation.
We recommend that applications always use the Intel Media SDK functions through a dispatcher since platform-specific SDK implementations or software SDK implementations may have different names and reside in separate locations. The dispatching process represents a unique way to locate these SDK implementations.
To maintain forward and backward compatibility, we do not recommend modifying the dispatcher in any way, except in the following cases:
•	Debugging in the case that the dispatcher fails to locate an SDK implementation
•	Compiling the dispatcher library with a compiler that the Intel Media SDK does not support
•	Rebuilding the dispatcher static library to be a dynamically linked library (DLL) for modular design
•	Tailoring redirected function entries to those applications actually used for a smaller footprint

SDK Implementation Registration

Software SDK Implementations
Software SDK implementations reside in the application’s local folder. The dispatcher locates software SDK implementations by their reserved names:
Library	Software SDK Implementation	
libmfxsw32.dll	for IA-32 architecture	
libmfxsw64.dll	for Intel® 64 architecture	
		
Platform-Specific SDK Implementations
The installer registers platform-specific SDK implementations in the system registry except for the following two reserved libraries:
Library	Platform-Specific SDK Implementation	
libmfxhw32.dll	Reserved hardware library for IA-32 architecture	
libmfxhw64.dll	Reserved hardware library for Intel® 64 architecture	
The system registry contains information about platform-specific SDK implementations under the following registry keys:
Registry Key	SDK Implementations for:	
HKEY_CURRENT_USER\Software\Intel\MediaSDK\Dispatch	Current user	
HKEY_LOCAL_MACHINE\Software\Intel\MediaSDK\Dispatch	Entire system	
Under each of these registry keys are descriptions of one or more SDK implementations. They are in the following structure in no particular order:
Key Structure	
LibraryName	“DeviceID”=DWORD:0x87654321
“VendorID”=DWORD:0x12345678
“Merit”=DWORD:0x08012345
“Path”=STRING:”c:\windows\system32\abc.dll”
“APIVersion”=DWORD:0x00000100	
Key Description	
LibraryName	Library name; the dispatching process does not use this value.	
DeviceID	Device identifier for the graphic adapter	
VendorID	Vendor identifier for the graphic adapter	
Merit	Order in which the dispatching process should search through the list of available SDK implementations, with higher merit first; the Merit value must be less than 0x7fffffff. It is recommended that the merit of HW libraries be greater than 0x08000000.	
Path	Absolute path of the SDK implementation	
APIVersion	The SDK API version=major*256+minor.	
Example 1 illustrates an example of registered SDK platform-specific implementations in the system registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Intel\MediaSDK\Dispatch\HWLib01]
"DeviceID"=dword:00002e22
"VendorID"=dword:00008086
"Merit"=dword:08000001
"Path"="C:\WINDOWS\system32\libmfxhw01.dll"
“APIVersion”=dword:00000100
[HKEY_LOCAL_MACHINE\SOFTWARE\Intel\MediaSDK\Dispatch\HWLib02]
"DeviceID"=dword:00002a42
"VendorID"=dword:00008086
"Merit"=dword:08000002
"Path"="C:\WINDOWS\system32\libmfxhw02.dll"
“APIVersion”=dword:00000100

Example 1: SDK Platform-Specific Implementations in the System Registry

The Dispatching Procedure
The following describes the dispatching procedure:
1.	Create a list of device and vendor identifiers for the display adaptor(s) to be scanned, according to the MFXInit initialization parameter as follows:
MFXInit Initialization Parameter	Device & Vendor Identifiers	
MFX_IMPL_SOFTWARE	Use DeviceId=0 and VendorId=0	
MFX_IMPL_HARDWARE or 
MFX_IMPL_AUTO	Use the device and vendor identifiers for the default display adapter.	
MFX_IMPL_HARDWARE2 or
MFX_IMPL_HARDWARE3 or
MFX_IMPL_HARDWARE4	Use the device and vendor identifiers for the second, third or fourth display adapter.	
MFX_IMPL_HARDWARE_ANY	Scan all display adapters. Obtain device and vendor identifiers for them.	
	Perform step 2 to step 3 for each set of device and vendor identifiers in the list.
2.	Search the list of SDK implementations registered under HKEY_CURRENT_USER\Software\Intel\MediaSDK\Dispatch in the following manner:
a.	Filter out SDK implementations that do not match the device and vendor identifiers.
b.	Filter out SDK implementations that do not meet the SDK API version requirement.
c.	Search registered SDK implementations in order of their merit—largest first:
i.	Load the SDK implementation.
ii.	If the MFXInit function of the SDK implementation returns successfully, the dispatcher has identified the correct SDK implementation. Terminate the dispatching process.
iii.	Otherwise, unload the SDK implementation. Search the next SDK implementation in like manner.
3.	Search the list of SDK implementations registered under HKEY_LOCAL_MACHINE\Software\Intel\MediaSDK\Dispatch with the same steps listed in step 2.
4.	Search the default platform-specific SDK implementation—libmfxhw32.dll for 32-bit systems and libmfxhw64.dll for 64-bit systems—in the following manner:
a.	Locate and load the SDK implementation through the system-default search path.
b.	If the MFXInit function of the SDK implementation returns successfully, then the dispatcher has identified the correct SDK implementation. Terminate the dispatching process.
c.	Otherwise, Unload the SDK implementation.
5.	Search the default SDK software implementation—libmfxsw32.dll for 32-bit systems or libmfxsw64.dll for 64-bit systems—with the same steps listed in step 4.

Additional Recommendations
To ensure SDK API compatibility, unless applications explicitly specify a version of an SDK implementation, we recommend that a dispatcher always match the SDK API version, during session initialization (MFXInit), with the latest released SDK API version.

Legal Information
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.  EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.

Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information. 

The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. 

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. 

Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or by visiting Intel's Web Site.

MPEG is an international standard for video compression/decompression promoted by ISO. Implementations of MPEG CODECs, or MPEG enabled platforms may require licenses from various entities, including Intel Corporation.

Intel, the Intel logo, Intel Core, Intel 64, Intel HD Graphics, Intel Media Software Development Kit (Intel Media SDK) are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

Optimization Notice
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. 

Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804