expect_equal(expected_data, out_data, 4, size);
}
+// Note: The sRGB conversion itself is tested in EffectChainTester,
+// since it also wants to test the chain building itself.
+// Here, we merely test that alpha is left alone; the test will usually
+// run using the sRGB OpenGL extension, but might be run with a
+// GammaExpansionEffect if the card/driver happens not to support that.
+TEST(FlatInput, AlphaIsNotModifiedBySRGBConversion) {
+ const int size = 5;
+
+ unsigned char data[4 * size] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 63,
+ 0, 0, 0, 127,
+ 0, 0, 0, 191,
+ 0, 0, 0, 255,
+ };
+ float expected_data[4 * size] = {
+ 0, 0, 0, 0.0 / 255.0,
+ 0, 0, 0, 63.0 / 255.0,
+ 0, 0, 0, 127.0 / 255.0,
+ 0, 0, 0, 191.0 / 255.0,
+ 0, 0, 0, 255.0 / 255.0,
+ };
+ float out_data[4 * size];
+
+ EffectChainTester tester(NULL, 1, size);
+ tester.add_input(data, FORMAT_RGBA, COLORSPACE_sRGB, GAMMA_sRGB);
+ tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+ expect_equal(expected_data, out_data, 4, size);
+}
+
TEST(FlatInput, BGR) {
const int size = 5;
}
}
+TEST(GammaExpansionEffectTest, sRGB_AlphaIsUnchanged) {
+ float data[] = {
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.25f,
+ 0.0f, 0.0f, 0.0f, 0.5f,
+ 0.0f, 0.0f, 0.0f, 0.75f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+ };
+ float out_data[5 * 4];
+ EffectChainTester tester(data, 5, 1, FORMAT_RGBA, COLORSPACE_sRGB, GAMMA_sRGB);
+ tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+ expect_equal(data, out_data, 5, 1);
+}
+
TEST(GammaExpansionEffectTest, Rec709_KeyValues) {
float data[] = {
0.0f, 1.0f,
<< "No increase between " << i-1 << " and " << i;
}
}
+
+TEST(GammaExpansionEffectTest, Rec709_AlphaIsUnchanged) {
+ float data[] = {
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.25f,
+ 0.0f, 0.0f, 0.0f, 0.5f,
+ 0.0f, 0.0f, 0.0f, 0.75f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+ };
+ float out_data[5 * 4];
+ EffectChainTester tester(data, 5, 1, FORMAT_RGBA, COLORSPACE_sRGB, GAMMA_REC_709);
+ tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+ expect_equal(data, out_data, 5, 1);
+}