[PATCH 3/5] scripts: Add qoiconv to convert png to qoi
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jan 17 03:48:25 PST 2022
On 14.01.22 12:14, Jules Maselbas wrote:
> On Fri, Jan 14, 2022 at 11:29:58AM +0100, Ahmad Fatoum wrote:
>> On 10.01.22 23:12, Jules Maselbas wrote:
>>> ImageMagick will eventually support the qoi image format, in the
>>> mean time add a png to qoi conversion program.
>>>
>>> Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
>>> ---
>>> scripts/Kconfig | 5 +
>>> scripts/Makefile | 1 +
>>> scripts/qoiconv.c | 91 +
>>> scripts/stb_image.h | 7756 +++++++++++++++++++++++++++++++++++++++++++
>>> 4 files changed, 7853 insertions(+)
>>> create mode 100644 scripts/qoiconv.c
>>> create mode 100644 scripts/stb_image.h
>>>
>>> diff --git a/scripts/Kconfig b/scripts/Kconfig
>>> index 9b744deba9..747f665e02 100644
>>> --- a/scripts/Kconfig
>>> +++ b/scripts/Kconfig
>>> @@ -110,6 +110,11 @@ config RK_USB_LOADER
>>>
>>> You need libusb-1.0 to compile this tool.
>>>
>>> +config QOICONV
>>> + bool "QOI image format conversion" if COMPILE_HOST_TOOLS
>>> + help
>>> + This enable converting png to qoi images to generate boot logo.
>>> +
>>> endmenu
>>>
>>> menu "Target Tools"
>>> diff --git a/scripts/Makefile b/scripts/Makefile
>>> index dc5fa75f90..cbaf2d55ff 100644
>>> --- a/scripts/Makefile
>>> +++ b/scripts/Makefile
>>> @@ -8,6 +8,7 @@ hostprogs-always-y += fix_size
>>> hostprogs-always-y += bareboxenv
>>> hostprogs-always-y += bareboxcrc32
>>> hostprogs-always-y += kernel-install
>>> +hostprogs-always-$(CONFIG_QOICONV) += qoiconv
>>> hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
>>> HOSTCFLAGS_rsatoc = `pkg-config --cflags openssl`
>>> HOSTLDLIBS_rsatoc = `pkg-config --libs openssl`
>>> diff --git a/scripts/qoiconv.c b/scripts/qoiconv.c
>>> new file mode 100644
>>> index 0000000000..010c70ead0
>>> --- /dev/null
>>> +++ b/scripts/qoiconv.c
>>> @@ -0,0 +1,91 @@
> Probably missing SPDX identifiers as well
>
>>> +/*
>>> +
>>> +Command line tool to convert between png <> qoi format
>>> +
>>> +Requires "stb_image.h" and "stb_image_write.h"
>>> +Compile with:
>>> + gcc qoiconv.c -std=c99 -O3 -o qoiconv
>>> +
>>> +Dominic Szablewski - https://phoboslab.org
>>> +
>>> +
>>> +-- LICENSE: The MIT License(MIT)
>>> +
>>> +Copyright(c) 2021 Dominic Szablewski
>>> +
>>> +Permission is hereby granted, free of charge, to any person obtaining a copy of
>>> +this software and associated documentation files(the "Software"), to deal in
>>> +the Software without restriction, including without limitation the rights to
>>> +use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies
>>> +of the Software, and to permit persons to whom the Software is furnished to do
>>> +so, subject to the following conditions :
>>> +The above copyright notice and this permission notice shall be included in all
>>> +copies or substantial portions of the Software.
>>> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>>> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
>>> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>>> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>>> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>>> +SOFTWARE.
>>> +
>>> +*/
>>
>> Can you not reuse the header added in the previous commit?
> I am not sure what you mean here, the qoi.h header is reused from
> lib/gui/qoi.h, see the include below.
> Are you sugesting to _not_ reuse the header?
All good then. I missed that.
>
>
>>> +
>>> +
>>> +#define STB_IMAGE_IMPLEMENTATION
>>> +#define STBI_ONLY_PNG
>>> +#define STBI_NO_LINEAR
>>> +#include "stb_image.h"
>>> +
>>> +#define QOI_IMPLEMENTATION
>>> +#include "../lib/gui/qoi.h"
> included here.
>
>
>
>
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list