log2 approximation. A slight bit faster than std::log. */
| 5221 | |
| 5222 | /* log2 approximation. A slight bit faster than std::log. */ |
| 5223 | static float flog2(float f) |
| 5224 | { |
| 5225 | float result = 0; |
| 5226 | while(f > 32) { result += 4; f /= 16; } |
| 5227 | while(f > 2) { result++; f /= 2; } |
| 5228 | return result + 1.442695f * (f * f * f / 3 - 3 * f * f / 2 + 3 * f - 1.83333f); |
| 5229 | } |
| 5230 | |
| 5231 | static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, |
| 5232 | const LodePNGColorMode* info, const LodePNGEncoderSettings* settings) |