Tom94 / tev

High dynamic range (HDR) image viewer for graphics people
BSD 3-Clause "New" or "Revised" License
1.02k stars 86 forks source link

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

Closed laurelkeys closed 2 years ago

laurelkeys commented 2 years ago

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


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

Other notes:

Tom94 commented 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:

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

Tom94 commented 2 years ago

Oh wow, that was quick. Very much appreciated!