Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add initial support for the QOI image format #147

Closed
wants to merge 1 commit into from

Conversation

laurelkeys
Copy link
Contributor

@laurelkeys laurelkeys commented Nov 26, 2021

This PR adds support for the new "Quite OK Image" format (qoi).


This PR is currently labeled as ⚠ work in progress ⚠ because:

Other notes:

  • I have replaced filesystem::path& -> ::filesystem::path& in the include/tev/imageio/Image*.h files, as Visual Studio warns about filesystem being ambiguous;
  • I have replaced ostream& iStream -> ostream& oStream in src/imageio/StbiLdrImageSaver.cpp, for consistency;
  • I have only compiled this on Windows, using Visual Studio 16 2019. It would be great to have it tested on at least one other platform to make sure there won't be problems with qoi.h being a C99 file (also, see src/imageio/QoiImplementation.c).

@Tom94
Copy link
Owner

Tom94 commented Nov 27, 2021

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 #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:

  • designated initializers should now be fine in cpp code. (No separate .c file required)
  • filesystem is now native to the STL, sidestepping the ambiguity warnings

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!

@Tom94
Copy link
Owner

Tom94 commented Nov 27, 2021

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. :)

@laurelkeys
Copy link
Contributor Author

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?

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().

@Tom94
Copy link
Owner

Tom94 commented Nov 27, 2021

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.

@laurelkeys
Copy link
Contributor Author

@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 #148 (?)

@Tom94
Copy link
Owner

Tom94 commented Nov 27, 2021

Oh wow, that was quick. Very much appreciated!

@Tom94 Tom94 closed this Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants