summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJules Maselbas <jmaselbas@kalray.eu>2022-01-18 00:02:31 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-01-20 09:14:01 +0100
commiteacac60aeb46a0d35c92c673fcaa118befd54bfe (patch)
tree26cd14528a6ef79e7b06c22b5f2dd3bffe86db4c
parent38dd0a5579e15bee6d890d3a232da29574a49083 (diff)
downloadbarebox-eacac60aeb46a0d35c92c673fcaa118befd54bfe.tar.gz
barebox-eacac60aeb46a0d35c92c673fcaa118befd54bfe.tar.xz
filetype: Add QOI format image type
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@kalray.eu> Link: https://lore.barebox.org/20220117230235.13549-2-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/filetype.c3
-rw-r--r--include/filetype.h1
2 files changed, 4 insertions, 0 deletions
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,