In my efforts to continue to improve the core programming, I took on an issue that's plagued me for quite a while now. The issue resides around the pulling of image data from the raw video files, in this case, the R3D file format. I'd been pulling things into memory (that is, RAM memory) and then sending it to the GPU for rendering. But, there was a way to decompress and debayer the frame entirely o the GPU, and then have the system debayer it into a texture that's already on the GPU.
I couldn't get this to work for quite a long time, because I just haven't done this before and the code available to browse on the internet for this kind of thing is, well, almost non-existent. So I had to do a bit of improvising and find examples that I could transfer over to my needs. Turns out, I was missing perhaps ~6 lines of code. When added, the system did it's job, and without issue.
This is really great because, it's sped up the viewport rendering, for projects using clips with the R3D file format, by almost 100%. That is, it's almost twice as fast to go between frames now. There is however, a new issue that's arisen. I don't know why, but for some reason pulling frame data into RAM memory and then transferring back onto the GPU for the viewport engine does something to the gamma curves. Here's two frames that tell the story:
As you can see, there's a clear difference in colours between the two viewport screen shots. I'm absolutely sure this has something to do with the colour space and/or gamma curve. What puzzles me though, is that I'm not sure where this problem sits. I can use the same values to decode and debayer the image irrespective of whether I transfer the final shot to CPU memory first, or go straight to GPU memory. I just don't know why there's a change in viewport colours if the decode and debayer functions use the same settings.
There must be something happening in the transfer to CPU RAM as opposed to going straight to GPU memory. I think the darker image may actually be the correct one, which may mean I have to do a bit of work with my shaders. But I'll need to dig a bit further to figure this one out.