YCbCr Effect

Converts planar and chroma subsampled JPEG YCbCr data to RGB. This effect assumes that the YCbCr data is formatted in compliance with the JPEG standard. Data for the inputs may be obtained from IWICPlanarBitmapSourceTransform. The YCbCr effect requires two inputs; the first must be a DXGI_FORMAT_R8 bitmap containing luma data, and the second must be a DXGI_FORMAT_R8G8 bitmap containing subsampled chroma data. For more information about using this effect, see JPEG YCbCr Support.

The CLSID for this effect is CLSID_D2D1YCbCr.

Effect properties

Display name and index enumeration Description
ChromaSubsampling
D2D1_YCBCR_CHROMA_SUBSAMPLING
Specifies the chroma subsampling of the input chroma image.
The type is D2D1_YCBCR_CHROMA_SUBSAMPLING.
The default value is D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO.
TransformMatrix
D2D1_YCBCR_PROP_TRANSFORM_MATRIX
A 3x2 Matrix specifying the axis-aligned affine transform of the image. Axis aligned transforms include Scale, Flips, and 90 degree rotations.
The type is D2D1_MATRIX_3X2_F.
The default value is Matrix3x2F::Identity().
InterpolationMode
D2D1_YCBCR_INTERPOLATION_MODE
The interpolation mode.
The type is D2D1_YCBCR_INTERPOLATION_MODE.

Subsampling modes

Enumeration Description
D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO
This mode attempts to infer the chroma subsampling from the bounds of the input images. When this option is selected, the smaller plane is upsampled to the size of the larger plane and this effect s output rectangle is the intersection of the two planes. When using this mode, care should be taken when applying effects to the input planes that change the image bounds, such as the border transform, so that the desired size ratio between the planes is maintained.
D2D1_YCBCR_CHROMA_SUBSAMPLING_420
The chroma plane is horizontally subsampled by and vertically subsampled by . When this option is selected, the chroma plane is horizontally and vertically upsampled by 2x and this effect s output rectangle is the intersection of the two planes.
D2D1_YCBCR_CHROMA_SUBSAMPLING_422
The chroma plane is horizontally subsampled by . When this option is selected, the chroma plane is horizontally upsampled by 2x and this effect s output rectangle is the intersection of the two planes.
D2D1_YCBCR_CHROMA_SUBSAMPLING_444
The chroma plane is not subsampled. When this option is selected this effect s output rectangle is the intersection of the two planes.
D2D1_YCBCR_CHROMA_SUBSAMPLING_440
The chroma plane is vertically subsampled by . When this option is selected, the chroma plane is vertically upsampled by 2x and this effect s output rectangle is the intersection of the two planes.

Interpolation modes

Enumeration Description
D2D1_YCBCR_INTERPOLATION_MODE_NEAREST_NEIGHBOR Samples the nearest single point and uses that. This mode uses less processing time, but outputs the lowest quality image.
D2D1_YCBCR_INTERPOLATION_MODE_LINEAR Uses a four point sample and linear interpolation. This mode uses more processing time than the nearest neighbor mode, but outputs a higher quality image.
D2D1_YCBCR_INTERPOLATION_MODE_CUBIC Uses a 16 sample cubic kernel for interpolation. This mode uses the most processing time, but outputs a higher quality image.
D2D1_YCBCR_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR Uses 4 linear samples within a single pixel for good edge anti-aliasing. This mode is good for scaling down by small amounts on images with few pixels.
D2D1_YCBCR_INTERPOLATION_MODE_ANISOTROPIC Uses anisotropic filtering to sample a pattern according to the transformed shape of the bitmap.
D2D1_YCBCR_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC Uses a variable size high quality cubic kernel to perform a pre-downscale the image if downscaling is involved in the transform matrix. Then uses the cubic interpolation mode for the final output.

Output bitmap

The size of the output bitmap depends on the transform matrix that is applied to the image.

The effect performs the transform operation and then applies a bounding box around the result. The output bitmap is the size of the bounding box.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps | Windows Store apps]
Minimum supported server Windows Server 2012 R2 [desktop apps | Windows Store apps]
Header d2d1effects_1.h
Library d2d1.lib, dxguid.lib

ID2D1Effect

JPEG YCbCr Support

IWICPlanarBitmapSourceTransform