Permalink
Browse files

Remove unused sRGB conversion functions

Now the arbitrary mipmap reference downsampling is just done in linear space,
these are no longer used.
  • Loading branch information...
JonnyH committed Jul 2, 2018
1 parent 431b9e7 commit b54803a074ad8ee02ee5c7073db237acb705bf7b
Showing with 0 additions and 19 deletions.
  1. +0 −19 Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -544,19 +544,6 @@ class ArbitraryMipmapDetector
}
private:
static float SRGBToLinear(u8 srgb_byte)
{
auto srgb_float = static_cast<float>(srgb_byte) / 256.f;
// approximations found on
// http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html
return srgb_float * (srgb_float * (srgb_float * 0.305306011f + 0.682171111f) + 0.012522878f);
}
static u8 LinearToSRGB(float linear)
{
return static_cast<u8>(std::max(1.055f * std::pow(linear, 0.416666667f) - 0.055f, 0.f) * 256.f);
}
struct Shape
{
u32 width;
@@ -569,12 +556,6 @@ class ArbitraryMipmapDetector
Shape shape;
const u8* pixels;
static PixelRGBAf Sample(const u8* src, const Shape& src_shape, u32 x, u32 y)
{
const auto* p = src + (x + y * src_shape.row_length) * 4;
return {{SRGBToLinear(p[0]), SRGBToLinear(p[1]), SRGBToLinear(p[2]), SRGBToLinear(p[3])}};
}
static PixelRGBAu8 SampleLinear(const u8* src, const Shape& src_shape, u32 x, u32 y)
{
const auto* p = src + (x + y * src_shape.row_length) * 4;

0 comments on commit b54803a

Please sign in to comment.