Closed laurelkeys closed 2 years ago
Hi there, this is amazing, thank you very much!
I have a small request: tev is currently transitioning to cpp20 with several changes having already been made to the image loader. These are mostly related to supporting async computation via coroutines (co_await
and co_return
). (see https://github.com/Tom94/tev/pull/134)
Would it be possible for you to target this PR at the cpp20
branch rather than the master
branch to avoid porting effort in the future? (make sure to run git submodule sync
and git submodule update --recursive
after checking out the cpp20
branch)
Somewhat nicely, I think the transition to cpp20 avoids two of the issues you encountered:
.c
file required)If not, that's also fine. I don't want to put extra work on your plate and would be happy to port it myself.
Thanks again in any case!
Regarding your concern about qoi.h
: I enabled CI for your PRs. This will shed some light on whether things compile on all platforms. I will additionally make sure that there are no runtime errors before merging. :)
Would it be possible for you to target this PR at the
cpp20
branch rather than themaster
branch to avoid porting effort in the future?
Sure! I will fetch the C++20 branch and open a new PR targeting cpp20
once I make and test the changes. Btw, I think I can use qoi.h
's encode/decode functions directly with C++ streams to replace the use of path.str().c_str()
.
Thanks!
From quickly looking at qui.h
, the read/write functions copy the entire file into memory anyway, so I agree that doing the copy/reserve on tev's end and calling decode/encode is better.
That said -- perhaps at some point in the future -- a single-pass over the file would be best, given that qui
is a fully streaming format.
@Tom94 if the next releases of tev are going to be based on the cpp20
branch, I believe this PR can be closed in favor of https://github.com/Tom94/tev/pull/148 (?)
Oh wow, that was quick. Very much appreciated!
This PR adds support for the new "Quite OK Image" format (qoi).
This PR is currently labeled as ⚠ work in progress ⚠ because:
qoi.h
doesn't seem to have a way for querying the number of color channels in a file when loading it, analogous to stb_image'sint *channels_in_file
output parameter (see https://github.com/phoboslab/qoi/issues/16);qoi.h
does not have functions that take in some parameter likestbi_io_callbacks
. Hence, I'm usingpath.str().c_str()
directly for loading and saving the files (instead of C++ streams). Please let me know if this is a problem, or if the code can be kept this way.Other notes:
filesystem::path&
->::filesystem::path&
in theinclude/tev/imageio/Image*.h
files, as Visual Studio warns aboutfilesystem
being ambiguous;ostream& iStream
->ostream& oStream
insrc/imageio/StbiLdrImageSaver.cpp
, for consistency;qoi.h
being a C99 file (also, seesrc/imageio/QoiImplementation.c
).