I am wondering if thereis a function in IPP that can help me convert planar YUV 8-bit 4:4:4 into4:2:2 and vice versa. Technically I just need toconvert the 2 chroma planes.
See this page in the documentation for a complete list of the conversion functions:
Possibly, you could convert twice, through a differenc color space, but you might lose some color fidelity and using a second step might defeat the performance advantage. See this doc page:
With the format being planar, you should just subsample the chroma planes that you also seem to indicate. Use your favorite subsampling/resizing function for that, e.g. ippiResizeSqrPixel. The source Y-plane is obviously just copied to the destination Y-plane using an ordinary ippiCopy function. This keeps the color fidelity (except the unavoidable loss in color due to subsampling) and let's you choose the subsampling/interpolation you like. So it will consist of three independent IPP calls; one for each plane.
We do the exact same using bilinear downscaling and it seems to perform well. If Intel had made a specific IPP function for it, it could possibly have performed slightly better but I doubt that the difference would be significant.
If you resize, as suggested, you might want to add a parameter to the funciton you createthat allows the caller to specify if the frame is interlaced or not. In the interlaced case, you would want to resize top/bottom fields separately. This is fairly easy to do by doubling the stride. If you only deal with progressive content, you can ignore this suggestion.
In 4:2:2, Cb and Cr are co-sited, meaning going from 4:4:4 you just need to throw away every other sample. I suppose theresize functionsinvolve some kind of filtering, which is not ideal if you want to preserve the exact co-sited values.