EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned height,
MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve,
- GLenum framebuffer_format,
- GLenum intermediate_format)
- : chain(width, height, get_static_pool(), intermediate_format),
+ GLenum framebuffer_format)
+ : chain(width, height, get_static_pool()),
width(width),
height(height),
framebuffer_format(framebuffer_format),
EXPECT_LT(rms, rms_limit);
}
+double srgb_to_linear(double x)
+{
+ // From the Wikipedia article on sRGB.
+ if (x < 0.04045) {
+ return x / 12.92;
+ } else {
+ return pow((x + 0.055) / 1.055, 2.4);
+ }
+}
+
+double linear_to_srgb(double x)
+{
+ // From the Wikipedia article on sRGB.
+ if (x < 0.0031308) {
+ return 12.92 * x;
+ } else {
+ return 1.055 * pow(x, 1.0 / 2.4) - 0.055;
+ }
+}
+
} // namespace movit