tag:blogger.com,1999:blog-5181746871086541575.post342036071311952584..comments2023-05-16T08:22:45.753+00:00Comments on chilliant: sRGB Integer ConversionsIan Taylorhttp://www.blogger.com/profile/06869762490434824010noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5181746871086541575.post-59663099540888249172019-02-22T02:18:31.779+00:002019-02-22T02:18:31.779+00:00If you're still reading after all these years,...If you're still reading after all these years, this is my attempt:<br />https://github.com/ncruces/go-image/blob/master/imageutil/srgb.go<br /><br />My approach is different, with two 512 byte LUTs for the forward and reverse transforms.Nuno Cruceshttps://www.blogger.com/profile/10929323435972379736noreply@blogger.comtag:blogger.com,1999:blog-5181746871086541575.post-63758795491907933772018-10-28T06:20:38.855+00:002018-10-28T06:20:38.855+00:00Isn't the final table two kilobytes, not one?
...Isn't the final table two kilobytes, not one?<br /><br />This is interesting, but it's kind of unfortunate that your focus is on converting to linear instead of from linear. I'm not sure what your use case is for this because I don't know when you would ever have 16-bit data in the sRGB gamma, let alone needing to convert it to linear as fast as possible. In the real world, most input data would be 8-bit sRGB, and you want to convert it to 16-bit linear to do high-precision linear transformations. This can be done directly with a 512 byte LUT. The hard part is converting 16-bit linear back down to 8-bit sRGB efficiently without a huge 64kb LUT.<br /><br />I imagine your solution here would work just as well though, and since typically we only care about 8-bit sRGB, it would probably work with just a 16-bit LUT for the linear piecewise approximation, so it really would be 1kb. It's not exactly straightforward to compute the tables (and get rounding right) but I can't find any better solution.Anonymousnoreply@blogger.com