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
Added support for decoding plain PPM formats #5242
Conversation
Remove commented line. Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
for more information, see https://pre-commit.ci
I'm looking for this feature as well. What's holding up the merge? I'd be happy to help bring this over the finish-line if there's anything left to do. |
After #6242, it has become apparent that the hopper_32bit had a maximum value outside of the 0-65535 range. So I've removed those test images. |
9b5d3aa
to
c6646f7
Compare
@djbuijs I've now resolved the merge conflict, and added support for arbitrary maxval in plain formats to continue the work of #6119. Those were the issues that I was conscious of. What's left is just reviewing it to make sure that everything is correct and there's no straightforward improvements to be made. |
0f7e75e
to
da43130
Compare
Thank you @radarhere! |
Resolves #860
Resolves #4999
Builds upon @gofr's PR draft #5009.
Changes proposed in this pull request:
raw
andplain
formats inconsistent, so I decided to leave it as is;I made the changes on top of my other, still open, PR (#5121).
gofr's PR could potentially read the whole file at once (if there are no
LF
s) which for very large files could take up lots of memory. To avoid this, I tried to read one char at a time and although the implementation was easy, the performance was poor. I finally opted to read 1 MB blocks and process each one instead. The code ended up being more complex,* so there's that. On the bright side, it could easily be adapted not to_pull_fd
, if it's any use.*Strictly speaking, the PPM format doesn't allow comments in the raster section. However, these are commonly used. Ignoring them even when they span several blocks or split tokens in half was the hardest part.