summaryrefslogtreecommitdiff
path: root/inc/mjpeg/colorspaces.h (plain)
blob: 347956837aebcd2623c37f9293cad5bc0222a0fd
1/*******************************************************************************#
2# guvcview http://guvcview.sourceforge.net #
3# #
4# Paulo Assis <pj.assis@gmail.com> #
5# #
6# This program is free software; you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation; either version 2 of the License, or #
9# (at your option) any later version. #
10# #
11# This program is distributed in the hope that it will be useful, #
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with this program; if not, write to the Free Software #
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19# #
20********************************************************************************/
21
22#ifndef COLORSPACES_H
23#define COLORSPACES_H
24
25#include "defs.h"
26#include "jutils.h"
27
28/*convert yuv 420 planar (yu12) to yuv 422
29* args:
30* framebuffer: pointer to frame buffer (yuyv)
31* tmpbuffer: pointer to temp buffer containing yuv420 planar data frame
32* width: picture width
33* height: picture height
34*/
35void
36yuv420_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
37
38/*convert yvu 420 planar (yv12) to yuv 422 (yuyv)
39* args:
40* framebuffer: pointer to frame buffer (yuyv)
41* tmpbuffer: pointer to temp buffer containing yvu420 planar data frame
42* width: picture width
43* height: picture height
44*/
45void yvu420_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
46
47/*convert yuv 420 planar (uv interleaved) (nv12) to yuv 422
48* args:
49* framebuffer: pointer to frame buffer (yuyv)
50* tmpbuffer: pointer to temp buffer containing yuv420 (nv12) planar data frame
51* width: picture width
52* height: picture height
53*/
54void nv12_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
55
56/*convert yuv 420 planar (vu interleaved) (nv21) to yuv 422
57* args:
58* framebuffer: pointer to frame buffer (yuyv)
59* tmpbuffer: pointer to temp buffer containing yuv420 (nv21) planar data frame
60* width: picture width
61* height: picture height
62*/
63void nv21_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
64
65/*convert yuv 422 planar (uv interleaved) (nv16) to yuv 422
66* args:
67* framebuffer: pointer to frame buffer (yuyv)
68* tmpbuffer: pointer to temp buffer containing yuv422 (nv16) planar data frame
69* width: picture width
70* height: picture height
71*/
72void nv16_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
73
74/*convert yuv 422 planar (vu interleaved) (nv61) to yuv 422
75* args:
76* framebuffer: pointer to frame buffer (yuyv)
77* tmpbuffer: pointer to temp buffer containing yuv422 (nv61) planar data frame
78* width: picture width
79* height: picture height
80*/
81void nv61_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
82
83/*convert y10b (bit-packed array greyscale format) to yuyv (packed)
84* args:
85* framebuffer: pointer to frame buffer (yuyv)
86* tmpbuffer: pointer to temp buffer containing y10b (bit-packed array) data frame
87* width: picture width
88* height: picture height
89*/
90void y10b_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
91
92/*convert y16 (grey) to yuyv (packed)
93* args:
94* framebuffer: pointer to frame buffer (yuyv)
95* tmpbuffer: pointer to temp buffer containing y16 (grey) data frame
96* width: picture width
97* height: picture height
98*/
99void y16_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
100
101/*convert yyuv to yuyv
102* args:
103* framebuffer: pointer to frame buffer (yuyv)
104* tmpbuffer: pointer to temp buffer containing a yyuv data frame
105* width: picture width
106* height: picture height
107*/
108void
109yyuv_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
110
111/*convert uyvy (packed) to yuyv (packed)
112* args:
113* framebuffer: pointer to frame buffer (yuyv)
114* tmpbuffer: pointer to temp buffer containing uyvy packed data frame
115* width: picture width
116* height: picture height
117*/
118void uyvy_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
119
120/*convert yvyu (packed) to yuyv (packed)
121* args:
122* framebuffer: pointer to frame buffer (yuyv)
123* tmpbuffer: pointer to temp buffer containing yvyu packed data frame
124* width: picture width
125* height: picture height
126*/
127void yvyu_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
128
129/*convert yuv 411 packed (y41p) to yuv 422
130* args:
131* framebuffer: pointer to frame buffer (yuyv)
132* tmpbuffer: pointer to temp buffer containing y41p data frame
133* width: picture width
134* height: picture height
135*/
136void y41p_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
137
138/*convert yuv mono (grey) to yuv 422
139* args:
140* framebuffer: pointer to frame buffer (yuyv)
141* tmpbuffer: pointer to temp buffer containing grey (y only) data frame
142* width: picture width
143* height: picture height
144*/
145void grey_to_yuyv (BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
146
147/*convert SPCA501 (s501) to yuv 422
148* s501 |Y0..width..Y0|U..width/2..U|Y1..width..Y1|V..width/2..V|
149* signed values (-128;+127) must be converted to unsigned (0; 255)
150* args:
151* framebuffer: pointer to frame buffer (yuyv)
152* tmpbuffer: pointer to temp buffer containing s501 data frame
153* width: picture width
154* height: picture height
155*/
156void s501_to_yuyv(BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
157
158/*convert SPCA505 (s505) to yuv 422
159* s505 |Y0..width..Y0|Y1..width..Y1|U..width/2..U|V..width/2..V|
160* signed values (-128;+127) must be converted to unsigned (0; 255)
161* args:
162* framebuffer: pointer to frame buffer (yuyv)
163* tmpbuffer: pointer to temp buffer containing s501 data frame
164* width: picture width
165* height: picture height
166*/
167void s505_to_yuyv(BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
168
169/*convert SPCA508 (s508) to yuv 422
170* s508 |Y0..width..Y0|U..width/2..U|V..width/2..V|Y1..width..Y1|
171* signed values (-128;+127) must be converted to unsigned (0; 255)
172* args:
173* framebuffer: pointer to frame buffer (yuyv)
174* tmpbuffer: pointer to temp buffer containing s501 data frame
175* width: picture width
176* height: picture height
177*/
178void s508_to_yuyv(BYTE *framebuffer, BYTE *tmpbuffer, int width, int height);
179
180/*convert yuyv to rgb24
181* args:
182* pyuv: pointer to buffer containing yuv data (yuyv)
183* prgb: pointer to buffer containing rgb24 data
184* width: picture width
185* height: picture height
186*/
187void
188yuyv2rgb (BYTE *pyuv, BYTE *prgb, int width, int height);
189
190
191/*convert yuyv to bgr with lines upsidedown
192* used for bitmap files (DIB24)
193* args:
194* pyuv: pointer to buffer containing yuv data (yuyv)
195* prgb: pointer to buffer containing rgb24 data
196* width: picture width
197* height: picture height
198*/
199void
200yuyv2bgr (BYTE *pyuv, BYTE *pbgr, int width, int height);
201
202/* used for rgb video (fourcc="RGB ")
203* lines are in correct order
204*/
205void
206yuyv2bgr1 (BYTE *pyuv, BYTE *pbgr, int width, int height);
207
208/*convert bayer raw data to rgb24
209* args:
210* pBay: pointer to buffer containing Raw bayer data data
211* pRGB24: pointer to buffer containing rgb24 data
212* width: picture width
213* height: picture height
214* pix_order: bayer pixel order (0=gb/rg 1=gr/bg 2=bg/gr 3=rg/bg)
215*/
216void
217bayer_to_rgb24(BYTE *pBay, BYTE *pRGB24, int width, int height, int pix_order);
218
219/*convert rgb24 to yuyv
220* args:
221* prgb: pointer to buffer containing rgb24 data
222* pyuv: pointer to buffer containing yuv data (yuyv)
223* width: picture width
224* height: picture height
225*/
226void
227rgb2yuyv(BYTE *prgb, BYTE *pyuv, int width, int height);
228
229/*convert bgr24 to yuyv
230* args:
231* pbgr: pointer to buffer containing bgr24 data
232* pyuv: pointer to buffer containing yuv data (yuyv)
233* width: picture width
234* height: picture height
235*/
236void
237bgr2yuyv(BYTE *pbgr, BYTE *pyuv, int width, int height);
238
239/*use in utils.c for jpeg decoding 420 planar to 422
240* args:
241* out: pointer to data output of idct (macroblocks yyyy u v)
242* pic: pointer to picture buffer (yuyv)
243* width: picture width
244*/
245void
246yuv420pto422(int * out,unsigned char *pic,int width);
247
248/*use in utils.c for jpeg decoding 422 planar to 422
249* args:
250* out: pointer to data output of idct (macroblocks yyyy u v)
251* pic: pointer to picture buffer (yuyv)
252* width: picture width
253*/
254void
255yuv422pto422(int * out,unsigned char *pic,int width);
256
257void
258yuv420pto420sp(int * out,addr *pic,int width);
259
260void
261yuv420pto420p(int * out,addr *pic,int width);
262
263void
264yuv422pto420sp(int * out, addr *pic,int width);
265
266void
267yuv422pto420p(int * out, addr *pic,int width);
268
269/*use in utils.c for jpeg decoding 444 planar to 422
270* args:
271* out: pointer to data output of idct (macroblocks yyyy u v)
272* pic: pointer to picture buffer (yuyv)
273* width: picture width
274*/
275void
276yuv444pto422(int * out,unsigned char *pic,int width);
277
278/*use in utils.c for jpeg decoding 400 planar to 422
279* args:
280* out: pointer to data output of idct (macroblocks yyyy )
281* pic: pointer to picture buffer (yuyv)
282* width: picture width
283*/
284void
285yuv400pto422(int * out,unsigned char *pic,int width);
286
287#endif
288
289