ID3D11VideoContext::VideoProcessorSetStreamLumaKey method (d3d11.h)

Sets the luma key for an input stream on the video processor.


void VideoProcessorSetStreamLumaKey(
  [in] ID3D11VideoProcessor *pVideoProcessor,
  [in] UINT                 StreamIndex,
  [in] BOOL                 Enable,
  [in] FLOAT                Lower,
  [in] FLOAT                Upper


[in] pVideoProcessor

A pointer to the ID3D11VideoProcessor interface. To get this pointer, call ID3D11VideoDevice::CreateVideoProcessor.

[in] StreamIndex

The zero-based index of the input stream. To get the maximum number of streams, call ID3D11VideoProcessorEnumerator::GetVideoProcessorCaps and check the MaxStreamStates structure member.

[in] Enable

Specifies whether luma keying is enabled.

[in] Lower

The lower bound for the luma key. The valid range is [0…1]. If Enable is FALSE, this parameter is ignored.

[in] Upper

The upper bound for the luma key. The valid range is [0…1]. If Enable is FALSE, this parameter is ignored.

Return value



To use this feature, the driver must support luma keying, indicated by the D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY capability flag. To query for this capability, call ID3D11VideoProcessorEnumerator::GetVideoProcessorCaps. In addition, if the input format is RGB, the device must support the D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY capability.

The values of Lower and Upper give the lower and upper bounds of the luma key, using a nominal range of [0...1]. Given a format with n bits per channel, these values are converted to luma values as follows:

val = f * ((1 << n)-1)

Any pixel whose luma value falls within the upper and lower bounds (inclusive) is treated as transparent.

For example, if the pixel format uses 8-bit luma, the upper bound is calculated as follows:

BYTE Y = BYTE(max(min(1.0, Upper), 0.0) * 255.0)

Note that the value is clamped to the range [0...1] before multiplying by 255.


Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header d3d11.h

See also