Using the Intel® Media SDK within MainConcept* H.264/AVC Encoder for Intel® Quick Sync Video hardware acceleration on 2nd Generation Intel® Core™ Family Processors

Download Article

Download Using the Intel® Media SDK within MainConcept* [PDF 554KB]
 

Introduction - Intel® Media SDK

The Intel® Media Software Development Kit (Intel® Media SDK) is a software development library that exposes the media acceleration capabilities of Intel platforms for decoding, encoding, and video pre-processing (VPP). The Intel Media SDK helps developers rapidly create code that takes advantage of hardware acceleration for video codecs. The Intel Media SDK also supports future Intel architectures and processor graphics products that feature hardware encode, decode, and video processing capabilities.

The Intel Media SDK is packaged with many application samples that illustrate how to use it to encode, decode, and pre-process media. The Intel Media SDK is available as a free download here: www.intel.com/software/mediasdk.

 

MainConcept* H.264/AVC Encoder for Intel® Quick Sync Video SDK

Available in the SDK and in application form as part of the MainConcept Codec SDK and MC ReferenceTM transcoding platform, the H.264/AVC Encoder for Intel Quick Sync Video SDK acts as a wrapper for the Intel Media SDK 2.0. The H.264/AVC Encoder for Intel Quick Sync Video streamlines application development with features such as video pre-processing and encode/decode services. It also significantly streamlines access to the advanced Intel Quick Sync Video hardware acceleration offered by 2nd generation Intel® CoreTM family processors. For H.264/AVC encoding and decoding, these capabilities deliver faster-than-ever speeds at all profiles and levels supported by the popular standard. And further, the MainConcept H.264/AVC Encoder for Intel Quick Sync Video builds on the Intel Media SDK 2.0 with a number of high-end feature enhancement opportunities, providing a foundation for customization and product differentiation.

The following article describes how MainConcept adapted its encoder by creating a wrapper for Intel Media SDK 2.0. It also discusses how MainConcept customers can benefit from tapping into the powerful Intel Quick Sync Video hardware-accelerated encoding and other aspects of 2nd generation Intel Core processors.

The MainConcept Codec SDK includes sample code and documentation for creating a wide range of applications and plug-ins. Request it at: sales@mainconcept.com. Existing MainConcept customers can download the SDK through the MainConcept customer portal. Log-in is required.


 

MainConcept* H.264/AVC Encoder for Intel® Quick Sync Video

The MainConcept H.264/AVC Encoder SDK for Intel Quick Sync Video lets developers use the Intel Media SDK through the MainConcept API. As an extension to the H.264/AVC Software Encoder, the MainConcept H.264/AVC Encoder for Intel Quick Sync Video gives customers easy access to the Intel hardware accelerated encoder. Existing encoding tool chains based on the MainConcept Codec API can be enhanced to take advantage of hardware encoding with just a few tweaks, regardless of whether the MainConcept Low-Level API or DirectShowTM Filter is used.





Figure 1: Intel® Media SDK / MainConcept* H.264/AVC Encoder SDK for Intel® Quick Sync Video

The Intel Media SDK 2.0 outside the MainConcept SDK wrapper (see Figure 1) provides four building blocks for working with coded bit streams and raw video frames: decode; VPP (including deinterlacing, inverse telecine, resizing, color conversion, scene change detection, denoising, frame rate conversion, brightness, contrast, hue, saturation control, and sharpening); encode (CBR and VBR); and user (supports creating user-defined custom video filters).

MainConcept's SDK augments the feature set of Intel Media SDK 2.0 with MainConcept's encoder, decoder, and transcoder, and supports:

  • Input chroma format: 4:2:0
  • Input color format: YV12
  • Picture structure: progressive or interlaced
  • Bit depth: 8
  • H.264/AVC encoding (ISO/IEC 14496-10)
  • Selectable profiles up to High Profile
  • Selectable levels up to Level 5.1
  • Configurable bitrate control (constant bitrate, variable bitrate, constant quantization parameter)
  • Configurable GOP structure (I, P, and B frames in different combinations)
  • Scene change detection and adaptive GOP structure
  • Strict HRD restrictions compliance
  • Configurable number of slices
  • Multi-CPU support
  • Configurable Rate-Distortion optimization (fastest speed, best quality, balanced quality, and speed)

Incorporating the Intel Media SDK in its H.264/AVC Encoder SDK was a simple matter for MainConcept engineers. The two SDKs rely on a number of similar technologies, ranging from development tools-for example, the Intel® compilers-to program language support for C and C++. Wrapping the Intel Media SDK encoder and optimized media hardware libraries was a straightforward process for the MainConcept engineers. Thorsten Schumann, CTO and VP of Engineering at MainConcept, explained: "Intel provides a very clear, well-documented API for [Intel] Media SDK components. The sample applications that are provided by Intel are a bit complicated, but still very informative. We encountered very few problems with the implementation, but they were quickly solved thanks to support from Intel. We posed our questions on the Intel® Media SDK forum (forum link: http://software.intel.com/en-us/forums/intel-media-sdk/) and got answers on the fly."

For example, upon receiving a 2nd generation Intel Core processor-based platform, MainConcept was unable to turn its hardware acceleration mode "on." After some troubleshooting-installing new video drivers and so on-the team realized that the external video card installed on the PC was the problem. As soon as the card was removed, everything ran perfectly.

During QA testing of the AVC encoder for Intel Quick Sync Video, MainConcept discovered that when B-frames were enabled, the MainConcept application stopped encoding after a few frames. Schumann explained, "During debugging, we discovered that we hadn't addressed an MFX_WRN_IN_EXECUTION warning message that was returned from the MFXVideoCORE_SyncOperation function. After the fix, our application worked fine, but only in software mode. Streams that were generated using hardware mode contained less frames than input streams. After careful examination of Intel's sample application, we were able to add a loop for processing the MFX_WRN_DEVICE_BUSY error message that MFXVideoENCODE_EncodeFrameAsync function sometimes returned in hardware acceleration mode. That solved our issue."

"While debugging, we discovered that when using remote desktop we weren't able to switch the application to HW mode. It appeared the video device (and HW acceleration) is unavailable when the application is executed through remote desktop. So we had to use VNC to test and debug remotely."

In short, MainConcept was able to quickly add Intel Quick Sync Video hardware encoding to its product portfolio.


How Dedicated Fixed-Function Logic in a Silicon Block Benefits Video Encoding
Intel Quick Sync Video technology embedded in 2nd generation Intel Core processors utilizes dedicated fixed-function logic to enable compelling performance improvements, while reducing energy use to a minimum. For example, decoding, motion estimation, and loop filtering in H.264/AVC and VC-1 are typically handled by general-purpose execution units (EUs) that consume a lot of power. In 2nd generation Intel Core processor microarchitectures, these tasks are handled by the Intel® Clear Video HD engine-a complete decode pipeline for handling a number of multi-purpose codecs, including H.264/AVC, VC-1, and MPEG-2. The Intel HD Graphics engine includes 12 scalar EUs with support for Microsoft* DXVA acceleration.

The encoding pipeline relies on fixed-function logic working in conjunction with programmable execution units (EUs). Another logic block attached to the EUs samples incoming media and takes care of motion estimation, freeing the main processor cores to handle other tasks. When configured for transcoding, decoding tasks travel the same fixed-function logic pipeline to deliver even more performance gains.

All of this fixed-function logic is tied together using a ring bus, which means that, for example, graphics can access the last-level cache-L3 in 2nd generation Intel Core processors. This provides the means to avert cache thrashing and balance workloads between CPU cores and processor graphics.

MainConcept H.264/AVC Encoder for Intel Quick Sync Video gives developers the means to tap into these powerful hardware acceleration functions. In addition, the MainConcept SDK provides developers with the means to handle Microsoft DirectX* Video Acceleration (DXVA) encoding.

The MainConcept Intel Media SDK AVC/H.264 Video Encoder filter is a software module for encoding video into H.264/AVC (ISO/IEC 14496-10) streams. It is based on the Microsoft DirectShow* architecture and is implemented as a Microsoft DirectShow transform filter. Its features include:

  • Software-only H.264/AVC encoding
  • Selectable profiles up to High Profile
  • Selectable levels up to Level 5.1
  • Bitrate support up to Level 5.1 restriction (288 Mbps)
  • Configurable bitrate control (constant bitrate, variable bitrate, constant quantization parameter)
  • Strict HRD restrictions compliance
  • Configurable GOP structure (I, P, and B frames in different combinations)
  • Configurable motion estimation (number of reference frames)
  • Adaptive GOP structure
  • Configurable number of slices
  • Configurable Rate-Distortion optimization (fastest speed, best quality, balanced quality, and speed)
  • Special input pin for the closed caption data receiving

For optimal performance, the frame cadence must be a multiple of 16. For progressive frame sequences, the surface height of video frames must also be a multiple of 16. For interlaced footage, the frame height should be a multiple of 32.


Measured Performance Results
MainConcept in-house performance tests1 have shown that Intel Quick Sync Video technology found in 2nd generation Intel Core processors encodes an 11-second clip for AVCHD@1080i in3.2s, while CPU utilization is as low as 10%-an impressive feat.

1 Configurations: Configuration: Intel® CoreTM i7-2600 CPU (4x 3.40GHz @ 3401 MHz), Microsoft Windows* 7 Ultimate x64, 8GB DDR3 RAM, Intel HD Graphics Family (installed drivers: igdumd64.dll, igd10umd64.dll, igd10umd64.dll, igdumdx32, igd10umd32, igd10umd32); driver version: 8.15.10.2246; resolution: 1208 x 1080 @ 60 Hz; bits/pixel 32)

Storage: Intel® X-25M SSD, 160GB.

 

Conclusion

For companies that develop video creation and playback applications, MainConcept H.264/AVC Encoder for Intel Quick Sync Video provides a fast and convenient way to optimize video processing routines for delivering maximum performance on 2nd Generation Intel Core processors. In addition to speeding up development for Intel Quick Sync Video hardware acceleration, MainConcept H.264/AVC Encoder SDK for Intel Quick Sync Video future-proofs encoder implementations through support for future Intel multi-core architectures and Intel client PC platforms thanks to the Intel Media SDK. When run on legacy systems, robust x86 support provides highly threaded, optimized software fallback using the renowned MainConcept software encoder. All of these benefits help developers keep pace with the evolutionary processor lifecycle, maintain market position, and meet customer demands for better/faster product capabilities.

The MainConcept Codec SDK includes sample code and documentation for creating a wide range of plug-ins (details provided only under NDA). Interested parties should contact: sales@mainconcept.com. Existing MainConcept customers can download the SDK through the MainConcept customer portal. Log-in is required.

The Intel Media SDK is packaged with many simple application samples that illustrate how to use it to encode, decode, and pre-process media. The Intel Media SDK is available as a free download at www.intel.com/software/mediasdk.

 

References


Rovi, MainConcept and associated logos are trademarks of Rovi Corporation and/or its subsidiaries.

For more complete information about compiler optimizations, see our Optimization Notice.