Nigel Tao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84340?usp=email )
Change subject: lib/jpeg: enable dst-pixel-format allowlist ......................................................................
lib/jpeg: enable dst-pixel-format allowlist
Wuffs can decode image files to a variety of pixel formats (BGRA vs RGBA, premultiplied vs non-premultiplied alpha, 8-bit vs 16-bit, etc). If Coreboot always decodes to BGRA and never to RGBA then we can cut out the unused code paths at compile time, via configuration macros.
Before fallback/ramstage 84180 LZMA (174340 decompressed) After fallback/ramstage 83513 LZMA (173056 decompressed) = 99.21%
It's not a large saving, but every little bit helps.
Change-Id: Ie29592f74f245cb890d18b68060640e9bab192b2 --- M src/lib/jpeg.c 1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/40/84340/1
diff --git a/src/lib/jpeg.c b/src/lib/jpeg.c index 617ab0b..2de58b6 100644 --- a/src/lib/jpeg.c +++ b/src/lib/jpeg.c @@ -9,6 +9,10 @@ #include "jpeg.h"
#define WUFFS_CONFIG__AVOID_CPU_ARCH +#define WUFFS_CONFIG__DST_PIXEL_FORMAT__ENABLE_ALLOWLIST +#define WUFFS_CONFIG__DST_PIXEL_FORMAT__ALLOW_BGR_565 +#define WUFFS_CONFIG__DST_PIXEL_FORMAT__ALLOW_BGR +#define WUFFS_CONFIG__DST_PIXEL_FORMAT__ALLOW_BGRA_NONPREMUL #define WUFFS_CONFIG__MODULES #define WUFFS_CONFIG__MODULE__BASE #define WUFFS_CONFIG__MODULE__JPEG @@ -62,6 +66,9 @@ return JPEG_DECODE_FAILED; }
+ /* The WUFFS_BASE__PIXEL_FORMAT__FOOBAR values used here match + * "#define WUFFS_CONFIG__DST_PIXEL_FORMAT__ALLOW_FOOBAR" above. + */ uint32_t pixfmt; switch (depth) { case 16: