summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-05-05 20:01:04 +1000
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-05-05 20:01:04 +1000
commit170921f8c21b498ed9a497c52931e72e791f2fd9 (patch)
tree1c7e681a5b4bd1dea65de388931d4ac1ed9d9de8 /src/format
parentdf61c616e7e639d5782599c65de44464c2c50367 (diff)
feat(png): add benchmark markers to png decoding
Diffstat (limited to 'src/format')
-rw-r--r--src/format/image/png.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c
index 43cab04..e8aefcb 100644
--- a/src/format/image/png.c
+++ b/src/format/image/png.c
@@ -47,8 +47,10 @@ static ff_result ff_png_dispatch(ff_ctx* ctx, ff_stream* stream, ff_png_ctx *png
for (int i = 0; ff_png_chunk_handlers[i].type != NULL; i++) {
if (ff_memcmp(chunk_type, ff_png_chunk_handlers[i].type, 4) == 0) {
- if (ff_png_chunk_handlers[i].handler != NULL)
+ if (ff_png_chunk_handlers[i].handler != NULL) {
+ FF_BENCH_MARK(ctx, ff_png_chunk_handlers[i].type);
ff_png_chunk_handlers[i].handler(ctx, chunk_data, length, png_ctx);
+ }
break;
}
}
@@ -81,7 +83,9 @@ static ff_result ff_png_dispatch(ff_ctx* ctx, ff_stream* stream, ff_png_ctx *png
}
ff_result ff_png_isvalid(ff_ctx* ctx, ff_stream *stream)
-{
+{
+ FF_BENCH_MARK(ctx, "ff_png_isvalid");
+
ff_dprintf(ctx, "png: validating signature\n");
char raw_sig[8];
@@ -106,7 +110,9 @@ ff_result ff_png_isvalid(ff_ctx* ctx, ff_stream *stream)
}
ff_result ff_open_png(ff_ctx* ctx, ff_stream *stream, ff_png_ctx **out_ctx, ff_flag require_valid)
-{
+{
+ FF_BENCH_START(ctx, "png");
+ FF_BENCH_MARK(ctx, "ff_open_png");
ff_png_ctx *png_ctx = ctx->allocator.ff_alloc(sizeof(ff_png_ctx));
if (!png_ctx) {
@@ -470,6 +476,8 @@ ff_result ff_close_png(ff_ctx* ctx, ff_png_ctx *png_ctx)
ctx->allocator.ff_free(png_ctx);
ff_dprintf(ctx, "png: successfully freed png context\n");
+ FF_BENCH_END(ctx);
+
return FF_RESULT_OK;
}