summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-01-29 20:21:19 +1100
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-01-29 20:21:19 +1100
commit3989489a3a786aeb87dbdf30d6468f7fe7438759 (patch)
treed1136675c1a5f0166220f43e68d6eac2242c0764
parentf8ce98574f3f1e4f314de15be7fc66f307348618 (diff)
feat(png): Keep interlacing value in PNG context
-rw-r--r--include/tinyff/image/png.h3
-rw-r--r--src/format/image/png.c16
2 files changed, 19 insertions, 0 deletions
diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h
index c2c7db2..3937e8d 100644
--- a/include/tinyff/image/png.h
+++ b/include/tinyff/image/png.h
@@ -37,6 +37,9 @@ typedef struct {
uint8_t bit_depth;
uint8_t color_type;
+ // Interlace method
+ uint8_t interlace_method;
+
// Image data
ff_png_mode image_mode;
diff --git a/src/format/image/png.c b/src/format/image/png.c
index f21b42b..3fd14d5 100644
--- a/src/format/image/png.c
+++ b/src/format/image/png.c
@@ -92,6 +92,7 @@ ff_result ff_png_header_handler(uint8_t *buf, size_t len, ff_png_ctx *ctx)
ctx->height = h;
ctx->bit_depth = buf[8];
ctx->color_type = buf[9];
+ ctx->interlace_method = buf[12];
ff_dprintf("png: IHDR stored in context\n");
@@ -148,6 +149,21 @@ ff_result ff_png_data_handler(uint8_t *buf, size_t len, ff_png_ctx *ctx)
return FF_RESULT_ERROR_DECOMPRESSION_FAILURE;
}
+ ff_dprintf("png: IDAT data uncompressed successfully\n");
+
+ // Now we parse the uncompressed data into our pixel buffer
+ // However I don't understand Adam7 so interlaced images are not supported yet
+ if (ctx->interlace_method != 0) {
+ ff_dprintf("png: interlaced images are not supported yet\n");
+ free(uncompressed_data);
+ return FF_RESULT_WARN_NO_IMPL;
+ }
+
+ // Now I am very inexperienced so I'm doing what I think is right
+ // TODO: Review this code later
+
+
+
return FF_RESULT_WARN_NO_IMPL;
}