lib/handsum: renumber quality from 0..=3 to 1..=4

This commit is contained in:
Nigel Tao committed 2026-05-06 21:39:21 +10:00
1 parent 5db6a08b6a
commit 979a9d898c
24 files changed
+107 -127

No files matched your search

+6 -6
View File
@@ -42,7 +42,7 @@ var (
bFlag = flag.String("b", "", "") bFlag = flag.String("b", "", "")
bgFlag = flag.String("bg", "", "") bgFlag = flag.String("bg", "", "")
cFlag = flag.String("c", "rgb", "") cFlag = flag.String("c", "rgb", "")
qFlag = flag.Int("q", 3, "") qFlag = flag.Int("q", 4, "")
) )
func getBFlag() string { func getBFlag() string {
@@ -68,7 +68,7 @@ Decode inputs Handsum and outputs PNG.
Encode inputs BMP, GIF, JPEG, PNG, TIFF or WEBP and outputs Handsum. Encode inputs BMP, GIF, JPEG, PNG, TIFF or WEBP and outputs Handsum.
Roundtrip is equivalent to encode (to an ephemeral file) and then decode. Roundtrip is equivalent to encode (to an ephemeral file) and then decode.
For encode or roundtrip, the default color and quality is -c=rgb -q=3 (best For encode or roundtrip, the default color and quality is -c=rgb -q=4 (best
quality; 147 bytes per file) but you can choose a lower setting. The -b or -bg quality; 147 bytes per file) but you can choose a lower setting. The -b or -bg
flag sets a background color (in case the input is transparent). For example: flag sets a background color (in case the input is transparent). For example:
@@ -85,7 +85,7 @@ Flags:
-b or -bg Encoding background color: e.g. red, white, 9c27b0 or #ff8. -b or -bg Encoding background color: e.g. red, white, 9c27b0 or #ff8.
The default is ff9e9e9e (for -c=1 or -c=3) or 00000000 (for -c=4). The default is ff9e9e9e (for -c=1 or -c=3) or 00000000 (for -c=4).
-c Encoding color: gray (1), rgb (3, default) or rgba (4). -c Encoding color: gray (1), rgb (3, default) or rgba (4).
-q Encoding quality: 0, 1, 2 or 3 (default). -q Encoding quality: 1, 2, 3 or 4 (default).
` `
func main() { func main() {
@@ -106,7 +106,7 @@ func main1() error {
case "4", "RGBA", "Rgba", "rgba": case "4", "RGBA", "Rgba", "rgba":
color = handsum.ColorRGBA color = handsum.ColorRGBA
} }
quality := handsum.Quality(max(0, min(3, *qFlag))) quality := handsum.Quality(max(1, min(4, *qFlag)))
if (color <= handsum.ColorRGB) && (getBFlag() == "") { if (color <= handsum.ColorRGB) && (getBFlag() == "") {
*bFlag = "ff9e9e9e" *bFlag = "ff9e9e9e"
@@ -158,8 +158,8 @@ func encode(w io.Writer, inFile *os.File, color handsum.Color, quality handsum.Q
} }
return handsum.Encode(w, src, &handsum.EncodeOptions{ return handsum.Encode(w, src, &handsum.EncodeOptions{
Color: handsum.MakeOptionColor(color), Color: color,
Quality: handsum.MakeOptionQuality(quality), Quality: quality,
}) })
} }
+10 -10
View File
@@ -230,15 +230,15 @@ const uint8_t g_src_ptr__mona_lisa_21_32_th[] = {
}; };
const size_t g_src_len__mona_lisa_21_32_th = 24; const size_t g_src_len__mona_lisa_21_32_th = 24;
const uint8_t g_src_ptr__mona_lisa_21_32_c3q0_handsum[] = { const uint8_t g_src_ptr__mona_lisa_21_32_c3q1_handsum[] = {
0xfe, 0xd7, 0x1a, 0x76, 0x8b, 0x9a, 0x76, 0x58, 0x88, 0x99, 0x68, 0xb6, 0xfe, 0xd7, 0x1a, 0x76, 0x8b, 0x9a, 0x76, 0x58, 0x88, 0x99, 0x68, 0xb6,
0x79, 0xaa, 0xa6, 0x86, 0x99, 0x97, 0x63, 0x7b, 0x89, 0x98, 0xb9, 0x59, 0x79, 0xaa, 0xa6, 0x86, 0x99, 0x97, 0x63, 0x7b, 0x89, 0x98, 0xb9, 0x59,
0x79, 0x28, 0xb8, 0x88, 0x8a, 0x89, 0x8a, 0x99, 0x98, 0x77, 0x94, 0x98, 0x79, 0x28, 0xb8, 0x88, 0x8a, 0x89, 0x8a, 0x99, 0x98, 0x77, 0x94, 0x98,
0x79, 0x88, 0x88, 0x88, 0x97, 0x79, 0x87, 0x77, 0x88, 0x88, 0x88, 0x98, 0x79, 0x88, 0x88, 0x88, 0x97, 0x79, 0x87, 0x77, 0x88, 0x88, 0x88, 0x98,
}; };
const size_t g_src_len__mona_lisa_21_32_c3q0_handsum = 48; const size_t g_src_len__mona_lisa_21_32_c3q1_handsum = 48;
const uint8_t g_src_ptr__mona_lisa_21_32_c3q3_handsum[] = { const uint8_t g_src_ptr__mona_lisa_21_32_c3q4_handsum[] = {
0xfe, 0xd7, 0x7a, 0x87, 0x76, 0x68, 0x87, 0x75, 0x89, 0x77, 0x8c, 0xb7, 0xfe, 0xd7, 0x7a, 0x87, 0x76, 0x68, 0x87, 0x75, 0x89, 0x77, 0x8c, 0xb7,
0xc7, 0x9b, 0x78, 0x64, 0x5a, 0x98, 0xb4, 0x79, 0xe6, 0x75, 0x57, 0x8a, 0xc7, 0x9b, 0x78, 0x64, 0x5a, 0x98, 0xb4, 0x79, 0xe6, 0x75, 0x57, 0x8a,
0x84, 0x88, 0x03, 0x86, 0x7a, 0x68, 0x87, 0x76, 0x68, 0xf4, 0x55, 0xe2, 0x84, 0x88, 0x03, 0x86, 0x7a, 0x68, 0x87, 0x76, 0x68, 0xf4, 0x55, 0xe2,
@@ -253,7 +253,7 @@ const uint8_t g_src_ptr__mona_lisa_21_32_c3q3_handsum[] = {
0xba, 0x86, 0x58, 0x8a, 0x9a, 0xa8, 0x89, 0x9a, 0xa7, 0x79, 0xa9, 0xc8, 0xba, 0x86, 0x58, 0x8a, 0x9a, 0xa8, 0x89, 0x9a, 0xa7, 0x79, 0xa9, 0xc8,
0x99, 0x8b, 0x87, 0x99, 0x8b, 0x87,
}; };
const size_t g_src_len__mona_lisa_21_32_c3q3_handsum = 147; const size_t g_src_len__mona_lisa_21_32_c3q4_handsum = 147;
const uint8_t g_src_ptr__mona_lisa_21_32_etc2_pkm[] = { const uint8_t g_src_ptr__mona_lisa_21_32_etc2_pkm[] = {
0x50, 0x4b, 0x4d, 0x20, 0x32, 0x30, 0x00, 0x01, 0x00, 0x18, 0x00, 0x20, 0x50, 0x4b, 0x4d, 0x20, 0x32, 0x30, 0x00, 0x01, 0x00, 0x18, 0x00, 0x20,
@@ -1115,14 +1115,14 @@ main(int argc, char** argv) {
g_src_len__mona_lisa_21_32_th, g_src_len__mona_lisa_21_32_th,
}, },
{ {
"«demo»/mona-lisa.21x32.c3q0.handsum", "«demo»/mona-lisa.21x32.c3q1.handsum",
g_src_ptr__mona_lisa_21_32_c3q0_handsum, g_src_ptr__mona_lisa_21_32_c3q1_handsum,
g_src_len__mona_lisa_21_32_c3q0_handsum, g_src_len__mona_lisa_21_32_c3q1_handsum,
}, },
{ {
"«demo»/mona-lisa.21x32.c3q3.handsum", "«demo»/mona-lisa.21x32.c3q4.handsum",
g_src_ptr__mona_lisa_21_32_c3q3_handsum, g_src_ptr__mona_lisa_21_32_c3q4_handsum,
g_src_len__mona_lisa_21_32_c3q3_handsum, g_src_len__mona_lisa_21_32_c3q4_handsum,
}, },
{ {
"«demo»/mona-lisa.21x32.etc2.pkm", "«demo»/mona-lisa.21x32.etc2.pkm",
+52 -72
View File
@@ -15,33 +15,35 @@
// This is a very lossy format for very small thumbnails. Very small in terms // This is a very lossy format for very small thumbnails. Very small in terms
// of image dimensions, up to 16×16 pixels, but also in terms of file size. // of image dimensions, up to 16×16 pixels, but also in terms of file size.
// //
// The file format has three color settings (Gray, RGB and RGBA) and four // The file format has three color settings (1=Gray, 3=RGB and 4=RGBA) and four
// quality settings. For any given color-and-quality combination, every Handsum // quality settings. For any given color-and-quality combination, every Handsum
// image file with those settings is a fixed number of bytes. For color=Gray: // image file with those settings is a fixed number of bytes.
// //
// - A quality=0 file is 33 bytes long. // For color=1, also known as color=Gray:
// - A quality=1 file is 51 bytes long.
// - A quality=2 file is 83 bytes long.
// - A quality=3 file is 99 bytes long.
// //
// For color=RGB: // - A quality=1 file is 33 bytes long.
// - A quality=2 file is 51 bytes long.
// - A quality=3 file is 83 bytes long.
// - A quality=4 file is 99 bytes long.
// //
// - A quality=0 file is 48 bytes long. // For color=3, also known as color=RGB:
// - A quality=1 file is 75 bytes long. //
// - A quality=2 file is 123 bytes long. // - A quality=1 file is 48 bytes long.
// - A quality=2 file is 75 bytes long.
// - A quality=3 file is 123 bytes long.
// - A quality=4 file is 147 bytes long.
//
// For color=4, also known as color=RGBA:
//
// - A quality=1 file is 72 bytes long.
// - A quality=2 file is 99 bytes long.
// - A quality=3 file is 147 bytes long. // - A quality=3 file is 147 bytes long.
// - A quality=4 file is 171 bytes long.
// //
// For color=RGBA: // Every Gray/q1 image file is exactly 48 bytes (384 bits) long. For a 16×16
//
// - A quality=0 file is 72 bytes long.
// - A quality=1 file is 99 bytes long.
// - A quality=2 file is 147 bytes long.
// - A quality=3 file is 171 bytes long.
//
// Every Gray/q0 image file is exactly 48 bytes (384 bits) long. For a 16×16
// pixel image, this uses 1.5 bits (0.1875 bytes) per pixel. // pixel image, this uses 1.5 bits (0.1875 bytes) per pixel.
// //
// Every RGB/q3 image file is exactly 147 bytes (1176 bits) long. This uses // Every RGB/q4 image file is exactly 147 bytes (1176 bits) long. This uses
// 4.59375 bits per pixel for a 16×16 pixel image (a 1:1 aspect ratio), or // 4.59375 bits per pixel for a 16×16 pixel image (a 1:1 aspect ratio), or
// 6.125 bits per pixel for a 16×12 pixel image (a 4:3 aspect ratio). // 6.125 bits per pixel for a 16×12 pixel image (a 4:3 aspect ratio).
// //
@@ -60,10 +62,10 @@
// Luma blocks without explicitly recording the 2 Chroma blocks. // Luma blocks without explicitly recording the 2 Chroma blocks.
// //
// The color=RGBA payload extends the color=RGB payload with one more 8×8 Alpha // The color=RGBA payload extends the color=RGB payload with one more 8×8 Alpha
// block. That seventh block is always encoded in 24 bytes (as if quality=3). // block. That seventh block is always encoded in 24 bytes (as if quality=4).
// //
// Each 8×8 block is sub-divided into 8×8 (for q0), 4×4 (for q1 and q2) or 2×2 // Each 8×8 block is sub-divided into 8×8 (for q1), 4×4 (for q2 and q3) or 2×2
// (for q3) tiles. DCT (Discrete Cosine Transform) is applied to each tile, // (for q4) tiles. DCT (Discrete Cosine Transform) is applied to each tile,
// producing 64, 16, 16 or 4 DCT coefficients (depending on the quality). Only // producing 64, 16, 16 or 4 DCT coefficients (depending on the quality). Only
// the 15 (out of 64), 6 (out of 16), 10 (out of 16) or 3 (out of 4) lowest // the 15 (out of 64), 6 (out of 16), 10 (out of 16) or 3 (out of 4) lowest
// frequency DCT coefficients are kept for each tile. Lowest frequency means // frequency DCT coefficients are kept for each tile. Lowest frequency means
@@ -92,7 +94,7 @@ package handsum
// tiles are 8×8, 4×4 or 2×2): // tiles are 8×8, 4×4 or 2×2):
// //
// ====== ======== DC ======== ======== AC ======== // ====== ======== DC ======== ======== AC ========
// Bucket q0 q1,q2 q3 q0 q1,q2 q3 // Bucket q1 q2,q3 q4 q1 q2,q3 q4
// //
// 0x0 -1024 -512 -256 -512 -256 -128 // 0x0 -1024 -512 -256 -512 -256 -128
// 0x1 -888 -444 -222 -448 -224 -112 // 0x1 -888 -444 -222 -448 -224 -112
@@ -187,7 +189,7 @@ func fileSize(c Color, q Quality) int {
"\x21\x33\x53\x63" + "\x21\x33\x53\x63" +
"\x00\x00\x00\x00" + "\x00\x00\x00\x00" +
"\x30\x4B\x7B\x93" + "\x30\x4B\x7B\x93" +
"\x48\x63\x93\xAB")[(int((c-1)&3)<<2)|int(q&3)]) "\x48\x63\x93\xAB")[(int((c-1)&3)<<2)|int((q-1)&3)])
} }
// Color is a Handsum image's color setting, either 1 (Gray), 3 (RGB) or 4 // Color is a Handsum image's color setting, either 1 (Gray), 3 (RGB) or 4
@@ -207,74 +209,52 @@ func (c Color) numberOfBlocks() int {
return 6 return 6
} }
// OptionColor is an option type, what Rust would call an Option<Color>. // Quality is a Handsum image's quality setting, from 1 (worst) to 4 (best).
type OptionColor struct {
representation uint8
}
// MakeOptionColor returns an option value that is Some(c), instead of the
// OptionColor zero-value, which is None.
func MakeOptionColor(c Color) OptionColor {
if (c == ColorGray) || (c == ColorRGB) || (c == ColorRGBA) {
return OptionColor{representation: 0x80 | uint8(c)}
}
return OptionColor{}
}
// Quality is a Handsum image's quality setting, from 0 (worst) to 3 (best).
// //
// "Best" is relative to the other settings. In absolute terms, Handsum's image // "Best" is relative to the other settings. In absolute terms, Handsum's image
// quality ranges from "potato" (best) to "extremely potato" (worst). // quality ranges from "potato" (best) to "extremely potato" (worst).
type Quality uint8 type Quality uint8
const ( const (
QualityWorst = Quality(0) QualityWorst = Quality(1)
QualityMediumLow = Quality(1) QualityMediumLow = Quality(2)
QualityMediumHigh = Quality(2) QualityMediumHigh = Quality(3)
QualityBest = Quality(3) QualityBest = Quality(4)
) )
func (q Quality) numberOfCoefficients() int { func (q Quality) numberOfCoefficients() int {
// 15 (out of 64), 6 (out of 16), 10 (out of 16), 3 (out of 4). // 15 (out of 64), 6 (out of 16), 10 (out of 16), 3 (out of 4).
return int("\x0F\x06\x0A\x03"[q&3]) return int("\x0F\x06\x0A\x03"[(q-1)&3])
}
// OptionQuality is an option type, what Rust would call an Option<Quality>.
type OptionQuality struct {
representation uint8
}
// MakeOptionQuality returns an option value that is Some(q), instead of the
// OptionQuality zero-value, which is None.
func MakeOptionQuality(q Quality) OptionQuality {
if (0 <= q) && (q <= 3) {
return OptionQuality{representation: 0x80 | uint8(q)}
}
return OptionQuality{}
} }
// EncodeOptions are optional arguments to Encode. The zero value is valid and // EncodeOptions are optional arguments to Encode. The zero value is valid and
// means to use the default configuration, encoding to 147 bytes. // means to use the default configuration, encoding to 147 bytes.
type EncodeOptions struct { type EncodeOptions struct {
// Color is the color setting. The None option (the zero OptionColor value) // Color is the color setting. The zero value means to use the default,
// means to use the default, ColorRGB. // ColorRGB.
Color OptionColor Color Color
// Quality is the quality-versus-file-size setting. The None option (the // Quality is the quality-versus-file-size setting. The zero value means to
// zero OptionQuality value) means to use the default, QualityBest. // use the default, QualityBest (which is also the largest file size).
Quality OptionQuality Quality Quality
} }
func (o *EncodeOptions) color() Color { func (o *EncodeOptions) color() Color {
if (o != nil) && ((o.Color.representation & 0x80) != 0) { if o != nil {
return Color(o.Color.representation & 0x7F) switch o.Color {
case ColorGray, ColorRGB, ColorRGBA:
return o.Color
}
} }
return ColorRGB return ColorRGB
} }
func (o *EncodeOptions) quality() Quality { func (o *EncodeOptions) quality() Quality {
if (o != nil) && ((o.Quality.representation & 0x80) != 0) { if o != nil {
return Quality(o.Quality.representation & 0x7F) switch o.Quality {
case QualityWorst, QualityMediumLow, QualityMediumHigh, QualityBest:
return o.Quality
}
} }
return QualityBest return QualityBest
} }
@@ -326,10 +306,10 @@ func Encode(w io.Writer, src image.Image, options *EncodeOptions) error {
buf := [fileSizeMax]byte{} buf := [fileSizeMax]byte{}
buf[0] = Magic0[0] buf[0] = Magic0[0]
buf[1] = Magic0[1] | uint8((c-1)>>1) buf[1] = Magic0[1] | uint8((c-1)>>1)
buf[2] = ((uint8(c - 1)) << 7) | ((uint8(q)) << 5) | aspectRatio buf[2] = ((uint8(c - 1)) << 7) | ((uint8(q - 1)) << 5) | aspectRatio
bitOffset := 3 * 8 bitOffset := 3 * 8
encodeBlock := encodeBlockFuncs[q] encodeBlock := encodeBlockFuncs[(q-1)&3]
for i := range c.numberOfBlocks() { for i := range c.numberOfBlocks() {
bitOffset = encodeBlock(&buf, bitOffset, &dstU8s[i], q.numberOfCoefficients()) bitOffset = encodeBlock(&buf, bitOffset, &dstU8s[i], q.numberOfCoefficients())
} }
@@ -511,7 +491,7 @@ func Decode(r io.Reader) (image.Image, error) {
if !ok { if !ok {
return nil, ErrNotAHandsumFile return nil, ErrNotAHandsumFile
} }
q := Quality((buf[2] >> 5) & 0x03) q := Quality((buf[2]>>5)&0x03) + 1
if _, err := io.ReadFull(r, buf[fileSizeHeader:fileSize(c, q)]); err != nil { if _, err := io.ReadFull(r, buf[fileSizeHeader:fileSize(c, q)]); err != nil {
return nil, err return nil, err
} }
@@ -521,7 +501,7 @@ func Decode(r io.Reader) (image.Image, error) {
} }
bitOffset := 3 * 8 bitOffset := 3 * 8
decodeBlock := decodeBlockFuncs[q] decodeBlock := decodeBlockFuncs[(q-1)&3]
lumaQuadBlockU8 := lowleveljpeg.QuadBlockU8{} lumaQuadBlockU8 := lowleveljpeg.QuadBlockU8{}
bitOffset = decodeBlock(lumaQuadBlockU8[0x00:], 16, &buf, bitOffset, q.numberOfCoefficients()) bitOffset = decodeBlock(lumaQuadBlockU8[0x00:], 16, &buf, bitOffset, q.numberOfCoefficients())
bitOffset = decodeBlock(lumaQuadBlockU8[0x08:], 16, &buf, bitOffset, q.numberOfCoefficients()) bitOffset = decodeBlock(lumaQuadBlockU8[0x08:], 16, &buf, bitOffset, q.numberOfCoefficients())
+3 -3
View File
@@ -32,11 +32,11 @@ func testRoundTrip(tt *testing.T, src image.Image, pixelValue uint8, justCheckTh
} }
for _, c := range colors { for _, c := range colors {
for q := Quality(0); q < 4; q++ { for q := QualityWorst; q <= QualityBest; q++ {
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
err := Encode(buf, src, &EncodeOptions{ err := Encode(buf, src, &EncodeOptions{
Color: MakeOptionColor(c), Color: c,
Quality: MakeOptionQuality(q), Quality: q,
}) })
if err != nil { if err != nil {
tt.Fatalf("c=%d: q=%d: Encode: %v", c, q, err) tt.Fatalf("c=%d: q=%d: Encode: %v", c, q, err)
+1 -1
View File
@@ -23,7 +23,7 @@ pub struct decoder? implements base.image_decoder(
width : base.u32[..= 16], width : base.u32[..= 16],
height : base.u32[..= 16], height : base.u32[..= 16],
color : base.u32[..= 3], // 0=gray, 2=rgb, 3=rgba. color : base.u32[..= 3], // 0=gray, 2=rgb, 3=rgba.
quality : base.u32[..= 3], quality : base.u32[..= 3], // 0=worst, 3=best.
// The call sequence state machine is discussed in // The call sequence state machine is discussed in
// (/doc/std/image-decoders-call-sequence.md). // (/doc/std/image-decoders-call-sequence.md).
+13 -13
View File
@@ -66,7 +66,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- Handsum Tests // ---------------- Handsum Tests
const char* // const char* //
test_wuffs_handsum_decode_interface_c1q0() { test_wuffs_handsum_decode_interface_c1q1() {
CHECK_FOCUS(__func__); CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec; wuffs_handsum__decoder dec;
CHECK_STATUS("initialize", CHECK_STATUS("initialize",
@@ -75,11 +75,11 @@ test_wuffs_handsum_decode_interface_c1q0() {
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED)); WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder( return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec), wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-gray.c1q0.handsum", 0, SIZE_MAX, 16, 12, 0xFF040404); "test/data/bricks-gray.c1q1.handsum", 0, SIZE_MAX, 16, 12, 0xFF040404);
} }
const char* // const char* //
test_wuffs_handsum_decode_interface_c1q2() { test_wuffs_handsum_decode_interface_c1q3() {
CHECK_FOCUS(__func__); CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec; wuffs_handsum__decoder dec;
CHECK_STATUS("initialize", CHECK_STATUS("initialize",
@@ -88,11 +88,11 @@ test_wuffs_handsum_decode_interface_c1q2() {
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED)); WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder( return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec), wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-gray.c1q2.handsum", 0, SIZE_MAX, 16, 12, 0xFF101010); "test/data/bricks-gray.c1q3.handsum", 0, SIZE_MAX, 16, 12, 0xFF101010);
} }
const char* // const char* //
test_wuffs_handsum_decode_interface_c3q1() { test_wuffs_handsum_decode_interface_c3q2() {
CHECK_FOCUS(__func__); CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec; wuffs_handsum__decoder dec;
CHECK_STATUS("initialize", CHECK_STATUS("initialize",
@@ -101,11 +101,11 @@ test_wuffs_handsum_decode_interface_c3q1() {
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED)); WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder( return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec), wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-color.c3q1.handsum", 0, SIZE_MAX, 16, 12, 0xFF313D58); "test/data/bricks-color.c3q2.handsum", 0, SIZE_MAX, 16, 12, 0xFF313D58);
} }
const char* // const char* //
test_wuffs_handsum_decode_interface_c3q3() { test_wuffs_handsum_decode_interface_c3q4() {
CHECK_FOCUS(__func__); CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec; wuffs_handsum__decoder dec;
CHECK_STATUS("initialize", CHECK_STATUS("initialize",
@@ -114,7 +114,7 @@ test_wuffs_handsum_decode_interface_c3q3() {
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED)); WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder( return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec), wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-color.c3q3.handsum", 0, SIZE_MAX, 16, 12, 0xFF0B337D); "test/data/bricks-color.c3q4.handsum", 0, SIZE_MAX, 16, 12, 0xFF0B337D);
} }
const char* // const char* //
@@ -158,7 +158,7 @@ test_wuffs_handsum_decode_frame_config() {
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){ wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
.data = g_src_slice_u8, .data = g_src_slice_u8,
}); });
CHECK_STRING(read_file(&src, "test/data/mona-lisa.21x32.c3q3.handsum")); CHECK_STRING(read_file(&src, "test/data/mona-lisa.21x32.c3q4.handsum"));
CHECK_STATUS("decode_frame_config #0", CHECK_STATUS("decode_frame_config #0",
wuffs_handsum__decoder__decode_frame_config(&dec, &fc, &src)); wuffs_handsum__decoder__decode_frame_config(&dec, &fc, &src));
@@ -203,10 +203,10 @@ test_wuffs_handsum_decode_frame_config() {
proc g_tests[] = { proc g_tests[] = {
test_wuffs_handsum_decode_frame_config, test_wuffs_handsum_decode_frame_config,
test_wuffs_handsum_decode_interface_c1q0, test_wuffs_handsum_decode_interface_c1q1,
test_wuffs_handsum_decode_interface_c1q2, test_wuffs_handsum_decode_interface_c1q3,
test_wuffs_handsum_decode_interface_c3q1, test_wuffs_handsum_decode_interface_c3q2,
test_wuffs_handsum_decode_interface_c3q3, test_wuffs_handsum_decode_interface_c3q4,
test_wuffs_handsum_decode_truncated_input, test_wuffs_handsum_decode_truncated_input,
#ifdef WUFFS_MIMIC #ifdef WUFFS_MIMIC
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-1
View File
@@ -1 +0,0 @@
þ× †¼“‡§ŠˆHˆ—˜›‰¨˜uxºh{ixHކ{xwv‰»§†¬˜†©Y—§SV´§v
+1 -1
View File
@@ -1 +1 @@
ţ×+UÚ‡7ź…¦�h�š†Ô{ĽC—‡Dy§´›z¦Šwe“şÔŐ‡&mYćRi�‰h噋Sz¶úk¦»{śTÚęIÍpoŐ¨ăSË6…đb þ× †¼“‡§ŠˆHˆ—˜›‰¨˜uxºh{ixHކ{xwv‰»§†¬˜†©Y—§SV´§v
+1 -1
View File
@@ -1 +1 @@
ţ×KUÚ‡��7ź…‡h¦�h‰‡�š†i‰Ô{ĽŞ‡C—‡™�Dy§‰š´›z†x¦Šw��e“ş—yÔŐ‡�‰&mYx�ćRi™‡�‰hx�噋†–Sz¶�yúk¦gZ»{§—śTÚÇ‹ęIÍe•poş·Ő¨ăK�SË6Y“…đb‡o ţ×+UÚ‡7ź…¦�h�š†Ô{ĽC—‡Dy§´›z¦Šwe“şÔŐ‡&mYćRi�‰h噋Sz¶úk¦»{śTÚęIÍpoŐ¨ăSË6…đb
Binary file not shown.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
�ヨ sャ迫ヲzx(汚剱汚冱wケx及x(合休ww�
+1 -1
View File
@@ -1 +1 @@
ўж+cк�%����x���в{Ыa��RyЈВ�zЃ�wR�ЊТХw4lhдSh��xг�{ayЇ �ヨ sャ迫ヲzx(汚剱汚冱wケx及x(合休ww�
+1 -1
View File
@@ -1 +1 @@
ţÖKcÚ‡�‡%ꔆh“�x‰�‚š‡x�Ň{ËŞ‡a—�™�Ry¨‰š˛‹z‡xىw��R“Ş—yÂĹw�‰4lhx�ÔSh����xx�Ó™{‡–ay§�y ўж+cк�%����x���в{Ыa��RyЈВ�zЃ�wR�ЊТХw4lhдSh��xг�{ayЇ
+1 -1
View File
@@ -1 +1 @@
þÖkrMø©ðr45‚8¶ƒ9«b)ªs8{¡—ôˆ€(…‰�&{‘(vt˜¡(Öq‰ƒ)™¡(Tƒ(šrDD’©hˆ¤!MQKÉ”[qІH®€ˆ¥«�(bt,I�— ţÖKcÚ‡�‡%ꔆh“�x‰�‚š‡x�Ň{ËŞ‡a—�™�Ry¨‰š˛‹z‡xىw��R“Ş—yÂĹw�‰4lhx�ÔSh����xx�Ó™{‡–ay§�y
+1
View File
@@ -0,0 +1 @@
þÖkrMø©ðr45‚8¶ƒ9«b)ªs8{¡—ôˆ€(…‰�&{‘(vt˜¡(Öq‰ƒ)™¡(Tƒ(šrDD’©hˆ¤!MQKÉ”[qІH®€ˆ¥«�(bt,I�—
File renamed without changes.
+16 -15
View File
@@ -4,10 +4,10 @@ OK. c3528d19 test/data/49.bn4.nie
OK. c3528d19 test/data/49.bn8.nie OK. c3528d19 test/data/49.bn8.nie
OK. e3bae566 test/data/49.bp4.nie OK. e3bae566 test/data/49.bp4.nie
OK. c3528d19 test/data/49.bp8.nie OK. c3528d19 test/data/49.bp8.nie
OK. bf3fd567 test/data/49.c3q1.handsum OK. bf3fd567 test/data/49.c3q2.handsum
OK. 7cac72e5 test/data/49.c3q3.handsum OK. 7cac72e5 test/data/49.c3q4.handsum
OK. b8e18bd1 test/data/49.c4q1.handsum OK. b8e18bd1 test/data/49.c4q2.handsum
OK. 295c387a test/data/49.c4q3.handsum OK. 295c387a test/data/49.c4q4.handsum
OK. f2a0a3f6 test/data/49.png OK. f2a0a3f6 test/data/49.png
OK. d3bb0beb test/data/DCI-P3-D65.icc OK. d3bb0beb test/data/DCI-P3-D65.icc
OK. 646e081a test/data/animated-red-blue.000000.nie OK. 646e081a test/data/animated-red-blue.000000.nie
@@ -56,10 +56,10 @@ OK. 27a6e456 test/data/artificial-thumbhash/VggKDYAW6lZvdYd6d2iZh_p4GE_k.th
OK. d9ce0e57 test/data/artificial-thumbhash/YJqGPQw7sFlslqhFafSE-Q6oJ1h2iHB2Rw.png OK. d9ce0e57 test/data/artificial-thumbhash/YJqGPQw7sFlslqhFafSE-Q6oJ1h2iHB2Rw.png
OK. 4965134c test/data/artificial-thumbhash/YJqGPQw7sFlslqhFafSE-Q6oJ1h2iHB2Rw.th OK. 4965134c test/data/artificial-thumbhash/YJqGPQw7sFlslqhFafSE-Q6oJ1h2iHB2Rw.th
OK. 076cb375 test/data/bricks-color.bmp OK. 076cb375 test/data/bricks-color.bmp
OK. 1bb2c55a test/data/bricks-color.c3q0.handsum OK. 1bb2c55a test/data/bricks-color.c3q1.handsum
OK. 74bb07e1 test/data/bricks-color.c3q1.handsum OK. 74bb07e1 test/data/bricks-color.c3q2.handsum
OK. 43dd4660 test/data/bricks-color.c3q2.handsum OK. 43dd4660 test/data/bricks-color.c3q3.handsum
OK. 79b8bd57 test/data/bricks-color.c3q3.handsum OK. 79b8bd57 test/data/bricks-color.c3q4.handsum
OK. bdbbfadb test/data/bricks-color.etc1.pkm OK. bdbbfadb test/data/bricks-color.etc1.pkm
OK. 41e6110e test/data/bricks-color.etc1s.pkm OK. 41e6110e test/data/bricks-color.etc1s.pkm
OK. 5670f263 test/data/bricks-color.etc2.pkm OK. 5670f263 test/data/bricks-color.etc2.pkm
@@ -75,11 +75,11 @@ OK. f36c2e80 test/data/bricks-dither.lossless.webp
OK. f36c2e80 test/data/bricks-dither.no-ancillary.png OK. f36c2e80 test/data/bricks-dither.no-ancillary.png
OK. f36c2e80 test/data/bricks-dither.png OK. f36c2e80 test/data/bricks-dither.png
OK. c2bce675 test/data/bricks-gray.bmp OK. c2bce675 test/data/bricks-gray.bmp
OK. 00db551d test/data/bricks-gray.c1q0.handsum OK. 00db551d test/data/bricks-gray.c1q1.handsum
OK. 5c979d98 test/data/bricks-gray.c1q1.handsum OK. 5c979d98 test/data/bricks-gray.c1q2.handsum
OK. 23430f55 test/data/bricks-gray.c1q2.handsum OK. 23430f55 test/data/bricks-gray.c1q3.handsum
OK. 6065d955 test/data/bricks-gray.c1q3.handsum OK. 6065d955 test/data/bricks-gray.c1q4.handsum
OK. 6065d955 test/data/bricks-gray.c3q3.handsum OK. 6065d955 test/data/bricks-gray.c3q4.handsum
OK. c2bce675 test/data/bricks-gray.gif OK. c2bce675 test/data/bricks-gray.gif
OK. 3a2478ad test/data/bricks-gray.jpeg OK. 3a2478ad test/data/bricks-gray.jpeg
OK. c2bce675 test/data/bricks-gray.lossless.webp OK. c2bce675 test/data/bricks-gray.lossless.webp
@@ -141,8 +141,8 @@ OK. dcbb225a test/data/hippopotamus.ppm
OK. ed4b78fc test/data/hippopotamus.regular.gif OK. ed4b78fc test/data/hippopotamus.regular.gif
OK. dcbb225a test/data/hippopotamus.regular.png OK. dcbb225a test/data/hippopotamus.regular.png
BAD e4c5926b test/data/hippopotamus.regular.truncated.png BAD e4c5926b test/data/hippopotamus.regular.truncated.png
OK. 57441dc9 test/data/mona-lisa.21x32.c3q0.handsum OK. 57441dc9 test/data/mona-lisa.21x32.c3q1.handsum
OK. 39d18fce test/data/mona-lisa.21x32.c3q3.handsum OK. 39d18fce test/data/mona-lisa.21x32.c3q4.handsum
OK. f6bb81e2 test/data/mona-lisa.21x32.etc2.pkm OK. f6bb81e2 test/data/mona-lisa.21x32.etc2.pkm
OK. 012ce4cf test/data/mona-lisa.21x32.lossless.webp OK. 012ce4cf test/data/mona-lisa.21x32.lossless.webp
OK. 012ce4cf test/data/mona-lisa.21x32.png OK. 012ce4cf test/data/mona-lisa.21x32.png
@@ -200,3 +200,4 @@ OK. 38cb4cbf test/data/red-blue-gradient.gamma2dot2.png
OK. 38cb4cbf test/data/red-blue-gradient.vanilla.png OK. 38cb4cbf test/data/red-blue-gradient.vanilla.png
OK. 75060601 test/data/rgb24png.bmp OK. 75060601 test/data/rgb24png.bmp
OK. 79ab18b6 test/data/ridiculously-fast.png OK. 79ab18b6 test/data/ridiculously-fast.png
OK. 4c6d02c3 test/data/transparent-1x1.gif