pixconv: allow swizzling to Y (gray) more often

Binary size, before:
124816 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
124816 gen/lib/c/clang-static/wuffs-base-pixconv.o
196736 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
196672 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
142032 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
142032 gen/lib/c/clang-static/wuffs-base-pixconv.o
242712 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
242584 gen/lib/c/gcc-static/wuffs-base-pixconv.o
This commit is contained in:
Nigel Tao committed 2024-09-08 22:54:35 +10:00
1 parent 43d412a15f
commit 42ba720d4e
8 files changed
+1405 -32

No files matched your search

+4 -21
View File
@@ -378,10 +378,10 @@ test_wuffs_pixel_swizzler_swizzle() {
// When updating this list, also consider updating the pixel formats that
// fuzz/c/std/pixel_swizzler_fuzzer.c exercises and those that
// wuffs_aux::DecodeImageCallbacks::SelectPixfmt accepts.
//
// SelectPixfmt excludes WUFFS_BASE__PIXEL_FORMAT__Y, even though we test
// it here, since it doesn't support every source pixel format in the
// srcs array. See "dst WUFFS_BASE__PIXEL_FORMAT__Y allow-list" below.
{
.color = 0xFF999999,
.pixfmt_repr = WUFFS_BASE__PIXEL_FORMAT__Y,
},
{
.color = 0xFF000010,
.pixfmt_repr = WUFFS_BASE__PIXEL_FORMAT__BGR_565,
@@ -414,10 +414,6 @@ test_wuffs_pixel_swizzler_swizzle() {
.color = 0x33002233,
.pixfmt_repr = WUFFS_BASE__PIXEL_FORMAT__RGBA_PREMUL,
},
{
.color = 0xFF999999,
.pixfmt_repr = WUFFS_BASE__PIXEL_FORMAT__Y,
},
};
const wuffs_base__pixel_blend blends[] = {
@@ -455,19 +451,6 @@ test_wuffs_pixel_swizzler_swizzle() {
}
for (size_t d = 0; d < WUFFS_TESTLIB_ARRAY_SIZE(dsts); d++) {
// See "dst WUFFS_BASE__PIXEL_FORMAT__Y allow-list" above.
if (dsts[d].pixfmt_repr == WUFFS_BASE__PIXEL_FORMAT__Y) {
switch (srcs[s].pixfmt_repr) {
case WUFFS_BASE__PIXEL_FORMAT__Y:
case WUFFS_BASE__PIXEL_FORMAT__Y_16BE:
case WUFFS_BASE__PIXEL_FORMAT__BGRX:
case WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL:
break;
default:
continue;
}
}
// Allocate the dst_pixbuf.
wuffs_base__pixel_config dst_pixcfg = ((wuffs_base__pixel_config){});
wuffs_base__pixel_config__set(&dst_pixcfg, dsts[d].pixfmt_repr,