yuv.h
Go to the documentation of this file.
1 /* -*- mode: C++ -*- */
2 /* $Id: yuv.h 35110 2011-01-05 00:31:58Z joq $ */
3 /*
4  * Copyright (C) 2000-2004 Damien Douxchamps <ddouxchamps@users.sf.net>
5  * Dan Dennedy <dan@dennedy.org>
6  *
7  * NOTE: On 4 Jan. 2011, this file was re-licensed under the GNU LGPL
8  * with permission of the original GPL authors: Damien Douxchamps and
9  * Dan Dennedy.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  * 02111-1307, USA.
25  */
26 
27 /* Copyright (C) 2010 Jack O'Quin
28  *
29  * Minor changes for use with the ROS camera1394 driver:
30  *
31  * * generate RGB rather than BGR
32  * * repackage as a separate file
33  * * use yuv namespace
34  */
35 
36 #ifndef _YUV_H_
37 #define _YUV_H_
38 
39 #include <dc1394/dc1394.h>
40 
46 namespace yuv
47 {
48 
50  void inline uyv2rgb(const unsigned char *src, unsigned char *dest,
51  unsigned long long int NumPixels)
52  {
53  register int i = NumPixels + (NumPixels << 1) - 1;
54  register int j = NumPixels + (NumPixels << 1) - 1;
55  register int y, u, v;
56  register int r, g, b;
57 
58  while (i > 0) {
59  v = src[i--] - 128;
60  y = src[i--];
61  u = src[i--] - 128;
62  YUV2RGB(y, u, v, r, g, b);
63  dest[j--] = b;
64  dest[j--] = g;
65  dest[j--] = r;
66  }
67  }
68 
70  void inline uyvy2rgb(unsigned char *src, unsigned char *dest,
71  unsigned long long int NumPixels)
72  {
73  register int i = (NumPixels << 1)-1;
74  register int j = NumPixels + ( NumPixels << 1 ) -1;
75  register int y0, y1, u, v;
76  register int r, g, b;
77 
78  while (i > 0)
79  {
80  y1 = (unsigned char) src[i--];
81  v = (unsigned char) src[i--] - 128;
82  y0 = (unsigned char) src[i--];
83  u = (unsigned char) src[i--] - 128;
84  YUV2RGB (y1, u, v, r, g, b);
85  dest[j--] = b;
86  dest[j--] = g;
87  dest[j--] = r;
88  YUV2RGB (y0, u, v, r, g, b);
89  dest[j--] = b;
90  dest[j--] = g;
91  dest[j--] = r;
92  }
93  }
94 
96  void inline uyyvyy2rgb(const unsigned char *src, unsigned char *dest,
97  unsigned long long int NumPixels)
98  {
99  register int i = NumPixels + (NumPixels >> 1) - 1;
100  register int j = NumPixels + (NumPixels << 1) - 1;
101  register int y0, y1, y2, y3, u, v;
102  register int r, g, b;
103 
104  while (i > 0) {
105  y3 = src[i--];
106  y2 = src[i--];
107  v = src[i--] - 128;
108  y1 = src[i--];
109  y0 = src[i--];
110  u = src[i--] - 128;
111  YUV2RGB(y3, u, v, r, g, b);
112  dest[j--] = b;
113  dest[j--] = g;
114  dest[j--] = r;
115  YUV2RGB(y2, u, v, r, g, b);
116  dest[j--] = b;
117  dest[j--] = g;
118  dest[j--] = r;
119  YUV2RGB(y1, u, v, r, g, b);
120  dest[j--] = b;
121  dest[j--] = g;
122  dest[j--] = r;
123  YUV2RGB(y0, u, v, r, g, b);
124  dest[j--] = b;
125  dest[j--] = g;
126  dest[j--] = r;
127  }
128  }
129 }
130 
131 #endif // _YUV_H_
TFSIMD_FORCE_INLINE const tfScalar & y() const
void uyvy2rgb(unsigned char *src, unsigned char *dest, unsigned long long int NumPixels)
Definition: yuv.h:70
void uyyvyy2rgb(const unsigned char *src, unsigned char *dest, unsigned long long int NumPixels)
Definition: yuv.h:96
Definition: yuv.h:46
void uyv2rgb(const unsigned char *src, unsigned char *dest, unsigned long long int NumPixels)
Definition: yuv.h:50


camera1394stereo
Author(s): Joan Pau Beltran
autogenerated on Mon Jun 10 2019 12:52:45