Pixel data manipulation


I'm sorry if this has been asked before, but I'd like to know how to extract pixel data for further processing, then write it back into some lossless format like TIFF.
I have been digging this forum for a solution, but all I found is that things get extremely complicated. (for me at least :) )
I'd like to work with pixel values in CUDA, on GPU. All I want to achieve is an array or matrix or whatever you call it, that contains the "least processed" but raw pixel data if this is possible.
I'd like to process .NEF files. Now I don't really understand the way Bayer images are stored (one component per pixel ?!?!?) Converting to rgb is fine as long as there's no loss of information.
Could someone help me out or point me at a relatively beginner friendly tutorial?

Thanks, Pete


Unaltered ('as unpacked')

Unaltered ('as unpacked') pixel values are stored in imgdata.rawdata array(s)

samples/unprocessed_raw.cpp example writes (unaltered) data to TIFF file, probably this is code example you're looking for

-- Alex Tutubalin @LibRaw LLC