Korkut Gule wrote:
Hi Guys,
If i am receiving data in format of IYU1 (aka Y411) can i use any of the YUV surfaces in DirectFB ? Or the best way would be converting it to RGB ? I would like to copy image buffer to surface directly and flip it. Best Regards !


Probably the best way would be converting the image to YUY2.

For example the following function converts a Y411 image to YUY2 in little-endian byte order:

void
Y411_to_YUY2_LE( vodi *src, void *dst,
                 int src_pitch, int dst_pitch,
                 int width, int height )
{
     unsigned char *S;
     unsigned int  *D;
     int            n;

     while (height--) {
          for (S = src, D = dst, n = width/4; n--;) {
               // Y0 U2 Y1 V2
               D[0] = S[1] | (S[0] << 8) | (S[2] << 16) | (S[3] << 24);
               // Y2 U2 Y3 V2
               D[1] = S[4] | (S[0] << 8) | (S[5] << 16) | (S[3] << 24);

               S += 12;
               D += 2;
          }

          src += src_pitch;
          dst += dst_pitch;
     }
}

--
Regards,
     Claudio Ciccani

[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to