Swizzler support src_pixfmt = PIXEL_FORMAT__Y_16BE

Binary size, before:
30800 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
32424 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
56200 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
56152 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
33416 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
35120 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
59504 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
59440 gen/lib/c/gcc-static/wuffs-base-pixconv.o
This commit is contained in:
Nigel Tao committed 2021-02-03 13:11:22 +11:00
1 parent e77e16cd98
commit 4942324f25
7 files changed
+450 -61

No files matched your search

+13 -8
View File
@@ -301,25 +301,30 @@ pri func decoder.calculate_bytes_per_row!() {
choose filter_and_swizzle = [filter_and_swizzle_low_bit_depth]
} else if this.color_type == 0 {
this.dst_pixfmt = base.PIXEL_FORMAT__Y
this.src_pixfmt = base.PIXEL_FORMAT__Y
if this.depth == 8 {
this.dst_pixfmt = base.PIXEL_FORMAT__Y
this.src_pixfmt = base.PIXEL_FORMAT__Y
this.filter_distance = 1
this.bytes_per_row = (this.width as base.u64) * 1
} else if this.depth == 16 {
this.dst_pixfmt = base.PIXEL_FORMAT__Y // TODO: PIXEL_FORMAT__Y_16LE
this.src_pixfmt = base.PIXEL_FORMAT__Y_16BE
this.filter_distance = 2
this.bytes_per_row = (this.width as base.u64) * 2
}
} else if this.color_type == 2 {
this.dst_pixfmt = base.PIXEL_FORMAT__BGR
this.src_pixfmt = base.PIXEL_FORMAT__RGB
if this.depth == 8 {
this.dst_pixfmt = base.PIXEL_FORMAT__BGR
this.src_pixfmt = base.PIXEL_FORMAT__RGB
this.filter_distance = 3
this.bytes_per_row = (this.width as base.u64) * 3
}
} else if this.color_type == 3 {
this.dst_pixfmt = base.PIXEL_FORMAT__INDEXED__BGRA_BINARY
this.src_pixfmt = base.PIXEL_FORMAT__INDEXED__BGRA_BINARY
if this.depth == 8 {
this.dst_pixfmt = base.PIXEL_FORMAT__INDEXED__BGRA_BINARY
this.src_pixfmt = base.PIXEL_FORMAT__INDEXED__BGRA_BINARY
this.filter_distance = 1
this.bytes_per_row = (this.width as base.u64) * 1
}
@@ -328,9 +333,9 @@ pri func decoder.calculate_bytes_per_row!() {
// TODO: PIXEL_FORMAT__YA_NONPREMUL
} else if this.color_type == 6 {
this.dst_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
this.src_pixfmt = base.PIXEL_FORMAT__RGBA_NONPREMUL
if this.depth == 8 {
this.dst_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
this.src_pixfmt = base.PIXEL_FORMAT__RGBA_NONPREMUL
this.filter_distance = 4
this.bytes_per_row = (this.width as base.u64) * 4
}