Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 369ea47f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Treat extended range sRGB dataspaces as HDR"

parents 6e3ca218 eed9d5db
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -22,8 +22,10 @@ namespace android {

inline bool isHdrDataspace(ui::Dataspace dataspace) {
    const auto transfer = dataspace & HAL_DATASPACE_TRANSFER_MASK;
    const auto range = dataspace & HAL_DATASPACE_RANGE_MASK;

    return transfer == HAL_DATASPACE_TRANSFER_ST2084 || transfer == HAL_DATASPACE_TRANSFER_HLG;
    return transfer == HAL_DATASPACE_TRANSFER_ST2084 || transfer == HAL_DATASPACE_TRANSFER_HLG ||
            range == HAL_DATASPACE_RANGE_EXTENDED;
}

} // namespace android
+4 −3
Original line number Diff line number Diff line
@@ -29,12 +29,13 @@ TEST_F(DataspaceUtilsTest, isHdrDataspace) {
    EXPECT_TRUE(isHdrDataspace(ui::Dataspace::BT2020_ITU_PQ));
    EXPECT_TRUE(isHdrDataspace(ui::Dataspace::BT2020_PQ));
    EXPECT_TRUE(isHdrDataspace(ui::Dataspace::BT2020_HLG));
    // The original formulation of scRGB indicates the same white points as that
    // of sRGB, however scRGB may be used to implement HDR.
    EXPECT_TRUE(isHdrDataspace(ui::Dataspace::V0_SCRGB_LINEAR));
    EXPECT_TRUE(isHdrDataspace(ui::Dataspace::V0_SCRGB));

    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_SRGB_LINEAR));
    // scRGB defines a very wide gamut but not an expanded luminance range
    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_SCRGB_LINEAR));
    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_SRGB));
    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_SCRGB));
    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_JFIF));
    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_BT601_625));
    EXPECT_FALSE(isHdrDataspace(ui::Dataspace::V0_BT601_525));