Implementing custom demosaic algorithm - any examples?

As the title says I am working on implementing a custom demosaic algorithm. I am having some trouble writing intermediate results to file. I have been trying to use dcraw_ppm_tiff_writer() but I seem to be missing G2 in the output. I have the same problem trying to write the raw (opened and unpacked file) to a TIFF. Does anyone have a suitable example?

Forums: