[PATCH v2 1/5] filetype: Add QOI format image type
Jules Maselbas
jmaselbas at kalray.eu
Mon Jan 17 15:02:31 PST 2022
QOI image format is a "Quite OK" image format, it's simplicity is it's
strengh and could be a good replacement of bmp, maybe even for png.
Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
---
common/filetype.c | 3 +++
include/filetype.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index 8ffcd6adcd..e5245668e2 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -45,6 +45,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_mbr] = { "MBR sector", "mbr" },
[filetype_bmp] = { "BMP image", "bmp" },
[filetype_png] = { "PNG image", "png" },
+ [filetype_qoi] = { "QOI image", "qoi" },
[filetype_ext] = { "EXT filesystem", "ext" },
[filetype_gpt] = { "GUID Partition Table", "gpt" },
[filetype_ubifs] = { "UBIFS image", "ubifs" },
@@ -300,6 +301,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
return filetype_aimage;
if (buf64[0] == le64_to_cpu(0x0a1a0a0d474e5089ull))
return filetype_png;
+ if (strncmp(buf8, "qoif", 4) == 0)
+ return filetype_qoi;
if (is_barebox_mips_head(_buf))
return filetype_mips_barebox;
if (buf[0] == be32_to_cpu(0x534F4659))
diff --git a/include/filetype.h b/include/filetype.h
index 2640847e1f..8bc179ac08 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -28,6 +28,7 @@ enum filetype {
filetype_mbr,
filetype_bmp,
filetype_png,
+ filetype_qoi,
filetype_ext,
filetype_gpt,
filetype_ubifs,
--
2.17.1
More information about the barebox
mailing list