Skip to content

Commit 8b274ae

Browse files
committed
Add test to reproduce bug 2220
Code incorrectly deals with edge cases where atan2() returns end of range [-pi, pi] Signed-off-by: Kevin Wheatley <[email protected]>
1 parent 1d77ecd commit 8b274ae

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/cpu/ops/fixedfunction/FixedFunctionOpCPU_tests.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,33 @@ OCIO_ADD_TEST(FixedFunctionOpCPU, aces_ot_20_rec709_100n_rt)
586586
__LINE__);
587587
}
588588

589+
OCIO_ADD_TEST(FixedFunctionOpCPU, aces_ot_20_edge_cases)
590+
{
591+
constexpr int test_cases = 2;
592+
constexpr int num_channels = 4;
593+
std::array<float, test_cases * num_channels> input_32f = {
594+
0.0f, 0.0f, 0.0f, 1.0f,
595+
0.742242277f, 0.0931933373f, 0.321542144f, 1.0f // Bug 2220: related to hue angle calculation not wrapping
596+
};
597+
constexpr std::array<float, test_cases * num_channels> expected_32f = {
598+
0.0f, 0.0f, 0.0f, 1.0f,
599+
0.0f, 0.0f, 0.0f, 1.0f,
600+
};
601+
602+
OCIO::FixedFunctionOpData::Params params = {
603+
// Peak luminance
604+
100.f,
605+
// Rec709 gamut
606+
0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, 0.3127, 0.3290
607+
};
608+
609+
OCIO::ConstFixedFunctionOpDataRcPtr funcData
610+
= std::make_shared<OCIO::FixedFunctionOpData>(OCIO::FixedFunctionOpData::ACES_OUTPUT_TRANSFORM_20_FWD,
611+
params);
612+
613+
ApplyFixedFunction(input_32f.data(), expected_32f.data(), test_cases, funcData, 1e-6f, __LINE__);
614+
}
615+
589616
OCIO_ADD_TEST(FixedFunctionOpCPU, aces_ot_20_p3d65_100n_rt)
590617
{
591618
const int lut_size = 8;

0 commit comments

Comments
 (0)