Add std/png benches for ignore/verify checksums

wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   324MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   258MB/s ± 0%

wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    319MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    269MB/s ± 0%
This commit is contained in:
Nigel Tao committed 2021-01-22 11:34:52 +11:00
1 parent 5669f6da87
commit 170a810486
2 files changed
+49 -4

No files matched your search

+21
View File
@@ -14,6 +14,8 @@
#include "png.h"
#define WUFFS_MIMICLIB_PNG_DOES_NOT_SUPPORT_QUIRK_IGNORE_CHECKSUM 1
const char* //
mimic_png_decode(uint64_t* n_bytes_out,
wuffs_base__io_buffer* dst,
@@ -40,6 +42,25 @@ mimic_png_decode(uint64_t* n_bytes_out,
goto cleanup0;
}
size_t i;
for (i = 0; i < quirks_len; i++) {
uint32_t q = quirks_ptr[i];
if (q == WUFFS_BASE__QUIRK_IGNORE_CHECKSUM) {
// TODO: configure libpng to ignore Adler-32 and CRC-32 checksums.
//
// The libpng "simplified API" (based on the png_image struct type) does
// not offer an equivalent of libpng's lower level API's
// png_set_crc_action and png_set_option(etc, PNG_IGNORE_ADLER32, etc).
// But the lower level API is complicated (hence why libpng introduced a
// "simplified API" in the first place), especially trying to make the
// equivalent of the png_image.format field work.
//
// Instead, we simply disable (via the
// WUFFS_MIMICLIB_PNG_DOES_NOT_SUPPORT_QUIRK_IGNORE_CHECKSUM macro) any
// tests or benches that try to use WUFFS_BASE__QUIRK_IGNORE_CHECKSUM.
}
}
switch (pixfmt.repr) {
case WUFFS_BASE__PIXEL_FORMAT__Y:
pi.format = PNG_FORMAT_GRAY;
+28 -4
View File
@@ -587,7 +587,17 @@ bench_wuffs_png_decode_image_77k_8bpp() {
}
const char* //
bench_wuffs_png_decode_image_552k_32bpp() {
bench_wuffs_png_decode_image_552k_32bpp_ignore_checksum() {
uint32_t q = WUFFS_BASE__QUIRK_IGNORE_CHECKSUM;
CHECK_FOCUS(__func__);
return do_bench_image_decode(
&wuffs_png_decode, WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED,
wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL),
&q, 1, "test/data/hibiscus.primitive.png", 0, SIZE_MAX, 4);
}
const char* //
bench_wuffs_png_decode_image_552k_32bpp_verify_checksum() {
CHECK_FOCUS(__func__);
return do_bench_image_decode(
&wuffs_png_decode, WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED,
@@ -757,7 +767,17 @@ bench_mimic_png_decode_image_77k_8bpp() {
}
const char* //
bench_mimic_png_decode_image_552k_32bpp() {
bench_mimic_png_decode_image_552k_32bpp_ignore_checksum() {
uint32_t q = WUFFS_BASE__QUIRK_IGNORE_CHECKSUM;
CHECK_FOCUS(__func__);
return do_bench_image_decode(
&mimic_png_decode, WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED,
wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL),
&q, 1, "test/data/hibiscus.primitive.png", 0, SIZE_MAX, 4);
}
const char* //
bench_mimic_png_decode_image_552k_32bpp_verify_checksum() {
CHECK_FOCUS(__func__);
return do_bench_image_decode(
&mimic_png_decode, WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED,
@@ -814,7 +834,8 @@ proc g_benches[] = {
bench_wuffs_png_decode_image_19k_8bpp,
bench_wuffs_png_decode_image_40k_24bpp,
bench_wuffs_png_decode_image_77k_8bpp,
bench_wuffs_png_decode_image_552k_32bpp,
bench_wuffs_png_decode_image_552k_32bpp_ignore_checksum,
bench_wuffs_png_decode_image_552k_32bpp_verify_checksum,
bench_wuffs_png_decode_image_4002k_24bpp,
#ifdef WUFFS_MIMIC
@@ -822,7 +843,10 @@ proc g_benches[] = {
bench_mimic_png_decode_image_19k_8bpp,
bench_mimic_png_decode_image_40k_24bpp,
bench_mimic_png_decode_image_77k_8bpp,
bench_mimic_png_decode_image_552k_32bpp,
#ifndef WUFFS_MIMICLIB_PNG_DOES_NOT_SUPPORT_QUIRK_IGNORE_CHECKSUM
bench_mimic_png_decode_image_552k_32bpp_ignore_checksum,
#endif
bench_mimic_png_decode_image_552k_32bpp_verify_checksum,
bench_mimic_png_decode_image_4002k_24bpp,
#endif // WUFFS_MIMIC