std/webp: add new package (and vp8 placeholder)

This commit is contained in:
Nigel Tao committed 2024-05-10 13:52:07 +10:00
1 parent 16705a1816
commit 09f4500e19
17 files changed
+1843

No files matched your search

@@ -30,6 +30,7 @@ OK. d9f8441c test/3pdata/blinksuite/blue-10.png
OK. 267741e0 test/3pdata/blinksuite/blue-100.png
OK. 89449c01 test/3pdata/blinksuite/blue-wheel-srgb-color-profile.jpg
OK. 8fce70a9 test/3pdata/blinksuite/blue-wheel-srgb-color-profile.png
OK. 2ef5fd5d test/3pdata/blinksuite/blue-wheel-srgb-color-profile.webp
OK. 2d7bad9f test/3pdata/blinksuite/border-image-srgb-color-profile.png
OK. 9ca73f21 test/3pdata/blinksuite/border-image.png
OK. 277600f9 test/3pdata/blinksuite/boston.gif
@@ -42,6 +43,8 @@ OK. 5ec78d7c test/3pdata/blinksuite/color-checker-adobe-color-profile.png
OK. b3389858 test/3pdata/blinksuite/color-checker-srgb-color-profile.png
OK. 10721531 test/3pdata/blinksuite/count-down-color-test.gif
OK. 1abc4dc6 test/3pdata/blinksuite/count-down-color-test.png
OK. 2ef5fd5d test/3pdata/blinksuite/count-down-color-test.webp
OK. 2ef5fd5d test/3pdata/blinksuite/crbug.364830.webp
OK. 24ab1efd test/3pdata/blinksuite/crbug779261.gif
OK. ae034abe test/3pdata/blinksuite/crbug807324.png
OK. 4f50fdb0 test/3pdata/blinksuite/crbug827754.png
@@ -66,6 +69,7 @@ OK. d97ce4e8 test/3pdata/blinksuite/cs-uma-ycbcr-other.jpg
OK. a2a940bc test/3pdata/blinksuite/cs-uma-ycck.jpg
OK. b6000be6 test/3pdata/blinksuite/dice.png
BAD 1023c20a test/3pdata/blinksuite/empty-frame.png
OK. 2ef5fd5d test/3pdata/blinksuite/flip.webp
OK. eff36075 test/3pdata/blinksuite/flowchart.jpg
OK. 20ff1df8 test/3pdata/blinksuite/full2loop.gif
OK. dc814e29 test/3pdata/blinksuite/gif-loop-count.gif
@@ -89,8 +93,14 @@ OK. 95641cb9 test/3pdata/blinksuite/icc-v2-gbr-420-height-not-whole-mcu.jpg
OK. 93f21c2a test/3pdata/blinksuite/icc-v2-gbr-420-width-not-whole-mcu.jpg
OK. f37cea44 test/3pdata/blinksuite/icc-v2-gbr-422-whole-mcus.jpg
OK. 1de5a906 test/3pdata/blinksuite/icc-v2-gbr.jpg
OK. 2ef5fd5d test/3pdata/blinksuite/invalid-animated-webp.webp
OK. 2ef5fd5d test/3pdata/blinksuite/invalid-animated-webp2.webp
OK. 2ef5fd5d test/3pdata/blinksuite/invalid-animated-webp3.webp
OK. 2ef5fd5d test/3pdata/blinksuite/invalid-animated-webp4.webp
OK. 2ef5fd5d test/3pdata/blinksuite/invalid_vp8_vp8x.webp
OK. 0da5f37e test/3pdata/blinksuite/jpeg-height-exif-orientation.jpg
OK. 4409dca6 test/3pdata/blinksuite/large-gif-checkerboard.gif
OK. 2ef5fd5d test/3pdata/blinksuite/large.webp
BAD 2f310e57 test/3pdata/blinksuite/missing-eoi.jpg
OK. 72bbe2b6 test/3pdata/blinksuite/motion-jpeg-single-frame.jpg
OK. 0268284a test/3pdata/blinksuite/mu.png
@@ -161,6 +171,7 @@ OK. bfebcca4 test/3pdata/blinksuite/rgb-jpeg-red.jpg
OK. 6ed3c2e7 test/3pdata/blinksuite/rgb-jpeg-with-adobe-marker-only.jpg
OK. cfb6f39d test/3pdata/blinksuite/rgb-png-with-cmyk-color-profile.png
OK. a3454fb7 test/3pdata/blinksuite/short-app-extension-string.gif
OK. 2ef5fd5d test/3pdata/blinksuite/size-failure.b186640109.webp
BAD 2398258b test/3pdata/blinksuite/size-failure.gif
OK. 5c4b1a8b test/3pdata/blinksuite/small-square-with-colorspin-profile.jpg
OK. 44dc95b9 test/3pdata/blinksuite/sprite_all_fragments_same.png
@@ -168,6 +179,25 @@ OK. 9a7e5ec7 test/3pdata/blinksuite/sprite_alternate_fragments_same.png
OK. 1b1f5f96 test/3pdata/blinksuite/stripes-large.png
OK. 6b85cdb9 test/3pdata/blinksuite/stripes-small.png
OK. 16c2c0fe test/3pdata/blinksuite/test-load.jpg
OK. 2ef5fd5d test/3pdata/blinksuite/test.webp
OK. 2ef5fd5d test/3pdata/blinksuite/test2.webp
OK. 2ef5fd5d test/3pdata/blinksuite/test3.webp
OK. 2ef5fd5d test/3pdata/blinksuite/truncated.webp
OK. 2ef5fd5d test/3pdata/blinksuite/truncated2.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-icc-xmp.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-large.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-no-blend.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-opaque.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-semitransparent1.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-semitransparent2.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-semitransparent3.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated-semitransparent4.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-animated.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-color-no-profile-lossy.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-color-profile-crash.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-color-profile-lossless.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-color-profile-lossy-alpha.webp
OK. 2ef5fd5d test/3pdata/blinksuite/webp-color-profile-lossy.webp
BAD ed67a9a5 test/3pdata/blinksuite/wrong-block-length.gif
OK. 577c5c4c test/3pdata/blinksuite/ycbcr-420-fast-int-progressive.jpg
OK. bf4cd8e2 test/3pdata/blinksuite/ycbcr-420-float-progressive.jpg
+122
View File
@@ -0,0 +1,122 @@
// Copyright 2024 The Wuffs Authors.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
// ----------------
/*
This test program is typically run indirectly, by the "wuffs test" or "wuffs
bench" commands. These commands take an optional "-mimic" flag to check that
Wuffs' output mimics (i.e. exactly matches) other libraries' output, such as
giflib for GIF, libpng for PNG, etc.
To manually run this test:
for CC in clang gcc; do
$CC -std=c99 -Wall -Werror vp8.c && ./a.out
rm -f a.out
done
Each edition should print "PASS", amongst other information, and exit(0).
Add the "wuffs mimic cflags" (everything after the colon below) to the C
compiler flags (after the .c file) to run the mimic tests.
To manually run the benchmarks, replace "-Wall -Werror" with "-O3" and replace
the first "./a.out" with "./a.out -bench". Combine these changes with the
"wuffs mimic cflags" to run the mimic benchmarks.
*/
// ¿ wuffs mimic cflags: -DWUFFS_MIMIC
// Wuffs ships as a "single file C library" or "header file library" as per
// https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
//
// To use that single file as a "foo.c"-like implementation, instead of a
// "foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or
// compiling it.
#define WUFFS_IMPLEMENTATION
// Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of
// release/c/etc.c choose which parts of Wuffs to build. That file contains the
// entire Wuffs standard library, implementing a variety of codecs and file
// formats. Without this macro definition, an optimizing compiler or linker may
// very well discard Wuffs code for unused codecs, but listing the Wuffs
// modules we use makes that process explicit. Preprocessing means that such
// code simply isn't compiled.
#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__VP8
// If building this program in an environment that doesn't easily accommodate
// relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file.
#include "../../../release/c/wuffs-unsupported-snapshot.c"
#include "../testlib/testlib.c"
#ifdef WUFFS_MIMIC
// No mimic library.
#endif
// ---------------- VP8 Tests
// No VP8 tests.
// ---------------- Mimic Tests
#ifdef WUFFS_MIMIC
// No mimic tests.
#endif // WUFFS_MIMIC
// ---------------- VP8 Benches
// No VP8 benches.
// ---------------- Mimic Benches
#ifdef WUFFS_MIMIC
// No mimic benches.
#endif // WUFFS_MIMIC
// ---------------- Manifest
proc g_tests[] = {
// No VP8 tests.
#ifdef WUFFS_MIMIC
// No mimic tests.
#endif // WUFFS_MIMIC
NULL,
};
proc g_benches[] = {
// No VP8 benches.
#ifdef WUFFS_MIMIC
// No mimic benches.
#endif // WUFFS_MIMIC
NULL,
};
int //
main(int argc, char** argv) {
g_proc_package_name = "std/vp8";
return test_main(argc, argv, g_tests, g_benches);
}
+154
View File
@@ -0,0 +1,154 @@
// Copyright 2024 The Wuffs Authors.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
// ----------------
/*
This test program is typically run indirectly, by the "wuffs test" or "wuffs
bench" commands. These commands take an optional "-mimic" flag to check that
Wuffs' output mimics (i.e. exactly matches) other libraries' output, such as
giflib for GIF, libpng for PNG, etc.
To manually run this test:
for CC in clang gcc; do
$CC -std=c99 -Wall -Werror webp.c && ./a.out
rm -f a.out
done
Each edition should print "PASS", amongst other information, and exit(0).
Add the "wuffs mimic cflags" (everything after the colon below) to the C
compiler flags (after the .c file) to run the mimic tests.
To manually run the benchmarks, replace "-Wall -Werror" with "-O3" and replace
the first "./a.out" with "./a.out -bench". Combine these changes with the
"wuffs mimic cflags" to run the mimic benchmarks.
*/
// ¿ wuffs mimic cflags: -DWUFFS_MIMIC
// Wuffs ships as a "single file C library" or "header file library" as per
// https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
//
// To use that single file as a "foo.c"-like implementation, instead of a
// "foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or
// compiling it.
#define WUFFS_IMPLEMENTATION
// Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of
// release/c/etc.c choose which parts of Wuffs to build. That file contains the
// entire Wuffs standard library, implementing a variety of codecs and file
// formats. Without this macro definition, an optimizing compiler or linker may
// very well discard Wuffs code for unused codecs, but listing the Wuffs
// modules we use makes that process explicit. Preprocessing means that such
// code simply isn't compiled.
#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__VP8
#define WUFFS_CONFIG__MODULE__WEBP
// If building this program in an environment that doesn't easily accommodate
// relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file.
#include "../../../release/c/wuffs-unsupported-snapshot.c"
#include "../testlib/testlib.c"
#ifdef WUFFS_MIMIC
// No mimic library.
#endif
// ---------------- WebP Tests
const char* //
wuffs_webp_decode(uint64_t* n_bytes_out,
wuffs_base__io_buffer* dst,
uint32_t wuffs_initialize_flags,
wuffs_base__pixel_format pixfmt,
uint32_t* quirks_ptr,
size_t quirks_len,
wuffs_base__io_buffer* src) {
wuffs_webp__decoder dec;
CHECK_STATUS("initialize",
wuffs_webp__decoder__initialize(&dec, sizeof dec, WUFFS_VERSION,
wuffs_initialize_flags));
return do_run__wuffs_base__image_decoder(
wuffs_webp__decoder__upcast_as__wuffs_base__image_decoder(&dec),
n_bytes_out, dst, pixfmt, quirks_ptr, quirks_len, src);
}
// --------
const char* //
test_wuffs_webp_decode_interface() {
CHECK_FOCUS(__func__);
wuffs_webp__decoder dec;
CHECK_STATUS("initialize",
wuffs_webp__decoder__initialize(
&dec, sizeof dec, WUFFS_VERSION,
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder(
wuffs_webp__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-color.lossless.webp", 0, SIZE_MAX, 160, 120,
0x00000000);
}
// ---------------- Mimic Tests
#ifdef WUFFS_MIMIC
// No mimic tests.
#endif // WUFFS_MIMIC
// ---------------- WebP Benches
// No WebP benches.
// ---------------- Mimic Benches
#ifdef WUFFS_MIMIC
// No mimic benches.
#endif // WUFFS_MIMIC
// ---------------- Manifest
proc g_tests[] = {
test_wuffs_webp_decode_interface,
#ifdef WUFFS_MIMIC
// No mimic tests.
#endif // WUFFS_MIMIC
NULL,
};
proc g_benches[] = {
// No WebP benches.
#ifdef WUFFS_MIMIC
// No mimic benches.
#endif // WUFFS_MIMIC
NULL,
};
int //
main(int argc, char** argv) {
g_proc_package_name = "std/webp";
return test_main(argc, argv, g_tests, g_benches);
}
+18
View File
@@ -26,20 +26,26 @@ OK. e08a7cc8 test/data/artificial-png/exif.png
OK. e08a7cc8 test/data/artificial-png/key-value-pairs.png
OK. 076cb375 test/data/bricks-color.bmp
OK. 72a1f9cc test/data/bricks-color.jpeg
OK. 2ef5fd5d test/data/bricks-color.lossless.webp
OK. 2ef5fd5d test/data/bricks-color.lossy.webp
OK. 076cb375 test/data/bricks-color.png
OK. 076cb375 test/data/bricks-color.tga
OK. f36c2e80 test/data/bricks-dither.bmp
OK. f36c2e80 test/data/bricks-dither.gif
OK. 2ef5fd5d test/data/bricks-dither.lossless.webp
OK. f36c2e80 test/data/bricks-dither.no-ancillary.png
OK. f36c2e80 test/data/bricks-dither.png
OK. c2bce675 test/data/bricks-gray.bmp
OK. c2bce675 test/data/bricks-gray.gif
OK. 3a2478ad test/data/bricks-gray.jpeg
OK. 2ef5fd5d test/data/bricks-gray.lossless.webp
OK. 2ef5fd5d test/data/bricks-gray.lossy.webp
OK. c2bce675 test/data/bricks-gray.no-ancillary.png
OK. c2bce675 test/data/bricks-gray.png
OK. c2bce675 test/data/bricks-gray.tga
OK. 7aebfe6c test/data/bricks-nodither.bmp
OK. 7aebfe6c test/data/bricks-nodither.gif
OK. 2ef5fd5d test/data/bricks-nodither.lossless.webp
OK. 7aebfe6c test/data/bricks-nodither.png
OK. 7aebfe6c test/data/bricks-nodither.tga
OK. ae2e547d test/data/bricks-nodither.wbmp
@@ -50,19 +56,27 @@ OK. 3014b4c0 test/data/gifplayer-muybridge.gif
OK. 030f5a48 test/data/harvesters.bmp
OK. c18b3d5a test/data/harvesters.gif
OK. f217df74 test/data/harvesters.jpeg
OK. 2ef5fd5d test/data/harvesters.lossless.webp
OK. 2ef5fd5d test/data/harvesters.lossy.webp
OK. 030f5a48 test/data/harvesters.png
OK. e776c90f test/data/hat.bmp
OK. 6dcba6a4 test/data/hat.gif
OK. 2298f3ca test/data/hat.jpeg
OK. 2ef5fd5d test/data/hat.lossless.webp
OK. 2ef5fd5d test/data/hat.lossy.webp
OK. e776c90f test/data/hat.png
OK. d30bfe5d test/data/hat.wbmp
OK. 33a44f22 test/data/hibiscus.primitive.bmp
OK. 25e212b3 test/data/hibiscus.primitive.gif
OK. 9624fa44 test/data/hibiscus.primitive.jpeg
OK. 2ef5fd5d test/data/hibiscus.primitive.lossless.webp
OK. 2ef5fd5d test/data/hibiscus.primitive.lossy.webp
OK. 33a44f22 test/data/hibiscus.primitive.png
OK. 60040742 test/data/hibiscus.regular.bmp
OK. b727da8b test/data/hibiscus.regular.gif
OK. 41e39405 test/data/hibiscus.regular.jpeg
OK. 2ef5fd5d test/data/hibiscus.regular.lossless.webp
OK. 2ef5fd5d test/data/hibiscus.regular.lossy.webp
OK. 60040742 test/data/hibiscus.regular.png
OK. dcbb225a test/data/hippopotamus.bmp
OK. ed4b78fc test/data/hippopotamus.interlaced.gif
@@ -70,6 +84,8 @@ OK. dcbb225a test/data/hippopotamus.interlaced.png
BAD c3c4bd65 test/data/hippopotamus.interlaced.truncated.gif
BAD 7c6a771b test/data/hippopotamus.interlaced.truncated.png
OK. 96bdbbb3 test/data/hippopotamus.jpeg
OK. 2ef5fd5d test/data/hippopotamus.lossless.webp
OK. 2ef5fd5d test/data/hippopotamus.lossy.webp
OK. d3bbed27 test/data/hippopotamus.masked-with-muybridge.gif
OK. 7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
OK. dcbb225a test/data/hippopotamus.nie
@@ -114,6 +130,8 @@ OK. d42a13cd test/data/peacock.s2x2-420.jpeg
OK. bf7e8c96 test/data/pjw-thumbnail.bmp
OK. bf7e8c96 test/data/pjw-thumbnail.gif
OK. 7c67a37f test/data/pjw-thumbnail.jpeg
OK. 2ef5fd5d test/data/pjw-thumbnail.lossless.webp
OK. 2ef5fd5d test/data/pjw-thumbnail.lossy.webp
OK. bf7e8c96 test/data/pjw-thumbnail.png
OK. 38cb4cbf test/data/red-blue-gradient.dcip3d65-no-chrm-no-gama.png
OK. 38cb4cbf test/data/red-blue-gradient.gamma1dot0.png