Identifying/decomposing raw formats
I don't have any prior experience with LibRaw, but quickly glossing over the documentation and header files, I didn't find anything that looks like the kind of feature I'm looking for. Maybe I'm wrong, though!
I'd like to be able to do the following:
- Identify that a file is a raw file, as quickly as possible.
- If it is a raw file, figure out if it is using a compressed sample representation or not.
- If it is not using compressed representation, determine where (i.e. at which byte offset) in the raw file the pixel data starts, where it ends, and what the format of the pixels is (e.g. 16-bit little-endian integer, no padding, RGGB or something like this). I'm naively assuming that most raw formats store the pixel data in a contiguous block.
I'm pretty certain that all of this information is available somewhere inside LibRaw. The question is if there is already an interface that could provide this information, and if there isn't, if it would be something worth adding without making it a maintenance nightmare.
The reason I'm asking in this is that I'd like to add transparent compression/decompression support for uncompressed raw files to my compressed read-only file system [1]. That is, while the data is compressed in the file system image, it will be byte-for-byte identical to the original raw file when the file system is mounted. I've implemented this type of transparent compression/decompression for raw audio formats as well as for the FITS image format that is popular in astrophotography. The compression ratio is usually around 50% and compression/decompression speed is so fast that by accessing a mounted image over a 1 Gbps network, you can achieve read speeds of up to 2 Gbps. I'm using this already for archiving my astrophotography images, and I would like to also use it to archive my uncompressed raw images. I've already done a few basic tests by converting raw images to FITS to see if they compress well using the compression algorithm I'm using and it seems they do.
Any feedback would be really appreciated!
Recent comments