Skip to content

fix: compare alpha channel in MSE::operator==#666

Open
for13to1 wants to merge 1 commit into
IENT:developfrom
for13to1:fix-mse-operator-equals
Open

fix: compare alpha channel in MSE::operator==#666
for13to1 wants to merge 1 commit into
IENT:developfrom
for13to1:fix-mse-operator-equals

Conversation

@for13to1

Copy link
Copy Markdown
Contributor

Description

This PR resolves the comparison bug in the MSE equality operator where the alpha channel was compared to itself instead of the target object.

Changes

  1. Fix MSE::operator== typo: Corrected std::tie(other.r, other.g, other.b, a) to std::tie(other.r, other.g, other.b, other.a) in ConversionDifferenceRGB.h.
  2. Update Unit Test Expectation: Since calculateDifferenceAndMSE does not calculate MSE for the alpha channel (which is expected by design since the difference tool only targets RGB color components), fixing the typo would otherwise break unit tests with alpha components (such as RGBA_8bit etc.).
    Adjusted ConversionDifferenceRGBTest.cpp to explicitly ignore alpha channel differences (diff.a = 0) before adding samples. This ensures the test's expected MSE aligns with the library's actual calculations.

Verification

Ran all unit tests on macOS:

./YUViewUnitTest

All 1860 tests now pass successfully (100% PASSED).

The alpha channel comparison was comparing this->a with itself instead
of other.a, causing MSE equality to ignore alpha differences.
@for13to1

Copy link
Copy Markdown
Contributor Author

#665

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant