libdc1394 2.2.1 Windows binaries.
authormark <mark@2c67d6c2-4361-4cd7-bd83-1149b1926c9b>
Fri, 7 Mar 2014 02:45:06 +0000 (02:45 +0000)
committermark <mark@2c67d6c2-4361-4cd7-bd83-1149b1926c9b>
Fri, 7 Mar 2014 02:45:06 +0000 (02:45 +0000)
See readme.txt file for details.

git-svn-id: https://valelab.ucsf.edu/svn/3rdpartypublic@158 2c67d6c2-4361-4cd7-bd83-1149b1926c9b

81 files changed:
libdc1394/libdc1394-2.2.1-bin/COPYING.MinGW-w64-runtime.txt [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/COPYING.libdc1394.txt [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.def [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.dll [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.exp [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.lib [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/bayer.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/camera.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/capture.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/capture.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/control.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/control.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/conversions.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/conversions.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/dc1394.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/enumeration.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/format7.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/format7.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/internal.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/internal.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/iso.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/iso.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/capture.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/control.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/firewire-cdev.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/firewire-constants.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/juju/juju.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/capture.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/capture.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/control.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/control.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/kernel-video1394.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/linux/linux.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/log.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/log.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/macosx/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/macosx/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/macosx/capture.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/macosx/capture.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/macosx/control.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/macosx/macosx.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/offsets.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/platform.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/register.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/register.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/types.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/usb/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/usb/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/usb/capture.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/usb/control.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/usb/usb.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/utils.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/utils.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/avt.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/avt.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/basler.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/basler.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/basler_sff.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/basler_sff_registry.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/basler_sff_registry.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/pixelink.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/vendor/pixelink.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/video.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/windows/Makefile.am [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/windows/Makefile.in [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/windows/capture.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/windows/control.c [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/include/dc1394/windows/platform_windows.h [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/readme.txt [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/x64/libdc1394-22.def [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/x64/libdc1394-22.dll [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/x64/libdc1394-22.exp [new file with mode: 0644]
libdc1394/libdc1394-2.2.1-bin/x64/libdc1394-22.lib [new file with mode: 0644]

diff --git a/libdc1394/libdc1394-2.2.1-bin/COPYING.MinGW-w64-runtime.txt b/libdc1394/libdc1394-2.2.1-bin/COPYING.MinGW-w64-runtime.txt
new file mode 100644 (file)
index 0000000..ca6a077
--- /dev/null
@@ -0,0 +1,240 @@
+MinGW-w64 runtime licensing
+***************************
+
+This program or library was built using MinGW-w64 and statically
+linked against the MinGW-w64 runtime. Some parts of the runtime
+are under licenses which require that the copyright and license
+notices are included when distributing the code in binary form.
+These notices are listed below.
+
+
+========================
+Overall copyright notice
+========================
+
+Copyright (c) 2009, 2010, 2011, 2012, 2013 by the mingw-w64 project
+
+This license has been certified as open source. It has also been designated
+as GPL compatible by the Free Software Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions in source code must retain the accompanying copyright
+      notice, this list of conditions, and the following disclaimer.
+   2. Redistributions in binary form must reproduce the accompanying
+      copyright notice, this list of conditions, and the following disclaimer
+      in the documentation and/or other materials provided with the
+      distribution.
+   3. Names of the copyright holders must not be used to endorse or promote
+      products derived from this software without prior written permission
+      from the copyright holders.
+   4. The right to distribute this software or to use it for any purpose does
+      not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+      the copyright holders.  Use of them is covered by separate agreement
+      with the copyright holders.
+   5. If any files are modified, you must cause the modified files to carry
+      prominent notices stating that you changed the files and the date of
+      any change.
+
+Disclaimer
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+======================================== 
+getopt, getopt_long, and getop_long_only
+======================================== 
+
+Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com> 
+Permission to use, copy, modify, and distribute this software for any 
+purpose with or without fee is hereby granted, provided that the above 
+copyright notice and this permission notice appear in all copies. 
+        
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Sponsored in part by the Defense Advanced Research Projects
+Agency (DARPA) and Air Force Research Laboratory, Air Force
+Materiel Command, USAF, under agreement number F39502-99-1-0512.
+
+        *       *       *       *       *       *       * 
+
+Copyright (c) 2000 The NetBSD Foundation, Inc.
+All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation
+by Dieter Baron and Thomas Klausner.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+
+===============================================================
+gdtoa: Converting between IEEE floating point numbers and ASCII
+===============================================================
+
+The author of this software is David M. Gay.
+
+Copyright (C) 1997, 1998, 1999, 2000, 2001 by Lucent Technologies
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the name of Lucent or any of its entities
+not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
+
+        *       *       *       *       *       *       *
+
+The author of this software is David M. Gay.
+
+Copyright (C) 2005 by David M. Gay
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that the copyright notice and this permission notice and warranty
+disclaimer appear in supporting documentation, and that the name of
+the author or any of his current or former employers not be used in
+advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN
+NO EVENT SHALL THE AUTHOR OR ANY OF HIS CURRENT OR FORMER EMPLOYERS BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+        *       *       *       *       *       *       *
+
+The author of this software is David M. Gay.
+
+Copyright (C) 2004 by David M. Gay.
+All Rights Reserved
+Based on material in the rest of /netlib/fp/gdota.tar.gz,
+which is copyright (C) 1998, 2000 by Lucent Technologies.
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the name of Lucent or any of its entities
+not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
+
+
+=========================
+Parts of the math library
+=========================
+
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+        *       *       *       *       *       *       *
+
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+        *       *       *       *       *       *       *
+
+FIXME: Cephes math lib
+Copyright (C) 1984-1998 Stephen L. Moshier
+
+It sounds vague, but as to be found at
+<http://lists.debian.org/debian-legal/2004/12/msg00295.html>, it gives an
+impression that the author could be willing to give an explicit
+permission to distribute those files e.g. under a BSD style license. So
+probably there is no problem here, although it could be good to get a
+permission from the author and then add a license into the Cephes files
+in MinGW runtime. At least on follow-up it is marked that debian sees the
+version a-like BSD one. As MinGW.org (where those cephes parts are coming
+from) distributes them now over 6 years, it should be fine.
+
+===================================
+Headers and IDLs imported from Wine
+===================================
+
+Some header and IDL files were imported from the Wine project. These files
+are prominent maked in source. Their copyright belongs to contributors and
+they are distributed under LGPL license.
+
+Disclaimer
+
+This library 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 library 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.
diff --git a/libdc1394/libdc1394-2.2.1-bin/COPYING.libdc1394.txt b/libdc1394/libdc1394-2.2.1-bin/COPYING.libdc1394.txt
new file mode 100644 (file)
index 0000000..1812127
--- /dev/null
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library 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 of the License, or (at your option) any later version.
+
+    This library 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 library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.def b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.def
new file mode 100644 (file)
index 0000000..23b296d
--- /dev/null
@@ -0,0 +1,277 @@
+EXPORTS
+dc1394_MONO16_to_MONO8
+dc1394_MONO16_to_RGB8
+dc1394_MONO16_to_YUV422
+dc1394_MONO8_to_RGB8
+dc1394_MONO8_to_YUV422
+dc1394_RGB16_to_RGB8
+dc1394_RGB16_to_YUV422
+dc1394_RGB8_to_YUV422
+dc1394_YUV411_to_RGB8
+dc1394_YUV411_to_YUV422
+dc1394_YUV422_to_RGB8
+dc1394_YUV422_to_YUV422
+dc1394_YUV444_to_RGB8
+dc1394_YUV444_to_YUV422
+dc1394_avt_get_MaxResolution
+dc1394_avt_get_advanced_feature_inquiry
+dc1394_avt_get_aoi
+dc1394_avt_get_auto_gain
+dc1394_avt_get_auto_shutter
+dc1394_avt_get_blemish
+dc1394_avt_get_channel_adjust
+dc1394_avt_get_color_corr
+dc1394_avt_get_deferred_trans
+dc1394_avt_get_dsnu
+dc1394_avt_get_extented_shutter
+dc1394_avt_get_frame_info
+dc1394_avt_get_gpdata_info
+dc1394_avt_get_hsnr
+dc1394_avt_get_io
+dc1394_avt_get_lut
+dc1394_avt_get_lut_info
+dc1394_avt_get_lut_mem_ctrl
+dc1394_avt_get_mirror
+dc1394_avt_get_multiple_slope
+dc1394_avt_get_shading
+dc1394_avt_get_shading_info
+dc1394_avt_get_shading_mem_ctrl
+dc1394_avt_get_test_images
+dc1394_avt_get_timebase
+dc1394_avt_get_trigger_delay
+dc1394_avt_get_version
+dc1394_avt_print_advanced_feature
+dc1394_avt_read_gpdata
+dc1394_avt_read_shading_img
+dc1394_avt_reset
+dc1394_avt_reset_frame_info
+dc1394_avt_set_aoi
+dc1394_avt_set_auto_gain
+dc1394_avt_set_auto_shutter
+dc1394_avt_set_blemish
+dc1394_avt_set_channel_adjust
+dc1394_avt_set_color_corr
+dc1394_avt_set_deferred_trans
+dc1394_avt_set_dsnu
+dc1394_avt_set_extented_shutter
+dc1394_avt_set_hsnr
+dc1394_avt_set_io
+dc1394_avt_set_lut
+dc1394_avt_set_lut_mem_ctrl
+dc1394_avt_set_mirror
+dc1394_avt_set_multiple_slope
+dc1394_avt_set_shading
+dc1394_avt_set_shading_mem_ctrl
+dc1394_avt_set_test_images
+dc1394_avt_set_timebase
+dc1394_avt_set_trigger_delay
+dc1394_avt_write_gpdata
+dc1394_avt_write_shading_img
+dc1394_basler_sff_check_crc
+dc1394_basler_sff_chunk_find
+dc1394_basler_sff_chunk_iterate
+dc1394_basler_sff_chunk_iterate_init
+dc1394_basler_sff_feature_enable
+dc1394_basler_sff_feature_is_available
+dc1394_basler_sff_feature_is_enabled
+dc1394_basler_sff_feature_print
+dc1394_basler_sff_feature_print_all
+dc1394_basler_sff_is_available
+dc1394_bayer_AHD
+dc1394_bayer_AHD_uint16
+dc1394_bayer_Bilinear
+dc1394_bayer_Bilinear_uint16
+dc1394_bayer_Downsample
+dc1394_bayer_Downsample_uint16
+dc1394_bayer_EdgeSense
+dc1394_bayer_EdgeSense_uint16
+dc1394_bayer_HQLinear
+dc1394_bayer_HQLinear_uint16
+dc1394_bayer_NearestNeighbor
+dc1394_bayer_NearestNeighbor_uint16
+dc1394_bayer_Simple
+dc1394_bayer_Simple_uint16
+dc1394_bayer_VNG
+dc1394_bayer_VNG_uint16
+dc1394_bayer_decoding_16bit
+dc1394_bayer_decoding_8bit
+dc1394_camera_enumerate
+dc1394_camera_free
+dc1394_camera_free_list
+dc1394_camera_get_broadcast
+dc1394_camera_get_node
+dc1394_camera_get_windows_port
+dc1394_camera_new
+dc1394_camera_new_unit
+dc1394_camera_print_info
+dc1394_camera_reset
+dc1394_camera_set_broadcast
+dc1394_camera_set_power
+dc1394_capture_dequeue
+dc1394_capture_enqueue
+dc1394_capture_get_fileno
+dc1394_capture_is_frame_corrupt
+dc1394_capture_setup
+dc1394_capture_stop
+dc1394_checksum_crc16
+dc1394_convert_frames
+dc1394_convert_to_MONO8
+dc1394_convert_to_RGB8
+dc1394_convert_to_YUV422
+dc1394_debayer_frames
+dc1394_deinterlace_stereo
+dc1394_deinterlace_stereo_frames
+dc1394_error_get_string
+dc1394_error_strings DATA
+dc1394_external_trigger_get_mode
+dc1394_external_trigger_get_polarity
+dc1394_external_trigger_get_power
+dc1394_external_trigger_get_source
+dc1394_external_trigger_get_supported_sources
+dc1394_external_trigger_has_polarity
+dc1394_external_trigger_set_mode
+dc1394_external_trigger_set_polarity
+dc1394_external_trigger_set_power
+dc1394_external_trigger_set_source
+dc1394_feature_desc DATA
+dc1394_feature_get
+dc1394_feature_get_absolute_boundaries
+dc1394_feature_get_absolute_control
+dc1394_feature_get_absolute_value
+dc1394_feature_get_all
+dc1394_feature_get_boundaries
+dc1394_feature_get_mode
+dc1394_feature_get_modes
+dc1394_feature_get_power
+dc1394_feature_get_string
+dc1394_feature_get_value
+dc1394_feature_has_absolute_control
+dc1394_feature_is_present
+dc1394_feature_is_readable
+dc1394_feature_is_switchable
+dc1394_feature_print
+dc1394_feature_print_all
+dc1394_feature_set_absolute_control
+dc1394_feature_set_absolute_value
+dc1394_feature_set_mode
+dc1394_feature_set_power
+dc1394_feature_set_value
+dc1394_feature_temperature_get_value
+dc1394_feature_temperature_set_value
+dc1394_feature_whitebalance_get_value
+dc1394_feature_whitebalance_set_value
+dc1394_feature_whiteshading_get_value
+dc1394_feature_whiteshading_set_value
+dc1394_format7_get_color_coding
+dc1394_format7_get_color_codings
+dc1394_format7_get_color_filter
+dc1394_format7_get_data_depth
+dc1394_format7_get_frame_interval
+dc1394_format7_get_image_position
+dc1394_format7_get_image_size
+dc1394_format7_get_max_image_size
+dc1394_format7_get_mode_info
+dc1394_format7_get_modeset
+dc1394_format7_get_packet_parameters
+dc1394_format7_get_packet_size
+dc1394_format7_get_packets_per_frame
+dc1394_format7_get_pixel_number
+dc1394_format7_get_recommended_packet_size
+dc1394_format7_get_roi
+dc1394_format7_get_total_bytes
+dc1394_format7_get_unit_position
+dc1394_format7_get_unit_size
+dc1394_format7_get_value_setting
+dc1394_format7_set_color_coding
+dc1394_format7_set_image_position
+dc1394_format7_set_image_size
+dc1394_format7_set_packet_size
+dc1394_format7_set_roi
+dc1394_format7_set_value_setting
+dc1394_framerate_as_float
+dc1394_free
+dc1394_get_PIO_register
+dc1394_get_SIO_register
+dc1394_get_absolute_register
+dc1394_get_adv_control_registers
+dc1394_get_color_coding_bit_size
+dc1394_get_color_coding_data_depth
+dc1394_get_color_coding_from_video_mode
+dc1394_get_control_registers
+dc1394_get_format7_register
+dc1394_get_image_size_from_video_mode
+dc1394_get_registers
+dc1394_get_strobe_register
+dc1394_is_color
+dc1394_is_same_camera
+dc1394_is_video_mode_scalable
+dc1394_is_video_mode_still_image
+dc1394_iso_allocate_bandwidth
+dc1394_iso_allocate_channel
+dc1394_iso_release_all
+dc1394_iso_release_bandwidth
+dc1394_iso_release_channel
+dc1394_iso_set_persist
+dc1394_log_debug
+dc1394_log_error
+dc1394_log_register_handler
+dc1394_log_set_default_handler
+dc1394_log_warning
+dc1394_memory_busy
+dc1394_memory_load
+dc1394_memory_save
+dc1394_new
+dc1394_pio_get
+dc1394_pio_set
+dc1394_pxl_convert_float32_to_quadlet
+dc1394_pxl_convert_uint32_to_float32
+dc1394_pxl_get_adv_feature_info
+dc1394_pxl_get_camera_info
+dc1394_pxl_get_camera_serial_number
+dc1394_pxl_get_gpio_inq
+dc1394_pxl_get_gpo_config
+dc1394_pxl_get_gpo_param
+dc1394_pxl_get_gpo_param_min_max
+dc1394_pxl_print_camera_info
+dc1394_pxl_read_n_bytes
+dc1394_pxl_set_gpio_mode_param
+dc1394_pxl_set_gpo_config
+dc1394_pxl_set_gpo_param
+dc1394_read_cycle_timer
+dc1394_reset_bus
+dc1394_set_PIO_register
+dc1394_set_SIO_register
+dc1394_set_absolute_register
+dc1394_set_adv_control_registers
+dc1394_set_control_registers
+dc1394_set_format7_register
+dc1394_set_registers
+dc1394_set_strobe_register
+dc1394_software_trigger_get_power
+dc1394_software_trigger_set_power
+dc1394_video_get_bandwidth_usage
+dc1394_video_get_data_depth
+dc1394_video_get_framerate
+dc1394_video_get_iso_channel
+dc1394_video_get_iso_speed
+dc1394_video_get_mode
+dc1394_video_get_multi_shot
+dc1394_video_get_one_shot
+dc1394_video_get_operation_mode
+dc1394_video_get_supported_framerates
+dc1394_video_get_supported_modes
+dc1394_video_get_transmission
+dc1394_video_set_framerate
+dc1394_video_set_iso_channel
+dc1394_video_set_iso_speed
+dc1394_video_set_mode
+dc1394_video_set_multi_shot
+dc1394_video_set_one_shot
+dc1394_video_set_operation_mode
+dc1394_video_set_transmission
+dc1394_windows_capture_dequeue
+dc1394_windows_capture_enqueue
+dc1394_windows_capture_setup
+dc1394_windows_capture_stop
+dc1394_windows_iso_allocate_channel
+dc1394_windows_iso_release_channel
diff --git a/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.dll b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.dll
new file mode 100644 (file)
index 0000000..319dbd8
Binary files /dev/null and b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.dll differ
diff --git a/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.exp b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.exp
new file mode 100644 (file)
index 0000000..f54af5d
Binary files /dev/null and b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.exp differ
diff --git a/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.lib b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.lib
new file mode 100644 (file)
index 0000000..6eb933b
Binary files /dev/null and b/libdc1394/libdc1394-2.2.1-bin/Win32/libdc1394-22.lib differ
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/Makefile.am b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/Makefile.am
new file mode 100644 (file)
index 0000000..1a2cb19
--- /dev/null
@@ -0,0 +1,70 @@
+MAINTAINERCLEANFILES = Makefile.in
+lib_LTLIBRARIES = libdc1394.la
+
+SUBDIRS = linux juju macosx windows usb vendor
+AM_CFLAGS = $(platform_CFLAGS) -I$(top_srcdir)
+
+libdc1394_la_LDFLAGS = $(platform_LDFLAGS) \
+       -version-info @lt_current@:@lt_revision@:@lt_age@ \
+       -export-symbols-regex '^dc1394_'
+
+libdc1394_la_SOURCES =  \
+       control.c       \
+       control.h       \
+       enumeration.c   \
+       platform.h      \
+       capture.c       \
+       offsets.h       \
+       format7.c       \
+       register.c      \
+       register.h      \
+       utils.c         \
+       utils.h         \
+       internal.c      \
+       internal.h      \
+       conversions.c   \
+       conversions.h   \
+       bayer.c         \
+       log.c           \
+       log.h           \
+       iso.c           \
+       iso.h
+
+if HAVE_LINUX
+if HAVE_LIBRAW1394
+  LINUX_LIBADD = linux/libdc1394-linux.la
+endif
+  JUJU_LIBADD = juju/libdc1394-juju.la
+endif
+if HAVE_MACOSX
+  MACOSX_LIBADD = macosx/libdc1394-macosx.la
+endif
+if HAVE_WINDOWS
+  WINDOWS_LIBADD = windows/libdc1394-windows.la
+endif
+if HAVE_LIBUSB
+  USB_LIBADD = usb/libdc1394-usb.la
+endif
+
+libdc1394_la_LIBADD = \
+       $(LINUX_LIBADD) \
+       $(JUJU_LIBADD) \
+       $(MACOSX_LIBADD) \
+       $(WINDOWS_LIBADD) \
+       $(USB_LIBADD) \
+       vendor/libdc1394-vendor.la
+
+# headers to be installed
+pkginclude_HEADERS =   \
+       dc1394.h        \
+       types.h         \
+       camera.h        \
+       control.h       \
+       capture.h       \
+       video.h         \
+       format7.h       \
+       utils.h         \
+       conversions.h   \
+       register.h      \
+       log.h           \
+       iso.h
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/Makefile.in b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/Makefile.in
new file mode 100644 (file)
index 0000000..a29d748
--- /dev/null
@@ -0,0 +1,812 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = dc1394
+DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libdc1394_la_DEPENDENCIES = $(LINUX_LIBADD) $(JUJU_LIBADD) \
+       $(MACOSX_LIBADD) $(WINDOWS_LIBADD) $(USB_LIBADD) \
+       vendor/libdc1394-vendor.la
+am_libdc1394_la_OBJECTS = control.lo enumeration.lo capture.lo \
+       format7.lo register.lo utils.lo internal.lo conversions.lo \
+       bayer.lo log.lo iso.lo
+libdc1394_la_OBJECTS = $(am_libdc1394_la_OBJECTS)
+libdc1394_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libdc1394_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = $(libdc1394_la_SOURCES)
+DIST_SOURCES = $(libdc1394_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-dvi-recursive install-exec-recursive \
+       install-html-recursive install-info-recursive \
+       install-pdf-recursive install-ps-recursive install-recursive \
+       installcheck-recursive installdirs-recursive pdf-recursive \
+       ps-recursive uninstall-recursive
+HEADERS = $(pkginclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+       $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+       distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+pkgincludedir = @pkgincludedir@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
+LIBUSB_LIBS = @LIBUSB_LIBS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+XV_CFLAGS = @XV_CFLAGS@
+XV_LIBS = @XV_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+lt_age = @lt_age@
+lt_current = @lt_current@
+lt_revision = @lt_revision@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+platform_LDFLAGS = @platform_LDFLAGS@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+MAINTAINERCLEANFILES = Makefile.in
+lib_LTLIBRARIES = libdc1394.la
+SUBDIRS = linux juju macosx windows usb vendor
+AM_CFLAGS = $(platform_CFLAGS) -I$(top_srcdir)
+libdc1394_la_LDFLAGS = $(platform_LDFLAGS) \
+       -version-info @lt_current@:@lt_revision@:@lt_age@ \
+       -export-symbols-regex '^dc1394_'
+
+libdc1394_la_SOURCES = \
+       control.c       \
+       control.h       \
+       enumeration.c   \
+       platform.h      \
+       capture.c       \
+       offsets.h       \
+       format7.c       \
+       register.c      \
+       register.h      \
+       utils.c         \
+       utils.h         \
+       internal.c      \
+       internal.h      \
+       conversions.c   \
+       conversions.h   \
+       bayer.c         \
+       log.c           \
+       log.h           \
+       iso.c           \
+       iso.h
+
+@HAVE_LIBRAW1394_TRUE@@HAVE_LINUX_TRUE@LINUX_LIBADD = linux/libdc1394-linux.la
+@HAVE_LINUX_TRUE@JUJU_LIBADD = juju/libdc1394-juju.la
+@HAVE_MACOSX_TRUE@MACOSX_LIBADD = macosx/libdc1394-macosx.la
+@HAVE_WINDOWS_TRUE@WINDOWS_LIBADD = windows/libdc1394-windows.la
+@HAVE_LIBUSB_TRUE@USB_LIBADD = usb/libdc1394-usb.la
+libdc1394_la_LIBADD = \
+       $(LINUX_LIBADD) \
+       $(JUJU_LIBADD) \
+       $(MACOSX_LIBADD) \
+       $(WINDOWS_LIBADD) \
+       $(USB_LIBADD) \
+       vendor/libdc1394-vendor.la
+
+
+# headers to be installed
+pkginclude_HEADERS = \
+       dc1394.h        \
+       types.h         \
+       camera.h        \
+       control.h       \
+       capture.h       \
+       video.h         \
+       format7.h       \
+       utils.h         \
+       conversions.h   \
+       register.h      \
+       log.h           \
+       iso.h
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu dc1394/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+       }
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libdc1394.la: $(libdc1394_la_OBJECTS) $(libdc1394_la_DEPENDENCIES) 
+       $(libdc1394_la_LINK) -rpath $(libdir) $(libdc1394_la_OBJECTS) $(libdc1394_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bayer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversions.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enumeration.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format7.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/internal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/register.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
+       @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
+       done
+
+uninstall-pkgincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       test -n "$$files" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @fail= failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+       @fail= failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(MKDIR_P) "$(distdir)/$$subdir" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+           $(am__relativize); \
+           new_distdir=$$reldir; \
+           dir1=$$subdir; dir2="$(top_distdir)"; \
+           $(am__relativize); \
+           new_top_distdir=$$reldir; \
+           echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+           echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+           ($(am__cd) $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$new_top_distdir" \
+               distdir="$$new_distdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               am__skip_mode_fix=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+       install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+       all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \
+       distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-am install-data \
+       install-data-am install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-libLTLIBRARIES install-man install-pdf \
+       install-pdf-am install-pkgincludeHEADERS install-ps \
+       install-ps-am install-strip installcheck installcheck-am \
+       installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags tags-recursive uninstall uninstall-am \
+       uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/bayer.c b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/bayer.c
new file mode 100644 (file)
index 0000000..6c946e1
--- /dev/null
@@ -0,0 +1,2183 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Bayer pattern decoding functions
+ *
+ * Written by Damien Douxchamps and Frederic Devernay
+ * The original VNG and AHD Bayer decoding are from Dave Coffin's DCRAW.
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <limits.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include "conversions.h"
+
+#define CLIP(in, out)\
+   in = in < 0 ? 0 : in;\
+   in = in > 255 ? 255 : in;\
+   out=in;
+
+#define CLIP16(in, out, bits)\
+   in = in < 0 ? 0 : in;\
+   in = in > ((1<<bits)-1) ? ((1<<bits)-1) : in;\
+   out=in;
+
+void
+ClearBorders(uint8_t *rgb, int sx, int sy, int w)
+{
+    int i, j;
+    // black edges are added with a width w:
+    i = 3 * sx * w - 1;
+    j = 3 * sx * sy - 1;
+    while (i >= 0) {
+        rgb[i--] = 0;
+        rgb[j--] = 0;
+    }
+
+    int low = sx * (w - 1) * 3 - 1 + w * 3;
+    i = low + sx * (sy - w * 2 + 1) * 3;
+    while (i > low) {
+        j = 6 * w;
+        while (j > 0) {
+            rgb[i--] = 0;
+            j--;
+        }
+        i -= (sx - 2 * w) * 3;
+    }
+}
+
+void
+ClearBorders_uint16(uint16_t * rgb, int sx, int sy, int w)
+{
+    int i, j;
+
+    // black edges:
+    i = 3 * sx * w - 1;
+    j = 3 * sx * sy - 1;
+    while (i >= 0) {
+        rgb[i--] = 0;
+        rgb[j--] = 0;
+    }
+
+    int low = sx * (w - 1) * 3 - 1 + w * 3;
+    i = low + sx * (sy - w * 2 + 1) * 3;
+    while (i > low) {
+        j = 6 * w;
+        while (j > 0) {
+            rgb[i--] = 0;
+            j--;
+        }
+        i -= (sx - 2 * w) * 3;
+    }
+
+}
+
+/**************************************************************
+ *     Color conversion functions for cameras that can        *
+ * output raw-Bayer pattern images, such as some Basler and   *
+ * Point Grey camera. Most of the algos presented here come   *
+ * from http://www-ise.stanford.edu/~tingchen/ and have been  *
+ * converted from Matlab to C and extended to all elementary  *
+ * patterns.                                                  *
+ **************************************************************/
+
+/* 8-bits versions */
+/* insprired by OpenCV's Bayer decoding */
+
+dc1394error_t
+dc1394_bayer_NearestNeighbor(const uint8_t *restrict bayer, uint8_t *restrict rgb, int sx, int sy, int tile)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+    int i, imax, iinc;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+      return DC1394_INVALID_COLOR_FILTER;
+
+    /* add black border */
+    imax = sx * sy * 3;
+    for (i = sx * (sy - 1) * 3; i < imax; i++) {
+        rgb[i] = 0;
+    }
+    iinc = (sx - 1) * 3;
+    for (i = (sx - 1) * 3; i < imax; i += iinc) {
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+    }
+
+    rgb += 1;
+    width -= 1;
+    height -= 1;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+      //int t0, t1;
+        const uint8_t *bayerEnd = bayer + width;
+
+        if (start_with_green) {
+            rgb[-blue] = bayer[1];
+            rgb[0] = bayer[bayerStep + 1];
+            rgb[blue] = bayer[bayerStep];
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                rgb[-1] = bayer[0];
+                rgb[0] = bayer[1];
+                rgb[1] = bayer[bayerStep + 1];
+
+                rgb[2] = bayer[2];
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[4] = bayer[bayerStep + 1];
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                rgb[1] = bayer[0];
+                rgb[0] = bayer[1];
+                rgb[-1] = bayer[bayerStep + 1];
+
+                rgb[4] = bayer[2];
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[2] = bayer[bayerStep + 1];
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            rgb[-blue] = bayer[0];
+            rgb[0] = bayer[1];
+            rgb[blue] = bayer[bayerStep + 1];
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+
+    return DC1394_SUCCESS;
+}
+
+/* OpenCV's Bayer decoding */
+dc1394error_t
+dc1394_bayer_Bilinear(const uint8_t *restrict bayer, uint8_t *restrict rgb, int sx, int sy, int tile)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    /*
+       the two letters  of the OpenCV name are respectively
+       the 4th and 3rd letters from the blinky name,
+       and we also have to switch R and B (OpenCV is BGR)
+
+       CV_BayerBG2BGR <-> DC1394_COLOR_FILTER_BGGR
+       CV_BayerGB2BGR <-> DC1394_COLOR_FILTER_GBRG
+       CV_BayerGR2BGR <-> DC1394_COLOR_FILTER_GRBG
+
+       int blue = tile == CV_BayerBG2BGR || tile == CV_BayerGB2BGR ? -1 : 1;
+       int start_with_green = tile == CV_BayerGB2BGR || tile == CV_BayerGR2BGR;
+     */
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+        return DC1394_INVALID_COLOR_FILTER;
+
+    ClearBorders(rgb, sx, sy, 1);
+    rgb += rgbStep + 3 + 1;
+    height -= 2;
+    width -= 2;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+        int t0, t1;
+        const uint8_t *bayerEnd = bayer + width;
+
+        if (start_with_green) {
+            /* OpenCV has a bug in the next line, which was
+               t0 = (bayer[0] + bayer[bayerStep * 2] + 1) >> 1; */
+            t0 = (bayer[1] + bayer[bayerStep * 2 + 1] + 1) >> 1;
+            t1 = (bayer[bayerStep] + bayer[bayerStep + 2] + 1) >> 1;
+            rgb[-blue] = (uint8_t) t0;
+            rgb[0] = bayer[bayerStep + 1];
+            rgb[blue] = (uint8_t) t1;
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                t0 = (bayer[0] + bayer[2] + bayer[bayerStep * 2] +
+                      bayer[bayerStep * 2 + 2] + 2) >> 2;
+                t1 = (bayer[1] + bayer[bayerStep] +
+                      bayer[bayerStep + 2] + bayer[bayerStep * 2 + 1] +
+                      2) >> 2;
+                rgb[-1] = (uint8_t) t0;
+                rgb[0] = (uint8_t) t1;
+                rgb[1] = bayer[bayerStep + 1];
+
+                t0 = (bayer[2] + bayer[bayerStep * 2 + 2] + 1) >> 1;
+                t1 = (bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                      1) >> 1;
+                rgb[2] = (uint8_t) t0;
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[4] = (uint8_t) t1;
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                t0 = (bayer[0] + bayer[2] + bayer[bayerStep * 2] +
+                      bayer[bayerStep * 2 + 2] + 2) >> 2;
+                t1 = (bayer[1] + bayer[bayerStep] +
+                      bayer[bayerStep + 2] + bayer[bayerStep * 2 + 1] +
+                      2) >> 2;
+                rgb[1] = (uint8_t) t0;
+                rgb[0] = (uint8_t) t1;
+                rgb[-1] = bayer[bayerStep + 1];
+
+                t0 = (bayer[2] + bayer[bayerStep * 2 + 2] + 1) >> 1;
+                t1 = (bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                      1) >> 1;
+                rgb[4] = (uint8_t) t0;
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[2] = (uint8_t) t1;
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            t0 = (bayer[0] + bayer[2] + bayer[bayerStep * 2] +
+                  bayer[bayerStep * 2 + 2] + 2) >> 2;
+            t1 = (bayer[1] + bayer[bayerStep] +
+                  bayer[bayerStep + 2] + bayer[bayerStep * 2 + 1] +
+                  2) >> 2;
+            rgb[-blue] = (uint8_t) t0;
+            rgb[0] = (uint8_t) t1;
+            rgb[blue] = bayer[bayerStep + 1];
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+    return DC1394_SUCCESS;
+}
+
+/* High-Quality Linear Interpolation For Demosaicing Of
+   Bayer-Patterned Color Images, by Henrique S. Malvar, Li-wei He, and
+   Ross Cutler, in ICASSP'04 */
+dc1394error_t
+dc1394_bayer_HQLinear(const uint8_t *restrict bayer, uint8_t *restrict rgb, int sx, int sy, int tile)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+      return DC1394_INVALID_COLOR_FILTER;
+
+    ClearBorders(rgb, sx, sy, 2);
+    rgb += 2 * rgbStep + 6 + 1;
+    height -= 4;
+    width -= 4;
+
+    /* We begin with a (+1 line,+1 column) offset with respect to bilinear decoding, so start_with_green is the same, but blue is opposite */
+    blue = -blue;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+        int t0, t1;
+        const uint8_t *bayerEnd = bayer + width;
+        const int bayerStep2 = bayerStep * 2;
+        const int bayerStep3 = bayerStep * 3;
+        const int bayerStep4 = bayerStep * 4;
+
+        if (start_with_green) {
+            /* at green pixel */
+            rgb[0] = bayer[bayerStep2 + 2];
+            t0 = rgb[0] * 5
+                + ((bayer[bayerStep + 2] + bayer[bayerStep3 + 2]) << 2)
+                - bayer[2]
+                - bayer[bayerStep + 1]
+                - bayer[bayerStep + 3]
+                - bayer[bayerStep3 + 1]
+                - bayer[bayerStep3 + 3]
+                - bayer[bayerStep4 + 2]
+                + ((bayer[bayerStep2] + bayer[bayerStep2 + 4] + 1) >> 1);
+            t1 = rgb[0] * 5 +
+                ((bayer[bayerStep2 + 1] + bayer[bayerStep2 + 3]) << 2)
+                - bayer[bayerStep2]
+                - bayer[bayerStep + 1]
+                - bayer[bayerStep + 3]
+                - bayer[bayerStep3 + 1]
+                - bayer[bayerStep3 + 3]
+                - bayer[bayerStep2 + 4]
+                + ((bayer[2] + bayer[bayerStep4 + 2] + 1) >> 1);
+            t0 = (t0 + 4) >> 3;
+            CLIP(t0, rgb[-blue]);
+            t1 = (t1 + 4) >> 3;
+            CLIP(t1, rgb[blue]);
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                /* B at B */
+                rgb[1] = bayer[bayerStep2 + 2];
+                /* R at B */
+                t0 = ((bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                       bayer[bayerStep3 + 1] + bayer[bayerStep3 + 3]) << 1)
+                    -
+                    (((bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 +
+                                                     2]) * 3 + 1) >> 1)
+                    + rgb[1] * 6;
+                /* G at B */
+                t1 = ((bayer[bayerStep + 2] + bayer[bayerStep2 + 1] +
+                       bayer[bayerStep2 + 3] + bayer[bayerStep3 + 2]) << 1)
+                    - (bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 + 2])
+                    + (rgb[1] << 2);
+                t0 = (t0 + 4) >> 3;
+                CLIP(t0, rgb[-1]);
+                t1 = (t1 + 4) >> 3;
+                CLIP(t1, rgb[0]);
+                /* at green pixel */
+                rgb[3] = bayer[bayerStep2 + 3];
+                t0 = rgb[3] * 5
+                    + ((bayer[bayerStep + 3] + bayer[bayerStep3 + 3]) << 2)
+                    - bayer[3]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep4 + 3]
+                    +
+                    ((bayer[bayerStep2 + 1] + bayer[bayerStep2 + 5] +
+                      1) >> 1);
+                t1 = rgb[3] * 5 +
+                    ((bayer[bayerStep2 + 2] + bayer[bayerStep2 + 4]) << 2)
+                    - bayer[bayerStep2 + 1]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep2 + 5]
+                    + ((bayer[3] + bayer[bayerStep4 + 3] + 1) >> 1);
+                t0 = (t0 + 4) >> 3;
+                CLIP(t0, rgb[2]);
+                t1 = (t1 + 4) >> 3;
+                CLIP(t1, rgb[4]);
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                /* R at R */
+                rgb[-1] = bayer[bayerStep2 + 2];
+                /* B at R */
+                t0 = ((bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                       bayer[bayerStep3 + 1] + bayer[bayerStep3 + 3]) << 1)
+                    -
+                    (((bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 +
+                                                     2]) * 3 + 1) >> 1)
+                    + rgb[-1] * 6;
+                /* G at R */
+                t1 = ((bayer[bayerStep + 2] + bayer[bayerStep2 + 1] +
+                       bayer[bayerStep2 + 3] + bayer[bayerStep * 3 +
+                                                     2]) << 1)
+                    - (bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 + 2])
+                    + (rgb[-1] << 2);
+                t0 = (t0 + 4) >> 3;
+                CLIP(t0, rgb[1]);
+                t1 = (t1 + 4) >> 3;
+                CLIP(t1, rgb[0]);
+
+                /* at green pixel */
+                rgb[3] = bayer[bayerStep2 + 3];
+                t0 = rgb[3] * 5
+                    + ((bayer[bayerStep + 3] + bayer[bayerStep3 + 3]) << 2)
+                    - bayer[3]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep4 + 3]
+                    +
+                    ((bayer[bayerStep2 + 1] + bayer[bayerStep2 + 5] +
+                      1) >> 1);
+                t1 = rgb[3] * 5 +
+                    ((bayer[bayerStep2 + 2] + bayer[bayerStep2 + 4]) << 2)
+                    - bayer[bayerStep2 + 1]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep2 + 5]
+                    + ((bayer[3] + bayer[bayerStep4 + 3] + 1) >> 1);
+                t0 = (t0 + 4) >> 3;
+                CLIP(t0, rgb[4]);
+                t1 = (t1 + 4) >> 3;
+                CLIP(t1, rgb[2]);
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            /* B at B */
+            rgb[blue] = bayer[bayerStep2 + 2];
+            /* R at B */
+            t0 = ((bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                   bayer[bayerStep3 + 1] + bayer[bayerStep3 + 3]) << 1)
+                -
+                (((bayer[2] + bayer[bayerStep2] +
+                   bayer[bayerStep2 + 4] + bayer[bayerStep4 +
+                                                 2]) * 3 + 1) >> 1)
+                + rgb[blue] * 6;
+            /* G at B */
+            t1 = (((bayer[bayerStep + 2] + bayer[bayerStep2 + 1] +
+                    bayer[bayerStep2 + 3] + bayer[bayerStep3 + 2])) << 1)
+                - (bayer[2] + bayer[bayerStep2] +
+                   bayer[bayerStep2 + 4] + bayer[bayerStep4 + 2])
+                + (rgb[blue] << 2);
+            t0 = (t0 + 4) >> 3;
+            CLIP(t0, rgb[-blue]);
+            t1 = (t1 + 4) >> 3;
+            CLIP(t1, rgb[0]);
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+/* coriander's Bayer decoding */
+/* Edge Sensing Interpolation II from http://www-ise.stanford.edu/~tingchen/ */
+/*   (Laroche,Claude A.  "Apparatus and method for adaptively
+     interpolating a full color image utilizing chrominance gradients"
+     U.S. Patent 5,373,322) */
+dc1394error_t
+dc1394_bayer_EdgeSense(const uint8_t *restrict bayer, uint8_t *restrict rgb, int sx, int sy, int tile)
+{
+    /* Removed due to patent concerns */
+    return DC1394_FUNCTION_NOT_SUPPORTED;
+}
+
+/* coriander's Bayer decoding */
+dc1394error_t
+dc1394_bayer_Downsample(const uint8_t *restrict bayer, uint8_t *restrict rgb, int sx, int sy, int tile)
+{
+    uint8_t *outR, *outG, *outB;
+    register int i, j;
+    int tmp;
+
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:
+    case DC1394_COLOR_FILTER_BGGR:
+        outR = &rgb[0];
+        outG = &rgb[1];
+        outB = &rgb[2];
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+    case DC1394_COLOR_FILTER_RGGB:
+        outR = &rgb[2];
+        outG = &rgb[1];
+        outB = &rgb[0];
+        break;
+    default:
+      return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:        //---------------------------------------------------------
+    case DC1394_COLOR_FILTER_GBRG:
+        for (i = 0; i < sy*sx; i += (sx<<1)) {
+            for (j = 0; j < sx; j += 2) {
+                tmp = ((bayer[i + j] + bayer[i + sx + j + 1]) >> 1);
+                CLIP(tmp, outG[((i >> 2) + (j >> 1)) * 3]);
+                tmp = bayer[i + j + 1];
+                CLIP(tmp, outR[((i >> 2) + (j >> 1)) * 3]);
+                tmp = bayer[i + sx + j];
+                CLIP(tmp, outB[((i >> 2) + (j >> 1)) * 3]);
+            }
+        }
+        break;
+    case DC1394_COLOR_FILTER_BGGR:        //---------------------------------------------------------
+    case DC1394_COLOR_FILTER_RGGB:
+        for (i = 0; i < sy*sx; i += (sx<<1)) {
+            for (j = 0; j < sx; j += 2) {
+                tmp = ((bayer[i + sx + j] + bayer[i + j + 1]) >> 1);
+                CLIP(tmp, outG[((i >> 2) + (j >> 1)) * 3]);
+                tmp = bayer[i + sx + j + 1];
+                CLIP(tmp, outR[((i >> 2) + (j >> 1)) * 3]);
+                tmp = bayer[i + j];
+                CLIP(tmp, outB[((i >> 2) + (j >> 1)) * 3]);
+            }
+        }
+        break;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+/* this is the method used inside AVT cameras. See AVT docs. */
+dc1394error_t
+dc1394_bayer_Simple(const uint8_t *restrict bayer, uint8_t *restrict rgb, int sx, int sy, int tile)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+    int i, imax, iinc;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+      return DC1394_INVALID_COLOR_FILTER;
+
+    /* add black border */
+    imax = sx * sy * 3;
+    for (i = sx * (sy - 1) * 3; i < imax; i++) {
+        rgb[i] = 0;
+    }
+    iinc = (sx - 1) * 3;
+    for (i = (sx - 1) * 3; i < imax; i += iinc) {
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+    }
+
+    rgb += 1;
+    width -= 1;
+    height -= 1;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+        const uint8_t *bayerEnd = bayer + width;
+
+        if (start_with_green) {
+            rgb[-blue] = bayer[1];
+            rgb[0] = (bayer[0] + bayer[bayerStep + 1] + 1) >> 1;
+            rgb[blue] = bayer[bayerStep];
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                rgb[-1] = bayer[0];
+                rgb[0] = (bayer[1] + bayer[bayerStep] + 1) >> 1;
+                rgb[1] = bayer[bayerStep + 1];
+
+                rgb[2] = bayer[2];
+                rgb[3] = (bayer[1] + bayer[bayerStep + 2] + 1) >> 1;
+                rgb[4] = bayer[bayerStep + 1];
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                rgb[1] = bayer[0];
+                rgb[0] = (bayer[1] + bayer[bayerStep] + 1) >> 1;
+                rgb[-1] = bayer[bayerStep + 1];
+
+                rgb[4] = bayer[2];
+                rgb[3] = (bayer[1] + bayer[bayerStep + 2] + 1) >> 1;
+                rgb[2] = bayer[bayerStep + 1];
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            rgb[-blue] = bayer[0];
+            rgb[0] = (bayer[1] + bayer[bayerStep] + 1) >> 1;
+            rgb[blue] = bayer[bayerStep + 1];
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+/* 16-bits versions */
+
+/* insprired by OpenCV's Bayer decoding */
+dc1394error_t
+dc1394_bayer_NearestNeighbor_uint16(const uint16_t *restrict bayer, uint16_t *restrict rgb, int sx, int sy, int tile, int bits)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+    int i, iinc, imax;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+      return DC1394_INVALID_COLOR_FILTER;
+
+    /* add black border */
+    imax = sx * sy * 3;
+    for (i = sx * (sy - 1) * 3; i < imax; i++) {
+        rgb[i] = 0;
+    }
+    iinc = (sx - 1) * 3;
+    for (i = (sx - 1) * 3; i < imax; i += iinc) {
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+    }
+
+    rgb += 1;
+    height -= 1;
+    width -= 1;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+      //int t0, t1;
+        const uint16_t *bayerEnd = bayer + width;
+
+        if (start_with_green) {
+            rgb[-blue] = bayer[1];
+            rgb[0] = bayer[bayerStep + 1];
+            rgb[blue] = bayer[bayerStep];
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                rgb[-1] = bayer[0];
+                rgb[0] = bayer[1];
+                rgb[1] = bayer[bayerStep + 1];
+
+                rgb[2] = bayer[2];
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[4] = bayer[bayerStep + 1];
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                rgb[1] = bayer[0];
+                rgb[0] = bayer[1];
+                rgb[-1] = bayer[bayerStep + 1];
+
+                rgb[4] = bayer[2];
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[2] = bayer[bayerStep + 1];
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            rgb[-blue] = bayer[0];
+            rgb[0] = bayer[1];
+            rgb[blue] = bayer[bayerStep + 1];
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+/* OpenCV's Bayer decoding */
+dc1394error_t
+dc1394_bayer_Bilinear_uint16(const uint16_t *restrict bayer, uint16_t *restrict rgb, int sx, int sy, int tile, int bits)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+      return DC1394_INVALID_COLOR_FILTER;
+
+    rgb += rgbStep + 3 + 1;
+    height -= 2;
+    width -= 2;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+        int t0, t1;
+        const uint16_t *bayerEnd = bayer + width;
+
+        if (start_with_green) {
+            /* OpenCV has a bug in the next line, which was
+               t0 = (bayer[0] + bayer[bayerStep * 2] + 1) >> 1; */
+            t0 = (bayer[1] + bayer[bayerStep * 2 + 1] + 1) >> 1;
+            t1 = (bayer[bayerStep] + bayer[bayerStep + 2] + 1) >> 1;
+            rgb[-blue] = (uint16_t) t0;
+            rgb[0] = bayer[bayerStep + 1];
+            rgb[blue] = (uint16_t) t1;
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                t0 = (bayer[0] + bayer[2] + bayer[bayerStep * 2] +
+                      bayer[bayerStep * 2 + 2] + 2) >> 2;
+                t1 = (bayer[1] + bayer[bayerStep] +
+                      bayer[bayerStep + 2] + bayer[bayerStep * 2 + 1] +
+                      2) >> 2;
+                rgb[-1] = (uint16_t) t0;
+                rgb[0] = (uint16_t) t1;
+                rgb[1] = bayer[bayerStep + 1];
+
+                t0 = (bayer[2] + bayer[bayerStep * 2 + 2] + 1) >> 1;
+                t1 = (bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                      1) >> 1;
+                rgb[2] = (uint16_t) t0;
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[4] = (uint16_t) t1;
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                t0 = (bayer[0] + bayer[2] + bayer[bayerStep * 2] +
+                      bayer[bayerStep * 2 + 2] + 2) >> 2;
+                t1 = (bayer[1] + bayer[bayerStep] +
+                      bayer[bayerStep + 2] + bayer[bayerStep * 2 + 1] +
+                      2) >> 2;
+                rgb[1] = (uint16_t) t0;
+                rgb[0] = (uint16_t) t1;
+                rgb[-1] = bayer[bayerStep + 1];
+
+                t0 = (bayer[2] + bayer[bayerStep * 2 + 2] + 1) >> 1;
+                t1 = (bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                      1) >> 1;
+                rgb[4] = (uint16_t) t0;
+                rgb[3] = bayer[bayerStep + 2];
+                rgb[2] = (uint16_t) t1;
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            t0 = (bayer[0] + bayer[2] + bayer[bayerStep * 2] +
+                  bayer[bayerStep * 2 + 2] + 2) >> 2;
+            t1 = (bayer[1] + bayer[bayerStep] +
+                  bayer[bayerStep + 2] + bayer[bayerStep * 2 + 1] +
+                  2) >> 2;
+            rgb[-blue] = (uint16_t) t0;
+            rgb[0] = (uint16_t) t1;
+            rgb[blue] = bayer[bayerStep + 1];
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+/* High-Quality Linear Interpolation For Demosaicing Of
+   Bayer-Patterned Color Images, by Henrique S. Malvar, Li-wei He, and
+   Ross Cutler, in ICASSP'04 */
+dc1394error_t
+dc1394_bayer_HQLinear_uint16(const uint16_t *restrict bayer, uint16_t *restrict rgb, int sx, int sy, int tile, int bits)
+{
+    const int bayerStep = sx;
+    const int rgbStep = 3 * sx;
+    int width = sx;
+    int height = sy;
+    /*
+       the two letters  of the OpenCV name are respectively
+       the 4th and 3rd letters from the blinky name,
+       and we also have to switch R and B (OpenCV is BGR)
+
+       CV_BayerBG2BGR <-> DC1394_COLOR_FILTER_BGGR
+       CV_BayerGB2BGR <-> DC1394_COLOR_FILTER_GBRG
+       CV_BayerGR2BGR <-> DC1394_COLOR_FILTER_GRBG
+
+       int blue = tile == CV_BayerBG2BGR || tile == CV_BayerGB2BGR ? -1 : 1;
+       int start_with_green = tile == CV_BayerGB2BGR || tile == CV_BayerGR2BGR;
+     */
+    int blue = tile == DC1394_COLOR_FILTER_BGGR
+        || tile == DC1394_COLOR_FILTER_GBRG ? -1 : 1;
+    int start_with_green = tile == DC1394_COLOR_FILTER_GBRG
+        || tile == DC1394_COLOR_FILTER_GRBG;
+
+    if ((tile>DC1394_COLOR_FILTER_MAX)||(tile<DC1394_COLOR_FILTER_MIN))
+      return DC1394_INVALID_COLOR_FILTER;
+
+    ClearBorders_uint16(rgb, sx, sy, 2);
+    rgb += 2 * rgbStep + 6 + 1;
+    height -= 4;
+    width -= 4;
+
+    /* We begin with a (+1 line,+1 column) offset with respect to bilinear decoding, so start_with_green is the same, but blue is opposite */
+    blue = -blue;
+
+    for (; height--; bayer += bayerStep, rgb += rgbStep) {
+        int t0, t1;
+        const uint16_t *bayerEnd = bayer + width;
+        const int bayerStep2 = bayerStep * 2;
+        const int bayerStep3 = bayerStep * 3;
+        const int bayerStep4 = bayerStep * 4;
+
+        if (start_with_green) {
+            /* at green pixel */
+            rgb[0] = bayer[bayerStep2 + 2];
+            t0 = rgb[0] * 5
+                + ((bayer[bayerStep + 2] + bayer[bayerStep3 + 2]) << 2)
+                - bayer[2]
+                - bayer[bayerStep + 1]
+                - bayer[bayerStep + 3]
+                - bayer[bayerStep3 + 1]
+                - bayer[bayerStep3 + 3]
+                - bayer[bayerStep4 + 2]
+                + ((bayer[bayerStep2] + bayer[bayerStep2 + 4] + 1) >> 1);
+            t1 = rgb[0] * 5 +
+                ((bayer[bayerStep2 + 1] + bayer[bayerStep2 + 3]) << 2)
+                - bayer[bayerStep2]
+                - bayer[bayerStep + 1]
+                - bayer[bayerStep + 3]
+                - bayer[bayerStep3 + 1]
+                - bayer[bayerStep3 + 3]
+                - bayer[bayerStep2 + 4]
+                + ((bayer[2] + bayer[bayerStep4 + 2] + 1) >> 1);
+            t0 = (t0 + 4) >> 3;
+            CLIP16(t0, rgb[-blue], bits);
+            t1 = (t1 + 4) >> 3;
+            CLIP16(t1, rgb[blue], bits);
+            bayer++;
+            rgb += 3;
+        }
+
+        if (blue > 0) {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                /* B at B */
+                rgb[1] = bayer[bayerStep2 + 2];
+                /* R at B */
+                t0 = ((bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                       bayer[bayerStep3 + 1] + bayer[bayerStep3 + 3]) << 1)
+                    -
+                    (((bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 +
+                                                     2]) * 3 + 1) >> 1)
+                    + rgb[1] * 6;
+                /* G at B */
+                t1 = ((bayer[bayerStep + 2] + bayer[bayerStep2 + 1] +
+                       bayer[bayerStep2 + 3] + bayer[bayerStep * 3 +
+                                                     2]) << 1)
+                    - (bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 + 2])
+                    + (rgb[1] << 2);
+                t0 = (t0 + 4) >> 3;
+                CLIP16(t0, rgb[-1], bits);
+                t1 = (t1 + 4) >> 3;
+                CLIP16(t1, rgb[0], bits);
+                /* at green pixel */
+                rgb[3] = bayer[bayerStep2 + 3];
+                t0 = rgb[3] * 5
+                    + ((bayer[bayerStep + 3] + bayer[bayerStep3 + 3]) << 2)
+                    - bayer[3]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep4 + 3]
+                    +
+                    ((bayer[bayerStep2 + 1] + bayer[bayerStep2 + 5] +
+                      1) >> 1);
+                t1 = rgb[3] * 5 +
+                    ((bayer[bayerStep2 + 2] + bayer[bayerStep2 + 4]) << 2)
+                    - bayer[bayerStep2 + 1]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep2 + 5]
+                    + ((bayer[3] + bayer[bayerStep4 + 3] + 1) >> 1);
+                t0 = (t0 + 4) >> 3;
+                CLIP16(t0, rgb[2], bits);
+                t1 = (t1 + 4) >> 3;
+                CLIP16(t1, rgb[4], bits);
+            }
+        } else {
+            for (; bayer <= bayerEnd - 2; bayer += 2, rgb += 6) {
+                /* R at R */
+                rgb[-1] = bayer[bayerStep2 + 2];
+                /* B at R */
+                t0 = ((bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                       bayer[bayerStep * 3 + 1] + bayer[bayerStep3 +
+                                                        3]) << 1)
+                    -
+                    (((bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 +
+                                                     2]) * 3 + 1) >> 1)
+                    + rgb[-1] * 6;
+                /* G at R */
+                t1 = ((bayer[bayerStep + 2] + bayer[bayerStep2 + 1] +
+                       bayer[bayerStep2 + 3] + bayer[bayerStep3 + 2]) << 1)
+                    - (bayer[2] + bayer[bayerStep2] +
+                       bayer[bayerStep2 + 4] + bayer[bayerStep4 + 2])
+                    + (rgb[-1] << 2);
+                t0 = (t0 + 4) >> 3;
+                CLIP16(t0, rgb[1], bits);
+                t1 = (t1 + 4) >> 3;
+                CLIP16(t1, rgb[0], bits);
+
+                /* at green pixel */
+                rgb[3] = bayer[bayerStep2 + 3];
+                t0 = rgb[3] * 5
+                    + ((bayer[bayerStep + 3] + bayer[bayerStep3 + 3]) << 2)
+                    - bayer[3]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep4 + 3]
+                    +
+                    ((bayer[bayerStep2 + 1] + bayer[bayerStep2 + 5] +
+                      1) >> 1);
+                t1 = rgb[3] * 5 +
+                    ((bayer[bayerStep2 + 2] + bayer[bayerStep2 + 4]) << 2)
+                    - bayer[bayerStep2 + 1]
+                    - bayer[bayerStep + 2]
+                    - bayer[bayerStep + 4]
+                    - bayer[bayerStep3 + 2]
+                    - bayer[bayerStep3 + 4]
+                    - bayer[bayerStep2 + 5]
+                    + ((bayer[3] + bayer[bayerStep4 + 3] + 1) >> 1);
+                t0 = (t0 + 4) >> 3;
+                CLIP16(t0, rgb[4], bits);
+                t1 = (t1 + 4) >> 3;
+                CLIP16(t1, rgb[2], bits);
+            }
+        }
+
+        if (bayer < bayerEnd) {
+            /* B at B */
+            rgb[blue] = bayer[bayerStep2 + 2];
+            /* R at B */
+            t0 = ((bayer[bayerStep + 1] + bayer[bayerStep + 3] +
+                   bayer[bayerStep3 + 1] + bayer[bayerStep3 + 3]) << 1)
+                -
+                (((bayer[2] + bayer[bayerStep2] +
+                   bayer[bayerStep2 + 4] + bayer[bayerStep4 +
+                                                 2]) * 3 + 1) >> 1)
+                + rgb[blue] * 6;
+            /* G at B */
+            t1 = (((bayer[bayerStep + 2] + bayer[bayerStep2 + 1] +
+                    bayer[bayerStep2 + 3] + bayer[bayerStep3 + 2])) << 1)
+                - (bayer[2] + bayer[bayerStep2] +
+                   bayer[bayerStep2 + 4] + bayer[bayerStep4 + 2])
+                + (rgb[blue] << 2);
+            t0 = (t0 + 4) >> 3;
+            CLIP16(t0, rgb[-blue], bits);
+            t1 = (t1 + 4) >> 3;
+            CLIP16(t1, rgb[0], bits);
+            bayer++;
+            rgb += 3;
+        }
+
+        bayer -= width;
+        rgb -= width * 3;
+
+        blue = -blue;
+        start_with_green = !start_with_green;
+    }
+
+    return DC1394_SUCCESS;
+}
+
+/* coriander's Bayer decoding */
+dc1394error_t
+dc1394_bayer_EdgeSense_uint16(const uint16_t *restrict bayer, uint16_t *restrict rgb, int sx, int sy, int tile, int bits)
+{
+    /* Removed due to patent concerns */
+    return DC1394_FUNCTION_NOT_SUPPORTED;
+}
+
+/* coriander's Bayer decoding */
+dc1394error_t
+dc1394_bayer_Downsample_uint16(const uint16_t *restrict bayer, uint16_t *restrict rgb, int sx, int sy, int tile, int bits)
+{
+    uint16_t *outR, *outG, *outB;
+    register int i, j;
+    int tmp;
+
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:
+    case DC1394_COLOR_FILTER_BGGR:
+        outR = &rgb[0];
+        outG = &rgb[1];
+        outB = &rgb[2];
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+    case DC1394_COLOR_FILTER_RGGB:
+        outR = &rgb[2];
+        outG = &rgb[1];
+        outB = &rgb[0];
+        break;
+    default:
+      return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:        //---------------------------------------------------------
+    case DC1394_COLOR_FILTER_GBRG:
+        for (i = 0; i < sy*sx; i += (sx<<1)) {
+            for (j = 0; j < sx; j += 2) {
+                tmp =
+                    ((bayer[i + j] + bayer[i + sx + j + 1]) >> 1);
+                CLIP16(tmp, outG[((i >> 2) + (j >> 1)) * 3], bits);
+                tmp = bayer[i + sx + j + 1];
+                CLIP16(tmp, outR[((i >> 2) + (j >> 1)) * 3], bits);
+                tmp = bayer[i + sx + j];
+                CLIP16(tmp, outB[((i >> 2) + (j >> 1)) * 3], bits);
+            }
+        }
+        break;
+    case DC1394_COLOR_FILTER_BGGR:        //---------------------------------------------------------
+    case DC1394_COLOR_FILTER_RGGB:
+        for (i = 0; i < sy*sx; i += (sx<<1)) {
+            for (j = 0; j < sx; j += 2) {
+                tmp =
+                    ((bayer[i + sx + j] + bayer[i + j + 1]) >> 1);
+                CLIP16(tmp, outG[((i >> 2) + (j >> 1)) * 3], bits);
+                tmp = bayer[i + sx + j + 1];
+                CLIP16(tmp, outR[((i >> 2) + (j >> 1)) * 3], bits);
+                tmp = bayer[i + j];
+                CLIP16(tmp, outB[((i >> 2) + (j >> 1)) * 3], bits);
+            }
+        }
+        break;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+/* coriander's Bayer decoding */
+dc1394error_t
+dc1394_bayer_Simple_uint16(const uint16_t *restrict bayer, uint16_t *restrict rgb, int sx, int sy, int tile, int bits)
+{
+    uint16_t *outR, *outG, *outB;
+    register int i, j;
+    int tmp, base;
+
+    // sx and sy should be even
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:
+    case DC1394_COLOR_FILTER_BGGR:
+        outR = &rgb[0];
+        outG = &rgb[1];
+        outB = &rgb[2];
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+    case DC1394_COLOR_FILTER_RGGB:
+        outR = &rgb[2];
+        outG = &rgb[1];
+        outB = &rgb[0];
+        break;
+    default:
+      return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:
+    case DC1394_COLOR_FILTER_BGGR:
+        outR = &rgb[0];
+        outG = &rgb[1];
+        outB = &rgb[2];
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+    case DC1394_COLOR_FILTER_RGGB:
+        outR = &rgb[2];
+        outG = &rgb[1];
+        outB = &rgb[0];
+        break;
+    default:
+        outR = NULL;
+        outG = NULL;
+        outB = NULL;
+        break;
+    }
+
+    switch (tile) {
+    case DC1394_COLOR_FILTER_GRBG:        //---------------------------------------------------------
+    case DC1394_COLOR_FILTER_GBRG:
+        for (i = 0; i < sy - 1; i += 2) {
+            for (j = 0; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base] + bayer[base + sx + 1]) >> 1);
+                CLIP16(tmp, outG[base * 3], bits);
+                tmp = bayer[base + 1];
+                CLIP16(tmp, outR[base * 3], bits);
+                tmp = bayer[base + sx];
+                CLIP16(tmp, outB[base * 3], bits);
+            }
+        }
+        for (i = 0; i < sy - 1; i += 2) {
+            for (j = 1; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base + 1] + bayer[base + sx]) >> 1);
+                CLIP16(tmp, outG[(base) * 3], bits);
+                tmp = bayer[base];
+                CLIP16(tmp, outR[(base) * 3], bits);
+                tmp = bayer[base + 1 + sx];
+                CLIP16(tmp, outB[(base) * 3], bits);
+            }
+        }
+        for (i = 1; i < sy - 1; i += 2) {
+            for (j = 0; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base + sx] + bayer[base + 1]) >> 1);
+                CLIP16(tmp, outG[base * 3], bits);
+                tmp = bayer[base + sx + 1];
+                CLIP16(tmp, outR[base * 3], bits);
+                tmp = bayer[base];
+                CLIP16(tmp, outB[base * 3], bits);
+            }
+        }
+        for (i = 1; i < sy - 1; i += 2) {
+            for (j = 1; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base] + bayer[base + 1 + sx]) >> 1);
+                CLIP16(tmp, outG[(base) * 3], bits);
+                tmp = bayer[base + sx];
+                CLIP16(tmp, outR[(base) * 3], bits);
+                tmp = bayer[base + 1];
+                CLIP16(tmp, outB[(base) * 3], bits);
+            }
+        }
+        break;
+    case DC1394_COLOR_FILTER_BGGR:        //---------------------------------------------------------
+    case DC1394_COLOR_FILTER_RGGB:
+        for (i = 0; i < sy - 1; i += 2) {
+            for (j = 0; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base + sx] + bayer[base + 1]) >> 1);
+                CLIP16(tmp, outG[base * 3], bits);
+                tmp = bayer[base + sx + 1];
+                CLIP16(tmp, outR[base * 3], bits);
+                tmp = bayer[base];
+                CLIP16(tmp, outB[base * 3], bits);
+            }
+        }
+        for (i = 1; i < sy - 1; i += 2) {
+            for (j = 0; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base] + bayer[base + 1 + sx]) >> 1);
+                CLIP16(tmp, outG[(base) * 3], bits);
+                tmp = bayer[base + 1];
+                CLIP16(tmp, outR[(base) * 3], bits);
+                tmp = bayer[base + sx];
+                CLIP16(tmp, outB[(base) * 3], bits);
+            }
+        }
+        for (i = 0; i < sy - 1; i += 2) {
+            for (j = 1; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base] + bayer[base + sx + 1]) >> 1);
+                CLIP16(tmp, outG[base * 3], bits);
+                tmp = bayer[base + sx];
+                CLIP16(tmp, outR[base * 3], bits);
+                tmp = bayer[base + 1];
+                CLIP16(tmp, outB[base * 3], bits);
+            }
+        }
+        for (i = 1; i < sy - 1; i += 2) {
+            for (j = 1; j < sx - 1; j += 2) {
+                base = i * sx + j;
+                tmp = ((bayer[base + 1] + bayer[base + sx]) >> 1);
+                CLIP16(tmp, outG[(base) * 3], bits);
+                tmp = bayer[base];
+                CLIP16(tmp, outR[(base) * 3], bits);
+                tmp = bayer[base + 1 + sx];
+                CLIP16(tmp, outB[(base) * 3], bits);
+            }
+        }
+        break;
+    }
+
+    /* add black border */
+    for (i = sx * (sy - 1) * 3; i < sx * sy * 3; i++) {
+        rgb[i] = 0;
+    }
+    for (i = (sx - 1) * 3; i < sx * sy * 3; i += (sx - 1) * 3) {
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+        rgb[i++] = 0;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+/* Variable Number of Gradients, from dcraw <http://www.cybercom.net/~dcoffin/dcraw/> */
+/* Ported to libdc1394 by Frederic Devernay */
+
+#define FORC3 for (c=0; c < 3; c++)
+
+#define SQR(x) ((x)*(x))
+#define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31))
+#ifndef MIN
+  #define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+  #define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+#define LIM(x,min,max) MAX(min,MIN(x,max))
+#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y))
+/*
+   In order to inline this calculation, I make the risky
+   assumption that all filter patterns can be described
+   by a repeating pattern of eight rows and two columns
+
+   Return values are either 0/1/2/3 = G/M/C/Y or 0/1/2/3 = R/G1/B/G2
+ */
+#define FC(row,col) \
+        (filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)
+
+/*
+   This algorithm is officially called:
+
+   "Interpolation using a Threshold-based variable number of gradients"
+
+   described in http://www-ise.stanford.edu/~tingchen/algodep/vargra.html
+
+   I've extended the basic idea to work with non-Bayer filter arrays.
+   Gradients are numbered clockwise from NW=0 to W=7.
+ */
+static const signed char bayervng_terms[] = {
+    -2,-2,+0,-1,0,0x01, -2,-2,+0,+0,1,0x01, -2,-1,-1,+0,0,0x01,
+    -2,-1,+0,-1,0,0x02, -2,-1,+0,+0,0,0x03, -2,-1,+0,+1,1,0x01,
+    -2,+0,+0,-1,0,0x06, -2,+0,+0,+0,1,0x02, -2,+0,+0,+1,0,0x03,
+    -2,+1,-1,+0,0,0x04, -2,+1,+0,-1,1,0x04, -2,+1,+0,+0,0,0x06,
+    -2,+1,+0,+1,0,0x02, -2,+2,+0,+0,1,0x04, -2,+2,+0,+1,0,0x04,
+    -1,-2,-1,+0,0,0x80, -1,-2,+0,-1,0,0x01, -1,-2,+1,-1,0,0x01,
+    -1,-2,+1,+0,1,0x01, -1,-1,-1,+1,0,0x88, -1,-1,+1,-2,0,0x40,
+    -1,-1,+1,-1,0,0x22, -1,-1,+1,+0,0,0x33, -1,-1,+1,+1,1,0x11,
+    -1,+0,-1,+2,0,0x08, -1,+0,+0,-1,0,0x44, -1,+0,+0,+1,0,0x11,
+    -1,+0,+1,-2,1,0x40, -1,+0,+1,-1,0,0x66, -1,+0,+1,+0,1,0x22,
+    -1,+0,+1,+1,0,0x33, -1,+0,+1,+2,1,0x10, -1,+1,+1,-1,1,0x44,
+    -1,+1,+1,+0,0,0x66, -1,+1,+1,+1,0,0x22, -1,+1,+1,+2,0,0x10,
+    -1,+2,+0,+1,0,0x04, -1,+2,+1,+0,1,0x04, -1,+2,+1,+1,0,0x04,
+    +0,-2,+0,+0,1,0x80, +0,-1,+0,+1,1,0x88, +0,-1,+1,-2,0,0x40,
+    +0,-1,+1,+0,0,0x11, +0,-1,+2,-2,0,0x40, +0,-1,+2,-1,0,0x20,
+    +0,-1,+2,+0,0,0x30, +0,-1,+2,+1,1,0x10, +0,+0,+0,+2,1,0x08,
+    +0,+0,+2,-2,1,0x40, +0,+0,+2,-1,0,0x60, +0,+0,+2,+0,1,0x20,
+    +0,+0,+2,+1,0,0x30, +0,+0,+2,+2,1,0x10, +0,+1,+1,+0,0,0x44,
+    +0,+1,+1,+2,0,0x10, +0,+1,+2,-1,1,0x40, +0,+1,+2,+0,0,0x60,
+    +0,+1,+2,+1,0,0x20, +0,+1,+2,+2,0,0x10, +1,-2,+1,+0,0,0x80,
+    +1,-1,+1,+1,0,0x88, +1,+0,+1,+2,0,0x08, +1,+0,+2,-1,0,0x40,
+    +1,+0,+2,+1,0,0x10
+}, bayervng_chood[] = { -1,-1, -1,0, -1,+1, 0,+1, +1,+1, +1,0, +1,-1, 0,-1 };
+
+dc1394error_t
+dc1394_bayer_VNG(const uint8_t *restrict bayer,
+                 uint8_t *restrict dst, int sx, int sy,
+                 dc1394color_filter_t pattern)
+{
+    const int height = sy, width = sx;
+    static const signed char *cp;
+    /* the following has the same type as the image */
+    uint8_t (*brow[5])[3], *pix;          /* [FD] */
+    int code[8][2][320], *ip, gval[8], gmin, gmax, sum[4];
+    int row, col, x, y, x1, x2, y1, y2, t, weight, grads, color, diag;
+    int g, diff, thold, num, c;
+    uint32_t filters;                     /* [FD] */
+
+    /* first, use bilinear bayer decoding */
+    dc1394_bayer_Bilinear(bayer, dst, sx, sy, pattern);
+
+    switch(pattern) {
+    case DC1394_COLOR_FILTER_BGGR:
+        filters = 0x16161616;
+        break;
+    case DC1394_COLOR_FILTER_GRBG:
+        filters = 0x61616161;
+        break;
+    case DC1394_COLOR_FILTER_RGGB:
+        filters = 0x94949494;
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+        filters = 0x49494949;
+        break;
+    default:
+        return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    for (row=0; row < 8; row++) {                /* Precalculate for VNG */
+        for (col=0; col < 2; col++) {
+            ip = code[row][col];
+            for (cp=bayervng_terms, t=0; t < 64; t++) {
+                y1 = *cp++;  x1 = *cp++;
+                y2 = *cp++;  x2 = *cp++;
+                weight = *cp++;
+                grads = *cp++;
+                color = FC(row+y1,col+x1);
+                if (FC(row+y2,col+x2) != color) continue;
+                diag = (FC(row,col+1) == color && FC(row+1,col) == color) ? 2:1;
+                if (abs(y1-y2) == diag && abs(x1-x2) == diag) continue;
+                *ip++ = (y1*width + x1)*3 + color; /* [FD] */
+                *ip++ = (y2*width + x2)*3 + color; /* [FD] */
+                *ip++ = weight;
+                for (g=0; g < 8; g++)
+                    if (grads & 1<<g) *ip++ = g;
+                *ip++ = -1;
+            }
+            *ip++ = INT_MAX;
+            for (cp=bayervng_chood, g=0; g < 8; g++) {
+                y = *cp++;  x = *cp++;
+                *ip++ = (y*width + x) * 3;      /* [FD] */
+                color = FC(row,col);
+                if (FC(row+y,col+x) != color && FC(row+y*2,col+x*2) == color)
+                    *ip++ = (y*width + x) * 6 + color; /* [FD] */
+                else
+                    *ip++ = 0;
+            }
+        }
+    }
+    brow[4] = calloc (width*3, sizeof **brow);
+    //merror (brow[4], "vng_interpolate()");
+    for (row=0; row < 3; row++)
+        brow[row] = brow[4] + row*width;
+    for (row=2; row < height-2; row++) {                /* Do VNG interpolation */
+        for (col=2; col < width-2; col++) {
+            pix = dst + (row*width+col)*3;        /* [FD] */
+            ip = code[row & 7][col & 1];
+            memset (gval, 0, sizeof gval);
+            while ((g = ip[0]) != INT_MAX) {                /* Calculate gradients */
+                diff = ABS(pix[g] - pix[ip[1]]) << ip[2];
+                gval[ip[3]] += diff;
+                ip += 5;
+                if ((g = ip[-1]) == -1) continue;
+                gval[g] += diff;
+                while ((g = *ip++) != -1)
+                    gval[g] += diff;
+            }
+            ip++;
+            gmin = gmax = gval[0];                        /* Choose a threshold */
+            for (g=1; g < 8; g++) {
+                if (gmin > gval[g]) gmin = gval[g];
+                if (gmax < gval[g]) gmax = gval[g];
+            }
+            if (gmax == 0) {
+                memcpy (brow[2][col], pix, 3 * sizeof *dst); /* [FD] */
+                continue;
+            }
+            thold = gmin + (gmax >> 1);
+            memset (sum, 0, sizeof sum);
+            color = FC(row,col);
+            for (num=g=0; g < 8; g++,ip+=2) {                /* Average the neighbors */
+                if (gval[g] <= thold) {
+                    for (c=0; c < 3; c++)         /* [FD] */
+                        if (c == color && ip[1])
+                            sum[c] += (pix[c] + pix[ip[1]]) >> 1;
+                        else
+                            sum[c] += pix[ip[0] + c];
+                    num++;
+                }
+            }
+            for (c=0; c < 3; c++) {               /* [FD] Save to buffer */
+                t = pix[color];
+                if (c != color)
+                    t += (sum[c] - sum[color]) / num;
+                CLIP(t,brow[2][col][c]);          /* [FD] */
+            }
+        }
+        if (row > 3)                                /* Write buffer to image */
+            memcpy (dst + 3*((row-2)*width+2), brow[0]+2, (width-4)*3*sizeof *dst); /* [FD] */
+        for (g=0; g < 4; g++)
+            brow[(g-1) & 3] = brow[g];
+    }
+    memcpy (dst + 3*((row-2)*width+2), brow[0]+2, (width-4)*3*sizeof *dst);
+    memcpy (dst + 3*((row-1)*width+2), brow[1]+2, (width-4)*3*sizeof *dst);
+    free (brow[4]);
+
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+dc1394_bayer_VNG_uint16(const uint16_t *restrict bayer,
+                        uint16_t *restrict dst, int sx, int sy,
+                        dc1394color_filter_t pattern, int bits)
+{
+    const int height = sy, width = sx;
+    static const signed char *cp;
+    /* the following has the same type as the image */
+    uint16_t (*brow[5])[3], *pix;          /* [FD] */
+    int code[8][2][320], *ip, gval[8], gmin, gmax, sum[4];
+    int row, col, x, y, x1, x2, y1, y2, t, weight, grads, color, diag;
+    int g, diff, thold, num, c;
+    uint32_t filters;                     /* [FD] */
+
+    /* first, use bilinear bayer decoding */
+
+    dc1394_bayer_Bilinear_uint16(bayer, dst, sx, sy, pattern, bits);
+
+    switch(pattern) {
+    case DC1394_COLOR_FILTER_BGGR:
+        filters = 0x16161616;
+        break;
+    case DC1394_COLOR_FILTER_GRBG:
+        filters = 0x61616161;
+        break;
+    case DC1394_COLOR_FILTER_RGGB:
+        filters = 0x94949494;
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+        filters = 0x49494949;
+        break;
+    default:
+        return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    for (row=0; row < 8; row++) {                /* Precalculate for VNG */
+        for (col=0; col < 2; col++) {
+            ip = code[row][col];
+            for (cp=bayervng_terms, t=0; t < 64; t++) {
+                y1 = *cp++;  x1 = *cp++;
+                y2 = *cp++;  x2 = *cp++;
+                weight = *cp++;
+                grads = *cp++;
+                color = FC(row+y1,col+x1);
+                if (FC(row+y2,col+x2) != color) continue;
+                diag = (FC(row,col+1) == color && FC(row+1,col) == color) ? 2:1;
+                if (abs(y1-y2) == diag && abs(x1-x2) == diag) continue;
+                *ip++ = (y1*width + x1)*3 + color; /* [FD] */
+                *ip++ = (y2*width + x2)*3 + color; /* [FD] */
+                *ip++ = weight;
+                for (g=0; g < 8; g++)
+                    if (grads & 1<<g) *ip++ = g;
+                *ip++ = -1;
+            }
+            *ip++ = INT_MAX;
+            for (cp=bayervng_chood, g=0; g < 8; g++) {
+                y = *cp++;  x = *cp++;
+                *ip++ = (y*width + x) * 3;      /* [FD] */
+                color = FC(row,col);
+                if (FC(row+y,col+x) != color && FC(row+y*2,col+x*2) == color)
+                    *ip++ = (y*width + x) * 6 + color; /* [FD] */
+                else
+                    *ip++ = 0;
+            }
+        }
+    }
+    brow[4] = calloc (width*3, sizeof **brow);
+    //merror (brow[4], "vng_interpolate()");
+    for (row=0; row < 3; row++)
+        brow[row] = brow[4] + row*width;
+    for (row=2; row < height-2; row++) {                /* Do VNG interpolation */
+        for (col=2; col < width-2; col++) {
+            pix = dst + (row*width+col)*3;  /* [FD] */
+            ip = code[row & 7][col & 1];
+            memset (gval, 0, sizeof gval);
+            while ((g = ip[0]) != INT_MAX) {                /* Calculate gradients */
+                diff = ABS(pix[g] - pix[ip[1]]) << ip[2];
+                gval[ip[3]] += diff;
+                ip += 5;
+                if ((g = ip[-1]) == -1) continue;
+                gval[g] += diff;
+                while ((g = *ip++) != -1)
+                    gval[g] += diff;
+            }
+            ip++;
+            gmin = gmax = gval[0];                        /* Choose a threshold */
+            for (g=1; g < 8; g++) {
+                if (gmin > gval[g]) gmin = gval[g];
+                if (gmax < gval[g]) gmax = gval[g];
+            }
+            if (gmax == 0) {
+                memcpy (brow[2][col], pix, 3 * sizeof *dst); /* [FD] */
+                continue;
+            }
+            thold = gmin + (gmax >> 1);
+            memset (sum, 0, sizeof sum);
+            color = FC(row,col);
+            for (num=g=0; g < 8; g++,ip+=2) {                /* Average the neighbors */
+                if (gval[g] <= thold) {
+                    for (c=0; c < 3; c++)         /* [FD] */
+                        if (c == color && ip[1])
+                            sum[c] += (pix[c] + pix[ip[1]]) >> 1;
+                        else
+                            sum[c] += pix[ip[0] + c];
+                    num++;
+                }
+            }
+            for (c=0; c < 3; c++) {           /* [FD] Save to buffer */
+                t = pix[color];
+                if (c != color)
+                    t += (sum[c] - sum[color]) / num;
+                CLIP16(t,brow[2][col][c],bits);        /* [FD] */
+            }
+        }
+        if (row > 3)                                /* Write buffer to image */
+            memcpy (dst + 3*((row-2)*width+2), brow[0]+2, (width-4)*3*sizeof *dst); /* [FD] */
+        for (g=0; g < 4; g++)
+            brow[(g-1) & 3] = brow[g];
+    }
+    memcpy (dst + 3*((row-2)*width+2), brow[0]+2, (width-4)*3*sizeof *dst);
+    memcpy (dst + 3*((row-1)*width+2), brow[1]+2, (width-4)*3*sizeof *dst);
+    free (brow[4]);
+
+    return DC1394_SUCCESS;
+}
+
+
+
+/* AHD interpolation ported from dcraw to libdc1394 by Samuel Audet */
+static dc1394bool_t ahd_inited = DC1394_FALSE; /* WARNING: not multi-processor safe */
+
+#define CLIPOUT(x)        LIM(x,0,255)
+#define CLIPOUT16(x,bits) LIM(x,0,((1<<bits)-1))
+
+static const double xyz_rgb[3][3] = {                        /* XYZ from RGB */
+  { 0.412453, 0.357580, 0.180423 },
+  { 0.212671, 0.715160, 0.072169 },
+  { 0.019334, 0.119193, 0.950227 } };
+static const float d65_white[3] = { 0.950456, 1, 1.088754 };
+
+static void cam_to_cielab (uint16_t cam[3], float lab[3]) /* [SA] */
+{
+    int c, i, j;
+    float r, xyz[3];
+    static float cbrt[0x10000], xyz_cam[3][4];
+
+    if (cam == NULL) {
+        for (i=0; i < 0x10000; i++) {
+            r = i / 65535.0;
+            cbrt[i] = r > 0.008856 ? pow(r,1/3.0) : 7.787*r + 16/116.0;
+        }
+        for (i=0; i < 3; i++)
+            for (j=0; j < 3; j++)                           /* [SA] */
+                xyz_cam[i][j] = xyz_rgb[i][j] / d65_white[i]; /* [SA] */
+    } else {
+        xyz[0] = xyz[1] = xyz[2] = 0.5;
+        FORC3 { /* [SA] */
+            xyz[0] += xyz_cam[0][c] * cam[c];
+            xyz[1] += xyz_cam[1][c] * cam[c];
+            xyz[2] += xyz_cam[2][c] * cam[c];
+        }
+        xyz[0] = cbrt[CLIPOUT16((int) xyz[0],16)];        /* [SA] */
+        xyz[1] = cbrt[CLIPOUT16((int) xyz[1],16)];        /* [SA] */
+        xyz[2] = cbrt[CLIPOUT16((int) xyz[2],16)];        /* [SA] */
+        lab[0] = 116 * xyz[1] - 16;
+        lab[1] = 500 * (xyz[0] - xyz[1]);
+        lab[2] = 200 * (xyz[1] - xyz[2]);
+    }
+}
+
+/*
+   Adaptive Homogeneity-Directed interpolation is based on
+   the work of Keigo Hirakawa, Thomas Parks, and Paul Lee.
+ */
+#define TS 256                /* Tile Size */
+
+dc1394error_t
+dc1394_bayer_AHD(const uint8_t *restrict bayer,
+                 uint8_t *restrict dst, int sx, int sy,
+                 dc1394color_filter_t pattern)
+{
+    int i, j, top, left, row, col, tr, tc, fc, c, d, val, hm[2];
+    /* the following has the same type as the image */
+    uint8_t (*pix)[3], (*rix)[3];      /* [SA] */
+    uint16_t rix16[3];                 /* [SA] */
+    static const int dir[4] = { -1, 1, -TS, TS };
+    unsigned ldiff[2][4], abdiff[2][4], leps, abeps;
+    float flab[3];                     /* [SA] */
+    uint8_t (*rgb)[TS][TS][3];
+    short (*lab)[TS][TS][3];
+    char (*homo)[TS][TS], *buffer;
+
+    /* start - new code for libdc1394 */
+    uint32_t filters;
+    const int height = sy, width = sx;
+    int x, y;
+
+    if (ahd_inited==DC1394_FALSE) {
+        /* WARNING: this might not be multi-processor safe */
+        cam_to_cielab (NULL,NULL);
+        ahd_inited = DC1394_TRUE;
+    }
+
+    switch(pattern) {
+    case DC1394_COLOR_FILTER_BGGR:
+        filters = 0x16161616;
+        break;
+    case DC1394_COLOR_FILTER_GRBG:
+        filters = 0x61616161;
+        break;
+    case DC1394_COLOR_FILTER_RGGB:
+        filters = 0x94949494;
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+        filters = 0x49494949;
+        break;
+    default:
+        return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    /* fill-in destination with known exact values */
+    for (y = 0; y < height; y++) {
+        for (x = 0; x < width; x++) {
+            int channel = FC(y,x);
+            dst[(y*width+x)*3 + channel] = bayer[y*width+x];
+        }
+    }
+    /* end - new code for libdc1394 */
+
+    /* start - code from border_interpolate (int border) */
+    {
+        int border = 3;
+        unsigned row, col, y, x, f, c, sum[8];
+
+        for (row=0; row < height; row++)
+            for (col=0; col < width; col++) {
+                if (col==border && row >= border && row < height-border)
+                    col = width-border;
+                memset (sum, 0, sizeof sum);
+                for (y=row-1; y != row+2; y++)
+                    for (x=col-1; x != col+2; x++)
+                        if (y < height && x < width) {
+                            f = FC(y,x);
+                            sum[f] += dst[(y*width+x)*3 + f];           /* [SA] */
+                            sum[f+4]++;
+                        }
+                f = FC(row,col);
+                FORC3 if (c != f && sum[c+4])                     /* [SA] */
+                    dst[(row*width+col)*3 + c] = sum[c] / sum[c+4]; /* [SA] */
+            }
+    }
+    /* end - code from border_interpolate (int border) */
+
+
+    buffer = (char *) malloc (26*TS*TS);                /* 1664 kB */
+    /* merror (buffer, "ahd_interpolate()"); */
+    rgb  = (uint8_t(*)[TS][TS][3]) buffer;                /* [SA] */
+    lab  = (short (*)[TS][TS][3])(buffer + 12*TS*TS);
+    homo = (char  (*)[TS][TS])   (buffer + 24*TS*TS);
+
+    for (top=0; top < height; top += TS-6)
+        for (left=0; left < width; left += TS-6) {
+            memset (rgb, 0, 12*TS*TS);
+
+            /*  Interpolate green horizontally and vertically:                */
+            for (row = top < 2 ? 2:top; row < top+TS && row < height-2; row++) {
+                col = left + (FC(row,left) == 1);
+                if (col < 2) col += 2;
+                for (fc = FC(row,col); col < left+TS && col < width-2; col+=2) {
+                    pix = (uint8_t (*)[3])dst + (row*width+col);          /* [SA] */
+                    val = ((pix[-1][1] + pix[0][fc] + pix[1][1]) * 2
+                           - pix[-2][fc] - pix[2][fc]) >> 2;
+                    rgb[0][row-top][col-left][1] = ULIM(val,pix[-1][1],pix[1][1]);
+                    val = ((pix[-width][1] + pix[0][fc] + pix[width][1]) * 2
+                           - pix[-2*width][fc] - pix[2*width][fc]) >> 2;
+                    rgb[1][row-top][col-left][1] = ULIM(val,pix[-width][1],pix[width][1]);
+                }
+            }
+            /*  Interpolate red and blue, and convert to CIELab:                */
+            for (d=0; d < 2; d++)
+                for (row=top+1; row < top+TS-1 && row < height-1; row++)
+                    for (col=left+1; col < left+TS-1 && col < width-1; col++) {
+                        pix = (uint8_t (*)[3])dst + (row*width+col);        /* [SA] */
+                        rix = &rgb[d][row-top][col-left];
+                        if ((c = 2 - FC(row,col)) == 1) {
+                            c = FC(row+1,col);
+                            val = pix[0][1] + (( pix[-1][2-c] + pix[1][2-c]
+                                                 - rix[-1][1] - rix[1][1] ) >> 1);
+                            rix[0][2-c] = CLIPOUT(val);         /* [SA] */
+                            val = pix[0][1] + (( pix[-width][c] + pix[width][c]
+                                                 - rix[-TS][1] - rix[TS][1] ) >> 1);
+                        } else
+                            val = rix[0][1] + (( pix[-width-1][c] + pix[-width+1][c]
+                                                 + pix[+width-1][c] + pix[+width+1][c]
+                                                 - rix[-TS-1][1] - rix[-TS+1][1]
+                                                 - rix[+TS-1][1] - rix[+TS+1][1] + 1) >> 2);
+                        rix[0][c] = CLIPOUT(val);             /* [SA] */
+                        c = FC(row,col);
+                        rix[0][c] = pix[0][c];
+                        rix16[0] = rix[0][0];                 /* [SA] */
+                        rix16[1] = rix[0][1];                 /* [SA] */
+                        rix16[2] = rix[0][2];                 /* [SA] */
+                        cam_to_cielab (rix16, flab);          /* [SA] */
+                        FORC3 lab[d][row-top][col-left][c] = 64*flab[c];
+                    }
+            /*  Build homogeneity maps from the CIELab images:                */
+            memset (homo, 0, 2*TS*TS);
+            for (row=top+2; row < top+TS-2 && row < height; row++) {
+                tr = row-top;
+                for (col=left+2; col < left+TS-2 && col < width; col++) {
+                    tc = col-left;
+                    for (d=0; d < 2; d++)
+                        for (i=0; i < 4; i++)
+                            ldiff[d][i] = ABS(lab[d][tr][tc][0]-lab[d][tr][tc+dir[i]][0]);
+                    leps = MIN(MAX(ldiff[0][0],ldiff[0][1]),
+                               MAX(ldiff[1][2],ldiff[1][3]));
+                    for (d=0; d < 2; d++)
+                        for (i=0; i < 4; i++)
+                            if (i >> 1 == d || ldiff[d][i] <= leps)
+                                abdiff[d][i] = SQR(lab[d][tr][tc][1]-lab[d][tr][tc+dir[i]][1])
+                                    + SQR(lab[d][tr][tc][2]-lab[d][tr][tc+dir[i]][2]);
+                    abeps = MIN(MAX(abdiff[0][0],abdiff[0][1]),
+                                MAX(abdiff[1][2],abdiff[1][3]));
+                    for (d=0; d < 2; d++)
+                        for (i=0; i < 4; i++)
+                            if (ldiff[d][i] <= leps && abdiff[d][i] <= abeps)
+                                homo[d][tr][tc]++;
+                }
+            }
+            /*  Combine the most homogenous pixels for the final result:        */
+            for (row=top+3; row < top+TS-3 && row < height-3; row++) {
+                tr = row-top;
+                for (col=left+3; col < left+TS-3 && col < width-3; col++) {
+                    tc = col-left;
+                    for (d=0; d < 2; d++)
+                        for (hm[d]=0, i=tr-1; i <= tr+1; i++)
+                            for (j=tc-1; j <= tc+1; j++)
+                                hm[d] += homo[d][i][j];
+                    if (hm[0] != hm[1])
+                        FORC3 dst[(row*width+col)*3 + c] = CLIPOUT(rgb[hm[1] > hm[0]][tr][tc][c]); /* [SA] */
+                    else
+                        FORC3 dst[(row*width+col)*3 + c] =
+                            CLIPOUT((rgb[0][tr][tc][c] + rgb[1][tr][tc][c]) >> 1);      /* [SA] */
+                }
+            }
+        }
+    free (buffer);
+
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_bayer_AHD_uint16(const uint16_t *restrict bayer,
+                        uint16_t *restrict dst, int sx, int sy,
+                        dc1394color_filter_t pattern, int bits)
+{
+    int i, j, top, left, row, col, tr, tc, fc, c, d, val, hm[2];
+    /* the following has the same type as the image */
+    uint16_t (*pix)[3], (*rix)[3];      /* [SA] */
+    static const int dir[4] = { -1, 1, -TS, TS };
+    unsigned ldiff[2][4], abdiff[2][4], leps, abeps;
+    float flab[3];
+    uint16_t (*rgb)[TS][TS][3];         /* [SA] */
+    short (*lab)[TS][TS][3];
+    char (*homo)[TS][TS], *buffer;
+
+    /* start - new code for libdc1394 */
+    uint32_t filters;
+    const int height = sy, width = sx;
+    int x, y;
+
+    if (ahd_inited==DC1394_FALSE) {
+        /* WARNING: this might not be multi-processor safe */
+        cam_to_cielab (NULL,NULL);
+        ahd_inited = DC1394_TRUE;
+    }
+
+    switch(pattern) {
+    case DC1394_COLOR_FILTER_BGGR:
+        filters = 0x16161616;
+        break;
+    case DC1394_COLOR_FILTER_GRBG:
+        filters = 0x61616161;
+        break;
+    case DC1394_COLOR_FILTER_RGGB:
+        filters = 0x94949494;
+        break;
+    case DC1394_COLOR_FILTER_GBRG:
+        filters = 0x49494949;
+        break;
+    default:
+        return DC1394_INVALID_COLOR_FILTER;
+    }
+
+    /* fill-in destination with known exact values */
+    for (y = 0; y < height; y++) {
+        for (x = 0; x < width; x++) {
+            int channel = FC(y,x);
+            dst[(y*width+x)*3 + channel] = bayer[y*width+x];
+        }
+    }
+    /* end - new code for libdc1394 */
+
+    /* start - code from border_interpolate(int border) */
+    {
+        int border = 3;
+        unsigned row, col, y, x, f, c, sum[8];
+
+        for (row=0; row < height; row++)
+            for (col=0; col < width; col++) {
+                if (col==border && row >= border && row < height-border)
+        col = width-border;
+                memset (sum, 0, sizeof sum);
+                for (y=row-1; y != row+2; y++)
+                    for (x=col-1; x != col+2; x++)
+                        if (y < height && x < width) {
+                            f = FC(y,x);
+                            sum[f] += dst[(y*width+x)*3 + f];           /* [SA] */
+                            sum[f+4]++;
+                        }
+                f = FC(row,col);
+                FORC3 if (c != f && sum[c+4])                     /* [SA] */
+                    dst[(row*width+col)*3 + c] = sum[c] / sum[c+4]; /* [SA] */
+            }
+    }
+    /* end - code from border_interpolate(int border) */
+
+
+    buffer = (char *) malloc (26*TS*TS);                /* 1664 kB */
+    /* merror (buffer, "ahd_interpolate()"); */
+    rgb  = (uint16_t(*)[TS][TS][3]) buffer;               /* [SA] */
+    lab  = (short (*)[TS][TS][3])(buffer + 12*TS*TS);
+    homo = (char  (*)[TS][TS])   (buffer + 24*TS*TS);
+
+    for (top=0; top < height; top += TS-6)
+        for (left=0; left < width; left += TS-6) {
+            memset (rgb, 0, 12*TS*TS);
+
+            /*  Interpolate green horizontally and vertically:                */
+            for (row = top < 2 ? 2:top; row < top+TS && row < height-2; row++) {
+                col = left + (FC(row,left) == 1);
+                if (col < 2) col += 2;
+                for (fc = FC(row,col); col < left+TS && col < width-2; col+=2) {
+                    pix = (uint16_t (*)[3])dst + (row*width+col);          /* [SA] */
+                    val = ((pix[-1][1] + pix[0][fc] + pix[1][1]) * 2
+                           - pix[-2][fc] - pix[2][fc]) >> 2;
+                    rgb[0][row-top][col-left][1] = ULIM(val,pix[-1][1],pix[1][1]);
+                    val = ((pix[-width][1] + pix[0][fc] + pix[width][1]) * 2
+                           - pix[-2*width][fc] - pix[2*width][fc]) >> 2;
+                    rgb[1][row-top][col-left][1] = ULIM(val,pix[-width][1],pix[width][1]);
+                }
+            }
+            /*  Interpolate red and blue, and convert to CIELab:                */
+            for (d=0; d < 2; d++)
+                for (row=top+1; row < top+TS-1 && row < height-1; row++)
+                    for (col=left+1; col < left+TS-1 && col < width-1; col++) {
+                        pix = (uint16_t (*)[3])dst + (row*width+col);        /* [SA] */
+                        rix = &rgb[d][row-top][col-left];
+                        if ((c = 2 - FC(row,col)) == 1) {
+                            c = FC(row+1,col);
+                            val = pix[0][1] + (( pix[-1][2-c] + pix[1][2-c]
+                                                 - rix[-1][1] - rix[1][1] ) >> 1);
+                            rix[0][2-c] = CLIPOUT16(val, bits); /* [SA] */
+                            val = pix[0][1] + (( pix[-width][c] + pix[width][c]
+                                                 - rix[-TS][1] - rix[TS][1] ) >> 1);
+                        } else
+                            val = rix[0][1] + (( pix[-width-1][c] + pix[-width+1][c]
+                                                 + pix[+width-1][c] + pix[+width+1][c]
+                                                 - rix[-TS-1][1] - rix[-TS+1][1]
+                                                 - rix[+TS-1][1] - rix[+TS+1][1] + 1) >> 2);
+                        rix[0][c] = CLIPOUT16(val, bits);     /* [SA] */
+                        c = FC(row,col);
+                        rix[0][c] = pix[0][c];
+                        cam_to_cielab (rix[0], flab);
+                        FORC3 lab[d][row-top][col-left][c] = 64*flab[c];
+                    }
+            /*  Build homogeneity maps from the CIELab images:                */
+            memset (homo, 0, 2*TS*TS);
+            for (row=top+2; row < top+TS-2 && row < height; row++) {
+                tr = row-top;
+                for (col=left+2; col < left+TS-2 && col < width; col++) {
+                    tc = col-left;
+                    for (d=0; d < 2; d++)
+                        for (i=0; i < 4; i++)
+                            ldiff[d][i] = ABS(lab[d][tr][tc][0]-lab[d][tr][tc+dir[i]][0]);
+                    leps = MIN(MAX(ldiff[0][0],ldiff[0][1]),
+                               MAX(ldiff[1][2],ldiff[1][3]));
+                    for (d=0; d < 2; d++)
+                        for (i=0; i < 4; i++)
+                            if (i >> 1 == d || ldiff[d][i] <= leps)
+                                abdiff[d][i] = SQR(lab[d][tr][tc][1]-lab[d][tr][tc+dir[i]][1])
+                                    + SQR(lab[d][tr][tc][2]-lab[d][tr][tc+dir[i]][2]);
+                    abeps = MIN(MAX(abdiff[0][0],abdiff[0][1]),
+                                MAX(abdiff[1][2],abdiff[1][3]));
+                    for (d=0; d < 2; d++)
+                        for (i=0; i < 4; i++)
+                            if (ldiff[d][i] <= leps && abdiff[d][i] <= abeps)
+                                homo[d][tr][tc]++;
+                }
+            }
+            /*  Combine the most homogenous pixels for the final result:        */
+            for (row=top+3; row < top+TS-3 && row < height-3; row++) {
+                tr = row-top;
+                for (col=left+3; col < left+TS-3 && col < width-3; col++) {
+                    tc = col-left;
+                    for (d=0; d < 2; d++)
+                        for (hm[d]=0, i=tr-1; i <= tr+1; i++)
+                            for (j=tc-1; j <= tc+1; j++)
+                                hm[d] += homo[d][i][j];
+                    if (hm[0] != hm[1])
+                        FORC3 dst[(row*width+col)*3 + c] = CLIPOUT16(rgb[hm[1] > hm[0]][tr][tc][c], bits); /* [SA] */
+                    else
+                        FORC3 dst[(row*width+col)*3 + c] =
+                            CLIPOUT16((rgb[0][tr][tc][c] + rgb[1][tr][tc][c]) >> 1, bits); /* [SA] */
+                }
+            }
+        }
+    free (buffer);
+
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_bayer_decoding_8bit(const uint8_t *restrict bayer, uint8_t *restrict rgb, uint32_t sx, uint32_t sy, dc1394color_filter_t tile, dc1394bayer_method_t method)
+{
+    switch (method) {
+    case DC1394_BAYER_METHOD_NEAREST:
+        return dc1394_bayer_NearestNeighbor(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_SIMPLE:
+        return dc1394_bayer_Simple(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_BILINEAR:
+        return dc1394_bayer_Bilinear(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_HQLINEAR:
+        return dc1394_bayer_HQLinear(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_DOWNSAMPLE:
+        return dc1394_bayer_Downsample(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_EDGESENSE:
+        return dc1394_bayer_EdgeSense(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_VNG:
+        return dc1394_bayer_VNG(bayer, rgb, sx, sy, tile);
+    case DC1394_BAYER_METHOD_AHD:
+        return dc1394_bayer_AHD(bayer, rgb, sx, sy, tile);
+    default:
+        return DC1394_INVALID_BAYER_METHOD;
+  }
+
+}
+
+dc1394error_t
+dc1394_bayer_decoding_16bit(const uint16_t *restrict bayer, uint16_t *restrict rgb, uint32_t sx, uint32_t sy, dc1394color_filter_t tile, dc1394bayer_method_t method, uint32_t bits)
+{
+    switch (method) {
+    case DC1394_BAYER_METHOD_NEAREST:
+        return dc1394_bayer_NearestNeighbor_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_SIMPLE:
+        return dc1394_bayer_Simple_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_BILINEAR:
+        return dc1394_bayer_Bilinear_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_HQLINEAR:
+        return dc1394_bayer_HQLinear_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_DOWNSAMPLE:
+        return dc1394_bayer_Downsample_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_EDGESENSE:
+        return dc1394_bayer_EdgeSense_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_VNG:
+        return dc1394_bayer_VNG_uint16(bayer, rgb, sx, sy, tile, bits);
+    case DC1394_BAYER_METHOD_AHD:
+        return dc1394_bayer_AHD_uint16(bayer, rgb, sx, sy, tile, bits);
+    default:
+        return DC1394_INVALID_BAYER_METHOD;
+    }
+
+}
+
+dc1394error_t
+Adapt_buffer_bayer(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394bayer_method_t method)
+{
+    uint32_t bpp;
+
+    // conversions will halve the buffer size if the method is DOWNSAMPLE:
+    out->size[0]=in->size[0];
+    out->size[1]=in->size[1];
+    if (method == DC1394_BAYER_METHOD_DOWNSAMPLE) {
+        out->size[0]/=2; // ODD SIZE CASES NOT TAKEN INTO ACCOUNT
+        out->size[1]/=2;
+    }
+
+    // as a convention we divide the image position by two in the case of a DOWNSAMPLE:
+    out->position[0]=in->position[0];
+    out->position[1]=in->position[1];
+    if (method == DC1394_BAYER_METHOD_DOWNSAMPLE) {
+        out->position[0]/=2;
+        out->position[1]/=2;
+    }
+
+    // the destination color coding is ALWAYS RGB. Set this.
+    if ( (in->color_coding==DC1394_COLOR_CODING_RAW16) || 
+        (in->color_coding==DC1394_COLOR_CODING_MONO16) )
+        out->color_coding=DC1394_COLOR_CODING_RGB16;
+    else
+        out->color_coding=DC1394_COLOR_CODING_RGB8;
+
+    // keep the color filter value in all cases. If the format is not raw it will not be further used anyway
+    out->color_filter=in->color_filter;
+
+    // The output is never YUV, hence nothing to do about YUV byte order
+
+    // bit depth is conserved for 16 bit and set to 8bit for 8bit:
+    if ( (in->color_coding==DC1394_COLOR_CODING_RAW16) || 
+        (in->color_coding==DC1394_COLOR_CODING_MONO16) )
+        out->data_depth=in->data_depth;
+    else
+        out->data_depth=8;
+
+    // don't know what to do with stride... >>>> TODO: STRIDE SHOULD BE TAKEN INTO ACCOUNT... <<<<
+    // out->stride=??
+
+    // the video mode should not change. Color coding and other stuff can be accessed in specific fields of this struct
+    out->video_mode = in->video_mode;
+
+    // padding is kept:
+    out->padding_bytes = in->padding_bytes;
+
+    // image bytes changes:    >>>> TODO: STRIDE SHOULD BE TAKEN INTO ACCOUNT... <<<<
+    dc1394_get_color_coding_bit_size(out->color_coding, &bpp);
+    out->image_bytes=(out->size[0]*out->size[1]*bpp)/8;
+
+    // total is image_bytes + padding_bytes
+    out->total_bytes = out->image_bytes + out->padding_bytes;
+
+    // bytes-per-packet and packets_per_frame are internal data that can be kept as is.
+    out->packet_size  = in->packet_size;
+    out->packets_per_frame = in->packets_per_frame;
+
+    // timestamp, frame_behind, id and camera are copied too:
+    out->timestamp = in->timestamp;
+    out->frames_behind = in->frames_behind;
+    out->camera = in->camera;
+    out->id = in->id;
+
+    // verify memory allocation:
+    if (out->total_bytes>out->allocated_image_bytes) {
+        free(out->image);
+        out->image=(uint8_t*)malloc(out->total_bytes*sizeof(uint8_t));
+        if (out->image)
+            out->allocated_image_bytes = out->total_bytes*sizeof(uint8_t);
+        else
+            out->allocated_image_bytes = 0;
+    }
+
+    // Copy padding bytes:
+    if(out->image)
+        memcpy(&(out->image[out->image_bytes]),&(in->image[in->image_bytes]),out->padding_bytes);
+
+    out->little_endian=0; // not used before 1.32 is out.
+    out->data_in_padding=0; // not used before 1.32 is out.
+    
+    if(out->image)
+        return DC1394_SUCCESS;
+        
+    return DC1394_MEMORY_ALLOCATION_FAILURE;
+}
+
+dc1394error_t
+dc1394_debayer_frames(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394bayer_method_t method)
+{
+    if ((method<DC1394_BAYER_METHOD_MIN)||(method>DC1394_BAYER_METHOD_MAX))
+        return DC1394_INVALID_BAYER_METHOD;
+
+    switch (in->color_coding) {
+    case DC1394_COLOR_CODING_RAW8:
+    case DC1394_COLOR_CODING_MONO8:
+        
+        if(DC1394_SUCCESS != Adapt_buffer_bayer(in,out,method))
+            return DC1394_MEMORY_ALLOCATION_FAILURE;
+            
+        switch (method) {
+        case DC1394_BAYER_METHOD_NEAREST:
+            return dc1394_bayer_NearestNeighbor(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_SIMPLE:
+            return dc1394_bayer_Simple(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_BILINEAR:
+            return dc1394_bayer_Bilinear(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_HQLINEAR:
+            return dc1394_bayer_HQLinear(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_DOWNSAMPLE:
+            return dc1394_bayer_Downsample(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_EDGESENSE:
+            return dc1394_bayer_EdgeSense(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_VNG:
+            return dc1394_bayer_VNG(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        case DC1394_BAYER_METHOD_AHD:
+            return dc1394_bayer_AHD(in->image, out->image, in->size[0], in->size[1], in->color_filter);
+        }
+        break;
+    case DC1394_COLOR_CODING_MONO16:
+    case DC1394_COLOR_CODING_RAW16:
+    
+        if(DC1394_SUCCESS != Adapt_buffer_bayer(in,out,method))
+            return DC1394_MEMORY_ALLOCATION_FAILURE;
+            
+        switch (method) {
+        case DC1394_BAYER_METHOD_NEAREST:
+            return dc1394_bayer_NearestNeighbor_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_SIMPLE:
+            return dc1394_bayer_Simple_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_BILINEAR:
+            return dc1394_bayer_Bilinear_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_HQLINEAR:
+            return dc1394_bayer_HQLinear_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_DOWNSAMPLE:
+            return dc1394_bayer_Downsample_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_EDGESENSE:
+            return dc1394_bayer_EdgeSense_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_VNG:
+            return dc1394_bayer_VNG_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        case DC1394_BAYER_METHOD_AHD:
+            return dc1394_bayer_AHD_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, in->data_depth);
+        }
+        break;
+    default:
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    }
+
+    return DC1394_SUCCESS;
+}
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/camera.h b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/camera.h
new file mode 100644 (file)
index 0000000..75a09a9
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Written by Damien Douxchamps <ddouxchamps@users.sf.net>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <dc1394/log.h>
+#include <stdio.h>
+
+#ifndef __DC1394_CAMERA_H__
+#define __DC1394_CAMERA_H__
+
+/*! \file dc1394/camera.h
+    \brief Basic system and camera functions
+    \author Damien Douxchamps: coding
+    \author Peter Antoniac: documentation maintainer
+
+    More details soon
+*/
+
+/**
+ * List of IIDC versions
+ *
+ * Currently, the following versions exist: 1.04, 1.20, PTGREY, 1.30 and 1.31 (1.32 coming soon)
+ * Observing other versions means that there's a bug crawling somewhere.
+ */
+typedef enum {
+    DC1394_IIDC_VERSION_1_04 = 544,
+    DC1394_IIDC_VERSION_1_20,
+    DC1394_IIDC_VERSION_PTGREY,
+    DC1394_IIDC_VERSION_1_30,
+    DC1394_IIDC_VERSION_1_31,
+    DC1394_IIDC_VERSION_1_32,
+    DC1394_IIDC_VERSION_1_33,
+    DC1394_IIDC_VERSION_1_34,
+    DC1394_IIDC_VERSION_1_35,
+    DC1394_IIDC_VERSION_1_36,
+    DC1394_IIDC_VERSION_1_37,
+    DC1394_IIDC_VERSION_1_38,
+    DC1394_IIDC_VERSION_1_39
+} dc1394iidc_version_t;
+#define DC1394_IIDC_VERSION_MIN        DC1394_IIDC_VERSION_1_04
+#define DC1394_IIDC_VERSION_MAX        DC1394_IIDC_VERSION_1_39
+#define DC1394_IIDC_VERSION_NUM       (DC1394_IIDC_VERSION_MAX - DC1394_IIDC_VERSION_MIN + 1)
+
+/**
+ * Enumeration of power classes
+ *
+ * This is currently not used in libdc1394.
+ */
+typedef enum {
+    DC1394_POWER_CLASS_NONE=608,
+    DC1394_POWER_CLASS_PROV_MIN_15W,
+    DC1394_POWER_CLASS_PROV_MIN_30W,
+    DC1394_POWER_CLASS_PROV_MIN_45W,
+    DC1394_POWER_CLASS_USES_MAX_1W,
+    DC1394_POWER_CLASS_USES_MAX_3W,
+    DC1394_POWER_CLASS_USES_MAX_6W,
+    DC1394_POWER_CLASS_USES_MAX_10W
+} dc1394power_class_t;
+#define DC1394_POWER_CLASS_MIN       DC1394_POWER_CLASS_NONE
+#define DC1394_POWER_CLASS_MAX       DC1394_POWER_CLASS_USES_MAX_10W
+#define DC1394_POWER_CLASS_NUM      (DC1394_POWER_CLASS_MAX - DC1394_POWER_CLASS_MIN + 1)
+
+/**
+ * Enumeration of PHY delays
+ *
+ * This is currently not used in libdc1394.
+ */
+typedef enum {
+    DC1394_PHY_DELAY_MAX_144_NS=640,
+    DC1394_PHY_DELAY_UNKNOWN_0,
+    DC1394_PHY_DELAY_UNKNOWN_1,
+    DC1394_PHY_DELAY_UNKNOWN_2
+} dc1394phy_delay_t;
+#define DC1394_PHY_DELAY_MIN         DC1394_PHY_DELAY_MAX_144_NS
+#define DC1394_PHY_DELAY_MAX         DC1394_PHY_DELAY_UNKNOWN_0
+#define DC1394_PHY_DELAY_NUM        (DC1394_PHY_DELAY_MAX - DC1394_PHY_DELAY_MIN + 1)
+
+/**
+ * Camera structure
+ *
+ * This structure represents the camera in libdc1394. It contains a number of useful static information, such as model/vendor names,
+ * a few capabilities, some ROM offsets, a unique identifier, etc... 
+ */
+typedef struct __dc1394_camera
+{
+    /* system/firmware information */
+    uint64_t             guid;
+    int                  unit;
+    uint32_t             unit_spec_ID;
+    uint32_t             unit_sw_version;
+    uint32_t             unit_sub_sw_version;
+    uint32_t             command_registers_base;
+    uint32_t             unit_directory;
+    uint32_t             unit_dependent_directory;
+    uint64_t             advanced_features_csr;
+    uint64_t             PIO_control_csr;
+    uint64_t             SIO_control_csr;
+    uint64_t             strobe_control_csr;
+    uint64_t             format7_csr[DC1394_VIDEO_MODE_FORMAT7_NUM];
+    dc1394iidc_version_t iidc_version;
+    char               * vendor;
+    char               * model;
+    uint32_t             vendor_id;
+    uint32_t             model_id;
+    dc1394bool_t         bmode_capable;
+    dc1394bool_t         one_shot_capable;
+    dc1394bool_t         multi_shot_capable;
+    dc1394bool_t         can_switch_on_off;
+    dc1394bool_t         has_vmode_error_status;
+    dc1394bool_t         has_feature_error_status;
+    int                  max_mem_channel;
+
+    /* not used, for future use: */
+    uint32_t             flags;
+
+} dc1394camera_t;
+
+/**
+ * A unique identifier for a functional camera unit
+ *
+ * Since a single camera can contain several functional units (think stereo cameras), the GUID is not enough to identify an IIDC camera.
+ * The unit number must also be used, hence this struct. 
+ */
+typedef struct
+{
+    uint16_t             unit;
+    uint64_t             guid;
+} dc1394camera_id_t;
+
+/**
+ * A list of cameras
+ *
+ * Usually returned by dc1394_camera_eumerate(). 
+ */
+typedef struct __dc1394camera_list_t
+{
+    uint32_t             num;
+    dc1394camera_id_t    *ids;
+} dc1394camera_list_t;
+
+typedef struct __dc1394_t dc1394_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************************
+     General system functions
+ ***************************************************************************/
+
+/**
+ * Creates a new context in which cameras can be searched and used. This should be called before using any other libdc1394 function. 
+ */
+dc1394_t* dc1394_new (void);
+
+/**
+ * Liberates a context. Last function to use in your program. After this, no libdc1394 function can be used.
+ */
+void dc1394_free (dc1394_t *dc1394);
+
+/**
+ * Sets and gets the broadcast flag of a camera. If the broadcast flag is set,
+ * all devices on the bus will execute the command. Useful to sync ISO start
+ * commands or setting a bunch of cameras at the same time. Broadcast only works
+ * with identical devices (brand/model). If the devices are not identical your
+ * mileage may vary. Some cameras may not answer broadcast commands at all. Also,
+ * this only works with cameras on the SAME bus (IOW, the same port).
+ */
+dc1394error_t dc1394_camera_set_broadcast(dc1394camera_t *camera, dc1394bool_t pwr);
+dc1394error_t dc1394_camera_get_broadcast(dc1394camera_t *camera, dc1394bool_t *pwr);
+
+/**
+ * Resets the IEEE1394 bus which camera is attached to.  Calling this function is
+ * "rude" to other devices because it causes them to re-enumerate on the bus and
+ * may cause a temporary disruption in their current activities.  Thus, use it
+ * sparingly.  Its primary use is if a program shuts down uncleanly and needs to
+ * free leftover ISO channels or bandwidth.  A bus reset will free those things
+ * as a side effect.
+ */
+dc1394error_t dc1394_reset_bus(dc1394camera_t *camera);
+dc1394error_t dc1394_read_cycle_timer (dc1394camera_t * camera,
+        uint32_t * cycle_timer, uint64_t * local_time);
+
+/**
+ * Gets the IEEE 1394 node ID of the camera.
+ */
+dc1394error_t dc1394_camera_get_node(dc1394camera_t *camera, uint32_t *node,
+        uint32_t * generation);
+
+
+/***************************************************************************
+     Camera functions
+ ***************************************************************************/
+
+/**
+ * Returns the list of cameras available on the computer. If present, multiple cards will be probed
+ */
+dc1394error_t dc1394_camera_enumerate(dc1394_t *dc1394, dc1394camera_list_t **list);
+
+/**
+ * Frees the memory allocated in dc1394_enumerate_cameras for the camera list
+ */
+void dc1394_camera_free_list(dc1394camera_list_t *list);
+
+/**
+ * Create a new camera based on a GUID (Global Unique IDentifier)
+ */
+dc1394camera_t * dc1394_camera_new(dc1394_t *dc1394, uint64_t guid);
+
+/**
+ * Create a new camera based on a GUID and a unit number (for multi-unit cameras)
+ */
+dc1394camera_t * dc1394_camera_new_unit(dc1394_t *dc1394, uint64_t guid, int unit);
+
+/**
+ * Frees a camera structure
+ */
+void dc1394_camera_free(dc1394camera_t *camera);
+
+/**
+ * Print various camera information, such as GUID, vendor, model, supported IIDC specs, etc...
+ */
+dc1394error_t dc1394_camera_print_info(dc1394camera_t *camera, FILE *fd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/capture.c b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/capture.c
new file mode 100644 (file)
index 0000000..a33a3b2
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Written by David Moore <dcm@acm.org>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+
+#include "control.h"
+#include "platform.h"
+#include "internal.h"
+
+dc1394error_t
+dc1394_capture_setup (dc1394camera_t *camera, uint32_t num_dma_buffers,
+        uint32_t flags)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (!d->capture_setup)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->capture_setup (cpriv->pcam, num_dma_buffers, flags);
+}
+
+dc1394error_t
+dc1394_capture_stop (dc1394camera_t *camera)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (!d->capture_stop)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->capture_stop (cpriv->pcam);
+}
+
+int
+dc1394_capture_get_fileno (dc1394camera_t * camera)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (!d->capture_get_fileno)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->capture_get_fileno (cpriv->pcam);
+}
+
+dc1394error_t
+dc1394_capture_dequeue (dc1394camera_t * camera, dc1394capture_policy_t policy,
+        dc1394video_frame_t **frame)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (!d->capture_dequeue)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->capture_dequeue (cpriv->pcam, policy, frame);
+}
+
+dc1394error_t
+dc1394_capture_enqueue (dc1394camera_t * camera, dc1394video_frame_t * frame)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (!d->capture_enqueue)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->capture_enqueue (cpriv->pcam, frame);
+}
+
+dc1394bool_t
+dc1394_capture_is_frame_corrupt (dc1394camera_t * camera,
+        dc1394video_frame_t * frame)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    if (!frame)
+        return DC1394_TRUE;
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (!d->capture_is_frame_corrupt)
+        return DC1394_FALSE;
+    return d->capture_is_frame_corrupt (cpriv->pcam, frame);
+}
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/capture.h b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/capture.h
new file mode 100644 (file)
index 0000000..5980719
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Written by Damien Douxchamps <ddouxchamps@users.sf.net>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <dc1394/log.h>
+#include <dc1394/video.h>
+
+#ifndef __DC1394_CAPTURE_H__
+#define __DC1394_CAPTURE_H__
+
+/*! \file dc1394/capture.h
+    \brief Capture functions
+    \author Damien Douxchamps: coding
+    \author Peter Antoniac: documentation maintainer
+
+    More details soon
+*/
+
+/**
+ * The capture policy.
+ *
+ * Can be blocking (wait for a frame forever) or polling (returns if no frames is in the ring buffer)
+ */
+typedef enum {
+    DC1394_CAPTURE_POLICY_WAIT=672,
+    DC1394_CAPTURE_POLICY_POLL
+} dc1394capture_policy_t;
+#define DC1394_CAPTURE_POLICY_MIN    DC1394_CAPTURE_POLICY_WAIT
+#define DC1394_CAPTURE_POLICY_MAX    DC1394_CAPTURE_POLICY_POLL
+#define DC1394_CAPTURE_POLICY_NUM   (DC1394_CAPTURE_POLICY_MAX - DC1394_CAPTURE_POLICY_MIN + 1)
+
+/**
+ * Capture flags. Currently limited to switching automatic functions on/off: channel allocation, bandwidth allocation and automatic
+ * starting of ISO transmission
+ */
+#define DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC   0x00000001U
+#define DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC 0x00000002U
+#define DC1394_CAPTURE_FLAGS_DEFAULT         0x00000004U /* a reasonable default value: do bandwidth and channel allocation */
+#define DC1394_CAPTURE_FLAGS_AUTO_ISO        0x00000008U /* automatically start iso before capture and stop it after */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************************
+     Capture Functions
+ ***************************************************************************/
+
+/**
+ * Setup the capture, using a ring buffer of a certain size (num_dma_buffers) and certain options (flags)
+ */
+dc1394error_t dc1394_capture_setup(dc1394camera_t *camera, uint32_t num_dma_buffers, uint32_t flags);
+
+/**
+ * Stop the capture
+ */
+dc1394error_t dc1394_capture_stop(dc1394camera_t *camera);
+
+/**
+ * Gets a file descriptor to be used for select(). Must be called after dc1394_capture_setup().
+ */
+int dc1394_capture_get_fileno (dc1394camera_t * camera);
+
+/**
+ * Captures a video frame. The returned struct contains the image buffer, among others. This image buffer SHALL NOT be freed, as it represents an area
+ * in the memory that belongs to the system. 
+ */
+dc1394error_t dc1394_capture_dequeue(dc1394camera_t * camera, dc1394capture_policy_t policy, dc1394video_frame_t **frame);
+
+/**
+ * Returns a frame to the ring buffer once it has been used.
+ */
+dc1394error_t dc1394_capture_enqueue(dc1394camera_t * camera, dc1394video_frame_t * frame);
+
+/**
+ * Returns DC1394_TRUE if the given frame (previously dequeued) has been
+ * detected to be corrupt (missing data, corrupted data, overrun buffer, etc.).
+ * Note that certain types of corruption may go undetected in which case
+ * DC1394_FALSE will be returned.  The ability to detect corruption also
+ * varies between platforms.  Note that corrupt frames still need to be
+ * enqueued with dc1394_capture_enqueue() when no longer needed by the user.
+ */
+dc1394bool_t dc1394_capture_is_frame_corrupt (dc1394camera_t * camera,
+        dc1394video_frame_t * frame);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/control.c b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/control.c
new file mode 100644 (file)
index 0000000..45f4ddd
--- /dev/null
@@ -0,0 +1,2193 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Generic camera control functions
+ *
+ * Written by Damien Douxchamps <ddouxchamps@users.sf.net>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "internal.h"
+#include "offsets.h"
+
+dc1394error_t
+dc1394_camera_set_broadcast(dc1394camera_t *camera, dc1394bool_t pwr)
+{
+    dc1394camera_priv_t * priv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = priv->platform->dispatch;
+    if (!d->set_broadcast)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->set_broadcast (priv->pcam, pwr);
+}
+
+dc1394error_t
+dc1394_camera_get_broadcast(dc1394camera_t *camera, dc1394bool_t *pwr)
+{
+    dc1394camera_priv_t * priv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = priv->platform->dispatch;
+    if (!d->get_broadcast)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->get_broadcast (priv->pcam, pwr);
+}
+
+dc1394error_t
+dc1394_reset_bus (dc1394camera_t * camera)
+{
+    dc1394camera_priv_t * priv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = priv->platform->dispatch;
+    if (!d->reset_bus)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->reset_bus (priv->pcam);
+}
+
+dc1394error_t
+dc1394_read_cycle_timer (dc1394camera_t * camera,
+                         uint32_t * cycle_timer, uint64_t * local_time)
+{
+    dc1394camera_priv_t * priv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = priv->platform->dispatch;
+    if (!d->read_cycle_timer)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->read_cycle_timer (priv->pcam, cycle_timer, local_time);
+}
+
+dc1394error_t
+dc1394_camera_get_node (dc1394camera_t *camera, uint32_t *node,
+        uint32_t * generation)
+{
+    dc1394camera_priv_t * priv = DC1394_CAMERA_PRIV (camera);
+    const platform_dispatch_t * d = priv->platform->dispatch;
+    if (!d->camera_get_node)
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    return d->camera_get_node (priv->pcam, node, generation);
+}
+
+static dc1394error_t
+update_camera_info (dc1394camera_t *camera)
+{
+    uint32_t value=0, quadval = 0; // set to zero to avoid valgrind errors
+
+    dc1394_get_control_register(camera, REG_CAMERA_BASIC_FUNC_INQ, &value);
+
+    int adv_features_capable = value >> 31;
+    camera->has_vmode_error_status = (value >> 30) & 1;
+    camera->has_feature_error_status = (value >> 29) & 1;
+    int opt_function_capable = (value >> 28) & 1;
+    camera->bmode_capable = (value >> 23) & 1;
+    camera->can_switch_on_off = (value >> 15) & 1;
+    camera->one_shot_capable = (value >> 12) & 1;
+    camera->multi_shot_capable = (value >> 11) & 1;
+    camera->max_mem_channel    = value & 0xf;
+
+    if (adv_features_capable)
+        if (dc1394_get_control_register (camera, REG_CAMERA_ADV_FEATURE_INQ,
+                                         &quadval) == DC1394_SUCCESS)
+            camera->advanced_features_csr = (uint64_t) quadval * 4;
+
+    if (opt_function_capable) {
+        value = 0;
+        dc1394_get_control_register (camera, REG_CAMERA_OPT_FUNC_INQ, &value);
+        if ((value >> 30) & 1)
+            if (dc1394_get_control_register (camera, REG_CAMERA_PIO_CONTROL_CSR_INQ, &quadval) == DC1394_SUCCESS)
+                camera->PIO_control_csr = (uint64_t) quadval * 4;
+        if ((value >> 29) & 1)
+            if (dc1394_get_control_register (camera, REG_CAMERA_SIO_CONTROL_CSR_INQ, &quadval) == DC1394_SUCCESS)
+                camera->SIO_control_csr = (uint64_t) quadval * 4;
+        if ((value >> 28) & 1)
+            if (dc1394_get_control_register (camera, REG_CAMERA_STROBE_CONTROL_CSR_INQ, &quadval) == DC1394_SUCCESS)
+                camera->strobe_control_csr = (uint64_t) quadval * 4;
+    }
+
+    // verify that the iso speed, the video mode and the framerates are OK
+    // at boot time
+
+    /* get the current ISO speed, and verify it*/
+    dc1394error_t err;
+    dc1394speed_t iso_speed;
+    err=dc1394_video_get_iso_speed(camera, &iso_speed);
+    if (err==DC1394_INVALID_ISO_SPEED) {
+        // default to the most probable speed: 400 Mbps
+        dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
+    }
+
+    /* get the current video mode, and verify it*/
+    dc1394video_modes_t modes;
+    dc1394video_mode_t video_mode;
+    err=dc1394_video_get_mode(camera, &video_mode);
+    if (err==DC1394_INVALID_VIDEO_FORMAT) {
+        // a proper video mode may not be present. Try to set a default video mode
+        dc1394_video_get_supported_modes(camera,&modes);
+
+        dc1394_video_set_mode(camera,modes.modes[0]);
+    }
+
+    /* get the current framerate, and verify it*/
+    dc1394framerate_t framerate;
+    dc1394framerates_t framerates;
+    err=dc1394_video_get_framerate(camera, &framerate);
+    if (err==DC1394_INVALID_FRAMERATE) {
+        // a proper framerate may not be present. Try to set a default framerate
+        dc1394_video_get_supported_framerates(camera,video_mode,&framerates);
+
+        dc1394_video_set_framerate(camera,framerates.framerates[0]);
+    }
+
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_camera_print_info(dc1394camera_t *camera, FILE* fd)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+    uint32_t value[2];
+
+    value[0]= camera->guid & 0xffffffff;
+    value[1]= (camera->guid >>32) & 0xffffffff;
+    fprintf(fd,"------ Camera information ------\n");
+    fprintf(fd,"Vendor                            :     %s\n", camera->vendor);
+    fprintf(fd,"Model                             :     %s\n", camera->model);
+    fprintf(fd,"Unit                              :     %d\n", camera->unit);
+    fprintf(fd,"Specifications ID                 :     0x%x\n", camera->unit_spec_ID);
+    fprintf(fd,"Software revision                 :     0x%x\n", camera->unit_sw_version);
+    fprintf(fd,"IIDC version code                 :     %d\n", camera->iidc_version);
+    fprintf(fd,"Unit directory offset             :     0x%x\n", camera->unit_directory);
+    fprintf(fd,"Unit dependent directory offset   :     0x%x\n", camera->unit_dependent_directory);
+    fprintf(fd,"Commands registers base           :     0x%x\n", camera->command_registers_base);
+    fprintf(fd,"Unique ID                         :     0x%08x%08x\n", value[1], value[0]);
+    fprintf(fd,"Vendor ID                         :     0x%x\n", camera->vendor_id);
+    fprintf(fd,"Model ID                          :     0x%x\n", camera->model_id);
+    if (camera->advanced_features_csr>0)
+        fprintf(fd,"Advanced features found at offset :     0x%"PRIx64"\n", camera->advanced_features_csr);
+    fprintf(fd,"1394b mode capable (>=800Mbit/s)  :     ");
+    if (camera->bmode_capable==DC1394_TRUE)
+        fprintf(fd,"Yes\n");
+    else
+        fprintf(fd,"No\n");
+
+    fprintf(fd,"Platform backend                  :     %s\n",
+            cpriv->platform->name);
+    const platform_dispatch_t * d = cpriv->platform->dispatch;
+    if (d->camera_print_info)
+        d->camera_print_info (cpriv->pcam, fd);
+
+    return DC1394_SUCCESS;
+}
+
+/*****************************************************
+ dc1394_get_camera_feature_set
+
+ Collects the available features for the camera
+ described by node and stores them in features.
+*****************************************************/
+dc1394error_t
+dc1394_feature_get_all(dc1394camera_t *camera, dc1394featureset_t *features)
+{
+    uint32_t i, j;
+    dc1394error_t err=DC1394_SUCCESS;
+
+    for (i= DC1394_FEATURE_MIN, j= 0; i <= DC1394_FEATURE_MAX; i++, j++)  {
+        features->feature[j].id= i;
+        err=dc1394_feature_get(camera, &features->feature[j]);
+        DC1394_ERR_RTN(err, "Could not get camera feature");
+    }
+
+    return err;
+}
+
+/*****************************************************
+ dc1394_get_camera_feature
+
+ Stores the bounds and options associated with the
+ feature described by feature->id
+*****************************************************/
+dc1394error_t
+dc1394_feature_get(dc1394camera_t *camera, dc1394feature_info_t *feature)
+{
+    uint64_t offset;
+    uint32_t value;
+    dc1394error_t err;
+
+    if ( (feature->id < DC1394_FEATURE_MIN) || (feature->id > DC1394_FEATURE_MAX) ) {
+        return DC1394_INVALID_FEATURE;
+    }
+
+    // check presence
+    err=dc1394_feature_is_present(camera, feature->id, &(feature->available));
+    DC1394_ERR_RTN(err, "Could not check feature presence");
+
+    if (feature->available == DC1394_FALSE) {
+        return DC1394_SUCCESS;
+    }
+
+    // get capabilities
+    FEATURE_TO_INQUIRY_OFFSET(feature->id, offset);
+    err=dc1394_get_control_register(camera, offset, &value);
+    DC1394_ERR_RTN(err, "Could not check feature characteristics");
+
+    dc1394_feature_get_modes(camera, feature->id, &feature->modes);
+    dc1394_feature_get_mode(camera, feature->id, &feature->current_mode);
+
+    switch (feature->id) {
+    case DC1394_FEATURE_TRIGGER:
+        feature->polarity_capable= (value & 0x02000000UL) ? DC1394_TRUE : DC1394_FALSE;
+        int i, j;
+        uint32_t value_tmp;
+
+        feature->trigger_modes.num=0;
+        value_tmp= (value & (0xFFFF));
+
+        for (i=DC1394_TRIGGER_MODE_MIN;i<=DC1394_TRIGGER_MODE_MAX;i++) {
+            j = i - DC1394_TRIGGER_MODE_MIN;
+            if (value_tmp & (0x1 << (15-j-(j>5)*8))) { // (i>5)*8 to take the mode gap into account
+                feature->trigger_modes.modes[feature->trigger_modes.num]=i;
+                feature->trigger_modes.num++;
+            }
+        }
+
+        err=dc1394_external_trigger_get_supported_sources(camera,&feature->trigger_sources);
+        DC1394_ERR_RTN(err, "Could not get supported trigger sources");
+
+        break;
+    default:
+        feature->polarity_capable = 0;
+        feature->trigger_mode     = 0;
+
+        feature->min= (value & 0xFFF000UL) >> 12;
+        feature->max= (value & 0xFFFUL);
+        break;
+    }
+
+    feature->absolute_capable = (value & 0x40000000UL) ? DC1394_TRUE : DC1394_FALSE;
+    feature->readout_capable  = (value & 0x08000000UL) ? DC1394_TRUE : DC1394_FALSE;
+    feature->on_off_capable   = (value & 0x04000000UL) ? DC1394_TRUE : DC1394_FALSE;
+
+    // get current values
+    FEATURE_TO_VALUE_OFFSET(feature->id, offset);
+
+    err=dc1394_get_control_register(camera, offset, &value);
+    DC1394_ERR_RTN(err, "Could not get feature register");
+
+    switch (feature->id) {
+    case DC1394_FEATURE_TRIGGER:
+        feature->trigger_polarity= (value & 0x01000000UL) ? DC1394_TRUE : DC1394_FALSE;
+        feature->trigger_mode= (uint32_t)((value >> 16) & 0xF);
+        if (feature->trigger_mode >= 14)
+            feature->trigger_mode += DC1394_TRIGGER_MODE_MIN - 8;
+        else
+            feature->trigger_mode += DC1394_TRIGGER_MODE_MIN;
+        feature->trigger_source = (uint32_t)((value >> 21) & 0x7UL);
+        if (feature->trigger_source > 3)
+            feature->trigger_source -= 3;
+        feature->trigger_source += DC1394_TRIGGER_SOURCE_MIN;
+        break;
+    default:
+        break;
+    }
+
+    feature->is_on= (value & 0x02000000UL) ? DC1394_TRUE : DC1394_FALSE;
+
+    switch (feature->id) {
+    case DC1394_FEATURE_WHITE_BALANCE:
+        feature->RV_value= value & 0xFFFUL;
+        feature->BU_value= (value & 0xFFF000UL) >> 12;
+        break;
+    case DC1394_FEATURE_WHITE_SHADING:
+        feature->R_value=value & 0xFFUL;
+        feature->G_value=(value & 0xFF00UL)>>8;
+        feature->B_value=(value & 0xFF0000UL)>>16;
+        break;
+    case DC1394_FEATURE_TEMPERATURE:
+        feature->value= value & 0xFFFUL;
+        feature->target_value= value & 0xFFF000UL;
+        break;
+    default:
+        feature->value= value & 0xFFFUL;
+        break;
+    }
+
+    if (feature->absolute_capable>0) {
+        err=dc1394_feature_get_absolute_boundaries(camera, feature->id, &feature->abs_min, &feature->abs_max);
+        DC1394_ERR_RTN(err, "Could not get feature absolute min/max");
+        err=dc1394_feature_get_absolute_value(camera, feature->id, &feature->abs_value);
+        DC1394_ERR_RTN(err, "Could not get feature absolute value");
+        err=dc1394_feature_get_absolute_control(camera, feature->id, &feature->abs_control);
+        DC1394_ERR_RTN(err, "Could not get feature absolute control");
+    }
+
+    return err;
+}
+
+/*****************************************************
+ dc1394_print_feature
+
+ Displays the bounds and options of the given feature
+*****************************************************/
+dc1394error_t
+dc1394_feature_print(dc1394feature_info_t *f, FILE *fd)
+{
+    int fid= f->id;
+
+    if ( (fid < DC1394_FEATURE_MIN) || (fid > DC1394_FEATURE_MAX) ) {
+        return DC1394_INVALID_FEATURE;
+    }
+    const char *feature_string = dc1394_feature_get_string (fid);
+    fprintf(fd,"%s:\n\t", feature_string);
+
+    if (!f->available) {
+        fprintf(fd,"NOT AVAILABLE\n");
+        return DC1394_SUCCESS;
+    }
+
+    if (f->readout_capable)
+        fprintf(fd,"RC  ");
+    if (f->on_off_capable)
+        fprintf(fd,"O/OC  ");
+    int i;
+    for (i=0;i<f->modes.num;i++) {
+        switch (f->modes.modes[i]) {
+        case DC1394_FEATURE_MODE_MANUAL:
+            fprintf(fd,"MC  ");
+            break;
+        case DC1394_FEATURE_MODE_AUTO:
+            fprintf(fd,"AC  ");
+            break;
+        case DC1394_FEATURE_MODE_ONE_PUSH_AUTO:
+            fprintf(fd,"OP  ");
+            break;
+        }
+        fprintf(fd,"(active is: ");
+        switch (f->current_mode) {
+        case DC1394_FEATURE_MODE_MANUAL:
+            fprintf(fd,"MAN)  ");
+            break;
+        case DC1394_FEATURE_MODE_AUTO:
+            fprintf(fd,"AUTO)  ");
+            break;
+        case DC1394_FEATURE_MODE_ONE_PUSH_AUTO:
+            fprintf(fd,"ONE PUSH)  ");
+            break;
+        }
+
+    }
+    if (f->absolute_capable)
+        fprintf(fd,"ABS  ");
+    fprintf(fd,"\n");
+
+    if (f->on_off_capable) {
+        if (f->is_on)
+            fprintf(fd,"\tFeature: ON  ");
+        else
+            fprintf(fd,"\tFeature: OFF  ");
+    }
+    else
+        fprintf(fd,"\t");
+
+    if (fid != DC1394_FEATURE_TRIGGER)
+        fprintf(fd,"min: %d max %d\n", f->min, f->max);
+
+    switch(fid) {
+    case DC1394_FEATURE_TRIGGER:
+        fprintf(fd,"\n\tAvailableTriggerModes: ");
+        if (f->trigger_modes.num==0) {
+            fprintf(fd,"none");
+        }
+        else {
+            int i;
+            for (i=0;i<f->trigger_modes.num;i++) {
+                fprintf(fd,"%d ",f->trigger_modes.modes[i]);
+            }
+        }
+        fprintf(fd,"\n\tAvailableTriggerSources: ");
+        if (f->trigger_sources.num==0) {
+            fprintf(fd,"none");
+        }
+        else {
+            int i;
+            for (i=0;i<f->trigger_sources.num;i++) {
+                fprintf(fd,"%d ",f->trigger_sources.sources[i]);
+            }
+        }
+        fprintf(fd,"\n\tPolarity Change Capable: ");
+
+        if (f->polarity_capable)
+            fprintf(fd,"True");
+        else
+            fprintf(fd,"False");
+
+        fprintf(fd,"\n\tCurrent Polarity: ");
+
+        if (f->trigger_polarity)
+            fprintf(fd,"POS");
+        else
+            fprintf(fd,"NEG");
+
+        fprintf(fd,"\n\tcurrent mode: %d\n", f->trigger_mode);
+        if (f->trigger_sources.num>0) {
+            fprintf(fd,"\n\tcurrent source: %d\n", f->trigger_source);
+        }
+        break;
+    case DC1394_FEATURE_WHITE_BALANCE:
+        fprintf(fd,"\tB/U value: %d R/V value: %d\n", f->BU_value, f->RV_value);
+        break;
+    case DC1394_FEATURE_TEMPERATURE:
+        fprintf(fd,"\tTarget temp: %d Current Temp: %d\n", f->target_value, f->value);
+        break;
+    case DC1394_FEATURE_WHITE_SHADING:
+        fprintf(fd,"\tR value: %d G value: %d B value: %d\n", f->R_value,
+                f->G_value, f->B_value);
+        break;
+    default:
+        fprintf(fd,"\tcurrent value is: %d\n",f->value);
+        break;
+    }
+    if (f->absolute_capable)
+        fprintf(fd,"\tabsolute settings:\n\t value: %f\n\t min: %f\n\t max: %f\n", f->abs_value,f->abs_min,f->abs_max);
+
+    return DC1394_SUCCESS;
+}
+
+/*****************************************************
+ dc1394_print_feature_set
+
+ Displays the entire feature set stored in features
+*****************************************************/
+dc1394error_t
+dc1394_feature_print_all(dc1394featureset_t *features, FILE *fd)
+{
+    uint32_t i, j;
+    dc1394error_t err=DC1394_SUCCESS;
+
+    fprintf(fd,"------ Features report ------\n");
+    fprintf(fd,"OP   - one push capable\n");
+    fprintf(fd,"RC   - readout capable\n");
+    fprintf(fd,"O/OC - on/off capable\n");
+    fprintf(fd,"AC   - auto capable\n");
+    fprintf(fd,"MC   - manual capable\n");
+    fprintf(fd,"ABS  - absolute capable\n");
+    fprintf(fd,"-----------------------------\n");
+
+    for (i= DC1394_FEATURE_MIN, j= 0; i <= DC1394_FEATURE_MAX; i++, j++)  {
+        err=dc1394_feature_print(&features->feature[j], fd);
+        DC1394_ERR_RTN(err, "Could not print feature");
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_camera_reset(dc1394camera_t *camera)
+{
+    dc1394error_t err;
+    err=dc1394_set_control_register(camera, REG_CAMERA_INITIALIZE, DC1394_FEATURE_ON);
+    DC1394_ERR_RTN(err, "Could not reset the camera");
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_supported_modes(dc1394camera_t *camera, dc1394video_modes_t *modes)
+{
+    dc1394error_t err;
+    uint32_t value, sup_formats;
+    dc1394video_mode_t mode;
+
+    // get supported formats
+    err=dc1394_get_control_register(camera, REG_CAMERA_V_FORMAT_INQ, &sup_formats);
+    DC1394_ERR_RTN(err, "Could not get supported formats");
+
+    // for each format check supported modes and add them as we find them.
+
+    modes->num=0;
+    // Format_0
+    if ((sup_formats & (0x1 << (31-(DC1394_FORMAT0-DC1394_FORMAT_MIN)))) > 0) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_V_MODE_INQ_BASE + ((DC1394_FORMAT0-DC1394_FORMAT_MIN) * 0x04U), &value);
+        DC1394_ERR_RTN(err, "Could not get supported modes for Format_0");
+
+        for (mode=DC1394_VIDEO_MODE_FORMAT0_MIN;mode<=DC1394_VIDEO_MODE_FORMAT0_MAX;mode++) {
+            if ((value & (0x1<<(31-(mode-DC1394_VIDEO_MODE_FORMAT0_MIN)))) > 0) {
+                modes->modes[modes->num]=mode;
+                modes->num++;
+            }
+        }
+    }
+    // Format_1
+    if ((sup_formats & (0x1 << (31-(DC1394_FORMAT1-DC1394_FORMAT_MIN)))) > 0) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_V_MODE_INQ_BASE + ((DC1394_FORMAT1-DC1394_FORMAT_MIN) * 0x04U), &value);
+        DC1394_ERR_RTN(err, "Could not get supported modes for Format_1");
+
+        for (mode=DC1394_VIDEO_MODE_FORMAT1_MIN;mode<=DC1394_VIDEO_MODE_FORMAT1_MAX;mode++) {
+            if ((value & (0x1<<(31-(mode-DC1394_VIDEO_MODE_FORMAT1_MIN)))) > 0) {
+                modes->modes[modes->num]=mode;
+                modes->num++;
+            }
+        }
+    }
+    // Format_2
+    if ((sup_formats & (0x1 << (31-(DC1394_FORMAT2-DC1394_FORMAT_MIN)))) > 0) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_V_MODE_INQ_BASE + ((DC1394_FORMAT2-DC1394_FORMAT_MIN) * 0x04U), &value);
+        DC1394_ERR_RTN(err, "Could not get supported modes for Format_2");
+
+        for (mode=DC1394_VIDEO_MODE_FORMAT2_MIN;mode<=DC1394_VIDEO_MODE_FORMAT2_MAX;mode++) {
+            if ((value & (0x1<<(31-(mode-DC1394_VIDEO_MODE_FORMAT2_MIN)))) > 0) {
+                modes->modes[modes->num]=mode;
+                modes->num++;
+            }
+        }
+    }
+    // Format_6
+    if ((sup_formats & (0x1 << (31-(DC1394_FORMAT6-DC1394_FORMAT_MIN)))) > 0) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_V_MODE_INQ_BASE + ((DC1394_FORMAT6-DC1394_FORMAT_MIN) * 0x04U), &value);
+        DC1394_ERR_RTN(err, "Could not get supported modes for Format_3");
+
+        for (mode=DC1394_VIDEO_MODE_FORMAT6_MIN;mode<=DC1394_VIDEO_MODE_FORMAT6_MAX;mode++) {
+            if ((value & (0x1<<(31-(mode-DC1394_VIDEO_MODE_FORMAT6_MIN))))>0) {
+                modes->modes[modes->num]=mode;
+                modes->num++;
+            }
+        }
+    }
+    // Format_7
+    if ((sup_formats & (0x1 << (31-(DC1394_FORMAT7-DC1394_FORMAT_MIN)))) > 0) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_V_MODE_INQ_BASE + ((DC1394_FORMAT7-DC1394_FORMAT_MIN) * 0x04U), &value);
+        DC1394_ERR_RTN(err, "Could not get supported modes for Format_4");
+
+        for (mode=DC1394_VIDEO_MODE_FORMAT7_MIN;mode<=DC1394_VIDEO_MODE_FORMAT7_MAX;mode++) {
+            if ((value & (0x1<<(31-(mode-DC1394_VIDEO_MODE_FORMAT7_MIN))))>0) {
+                modes->modes[modes->num]=mode;
+                modes->num++;
+            }
+        }
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_supported_framerates(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394framerates_t *framerates)
+{
+    dc1394framerate_t framerate;
+    dc1394error_t err;
+    uint32_t format;
+    uint32_t value;
+
+    err=get_format_from_mode(video_mode, &format);
+    DC1394_ERR_RTN(err, "Invalid mode code");
+
+    if ((format==DC1394_FORMAT6)||(format==DC1394_FORMAT7)) {
+        err=DC1394_INVALID_VIDEO_FORMAT;
+        DC1394_ERR_RTN(err, "Modes corresponding for format6 and format7 do not have framerates!");
+    }
+
+    switch (format) {
+    case DC1394_FORMAT0:
+        video_mode-=DC1394_VIDEO_MODE_FORMAT0_MIN;
+        break;
+    case DC1394_FORMAT1:
+        video_mode-=DC1394_VIDEO_MODE_FORMAT1_MIN;
+        break;
+    case DC1394_FORMAT2:
+        video_mode-=DC1394_VIDEO_MODE_FORMAT2_MIN;
+        break;
+    }
+    format-=DC1394_FORMAT_MIN;
+
+
+    err=dc1394_get_control_register(camera,REG_CAMERA_V_RATE_INQ_BASE + (format * 0x20U) + (video_mode * 0x04U), &value);
+    DC1394_ERR_RTN(err, "Could not get supported framerates");
+
+    framerates->num=0;
+    for (framerate=DC1394_FRAMERATE_MIN;framerate<=DC1394_FRAMERATE_MAX;framerate++) {
+        if ((value & (0x1<<(31-(framerate-DC1394_FRAMERATE_MIN))))>0) {
+            framerates->framerates[framerates->num]=framerate;
+            framerates->num++;
+        }
+    }
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_video_get_framerate(dc1394camera_t *camera, dc1394framerate_t *framerate)
+{
+    uint32_t value;
+    dc1394error_t err;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_FRAME_RATE, &value);
+    DC1394_ERR_RTN(err, "Could not get video framerate");
+
+    *framerate= (uint32_t)((value >> 29) & 0x7UL) + DC1394_FRAMERATE_MIN;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_set_framerate(dc1394camera_t *camera, dc1394framerate_t framerate)
+{
+    dc1394error_t err;
+    if ( (framerate < DC1394_FRAMERATE_MIN) || (framerate > DC1394_FRAMERATE_MAX) ) {
+        return DC1394_INVALID_FRAMERATE;
+    }
+
+    err=dc1394_set_control_register(camera, REG_CAMERA_FRAME_RATE, (uint32_t)(((framerate - DC1394_FRAMERATE_MIN) & 0x7UL) << 29));
+    DC1394_ERR_RTN(err, "Could not set video framerate");
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_mode(dc1394camera_t *camera, dc1394video_mode_t *mode)
+{
+    dc1394error_t err;
+    uint32_t value = 0; // set to zero to avoid valgrind errors
+    uint32_t format = 0; // set to zero to avoid valgrind errors
+
+    err= dc1394_get_control_register(camera, REG_CAMERA_VIDEO_FORMAT, &value);
+    DC1394_ERR_RTN(err, "Could not get video format");
+
+    format= (uint32_t)((value >> 29) & 0x7UL) + DC1394_FORMAT_MIN;
+
+    err= dc1394_get_control_register(camera, REG_CAMERA_VIDEO_MODE, &value);
+    DC1394_ERR_RTN(err, "Could not get video mode");
+
+    switch(format) {
+    case DC1394_FORMAT0:
+        *mode= (uint32_t)((value >> 29) & 0x7UL) + DC1394_VIDEO_MODE_FORMAT0_MIN;
+        break;
+    case DC1394_FORMAT1:
+        *mode= (uint32_t)((value >> 29) & 0x7UL) + DC1394_VIDEO_MODE_FORMAT1_MIN;
+        break;
+    case DC1394_FORMAT2:
+        *mode= (uint32_t)((value >> 29) & 0x7UL) + DC1394_VIDEO_MODE_FORMAT2_MIN;
+        break;
+    case DC1394_FORMAT6:
+        *mode= (uint32_t)((value >> 29) & 0x7UL) + DC1394_VIDEO_MODE_FORMAT6_MIN;
+        break;
+    case DC1394_FORMAT7:
+        *mode= (uint32_t)((value >> 29) & 0x7UL) + DC1394_VIDEO_MODE_FORMAT7_MIN;
+        break;
+    default:
+        return DC1394_INVALID_VIDEO_FORMAT;
+        break;
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_set_mode(dc1394camera_t *camera, dc1394video_mode_t  mode)
+{
+    uint32_t format, min;
+    dc1394error_t err;
+
+    if ( (mode<DC1394_VIDEO_MODE_MIN) || (mode>DC1394_VIDEO_MODE_MAX) )
+        return DC1394_INVALID_VIDEO_MODE;
+
+    err=get_format_from_mode(mode, &format);
+    DC1394_ERR_RTN(err, "Invalid video mode code");
+
+    switch(format) {
+    case DC1394_FORMAT0:
+        min= DC1394_VIDEO_MODE_FORMAT0_MIN;
+        break;
+    case DC1394_FORMAT1:
+        min= DC1394_VIDEO_MODE_FORMAT1_MIN;
+        break;
+    case DC1394_FORMAT2:
+        min= DC1394_VIDEO_MODE_FORMAT2_MIN;
+        break;
+    case DC1394_FORMAT6:
+        min= DC1394_VIDEO_MODE_FORMAT6_MIN;
+        break;
+    case DC1394_FORMAT7:
+        min= DC1394_VIDEO_MODE_FORMAT7_MIN;
+        break;
+    default:
+        return DC1394_INVALID_VIDEO_MODE;
+        break;
+    }
+
+    //if (format>FORMAT2)
+    //  format+=DC1394_FORMAT_GAP;
+
+    err=dc1394_set_control_register(camera, REG_CAMERA_VIDEO_FORMAT, (uint32_t)(((format - DC1394_FORMAT_MIN) & 0x7UL) << 29));
+    DC1394_ERR_RTN(err, "Could not set video format");
+
+    err=dc1394_set_control_register(camera, REG_CAMERA_VIDEO_MODE, (uint32_t)(((mode - min) & 0x7UL) << 29));
+    DC1394_ERR_RTN(err, "Could not set video mode");
+
+    return err;
+
+}
+
+dc1394error_t
+dc1394_video_get_iso_speed(dc1394camera_t *camera, dc1394speed_t *speed)
+{
+    dc1394error_t err;
+    uint32_t value;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO data");
+
+    if (camera->bmode_capable) { // check if 1394b is available
+        if (value & 0x00008000) { //check if we are now using 1394b
+            *speed= (uint32_t)(value& 0x7UL);
+            if ((*speed<DC1394_ISO_SPEED_MIN)||(*speed>DC1394_ISO_SPEED_MAX)) // abort if speed not within valid range
+                return DC1394_INVALID_ISO_SPEED;
+        }
+        else { // fallback to legacy
+            *speed= (uint32_t)((value >> 24) & 0x3UL);
+            if ((*speed<DC1394_ISO_SPEED_MIN)||(*speed>DC1394_ISO_SPEED_400)) // abort if speed not within valid range
+                return DC1394_INVALID_ISO_SPEED;
+        }
+    }
+    else { // legacy
+        *speed= (uint32_t)((value >> 24) & 0x3UL);
+        if ((*speed<DC1394_ISO_SPEED_MIN)||(*speed>DC1394_ISO_SPEED_400)) // abort if speed not within valid range
+            return DC1394_INVALID_ISO_SPEED;
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_set_iso_speed(dc1394camera_t *camera, dc1394speed_t speed)
+{
+    dc1394error_t err;
+    uint32_t value=0;
+    int channel;
+
+    if ((speed>DC1394_ISO_SPEED_MAX) || (speed<DC1394_ISO_SPEED_MIN))
+        return DC1394_INVALID_ISO_SPEED;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO data");
+
+    // check if 1394b is available and if we are now using 1394b
+    if ((camera->bmode_capable)&&(value & 0x00008000)) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+        DC1394_ERR_RTN(err, "oops");
+        channel=(value >> 8) & 0x3FUL;
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_DATA,
+                                        (uint32_t) ( ((channel & 0x3FUL) << 8) | (speed & 0x7UL) | (0x1 << 15) ));
+        DC1394_ERR_RTN(err, "oops");
+    }
+    else { // fallback to legacy
+        if (speed>DC1394_ISO_SPEED_400-DC1394_ISO_SPEED_MIN) {
+            dc1394_log_error("An ISO speed >400Mbps was requested while the camera is in LEGACY mode. Please set the operation mode to OPERATION_MODE_1394B before asking for 1394b ISO speeds");
+            return DC1394_INVALID_ISO_SPEED;
+        }
+        err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+        DC1394_ERR_RTN(err, "oops");
+        channel=(value >> 28) & 0xFUL;
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_DATA,
+                                        (uint32_t) (((channel & 0xFUL) << 28) |
+                                                    ((speed & 0x3UL) << 24) ));
+        DC1394_ERR_RTN(err, "Could not set ISO data register");
+    }
+
+    return err;;
+}
+
+dc1394error_t
+dc1394_video_get_iso_channel(dc1394camera_t *camera, uint32_t * channel)
+{
+    dc1394error_t err;
+    uint32_t value_inq, value;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_BASIC_FUNC_INQ, &value_inq);
+    DC1394_ERR_RTN(err, "Could not get basic function register");
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO data");
+
+    // check if 1394b is available and if we are now using 1394b
+    if ((value_inq & 0x00800000)&&(value & 0x00008000))
+        *channel = (value >> 8) & 0x3FUL;
+    else
+        *channel = (value >> 28) & 0xFUL;
+
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_video_set_iso_channel(dc1394camera_t *camera, uint32_t channel)
+{
+    dc1394error_t err;
+    uint32_t value_inq, value=0;
+    int speed;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_BASIC_FUNC_INQ, &value_inq);
+    DC1394_ERR_RTN(err, "Could not get basic function register");
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO data");
+
+    // check if 1394b is available and if we are now using 1394b
+    if ((value_inq & 0x00800000)&&(value & 0x00008000)) {
+        err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+        DC1394_ERR_RTN(err, "oops");
+        speed=value & 0x7UL;
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_DATA,
+                                        (uint32_t) ( ((channel & 0x3FUL) << 8) | (speed & 0x7UL) | (0x1 << 15) ));
+        DC1394_ERR_RTN(err, "oops");
+    }
+    else { // fallback to legacy
+        err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+        DC1394_ERR_RTN(err, "oops");
+        speed=(value >> 24) & 0x3UL;
+        if (speed>DC1394_ISO_SPEED_400-DC1394_ISO_SPEED_MIN) {
+            dc1394_log_error("an ISO speed >400Mbps was requested while the camera is in LEGACY mode              Please set the operation mode to OPERATION_MODE_1394B before asking for\n              1394b ISO speeds");
+            return DC1394_FAILURE;
+        }
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_DATA,
+                                        (uint32_t) (((channel & 0xFUL) << 28) | ((speed & 0x3UL) << 24) ));
+        DC1394_ERR_RTN(err, "Could not set ISO data register");
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_operation_mode(dc1394camera_t *camera, dc1394operation_mode_t  *mode)
+{
+    dc1394error_t err;
+    uint32_t value;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO data");
+
+    if (camera->bmode_capable==DC1394_TRUE) {
+        if ((value & 0x00008000) >0)
+            *mode=DC1394_OPERATION_MODE_1394B;
+        else
+            *mode=DC1394_OPERATION_MODE_LEGACY;
+    }
+    else {
+        *mode=DC1394_OPERATION_MODE_LEGACY;
+    }
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_video_set_operation_mode(dc1394camera_t *camera, dc1394operation_mode_t  mode)
+{
+    dc1394error_t err;
+    uint32_t value;
+
+    if ( (mode<DC1394_OPERATION_MODE_MIN) || (mode>DC1394_OPERATION_MODE_MAX) )
+        return DC1394_INVALID_OPERATION_MODE;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_ISO_DATA, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO data");
+
+    if (mode==DC1394_OPERATION_MODE_LEGACY) {
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_DATA, (uint32_t) (value & 0xFFFF7FFF));
+        DC1394_ERR_RTN(err, "Could not set ISO data");
+    }
+    else { // 1394b
+        if (camera->bmode_capable) { // if 1394b available
+            err=dc1394_set_control_register(camera, REG_CAMERA_ISO_DATA, (uint32_t) (value | 0x00008000));
+            DC1394_ERR_RTN(err, "Could not set ISO data");
+        }
+        else { // 1394b asked, but it is not available
+            return DC1394_FUNCTION_NOT_SUPPORTED;
+        }
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+dc1394error_t
+dc1394_camera_set_power(dc1394camera_t *camera, dc1394switch_t pwr)
+{
+    dc1394error_t err;
+    switch (pwr) {
+    case DC1394_ON:
+        err=dc1394_set_control_register(camera, REG_CAMERA_POWER, DC1394_FEATURE_ON);
+        DC1394_ERR_RTN(err, "Could not switch camera ON");
+        break;
+    case DC1394_OFF:
+        err=dc1394_set_control_register(camera, REG_CAMERA_POWER, DC1394_FEATURE_OFF);
+        DC1394_ERR_RTN(err, "Could not switch camera OFF");
+        break;
+    default:
+        err=DC1394_INVALID_ARGUMENT_VALUE;
+        DC1394_ERR_RTN(err, "Invalid switch value");
+    }
+    return err;
+}
+
+dc1394error_t
+dc1394_video_set_transmission(dc1394camera_t *camera, dc1394switch_t pwr)
+{
+    dc1394error_t err;
+
+    if (pwr==DC1394_ON) {
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_EN, DC1394_FEATURE_ON);
+        DC1394_ERR_RTN(err, "Could not start ISO transmission");
+    }
+    else {
+        // first we stop ISO
+        err=dc1394_set_control_register(camera, REG_CAMERA_ISO_EN, DC1394_FEATURE_OFF);
+        DC1394_ERR_RTN(err, "Could not stop ISO transmission");
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_transmission(dc1394camera_t *camera, dc1394switch_t *is_on)
+{
+    dc1394error_t err;
+    uint32_t value;
+    err= dc1394_get_control_register(camera, REG_CAMERA_ISO_EN, &value);
+    DC1394_ERR_RTN(err, "Could not get ISO status");
+
+    *is_on= (value & DC1394_FEATURE_ON)>>31;
+    return err;
+}
+
+dc1394error_t
+dc1394_video_set_one_shot(dc1394camera_t *camera, dc1394switch_t pwr)
+{
+    dc1394error_t err;
+    switch (pwr) {
+    case DC1394_ON:
+        err=dc1394_set_control_register(camera, REG_CAMERA_ONE_SHOT, DC1394_FEATURE_ON);
+        DC1394_ERR_RTN(err, "Could not set one-shot");
+        break;
+    case DC1394_OFF:
+        err=dc1394_set_control_register(camera, REG_CAMERA_ONE_SHOT, DC1394_FEATURE_OFF);
+        DC1394_ERR_RTN(err, "Could not unset one-shot");
+        break;
+    default:
+        err=DC1394_INVALID_ARGUMENT_VALUE;
+        DC1394_ERR_RTN(err, "Invalid switch value");
+    }
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_one_shot(dc1394camera_t *camera, dc1394bool_t *is_on)
+{
+    uint32_t value;
+    dc1394error_t err = dc1394_get_control_register(camera, REG_CAMERA_ONE_SHOT, &value);
+    DC1394_ERR_RTN(err, "Could not get one-shot status");
+    *is_on = ( value & DC1394_FEATURE_ON) ? DC1394_TRUE : DC1394_FALSE;
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_multi_shot(dc1394camera_t *camera, dc1394bool_t *is_on, uint32_t *numFrames)
+{
+    uint32_t value;
+    dc1394error_t err = dc1394_get_control_register(camera, REG_CAMERA_ONE_SHOT, &value);
+    DC1394_ERR_RTN(err, "Could not get multishot status");
+    *is_on = (value & (DC1394_FEATURE_ON>>1)) >> 30;
+    *numFrames= value & 0xFFFFUL;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_set_multi_shot(dc1394camera_t *camera, uint32_t numFrames, dc1394switch_t pwr)
+{
+    dc1394error_t err;
+    switch (pwr) {
+    case DC1394_ON:
+        err=dc1394_set_control_register(camera, REG_CAMERA_ONE_SHOT, (0x40000000UL | (numFrames & 0xFFFFUL)));
+        DC1394_ERR_RTN(err, "Could not set multishot");
+        break;
+    case DC1394_OFF:
+        err=dc1394_video_set_one_shot(camera,pwr);
+        DC1394_ERR_RTN(err, "Could not unset multishot");
+        break;
+    default:
+        err=DC1394_INVALID_ARGUMENT_VALUE;
+        DC1394_ERR_RTN(err, "Invalid switch value");
+    }
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_whitebalance_get_value(dc1394camera_t *camera, uint32_t *u_b_value, uint32_t *v_r_value)
+{
+    uint32_t value;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_WHITE_BALANCE, &value);
+    DC1394_ERR_RTN(err, "Could not get white balance");
+
+    *u_b_value= (uint32_t)((value & 0xFFF000UL) >> 12);
+    *v_r_value= (uint32_t)(value & 0xFFFUL);
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_whitebalance_set_value(dc1394camera_t *camera, uint32_t u_b_value, uint32_t v_r_value)
+{
+    uint32_t curval;
+    dc1394error_t err;
+    err=dc1394_get_control_register(camera, REG_CAMERA_WHITE_BALANCE, &curval);
+    DC1394_ERR_RTN(err, "Could not get white balance");
+
+    curval= (curval & 0xFF000000UL) | ( ((u_b_value & 0xFFFUL) << 12) | (v_r_value & 0xFFFUL) );
+    err=dc1394_set_control_register(camera, REG_CAMERA_WHITE_BALANCE, curval);
+    DC1394_ERR_RTN(err, "Could not set white balance");
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_temperature_get_value(dc1394camera_t *camera, uint32_t *target_temperature, uint32_t *temperature)
+{
+    uint32_t value;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_TEMPERATURE, &value);
+    DC1394_ERR_RTN(err, "Could not get temperature");
+    *target_temperature= (uint32_t)((value >> 12) & 0xFFF);
+    *temperature= (uint32_t)(value & 0xFFFUL);
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_temperature_set_value(dc1394camera_t *camera, uint32_t target_temperature)
+{
+    dc1394error_t err;
+    uint32_t curval;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_TEMPERATURE, &curval);
+    DC1394_ERR_RTN(err, "Could not get temperature");
+
+    curval= (curval & 0xFF000FFFUL) | ((target_temperature & 0xFFFUL) << 12);
+    err= dc1394_set_control_register(camera, REG_CAMERA_TEMPERATURE, curval);
+    DC1394_ERR_RTN(err, "Could not set temperature");
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_whiteshading_get_value(dc1394camera_t *camera, uint32_t *r_value, uint32_t *g_value, uint32_t *b_value)
+{
+    uint32_t value;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_WHITE_SHADING, &value);
+    DC1394_ERR_RTN(err, "Could not get white shading");
+
+    *r_value= (uint32_t)((value & 0xFF0000UL) >> 16);
+    *g_value= (uint32_t)((value & 0xFF00UL) >> 8);
+    *b_value= (uint32_t)(value & 0xFFUL);
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_whiteshading_set_value(dc1394camera_t *camera, uint32_t r_value, uint32_t g_value, uint32_t b_value)
+{
+    uint32_t curval;
+
+    dc1394error_t err=dc1394_get_control_register(camera, REG_CAMERA_WHITE_SHADING, &curval);
+    DC1394_ERR_RTN(err, "Could not get white shading");
+
+    curval= (curval & 0xFF000000UL) | ( ((r_value & 0xFFUL) << 16) |
+                                        ((g_value & 0xFFUL) << 8) |
+                                         (b_value & 0xFFUL) );
+    err=dc1394_set_control_register(camera, REG_CAMERA_WHITE_SHADING, curval);
+    DC1394_ERR_RTN(err, "Could not set white shading");
+
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_get_mode(dc1394camera_t *camera, dc1394trigger_mode_t *mode)
+{
+    uint32_t value;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_TRIGGER_MODE, &value);
+    DC1394_ERR_RTN(err, "Could not get trigger mode");
+
+    *mode= (uint32_t)( ((value >> 16) & 0xFUL) );
+    if ((*mode)>5)
+        (*mode)-=8;
+    (*mode)+= DC1394_TRIGGER_MODE_MIN;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_set_mode(dc1394camera_t *camera, dc1394trigger_mode_t mode)
+{
+    dc1394error_t err;
+    uint32_t curval;
+
+    if ( (mode < DC1394_TRIGGER_MODE_MIN) || (mode > DC1394_TRIGGER_MODE_MAX) ) {
+        return DC1394_INVALID_TRIGGER_MODE;
+    }
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_TRIGGER_MODE, &curval);
+    DC1394_ERR_RTN(err, "Could not get trigger mode");
+
+    mode-= DC1394_TRIGGER_MODE_MIN;
+    if (mode>5)
+        mode+=8;
+    curval= (curval & 0xFFF0FFFFUL) | ((mode & 0xFUL) << 16);
+    err=dc1394_set_control_register(camera, REG_CAMERA_TRIGGER_MODE, curval);
+    DC1394_ERR_RTN(err, "Could not set trigger mode");
+    return err;
+}
+
+
+dc1394error_t
+dc1394_external_trigger_get_supported_sources(dc1394camera_t *camera, dc1394trigger_sources_t *sources)
+{
+    uint32_t value;
+    dc1394error_t err;
+    uint64_t offset;
+    int i;
+
+    FEATURE_TO_INQUIRY_OFFSET(DC1394_FEATURE_TRIGGER, offset);
+    err=dc1394_get_control_register(camera, offset, &value);
+    DC1394_ERR_RTN(err,"Could not query supported trigger sources");
+
+    sources->num=0;
+    for (i = 0; i < DC1394_TRIGGER_SOURCE_NUM; i++) {
+        if (value & (0x1 << (23-i-(i>3)*3))){
+            sources->sources[sources->num]=i+DC1394_TRIGGER_SOURCE_MIN;
+            sources->num++;
+        }
+    }
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_external_trigger_get_source(dc1394camera_t *camera, dc1394trigger_source_t *source)
+{
+    uint32_t value;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_TRIGGER_MODE, &value);
+    DC1394_ERR_RTN(err, "Could not get trigger source");
+
+    *source= (uint32_t)( ((value >> 21) & 0x7UL) );
+    if (*source > 3)
+        *source -= 3;
+    (*source)+= DC1394_TRIGGER_SOURCE_MIN;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_set_source(dc1394camera_t *camera, dc1394trigger_source_t source)
+{
+    dc1394error_t err;
+    uint32_t curval;
+
+    if ( (source < DC1394_TRIGGER_SOURCE_MIN) || (source > DC1394_TRIGGER_SOURCE_MAX) ) {
+        return DC1394_INVALID_TRIGGER_SOURCE;
+    }
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_TRIGGER_MODE, &curval);
+    DC1394_ERR_RTN(err, "Could not get trigger source");
+
+    source-= DC1394_TRIGGER_SOURCE_MIN;
+    if (source > 3)
+        source += 3;
+    curval= (curval & 0xFF1FFFFFUL) | ((source & 0x7UL) << 21);
+    err=dc1394_set_control_register(camera, REG_CAMERA_TRIGGER_MODE, curval);
+    DC1394_ERR_RTN(err, "Could not set trigger source");
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_get_value(dc1394camera_t *camera, dc1394feature_t feature, uint32_t *value)
+{
+    uint32_t quadval;
+    uint64_t offset;
+    dc1394error_t err;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    if ((feature==DC1394_FEATURE_WHITE_BALANCE)||
+        (feature==DC1394_FEATURE_WHITE_SHADING)||
+        (feature==DC1394_FEATURE_TEMPERATURE)) {
+        err=DC1394_INVALID_FEATURE;
+        DC1394_ERR_RTN(err, "You should use the specific functions to read from multiple-value features");
+    }
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get feature value");
+    *value= (uint32_t)(quadval & 0xFFFUL);
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_set_value(dc1394camera_t *camera, dc1394feature_t feature, uint32_t value)
+{
+    uint32_t quadval;
+    uint64_t offset;
+    dc1394error_t err;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    if ((feature==DC1394_FEATURE_WHITE_BALANCE)||
+        (feature==DC1394_FEATURE_WHITE_SHADING)||
+        (feature==DC1394_FEATURE_TEMPERATURE)) {
+        err=DC1394_INVALID_FEATURE;
+        DC1394_ERR_RTN(err, "You should use the specific functions to write from multiple-value features");
+    }
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get feature value");
+
+    err=dc1394_set_control_register(camera, offset, (quadval & 0xFFFFF000UL) | (value & 0xFFFUL));
+    DC1394_ERR_RTN(err, "Could not set feature value");
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_is_present(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value)
+{
+/*
+
+  NOTE ON FEATURE PRESENCE DETECTION:
+
+  The IIDC specs have 3 locations where the feature presence is notified, at offsets 0x40X,
+  0x5XX and 0x8XX. The specs do not give any difference between the different locations,
+  leading to different interpretations by different manufacturers, or even from model to
+  model. Firmware revisions may also reflect a change in interpretation by a company. This
+  problem is acknowledged by the IIDC working group and will be resolved in IIDC 1.32.
+
+  In the meantime, the policy of libdc1394 is to make an AND of the three locations to
+  determine if a feature is available or not. No other verifications is performed.
+
+  Some manufacturer may choose to indicate feature presence by other means, such as setting
+  a feature OFF and simultaneously disabling the capability to turn the feature ON. Another
+  technique is to disable all control means (on/off, manual, auto, absolute, etc.),
+  effectively resulting in a feature that can't be used.
+
+  This kind of interpretation could be implemented in libdc1394. However, the feature may
+  still be writable even if it is not possible to use it. To allow this off-state writing,
+  the decision on whether a feature is available or not is not taking this into account.
+
+  Damien
+
+  */
+
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    *value=DC1394_FALSE;
+
+    if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) {
+        return DC1394_INVALID_FEATURE;
+    }
+
+    if (feature < DC1394_FEATURE_ZOOM) {
+        offset= REG_CAMERA_FEATURE_HI_INQ;
+    }
+    else {
+        offset= REG_CAMERA_FEATURE_LO_INQ;
+    }
+
+    // check feature presence in 0x40x
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get register for feature");
+
+    if (is_feature_bit_set(quadval, feature)!=DC1394_TRUE) {
+        *value=DC1394_FALSE;
+        return DC1394_SUCCESS;
+    }
+
+    // if feature is present in 0x40x, check for availability in 0x5xx
+    FEATURE_TO_INQUIRY_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get register for feature");
+
+    if (quadval & 0x80000000UL) {
+        *value= DC1394_TRUE;
+    }
+    else {
+        *value= DC1394_FALSE;
+        return DC1394_SUCCESS;
+    }
+
+    // if feature is present in 0x5xx, check for availability in 0x8xx
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get register for feature");
+
+    if (quadval & 0x80000000UL) {
+        *value= DC1394_TRUE;
+    }
+    else {
+        *value= DC1394_FALSE;
+        return DC1394_SUCCESS;
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_is_readable(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_INQUIRY_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get read-out capability for feature");
+
+    *value = (quadval & 0x08000000UL) ? DC1394_TRUE: DC1394_FALSE;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_is_switchable(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_INQUIRY_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get power capability for feature");
+
+    *value = (quadval & 0x04000000UL) ? DC1394_TRUE: DC1394_FALSE;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_get_power(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *value)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get feature status");
+
+    *value = (quadval & 0x02000000UL) ? DC1394_TRUE: DC1394_FALSE;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_set_power(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t value)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t curval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &curval);
+    DC1394_ERR_RTN(err, "Could not get feature register");
+
+    if (value && !(curval & 0x02000000UL)) {
+        curval|= 0x02000000UL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not set feature power");
+    }
+    else if (!value && (curval & 0x02000000UL)) {
+        curval&= 0xFDFFFFFFUL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not set feature power");
+    }
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_feature_get_modes(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_modes_t *modes)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    modes->num=0;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    if (feature == DC1394_FEATURE_TRIGGER) {
+        return DC1394_SUCCESS; // success, but no mode is available.
+    }
+
+    FEATURE_TO_INQUIRY_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get mode availability for feature");
+
+    if (quadval & 0x01000000UL) {
+        modes->modes[modes->num]=DC1394_FEATURE_MODE_MANUAL;
+        modes->num++;
+    }
+    if (quadval & 0x02000000UL) {
+        modes->modes[modes->num]=DC1394_FEATURE_MODE_AUTO;
+        modes->num++;
+    }
+    if (quadval & 0x10000000UL) {
+        modes->modes[modes->num]=DC1394_FEATURE_MODE_ONE_PUSH_AUTO;
+        modes->num++;
+    }
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_feature_get_mode(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t *mode)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    if ((feature == DC1394_FEATURE_TRIGGER)||
+        (feature == DC1394_FEATURE_TRIGGER_DELAY)) {
+        *mode=DC1394_FEATURE_MODE_MANUAL;
+    }
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get feature auto status");
+
+    if (quadval & 0x04000000UL) {
+        *mode= DC1394_FEATURE_MODE_ONE_PUSH_AUTO;
+    }
+    else if (quadval & 0x01000000UL) {
+        *mode= DC1394_FEATURE_MODE_AUTO;
+    }
+    else {
+        *mode= DC1394_FEATURE_MODE_MANUAL;
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_set_mode(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t mode)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t curval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    if ( (mode<DC1394_FEATURE_MODE_MIN) || (mode>DC1394_FEATURE_MODE_MAX) )
+        return DC1394_INVALID_FEATURE_MODE;
+
+    if (feature == DC1394_FEATURE_TRIGGER) {
+        return DC1394_INVALID_FEATURE;
+    }
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &curval);
+    DC1394_ERR_RTN(err, "Could not get feature register");
+
+    if ((mode==DC1394_FEATURE_MODE_AUTO) && !(curval & 0x01000000UL)) {
+        curval|= 0x01000000UL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not set auto mode for feature");
+    }
+    else if ((mode==DC1394_FEATURE_MODE_MANUAL) && (curval & 0x01000000UL)) {
+        curval&= 0xFEFFFFFFUL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not set auto mode for feature");
+    }
+    else if ((mode==DC1394_FEATURE_MODE_ONE_PUSH_AUTO)&& !(curval & 0x04000000UL)) {
+        curval|= 0x04000000UL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not sart one-push capability for feature");
+    }
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_get_boundaries(dc1394camera_t *camera, dc1394feature_t feature, uint32_t *min, uint32_t *max)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    if (feature == DC1394_FEATURE_TRIGGER) {
+        return DC1394_INVALID_FEATURE;
+    }
+
+    FEATURE_TO_INQUIRY_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get feature min value");
+
+    *min= (uint32_t)((quadval & 0xFFF000UL) >> 12);
+    *max= (uint32_t)(quadval & 0xFFFUL);
+    return err;
+}
+
+/*
+ * Memory load/save functions
+ */
+
+dc1394error_t
+dc1394_memory_busy(dc1394camera_t *camera, dc1394bool_t *value)
+{
+    uint32_t quadlet;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_MEMORY_SAVE, &quadlet);
+    DC1394_ERR_RTN(err, "Could not get memory busy status");
+    *value = (quadlet & DC1394_FEATURE_ON) >> 31;
+    return err;
+}
+
+dc1394error_t
+dc1394_memory_save(dc1394camera_t *camera, uint32_t channel)
+{
+    dc1394error_t err=dc1394_set_control_register(camera, REG_CAMERA_MEM_SAVE_CH, (uint32_t)((channel & 0xFUL) << 28));
+    DC1394_ERR_RTN(err, "Could not save memory channel");
+
+    err=dc1394_set_control_register(camera, REG_CAMERA_MEMORY_SAVE, DC1394_FEATURE_ON);
+    DC1394_ERR_RTN(err, "Could not save to memory");
+    return err;
+}
+
+dc1394error_t
+dc1394_memory_load(dc1394camera_t *camera, uint32_t channel)
+{
+    dc1394error_t err=dc1394_set_control_register(camera, REG_CAMERA_CUR_MEM_CH, (uint32_t)((channel & 0xFUL) << 28));
+    DC1394_ERR_RTN(err, "Could not load from memory");
+    return err;
+}
+
+/*
+ * Trigger functions
+ */
+
+dc1394error_t
+dc1394_external_trigger_set_polarity(dc1394camera_t *camera, dc1394trigger_polarity_t polarity)
+{
+    dc1394error_t err;
+    uint32_t curval;
+
+    if ( (polarity<DC1394_TRIGGER_ACTIVE_MIN) || (polarity>DC1394_TRIGGER_ACTIVE_MAX) )
+        return DC1394_INVALID_TRIGGER_POLARITY;
+
+    err=dc1394_get_control_register(camera, REG_CAMERA_TRIGGER_MODE, &curval);
+    DC1394_ERR_RTN(err, "Could not get trigger register");
+
+    curval= (curval & 0xFEFFFFFFUL) | ((polarity & 0x1UL) << 24);
+    err=dc1394_set_control_register(camera, REG_CAMERA_TRIGGER_MODE, curval);
+    DC1394_ERR_RTN(err, "Could not set set trigger polarity");
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_get_polarity(dc1394camera_t *camera, dc1394trigger_polarity_t *polarity)
+{
+    uint32_t value;
+    dc1394error_t err= dc1394_get_control_register(camera, REG_CAMERA_TRIGGER_MODE, &value);
+    DC1394_ERR_RTN(err, "Could not get trigger polarity");
+
+    *polarity= (uint32_t)( ((value >> 24) & 0x1UL) )+DC1394_TRIGGER_ACTIVE_MIN;
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_has_polarity(dc1394camera_t *camera, dc1394bool_t *polarity)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    offset= REG_CAMERA_FEATURE_HI_BASE_INQ;
+
+    err=dc1394_get_control_register(camera, offset + ((DC1394_FEATURE_TRIGGER - DC1394_FEATURE_MIN) * 0x04U), &quadval);
+    DC1394_ERR_RTN(err, "Could not get trigger polarity capability");
+
+    *polarity = (quadval & 0x02000000UL) ? DC1394_TRUE: DC1394_FALSE;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_set_power(dc1394camera_t *camera, dc1394switch_t pwr)
+{
+    dc1394error_t err=dc1394_feature_set_power(camera, DC1394_FEATURE_TRIGGER, pwr);
+    DC1394_ERR_RTN(err, "Could not set external trigger");
+    return err;
+}
+
+dc1394error_t
+dc1394_external_trigger_get_power(dc1394camera_t *camera, dc1394switch_t *pwr)
+{
+    dc1394error_t err=dc1394_feature_get_power(camera, DC1394_FEATURE_TRIGGER, pwr);
+    DC1394_ERR_RTN(err, "Could not set external trigger");
+    return err;
+}
+
+dc1394error_t
+dc1394_software_trigger_set_power(dc1394camera_t *camera, dc1394switch_t pwr)
+{
+    dc1394error_t err;
+
+    if (pwr==DC1394_ON) {
+        err=dc1394_set_control_register(camera, REG_CAMERA_SOFT_TRIGGER, DC1394_FEATURE_ON);
+    }
+    else {
+        err=dc1394_set_control_register(camera, REG_CAMERA_SOFT_TRIGGER, DC1394_FEATURE_OFF);
+    }
+    DC1394_ERR_RTN(err, "Could not set software trigger");
+    return err;
+}
+
+dc1394error_t
+dc1394_software_trigger_get_power(dc1394camera_t *camera, dc1394switch_t *pwr)
+{
+    uint32_t value;
+    dc1394error_t err = dc1394_get_control_register(camera, REG_CAMERA_SOFT_TRIGGER, &value);
+    DC1394_ERR_RTN(err, "Could not get software trigger status");
+
+    *pwr = (value & DC1394_FEATURE_ON)? DC1394_ON : DC1394_OFF;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_video_get_data_depth(dc1394camera_t *camera, uint32_t *depth)
+{
+    dc1394error_t err;
+    uint32_t value;
+    dc1394video_mode_t mode;
+    dc1394color_coding_t coding;
+
+    *depth = 0;
+    if (camera->iidc_version >= DC1394_IIDC_VERSION_1_31) {
+        err= dc1394_get_control_register(camera, REG_CAMERA_DATA_DEPTH, &value);
+        if (err==DC1394_SUCCESS)
+            *depth = value >> 24;
+    }
+
+    /* For cameras that do not have the DATA_DEPTH register, perform a
+       sane default. */
+    if (*depth == 0) {
+        err = dc1394_video_get_mode(camera, &mode);
+        DC1394_ERR_RTN(err, "Could not get video mode");
+
+        if (dc1394_is_video_mode_scalable (mode))
+            return dc1394_format7_get_data_depth (camera, mode, depth);
+
+        err = dc1394_get_color_coding_from_video_mode (camera, mode, &coding);
+        DC1394_ERR_RTN(err, "Could not get color coding");
+
+        err = dc1394_get_color_coding_data_depth (coding, depth);
+        DC1394_ERR_RTN(err, "Could not get data depth from color coding");
+
+        return err;
+    }
+
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_feature_get_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get get abs control for feature");
+
+    *pwr = (quadval & 0x40000000UL) ? DC1394_TRUE: DC1394_FALSE;
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_set_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t curval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_VALUE_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &curval);
+    DC1394_ERR_RTN(err, "Could not get abs setting status for feature");
+
+    if (pwr && !(curval & 0x40000000UL)) {
+        curval|= 0x40000000UL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not set absolute control for feature");
+    }
+    else if (!pwr && (curval & 0x40000000UL)) {
+        curval&= 0xBFFFFFFFUL;
+        err=dc1394_set_control_register(camera, offset, curval);
+        DC1394_ERR_RTN(err, "Could not set absolute control for feature");
+    }
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_feature_has_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value)
+{
+    dc1394error_t err;
+    uint64_t offset;
+    uint32_t quadval;
+
+    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
+        return DC1394_INVALID_FEATURE;
+
+    FEATURE_TO_INQUIRY_OFFSET(feature, offset);
+
+    err=dc1394_get_control_register(camera, offset, &quadval);
+    DC1394_ERR_RTN(err, "Could not get absolute control register for feature");
+
+    *value = (quadval & 0x40000000UL) ? DC1394_TRUE: DC1394_FALSE;
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_video_get_bandwidth_usage(dc1394camera_t *camera, uint32_t *bandwidth)
+{
+    uint32_t format, qpp;
+    dc1394video_mode_t video_mode;
+    dc1394speed_t speed;
+    dc1394framerate_t framerate=0;
+    dc1394error_t err;
+
+    // get format and mode
+    err=dc1394_video_get_mode(camera, &video_mode);
+    DC1394_ERR_RTN(err, "Could not get video mode");
+
+    err=get_format_from_mode(video_mode, &format);
+    DC1394_ERR_RTN(err, "Invalid mode ID");
+
+    if (format==DC1394_FORMAT7) {
+        // use the bytes per packet value:
+        err=dc1394_format7_get_packet_size(camera, video_mode, &qpp);
+        DC1394_ERR_RTN(err, "Could not get BPP");
+        qpp=qpp/4;
+    }
+    else {
+        // get the framerate:
+        err=dc1394_video_get_framerate(camera, &framerate);
+        DC1394_ERR_RTN(err, "Could not get framerate");
+        err=get_quadlets_per_packet(video_mode, framerate, &qpp);
+    }
+    // add the ISO header and footer:
+    qpp+=3;
+
+    // get camera ISO speed:
+    err=dc1394_video_get_iso_speed(camera, &speed);
+    DC1394_ERR_RTN(err, "Could not get ISO speed");
+
+    // mutiply by 4 anyway because the best speed is SPEED_400 only
+    if (speed>=DC1394_ISO_SPEED_1600)
+        *bandwidth = qpp >> (speed-DC1394_ISO_SPEED_1600);
+    else
+        *bandwidth = qpp << (DC1394_ISO_SPEED_1600-speed);
+
+    return err;
+}
+
+dc1394error_t
+dc1394_feature_get_absolute_boundaries(dc1394camera_t *camera, dc1394feature_t feature, float *min, float *max)
+{
+    dc1394error_t err=DC1394_SUCCESS;
+
+    if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) {
+        return DC1394_INVALID_FEATURE;
+    }
+
+    err=dc1394_get_absolute_register(camera, feature, REG_CAMERA_ABS_MAX, (uint32_t*)max);
+    DC1394_ERR_RTN(err,"Could not get maximal absolute value");
+    err=dc1394_get_absolute_register(camera, feature, REG_CAMERA_ABS_MIN, (uint32_t*)min);
+    DC1394_ERR_RTN(err,"Could not get minimal absolute value");
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_feature_get_absolute_value(dc1394camera_t *camera, dc1394feature_t feature, float *value)
+{
+    dc1394error_t err=DC1394_SUCCESS;
+
+    if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) {
+        return DC1394_INVALID_FEATURE;
+    }
+    err=dc1394_get_absolute_register(camera, feature, REG_CAMERA_ABS_VALUE, (uint32_t*)value);
+    DC1394_ERR_RTN(err,"Could not get current absolute value");
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_feature_set_absolute_value(dc1394camera_t *camera, dc1394feature_t feature, float value)
+{
+    dc1394error_t err=DC1394_SUCCESS;
+
+    uint32_t tempq;
+    memcpy(&tempq,&value,4);
+
+    if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) {
+        return DC1394_INVALID_FEATURE;
+    }
+
+    dc1394_set_absolute_register(camera, feature, REG_CAMERA_ABS_VALUE, tempq);
+    DC1394_ERR_RTN(err,"Could not get current absolute value");
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_pio_set(dc1394camera_t *camera, uint32_t value)
+{
+    dc1394error_t err=DC1394_SUCCESS;
+
+    err=dc1394_set_PIO_register(camera, REG_CAMERA_PIO_OUT, value);
+    DC1394_ERR_RTN(err,"Could not set PIO value");
+
+    return err;
+}
+
+
+dc1394error_t
+dc1394_pio_get(dc1394camera_t *camera, uint32_t *value)
+{
+    dc1394error_t err=DC1394_SUCCESS;
+
+    err=dc1394_get_PIO_register(camera, REG_CAMERA_PIO_IN, value);
+    DC1394_ERR_RTN(err,"Could not get PIO value");
+
+    return err;
+}
+
+/*******************************************************************************
+   New API for camera detection. For now we only have wrappers around existing
+   functions, which is of course far from optimal.
+ *******************************************************************************/
+
+/*
+  Create a new dc1394 struct, which also initialises the library
+*/
+dc1394_t *
+dc1394_new (void)
+{
+    dc1394_t * d = calloc (1, sizeof (dc1394_t));
+#ifdef HAVE_LINUX
+#ifdef HAVE_LIBRAW1394
+    linux_init (d);
+#endif
+    juju_init (d);
+#endif
+#ifdef HAVE_MACOSX
+    macosx_init (d);
+#endif
+#ifdef HAVE_WINDOWS
+    windows_init (d);
+#endif
+#ifdef HAVE_LIBUSB
+    dc1394_usb_init (d);
+#endif
+
+    int i;
+    int initializations = 0;
+    for (i = 0; i < d->num_platforms; i++) {
+        dc1394_log_debug ("Initializing platform %d: %s",
+                i, d->platforms[i].name);
+        d->platforms[i].p = d->platforms[i].dispatch->platform_new ();
+        if (d->platforms[i].p) {
+            initializations++;
+            dc1394_log_debug ("Initialized platform %d", i);
+        }
+        else {
+            dc1394_log_debug ("Failed to initialize platform %d", i);
+        }
+    }
+
+    if (initializations == 0) {
+        dc1394_free (d);
+        dc1394_log_error ("Failed to initialize libdc1394");
+        return NULL;
+    }
+    return d;
+}
+
+/*
+  Free a dc1394 struct, which also terminates the use of the library
+*/
+void
+dc1394_free (dc1394_t * d)
+{
+    free_enumeration (d);
+    int i;
+    for (i = 0; i < d->num_platforms; i++) {
+        if (d->platforms[i].p)
+            d->platforms[i].dispatch->platform_free (d->platforms[i].p);
+        d->platforms[i].p = NULL;
+    }
+    free (d->platforms);
+    d->platforms = NULL;
+    free (d);
+}
+
+void register_platform (dc1394_t * d, const platform_dispatch_t * dispatch,
+        const char * name)
+{
+    if (!dispatch->platform_new || !dispatch->platform_free ||
+            !dispatch->get_device_list || !dispatch->free_device_list ||
+            !dispatch->device_get_config_rom ||
+            !dispatch->camera_new || !dispatch->camera_free ||
+            !dispatch->camera_set_parent || !dispatch->camera_read ||
+            !dispatch->camera_write) {
+        dc1394_log_error ("Platform %s is missing required functions", name);
+        return;
+    }
+    int n = d->num_platforms;
+    d->platforms = realloc(d->platforms, (n+1)*sizeof(platform_info_t));
+    d->platforms[n].dispatch = dispatch;
+    d->platforms[n].name = name;
+    d->platforms[n].device_list = NULL;
+    d->platforms[n].p = NULL;
+    d->num_platforms++;
+}
+
+char *
+get_leaf_string (platform_camera_t * pcam, const platform_dispatch_t * disp,
+        uint32_t offset)
+{
+    uint32_t quad;
+    int len, i;
+    char * str;
+
+    if (disp->camera_read (pcam, offset, &quad, 1) < 0)
+        return NULL;
+
+    len = quad >> 16;
+    str = malloc (4 * (len - 2) + 1);
+    for (i = 0; i < len - 2; i++) {
+        if (disp->camera_read (pcam, offset + 12 + 4 * i, &quad, 1) < 0) {
+            free (str);
+            return NULL;
+        }
+        str[4*i+0] = quad >> 24;
+        str[4*i+1] = (quad >> 16) & 0xff;
+        str[4*i+2] = (quad >> 8) & 0xff;
+        str[4*i+3] = quad & 0xff;
+    }
+    str[4*i] = '\0';
+    return str;
+}
+
+dc1394camera_t *
+dc1394_camera_new_unit (dc1394_t * d, uint64_t guid, int unit)
+{
+    int i;
+    camera_info_t * info = NULL;
+    platform_camera_t * pcam;
+    const platform_dispatch_t * disp;
+    uint32_t command_regs_base = 0;
+    uint32_t vendor_name_offset = 0;
+    uint32_t model_name_offset = 0;
+    uint32_t unit_sub_sw_version = 0;
+    uint32_t ghigh, glow, quad;
+    uint32_t offset, num_entries;
+    dc1394camera_t * camera;
+    dc1394camera_priv_t * cpriv;
+
+    if (!d->num_cameras)
+        refresh_enumeration (d);
+
+    for (i = 0; i < d->num_cameras; i++) {
+        if (d->cameras[i].guid == guid &&
+            (unit < 0 || d->cameras[i].unit == unit)) {
+            info = d->cameras + i;
+            break;
+        }
+    }
+    if (!info)
+        return NULL;
+
+    disp = info->platform->dispatch;
+    pcam = disp->camera_new (info->platform->p, info->device,
+            info->unit_dependent_directory);
+    if (!pcam)
+        return NULL;
+
+    /* Check to make sure the GUID still matches. */
+    if (disp->camera_read (pcam, 0x40C, &ghigh, 1) < 0 ||
+        disp->camera_read (pcam, 0x410, &glow, 1) < 0)
+        goto fail;
+
+    if (ghigh != (info->guid >> 32) || glow != (info->guid & 0xffffffff))
+        goto fail;
+
+    if (disp->camera_read (pcam, info->unit_dependent_directory,
+                &quad, 1) < 0)
+        goto fail;
+
+    num_entries = quad >> 16;
+    offset = info->unit_dependent_directory + 4;
+    for (i = 0; i < num_entries; i++) {
+        if (disp->camera_read (pcam, offset + 4 * i, &quad, 1) < 0)
+            goto fail;
+        if ((quad >> 24) == 0x40)
+            command_regs_base = quad & 0xffffff;
+        else if ((quad >> 24) == 0x81) {
+            /*
+               The iSight version 1.0.3 has two 0x81 (vendor) leaves instead
+               of a 0x81 and a 0x82 (model leaf). To go around this problem,
+               we save the second vendor leaf as the model leaf. This is safe
+               because if there is two 0x81 AND a 0x82, the real model leaf
+               will overwrite the spurious second vendor string.
+            */
+            if (vendor_name_offset==0)
+                vendor_name_offset = offset + 4 * ((quad & 0xffffff) + i);
+            else
+                model_name_offset = offset + 4 * ((quad & 0xffffff) + i);
+        }
+        else if ((quad >> 24) == 0x82)
+            model_name_offset = offset + 4 * ((quad & 0xffffff) + i);
+        else if ((quad >> 24) == 0x38)
+            unit_sub_sw_version = quad & 0xffffff;
+    }
+
+    if (!command_regs_base)
+        goto fail;
+
+    camera = calloc (1, sizeof (dc1394camera_priv_t));
+    cpriv = DC1394_CAMERA_PRIV (camera);
+
+    cpriv->pcam = pcam;
+    cpriv->platform = info->platform;
+    camera->guid = info->guid;
+    camera->unit = info->unit;
+    camera->unit_spec_ID = info->unit_spec_ID;
+    camera->unit_sw_version = info->unit_sw_version;
+    camera->unit_sub_sw_version = unit_sub_sw_version;
+    camera->unit_directory = info->unit_directory;
+    camera->unit_dependent_directory = info->unit_dependent_directory;
+    camera->command_registers_base = command_regs_base * 4;
+    camera->vendor_id = info->vendor_id;
+    camera->model_id = info->model_id;
+
+    camera->vendor = get_leaf_string (pcam, disp, vendor_name_offset);
+    camera->model = get_leaf_string (pcam, disp, model_name_offset);
+
+    if (camera->unit_spec_ID == 0xA02D) {
+        if (info->unit_sw_version == 0x100)
+            camera->iidc_version = DC1394_IIDC_VERSION_1_04;
+        else if (info->unit_sw_version == 0x101)
+            camera->iidc_version = DC1394_IIDC_VERSION_1_20;
+        else if (info->unit_sw_version == 0x102) {
+            camera->iidc_version = DC1394_IIDC_VERSION_1_30;
+            // only add sub_sw_version if it is valid. Otherwise
+            // consider that it's IIDC 1.30 (hence add nothing)
+            if ((unit_sub_sw_version >> 4)<=9)
+                camera->iidc_version += unit_sub_sw_version >> 4;
+        }
+    }
+    else
+        camera->iidc_version = DC1394_IIDC_VERSION_PTGREY;
+
+    disp->camera_set_parent (cpriv->pcam, camera);
+    update_camera_info (camera);
+
+    return camera;
+
+ fail:
+    disp->camera_free (pcam);
+    return NULL;
+}
+
+dc1394camera_t *
+dc1394_camera_new (dc1394_t * d, uint64_t guid)
+{
+    return dc1394_camera_new_unit (d, guid, -1);
+}
+
+/*
+  Free a camera structure as well as resources used by that camera (bandwidth,
+  ISO channels, etc...)
+*/
+void
+dc1394_camera_free(dc1394camera_t *camera)
+{
+    dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
+
+    if (cpriv->iso_persist!=1)
+        dc1394_iso_release_all(camera);
+
+    cpriv->platform->dispatch->camera_free (cpriv->pcam);
+    free (camera->vendor);
+    free (camera->model);
+    free (camera);
+}
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/control.h b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/control.h
new file mode 100644 (file)
index 0000000..eb4202b
--- /dev/null
@@ -0,0 +1,456 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Generic camera control functions
+ *
+ * Written by Damien Douxchamps <ddouxchamps@users.sf.net>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <dc1394/log.h>
+
+#ifndef __DC1394_CONTROL_H__
+#define __DC1394_CONTROL_H__
+
+/*! \file dc1394/control.h
+    \brief Diverse controls of camera features
+    \author Gord Peters: main writer
+    \author Chris Urmson: some additions
+    \author Damien Douxchamps: some additions
+    \author Peter Antoniac: documentation maintainer
+    \author Rudolf Leitgeb: documentation writer
+
+    This is the main include file of the library. It lists most of the library
+    functions, enumerations and data structures.
+*/
+
+/**
+ * Enumeration of trigger modes
+ */
+typedef enum {
+    DC1394_TRIGGER_MODE_0= 384,
+    DC1394_TRIGGER_MODE_1,
+    DC1394_TRIGGER_MODE_2,
+    DC1394_TRIGGER_MODE_3,
+    DC1394_TRIGGER_MODE_4,
+    DC1394_TRIGGER_MODE_5,
+    DC1394_TRIGGER_MODE_14,
+    DC1394_TRIGGER_MODE_15
+} dc1394trigger_mode_t;
+#define DC1394_TRIGGER_MODE_MIN     DC1394_TRIGGER_MODE_0
+#define DC1394_TRIGGER_MODE_MAX     DC1394_TRIGGER_MODE_15
+#define DC1394_TRIGGER_MODE_NUM    (DC1394_TRIGGER_MODE_MAX - DC1394_TRIGGER_MODE_MIN + 1)
+
+/**
+ * Enumeration of camera features
+ */
+typedef enum {
+    DC1394_FEATURE_BRIGHTNESS= 416,
+    DC1394_FEATURE_EXPOSURE,
+    DC1394_FEATURE_SHARPNESS,
+    DC1394_FEATURE_WHITE_BALANCE,
+    DC1394_FEATURE_HUE,
+    DC1394_FEATURE_SATURATION,
+    DC1394_FEATURE_GAMMA,
+    DC1394_FEATURE_SHUTTER,
+    DC1394_FEATURE_GAIN,
+    DC1394_FEATURE_IRIS,
+    DC1394_FEATURE_FOCUS,
+    DC1394_FEATURE_TEMPERATURE,
+    DC1394_FEATURE_TRIGGER,
+    DC1394_FEATURE_TRIGGER_DELAY,
+    DC1394_FEATURE_WHITE_SHADING,
+    DC1394_FEATURE_FRAME_RATE,
+    DC1394_FEATURE_ZOOM,
+    DC1394_FEATURE_PAN,
+    DC1394_FEATURE_TILT,
+    DC1394_FEATURE_OPTICAL_FILTER,
+    DC1394_FEATURE_CAPTURE_SIZE,
+    DC1394_FEATURE_CAPTURE_QUALITY
+} dc1394feature_t;
+#define DC1394_FEATURE_MIN           DC1394_FEATURE_BRIGHTNESS
+#define DC1394_FEATURE_MAX           DC1394_FEATURE_CAPTURE_QUALITY
+#define DC1394_FEATURE_NUM          (DC1394_FEATURE_MAX - DC1394_FEATURE_MIN + 1)
+
+/**
+ * Enumeration of trigger sources
+ */
+typedef enum {
+    DC1394_TRIGGER_SOURCE_0= 576,
+    DC1394_TRIGGER_SOURCE_1,
+    DC1394_TRIGGER_SOURCE_2,
+    DC1394_TRIGGER_SOURCE_3,
+    DC1394_TRIGGER_SOURCE_SOFTWARE
+} dc1394trigger_source_t;
+#define DC1394_TRIGGER_SOURCE_MIN      DC1394_TRIGGER_SOURCE_0
+#define DC1394_TRIGGER_SOURCE_MAX      DC1394_TRIGGER_SOURCE_SOFTWARE
+#define DC1394_TRIGGER_SOURCE_NUM     (DC1394_TRIGGER_SOURCE_MAX - DC1394_TRIGGER_SOURCE_MIN + 1)
+
+/**
+ * External trigger polarity
+ */
+typedef enum {
+    DC1394_TRIGGER_ACTIVE_LOW= 704,
+    DC1394_TRIGGER_ACTIVE_HIGH
+} dc1394trigger_polarity_t;
+#define DC1394_TRIGGER_ACTIVE_MIN    DC1394_TRIGGER_ACTIVE_LOW
+#define DC1394_TRIGGER_ACTIVE_MAX    DC1394_TRIGGER_ACTIVE_HIGH
+#define DC1394_TRIGGER_ACTIVE_NUM   (DC1394_TRIGGER_ACTIVE_MAX - DC1394_TRIGGER_ACTIVE_MIN + 1)
+
+/**
+ * Control modes for a feature (excl. absolute control)
+ */
+typedef enum {
+    DC1394_FEATURE_MODE_MANUAL= 736,
+    DC1394_FEATURE_MODE_AUTO,
+    DC1394_FEATURE_MODE_ONE_PUSH_AUTO
+} dc1394feature_mode_t;
+#define DC1394_FEATURE_MODE_MIN      DC1394_FEATURE_MODE_MANUAL
+#define DC1394_FEATURE_MODE_MAX      DC1394_FEATURE_MODE_ONE_PUSH_AUTO
+#define DC1394_FEATURE_MODE_NUM     (DC1394_FEATURE_MODE_MAX - DC1394_FEATURE_MODE_MIN + 1)
+
+/**
+ * List of feature modes
+ */
+typedef struct
+{
+    uint32_t                num;
+    dc1394feature_mode_t    modes[DC1394_FEATURE_MODE_NUM];
+} dc1394feature_modes_t;
+
+/**
+ * List of trigger modes
+ */
+typedef struct
+{
+    uint32_t                num;
+    dc1394trigger_mode_t    modes[DC1394_TRIGGER_MODE_NUM];
+} dc1394trigger_modes_t;
+
+/**
+ * List of trigger sources
+ */
+typedef struct
+{
+    uint32_t                num;
+    dc1394trigger_source_t  sources[DC1394_TRIGGER_SOURCE_NUM];
+} dc1394trigger_sources_t;
+
+/**
+ * A structure containing all information about a feature.
+ *
+ * Some fields are only valid for some features (e.g. trigger, white balance,...)
+ */
+typedef struct __dc1394feature_info_t_struct
+{
+    dc1394feature_t    id;
+    dc1394bool_t       available;
+    dc1394bool_t       absolute_capable;
+    dc1394bool_t       readout_capable;
+    dc1394bool_t       on_off_capable;
+    dc1394bool_t       polarity_capable;
+    dc1394switch_t     is_on;
+    dc1394feature_mode_t     current_mode;
+    dc1394feature_modes_t    modes;
+    dc1394trigger_modes_t    trigger_modes;
+    dc1394trigger_mode_t     trigger_mode;
+    dc1394trigger_polarity_t trigger_polarity;
+    dc1394trigger_sources_t  trigger_sources;
+    dc1394trigger_source_t   trigger_source;
+    uint32_t           min;
+    uint32_t           max;
+    uint32_t           value;
+    uint32_t           BU_value;
+    uint32_t           RV_value;
+    uint32_t           B_value;
+    uint32_t           R_value;
+    uint32_t           G_value;
+    uint32_t           target_value;
+
+    dc1394switch_t     abs_control;
+    float              abs_value;
+    float              abs_max;
+    float              abs_min;
+
+} dc1394feature_info_t;
+
+/**
+ * The list of features
+ */
+typedef struct __dc1394featureset_t
+{
+    dc1394feature_info_t    feature[DC1394_FEATURE_NUM];
+} dc1394featureset_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************************
+     Features
+ ***************************************************************************/
+
+/**
+ * Collects the available features for the camera described by node and stores them in features.
+ */
+dc1394error_t dc1394_feature_get_all(dc1394camera_t *camera, dc1394featureset_t *features);
+
+/**
+ * Stores the bounds and options associated with the feature described by feature->feature_id
+ */
+dc1394error_t dc1394_feature_get(dc1394camera_t *camera, dc1394feature_info_t *feature);
+
+/**
+ * Displays the bounds and options of the given feature
+ */
+dc1394error_t dc1394_feature_print(dc1394feature_info_t *feature, FILE *fd);
+
+/**
+ * Displays the bounds and options of every feature supported by the camera
+ */
+dc1394error_t dc1394_feature_print_all(dc1394featureset_t *features, FILE *fd);
+
+/**
+ * Gets the whitebalance values
+ */
+dc1394error_t dc1394_feature_whitebalance_get_value(dc1394camera_t *camera, uint32_t *u_b_value, uint32_t *v_r_value);
+
+/**
+ * Sets the whitebalance values
+ */
+dc1394error_t dc1394_feature_whitebalance_set_value(dc1394camera_t *camera, uint32_t u_b_value, uint32_t v_r_value);
+
+/**
+ * Gets the temperature values (target and current)
+ */
+dc1394error_t dc1394_feature_temperature_get_value(dc1394camera_t *camera, uint32_t *target_temperature, uint32_t *temperature);
+
+/**
+ * Sets the temperature values (target only) FIXME: COULD BE DROPPED? already in the standard feature_set_value()?
+ */
+dc1394error_t dc1394_feature_temperature_set_value(dc1394camera_t *camera, uint32_t target_temperature);
+
+/**
+ * Gets the white shading values
+ */
+dc1394error_t dc1394_feature_whiteshading_get_value(dc1394camera_t *camera, uint32_t *r_value, uint32_t *g_value, uint32_t *b_value);
+
+/**
+ * Sets the white shading values
+ */
+dc1394error_t dc1394_feature_whiteshading_set_value(dc1394camera_t *camera, uint32_t r_value, uint32_t g_value, uint32_t b_value);
+
+/**
+ * Gets the value of a feature
+ */
+dc1394error_t dc1394_feature_get_value(dc1394camera_t *camera, dc1394feature_t feature, uint32_t *value);
+
+/**
+ * Sets the value of a feature
+ */
+dc1394error_t dc1394_feature_set_value(dc1394camera_t *camera, dc1394feature_t feature, uint32_t value);
+
+/**
+ * Tells whether a feature is present or not
+ */
+dc1394error_t dc1394_feature_is_present(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
+
+/**
+ * Tells whether a feature is readable or not
+ */
+dc1394error_t dc1394_feature_is_readable(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
+
+/**
+ * Gets the boundaries of a feature
+ */
+dc1394error_t dc1394_feature_get_boundaries(dc1394camera_t *camera, dc1394feature_t feature, uint32_t *min, uint32_t *max);
+
+/**
+ * Tells whether a feature is switcheable or not (ON/OFF)
+ */
+dc1394error_t dc1394_feature_is_switchable(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
+
+/**
+ * Gets the power status of a feature (ON or OFF)
+ */
+dc1394error_t dc1394_feature_get_power(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr);
+
+/**
+ * Sets the power status of a feature (ON or OFF)
+ */
+dc1394error_t dc1394_feature_set_power(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr);
+
+/**
+ * Gets the list of control modes for a feature (manual, auto, etc...)
+ */
+dc1394error_t dc1394_feature_get_modes(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_modes_t *modes);
+
+/**
+ * Gets the current control modes for a feature
+ */
+dc1394error_t dc1394_feature_get_mode(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t *mode);
+
+/**
+ * Sets the current control modes for a feature
+ */
+dc1394error_t dc1394_feature_set_mode(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t mode);
+
+/**
+ * Tells whether a feature can be controlled in absolute mode
+ */
+dc1394error_t dc1394_feature_has_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
+
+/**
+ * Gets the absolute boundaries of a feature
+ */
+dc1394error_t dc1394_feature_get_absolute_boundaries(dc1394camera_t *camera, dc1394feature_t feature, float *min, float *max);
+
+/**
+ * Gets the absolute value of a feature
+ */
+dc1394error_t dc1394_feature_get_absolute_value(dc1394camera_t *camera, dc1394feature_t feature, float *value);
+
+/**
+ * Sets the absolute value of a feature
+ */
+dc1394error_t dc1394_feature_set_absolute_value(dc1394camera_t *camera, dc1394feature_t feature, float value);
+
+/**
+ * Gets the status of absolute control of a feature
+ */
+dc1394error_t dc1394_feature_get_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr);
+
+/**
+ * Sets the feature in absolute control mode (ON/OFF)
+ */
+dc1394error_t dc1394_feature_set_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr);
+
+/***************************************************************************
+     Trigger
+ ***************************************************************************/
+
+/**
+ * Sets the polarity of the external trigger
+ */
+dc1394error_t dc1394_external_trigger_set_polarity(dc1394camera_t *camera, dc1394trigger_polarity_t polarity);
+
+/**
+ * Gets the polarity of the external trigger
+ */
+dc1394error_t dc1394_external_trigger_get_polarity(dc1394camera_t *camera, dc1394trigger_polarity_t *polarity);
+
+/**
+ * Tells whether the external trigger can change its polarity or not.
+ */
+dc1394error_t dc1394_external_trigger_has_polarity(dc1394camera_t *camera, dc1394bool_t *polarity_capable);
+
+/**
+ * Switch between internal and external trigger
+ */
+dc1394error_t dc1394_external_trigger_set_power(dc1394camera_t *camera, dc1394switch_t pwr);
+
+/**
+ * Gets the status of the external trigger
+ */
+dc1394error_t dc1394_external_trigger_get_power(dc1394camera_t *camera, dc1394switch_t *pwr);
+
+/**
+ * Sets the external trigger mode
+ */
+dc1394error_t dc1394_external_trigger_set_mode(dc1394camera_t *camera, dc1394trigger_mode_t mode);
+
+/**
+ * Gets the external trigger mode
+ */
+dc1394error_t dc1394_external_trigger_get_mode(dc1394camera_t *camera, dc1394trigger_mode_t *mode);
+
+/**
+ * Sets the external trigger source
+ */
+dc1394error_t dc1394_external_trigger_set_source(dc1394camera_t *camera, dc1394trigger_source_t source);
+
+/**
+ * Gets the external trigger source
+ */
+dc1394error_t dc1394_external_trigger_get_source(dc1394camera_t *camera, dc1394trigger_source_t *source);
+
+/**
+ * Gets the list of available external trigger source
+ */
+dc1394error_t dc1394_external_trigger_get_supported_sources(dc1394camera_t *camera, dc1394trigger_sources_t *sources);
+
+/**
+ * Turn software trigger on or off
+ */
+dc1394error_t dc1394_software_trigger_set_power(dc1394camera_t *camera, dc1394switch_t pwr);
+
+/**
+ * Gets the state of software trigger
+ */
+dc1394error_t dc1394_software_trigger_get_power(dc1394camera_t *camera, dc1394switch_t *pwr);
+
+/***************************************************************************
+     PIO, SIO and Strobe Functions
+ ***************************************************************************/
+
+/**
+ * Sends a quadlet on the PIO (output)
+ */
+dc1394error_t dc1394_pio_set(dc1394camera_t *camera, uint32_t value);
+
+/**
+ * Gets the current quadlet at the PIO (input)
+ */
+dc1394error_t dc1394_pio_get(dc1394camera_t *camera, uint32_t *value);
+
+/***************************************************************************
+     Other functionalities
+ ***************************************************************************/
+
+/**
+ * reset a camera to factory default settings
+ */
+dc1394error_t dc1394_camera_reset(dc1394camera_t *camera);
+
+/**
+ * turn a camera on or off
+ */
+dc1394error_t dc1394_camera_set_power(dc1394camera_t *camera, dc1394switch_t pwr);
+
+/**
+ * Download a camera setup from the memory.
+ */
+dc1394error_t dc1394_memory_busy(dc1394camera_t *camera, dc1394bool_t *value);
+
+/**
+ * Uploads a camera setup in the memory.
+ *
+ * Note that this operation can only be performed a certain number of
+ * times for a given camera, as it requires reprogramming of an EEPROM.
+ */
+dc1394error_t dc1394_memory_save(dc1394camera_t *camera, uint32_t channel);
+
+/**
+ * Tells whether the writing of the camera setup in memory is finished or not.
+ */
+dc1394error_t dc1394_memory_load(dc1394camera_t *camera, uint32_t channel);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DC1394_CONTROL_H__ */
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/conversions.c b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/conversions.c
new file mode 100644 (file)
index 0000000..6148126
--- /dev/null
@@ -0,0 +1,1002 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Color conversion functions
+ *
+ * Written by Damien Douxchamps and Frederic Devernay
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include "conversions.h"
+
+// this should disappear...
+extern void swab();
+
+/**********************************************************************
+ *
+ *  CONVERSION FUNCTIONS TO YUV422
+ *
+ **********************************************************************/
+
+dc1394error_t
+dc1394_YUV422_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order)
+{
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        swab(src, dest, (width*height) << 1);
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        memcpy(dest,src, (width*height)<<1);
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+}
+
+dc1394error_t
+dc1394_YUV411_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order)
+{
+    register int i=(width*height) + ((width*height) >> 1) -1;
+    register int j=((width*height) << 1)-1;
+    register int y0, y1, y2, y3, u, v;
+
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        while (i >= 0) {
+            y3 = src[i--];
+            y2 = src[i--];
+            v  = src[i--];
+            y1 = src[i--];
+            y0 = src[i--];
+            u  = src[i--];
+
+            dest[j--] = v;
+            dest[j--] = y3;
+            dest[j--] = u;
+            dest[j--] = y2;
+
+            dest[j--] = v;
+            dest[j--] = y1;
+            dest[j--] = u;
+            dest[j--] = y0;
+        }
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        while (i >= 0) {
+            y3 = src[i--];
+            y2 = src[i--];
+            v  = src[i--];
+            y1 = src[i--];
+            y0 = src[i--];
+            u  = src[i--];
+
+            dest[j--] = y3;
+            dest[j--] = v;
+            dest[j--] = y2;
+            dest[j--] = u;
+
+            dest[j--] = y1;
+            dest[j--] = v;
+            dest[j--] = y0;
+            dest[j--] = u;
+        }
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+
+}
+
+dc1394error_t
+dc1394_YUV444_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order)
+{
+    register int i = (width*height) + ((width*height) << 1)-1;
+    register int j = ((width*height) << 1)-1;
+    register int y0, y1, u0, u1, v0, v1;
+
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        while (i >= 0) {
+            v1 = src[i--];
+            y1 = src[i--];
+            u1 = src[i--];
+            v0 = src[i--];
+            y0 = src[i--];
+            u0 = src[i--];
+
+            dest[j--] = (v0+v1) >> 1;
+            dest[j--] = y1;
+            dest[j--] = (u0+u1) >> 1;
+            dest[j--] = y0;
+        }
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        while (i >= 0) {
+            v1 = src[i--];
+            y1 = src[i--];
+            u1 = src[i--];
+            v0 = src[i--];
+            y0 = src[i--];
+            u0 = src[i--];
+
+            dest[j--] = y1;
+            dest[j--] = (v0+v1) >> 1;
+            dest[j--] = y0;
+      dest[j--] = (u0+u1) >> 1;
+        }
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+}
+
+dc1394error_t
+dc1394_MONO8_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order)
+{
+    if ((width%2)==0) {
+        // do it the quick way
+        register int i = width*height - 1;
+        register int j = (width*height << 1) - 1;
+        register int y0, y1;
+
+        switch (byte_order) {
+        case DC1394_BYTE_ORDER_YUYV:
+            while (i >= 0) {
+                y1 = src[i--];
+                y0 = src[i--];
+                dest[j--] = 128;
+                dest[j--] = y1;
+                dest[j--] = 128;
+                dest[j--] = y0;
+            }
+            return DC1394_SUCCESS;
+        case DC1394_BYTE_ORDER_UYVY:
+            while (i >= 0) {
+                y1 = src[i--];
+                y0 = src[i--];
+                dest[j--] = y1;
+                dest[j--] = 128;
+                dest[j--] = y0;
+                dest[j--] = 128;
+            }
+            return DC1394_SUCCESS;
+        default:
+            return DC1394_INVALID_BYTE_ORDER;
+        }
+    } else { // width*2 != dest_pitch
+        register int x, y;
+
+        //assert ((dest_pitch - 2*width)==1);
+
+        switch (byte_order) {
+        case DC1394_BYTE_ORDER_YUYV:
+            y=height;
+            while (y--) {
+                x=width;
+                while (x--) {
+                    *dest++ = *src++;
+                    *dest++ = 128;
+                }
+                // padding required, duplicate last column
+                *dest++ = *(src-1);
+                *dest++ = 128;
+            }
+            return DC1394_SUCCESS;
+        case DC1394_BYTE_ORDER_UYVY:
+            y=height;
+            while (y--) {
+                x=width;
+                while (x--) {
+                    *dest++ = 128;
+                    *dest++ = *src++;
+                }
+                // padding required, duplicate last column
+                *dest++ = 128;
+                *dest++ = *(src-1);
+            }
+            return DC1394_SUCCESS;
+        default:
+            return DC1394_INVALID_BYTE_ORDER;
+        }
+    }
+}
+
+dc1394error_t
+dc1394_MONO16_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order, uint32_t bits)
+{
+    register int i = ((width*height) << 1)-1;
+    register int j = ((width*height) << 1)-1;
+    register int y0, y1;
+
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        while (i >= 0) {
+            y1 = src[i--];
+            y1 = (y1 + (((int)src[i--])<<8))>>(bits-8);
+            y0 = src[i--];
+            y0 = (y0 + (((int)src[i--])<<8))>>(bits-8);
+            dest[j--] = 128;
+            dest[j--] = y1;
+            dest[j--] = 128;
+            dest[j--] = y0;
+        }
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        while (i >= 0) {
+            y1 = src[i--];
+            y1 = (y1 + (((int)src[i--])<<8))>>(bits-8);
+            y0 = src[i--];
+            y0 = (y0 + (((int)src[i--])<<8))>>(bits-8);
+            dest[j--] = y1;
+            dest[j--] = 128;
+            dest[j--] = y0;
+            dest[j--] = 128;
+        }
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+
+}
+
+dc1394error_t
+dc1394_MONO16_to_MONO8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t bits)
+{
+    register int i = ((width*height)<<1)-1;
+    register int j = (width*height)-1;
+    register int y;
+
+    while (i >= 0) {
+        y = src[i--];
+        dest[j--] = (y + (src[i--]<<8))>>(bits-8);
+    }
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_RGB8_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order)
+{
+    register int i = (width*height) + ( (width*height) << 1 )-1;
+    register int j = ((width*height) << 1)-1;
+    register int y0, y1, u0, u1, v0, v1 ;
+    register int r, g, b;
+
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        while (i >= 0) {
+            b = (uint8_t) src[i--];
+            g = (uint8_t) src[i--];
+            r = (uint8_t) src[i--];
+            RGB2YUV (r, g, b, y0, u0 , v0);
+            b = (uint8_t) src[i--];
+            g = (uint8_t) src[i--];
+            r = (uint8_t) src[i--];
+            RGB2YUV (r, g, b, y1, u1 , v1);
+            dest[j--] = (v0+v1) >> 1;
+            dest[j--] = y0;
+            dest[j--] = (u0+u1) >> 1;
+            dest[j--] = y1;
+        }
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        while (i >= 0) {
+            b = (uint8_t) src[i--];
+            g = (uint8_t) src[i--];
+            r = (uint8_t) src[i--];
+            RGB2YUV (r, g, b, y0, u0 , v0);
+            b = (uint8_t) src[i--];
+            g = (uint8_t) src[i--];
+            r = (uint8_t) src[i--];
+            RGB2YUV (r, g, b, y1, u1 , v1);
+            dest[j--] = y0;
+            dest[j--] = (v0+v1) >> 1;
+            dest[j--] = y1;
+            dest[j--] = (u0+u1) >> 1;
+        }
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+}
+
+dc1394error_t
+dc1394_RGB16_to_YUV422(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order, uint32_t bits)
+{
+    register int i = ( ((width*height) + ( (width*height) << 1 )) << 1 ) -1;
+    register int j = ((width*height) << 1)-1;
+    register int y0, y1, u0, u1, v0, v1 ;
+    register int r, g, b, t;
+
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        while (i >= 0) {
+            t =src[i--];
+            b = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            g = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            r = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            RGB2YUV (r, g, b, y0, u0 , v0);
+            t =src[i--];
+            b = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            g = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            r = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            RGB2YUV (r, g, b, y1, u1 , v1);
+            dest[j--] = (v0+v1) >> 1;
+            dest[j--] = y0;
+            dest[j--] = (u0+u1) >> 1;
+            dest[j--] = y1;
+        }
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        while (i >= 0) {
+            t =src[i--];
+            b = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            g = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            r = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            RGB2YUV (r, g, b, y0, u0 , v0);
+            t =src[i--];
+            b = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            g = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            t =src[i--];
+            r = (uint8_t) ((t + (src[i--]<<8)) >>(bits-8));
+            RGB2YUV (r, g, b, y1, u1 , v1);
+            dest[j--] = y0;
+            dest[j--] = (v0+v1) >> 1;
+            dest[j--] = y1;
+            dest[j--] = (u0+u1) >> 1;
+        }
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+}
+
+/**********************************************************************
+ *
+ *  CONVERSION FUNCTIONS TO RGB 24bpp
+ *
+ **********************************************************************/
+
+dc1394error_t
+dc1394_RGB16_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t bits)
+{
+    register int i = (((width*height) + ( (width*height) << 1 )) << 1)-1;
+    register int j = (width*height) + ( (width*height) << 1 ) -1;
+    register int t;
+
+    while (i >= 0) {
+        t = src[i--];
+        t = (t + (src[i--]<<8))>>(bits-8);
+        dest[j--]=t;
+        t = src[i--];
+        t = (t + (src[i--]<<8))>>(bits-8);
+        dest[j--]=t;
+        t = src[i--];
+        t = (t + (src[i--]<<8))>>(bits-8);
+        dest[j--]=t;
+    }
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+dc1394_YUV444_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height)
+{
+    register int i = (width*height) + ( (width*height) << 1 ) -1;
+    register int j = (width*height) + ( (width*height) << 1 ) -1;
+    register int y, u, v;
+    register int r, g, b;
+
+    while (i >= 0) {
+        v = (uint8_t) src[i--] - 128;
+        y = (uint8_t) src[i--];
+        u = (uint8_t) src[i--] - 128;
+        YUV2RGB (y, u, v, r, g, b);
+        dest[j--] = b;
+        dest[j--] = g;
+        dest[j--] = r;
+    }
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+dc1394_YUV422_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order)
+{
+    register int i = ((width*height) << 1)-1;
+    register int j = (width*height) + ( (width*height) << 1 ) -1;
+    register int y0, y1, u, v;
+    register int r, g, b;
+
+
+    switch (byte_order) {
+    case DC1394_BYTE_ORDER_YUYV:
+        while (i >= 0) {
+            v  = (uint8_t) src[i--] -128;
+            y1 = (uint8_t) src[i--];
+            u  = (uint8_t) src[i--] -128;
+            y0  = (uint8_t) src[i--];
+            YUV2RGB (y1, u, v, r, g, b);
+            dest[j--] = b;
+            dest[j--] = g;
+            dest[j--] = r;
+            YUV2RGB (y0, u, v, r, g, b);
+            dest[j--] = b;
+            dest[j--] = g;
+            dest[j--] = r;
+        }
+        return DC1394_SUCCESS;
+    case DC1394_BYTE_ORDER_UYVY:
+        while (i >= 0) {
+            y1 = (uint8_t) src[i--];
+            v  = (uint8_t) src[i--] - 128;
+            y0 = (uint8_t) src[i--];
+            u  = (uint8_t) src[i--] - 128;
+            YUV2RGB (y1, u, v, r, g, b);
+            dest[j--] = b;
+            dest[j--] = g;
+            dest[j--] = r;
+            YUV2RGB (y0, u, v, r, g, b);
+            dest[j--] = b;
+            dest[j--] = g;
+            dest[j--] = r;
+        }
+        return DC1394_SUCCESS;
+    default:
+        return DC1394_INVALID_BYTE_ORDER;
+    }
+
+}
+
+
+dc1394error_t
+dc1394_YUV411_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height)
+{
+    register int i = (width*height) + ( (width*height) >> 1 )-1;
+    register int j = (width*height) + ( (width*height) << 1 )-1;
+    register int y0, y1, y2, y3, u, v;
+    register int r, g, b;
+
+    while (i >= 0) {
+        y3 = (uint8_t) src[i--];
+        y2 = (uint8_t) src[i--];
+        v  = (uint8_t) src[i--] - 128;
+        y1 = (uint8_t) src[i--];
+        y0 = (uint8_t) src[i--];
+        u  = (uint8_t) src[i--] - 128;
+        YUV2RGB (y3, u, v, r, g, b);
+        dest[j--] = b;
+        dest[j--] = g;
+        dest[j--] = r;
+        YUV2RGB (y2, u, v, r, g, b);
+        dest[j--] = b;
+        dest[j--] = g;
+        dest[j--] = r;
+        YUV2RGB (y1, u, v, r, g, b);
+        dest[j--] = b;
+        dest[j--] = g;
+        dest[j--] = r;
+        YUV2RGB (y0, u, v, r, g, b);
+        dest[j--] = b;
+        dest[j--] = g;
+        dest[j--] = r;
+    }
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+dc1394_MONO8_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height)
+{
+    register int i = (width*height)-1;
+    register int j = (width*height) + ( (width*height) << 1 )-1;
+    register int y;
+
+    while (i >= 0) {
+        y = (uint8_t) src[i--];
+        dest[j--] = y;
+        dest[j--] = y;
+        dest[j--] = y;
+    }
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+dc1394_MONO16_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t bits)
+{
+    register int i = ((width*height) << 1)-1;
+    register int j = (width*height) + ( (width*height) << 1 )-1;
+    register int y;
+
+    while (i > 0) {
+        y = src[i--];
+        y = (y + (src[i--]<<8))>>(bits-8);
+        dest[j--] = y;
+        dest[j--] = y;
+        dest[j--] = y;
+    }
+    return DC1394_SUCCESS;
+}
+
+
+// change a 16bit stereo image (8bit/channel) into two 8bit images on top
+// of each other
+dc1394error_t
+dc1394_deinterlace_stereo(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height)
+{
+    register int i = (width*height)-1;
+    register int j = ((width*height)>>1)-1;
+    register int k = (width*height)-1;
+
+    while (i >= 0) {
+        dest[k--] = src[i--];
+        dest[j--] = src[i--];
+    }
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+dc1394_convert_to_YUV422(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
+                         dc1394color_coding_t source_coding, uint32_t bits)
+{
+    switch(source_coding) {
+    case DC1394_COLOR_CODING_YUV422:
+        return dc1394_YUV422_to_YUV422(src, dest, width, height, byte_order);
+        break;
+    case DC1394_COLOR_CODING_YUV411:
+        return dc1394_YUV411_to_YUV422(src, dest, width, height, byte_order);
+        break;
+    case DC1394_COLOR_CODING_YUV444:
+        return dc1394_YUV444_to_YUV422(src, dest, width, height, byte_order);
+        break;
+    case DC1394_COLOR_CODING_RGB8:
+        return dc1394_RGB8_to_YUV422(src, dest, width, height, byte_order);
+        break;
+    case DC1394_COLOR_CODING_MONO8:
+    case DC1394_COLOR_CODING_RAW8:
+        return dc1394_MONO8_to_YUV422(src, dest, width, height, byte_order);
+        break;
+    case DC1394_COLOR_CODING_MONO16:
+    case DC1394_COLOR_CODING_RAW16:
+        return dc1394_MONO16_to_YUV422(src, dest, width, height, byte_order, bits);
+        break;
+    case DC1394_COLOR_CODING_RGB16:
+        return dc1394_RGB16_to_YUV422(src, dest, width, height, byte_order, bits);
+        break;
+    default:
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    }
+
+    return DC1394_SUCCESS;
+
+}
+
+
+dc1394error_t
+dc1394_convert_to_MONO8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order,
+                        dc1394color_coding_t source_coding, uint32_t bits)
+{
+    switch(source_coding) {
+    case DC1394_COLOR_CODING_MONO16:
+        return dc1394_MONO16_to_MONO8(src, dest, width, height, bits);
+        break;
+    case DC1394_COLOR_CODING_MONO8:
+        memcpy(dest, src, width*height);
+        break;
+    default:
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    }
+
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+dc1394_convert_to_RGB8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t byte_order,
+                       dc1394color_coding_t source_coding, uint32_t bits)
+{
+    switch(source_coding) {
+    case DC1394_COLOR_CODING_RGB16:
+        return dc1394_RGB16_to_RGB8 (src, dest, width, height, bits);
+        break;
+    case DC1394_COLOR_CODING_YUV444:
+        return dc1394_YUV444_to_RGB8 (src, dest, width, height);
+        break;
+    case DC1394_COLOR_CODING_YUV422:
+        return dc1394_YUV422_to_RGB8 (src, dest, width, height, byte_order);
+        break;
+    case DC1394_COLOR_CODING_YUV411:
+        return dc1394_YUV411_to_RGB8 (src, dest, width, height);
+        break;
+    case DC1394_COLOR_CODING_MONO8:
+    case DC1394_COLOR_CODING_RAW8:
+        return dc1394_MONO8_to_RGB8 (src, dest, width, height);
+        break;
+    case DC1394_COLOR_CODING_MONO16:
+    case DC1394_COLOR_CODING_RAW16:
+        return dc1394_MONO16_to_RGB8 (src, dest, width, height,bits);
+        break;
+    case DC1394_COLOR_CODING_RGB8:
+      memcpy(dest, src, width*height*3);
+      break;
+    default:
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    }
+
+    return DC1394_SUCCESS;
+}
+
+dc1394error_t
+Adapt_buffer_convert(dc1394video_frame_t *in, dc1394video_frame_t *out)
+{
+    uint32_t bpp;
+
+    // conversions don't change the size of buffers or its position
+    out->size[0]=in->size[0];
+    out->size[1]=in->size[1];
+    out->position[0]=in->position[0];
+    out->position[1]=in->position[1];
+
+    // color coding has already been set before conversion: don't touch it.
+
+    // keep the color filter value in all cases. if the format is not raw it will not be further used anyway
+    out->color_filter=in->color_filter;
+
+    // the output YUV byte order must be already set if the buffer is YUV422 at the output
+    // if the output is not YUV we don't care about this field.
+    // Hence nothing to do.
+
+    // we always convert to 8bits (at this point) we can safely set this value to 8.
+    out->data_depth=8;
+
+    // don't know what to do with stride... >>>> TODO: STRIDE SHOULD BE TAKEN INTO ACCOUNT... <<<<
+    // out->stride=??
+
+    // the video mode should not change. Color coding and other stuff can be accessed in specific fields of this struct
+    out->video_mode = in->video_mode;
+
+    // padding is kept:
+    out->padding_bytes = in->padding_bytes;
+
+    // image bytes changes:    >>>> TODO: STRIDE SHOULD BE TAKEN INTO ACCOUNT... <<<<
+    dc1394_get_color_coding_bit_size(out->color_coding, &bpp);
+    out->image_bytes=(out->size[0]*out->size[1]*bpp)/8;
+
+    // total is image_bytes + padding_bytes
+    out->total_bytes = out->image_bytes + out->padding_bytes;
+
+    // bytes-per-packet and packets_per_frame are internal data that can be kept as is.
+    out->packet_size  = in->packet_size;
+    out->packets_per_frame = in->packets_per_frame;
+
+    // timestamp, frame_behind, id and camera are copied too:
+    out->timestamp = in->timestamp;
+    out->frames_behind = in->frames_behind;
+    out->camera = in->camera;
+    out->id = in->id;
+
+    // verify memory allocation:
+    if (out->total_bytes>out->allocated_image_bytes) {
+        free(out->image);
+        out->image=(uint8_t*)malloc(out->total_bytes*sizeof(uint8_t));
+        if (out->image)
+            out->allocated_image_bytes = out->total_bytes*sizeof(uint8_t);
+        else
+            out->allocated_image_bytes = 0;
+    }
+
+    // Copy padding bytes:
+    if(out->image)
+        memcpy(&(out->image[out->image_bytes]),&(in->image[in->image_bytes]),out->padding_bytes);
+
+    out->little_endian=0;   // not used before 1.32 is out.
+    out->data_in_padding=0; // not used before 1.32 is out.
+    
+    if(out->image)
+        return DC1394_SUCCESS;
+        
+    return DC1394_MEMORY_ALLOCATION_FAILURE;
+}
+
+dc1394error_t
+dc1394_convert_frames(dc1394video_frame_t *in, dc1394video_frame_t *out)
+{
+
+    switch(out->color_coding) {
+    case DC1394_COLOR_CODING_YUV422:
+        switch(in->color_coding) {
+        case DC1394_COLOR_CODING_YUV422:
+            
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_YUV422_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order);
+            break;
+            
+        case DC1394_COLOR_CODING_YUV411:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_YUV411_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order);
+            break;
+            
+        case DC1394_COLOR_CODING_YUV444:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_YUV444_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order);
+            break;
+            
+        case DC1394_COLOR_CODING_RGB8:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_RGB8_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order);
+            break;
+            
+        case DC1394_COLOR_CODING_MONO8:
+        case DC1394_COLOR_CODING_RAW8:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_MONO8_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order);
+            break;
+            
+        case DC1394_COLOR_CODING_MONO16:
+        case DC1394_COLOR_CODING_RAW16:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_MONO16_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order, in->data_depth);
+            break;
+            
+        case DC1394_COLOR_CODING_RGB16:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_RGB16_to_YUV422(in->image, out->image, in->size[0], in->size[1], out->yuv_byte_order, in->data_depth);
+            break;
+            
+        default:
+            return DC1394_FUNCTION_NOT_SUPPORTED;
+        }
+        break;
+    case DC1394_COLOR_CODING_MONO8:
+        switch(in->color_coding) {
+        case DC1394_COLOR_CODING_MONO16:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_MONO16_to_MONO8(in->image, out->image, in->size[0], in->size[1], in->data_depth);
+            break;
+            
+        case DC1394_COLOR_CODING_MONO8:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            memcpy(out->image, in->image, in->size[0]*in->size[1]);
+            break;
+            
+        default:
+            return DC1394_FUNCTION_NOT_SUPPORTED;
+        }
+        break;
+    case DC1394_COLOR_CODING_RGB8:
+        switch(in->color_coding) {
+        case DC1394_COLOR_CODING_RGB16:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_RGB16_to_RGB8 (in->image, out->image, in->size[0], in->size[1], in->data_depth);
+            break;
+            
+        case DC1394_COLOR_CODING_YUV444:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_YUV444_to_RGB8 (in->image, out->image, in->size[0], in->size[1]);
+            break;
+            
+        case DC1394_COLOR_CODING_YUV422:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_YUV422_to_RGB8 (in->image, out->image, in->size[0], in->size[1], in->yuv_byte_order);
+            break;
+            
+        case DC1394_COLOR_CODING_YUV411:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_YUV411_to_RGB8 (in->image, out->image, in->size[0], in->size[1]);
+            break;
+            
+        case DC1394_COLOR_CODING_MONO8:
+        case DC1394_COLOR_CODING_RAW8:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_MONO8_to_RGB8 (in->image, out->image, in->size[0], in->size[1]);
+            break;
+            
+        case DC1394_COLOR_CODING_MONO16:
+        case DC1394_COLOR_CODING_RAW16:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            return dc1394_MONO16_to_RGB8 (in->image, out->image, in->size[0], in->size[1],in->data_depth);
+            break;
+            
+        case DC1394_COLOR_CODING_RGB8:
+
+            if(DC1394_SUCCESS != Adapt_buffer_convert(in,out))
+                return DC1394_MEMORY_ALLOCATION_FAILURE;
+                
+            memcpy(out->image, in->image, in->size[0]*in->size[1]*3);
+            break;
+            
+        default:
+            return DC1394_FUNCTION_NOT_SUPPORTED;
+        }
+        break;
+    default:
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+    }
+
+    return DC1394_SUCCESS;
+}
+
+
+dc1394error_t
+Adapt_buffer_stereo(dc1394video_frame_t *in, dc1394video_frame_t *out)
+{
+    uint32_t bpp;
+
+    // buffer position is not changed. Size is boubled in Y
+    out->size[0]=in->size[0];
+    out->size[1]=in->size[1]*2;
+    out->position[0]=in->position[0];
+    out->position[1]=in->position[1];
+
+    // color coding is set to mono8 or raw8.
+    switch (in->color_coding) {
+    case DC1394_COLOR_CODING_RAW16:
+        out->color_coding=DC1394_COLOR_CODING_RAW8;
+        break;
+    case DC1394_COLOR_CODING_MONO16:
+    case DC1394_COLOR_CODING_YUV422:
+        out->color_coding=DC1394_COLOR_CODING_MONO8;
+        break;
+    default:
+        return DC1394_INVALID_COLOR_CODING;
+  }
+
+    // keep the color filter value in all cases. if the format is not raw it will not be further used anyway
+    out->color_filter=in->color_filter;
+
+    // the output YUV byte order must be already set if the buffer is YUV422 at the output
+    // if the output is not YUV we don't care about this field.
+    // Hence nothing to do.
+
+    // we always convert to 8bits (at this point) we can safely set this value to 8.
+    out->data_depth=8;
+
+    // don't know what to do with stride... >>>> TODO: STRIDE SHOULD BE TAKEN INTO ACCOUNT... <<<<
+    // out->stride=??
+
+    // the video mode should not change. Color coding and other stuff can be accessed in specific fields of this struct
+    out->video_mode = in->video_mode;
+
+    // padding is kept:
+    out->padding_bytes = in->padding_bytes;
+
+    // image bytes changes:    >>>> TODO: STRIDE SHOULD BE TAKEN INTO ACCOUNT... <<<<
+    dc1394_get_color_coding_bit_size(out->color_coding, &bpp);
+    out->image_bytes=(out->size[0]*out->size[1]*bpp)/8;
+
+    // total is image_bytes + padding_bytes
+    out->total_bytes = out->image_bytes + out->padding_bytes;
+
+    // bytes-per-packet and packets_per_frame are internal data that can be kept as is.
+    out->packet_size  = in->packet_size;
+    out->packets_per_frame = in->packets_per_frame;
+
+    // timestamp, frame_behind, id and camera are copied too:
+    out->timestamp = in->timestamp;
+    out->frames_behind = in->frames_behind;
+    out->camera = in->camera;
+    out->id = in->id;
+
+    // verify memory allocation:
+    if (out->total_bytes>out->allocated_image_bytes) {
+        free(out->image);
+        out->image=(uint8_t*)malloc(out->total_bytes*sizeof(uint8_t));
+        if (out->image)
+            out->allocated_image_bytes = out->total_bytes*sizeof(uint8_t);
+        else
+            out->allocated_image_bytes = 0;
+    }
+
+    // Copy padding bytes:
+    if(out->image)
+        memcpy(&(out->image[out->image_bytes]),&(in->image[in->image_bytes]),out->padding_bytes);
+
+    out->little_endian=0;   // not used before 1.32 is out.
+    out->data_in_padding=0; // not used before 1.32 is out.
+
+    if(out->image)
+        return DC1394_SUCCESS;
+        
+    return DC1394_MEMORY_ALLOCATION_FAILURE;
+
+}
+
+dc1394error_t
+dc1394_deinterlace_stereo_frames(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394stereo_method_t method)
+{
+    dc1394error_t err;
+
+    if ((in->color_coding==DC1394_COLOR_CODING_RAW16)||
+        (in->color_coding==DC1394_COLOR_CODING_MONO16)||
+        (in->color_coding==DC1394_COLOR_CODING_YUV422)) {
+        switch (method) {
+        case DC1394_STEREO_METHOD_INTERLACED:
+            err=Adapt_buffer_stereo(in,out);
+            if(err != DC1394_SUCCESS)
+                return err;
+                
+            return dc1394_deinterlace_stereo(in->image, out->image, out->size[0], out->size[1]);
+            break;
+            
+        case DC1394_STEREO_METHOD_FIELD:
+            err=Adapt_buffer_stereo(in,out);
+            if (err != DC1394_SUCCESS)
+                return err;
+                
+            memcpy(out->image,in->image,out->image_bytes);
+           return DC1394_SUCCESS;
+            break;
+        default:
+            return DC1394_INVALID_STEREO_METHOD;
+        }
+// Never reached:  return DC1394_INVALID_STEREO_METHOD;
+    }
+    else
+        return DC1394_FUNCTION_NOT_SUPPORTED;
+}
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/conversions.h b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/conversions.h
new file mode 100644 (file)
index 0000000..b838758
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Color conversion functions, including Bayer pattern decoding
+ *
+ * Written by Damien Douxchamps and Frederic Devernay
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <dc1394/log.h>
+
+#ifndef __DC1394_CONVERSIONS_H__
+#define __DC1394_CONVERSIONS_H__
+
+/*! \file dc1394/conversions.h
+    \brief functions to convert video formats
+    \author Damien Douxchamps: coding
+    \author Frederic Devernay: coding
+    \author Peter Antoniac: documentation maintainer
+
+    More details soon
+*/
+
+#define restrict __restrict
+
+/**
+ * A list of de-mosaicing techniques for Bayer-patterns.
+ *
+ * The speed of the techniques can vary greatly, as well as their quality.
+ */
+typedef enum {
+    DC1394_BAYER_METHOD_NEAREST=0,
+    DC1394_BAYER_METHOD_SIMPLE,
+    DC1394_BAYER_METHOD_BILINEAR,
+    DC1394_BAYER_METHOD_HQLINEAR,
+    DC1394_BAYER_METHOD_DOWNSAMPLE,
+    DC1394_BAYER_METHOD_EDGESENSE,
+    DC1394_BAYER_METHOD_VNG,
+    DC1394_BAYER_METHOD_AHD
+} dc1394bayer_method_t;
+#define DC1394_BAYER_METHOD_MIN      DC1394_BAYER_METHOD_NEAREST
+#define DC1394_BAYER_METHOD_MAX      DC1394_BAYER_METHOD_AHD
+#define DC1394_BAYER_METHOD_NUM     (DC1394_BAYER_METHOD_MAX-DC1394_BAYER_METHOD_MIN+1)
+
+/**
+ * A list of known stereo-in-normal-video modes used by manufacturers like Point Grey Research and Videre Design.
+ */
+typedef enum {
+    DC1394_STEREO_METHOD_INTERLACED=0,
+    DC1394_STEREO_METHOD_FIELD
+} dc1394stereo_method_t;
+#define DC1394_STEREO_METHOD_MIN     DC1394_STEREO_METHOD_INTERLACED
+#define DC1394_STEREO_METHOD_MAX     DC1394_STEREO_METHOD_FIELD
+#define DC1394_STEREO_METHOD_NUM    (DC1394_STEREO_METHOD_MAX-DC1394_STEREO_METHOD_MIN+1)
+
+
+// color conversion functions from Bart Nabbe.
+// corrected by Damien: bad coeficients in YUV2RGB
+#define YUV2RGB(y, u, v, r, g, b) {\
+  r = y + ((v*1436) >> 10);\
+  g = y - ((u*352 + v*731) >> 10);\
+  b = y + ((u*1814) >> 10);\
+  r = r < 0 ? 0 : r;\
+  g = g < 0 ? 0 : g;\
+  b = b < 0 ? 0 : b;\
+  r = r > 255 ? 255 : r;\
+  g = g > 255 ? 255 : g;\
+  b = b > 255 ? 255 : b; }
+
+
+#define RGB2YUV(r, g, b, y, u, v) {\
+  y = (306*r + 601*g + 117*b)  >> 10;\
+  u = ((-172*r - 340*g + 512*b) >> 10)  + 128;\
+  v = ((512*r - 429*g - 83*b) >> 10) + 128;\
+  y = y < 0 ? 0 : y;\
+  u = u < 0 ? 0 : u;\
+  v = v < 0 ? 0 : v;\
+  y = y > 255 ? 255 : y;\
+  u = u > 255 ? 255 : u;\
+  v = v > 255 ? 255 : v; }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**********************************************************************
+ *  CONVERSION FUNCTIONS TO YUV422, MONO8 and RGB8
+ **********************************************************************/
+
+/**
+ * Converts an image buffer to YUV422
+ */
+dc1394error_t
+dc1394_convert_to_YUV422(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
+                         dc1394color_coding_t source_coding, uint32_t bits);
+
+/**
+ * Converts an image buffer to MONO8
+ */
+dc1394error_t
+dc1394_convert_to_MONO8(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
+                        dc1394color_coding_t source_coding, uint32_t bits);
+
+/**
+ * Converts an image buffer to RGB8
+ */
+dc1394error_t
+dc1394_convert_to_RGB8(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
+                       dc1394color_coding_t source_coding, uint32_t bits);
+
+/**********************************************************************
+ *  CONVERSION FUNCTIONS FOR STEREO IMAGES
+ **********************************************************************/
+
+/**
+ * changes a 16bit stereo image (8bit/channel) into two 8bit images on top of each other
+ */
+dc1394error_t
+dc1394_deinterlace_stereo(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height);
+
+/************************************************************************************************
+ *                                                                                              *
+ *      Color conversion functions for cameras that can output raw Bayer pattern images (color  *
+ *  codings DC1394_COLOR_CODING_RAW8 and DC1394_COLOR_CODING_RAW16).                            *
+ *                                                                                              *
+ *  Credits and sources:                                                                        *
+ *  - Nearest Neighbor : OpenCV library                                                         *
+ *  - Bilinear         : OpenCV library                                                         *
+ *  - HQLinear         : High-Quality Linear Interpolation For Demosaicing Of Bayer-Patterned   *
+ *                       Color Images, by Henrique S. Malvar, Li-wei He, and Ross Cutler,       *
+ *                          in Proceedings of the ICASSP'04 Conference.                            *
+ *  - Edge Sense II    : Laroche, Claude A. "Apparatus and method for adaptively interpolating  *
+ *                       a full color image utilizing chrominance gradients"                    *
+ *                          U.S. Patent 5,373,322. Based on the code found on the website          *
+ *                       http://www-ise.stanford.edu/~tingchen/ Converted to C and adapted to   *
+ *                       all four elementary patterns.                                          *
+ *  - Downsample       : "Known to the Ancients"                                                *
+ *  - Simple           : Implemented from the information found in the manual of Allied Vision  *
+ *                       Technologies (AVT) cameras.                                            *
+ *  - VNG              : Variable Number of Gradients, a method described in                    *
+ *                       http://www-ise.stanford.edu/~tingchen/algodep/vargra.html              *
+ *                       Sources import from DCRAW by Frederic Devernay. DCRAW is a RAW         *
+ *                       converter program by Dave Coffin. URL:                                 *
+ *                       http://www.cybercom.net/~dcoffin/dcraw/                                *
+ *  - AHD              : Adaptive Homogeneity-Directed Demosaicing Algorithm, by K. Hirakawa    *
+ *                       and T.W. Parks, IEEE Transactions on Image Processing, Vol. 14, Nr. 3, *
+ *                       March 2005, pp. 360 - 369.                                             *
+ *                                                                                              *
+ ************************************************************************************************/
+
+/**
+ * Perform de-mosaicing on an 8-bit image buffer
+ */
+dc1394error_t
+dc1394_bayer_decoding_8bit(const uint8_t *bayer, uint8_t *rgb,
+                           uint32_t width, uint32_t height, dc1394color_filter_t tile,
+                           dc1394bayer_method_t method);
+
+/**
+ * Perform de-mosaicing on an 16-bit image buffer
+ */
+dc1394error_t
+dc1394_bayer_decoding_16bit(const uint16_t *bayer, uint16_t *rgb,
+                            uint32_t width, uint32_t height, dc1394color_filter_t tile,
+                            dc1394bayer_method_t method, uint32_t bits);
+
+
+/**********************************************************************************
+ *  Frame based conversions
+ **********************************************************************************/
+
+/**
+ * Converts the format of a video frame.
+ *
+ * To set the format of the output, simply set the values of the corresponding fields in the output frame
+ */
+dc1394error_t
+dc1394_convert_frames(dc1394video_frame_t *in, dc1394video_frame_t *out);
+
+/**
+ * De-mosaicing of a Bayer-encoded video frame
+ *
+ * To set the format of the output, simply set the values of the corresponding fields in the output frame
+ * @param in is a pointer to the bayer video frame that is to be converted
+ * @param out is a pointer to the frame to be converted to.  If there is memory allocated to the image field, 
+ *      then it will be adjusted accordingly by this function.  If there is no memory allocated to the image
+ *      field, then ensure that out->image == NULL and out->allocated_image_bytes == 0
+ * @param method is the bayer method to interpolate the frame.
+ */
+dc1394error_t
+dc1394_debayer_frames(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394bayer_method_t method);
+
+/**
+ * De-interlacing of stereo data for cideo frames
+ *
+ * To set the format of the output, simply set the values of the corresponding fields in the output frame
+ */
+dc1394error_t
+dc1394_deinterlace_stereo_frames(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394stereo_method_t method);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DC1394_CONVERSIONS_H */
+
+
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/dc1394.h b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/dc1394.h
new file mode 100644 (file)
index 0000000..3ce30ed
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Written by
+ *   Gord Peters <GordPeters@smarttech.com>,
+ *   Chris Urmson <curmson@ri.cmu.edu>
+ *   Damien Douxchamps <ddouxchamps@users.sf.net>
+ *   Dan Dennedy <ddennedy@users.sf.net>
+ *   David Moore <dcm@acm.org>
+ *   ... and many ohters (see the AUTHORS file)
+ *
+ * Copyright (C) 2000-2001 SMART Technologies Inc.
+ * Copyright (C) 2001-2004 Universite catholique de Louvain
+ * Copyright (C) 2000 Carnegie Mellon University
+ * Copyright (C) 2006- Massachussets Institute of Technology
+ * Copyright (C) 2004- Nara Institute of Science and Technology
+ * All files are also Copyright (C) their respective author(s)
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __DC1394_H__
+#define __DC1394_H__
+
+
+/*! \file dc1394/dc1394.h
+    \brief Main include file, which include all others.
+
+    More details soon
+*/
+
+/* Include all public header files:*/
+#include <dc1394/types.h>
+#include <dc1394/camera.h>
+#include <dc1394/control.h>
+#include <dc1394/capture.h>
+#include <dc1394/conversions.h>
+#include <dc1394/format7.h>
+#include <dc1394/iso.h>
+#include <dc1394/log.h>
+#include <dc1394/register.h>
+#include <dc1394/video.h>
+#include <dc1394/utils.h>
+
+#endif
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/enumeration.c b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/enumeration.c
new file mode 100644 (file)
index 0000000..07aa207
--- /dev/null
@@ -0,0 +1,313 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Written by David Moore <dcm@acm.org>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include <string.h>
+
+#include <dc1394/control.h>
+#include "internal.h"
+#include "platform.h"
+#include "log.h"
+
+static void
+destroy_camera_info (camera_info_t * info)
+{
+    free (info->vendor);
+    free (info->model);
+}
+
+static int
+add_camera (dc1394_t * d, camera_info_t * info)
+{
+    int n = d->num_cameras;
+    dc1394_log_debug ("Adding camera %"PRIx64":%d %x:%x (%s:%s)",
+            info->guid, info->unit, info->vendor_id, info->model_id,
+            info->vendor, info->model);
+
+    /* For now, exclude duplicate cameras caused by seeing the same camera
+     * on different busses.  A better solution is to let the user choose
+     * between these different versions of the same camera, which will require
+     * a new API in the future. */
+    int i;
+    for (i = 0; i < n; i++) {
+        if (d->cameras[i].guid == info->guid
+                && d->cameras[i].unit == info->unit) {
+            dc1394_log_debug ("Rejected camera %"PRIx64" as duplicate",
+                    info->unit);
+            destroy_camera_info (info);
+            return 0;
+        }
+    }
+    d->cameras = realloc (d->cameras, (n + 1) * sizeof (camera_info_t));
+    memcpy (d->cameras + n, info, sizeof (camera_info_t));
+    d->num_cameras = n + 1;
+    return 0;
+}
+
+static char *
+parse_leaf (uint32_t offset, uint32_t * quads, int num_quads)
+{
+    if (offset >= num_quads)
+        return NULL;
+    int num_entries = quads[offset] >> 16;
+    if (offset + num_entries >= num_quads)
+        return NULL;
+
+    uint32_t * dquads = quads + offset + 1;
+    char * str = malloc ((num_entries - 1) * 4 + 1);
+    int i;
+    for (i = 0; i < num_entries - 2; i++) {
+        uint32_t q = dquads[i+2];
+        str[4*i+0] = q >> 24;
+        str[4*i+1] = (q >> 16) & 0xff;
+        str[4*i+2] = (q >> 8) & 0xff;
+        str[4*i+3] = q & 0xff;
+    }
+    str[4*i] = '\0';
+    return str;
+}
+
+static int
+identify_unit (dc1394_t * d, platform_info_t * platform,
+        platform_device_t * dev, uint64_t guid,
+        uint32_t offset, uint32_t * quads, int num_quads, int unit_num,
+        uint32_t vendor_id)
+{
+    if (offset >= num_quads)
+        return -1;
+    int num_entries = quads[offset] >> 16;
+    if (offset + num_entries >= num_quads)
+        return -1;
+
+    camera_info_t info;
+    memset (&info, 0, sizeof (camera_info_t));
+
+    info.guid = guid;
+    info.unit = unit_num;
+    info.device = dev;
+    info.vendor_id = vendor_id;
+    info.unit_directory = offset;
+    info.platform = platform;
+
+    uint32_t * dquads = quads + offset + 1;
+    int i;
+    for (i = 0; i < num_entries; i++) {
+        uint32_t q = dquads[i];
+        if ((q >> 24) == 0x12)
+            info.unit_spec_ID = q & 0xffffff;
+        if ((q >> 24) == 0x13)
+            info.unit_sw_version = q & 0xffffff;
+        if ((q >> 24) == 0xD4)
+            info.unit_dependent_directory = (q & 0xffffff) + offset + i + 1;
+        if ((q >> 24) == 0x17)
+            info.model_id = q & 0xffffff;
+    }
+
+  /*
+     Note on Point Grey (PG) cameras:
+     Although not always advertised, PG cameras are 'sometimes' compatible
+     with IIDC specs. This is especially the case with PG stereo products.
+     The following modifications have been tested with a stereo head
+     (BumbleBee). Most other cameras should be compatible, please consider
+     contributing to the lib if your PG camera is not recognized.
+
+     PG cams sometimes have a Unit_Spec_ID of 0xB09D, instead of the
+     0xA02D of classic IIDC cameras. Also, their software revision differs.
+     I could only get a 1.14 version from my BumbleBee but other versions
+     might exist.
+
+     As PG is regularly providing firmware updates you might also install
+     the latest one in your camera for an increased compatibility.
+
+     Damien
+
+     (updated 2005-04-30)
+  */
+
+    if ((info.unit_spec_ID != 0xA02D) &&
+            (info.unit_spec_ID != 0xB09D))
+        return -1;
+    if (!info.unit_dependent_directory)
+        return -1;
+
+    if (info.unit_dependent_directory >= num_quads)
+        goto done;
+    num_entries = quads[info.unit_dependent_directory] >> 16;
+    if (info.unit_dependent_directory + num_entries >= num_quads)
+        goto done;
+
+    dquads = quads + info.unit_dependent_directory + 1;
+    for (i = 0; i < num_entries; i++) {
+        uint32_t q = dquads[i];
+        if ((q >> 24) == 0x81)
+            info.vendor = parse_leaf ((q & 0xffffff) +
+                    info.unit_dependent_directory + 1 + i,
+                    quads, num_quads);
+        if ((q >> 24) == 0x82)
+            info.model = parse_leaf ((q & 0xffffff) +
+                    info.unit_dependent_directory + 1 + i,
+                    quads, num_quads);
+    }
+done:
+    info.unit_directory = info.unit_directory * 4 + 0x400;
+    info.unit_dependent_directory = info.unit_dependent_directory * 4 + 0x400;
+    return add_camera (d, &info);
+}
+
+static int
+identify_camera (dc1394_t * d, platform_info_t * platform,
+        platform_device_t * dev)
+{
+    uint64_t guid;
+    uint32_t quads[256];
+    int num_quads = 256;
+    if (platform->dispatch->device_get_config_rom (dev, quads,
+                &num_quads) < 0) {
+        dc1394_log_warning ("Failed to get config ROM from %s device",
+                platform->name);
+        return -1;
+    }
+
+    dc1394_log_debug ("Got %d quads of config ROM", num_quads);
+
+    if (num_quads < 7)
+        return -1;
+
+    /* Require 4 quadlets in the bus info block */
+    if ((quads[0] >> 24) != 0x4) {
+        dc1394_log_debug ("Expected 4 quadlets in bus info block, got %d",
+                quads[0] >> 24);
+        return -1;
+    }
+
+    /* Require "1394" as the bus identity */
+    if (quads[1] != 0x31333934)
+        return -1;
+
+    guid = ((uint64_t)quads[3] << 32) | quads[4];
+
+    int num_entries = quads[5] >> 16;
+    if (num_quads < num_entries + 6)
+        return -1;
+    int unit = 0;
+    uint32_t vendor_id = 0;
+    int i;
+    for (i = 0; i < num_entries; i++) {
+        uint32_t q = quads[6+i];
+        if ((q >> 24) == 0x03)
+            vendor_id = q & 0xffffff;
+        if ((q >> 24) == 0xD1) {
+            uint32_t offset = (q & 0xffffff) + 6 + i;
+            identify_unit (d, platform, dev, guid, offset, quads, num_quads,
+                    unit++, vendor_id);
+        }
+    }
+    return 0;
+}
+
+void
+free_enumeration (dc1394_t * d)
+{
+    int i;
+    for (i = 0; i < d->num_platforms; i++) {
+        platform_info_t * p = d->platforms + i;
+        if (p->device_list)
+            p->dispatch->free_device_list (p->device_list);
+        p->device_list = NULL;
+    }
+
+    for (i = 0; i < d->num_cameras; i++)
+        destroy_camera_info (d->cameras + i);
+    free (d->cameras);
+    d->num_cameras = 0;
+    d->cameras = NULL;
+}
+
+int
+refresh_enumeration (dc1394_t * d)
+{
+    free_enumeration (d);
+
+    dc1394_log_debug ("Enumerating cameras...");
+    int i;
+    for (i = 0; i < d->num_platforms; i++) {
+        platform_info_t * p = d->platforms + i;
+        if (!p->p)
+            continue;
+        dc1394_log_debug("Enumerating platform %s", p->name);
+        p->device_list = p->dispatch->get_device_list (p->p);
+        if (!p->device_list) {
+            dc1394_log_warning("Platform %s failed to get device list",
+                    p->name);
+            continue;
+        }
+
+        platform_device_t ** list = p->device_list->devices;
+        int j;
+        dc1394_log_debug ("Platform %s has %d device(s)",
+                p->name, p->device_list->num_devices);
+        for (j = 0; j < p->device_list->num_devices; j++)
+            if (identify_camera (d, p, list[j]) < 0)
+                dc1394_log_debug ("Failed to identify %s device %d",
+                        p->name, j);
+    }
+
+    return 0;
+}
+
+dc1394error_t
+dc1394_camera_enumerate (dc1394_t * d, dc1394camera_list_t **list)
+{
+    if (refresh_enumeration (d) < 0)
+        return DC1394_FAILURE;
+
+    dc1394camera_list_t * l;
+
+    l = calloc (1, sizeof (dc1394camera_list_t));
+    *list = l;
+    if (d->num_cameras == 0)
+        return DC1394_SUCCESS;
+
+    l->ids = malloc (d->num_cameras * sizeof (dc1394camera_id_t));
+    l->num = 0;
+
+    int i;
+    for (i = 0; i < d->num_cameras; i++) {
+        l->ids[i].guid = d->cameras[i].guid;
+        l->ids[i].unit = d->cameras[i].unit;
+        l->num++;
+    }
+    return DC1394_SUCCESS;
+}
+
+/*
+  Free a list of cameras returned by dc1394_enumerate_cameras()
+ */
+void
+dc1394_camera_free_list (dc1394camera_list_t *list)
+{
+    if (list)
+        free (list->ids);
+    list->ids = NULL;
+    free (list);
+}
+
diff --git a/libdc1394/libdc1394-2.2.1-bin/include/dc1394/format7.c b/libdc1394/libdc1394-2.2.1-bin/include/dc1394/format7.c
new file mode 100644 (file)
index 0000000..06fefdc
--- /dev/null
@@ -0,0 +1,959 @@
+/*
+ * 1394-Based Digital Camera Control Library
+ *
+ * Format_7 functions
+ *
+ * Written by Damien Douxchamps <ddouxchamps@users.sf.net>
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include <unistd.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+
+#include "control.h"
+#include "internal.h"
+#include "register.h"
+#include "offsets.h"
+#include "utils.h"
+#include "config.h"
+#include "log.h"
+
+/*==========================================================================
+ * This function implements the handshaking available (and sometimes required)
+ * on some cameras that comply with the IIDC specs v1.30. Thanks to Yasutoshi
+ * Onishi for his feedback and info.
+ *==========================================================================*/
+
+dc1394error_t
+dc1394_format7_get_value_setting(dc1394camera_t *camera, dc1394video_mode_t video_mode,
+                                 uint32_t *present, uint32_t *setting1,
+                                 uint32_t *err_flag1, uint32_t *err_flag2)
+{
+    dc1394error_t err;
+    uint32_t value;
+
+    if (camera->iidc_version<DC1394_IIDC_VERSION_1_30) {
+        *present=0;
+        return DC1394_SUCCESS;
+    }
+
+    if (!dc1394_is_video_mode_scalable(video_mode))
+        return DC1394_INVALID_VIDEO_MODE;
+
+    err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_VALUE_SETTING, &value);
+    DC1394_ERR_RTN(err, "could note get value setting");
+
+    *present= (uint32_t) ( value & 0x80000000UL ) >> 31;
+    *setting1= (uint32_t) ( value & 0x40000000UL ) >> 30;
+    *err_flag1= (uint32_t) ( value & 0x00800000UL ) >> 23;
+    *err_flag2= (uint32_t) ( value & 0x00400000UL ) >> 22;
+
+    return err;
+}
+
+int
+dc1394_format7_set_value_setting(dc1394camera_t *camera, dc1394video_mode_t video_mode)
+{
+    int err;
+
+    if (!dc1394_is_video_mode_scalable(video_mode))
+        return DC1394_INVALID_VIDEO_MODE;