Access compressed RAW data

Hello,

By reading other topics and sample unprocessed_raw, I understood that LibRaw allow me to get the unprocessed data in except of the linearization step.
However, I would like to also access the compressed data from the DNG file produced by my camera (a laboratory microscope).
I tried to follow step-by-step the operations handled by unpack() but I'm not good enough to understand clearly what happens when the load_raw function is called (in unpack.cpp at line 287) and more precisely what are the purpose of ljpeg_start and ljpeg_row.

I thought that I could use libraw_internal_data.unpacker_data.data_offset and libraw_internal_data.unpacker_data.data_size as described in this comment: https://www.libraw.org/comment/1946#comment-1946
But the four bytes read by the code sample when the pointer is located at libraw_internal_data.unpacker_data.data_offset seem to be used as an address to read a header describing some information related to the tile.
So while I was expecting to have just one compressed block of data to extract from the file, it appears that the task is more complicated: find and extract several "little" blocks.

My question is the following one: is there an easy/efficient way to extract those compressed data by using LibRaw? If not, would you please give me an hint on how to proceed? (tag IDs to search in the file for instance)

Thank you in advance for your help and thank you for all the efforts invested in this project.

Note: function called to load raw data is lossless_dng_load_raw() in the case presented.

Forums: 

DNG format is really TIFF 6.0

DNG format is really TIFF 6.0 + (lot of) extra tags for metadata.

Compressed DNG files are usually stored in tiles (each tile compressed separately)

If you want to read 'original' (i.e. compressed) data, libtiff is much better fit for this task.

-- Alex Tutubalin