Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Media SDK Shaders (EU Kernels)

Dmitry Rogozhkin edited this page Oct 13, 2020 · 6 revisions

Shaders

Media SDK uses few shaders (EU kernels) for different purposes. The following sections in detail describe each of them.

Field copy kernels

These kernels are accessible when Media SDK VPP is configured with mfxExtVPPFieldProcessing.

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_fcopy_gen8_isa.cpp BDW
genx_fcopy_gen9_isa.cpp SKL, BXT, KBL, CFL, GLK
genx_fcopy_gen11_isa.cpp ICL
genx_fcopy_gen11lp_isa.cpp ICL-LP (Low Power)
genx_fcopy_gen12lp_isa.cpp TGL, DG1

Look Ahead kernels

These kernels are used if mfxInfoMFX::RateControlMethod is one of:

  • MFX_RATECONTROL_LA
  • MFX_RATECONTROL_LA_ICQ
  • MFX_RATECONTROL_LA_EXT (Gen8+)
  • MFX_RATECONTROL_LA_HRD (Gen8+)

Kernel configuration options exposed in mfxExtCodingOption2 MediaSDK uAPI:

  • LookAheadDepth
  • LookAheadDS
  • MaxSliceSize (Gen8)
  • MaxSliceSize w/ mfxInfoMFX::LowPower=Disabled (Gen9+)
    • Note: LowPower (VDENC) implementation supports this feature natively

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_simple_me_gen8_isa.cpp BDW
genx_simple_me_gen9_isa.cpp SKL, BXT, KBL, CFL, GLK
genx_simple_me_gen11_isa.cpp ICL
genx_simple_me_gen11lp_isa.cpp ICL-LP (Low Power)
genx_simple_me_gen12lp_isa.cpp TGL, DG1

Weighted Prediction (Fade Detection) kernels

These kernels are used via mfxExtCodingOption3::FadeDetection uAPI.

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_histogram_gen9_isa.cpp SKL, BXT, KBL, CFL, GLK
genx_simple_me_gen11_isa.cpp ICL
genx_simple_me_gen11lp_isa.cpp ICL-LP (Low Power)
genx_simple_me_gen12lp_isa.cpp TGL, DG1

GPU copy and horizontal mirroring kernels

These kernels are used if one of the following conditions are met:

  • System memory I/O with mfxInitParam::GPUCopy = MFX_GPUCOPY_ON:
    • For video <> system memory transfers (Gen8+)
    • For BXT, KBL, CFL, GLK (excluding SKL) to support 10-bit color formats (performs copy and shift operation)
    • For Jpeg ARGB support performing RGB < - > BGR conversion (Gen9+)
  • Media SDK VPP is configured with mfxExtVPPMirroring::Type = MFX_MIRRORING_HORIZONTAL (Gen8+)

Kernel configuration options exposed in MediaSDK uAPI:

  • mfxFrameInfo::Shift (for 10-bit support - for system memory I/O as an option to get data in LSB instead of MSB defined by HW (Gen9+)

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_copy_kernel_gen8_isa.cpp BDW
genx_copy_kernel_gen8_isa.cpp SKL, BXT, KBL, CFL, GLK
genx_copy_kernel_gen11_isa.cpp ICL
genx_copy_kernel_gen11lp_isa.cpp ICL-LP (Low Power)
genx_copy_kernel_gen12lp_isa.cpp TGL, DG1

Motion compensation and merge kernels

These kernels are used if Media SDK VPP is configured with mfxExtVppMctf.

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_mc_gen8_isa.cpp BDW
genx_mc_gen9_isa.cpp SKL, KBL, CFL, BXT, GLK
genx_mc_gen11_isa.cpp ICL
genx_mc_gen11lp_isa.cpp ICL-LP (Low Power)
genx_mc_gen12lp_isa.cpp TGL, DG1

Motion Estimation kernels (runs on VME)

These kernels are used if Media SDK VPP is configured with mfxExtVppMctf.

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_me_gen8_isa.cpp BDW
genx_me_gen9_isa.cpp SKL, KBL, CFL, BXT, GLK
genx_me_gen11_isa.cpp ICL
genx_me_gen11lp_isa.cpp ICL-LP (Low Power)
genx_me_gen12lp_isa.cpp TGL, DG1

Spatial filtering kernels

These kernels are used if Media SDK VPP is configured with mfxExtVppMctf.

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_sd_gen8_isa.cpp BDW
genx_sd_gen9_isa.cpp SKL, KBL, CFL, BXT, GLK
genx_sd_gen11_isa.cpp ICL
genx_sd_gen11lp_isa.cpp ICL-LP (Low power)
genx_sd_gen12lp_isa.cpp TGL, DG1

Resizing kernels

These kernels perform direct subsampling of any size to 128x64 of luma layer. They are used if one of the following conditions are met:

  • Media SDK VPP is configured with mfxExtVPPDeinterlacing::Mode = MFX_DEINTERLACING_ADVANCED_SCD
  • Media SDK VPP is configured with mfxExtVppMctf
  • Media SDK AVC encoder uses External BRC with SCD (via mfxExtBRC)
  • Media SDK AVC encoders use adaptive LTR configured via mfxExtCodingOption3::ExtBrcAdaptiveLTR

Kernel sources:

Pre-built binary kernels:

Binary kernel Supported platforms
genx_scd_gen8_isa.cpp BDW
genx_scd_gen9_isa.cpp SKL, BXT, KBL, CFL, GLK
genx_scd_gen11_isa.cpp ICL
genx_scd_gen11lp_isa.cpp ICL-LP (Low Power)
genx_scd_gen12lp_isa.cpp TGL, DG1

Runtime prerequisites

Listed binary kernels require cmrt library (igfxcmrt64.so) installed and correctly running on the system to be able to run properly. This library can be build and installed along with https://github.com/intel/media-driver.

Disable binary kernels at compile time

To disable binary kernels at compile time, configure Media SDK build with the option -DMFX_ENABLE_KERNELS=OFF, i.e.:

cmake -DMFX_ENABLE_KERNELS=OFF /path/to/mediasdk

This will help to significantly reduce Media SDK library footprint on the system.

Build kernels from sources

To build kernels from sources you need to have Intel Graphics Compiler (IGC) and CM Compiler (CMC) installed:

As of now there are issues around proper installation of these packages on the system:

To rebuild mediasdk shaders, make sure that cmc and GenX_IR executables are in the path:

export PATH=/path/to/cmc:/path/to/GenX_IR:$PATH
cmake -DBUILD_KERNELS=ON /path/to/mediasdk
make
make install

These commands will permit to rebuild kernels from sources. You may notice that kernels were rebuilt via '''git-diff'''.

Clone this wiki locally