Parsing Fujifilm CFA layout (X-T2)

Hi everyone,

I'm trying to understand the Fujifilm RAF file format, I need some quick and dirty parsing but I can't really use dcraw or libraw.

I've managed to parse the non-CFA parts of the file: magic number, camera version (X-T2 in my case), I can extract the JPEG preview, etc. I'm stuck on parsing the CFA part of the file.

I can't find any info about the CFA part of the file, what's it's exact format? My C is quite rusty, and dcraw.c is pretty scary looking, is there a simple explanation of how to get the raw values out of the CFA (without trying to reverse engineer dcraw)?

I'm not looking for demosaicing, or doing anything to the image data inside. In a way, I need what "dcraw -D" gives.

Thanks a lot!

Forums: