mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
wuffsfmt: double-indents hanging lines
This commit is contained in:
1 parent
d910658bce
commit
9c03b8c71d
40 files changed
+2579
-2571
No files matched your search
+64
-64
@@ -58,87 +58,87 @@ pri const ANCILLARY_BIT : base.u32 = 0x0000_0020
|
||||
// 4: y_stride - y_offset - 1
|
||||
// 5: y_offset
|
||||
pri const INTERLACING : array[8] array[6] base.u8[..= 7] = [
|
||||
[0, 0, 0, 0, 0, 0], // non-interlaced; xy_stride=1, xy_offset=0
|
||||
[3, 7, 0, 3, 7, 0], // interlace_pass == 1
|
||||
[3, 3, 4, 3, 7, 0], // interlace_pass == 2
|
||||
[2, 3, 0, 3, 3, 4], // interlace_pass == 3
|
||||
[2, 1, 2, 2, 3, 0], // interlace_pass == 4
|
||||
[1, 1, 0, 2, 1, 2], // interlace_pass == 5
|
||||
[1, 0, 1, 1, 1, 0], // interlace_pass == 6
|
||||
[0, 0, 0, 1, 0, 1], // interlace_pass == 7
|
||||
[0, 0, 0, 0, 0, 0], // non-interlaced; xy_stride=1, xy_offset=0
|
||||
[3, 7, 0, 3, 7, 0], // interlace_pass == 1
|
||||
[3, 3, 4, 3, 7, 0], // interlace_pass == 2
|
||||
[2, 3, 0, 3, 3, 4], // interlace_pass == 3
|
||||
[2, 1, 2, 2, 3, 0], // interlace_pass == 4
|
||||
[1, 1, 0, 2, 1, 2], // interlace_pass == 5
|
||||
[1, 0, 1, 1, 1, 0], // interlace_pass == 6
|
||||
[0, 0, 0, 1, 0, 1], // interlace_pass == 7
|
||||
]
|
||||
|
||||
// LOW_BIT_DEPTH_MULTIPLIERS holds multipliers that convert D-bit values into
|
||||
// 8-bit values, for depth D.
|
||||
pri const LOW_BIT_DEPTH_MULTIPLIERS : array[8] base.u8 = [
|
||||
0,
|
||||
0b1111_1111, // depth == 1
|
||||
0b0101_0101, // depth == 2
|
||||
0,
|
||||
0b0001_0001, // depth == 4
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0b1111_1111, // depth == 1
|
||||
0b0101_0101, // depth == 2
|
||||
0,
|
||||
0b0001_0001, // depth == 4
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]
|
||||
|
||||
// LOW_BIT_DEPTH_NUM_PACKS holds the number of smaller-than-1-byte units that
|
||||
// are packed into each byte.
|
||||
pri const LOW_BIT_DEPTH_NUM_PACKS : array[8] base.u8 = [
|
||||
0,
|
||||
8, // depth == 1
|
||||
4, // depth == 2
|
||||
0,
|
||||
2, // depth == 4
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
8, // depth == 1
|
||||
4, // depth == 2
|
||||
0,
|
||||
2, // depth == 4
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]
|
||||
|
||||
// NUM_CHANNELS holds the number of channels for each valid color type.
|
||||
pri const NUM_CHANNELS : array[8] base.u8[..= 4] = [
|
||||
1, // color_type == 0: Y
|
||||
0,
|
||||
3, // color_type == 2: RGB
|
||||
1, // color_type == 3: indexed
|
||||
2, // color_type == 4: YA
|
||||
0,
|
||||
4, // color_type == 6: RGBA
|
||||
0,
|
||||
1, // color_type == 0: Y
|
||||
0,
|
||||
3, // color_type == 2: RGB
|
||||
1, // color_type == 3: indexed
|
||||
2, // color_type == 4: YA
|
||||
0,
|
||||
4, // color_type == 6: RGBA
|
||||
0,
|
||||
]
|
||||
|
||||
// LATIN_1 converts from printable Latin-1 (ISO/IEC 8859-1) to UTF-8 (encoded
|
||||
// as little-endian u16). It was created by script/print-png-latin-1.go.
|
||||
pri const LATIN_1 : array[256] base.u16 = [
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
|
||||
0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
|
||||
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
|
||||
0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
|
||||
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
|
||||
0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
|
||||
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
|
||||
0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
|
||||
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
|
||||
0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
|
||||
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
|
||||
0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0xA1C2, 0xA2C2, 0xA3C2, 0xA4C2, 0xA5C2, 0xA6C2, 0xA7C2,
|
||||
0xA8C2, 0xA9C2, 0xAAC2, 0xABC2, 0xACC2, 0xADC2, 0xAEC2, 0xAFC2,
|
||||
0xB0C2, 0xB1C2, 0xB2C2, 0xB3C2, 0xB4C2, 0xB5C2, 0xB6C2, 0xB7C2,
|
||||
0xB8C2, 0xB9C2, 0xBAC2, 0xBBC2, 0xBCC2, 0xBDC2, 0xBEC2, 0xBFC2,
|
||||
0x80C3, 0x81C3, 0x82C3, 0x83C3, 0x84C3, 0x85C3, 0x86C3, 0x87C3,
|
||||
0x88C3, 0x89C3, 0x8AC3, 0x8BC3, 0x8CC3, 0x8DC3, 0x8EC3, 0x8FC3,
|
||||
0x90C3, 0x91C3, 0x92C3, 0x93C3, 0x94C3, 0x95C3, 0x96C3, 0x97C3,
|
||||
0x98C3, 0x99C3, 0x9AC3, 0x9BC3, 0x9CC3, 0x9DC3, 0x9EC3, 0x9FC3,
|
||||
0xA0C3, 0xA1C3, 0xA2C3, 0xA3C3, 0xA4C3, 0xA5C3, 0xA6C3, 0xA7C3,
|
||||
0xA8C3, 0xA9C3, 0xAAC3, 0xABC3, 0xACC3, 0xADC3, 0xAEC3, 0xAFC3,
|
||||
0xB0C3, 0xB1C3, 0xB2C3, 0xB3C3, 0xB4C3, 0xB5C3, 0xB6C3, 0xB7C3,
|
||||
0xB8C3, 0xB9C3, 0xBAC3, 0xBBC3, 0xBCC3, 0xBDC3, 0xBEC3, 0xBFC3,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
|
||||
0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
|
||||
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
|
||||
0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
|
||||
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
|
||||
0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
|
||||
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
|
||||
0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
|
||||
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
|
||||
0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
|
||||
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
|
||||
0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0xA1C2, 0xA2C2, 0xA3C2, 0xA4C2, 0xA5C2, 0xA6C2, 0xA7C2,
|
||||
0xA8C2, 0xA9C2, 0xAAC2, 0xABC2, 0xACC2, 0xADC2, 0xAEC2, 0xAFC2,
|
||||
0xB0C2, 0xB1C2, 0xB2C2, 0xB3C2, 0xB4C2, 0xB5C2, 0xB6C2, 0xB7C2,
|
||||
0xB8C2, 0xB9C2, 0xBAC2, 0xBBC2, 0xBCC2, 0xBDC2, 0xBEC2, 0xBFC2,
|
||||
0x80C3, 0x81C3, 0x82C3, 0x83C3, 0x84C3, 0x85C3, 0x86C3, 0x87C3,
|
||||
0x88C3, 0x89C3, 0x8AC3, 0x8BC3, 0x8CC3, 0x8DC3, 0x8EC3, 0x8FC3,
|
||||
0x90C3, 0x91C3, 0x92C3, 0x93C3, 0x94C3, 0x95C3, 0x96C3, 0x97C3,
|
||||
0x98C3, 0x99C3, 0x9AC3, 0x9BC3, 0x9CC3, 0x9DC3, 0x9EC3, 0x9FC3,
|
||||
0xA0C3, 0xA1C3, 0xA2C3, 0xA3C3, 0xA4C3, 0xA5C3, 0xA6C3, 0xA7C3,
|
||||
0xA8C3, 0xA9C3, 0xAAC3, 0xABC3, 0xACC3, 0xADC3, 0xAEC3, 0xAFC3,
|
||||
0xB0C3, 0xB1C3, 0xB2C3, 0xB3C3, 0xB4C3, 0xB5C3, 0xB6C3, 0xB7C3,
|
||||
0xB8C3, 0xB9C3, 0xBAC3, 0xBBC3, 0xBCC3, 0xBDC3, 0xBEC3, 0xBFC3,
|
||||
]
|
||||
@@ -29,7 +29,7 @@
|
||||
// Filter 1: Sub.
|
||||
|
||||
pri func decoder.filter_1_distance_4_arm_neon!(curr: slice base.u8),
|
||||
choose cpu_arch >= arm_neon,
|
||||
choose cpu_arch >= arm_neon,
|
||||
{
|
||||
var curr : slice base.u8
|
||||
|
||||
@@ -50,7 +50,7 @@ pri func decoder.filter_1_distance_4_arm_neon!(curr: slice base.u8),
|
||||
// Filter 3: Average.
|
||||
|
||||
pri func decoder.filter_3_distance_4_arm_neon!(curr: slice base.u8, prev: slice base.u8),
|
||||
choose cpu_arch >= arm_neon,
|
||||
choose cpu_arch >= arm_neon,
|
||||
{
|
||||
var curr : slice base.u8
|
||||
var prev : slice base.u8
|
||||
@@ -84,7 +84,7 @@ pri func decoder.filter_3_distance_4_arm_neon!(curr: slice base.u8, prev: slice
|
||||
// Filter 4: Paeth.
|
||||
|
||||
pri func decoder.filter_4_distance_3_arm_neon!(curr: slice base.u8, prev: slice base.u8),
|
||||
choose cpu_arch >= arm_neon,
|
||||
choose cpu_arch >= arm_neon,
|
||||
{
|
||||
// See the comments in filter_4_distance_4_arm_neon for an explanation of
|
||||
// how this works. That function's single loop is copied twice here, once
|
||||
@@ -125,8 +125,8 @@ pri func decoder.filter_4_distance_3_arm_neon!(curr: slice base.u8, prev: slice
|
||||
picka = cmpab.vandq_u16(b: cmpac).vmovn_u16()
|
||||
pickb = pb.vcleq_u16(b: pc).vmovn_u16()
|
||||
fx = fx.vadd_u8(
|
||||
b: picka.vbsl_u8(b: fa,
|
||||
c: pickb.vbsl_u8(b: fb, c: fc)))
|
||||
b: picka.vbsl_u8(b: fa,
|
||||
c: pickb.vbsl_u8(b: fb, c: fc)))
|
||||
// § poke_u24le replaces poke_u32le.
|
||||
curr.poke_u24le!(a: fx.as_u32x2().vget_lane_u32(b: 0))
|
||||
fc = fb
|
||||
@@ -146,8 +146,8 @@ pri func decoder.filter_4_distance_3_arm_neon!(curr: slice base.u8, prev: slice
|
||||
picka = cmpab.vandq_u16(b: cmpac).vmovn_u16()
|
||||
pickb = pb.vcleq_u16(b: pc).vmovn_u16()
|
||||
fx = fx.vadd_u8(
|
||||
b: picka.vbsl_u8(b: fa,
|
||||
c: pickb.vbsl_u8(b: fb, c: fc)))
|
||||
b: picka.vbsl_u8(b: fa,
|
||||
c: pickb.vbsl_u8(b: fb, c: fc)))
|
||||
// § poke_u24le replaces poke_u32le.
|
||||
curr.poke_u24le!(a: fx.as_u32x2().vget_lane_u32(b: 0))
|
||||
// § These assignments are unnecessary; this is the last iteration.
|
||||
@@ -157,7 +157,7 @@ pri func decoder.filter_4_distance_3_arm_neon!(curr: slice base.u8, prev: slice
|
||||
}
|
||||
|
||||
pri func decoder.filter_4_distance_4_arm_neon!(curr: slice base.u8, prev: slice base.u8),
|
||||
choose cpu_arch >= arm_neon,
|
||||
choose cpu_arch >= arm_neon,
|
||||
{
|
||||
var curr : slice base.u8
|
||||
var prev : slice base.u8
|
||||
@@ -196,8 +196,8 @@ pri func decoder.filter_4_distance_4_arm_neon!(curr: slice base.u8, prev: slice
|
||||
|
||||
// Add the predictor to the residual.
|
||||
fx = fx.vadd_u8(
|
||||
b: picka.vbsl_u8(b: fa,
|
||||
c: pickb.vbsl_u8(b: fb, c: fc)))
|
||||
b: picka.vbsl_u8(b: fa,
|
||||
c: pickb.vbsl_u8(b: fb, c: fc)))
|
||||
|
||||
curr.poke_u32le!(a: fx.as_u32x2().vget_lane_u32(b: 0))
|
||||
fc = fb
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// Filter 1: Sub.
|
||||
|
||||
pri func decoder.filter_1!(curr: slice base.u8),
|
||||
choosy,
|
||||
choosy,
|
||||
{
|
||||
var filter_distance : base.u64[..= 8]
|
||||
var fa : base.u8
|
||||
@@ -31,7 +31,7 @@ pri func decoder.filter_1!(curr: slice base.u8),
|
||||
fa = 0
|
||||
i = i_start
|
||||
while i < args.curr.length(),
|
||||
inv i_start < 8,
|
||||
inv i_start < 8,
|
||||
{
|
||||
args.curr[i] = args.curr[i] ~mod+ fa
|
||||
fa = args.curr[i]
|
||||
@@ -87,8 +87,8 @@ pri func decoder.filter_2!(curr: slice base.u8, prev: slice base.u8) {
|
||||
n = args.curr.length().min(a: args.prev.length())
|
||||
i = 0
|
||||
while i < n,
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
{
|
||||
assert i < 0xFFFF_FFFF_FFFF_FFFF via "a < b: a < c; c <= b"(c: n)
|
||||
assert i < args.curr.length() via "a < b: a < c; c <= b"(c: n)
|
||||
@@ -101,7 +101,7 @@ pri func decoder.filter_2!(curr: slice base.u8, prev: slice base.u8) {
|
||||
// Filter 3: Average.
|
||||
|
||||
pri func decoder.filter_3!(curr: slice base.u8, prev: slice base.u8),
|
||||
choosy,
|
||||
choosy,
|
||||
{
|
||||
var filter_distance : base.u64[..= 8]
|
||||
var n : base.u64
|
||||
@@ -112,7 +112,7 @@ pri func decoder.filter_3!(curr: slice base.u8, prev: slice base.u8),
|
||||
i = filter_distance
|
||||
assert i >= filter_distance via "a >= b: a == b"()
|
||||
while i < args.curr.length(),
|
||||
inv i >= filter_distance,
|
||||
inv i >= filter_distance,
|
||||
{
|
||||
assert i < 0xFFFF_FFFF_FFFF_FFFF via "a < b: a < c; c <= b"(c: args.curr.length())
|
||||
assert (i - filter_distance) < args.curr.length() via "(a - b) < c: a < c; 0 <= b"()
|
||||
@@ -125,8 +125,8 @@ pri func decoder.filter_3!(curr: slice base.u8, prev: slice base.u8),
|
||||
n = args.curr.length().min(a: args.prev.length())
|
||||
i = 0
|
||||
while (i < n) and (i < filter_distance),
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
{
|
||||
assert i < 0xFFFF_FFFF_FFFF_FFFF via "a < b: a < c; c <= b"(c: n)
|
||||
assert i < args.curr.length() via "a < b: a < c; c <= b"(c: n)
|
||||
@@ -138,17 +138,17 @@ pri func decoder.filter_3!(curr: slice base.u8, prev: slice base.u8),
|
||||
i = filter_distance
|
||||
assert i >= filter_distance via "a >= b: a == b"()
|
||||
while i < n,
|
||||
inv i >= filter_distance,
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
inv i >= filter_distance,
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
{
|
||||
assert i < 0xFFFF_FFFF_FFFF_FFFF via "a < b: a < c; c <= b"(c: n)
|
||||
assert i < args.curr.length() via "a < b: a < c; c <= b"(c: n)
|
||||
assert i < args.prev.length() via "a < b: a < c; c <= b"(c: n)
|
||||
assert (i - filter_distance) < args.curr.length() via "(a - b) < c: a < c; 0 <= b"()
|
||||
args.curr[i] = args.curr[i] ~mod+ (((
|
||||
(args.curr[i - filter_distance] as base.u32) +
|
||||
(args.prev[i] as base.u32)) / 2) as base.u8)
|
||||
(args.curr[i - filter_distance] as base.u32) +
|
||||
(args.prev[i] as base.u32)) / 2) as base.u8)
|
||||
i += 1
|
||||
assert i >= filter_distance via "a >= b: a >= (b + c); 0 <= c"(c: 1)
|
||||
} endwhile
|
||||
@@ -223,7 +223,7 @@ pri func decoder.filter_3_distance_4_fallback!(curr: slice base.u8, prev: slice
|
||||
// Filter 4: Paeth.
|
||||
|
||||
pri func decoder.filter_4!(curr: slice base.u8, prev: slice base.u8),
|
||||
choosy,
|
||||
choosy,
|
||||
{
|
||||
var filter_distance : base.u64[..= 8]
|
||||
var n : base.u64
|
||||
@@ -241,8 +241,8 @@ pri func decoder.filter_4!(curr: slice base.u8, prev: slice base.u8),
|
||||
n = args.curr.length().min(a: args.prev.length())
|
||||
i = 0
|
||||
while (i < n) and (i < filter_distance),
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
{
|
||||
assert i < 0xFFFF_FFFF_FFFF_FFFF via "a < b: a < c; c <= b"(c: n)
|
||||
assert i < args.curr.length() via "a < b: a < c; c <= b"(c: n)
|
||||
@@ -254,9 +254,9 @@ pri func decoder.filter_4!(curr: slice base.u8, prev: slice base.u8),
|
||||
i = filter_distance
|
||||
assert i >= filter_distance via "a >= b: a == b"()
|
||||
while i < n,
|
||||
inv i >= filter_distance,
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
inv i >= filter_distance,
|
||||
inv n <= args.curr.length(),
|
||||
inv n <= args.prev.length(),
|
||||
{
|
||||
assert i < 0xFFFF_FFFF_FFFF_FFFF via "a < b: a < c; c <= b"(c: n)
|
||||
assert i < args.curr.length() via "a < b: a < c; c <= b"(c: n)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
// "Have std/png filter_1_distance_? use more SIMD" for a pessimizing example.
|
||||
|
||||
pri func decoder.filter_1_distance_4_x86_sse42!(curr: slice base.u8),
|
||||
choose cpu_arch >= x86_sse42,
|
||||
choose cpu_arch >= x86_sse42,
|
||||
{
|
||||
var curr : slice base.u8
|
||||
|
||||
@@ -75,7 +75,7 @@ pri func decoder.filter_1_distance_4_x86_sse42!(curr: slice base.u8),
|
||||
// }
|
||||
|
||||
pri func decoder.filter_3_distance_4_x86_sse42!(curr: slice base.u8, prev: slice base.u8),
|
||||
choose cpu_arch >= x86_sse42,
|
||||
choose cpu_arch >= x86_sse42,
|
||||
{
|
||||
var curr : slice base.u8
|
||||
var prev : slice base.u8
|
||||
@@ -134,7 +134,7 @@ pri func decoder.filter_3_distance_4_x86_sse42!(curr: slice base.u8, prev: slice
|
||||
// Filter 4: Paeth.
|
||||
|
||||
pri func decoder.filter_4_distance_3_x86_sse42!(curr: slice base.u8, prev: slice base.u8),
|
||||
choose cpu_arch >= x86_sse42,
|
||||
choose cpu_arch >= x86_sse42,
|
||||
{
|
||||
// See the comments in filter_4_distance_4_x86_sse42 for an explanation of
|
||||
// how this works. That function's single loop is copied twice here, once
|
||||
@@ -170,10 +170,10 @@ pri func decoder.filter_4_distance_3_x86_sse42!(curr: slice base.u8, prev: slice
|
||||
pc128 = pc128._mm_abs_epi16()
|
||||
smallest128 = pc128._mm_min_epi16(b: pb128._mm_min_epi16(b: pa128))
|
||||
p128 = c128._mm_blendv_epi8(
|
||||
b: b128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pb128))._mm_blendv_epi8(
|
||||
b: a128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pa128))
|
||||
b: b128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pb128))._mm_blendv_epi8(
|
||||
b: a128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pa128))
|
||||
x128 = util.make_m128i_single_u32(a: curr.peek_u32le())
|
||||
x128 = x128._mm_unpacklo_epi8(b: z128)
|
||||
x128 = x128._mm_add_epi8(b: p128)
|
||||
@@ -196,10 +196,10 @@ pri func decoder.filter_4_distance_3_x86_sse42!(curr: slice base.u8, prev: slice
|
||||
pc128 = pc128._mm_abs_epi16()
|
||||
smallest128 = pc128._mm_min_epi16(b: pb128._mm_min_epi16(b: pa128))
|
||||
p128 = c128._mm_blendv_epi8(
|
||||
b: b128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pb128))._mm_blendv_epi8(
|
||||
b: a128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pa128))
|
||||
b: b128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pb128))._mm_blendv_epi8(
|
||||
b: a128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pa128))
|
||||
// § peek_u24le_as_u32 replaces peek_u32le.
|
||||
x128 = util.make_m128i_single_u32(a: curr.peek_u24le_as_u32())
|
||||
x128 = x128._mm_unpacklo_epi8(b: z128)
|
||||
@@ -214,7 +214,7 @@ pri func decoder.filter_4_distance_3_x86_sse42!(curr: slice base.u8, prev: slice
|
||||
}
|
||||
|
||||
pri func decoder.filter_4_distance_4_x86_sse42!(curr: slice base.u8, prev: slice base.u8),
|
||||
choose cpu_arch >= x86_sse42,
|
||||
choose cpu_arch >= x86_sse42,
|
||||
{
|
||||
var curr : slice base.u8
|
||||
var prev : slice base.u8
|
||||
@@ -259,10 +259,10 @@ pri func decoder.filter_4_distance_4_x86_sse42!(curr: slice base.u8, prev: slice
|
||||
//
|
||||
// The a._mm_blendv_epi8(b, mask) method picks b when mask is true.
|
||||
p128 = c128._mm_blendv_epi8(
|
||||
b: b128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pb128))._mm_blendv_epi8(
|
||||
b: a128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pa128))
|
||||
b: b128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pb128))._mm_blendv_epi8(
|
||||
b: a128,
|
||||
mask: smallest128._mm_cmpeq_epi16(b: pa128))
|
||||
|
||||
// Add the predictor to the residual and, for the next iteration, set
|
||||
// its previous pixels, a128 and c128, to x128 and b128.
|
||||
|
||||
+191
-191
@@ -16,143 +16,143 @@ use "std/crc32"
|
||||
use "std/zlib"
|
||||
|
||||
pub struct decoder? implements base.image_decoder(
|
||||
// The 0x00FF_FFFF limit is arbitrary (the PNG spec says 0x7FFF_FFFF) but
|
||||
// it means that (width * height * bytes_per_pixel) doesn't overflow a u64.
|
||||
width : base.u32[..= 0x00FF_FFFF],
|
||||
height : base.u32[..= 0x00FF_FFFF],
|
||||
// The 0x00FF_FFFF limit is arbitrary (the PNG spec says 0x7FFF_FFFF) but
|
||||
// it means that (width * height * bytes_per_pixel) doesn't overflow a u64.
|
||||
width : base.u32[..= 0x00FF_FFFF],
|
||||
height : base.u32[..= 0x00FF_FFFF],
|
||||
|
||||
// pass_bytes_per_row doesn't include the 1 byte for the per-row filter.
|
||||
pass_bytes_per_row : base.u64[..= 0x07FF_FFF8],
|
||||
// pass_bytes_per_row doesn't include the 1 byte for the per-row filter.
|
||||
pass_bytes_per_row : base.u64[..= 0x07FF_FFF8],
|
||||
|
||||
workbuf_wi : base.u64,
|
||||
workbuf_hist_pos_base : base.u64,
|
||||
workbuf_wi : base.u64,
|
||||
workbuf_hist_pos_base : base.u64,
|
||||
|
||||
// The inclusive upper bound, DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE, is
|
||||
// derived from the width and height upper bounds at up to 8 bytes per
|
||||
// pixel. It equals (((8 * M) + 1) * M), where M is 0x00FF_FFFF.
|
||||
overall_workbuf_length : base.u64[..= 0x0007_FFFF_F100_0007],
|
||||
pass_workbuf_length : base.u64[..= 0x0007_FFFF_F100_0007],
|
||||
// The inclusive upper bound, DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE, is
|
||||
// derived from the width and height upper bounds at up to 8 bytes per
|
||||
// pixel. It equals (((8 * M) + 1) * M), where M is 0x00FF_FFFF.
|
||||
overall_workbuf_length : base.u64[..= 0x0007_FFFF_F100_0007],
|
||||
pass_workbuf_length : base.u64[..= 0x0007_FFFF_F100_0007],
|
||||
|
||||
// The call sequence state machine is discussed in
|
||||
// (/doc/std/image-decoders-call-sequence.md).
|
||||
call_sequence : base.u8,
|
||||
// The call sequence state machine is discussed in
|
||||
// (/doc/std/image-decoders-call-sequence.md).
|
||||
call_sequence : base.u8,
|
||||
|
||||
report_metadata_chrm : base.bool,
|
||||
report_metadata_exif : base.bool,
|
||||
report_metadata_gama : base.bool,
|
||||
report_metadata_iccp : base.bool,
|
||||
report_metadata_kvp : base.bool,
|
||||
report_metadata_srgb : base.bool,
|
||||
report_metadata_chrm : base.bool,
|
||||
report_metadata_exif : base.bool,
|
||||
report_metadata_gama : base.bool,
|
||||
report_metadata_iccp : base.bool,
|
||||
report_metadata_kvp : base.bool,
|
||||
report_metadata_srgb : base.bool,
|
||||
|
||||
ignore_checksum : base.bool,
|
||||
ignore_checksum : base.bool,
|
||||
|
||||
depth : base.u8[..= 16],
|
||||
color_type : base.u8[..= 6],
|
||||
filter_distance : base.u8[..= 8],
|
||||
interlace_pass : base.u8[..= 7],
|
||||
depth : base.u8[..= 16],
|
||||
color_type : base.u8[..= 6],
|
||||
filter_distance : base.u8[..= 8],
|
||||
interlace_pass : base.u8[..= 7],
|
||||
|
||||
seen_actl : base.bool,
|
||||
seen_chrm : base.bool,
|
||||
seen_fctl : base.bool,
|
||||
seen_exif : base.bool,
|
||||
seen_gama : base.bool,
|
||||
seen_iccp : base.bool,
|
||||
seen_idat : base.bool,
|
||||
seen_ihdr : base.bool,
|
||||
seen_plte : base.bool,
|
||||
seen_srgb : base.bool,
|
||||
seen_trns : base.bool,
|
||||
seen_actl : base.bool,
|
||||
seen_chrm : base.bool,
|
||||
seen_fctl : base.bool,
|
||||
seen_exif : base.bool,
|
||||
seen_gama : base.bool,
|
||||
seen_iccp : base.bool,
|
||||
seen_idat : base.bool,
|
||||
seen_ihdr : base.bool,
|
||||
seen_plte : base.bool,
|
||||
seen_srgb : base.bool,
|
||||
seen_trns : base.bool,
|
||||
|
||||
metadata_is_zlib_compressed : base.bool,
|
||||
metadata_is_zlib_compressed : base.bool,
|
||||
|
||||
zlib_is_dirty : base.bool,
|
||||
zlib_is_dirty : base.bool,
|
||||
|
||||
chunk_type : base.u32,
|
||||
chunk_type_array : array[4] base.u8,
|
||||
chunk_length : base.u32,
|
||||
chunk_type : base.u32,
|
||||
chunk_type_array : array[4] base.u8,
|
||||
chunk_length : base.u32,
|
||||
|
||||
// remap_transparency, if non-zero, is the 32-bit or 64-bit (depending on
|
||||
// this.depth) argb_nonpremul color that is nominally opaque but remapped
|
||||
// to transparent black.
|
||||
//
|
||||
// "Remapped" is an unofficial term. This is where the IHDR color type is 0
|
||||
// (Y) or 2 (RGB) but there's also a tRNS chunk.
|
||||
//
|
||||
// PNG transparency that isn't "remapped" is color type 3 (indexed) with
|
||||
// tRNS, color type 4 (YA) or color type 6 (RGBA).
|
||||
remap_transparency : base.u64,
|
||||
// remap_transparency, if non-zero, is the 32-bit or 64-bit (depending on
|
||||
// this.depth) argb_nonpremul color that is nominally opaque but remapped
|
||||
// to transparent black.
|
||||
//
|
||||
// "Remapped" is an unofficial term. This is where the IHDR color type is 0
|
||||
// (Y) or 2 (RGB) but there's also a tRNS chunk.
|
||||
//
|
||||
// PNG transparency that isn't "remapped" is color type 3 (indexed) with
|
||||
// tRNS, color type 4 (YA) or color type 6 (RGBA).
|
||||
remap_transparency : base.u64,
|
||||
|
||||
dst_pixfmt : base.u32,
|
||||
src_pixfmt : base.u32,
|
||||
dst_pixfmt : base.u32,
|
||||
src_pixfmt : base.u32,
|
||||
|
||||
num_animation_frames_value : base.u32,
|
||||
num_animation_loops_value : base.u32,
|
||||
num_decoded_frame_configs_value : base.u32,
|
||||
num_decoded_frames_value : base.u32,
|
||||
num_animation_frames_value : base.u32,
|
||||
num_animation_loops_value : base.u32,
|
||||
num_decoded_frame_configs_value : base.u32,
|
||||
num_decoded_frames_value : base.u32,
|
||||
|
||||
// The frame_etc fields correspond to the base.frame_config argument passed
|
||||
// to decode_frame_config. For animated APNG, these are explicitly given in
|
||||
// the file's fcTL chunks. For still PNG, these are implicitly given in the
|
||||
// file's IHDR chunk.
|
||||
//
|
||||
// Either way, decode_image_config has to read all the way to the start of
|
||||
// the first IDAT / fdAT chunk (e.g. to see if there's a PLTE chunk). While
|
||||
// later frame's restart io_positions are located just before fcTL chunks,
|
||||
// the first frame's restart io_position is located just before the IDAT /
|
||||
// fdAT chunk, so we also have to cache the first frame's configuration as
|
||||
// we cannot re-read the first fcTL. Hence, there are first_etc fields for
|
||||
// every frame_etc field.
|
||||
//
|
||||
// For the etc_duration fields, there are 705_600000 flicks per second and
|
||||
// the maximum frame duration is 65535 seconds.
|
||||
//
|
||||
// The fields are ordered to minimize alignment wastage.
|
||||
frame_rect_x0 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_rect_y0 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_rect_x1 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_rect_y1 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_x0 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_y0 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_x1 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_y1 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_config_io_position : base.u64,
|
||||
first_config_io_position : base.u64,
|
||||
frame_duration : base.u64[..= 0x2A0E_6FF1_6600],
|
||||
first_duration : base.u64[..= 0x2A0E_6FF1_6600],
|
||||
frame_disposal : base.u8,
|
||||
first_disposal : base.u8,
|
||||
frame_overwrite_instead_of_blend : base.bool,
|
||||
first_overwrite_instead_of_blend : base.bool,
|
||||
// The frame_etc fields correspond to the base.frame_config argument passed
|
||||
// to decode_frame_config. For animated APNG, these are explicitly given in
|
||||
// the file's fcTL chunks. For still PNG, these are implicitly given in the
|
||||
// file's IHDR chunk.
|
||||
//
|
||||
// Either way, decode_image_config has to read all the way to the start of
|
||||
// the first IDAT / fdAT chunk (e.g. to see if there's a PLTE chunk). While
|
||||
// later frame's restart io_positions are located just before fcTL chunks,
|
||||
// the first frame's restart io_position is located just before the IDAT /
|
||||
// fdAT chunk, so we also have to cache the first frame's configuration as
|
||||
// we cannot re-read the first fcTL. Hence, there are first_etc fields for
|
||||
// every frame_etc field.
|
||||
//
|
||||
// For the etc_duration fields, there are 705_600000 flicks per second and
|
||||
// the maximum frame duration is 65535 seconds.
|
||||
//
|
||||
// The fields are ordered to minimize alignment wastage.
|
||||
frame_rect_x0 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_rect_y0 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_rect_x1 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_rect_y1 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_x0 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_y0 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_x1 : base.u32[..= 0x00FF_FFFF],
|
||||
first_rect_y1 : base.u32[..= 0x00FF_FFFF],
|
||||
frame_config_io_position : base.u64,
|
||||
first_config_io_position : base.u64,
|
||||
frame_duration : base.u64[..= 0x2A0E_6FF1_6600],
|
||||
first_duration : base.u64[..= 0x2A0E_6FF1_6600],
|
||||
frame_disposal : base.u8,
|
||||
first_disposal : base.u8,
|
||||
frame_overwrite_instead_of_blend : base.bool,
|
||||
first_overwrite_instead_of_blend : base.bool,
|
||||
|
||||
next_animation_seq_num : base.u32,
|
||||
next_animation_seq_num : base.u32,
|
||||
|
||||
metadata_flavor : base.u32,
|
||||
metadata_fourcc : base.u32,
|
||||
metadata_x : base.u64,
|
||||
metadata_y : base.u64,
|
||||
metadata_z : base.u64,
|
||||
metadata_flavor : base.u32,
|
||||
metadata_fourcc : base.u32,
|
||||
metadata_x : base.u64,
|
||||
metadata_y : base.u64,
|
||||
metadata_z : base.u64,
|
||||
|
||||
// ztxt_ri and ztxt_wi are read and write indexes into the dst_palette
|
||||
// buffer, re-purposed as a zlib uncompression buffer for zTXt chunks. The
|
||||
// upper bound, 1024, is the same as the dst_palette length.
|
||||
ztxt_ri : base.u32[..= 1024],
|
||||
ztxt_wi : base.u32[..= 1024],
|
||||
// ztxt_hist_pos is the history position: how many uncompressed bytes have
|
||||
// been generated.
|
||||
ztxt_hist_pos : base.u64,
|
||||
// ztxt_ri and ztxt_wi are read and write indexes into the dst_palette
|
||||
// buffer, re-purposed as a zlib uncompression buffer for zTXt chunks. The
|
||||
// upper bound, 1024, is the same as the dst_palette length.
|
||||
ztxt_ri : base.u32[..= 1024],
|
||||
ztxt_wi : base.u32[..= 1024],
|
||||
// ztxt_hist_pos is the history position: how many uncompressed bytes have
|
||||
// been generated.
|
||||
ztxt_hist_pos : base.u64,
|
||||
|
||||
swizzler : base.pixel_swizzler,
|
||||
util : base.utility,
|
||||
swizzler : base.pixel_swizzler,
|
||||
util : base.utility,
|
||||
)(
|
||||
crc32 : crc32.ieee_hasher,
|
||||
zlib : zlib.decoder,
|
||||
crc32 : crc32.ieee_hasher,
|
||||
zlib : zlib.decoder,
|
||||
|
||||
// dst_palette and src_palette are used by the swizzler, during
|
||||
// decode_frame. src_palette is initialized by processing the PLTE chunk.
|
||||
// dst_palette is also re-purposed as a zlib uncompression buffer for zTXt
|
||||
// chunks, during decode_image_config.
|
||||
dst_palette : array[4 * 256] base.u8,
|
||||
src_palette : array[4 * 256] base.u8,
|
||||
// dst_palette and src_palette are used by the swizzler, during
|
||||
// decode_frame. src_palette is initialized by processing the PLTE chunk.
|
||||
// dst_palette is also re-purposed as a zlib uncompression buffer for zTXt
|
||||
// chunks, during decode_image_config.
|
||||
dst_palette : array[4 * 256] base.u8,
|
||||
src_palette : array[4 * 256] base.u8,
|
||||
)
|
||||
|
||||
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
|
||||
@@ -291,7 +291,7 @@ pri func decoder.do_decode_image_config?(dst: nptr base.image_config, src: base.
|
||||
|
||||
checksum_want = args.src.read_u32be?()
|
||||
if (not this.ignore_checksum) and ((this.chunk_type & ANCILLARY_BIT) == 0) and
|
||||
(checksum_have <> checksum_want) {
|
||||
(checksum_have <> checksum_want) {
|
||||
return "#bad checksum"
|
||||
}
|
||||
} endwhile
|
||||
@@ -305,12 +305,12 @@ pri func decoder.do_decode_image_config?(dst: nptr base.image_config, src: base.
|
||||
|
||||
if args.dst <> nullptr {
|
||||
args.dst.set!(
|
||||
pixfmt: this.dst_pixfmt,
|
||||
pixsub: 0,
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
first_frame_io_position: this.first_config_io_position,
|
||||
first_frame_is_opaque: (this.color_type <= 3) and (not this.seen_trns))
|
||||
pixfmt: this.dst_pixfmt,
|
||||
pixsub: 0,
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
first_frame_io_position: this.first_config_io_position,
|
||||
first_frame_is_opaque: (this.color_type <= 3) and (not this.seen_trns))
|
||||
}
|
||||
|
||||
// For still (non-animated) PNGs, the first and only frame's configuration
|
||||
@@ -393,7 +393,7 @@ pri func decoder.decode_ihdr?(src: base.io_reader) {
|
||||
return "#bad header"
|
||||
}
|
||||
this.overall_workbuf_length = (this.height as base.u64) *
|
||||
(1 + this.calculate_bytes_per_row(width: this.width))
|
||||
(1 + this.calculate_bytes_per_row(width: this.width))
|
||||
this.choose_filter_implementations!()
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ pri func decoder.calculate_bytes_per_row(width: base.u32[..= 0x00FF_FFFF]) base.
|
||||
}
|
||||
bytes_per_channel = (this.depth >> 3) as base.u64
|
||||
return (args.width as base.u64) * bytes_per_channel *
|
||||
(NUM_CHANNELS[this.color_type] as base.u64)
|
||||
(NUM_CHANNELS[this.color_type] as base.u64)
|
||||
}
|
||||
|
||||
pri func decoder.choose_filter_implementations!() {
|
||||
@@ -499,22 +499,22 @@ pri func decoder.choose_filter_implementations!() {
|
||||
choose filter_1 = [filter_1_distance_3_fallback]
|
||||
choose filter_3 = [filter_3_distance_3_fallback]
|
||||
choose filter_4 = [
|
||||
filter_4_distance_3_arm_neon,
|
||||
filter_4_distance_3_x86_sse42,
|
||||
filter_4_distance_3_fallback]
|
||||
filter_4_distance_3_arm_neon,
|
||||
filter_4_distance_3_x86_sse42,
|
||||
filter_4_distance_3_fallback]
|
||||
} else if this.filter_distance == 4 {
|
||||
choose filter_1 = [
|
||||
filter_1_distance_4_arm_neon,
|
||||
filter_1_distance_4_x86_sse42,
|
||||
filter_1_distance_4_fallback]
|
||||
filter_1_distance_4_arm_neon,
|
||||
filter_1_distance_4_x86_sse42,
|
||||
filter_1_distance_4_fallback]
|
||||
choose filter_3 = [
|
||||
filter_3_distance_4_arm_neon,
|
||||
filter_3_distance_4_x86_sse42,
|
||||
filter_3_distance_4_fallback]
|
||||
filter_3_distance_4_arm_neon,
|
||||
filter_3_distance_4_x86_sse42,
|
||||
filter_3_distance_4_fallback]
|
||||
choose filter_4 = [
|
||||
filter_4_distance_4_arm_neon,
|
||||
filter_4_distance_4_x86_sse42,
|
||||
filter_4_distance_4_fallback]
|
||||
filter_4_distance_4_arm_neon,
|
||||
filter_4_distance_4_x86_sse42,
|
||||
filter_4_distance_4_fallback]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,8 +553,8 @@ pri func decoder.decode_other_chunk?(src: base.io_reader, framy: base.bool) {
|
||||
}
|
||||
|
||||
} else if (this.chunk_type == 'iTXt'le) or
|
||||
(this.chunk_type == 'tEXt'le) or
|
||||
(this.chunk_type == 'zTXt'le) {
|
||||
(this.chunk_type == 'tEXt'le) or
|
||||
(this.chunk_type == 'zTXt'le) {
|
||||
if this.report_metadata_kvp {
|
||||
this.metadata_flavor = base.MORE_INFORMATION__FLAVOR__METADATA_RAW_TRANSFORM
|
||||
this.metadata_fourcc = 'KVPK'be
|
||||
@@ -616,7 +616,7 @@ pri func decoder.decode_other_chunk?(src: base.io_reader, framy: base.bool) {
|
||||
|
||||
} else if this.chunk_type == 'tRNS'le {
|
||||
if this.seen_trns or (this.color_type > 3) or
|
||||
((this.color_type == 3) and (not this.seen_plte)) {
|
||||
((this.color_type == 3) and (not this.seen_plte)) {
|
||||
return "#bad chunk"
|
||||
}
|
||||
this.decode_trns?(src: args.src)
|
||||
@@ -721,7 +721,7 @@ pri func decoder.decode_fctl?(src: base.io_reader) {
|
||||
x1 ~mod+= x0
|
||||
y1 ~mod+= y0
|
||||
if (x0 >= x1) or (x0 > this.width) or (x1 > this.width) or
|
||||
(y0 >= y1) or (y0 > this.height) or (y1 > this.height) {
|
||||
(y0 >= y1) or (y0 > this.height) or (y1 > this.height) {
|
||||
return "#bad chunk"
|
||||
}
|
||||
assert x1 <= 0x00FF_FFFF via "a <= b: a <= c; c <= b"(c: this.width)
|
||||
@@ -914,10 +914,10 @@ pri func decoder.decode_trns?(src: base.io_reader) {
|
||||
u = args.src.read_u48be_as_u64?()
|
||||
if this.depth <= 8 {
|
||||
this.remap_transparency =
|
||||
(0x0000_00FF & (u >> 0)) |
|
||||
(0x0000_FF00 & (u >> 8)) |
|
||||
(0x00FF_0000 & (u >> 16)) |
|
||||
0xFF00_0000
|
||||
(0x0000_00FF & (u >> 0)) |
|
||||
(0x0000_FF00 & (u >> 8)) |
|
||||
(0x00FF_0000 & (u >> 16)) |
|
||||
0xFF00_0000
|
||||
} else {
|
||||
this.remap_transparency = u | 0xFFFF_0000_0000_0000
|
||||
}
|
||||
@@ -1023,17 +1023,17 @@ pri func decoder.do_decode_frame_config?(dst: nptr base.frame_config, src: base.
|
||||
|
||||
if args.dst <> nullptr {
|
||||
args.dst.set!(bounds: this.util.make_rect_ie_u32(
|
||||
min_incl_x: this.frame_rect_x0,
|
||||
min_incl_y: this.frame_rect_y0,
|
||||
max_excl_x: this.frame_rect_x1,
|
||||
max_excl_y: this.frame_rect_y1),
|
||||
duration: this.frame_duration,
|
||||
index: this.num_decoded_frame_configs_value as base.u64,
|
||||
io_position: this.frame_config_io_position,
|
||||
disposal: this.frame_disposal,
|
||||
opaque_within_bounds: (this.color_type <= 3) and (not this.seen_trns),
|
||||
overwrite_instead_of_blend: this.frame_overwrite_instead_of_blend,
|
||||
background_color: 0x0000_0000)
|
||||
min_incl_x: this.frame_rect_x0,
|
||||
min_incl_y: this.frame_rect_y0,
|
||||
max_excl_x: this.frame_rect_x1,
|
||||
max_excl_y: this.frame_rect_y1),
|
||||
duration: this.frame_duration,
|
||||
index: this.num_decoded_frame_configs_value as base.u64,
|
||||
io_position: this.frame_config_io_position,
|
||||
disposal: this.frame_disposal,
|
||||
opaque_within_bounds: (this.color_type <= 3) and (not this.seen_trns),
|
||||
overwrite_instead_of_blend: this.frame_overwrite_instead_of_blend,
|
||||
background_color: 0x0000_0000)
|
||||
}
|
||||
|
||||
this.num_decoded_frame_configs_value ~sat+= 1
|
||||
@@ -1190,11 +1190,11 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
this.zlib_is_dirty = true
|
||||
|
||||
status = this.swizzler.prepare!(
|
||||
dst_pixfmt: args.dst.pixel_format(),
|
||||
dst_palette: args.dst.palette_or_else(fallback: this.dst_palette[..]),
|
||||
src_pixfmt: this.util.make_pixel_format(repr: this.src_pixfmt),
|
||||
src_palette: this.src_palette[..],
|
||||
blend: args.blend)
|
||||
dst_pixfmt: args.dst.pixel_format(),
|
||||
dst_palette: args.dst.palette_or_else(fallback: this.dst_palette[..]),
|
||||
src_pixfmt: this.util.make_pixel_format(repr: this.src_pixfmt),
|
||||
src_palette: this.src_palette[..],
|
||||
blend: args.blend)
|
||||
if not status.is_ok() {
|
||||
return status
|
||||
}
|
||||
@@ -1203,11 +1203,11 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
while true {
|
||||
if (this.chunk_type_array[0] == 'I') {
|
||||
pass_width = 0x00FF_FFFF &
|
||||
(((INTERLACING[this.interlace_pass][1] as base.u32) + this.width) >>
|
||||
INTERLACING[this.interlace_pass][0])
|
||||
(((INTERLACING[this.interlace_pass][1] as base.u32) + this.width) >>
|
||||
INTERLACING[this.interlace_pass][0])
|
||||
pass_height = 0x00FF_FFFF &
|
||||
(((INTERLACING[this.interlace_pass][4] as base.u32) + this.height) >>
|
||||
INTERLACING[this.interlace_pass][3])
|
||||
(((INTERLACING[this.interlace_pass][4] as base.u32) + this.height) >>
|
||||
INTERLACING[this.interlace_pass][3])
|
||||
} else {
|
||||
pass_width = 0x00FF_FFFF & (this.frame_rect_x1 ~mod- this.frame_rect_x0)
|
||||
pass_height = 0x00FF_FFFF & (this.frame_rect_y1 ~mod- this.frame_rect_y0)
|
||||
@@ -1221,7 +1221,7 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
if status.is_ok() {
|
||||
break
|
||||
} else if status.is_error() or
|
||||
((status == base."$short read") and args.src.is_closed()) {
|
||||
((status == base."$short read") and args.src.is_closed()) {
|
||||
// The input was invalid or truncated. Produce whatever
|
||||
// pixels we can.
|
||||
if this.workbuf_wi <= args.workbuf.length() {
|
||||
@@ -1265,7 +1265,7 @@ pri func decoder.decode_pass?(src: base.io_reader, workbuf: slice base.u8) {
|
||||
this.workbuf_wi = 0
|
||||
while true {
|
||||
if (this.workbuf_wi > this.pass_workbuf_length) or (
|
||||
this.pass_workbuf_length > args.workbuf.length()) {
|
||||
this.pass_workbuf_length > args.workbuf.length()) {
|
||||
return base."#bad workbuf length"
|
||||
}
|
||||
io_bind (io: w, data: args.workbuf[this.workbuf_wi .. this.pass_workbuf_length], history_position: this.workbuf_hist_pos_base ~mod+ this.workbuf_wi) {
|
||||
@@ -1273,7 +1273,7 @@ pri func decoder.decode_pass?(src: base.io_reader, workbuf: slice base.u8) {
|
||||
w_mark = w.mark()
|
||||
r_mark = args.src.mark()
|
||||
zlib_status =? this.zlib.transform_io?(
|
||||
dst: w, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
dst: w, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
if not this.ignore_checksum {
|
||||
this.crc32.update_u32!(x: args.src.since(mark: r_mark))
|
||||
}
|
||||
@@ -1359,10 +1359,10 @@ pri func decoder.decode_pass?(src: base.io_reader, workbuf: slice base.u8) {
|
||||
|
||||
pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
|
||||
return this.util.make_rect_ie_u32(
|
||||
min_incl_x: this.frame_rect_x0,
|
||||
min_incl_y: this.frame_rect_y0,
|
||||
max_excl_x: this.frame_rect_x1,
|
||||
max_excl_y: this.frame_rect_y1)
|
||||
min_incl_x: this.frame_rect_x0,
|
||||
min_incl_y: this.frame_rect_y0,
|
||||
max_excl_x: this.frame_rect_x1,
|
||||
max_excl_y: this.frame_rect_y1)
|
||||
}
|
||||
|
||||
pub func decoder.num_animation_loops() base.u32 {
|
||||
@@ -1381,7 +1381,7 @@ pub func decoder.restart_frame!(index: base.u64, io_position: base.u64) base.sta
|
||||
if this.call_sequence < 0x20 {
|
||||
return base."#bad call sequence"
|
||||
} else if (args.index >= (this.num_animation_frames_value as base.u64)) or
|
||||
((args.index == 0) and (args.io_position <> this.first_config_io_position)) {
|
||||
((args.index == 0) and (args.io_position <> this.first_config_io_position)) {
|
||||
return base."#bad argument"
|
||||
}
|
||||
this.call_sequence = 0x28
|
||||
@@ -1445,11 +1445,11 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
return base."#bad I/O position"
|
||||
} else if args.minfo <> nullptr {
|
||||
args.minfo.set!(
|
||||
flavor: this.metadata_flavor,
|
||||
w: this.metadata_fourcc,
|
||||
x: this.metadata_x,
|
||||
y: this.metadata_y,
|
||||
z: this.metadata_z)
|
||||
flavor: this.metadata_flavor,
|
||||
w: this.metadata_fourcc,
|
||||
x: this.metadata_x,
|
||||
y: this.metadata_y,
|
||||
z: this.metadata_z)
|
||||
}
|
||||
if this.metadata_y >= this.metadata_z {
|
||||
break.goto_done
|
||||
@@ -1473,11 +1473,11 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
while.loop true {
|
||||
if args.minfo <> nullptr {
|
||||
args.minfo.set!(
|
||||
flavor: this.metadata_flavor,
|
||||
w: this.metadata_fourcc,
|
||||
x: this.metadata_x,
|
||||
y: this.metadata_y,
|
||||
z: this.metadata_z)
|
||||
flavor: this.metadata_flavor,
|
||||
w: this.metadata_fourcc,
|
||||
x: this.metadata_x,
|
||||
y: this.metadata_y,
|
||||
z: this.metadata_z)
|
||||
}
|
||||
|
||||
if this.metadata_flavor <> base.MORE_INFORMATION__FLAVOR__METADATA_RAW_TRANSFORM {
|
||||
@@ -1489,9 +1489,9 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
io_limit (io: args.src, limit: this.chunk_length as base.u64) {
|
||||
r_mark = args.src.mark()
|
||||
zlib_status =? this.zlib.transform_io?(
|
||||
dst: args.dst, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
dst: args.dst, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
this.chunk_length ~sat-=
|
||||
(args.src.count_since(mark: r_mark) & 0xFFFF_FFFF) as base.u32
|
||||
(args.src.count_since(mark: r_mark) & 0xFFFF_FFFF) as base.u32
|
||||
}
|
||||
|
||||
if zlib_status.is_ok() {
|
||||
@@ -1507,9 +1507,9 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
io_limit (io: args.src, limit: this.chunk_length as base.u64) {
|
||||
r_mark = args.src.mark()
|
||||
zlib_status =? this.zlib.transform_io?(
|
||||
dst: args.dst, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
dst: args.dst, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
this.chunk_length ~sat-=
|
||||
(args.src.count_since(mark: r_mark) & 0xFFFF_FFFF) as base.u32
|
||||
(args.src.count_since(mark: r_mark) & 0xFFFF_FFFF) as base.u32
|
||||
}
|
||||
|
||||
if zlib_status.is_ok() {
|
||||
@@ -1528,9 +1528,9 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
w_mark = w.mark()
|
||||
r_mark = args.src.mark()
|
||||
zlib_status =? this.zlib.transform_io?(
|
||||
dst: w, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
dst: w, src: args.src, workbuf: this.util.empty_slice_u8())
|
||||
this.chunk_length ~sat-=
|
||||
(args.src.count_since(mark: r_mark) & 0xFFFF_FFFF) as base.u32
|
||||
(args.src.count_since(mark: r_mark) & 0xFFFF_FFFF) as base.u32
|
||||
num_written = w.count_since(mark: w_mark)
|
||||
}
|
||||
}
|
||||
@@ -1718,6 +1718,6 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(
|
||||
min_incl: this.overall_workbuf_length,
|
||||
max_incl: this.overall_workbuf_length)
|
||||
min_incl: this.overall_workbuf_length,
|
||||
max_incl: this.overall_workbuf_length)
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
pri func decoder.filter_and_swizzle!(dst: ptr base.pixel_buffer, workbuf: slice base.u8) base.status,
|
||||
choosy,
|
||||
choosy,
|
||||
{
|
||||
var dst_pixfmt : base.pixel_format
|
||||
var dst_bits_per_pixel : base.u32[..= 256]
|
||||
@@ -44,24 +44,24 @@ pri func decoder.filter_and_swizzle!(dst: ptr base.pixel_buffer, workbuf: slice
|
||||
|
||||
if dst_bytes_per_row1 < tab.width() {
|
||||
tab = tab.subtable(
|
||||
min_incl_x: 0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: dst_bytes_per_row1,
|
||||
max_incl_y: tab.height())
|
||||
min_incl_x: 0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: dst_bytes_per_row1,
|
||||
max_incl_y: tab.height())
|
||||
}
|
||||
|
||||
if dst_bytes_per_row0 < tab.width() {
|
||||
tab = tab.subtable(
|
||||
min_incl_x: dst_bytes_per_row0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: tab.width(),
|
||||
max_incl_y: tab.height())
|
||||
min_incl_x: dst_bytes_per_row0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: tab.width(),
|
||||
max_incl_y: tab.height())
|
||||
} else {
|
||||
tab = tab.subtable(
|
||||
min_incl_x: 0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: 0,
|
||||
max_incl_y: 0)
|
||||
min_incl_x: 0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: 0,
|
||||
max_incl_y: 0)
|
||||
}
|
||||
|
||||
y = this.frame_rect_y0
|
||||
@@ -95,9 +95,9 @@ pri func decoder.filter_and_swizzle!(dst: ptr base.pixel_buffer, workbuf: slice
|
||||
}
|
||||
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst,
|
||||
dst_palette: dst_palette,
|
||||
src: curr_row)
|
||||
dst: dst,
|
||||
dst_palette: dst_palette,
|
||||
src: curr_row)
|
||||
|
||||
prev_row = curr_row
|
||||
y += 1
|
||||
|
||||
@@ -52,7 +52,7 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
src_bytes_per_pixel = 1
|
||||
if this.depth >= 8 {
|
||||
src_bytes_per_pixel = (NUM_CHANNELS[this.color_type] as base.u64) *
|
||||
((this.depth >> 3) as base.u64)
|
||||
((this.depth >> 3) as base.u64)
|
||||
}
|
||||
|
||||
if (this.chunk_type_array[0] == 'I') {
|
||||
@@ -100,7 +100,7 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
}
|
||||
if this.depth == 8 {
|
||||
while x < this.frame_rect_x1,
|
||||
inv y < 0x00FF_FFFF,
|
||||
inv y < 0x00FF_FFFF,
|
||||
{
|
||||
assert x < 0x00FF_FFFF via "a < b: a < c; c <= b"(c: this.frame_rect_x1)
|
||||
i = (x as base.u64) * dst_bytes_per_pixel
|
||||
@@ -113,9 +113,9 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
bits_unpacked[3] = s[1]
|
||||
s = s[2 ..]
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
}
|
||||
|
||||
} else if ((this.remap_transparency & 0xFFFF_FFFF) as base.u32) <> 0 {
|
||||
@@ -127,19 +127,19 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
bits_unpacked[3] = 0xFF
|
||||
s = s[1 ..]
|
||||
if ((this.remap_transparency & 0xFFFF_FFFF) as base.u32) == (
|
||||
((bits_unpacked[0] as base.u32) << 0) |
|
||||
((bits_unpacked[1] as base.u32) << 8) |
|
||||
((bits_unpacked[2] as base.u32) << 16) |
|
||||
((bits_unpacked[3] as base.u32) << 24)) {
|
||||
((bits_unpacked[0] as base.u32) << 0) |
|
||||
((bits_unpacked[1] as base.u32) << 8) |
|
||||
((bits_unpacked[2] as base.u32) << 16) |
|
||||
((bits_unpacked[3] as base.u32) << 24)) {
|
||||
bits_unpacked[0] = 0
|
||||
bits_unpacked[1] = 0
|
||||
bits_unpacked[2] = 0
|
||||
bits_unpacked[3] = 0
|
||||
}
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
}
|
||||
} else {
|
||||
if 3 <= s.length() {
|
||||
@@ -149,27 +149,27 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
bits_unpacked[3] = 0xFF
|
||||
s = s[3 ..]
|
||||
if ((this.remap_transparency & 0xFFFF_FFFF) as base.u32) == (
|
||||
((bits_unpacked[0] as base.u32) << 0) |
|
||||
((bits_unpacked[1] as base.u32) << 8) |
|
||||
((bits_unpacked[2] as base.u32) << 16) |
|
||||
((bits_unpacked[3] as base.u32) << 24)) {
|
||||
((bits_unpacked[0] as base.u32) << 0) |
|
||||
((bits_unpacked[1] as base.u32) << 8) |
|
||||
((bits_unpacked[2] as base.u32) << 16) |
|
||||
((bits_unpacked[3] as base.u32) << 24)) {
|
||||
bits_unpacked[0] = 0
|
||||
bits_unpacked[1] = 0
|
||||
bits_unpacked[2] = 0
|
||||
bits_unpacked[3] = 0
|
||||
}
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
}
|
||||
}
|
||||
|
||||
} else if src_bytes_per_pixel <= s.length() {
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: s[.. src_bytes_per_pixel])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: s[.. src_bytes_per_pixel])
|
||||
s = s[src_bytes_per_pixel ..]
|
||||
}
|
||||
}
|
||||
@@ -185,8 +185,8 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
packs_remaining = 0
|
||||
|
||||
while x < this.frame_rect_x1,
|
||||
inv y < 0x00FF_FFFF,
|
||||
inv this.depth < 8,
|
||||
inv y < 0x00FF_FFFF,
|
||||
inv this.depth < 8,
|
||||
{
|
||||
assert x < 0x00FF_FFFF via "a < b: a < c; c <= b"(c: this.frame_rect_x1)
|
||||
i = (x as base.u64) * dst_bytes_per_pixel
|
||||
@@ -205,25 +205,25 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
bits_unpacked[2] = bits_unpacked[0]
|
||||
bits_unpacked[3] = 0xFF
|
||||
if ((this.remap_transparency & 0xFFFF_FFFF) as base.u32) == (
|
||||
((bits_unpacked[0] as base.u32) << 0) |
|
||||
((bits_unpacked[1] as base.u32) << 8) |
|
||||
((bits_unpacked[2] as base.u32) << 16) |
|
||||
((bits_unpacked[3] as base.u32) << 24)) {
|
||||
((bits_unpacked[0] as base.u32) << 0) |
|
||||
((bits_unpacked[1] as base.u32) << 8) |
|
||||
((bits_unpacked[2] as base.u32) << 16) |
|
||||
((bits_unpacked[3] as base.u32) << 24)) {
|
||||
bits_unpacked[0] = 0
|
||||
bits_unpacked[1] = 0
|
||||
bits_unpacked[2] = 0
|
||||
bits_unpacked[3] = 0
|
||||
}
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 4])
|
||||
|
||||
} else {
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 1])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 1])
|
||||
}
|
||||
}
|
||||
x += (1 as base.u32) << INTERLACING[this.interlace_pass][0]
|
||||
@@ -231,7 +231,7 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
|
||||
} else {
|
||||
while x < this.frame_rect_x1,
|
||||
inv y < 0x00FF_FFFF,
|
||||
inv y < 0x00FF_FFFF,
|
||||
{
|
||||
assert x < 0x00FF_FFFF via "a < b: a < c; c <= b"(c: this.frame_rect_x1)
|
||||
i = (x as base.u64) * dst_bytes_per_pixel
|
||||
@@ -248,14 +248,14 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
bits_unpacked[7] = 0xFF
|
||||
s = s[2 ..]
|
||||
if this.remap_transparency == (
|
||||
((bits_unpacked[0] as base.u64) << 0) |
|
||||
((bits_unpacked[1] as base.u64) << 8) |
|
||||
((bits_unpacked[2] as base.u64) << 16) |
|
||||
((bits_unpacked[3] as base.u64) << 24) |
|
||||
((bits_unpacked[4] as base.u64) << 32) |
|
||||
((bits_unpacked[5] as base.u64) << 40) |
|
||||
((bits_unpacked[6] as base.u64) << 48) |
|
||||
((bits_unpacked[7] as base.u64) << 56)) {
|
||||
((bits_unpacked[0] as base.u64) << 0) |
|
||||
((bits_unpacked[1] as base.u64) << 8) |
|
||||
((bits_unpacked[2] as base.u64) << 16) |
|
||||
((bits_unpacked[3] as base.u64) << 24) |
|
||||
((bits_unpacked[4] as base.u64) << 32) |
|
||||
((bits_unpacked[5] as base.u64) << 40) |
|
||||
((bits_unpacked[6] as base.u64) << 48) |
|
||||
((bits_unpacked[7] as base.u64) << 56)) {
|
||||
bits_unpacked[0] = 0
|
||||
bits_unpacked[1] = 0
|
||||
bits_unpacked[2] = 0
|
||||
@@ -279,14 +279,14 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
bits_unpacked[7] = 0xFF
|
||||
s = s[6 ..]
|
||||
if this.remap_transparency == (
|
||||
((bits_unpacked[0] as base.u64) << 0) |
|
||||
((bits_unpacked[1] as base.u64) << 8) |
|
||||
((bits_unpacked[2] as base.u64) << 16) |
|
||||
((bits_unpacked[3] as base.u64) << 24) |
|
||||
((bits_unpacked[4] as base.u64) << 32) |
|
||||
((bits_unpacked[5] as base.u64) << 40) |
|
||||
((bits_unpacked[6] as base.u64) << 48) |
|
||||
((bits_unpacked[7] as base.u64) << 56)) {
|
||||
((bits_unpacked[0] as base.u64) << 0) |
|
||||
((bits_unpacked[1] as base.u64) << 8) |
|
||||
((bits_unpacked[2] as base.u64) << 16) |
|
||||
((bits_unpacked[3] as base.u64) << 24) |
|
||||
((bits_unpacked[4] as base.u64) << 32) |
|
||||
((bits_unpacked[5] as base.u64) << 40) |
|
||||
((bits_unpacked[6] as base.u64) << 48) |
|
||||
((bits_unpacked[7] as base.u64) << 56)) {
|
||||
bits_unpacked[0] = 0
|
||||
bits_unpacked[1] = 0
|
||||
bits_unpacked[2] = 0
|
||||
@@ -326,9 +326,9 @@ pri func decoder.filter_and_swizzle_tricky!(dst: ptr base.pixel_buffer, workbuf:
|
||||
}
|
||||
|
||||
this.swizzler.swizzle_interleaved_from_slice!(
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 8])
|
||||
dst: dst[i ..],
|
||||
dst_palette: dst_palette,
|
||||
src: bits_unpacked[.. 8])
|
||||
}
|
||||
x += (1 as base.u32) << INTERLACING[this.interlace_pass][0]
|
||||
} endwhile
|
||||
|
||||
Reference in new issue
Block a user