ID3D11VideoContext::VideoProcessorSetStreamLumaKey Method

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

Syntax

public:
void VideoProcessorSetStreamLumaKey(
         ID3D11VideoProcessor *pVideoProcessor,
         UINT StreamIndex,
         BOOL Enable,
         FLOAT Lower,
         FLOAT Upper
)  

Parameters

pVideoProcessor
Type: ID3D11VideoProcessor *

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

StreamIndex
Type: UINT 

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

Enable
Type: BOOL 

[in] Specifies whether luma keying is enabled.

Lower
Type: FLOAT 

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

Upper
Type: FLOAT 

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

Return value

None.

Remarks

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.

Requirements

Header: Declared in d3d11_x.h (d3d11.h on other Windows platforms).