List Info

Thread: CR-Client: add RGB32->YUY2 color converter plus test harness




CR-Client: add RGB32->YUY2 color converter plus test harness
country flaguser name
United States
2007-05-08 11:02:17
Description
---------------------------------------
Currently, we do not have a one-step RGB32->YUY2
color converter in our color conversion library,
and if RGB32->YUY2 color conversion is needed, then
we have to do a two-step RGB32->I420->YUY2
conversion.
This change adds a one-step RGB32->YUY2 color
converter. It uses multiplies instead of lookups,
so it may not be as efficient as it could be. But
since it's a one-step converter, it's way more
efficient than what we currently have. For chroma
subsampling, I did the simplest possible thing:
alternated outputting U and V for each input
RGB pixel.

Also, I added a test harness in video/colconverter/test
which reads each raw RGB32 frame and converts it
to YUY2 and then writes all the converted frames
out to a new file.

Files Added
-----------------------------------------
video/colconverter/test/Umakefil
video/colconverter/test/win32.pcf
video/colconverter/test/rgb32_to_yuy2.cpp

Files Modified
-----------------------------------------
video/colconverter/hxcolor.cpp
video/colconverter/rgb2yuv.c
video/colconverter/pub/colorlib.h

Testing
-----------------------------------------
I produced a raw RGB32 file using dtdrive and
binwrtr and then converted this raw RGB32 file
to YUY2 and viewed it using PYUV (a third-party
raw viewing tool for Windows and Linux found at:
http://dsplab.diei.unipg.it/pyuv_raw_video_sequence_pl
ayer).


Index: colconverter/hxcolor.cpp
============================================================
=======
RCS file: /cvsroot/video/colconverter/hxcolor.cpp,v
retrieving revision 1.8
diff -u -w -u -w -r1.8 hxcolor.cpp
--- colconverter/hxcolor.cpp    11 Mar 2005 19:58:04 -0000  
   1.8
+++ colconverter/hxcolor.cpp    8 May 2007 15:55:55 -0000
 -239,6
+239,7 
 #endif
                                 {CID_ARGB32, 
RGB32toRGB32},
                                 {CID_YUVA,    ARGBtoYUVA},
+                                {CID_YUY2,   
RGB32toYUY2},
                                 {CID_UNKNOWN, 0} };

 static CCLINK pcclARGB32  [] = { {CID_I420,   
RGB32toI420},
 -253,6
+254,7 
                                  {CID_BGR32,  
RGB32toBGR32},
                                  {CID_RGB32,  
RGB32toRGB32},
                                  {CID_YUVA,   
ARGBtoYUVA},
+                                 {CID_YUY2,   
RGB32toYUY2},
                                  {CID_UNKNOWN, 0} };

 static CCLINK pcclYUVA  [] = { {CID_UNKNOWN, 0} };
Index: colconverter/rgb2yuv.c
============================================================
=======
RCS file: /cvsroot/video/colconverter/rgb2yuv.c,v
retrieving revision 1.4
diff -u -w -u -w -r1.4 rgb2yuv.c
--- colconverter/rgb2yuv.c      29 Dec 2004 02:07:37 -0000  
   1.4
+++ colconverter/rgb2yuv.c      8 May 2007 15:55:55 -0000
 -1104,4
+1104,106 
     return 0;
 }

+//////////////////////////////////////////////////////
+//
+//     RGB32toYUY2
+//
+//////////////////////////////////////////////////////
+
+int RGB32toYUY2 (unsigned char* dest_ptr,
+                 int            dest_width,
+                 int            dest_height,
+                 int            dest_pitch,
+                 int            dest_x,
+                 int            dest_y,
+                 int            dest_dx,
+                 int            dest_dy,
+                 unsigned char* src_ptr,
+                 int            src_width,
+                 int            src_height,
+                 int            src_pitch,
+                 int            src_x,
+                 int            src_y,
+                 int            src_dx,
+                 int            src_dy)
+{
+    /* scale factors: */
+    int            scale_x = 0;
+    int            scale_y = 0;
+    int            x       = 0;
+    int            y       = 0;
+    unsigned char* pSrc    = NULL;
+    unsigned char* pDst    = NULL;
+    int            iR      = 0;
+    int            iG      = 0;
+    int            iB      = 0;
+    int            iY      = 0;
+    int            iU      = 0;
+    int            iV      = 0;
+
+    /* check arguments: */
+    if (!chk_args (dest_ptr, dest_width, dest_height,
dest_pitch,
+                   dest_x, dest_y, dest_dx, dest_dy,
src_ptr, src_width,
src_height,
+                   src_pitch, src_x, src_y, src_dx, src_dy,
&scale_x,
&scale_y))
+    {
+        return -1;
+    }
+
+    /* Only support 1:1 scale */
+    if (scale_x != 1 || scale_y != 1)
+    {
+        return -1;
+    }
+
+    /* check if bottom-up bitmaps: */
+    if (src_pitch  <= 0)
+    {
+        return -1; /* not supported */
+    }
+    if (dest_pitch <= 0)
+    {
+        return -1; /* not supported */
+    }
+
+    /* Run through each row */
+    for (y = 0; y < src_dy; y++)
+    {
+        /* Get the src and dst row pointers */
+        pSrc = src_ptr  + (src_y + y)  * src_pitch  + src_x
* 4;
+        pDst = dest_ptr + (dest_y + y) * dest_pitch +
dest_x * 2;
+        /* Loop along each row */
+        for (x = 0; x < src_dx; x++)
+        {
+            /* Convert RGB to YUV, using the following
fixed-point formula:
+             *
+             * Y = (r *  2104 + g *  4130 + b *  802 + 4096
+  131072) >>
13
+             * U = (r * -1214 + g * -2384 + b * 3598 + 4096
+ 1048576) >>
13
+             * V = (r *  3598 + g * -3013 + b * -585 + 4096
+ 1048576) >>
13
+             */
+#if defined(_WINDOWS)
+            iR = pSrc[2];
+            iG = pSrc[1];
+            iB = pSrc[0];
+#else
+            iR = pSrc[0];
+            iG = pSrc[1];
+            iB = pSrc[2];
+#endif
+            iY = (iR *  2104 + iG * 4130 + iB *  802 + 4096
+  131072) >>
13;
+            iU = (iR * -1214 - iG * 2384 + iB * 3598 + 4096
+ 1048576) >>
13;
+            iV = (iR *  3598 - iG * 3013 - iB *  585 + 4096
+ 1048576) >>
13;
+            /* Write out the Y */
+            pDst[0] = (unsigned char) iY;
+            /* If we are even, write out U. If odd, write V
*/
+            pDst[1] = (unsigned char) ((x & 1) ? iV :
iU);
+            /* Advance the src pointer */
+            pSrc += 4;
+            /* Advance the dst pointer */
+            pDst += 2;
+        }
+    }
+
+    return 0;
+}
+
 /* rgb2yuv.c -- end of file */
Index: colconverter/pub/colorlib.h
============================================================
=======
RCS file: /cvsroot/video/colconverter/pub/colorlib.h,v
retrieving revision 1.5
diff -u -w -u -w -r1.5 colorlib.h
--- colconverter/pub/colorlib.h 29 Dec 2004 02:08:59 -0000  
   1.5
+++ colconverter/pub/colorlib.h 8 May 2007 15:55:55 -0000
 -276,6
+276,7 
 int RGB555toI420  (unsigned char *, int, int, int, int,
int, int, int,
unsigned char *, int, int, int, int, int, int, int);
 int RGB8toI420    (unsigned char *, int, int, int, int,
int, int, int,
unsigned char *, int, int, int, int, int, int, int);
 int ARGBtoYUVA    (unsigned char *, int, int, int, int,
int, int, int,
unsigned char *, int, int, int, int, int, int, int);
+int RGB32toYUY2   (unsigned char *, int, int, int, int,
int, int, int,
unsigned char *, int, int, int, int, int, int, int);
 int BGR_32toI420  (unsigned char *, int, int, int, int,
int, int, int,
unsigned char *, int, int, int, int, int, int, int);
 int BGR24toI420   (unsigned char *, int, int, int, int,
int, int, int,
unsigned char *, int, int, int, int, int, int, int);

=============================================
Eric Hyche (ehychereal.com)
Technical Lead
RealNetworks, Inc. 

_______________________________________________
Video-dev mailing list
Video-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/video
-dev

  
  
  
Re: CR-Client: add RGB32->YUY2 color converter plus test harness
country flaguser name
United States
2007-05-08 12:28:11
Eric Hyche wrote:
> Description
> ---------------------------------------
> Currently, we do not have a one-step RGB32->YUY2
> color converter in our color conversion library,
> and if RGB32->YUY2 color conversion is needed, then
> we have to do a two-step RGB32->I420->YUY2
conversion.
> This change adds a one-step RGB32->YUY2 color
> converter. It uses multiplies instead of lookups,
> so it may not be as efficient as it could be. But
> since it's a one-step converter, it's way more
> efficient than what we currently have. 

True for systems with FPUs. I don't see this being
used on those systems, however, I think we should
note this and re-write the converter as we have
time.

> For chroma
> subsampling, I did the simplest possible thing:
> alternated outputting U and V for each input
> RGB pixel.

Did you test the output quality of your version
versus the two-step process by capturing a few
random frames? We want to make sure that it is
still good because of how it is going to be used.


The code itself looks good.

--greg.


> 
> Also, I added a test harness in
video/colconverter/test
> which reads each raw RGB32 frame and converts it
> to YUY2 and then writes all the converted frames
> out to a new file.
> 
> Files Added
> -----------------------------------------
> video/colconverter/test/Umakefil
> video/colconverter/test/win32.pcf
> video/colconverter/test/rgb32_to_yuy2.cpp
> 
> Files Modified
> -----------------------------------------
> video/colconverter/hxcolor.cpp
> video/colconverter/rgb2yuv.c
> video/colconverter/pub/colorlib.h
> 
> Testing
> -----------------------------------------
> I produced a raw RGB32 file using dtdrive and
> binwrtr and then converted this raw RGB32 file
> to YUY2 and viewed it using PYUV (a third-party
> raw viewing tool for Windows and Linux found at:
> http://dsplab.diei.unipg.it/pyuv_raw_video_sequence_pl
ayer).
> 
> 
> Index: colconverter/hxcolor.cpp
>
============================================================
=======
> RCS file: /cvsroot/video/colconverter/hxcolor.cpp,v
> retrieving revision 1.8
> diff -u -w -u -w -r1.8 hxcolor.cpp
> --- colconverter/hxcolor.cpp    11 Mar 2005 19:58:04
-0000      1.8
> +++ colconverter/hxcolor.cpp    8 May 2007 15:55:55
-0000
>  -239,6 +239,7 
>  #endif
>                                  {CID_ARGB32, 
RGB32toRGB32},
>                                  {CID_YUVA,   
ARGBtoYUVA},
> +                                {CID_YUY2,   
RGB32toYUY2},
>                                  {CID_UNKNOWN, 0} };
> 
>  static CCLINK pcclARGB32  [] = { {CID_I420,   
RGB32toI420},
>  -253,6 +254,7 
>                                   {CID_BGR32,  
RGB32toBGR32},
>                                   {CID_RGB32,  
RGB32toRGB32},
>                                   {CID_YUVA,   
ARGBtoYUVA},
> +                                 {CID_YUY2,   
RGB32toYUY2},
>                                   {CID_UNKNOWN, 0} };
> 
>  static CCLINK pcclYUVA  [] = { {CID_UNKNOWN, 0} };
> Index: colconverter/rgb2yuv.c
>
============================================================
=======
> RCS file: /cvsroot/video/colconverter/rgb2yuv.c,v
> retrieving revision 1.4
> diff -u -w -u -w -r1.4 rgb2yuv.c
> --- colconverter/rgb2yuv.c      29 Dec 2004 02:07:37
-0000      1.4
> +++ colconverter/rgb2yuv.c      8 May 2007 15:55:55
-0000
>  -1104,4 +1104,106 
>      return 0;
>  }
> 
>
+//////////////////////////////////////////////////////
> +//
> +//     RGB32toYUY2
> +//
>
+//////////////////////////////////////////////////////
> +
> +int RGB32toYUY2 (unsigned char* dest_ptr,
> +                 int            dest_width,
> +                 int            dest_height,
> +                 int            dest_pitch,
> +                 int            dest_x,
> +                 int            dest_y,
> +                 int            dest_dx,
> +                 int            dest_dy,
> +                 unsigned char* src_ptr,
> +                 int            src_width,
> +                 int            src_height,
> +                 int            src_pitch,
> +                 int            src_x,
> +                 int            src_y,
> +                 int            src_dx,
> +                 int            src_dy)
> +{
> +    /* scale factors: */
> +    int            scale_x = 0;
> +    int            scale_y = 0;
> +    int            x       = 0;
> +    int            y       = 0;
> +    unsigned char* pSrc    = NULL;
> +    unsigned char* pDst    = NULL;
> +    int            iR      = 0;
> +    int            iG      = 0;
> +    int            iB      = 0;
> +    int            iY      = 0;
> +    int            iU      = 0;
> +    int            iV      = 0;
> +
> +    /* check arguments: */
> +    if (!chk_args (dest_ptr, dest_width, dest_height,
dest_pitch,
> +                   dest_x, dest_y, dest_dx, dest_dy,
src_ptr, src_width,
> src_height,
> +                   src_pitch, src_x, src_y, src_dx,
src_dy, &scale_x,
> &scale_y))
> +    {
> +        return -1;
> +    }
> +
> +    /* Only support 1:1 scale */
> +    if (scale_x != 1 || scale_y != 1)
> +    {
> +        return -1;
> +    }
> +
> +    /* check if bottom-up bitmaps: */
> +    if (src_pitch  <= 0)
> +    {
> +        return -1; /* not supported */
> +    }
> +    if (dest_pitch <= 0)
> +    {
> +        return -1; /* not supported */
> +    }
> +
> +    /* Run through each row */
> +    for (y = 0; y < src_dy; y++)
> +    {
> +        /* Get the src and dst row pointers */
> +        pSrc = src_ptr  + (src_y + y)  * src_pitch  +
src_x * 4;
> +        pDst = dest_ptr + (dest_y + y) * dest_pitch +
dest_x * 2;
> +        /* Loop along each row */
> +        for (x = 0; x < src_dx; x++)
> +        {
> +            /* Convert RGB to YUV, using the following
fixed-point formula:
> +             *
> +             * Y = (r *  2104 + g *  4130 + b *  802 +
4096 +  131072) >>
> 13
> +             * U = (r * -1214 + g * -2384 + b * 3598 +
4096 + 1048576) >>
> 13
> +             * V = (r *  3598 + g * -3013 + b * -585 +
4096 + 1048576) >>
> 13
> +             */
> +#if defined(_WINDOWS)
> +            iR = pSrc[2];
> +            iG = pSrc[1];
> +            iB = pSrc[0];
> +#else
> +            iR = pSrc[0];
> +            iG = pSrc[1];
> +            iB = pSrc[2];
> +#endif
> +            iY = (iR *  2104 + iG * 4130 + iB *  802 +
4096 +  131072) >>
> 13;
> +            iU = (iR * -1214 - iG * 2384 + iB * 3598 +
4096 + 1048576) >>
> 13;
> +            iV = (iR *  3598 - iG * 3013 - iB *  585 +
4096 + 1048576) >>
> 13;
> +            /* Write out the Y */
> +            pDst[0] = (unsigned char) iY;
> +            /* If we are even, write out U. If odd,
write V */
> +            pDst[1] = (unsigned char) ((x & 1) ?
iV : iU);
> +            /* Advance the src pointer */
> +            pSrc += 4;
> +            /* Advance the dst pointer */
> +            pDst += 2;
> +        }
> +    }
> +
> +    return 0;
> +}
> +
>  /* rgb2yuv.c -- end of file */
> Index: colconverter/pub/colorlib.h
>
============================================================
=======
> RCS file: /cvsroot/video/colconverter/pub/colorlib.h,v
> retrieving revision 1.5
> diff -u -w -u -w -r1.5 colorlib.h
> --- colconverter/pub/colorlib.h 29 Dec 2004 02:08:59
-0000      1.5
> +++ colconverter/pub/colorlib.h 8 May 2007 15:55:55
-0000
>  -276,6 +276,7 
>  int RGB555toI420  (unsigned char *, int, int, int,
int, int, int, int,
> unsigned char *, int, int, int, int, int, int, int);
>  int RGB8toI420    (unsigned char *, int, int, int,
int, int, int, int,
> unsigned char *, int, int, int, int, int, int, int);
>  int ARGBtoYUVA    (unsigned char *, int, int, int,
int, int, int, int,
> unsigned char *, int, int, int, int, int, int, int);
> +int RGB32toYUY2   (unsigned char *, int, int, int,
int, int, int, int,
> unsigned char *, int, int, int, int, int, int, int);
>  int BGR_32toI420  (unsigned char *, int, int, int,
int, int, int, int,
> unsigned char *, int, int, int, int, int, int, int);
>  int BGR24toI420   (unsigned char *, int, int, int,
int, int, int, int,
> unsigned char *, int, int, int, int, int, int, int);
> 
> =============================================
> Eric Hyche (ehychereal.com)
> Technical Lead
> RealNetworks, Inc. 
> 
> 
>
------------------------------------------------------------
------------
> 
> _______________________________________________
> Video-dev mailing list
> Video-devhelixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/video
-dev


_______________________________________________
Video-dev mailing list
Video-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/video
-dev

RE: CR-Client: add RGB32->YUY2 color converter plus test harness
country flaguser name
United States
2007-05-08 13:13:34

> -----Original Message-----
> From: Greg Wright [mailto:gwrightreal.com] 
> Sent: Tuesday, May 08, 2007 1:28 PM
> To: ehychereal.com
> Cc: video-devlists.helixcommunity.org
> Subject: Re: [Video-dev] CR-Client: add RGB32->YUY2
color 
> converter plus test harness
> 
> Eric Hyche wrote:
> > Description
> > ---------------------------------------
> > Currently, we do not have a one-step
RGB32->YUY2
> > color converter in our color conversion library,
> > and if RGB32->YUY2 color conversion is needed,
then
> > we have to do a two-step RGB32->I420->YUY2
conversion.
> > This change adds a one-step RGB32->YUY2 color
> > converter. It uses multiplies instead of lookups,
> > so it may not be as efficient as it could be. But
> > since it's a one-step converter, it's way more
> > efficient than what we currently have. 
> 
> True for systems with FPUs. I don't see this being
> used on those systems, however, I think we should
> note this and re-write the converter as we have
> time.
> 

Well, the actual RGB->YUV computation is fixed-point,
so it should work pretty well regardless of whether
an FPU is present or not.

> > For chroma
> > subsampling, I did the simplest possible thing:
> > alternated outputting U and V for each input
> > RGB pixel.
> 
> Did you test the output quality of your version
> versus the two-step process by capturing a few
> random frames? We want to make sure that it is
> still good because of how it is going to be used.
> 

I dumped out frame 484 and frame 860 from both the
RGB32 and YUY2 raw files, and have attached them
to this email. As you can see, there's no *obvious*
color problems.

Eric

> 
> The code itself looks good.
> 
> --greg.
> 
> 
> > 
> > Also, I added a test harness in
video/colconverter/test
> > which reads each raw RGB32 frame and converts it
> > to YUY2 and then writes all the converted frames
> > out to a new file.
> > 
> > Files Added
> > -----------------------------------------
> > video/colconverter/test/Umakefil
> > video/colconverter/test/win32.pcf
> > video/colconverter/test/rgb32_to_yuy2.cpp
> > 
> > Files Modified
> > -----------------------------------------
> > video/colconverter/hxcolor.cpp
> > video/colconverter/rgb2yuv.c
> > video/colconverter/pub/colorlib.h
> > 
> > Testing
> > -----------------------------------------
> > I produced a raw RGB32 file using dtdrive and
> > binwrtr and then converted this raw RGB32 file
> > to YUY2 and viewed it using PYUV (a third-party
> > raw viewing tool for Windows and Linux found at:
> > http://dsplab.diei.unipg.it/pyuv_raw_video_sequence_pl
ayer).
> > 
> > 
> > Index: colconverter/hxcolor.cpp
> >
============================================================
=======
> > RCS file:
/cvsroot/video/colconverter/hxcolor.cpp,v
> > retrieving revision 1.8
> > diff -u -w -u -w -r1.8 hxcolor.cpp
> > --- colconverter/hxcolor.cpp    11 Mar 2005
19:58:04 -0000      1.8
> > +++ colconverter/hxcolor.cpp    8 May 2007
15:55:55 -0000
> >  -239,6 +239,7 
> >  #endif
> >                                  {CID_ARGB32, 
RGB32toRGB32},
> >                                  {CID_YUVA,   
ARGBtoYUVA},
> > +                                {CID_YUY2,   
RGB32toYUY2},
> >                                  {CID_UNKNOWN, 0}
};
> > 
> >  static CCLINK pcclARGB32  [] = { {CID_I420,   
RGB32toI420},
> >  -253,6 +254,7 
> >                                   {CID_BGR32,  
RGB32toBGR32},
> >                                   {CID_RGB32,  
RGB32toRGB32},
> >                                   {CID_YUVA,   
ARGBtoYUVA},
> > +                                 {CID_YUY2,   
RGB32toYUY2},
> >                                   {CID_UNKNOWN, 0}
};
> > 
> >  static CCLINK pcclYUVA  [] = { {CID_UNKNOWN, 0}
};
> > Index: colconverter/rgb2yuv.c
> >
============================================================
=======
> > RCS file: /cvsroot/video/colconverter/rgb2yuv.c,v
> > retrieving revision 1.4
> > diff -u -w -u -w -r1.4 rgb2yuv.c
> > --- colconverter/rgb2yuv.c      29 Dec 2004
02:07:37 -0000      1.4
> > +++ colconverter/rgb2yuv.c      8 May 2007
15:55:55 -0000
> >  -1104,4 +1104,106 
> >      return 0;
> >  }
> > 
> >
+//////////////////////////////////////////////////////
> > +//
> > +//     RGB32toYUY2
> > +//
> >
+//////////////////////////////////////////////////////
> > +
> > +int RGB32toYUY2 (unsigned char* dest_ptr,
> > +                 int            dest_width,
> > +                 int            dest_height,
> > +                 int            dest_pitch,
> > +                 int            dest_x,
> > +                 int            dest_y,
> > +                 int            dest_dx,
> > +                 int            dest_dy,
> > +                 unsigned char* src_ptr,
> > +                 int            src_width,
> > +                 int            src_height,
> > +                 int            src_pitch,
> > +                 int            src_x,
> > +                 int            src_y,
> > +                 int            src_dx,
> > +                 int            src_dy)
> > +{
> > +    /* scale factors: */
> > +    int            scale_x = 0;
> > +    int            scale_y = 0;
> > +    int            x       = 0;
> > +    int            y       = 0;
> > +    unsigned char* pSrc    = NULL;
> > +    unsigned char* pDst    = NULL;
> > +    int            iR      = 0;
> > +    int            iG      = 0;
> > +    int            iB      = 0;
> > +    int            iY      = 0;
> > +    int            iU      = 0;
> > +    int            iV      = 0;
> > +
> > +    /* check arguments: */
> > +    if (!chk_args (dest_ptr, dest_width,
dest_height, dest_pitch,
> > +                   dest_x, dest_y, dest_dx,
dest_dy, 
> src_ptr, src_width,
> > src_height,
> > +                   src_pitch, src_x, src_y,
src_dx, 
> src_dy, &scale_x,
> > &scale_y))
> > +    {
> > +        return -1;
> > +    }
> > +
> > +    /* Only support 1:1 scale */
> > +    if (scale_x != 1 || scale_y != 1)
> > +    {
> > +        return -1;
> > +    }
> > +
> > +    /* check if bottom-up bitmaps: */
> > +    if (src_pitch  <= 0)
> > +    {
> > +        return -1; /* not supported */
> > +    }
> > +    if (dest_pitch <= 0)
> > +    {
> > +        return -1; /* not supported */
> > +    }
> > +
> > +    /* Run through each row */
> > +    for (y = 0; y < src_dy; y++)
> > +    {
> > +        /* Get the src and dst row pointers */
> > +        pSrc = src_ptr  + (src_y + y)  *
src_pitch  + src_x * 4;
> > +        pDst = dest_ptr + (dest_y + y) *
dest_pitch + dest_x * 2;
> > +        /* Loop along each row */
> > +        for (x = 0; x < src_dx; x++)
> > +        {
> > +            /* Convert RGB to YUV, using the
following 
> fixed-point formula:
> > +             *
> > +             * Y = (r *  2104 + g *  4130 + b * 
802 + 
> 4096 +  131072) >>
> > 13
> > +             * U = (r * -1214 + g * -2384 + b *
3598 + 
> 4096 + 1048576) >>
> > 13
> > +             * V = (r *  3598 + g * -3013 + b *
-585 + 
> 4096 + 1048576) >>
> > 13
> > +             */
> > +#if defined(_WINDOWS)
> > +            iR = pSrc[2];
> > +            iG = pSrc[1];
> > +            iB = pSrc[0];
> > +#else
> > +            iR = pSrc[0];
> > +            iG = pSrc[1];
> > +            iB = pSrc[2];
> > +#endif
> > +            iY = (iR *  2104 + iG * 4130 + iB * 
802 + 
> 4096 +  131072) >>
> > 13;
> > +            iU = (iR * -1214 - iG * 2384 + iB *
3598 + 
> 4096 + 1048576) >>
> > 13;
> > +            iV = (iR *  3598 - iG * 3013 - iB * 
585 + 
> 4096 + 1048576) >>
> > 13;
> > +            /* Write out the Y */
> > +            pDst[0] = (unsigned char) iY;
> > +            /* If we are even, write out U. If
odd, write V */
> > +            pDst[1] = (unsigned char) ((x &
1) ? iV : iU);
> > +            /* Advance the src pointer */
> > +            pSrc += 4;
> > +            /* Advance the dst pointer */
> > +            pDst += 2;
> > +        }
> > +    }
> > +
> > +    return 0;
> > +}
> > +
> >  /* rgb2yuv.c -- end of file */
> > Index: colconverter/pub/colorlib.h
> >
============================================================
=======
> > RCS file:
/cvsroot/video/colconverter/pub/colorlib.h,v
> > retrieving revision 1.5
> > diff -u -w -u -w -r1.5 colorlib.h
> > --- colconverter/pub/colorlib.h 29 Dec 2004
02:08:59 -0000      1.5
> > +++ colconverter/pub/colorlib.h 8 May 2007
15:55:55 -0000
> >  -276,6 +276,7 
> >  int RGB555toI420  (unsigned char *, int, int,
int, int, 
> int, int, int,
> > unsigned char *, int, int, int, int, int, int,
int);
> >  int RGB8toI420    (unsigned char *, int, int,
int, int, 
> int, int, int,
> > unsigned char *, int, int, int, int, int, int,
int);
> >  int ARGBtoYUVA    (unsigned char *, int, int,
int, int, 
> int, int, int,
> > unsigned char *, int, int, int, int, int, int,
int);
> > +int RGB32toYUY2   (unsigned char *, int, int,
int, int, 
> int, int, int,
> > unsigned char *, int, int, int, int, int, int,
int);
> >  int BGR_32toI420  (unsigned char *, int, int,
int, int, 
> int, int, int,
> > unsigned char *, int, int, int, int, int, int,
int);
> >  int BGR24toI420   (unsigned char *, int, int,
int, int, 
> int, int, int,
> > unsigned char *, int, int, int, int, int, int,
int);
> > 
> > =============================================
> > Eric Hyche (ehychereal.com)
> > Technical Lead
> > RealNetworks, Inc. 
> > 
> > 
> > 
>
------------------------------------------------------------
--
> ----------
> > 
> > _______________________________________________
> > Video-dev mailing list
> > Video-devhelixcommunity.org
> > http://lists.helixcommunity.org/mailman/listinfo/video
-dev
> 

_______________________________________________
Video-dev mailing list
Video-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/video
-dev

View Original Image
View Original Image
View Original Image
View Original Image
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )