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

Commit aea5077c authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix createLut in ColorSpace."

parents 43a759ee 20c825ae
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -351,13 +351,12 @@ const ColorSpace ColorSpace::ACEScg() {
    };
}

std::unique_ptr<float3> ColorSpace::createLUT(uint32_t size,
        const ColorSpace& src, const ColorSpace& dst) {

std::unique_ptr<float3[]> ColorSpace::createLUT(uint32_t size, const ColorSpace& src,
                                                const ColorSpace& dst) {
    size = clamp(size, 2u, 256u);
    float m = 1.0f / float(size - 1);

    std::unique_ptr<float3> lut(new float3[size * size * size]);
    std::unique_ptr<float3[]> lut(new float3[size * size * size]);
    float3* data = lut.get();

    ColorSpaceConnector connector(src, dst);
+2 −2
Original line number Diff line number Diff line
@@ -250,8 +250,8 @@ public:
    // axis is thus already flipped
    // The source color space must define its values in the domain [0..1]
    // The generated LUT transforms from gamma space to gamma space
    static std::unique_ptr<float3> createLUT(uint32_t size,
            const ColorSpace& src, const ColorSpace& dst);
    static std::unique_ptr<float3[]> createLUT(uint32_t size, const ColorSpace& src,
                                               const ColorSpace& dst);

private:
    static constexpr mat3 computeXYZMatrix(