• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * stv0680.c
3  *
4  * Copyright (c) 2009 Hans de Goede <hdegoede@redhat.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
19  */
20 
21 #include "libv4lconvert-priv.h"
22 
23 /* The stv0640 first sends all the red/green pixels for a line (so 1/2 width)
24    and then all the green/blue pixels in that line, shuffle this to a regular
25    RGGB bayer pattern. */
v4lconvert_decode_stv0680(const unsigned char * src,unsigned char * dst,int width,int height)26 void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
27 		int width, int height)
28 {
29 	int x, y;
30 	const unsigned char *src1 = src;
31 	const unsigned char *src2 = src + width / 2;
32 
33 	for (y = 0; y < height; y++) {
34 		for (x = 0; x < width / 2; x++) {
35 			*dst++ = *src1++;
36 			*dst++ = *src2++;
37 		}
38 		src1 += width / 2;
39 		src2 += width / 2;
40 	}
41 }
42