How can I convert Packed YUV422(YCbCr) into Planar YUV?

As the title says, I’d like to convert any ordinary YUV422 (U0 Y0 V0 Y1 U2 Y2 V2 Y3 U4 Y4 V4…) raw data into YUV planar data (so that I can put it into a cuda function nvjpegEncodeYUV()).

I’ve found some looking good api - nppiCopy_16u_C3P3R But I am not sure if this api is good to use my case. I doubt because the api itself doesn’t mention whether it supports YUV data at all.

I wrote same question on stackoverflow.com also:

Please help…