I am writing a scaling algorithm for YUV422 packed format images (without any intermediate conversions to RGB or grayscale or what have you). As can be seen in the below image from MSDN, the 4:2:2 format has 2 Luma bytes for each chroma byte. My test bench involves procuring images from the iSight camera using OpenCV APIs, converting them to YUV (CV_BGR2YUV) and then resizing them. The questions I have are:
I am posting sample data (from OpenCV's Mat's pointer to raw data) for reference below straight from the memory dump, how do I identify by looking at the data as to what is the Y component and what the UV components are? 05 89 7C 06 89 7B 04 89 7C 02 87 7E 04 88 7C 0A Is this bilinear interpolation algorithm correct? Let's say, my box is TOP ROW: Y00, U00, Y01, Y02, V00, Y03; BOTTOM ROW: Y10, U10, Y11, Y12, V10, Y13. Then the final pixels would be interpolated from: (Y00, Y01, Y10, Y11), (U00, U10, 0, 0), (Y02, Y03, Y12, Y13), (0, 0, V00, V10). That forms my first two YUYV pixels of 32 bits.
Any references to principles of performing bilinear interpolation on YUYV images would be very helpful! Thanks in advance.