1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibGfx: Implement PNG filtering on write

Is it another great upgrade to our PNG encoder like in 9aafaec259?
Well, not really - it's not a 2x or 55x improvement like you saw there,
but still it saves something:

- a screenshot of a blank Serenity desktop dropped from about 45 KiB
  to 40 KiB.
- re-encoding NASA photo of the Earth to PNG again saves about 25%
  (16.5 MiB -> 12.3 MiB), compared to not using filters.

[1]: https://commons.wikimedia.org/wiki/File:The_Blue_Marble_(remastered).jpg
This commit is contained in:
Karol Kosek 2022-07-10 00:18:18 +02:00 committed by Andreas Kling
parent 98a90d79de
commit b5420b8a9a
3 changed files with 124 additions and 6 deletions

View file

@ -36,6 +36,18 @@ ALWAYS_INLINE static constexpr u32x4 expand4(u32 u)
// Casting
template<typename TSrc>
ALWAYS_INLINE static u8x4 to_u8x4(TSrc v)
{
return __builtin_convertvector(v, u8x4);
}
template<typename TSrc>
ALWAYS_INLINE static u16x4 to_u16x4(TSrc v)
{
return __builtin_convertvector(v, u16x4);
}
template<typename TSrc>
ALWAYS_INLINE static u32x4 to_u32x4(TSrc v)
{