00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _YUV_H_
00037 #define _YUV_H_
00038
00039 #include <dc1394/dc1394.h>
00040
00046 namespace yuv
00047 {
00048
00050 void inline uyv2rgb(const unsigned char *src, unsigned char *dest,
00051 unsigned long long int NumPixels)
00052 {
00053 register int i = NumPixels + (NumPixels << 1) - 1;
00054 register int j = NumPixels + (NumPixels << 1) - 1;
00055 register int y, u, v;
00056 register int r, g, b;
00057
00058 while (i > 0) {
00059 v = src[i--] - 128;
00060 y = src[i--];
00061 u = src[i--] - 128;
00062 YUV2RGB(y, u, v, r, g, b);
00063 dest[j--] = b;
00064 dest[j--] = g;
00065 dest[j--] = r;
00066 }
00067 }
00068
00070 void inline uyvy2rgb(unsigned char *src, unsigned char *dest,
00071 unsigned long long int NumPixels)
00072 {
00073 register int i = (NumPixels << 1)-1;
00074 register int j = NumPixels + ( NumPixels << 1 ) -1;
00075 register int y0, y1, u, v;
00076 register int r, g, b;
00077
00078 while (i > 0)
00079 {
00080 y1 = (unsigned char) src[i--];
00081 v = (unsigned char) src[i--] - 128;
00082 y0 = (unsigned char) src[i--];
00083 u = (unsigned char) src[i--] - 128;
00084 YUV2RGB (y1, u, v, r, g, b);
00085 dest[j--] = b;
00086 dest[j--] = g;
00087 dest[j--] = r;
00088 YUV2RGB (y0, u, v, r, g, b);
00089 dest[j--] = b;
00090 dest[j--] = g;
00091 dest[j--] = r;
00092 }
00093 }
00094
00096 void inline uyyvyy2rgb(const unsigned char *src, unsigned char *dest,
00097 unsigned long long int NumPixels)
00098 {
00099 register int i = NumPixels + (NumPixels >> 1) - 1;
00100 register int j = NumPixels + (NumPixels << 1) - 1;
00101 register int y0, y1, y2, y3, u, v;
00102 register int r, g, b;
00103
00104 while (i > 0) {
00105 y3 = src[i--];
00106 y2 = src[i--];
00107 v = src[i--] - 128;
00108 y1 = src[i--];
00109 y0 = src[i--];
00110 u = src[i--] - 128;
00111 YUV2RGB(y3, u, v, r, g, b);
00112 dest[j--] = b;
00113 dest[j--] = g;
00114 dest[j--] = r;
00115 YUV2RGB(y2, u, v, r, g, b);
00116 dest[j--] = b;
00117 dest[j--] = g;
00118 dest[j--] = r;
00119 YUV2RGB(y1, u, v, r, g, b);
00120 dest[j--] = b;
00121 dest[j--] = g;
00122 dest[j--] = r;
00123 YUV2RGB(y0, u, v, r, g, b);
00124 dest[j--] = b;
00125 dest[j--] = g;
00126 dest[j--] = r;
00127 }
00128 }
00129 }
00130
00131 #endif // _YUV_H_