1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-09-18 22:59:54 +00:00
5 ComputeMSE
Chuck Walbourn edited this page 2022-01-20 17:41:58 -08:00
DirectXTex

Computes the mean-squared error for each component based on two input images.

HRESULT ComputeMSE(
    const Image& image1, const Image& image2,
    float& mse, float* mseV,
    CMSE_FLAGS flags = CMSE_DEFAULT );

Parameters

flags: a combination of the following flags

  • CMSE_DEFAULT Default flags

  • CMSE_IMAGE1_SRGB Indicates image1 should have sRGB -> scRGB conversion applied before comparison.

  • CMSE_IMAGE2_SRGB Indicates image2 should have sRGB -> scRGB conversion applied before comparison.

  • CMSE_IMAGE1_X2_BIAS Indicates image1 should have the UNORM -> SNORM conversion applied before comparison.

  • CMSE_IMAGE2_X2_BIAS Indicates image2 should have the UNORM -> SNORM conversion applied before comparison.

  • CMSE_IGNORE_RED Indicates comparison should ignore differences in the RED (X) channel.

  • CMSE_IGNORE_GREEN Indicates comparison should ignore differences in the GREEN (Y) channel.

  • CMSE_IGNORE_BLUE Indicates comparison should ignore differences in the BLUE (Z) channel.

  • CMSE_IGNORE_ALPHA Indicates comparison should ignore differences in the ALPHA (W) channel.

mse: The sum of the channel mean-squared error.

mseV: Points to an array of 4 floats which holds the individual channel mean-squared error. Can be nullptr.

Remarks

Image data is converted to DXGI_FORMAT_R32G32B32A32_FLOAT for this operation. BC data is automatically decompressed.

This function cannot operate directly on a planar format image. See ConvertToSinglePlane for a method for converting planar data to a format that is supported by this routine.