~ubuntu-branches/ubuntu/precise/v4l-utils/precise

« back to all changes in this revision

Viewing changes to lib/libv4lconvert/stv0680.c

  • Committer: Bazaar Package Importer
  • Author(s): Gregor Jasny
  • Date: 2010-02-28 19:44:15 UTC
  • Revision ID: james.westby@ubuntu.com-20100228194415-067hdj8rvawj91zw
Tags: upstream-0.7.90
ImportĀ upstreamĀ versionĀ 0.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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. */
 
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
}