The simplest solution for you is to use YV24 as an intermediate format, which will handle all the chroma subsampling issues. Use ConvertToYV24() /ConvertToYV12() to convert YV12 <-> YV24, either in a script or by using env->Invoke() inside your plugin. Conversion YV24 <-> RGB is simple, using the formulae you have already discovered.