File: stv0680.c

package info (click to toggle)
v4l-utils 1.32.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,276 kB
  • sloc: ansic: 85,528; cpp: 69,473; perl: 11,915; sh: 1,333; python: 883; php: 119; makefile: 39
file content (41 lines) | stat: -rw-r--r-- 1,396 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * stv0680.c
 *
 * Copyright (c) 2009 Hans de Goede <hdegoede@redhat.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
 */

#include "libv4lconvert-priv.h"

/* The stv0640 first sends all the red/green pixels for a line (so 1/2 width)
   and then all the green/blue pixels in that line, shuffle this to a regular
   RGGB bayer pattern. */
void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
		int width, int height)
{
	int x, y;
	const unsigned char *src1 = src;
	const unsigned char *src2 = src + width / 2;

	for (y = 0; y < height; y++) {
		for (x = 0; x < width / 2; x++) {
			*dst++ = *src1++;
			*dst++ = *src2++;
		}
		src1 += width / 2;
		src2 += width / 2;
	}
}