-
Notifications
You must be signed in to change notification settings - Fork 118
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
LJpegDecompressor predictor mode 6 support #189
Comments
Even w/ the predictor implemented, there is still some way to go - seems to be the BlackMagick TIFF tile tags vs LJpeg SOF3 frame geometry is a bit wonky/unexpected compared to "normal" CFA lossless DNGs?
|
Yep, unlike Adobe's "normal" lossless mode that has an SOF3 w/ H x W/2 x 2ch and matching TIFF tiles of H x W after reshaping, the Blackmagic SOF3 in the URSA 4K really is
Not sure which one of them is wrong and how to reshape, could be that it is H/2 x 2W x 1 -> H x W? In any case this test/assumption breaks. |
Did a quick test of manually changing the TIFF tags, and the results is not good (output image is sliced up incorrectly), so it really does seem the "special" reshaping needs to be done at the SOF3 decoding stage. |
Yay, more Ljpeg fun - predictor 6 just popped up in DJI Mavic 3 Pro DNGs as well...
w/ SOF3 (8000x1500): Edit: This is the same 2W x H/2 scatter/gather as Blackmagic. |
While the Sony ARW case was somewhat straightforward (we know a priori how to reshape the TIFF tiles, decompress, and then deinterleave back because it is the sole ARW lossless mode), it is not so for these Blackmagic/DJI/MLV CinemaDNGs - the tiling in the DngDecoder is done before any LJpeg parsing, and there is no other way to tell one needs the tile reshaping and subsequent deinterleaving compared to "traditional" DNGs. So the ideal flow after refactoring should be:
Right now, the DNG tiling (coming first) and LJpeg parsing are completely independent. |
Apologies if i have asked this before, but do we have example DNG's with predictor=0, |
predictor=0 is not really valid/supported, did you mean 6? If so, then, yes, we do have several samples on RPU. Please also note that I have updated the diagram - I now believe the reshaping and deinterleaving works out to be the same as the Sony case, despite the MCU difference. |
Err, i meant whatever we currently already support, i.e. |
The known predictor=1 files (at least to me) are:
All others seem to require either predictor 6 or 7 supported AFAIK... So, chicken and egg it would seem ;) As mentioned above - I have managed to decompress successfully w/ my "dumb" predictor patch (and by fudging the tiles in TIFF metadata manually), but the image comes out interlaced of course. |
@LebedevRI Note that the TIFF tile <-> JPEG SOF reshaping takes place for the lossy DNG mode as well, so ljpeg is probably not the place to address that in the abstraction hierarchy. This is from the Blackmagic Pocket Cinema Camera 4K 3:1 lossy DNG:
w/ |
Ah, turns out the reshaping for Blackmagic is even simpler than I thought: it's still 2W x H/2, but instead of flattening 2x2 pixel CFA macroblock into 4x1, it is just deinterleaving entire 2 rows, so one just needs to decode it into an appropriate buffer and it's done! I updated the diagram accordingly. |
Comes up in Blackmagic cameras, Magic Lantern DNG's.
The text was updated successfully, but these errors were encountered: