Hello community,

here is the log from the commit of package libdc1394 for openSUSE:Factory 
checked in at 2016-02-11 12:32:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libdc1394 (Old)
 and      /work/SRC/openSUSE:Factory/.libdc1394.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libdc1394"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libdc1394/libdc1394.changes      2015-11-24 
22:32:25.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libdc1394.new/libdc1394.changes 2016-02-11 
12:32:35.000000000 +0100
@@ -1,0 +2,9 @@
+Wed Feb  3 14:09:56 UTC 2016 - [email protected]
+
+- Update to 2.2.4:
+   - Add USB IDs for some Point Grey cameras 
+   - Re-activate the EdgeSense debayering algorithm (patent has expired)
+   - USB-captured frames now have a valid timestamp
+   - Look for USB enpoints on all interfaces
+
+-------------------------------------------------------------------

Old:
----
  libdc1394-2.2.3.tar.gz

New:
----
  libdc1394-2.2.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libdc1394.spec ++++++
--- /var/tmp/diff_new_pack.CwW5Y8/_old  2016-02-11 12:32:36.000000000 +0100
+++ /var/tmp/diff_new_pack.CwW5Y8/_new  2016-02-11 12:32:36.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libdc1394
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           libdc1394
-Version:        2.2.3
+Version:        2.2.4
 Release:        0
 Summary:        1394-Based Digital Camera Control Library
 License:        LGPL-2.1+

++++++ libdc1394-2.2.3.tar.gz -> libdc1394-2.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/AUTHORS new/libdc1394-2.2.4/AUTHORS
--- old/libdc1394-2.2.3/AUTHORS 2014-03-06 03:57:21.000000000 +0100
+++ new/libdc1394-2.2.4/AUTHORS 2015-03-21 07:35:09.000000000 +0100
@@ -1,5 +1,5 @@
-This is the list of the individuals who have contributed to libdc1394.
-If your name should have been here please contact Damien Douxchamps.
+This is the list of individuals who have contributed to libdc1394.
+If your name should have been here please contact the maintainer.
 
 Christophe Achard
 AgBr
@@ -12,6 +12,7 @@
 D. Bahadir
 Alexis Ballier
 Matthias Barkhoff
+Robin Beitra
 Etienne Bieber
 Blaise
 Argentum Brom
@@ -19,6 +20,7 @@
 Maya Cakmak
 Tim Canham
 Jim Cassidy
+Paul Chavent
 Hugo Costelha
 danalien
 Damien Delannay
@@ -78,6 +80,7 @@
 Robert Olsen
 Yasutoshi Onishi
 Thomas Passot
+Martin Peris
 Alain Perrier
 Gord Peters
 Rodolphe Pineau
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/NEWS new/libdc1394-2.2.4/NEWS
--- old/libdc1394-2.2.3/NEWS    2013-02-25 13:35:15.000000000 +0100
+++ new/libdc1394-2.2.4/NEWS    2016-02-03 14:16:15.000000000 +0100
@@ -1,6 +1,15 @@
 Release information and news:
 -----------------------------
 
+-- 2.2.4
+   - Add USB IDs for some Point Grey cameras 
+   - Re-activate the EdgeSense debayering algorithm (patent has expired)
+   - USB-captured frames now have a valid timestamp
+   - Look for USB enpoints on all interfaces
+
+-- 2.2.3
+   - Add USB IDs for some Point Grey cameras
+
 -- 2.2.1
    - all files are now under the LGPL2 license
    - Don't expose internal symbols
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/configure 
new/libdc1394-2.2.4/configure
--- old/libdc1394-2.2.3/configure       2014-09-10 01:28:21.000000000 +0200
+++ new/libdc1394-2.2.4/configure       2016-02-03 14:13:06.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libdc1394 2.2.3.
+# Generated by GNU Autoconf 2.69 for libdc1394 2.2.4.
 #
 # Report bugs to <[email protected]>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='libdc1394'
 PACKAGE_TARNAME='libdc1394'
-PACKAGE_VERSION='2.2.3'
-PACKAGE_STRING='libdc1394 2.2.3'
+PACKAGE_VERSION='2.2.4'
+PACKAGE_STRING='libdc1394 2.2.4'
 PACKAGE_BUGREPORT='[email protected]'
 PACKAGE_URL=''
 
@@ -1421,7 +1421,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libdc1394 2.2.3 to adapt to many kinds of systems.
+\`configure' configures libdc1394 2.2.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1496,7 +1496,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libdc1394 2.2.3:";;
+     short | recursive ) echo "Configuration of libdc1394 2.2.4:";;
    esac
   cat <<\_ACEOF
 
@@ -1633,7 +1633,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libdc1394 configure 2.2.3
+libdc1394 configure 2.2.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2056,7 +2056,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libdc1394 $as_me 2.2.3, which was
+It was created by libdc1394 $as_me 2.2.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -6301,7 +6301,7 @@
 
 # Define the identity of the package.
  PACKAGE='libdc1394'
- VERSION='2.2.3'
+ VERSION='2.2.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16589,7 +16589,7 @@
 
 
 lt_current=23
-lt_revision=10
+lt_revision=11
 lt_age=1
 
 
@@ -17261,7 +17261,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libdc1394 $as_me 2.2.3, which was
+This file was extended by libdc1394 $as_me 2.2.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17327,7 +17327,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libdc1394 config.status 2.2.3
+libdc1394 config.status 2.2.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/configure.ac 
new/libdc1394-2.2.4/configure.ac
--- old/libdc1394-2.2.3/configure.ac    2014-09-10 01:26:05.000000000 +0200
+++ new/libdc1394-2.2.4/configure.ac    2016-02-03 14:12:31.000000000 +0100
@@ -1,6 +1,6 @@
 # process this file with autoconf to get a configure script
 AC_PREREQ([2.6.0])
-AC_INIT([libdc1394],[2.2.3],[[email protected]])
+AC_INIT([libdc1394],[2.2.4],[[email protected]])
 AC_CONFIG_SRCDIR([dc1394/control.c])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -143,7 +143,7 @@
 dnl  4. If the interface has removed or changed elements, set AGE to 0.
 dnl ---------------------------------------------------------------------------
 lt_current=23
-lt_revision=10
+lt_revision=11
 lt_age=1
 
 AC_SUBST(lt_current)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/dc1394/bayer.c 
new/libdc1394-2.2.4/dc1394/bayer.c
--- old/libdc1394-2.2.3/dc1394/bayer.c  2011-08-21 08:32:57.000000000 +0200
+++ new/libdc1394-2.2.4/dc1394/bayer.c  2016-02-03 14:08:22.000000000 +0100
@@ -500,8 +500,273 @@
 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;
+       uint8_t *outR, *outG, *outB;
+    register int i3, j3, base;
+    int i, j;
+    int dh, dv;
+    int tmp;
+       int sx3=sx*3;
+
+    // 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_GBRG:
+        // copy original RGB data to output images
+               for (i = 0, i3=0; i < sy*sx; i += (sx<<1), i3 += (sx3<<1)) {
+                       for (j = 0, j3=0; j < sx; j += 2, j3+=6) {
+                               base=i3+j3;
+                               outG[base]           = bayer[i + j];
+                               outG[base + sx3 + 3] = bayer[i + j + sx + 1];
+                               outR[base + 3]       = bayer[i + j + 1];
+                               outB[base + sx3]     = bayer[i + j + sx];
+                       }
+               }
+               // process GREEN channel
+               for (i3= 3*sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=6; j3 < sx3 - 9; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outB[base - 6] +
+                                                  outB[base + 6]) >> 1) -
+                                                  outB[base]);
+                               dv = abs(((outB[base - (sx3<<1)] +
+                                                  outB[base + (sx3<<1)]) >> 1) 
-
+                                                  outB[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP(tmp, outG[base]);
+                       }
+               }
+               
+               for (i3=2*sx3; i3 < (sy - 3)*sx3; i3 += (sx3<<1)) {
+                       for (j3=9; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outR[base - 6] +
+                                                  outR[base + 6]) >>1 ) -
+                                                  outR[base]);
+                               dv = abs(((outR[base - (sx3<<1)] +
+                                                  outR[base + (sx3<<1)]) >>1 ) 
-
+                                                  outR[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP(tmp, outG[base]);
+                       }
+               }
+               // process RED channel
+               for (i3=0; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - 3] -
+                                         outG[base - 3] +
+                                         outR[base + 3] -
+                                         outG[base + 3]) >> 1);
+                               CLIP(tmp, outR[base]);
+                       }
+               }
+               for (i3=sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=3; j3 < sx3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3] -
+                                         outG[base - sx3] +
+                                         outR[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP(tmp, outR[base]);
+                       }
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outR[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outR[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outR[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP(tmp, outR[base]);
+                       }
+               }
+
+               // process BLUE channel
+               for (i3=sx3; i3 < sy*sx3; i3 += (sx3<<1)) {
+                       for (j3=3; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - 3] -
+                                         outG[base - 3] +
+                                         outB[base + 3] -
+                                         outG[base + 3]) >> 1);
+                               CLIP(tmp, outB[base]);
+                       }
+               }
+               for (i3=2*sx3; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {
+                       for (j3=0; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3] -
+                                         outG[base - sx3] +
+                                         outB[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP(tmp, outB[base]);
+                       }
+                       for (j3=3; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outB[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outB[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outB[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP(tmp, outB[base]);
+                       }
+               }
+               break;
+
+    case DC1394_COLOR_FILTER_BGGR:        
//---------------------------------------------------------
+    case DC1394_COLOR_FILTER_RGGB:
+        // copy original RGB data to output images
+               for (i = 0, i3=0; i < sy*sx; i += (sx<<1), i3 += (sx3<<1)) {
+                       for (j = 0, j3=0; j < sx; j += 2, j3+=6) {
+                               base=i3+j3;
+                               outB[base] = bayer[i + j];
+                               outR[base + sx3 + 3] = bayer[i + sx + (j + 1)];
+                               outG[base + 3] = bayer[i + j + 1];
+                               outG[base + sx3] = bayer[i + sx + j];
+                       }
+               }
+               // process GREEN channel
+               for (i3=2*sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=6; j3 < sx3 - 9; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outB[base - 6] +
+                                                  outB[base + 6]) >> 1) -
+                                                  outB[base]);
+                               dv = abs(((outB[base - (sx3<<1)] +
+                                                  outB[base + (sx3<<1)]) >> 1) 
-
+                                                  outB[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP(tmp, outG[base]);
+                       }
+               }
+               for (i3=3*sx3; i3 < (sy - 3)*sx3; i3 += (sx3<<1)) {
+                       for (j3=9; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outR[base - 6] +
+                                                  outR[base + 6]) >> 1) -
+                                                  outR[base]);
+                               dv = abs(((outR[base - (sx3<<1)] +
+                                                  outR[base + (sx3<<1)]) >> 1) 
-
+                                                  outR[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP(tmp, outG[base]);
+                       }
+               }
+               // process RED channel
+               for (i3=sx3; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {        // 
G-points (1/2)
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - 3] -
+                                         outG[base - 3] +
+                                         outR[base + 3] -
+                                         outG[base + 3]) >>1);
+                               CLIP(tmp, outR[base]);
+                       }
+               }
+               for (i3=2*sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=3; j3 < sx3; j3+=6) {        // G-points (2/2)
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3] -
+                                         outG[base - sx3] +
+                                         outR[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP(tmp, outR[base]);
+                       }
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {        // B-points
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outR[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outR[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outR[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP(tmp, outR[base]);
+                       }
+               }
+
+               // process BLUE channel
+               for (i = 0,i3=0; i < sy*sx; i += (sx<<1), i3 += (sx3<<1)) {
+                       for (j = 1, j3=3; j < sx - 2; j += 2, j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - 3] -
+                                         outG[base - 3] +
+                                         outB[base + 3] -
+                                         outG[base + 3]) >> 1);
+                               CLIP(tmp, outB[base]);
+                       }
+               }
+               for (i3=sx3; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {
+                       for (j3=0; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3] -
+                                         outG[base - sx3] +
+                                         outB[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP(tmp, outB[base]);
+                       }
+                       for (j3=3; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outB[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outB[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outB[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP(tmp, outB[base]);
+                       }
+               }
+               break;
+    }
+
+    ClearBorders(rgb, sx, sy, 3);
+
+    return DC1394_SUCCESS;
 }
 
 /* coriander's Bayer decoding */
@@ -1048,8 +1313,273 @@
 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;
+       uint16_t *outR, *outG, *outB;
+    register int i3, j3, base;
+    int i, j;
+    int dh, dv;
+    int tmp;
+       int sx3=sx*3;
+
+    // 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_GBRG:
+        // copy original RGB data to output images
+               for (i = 0, i3=0; i < sy*sx; i += (sx<<1), i3 += (sx3<<1)) {
+                       for (j = 0, j3=0; j < sx; j += 2, j3+=6) {
+                               base=i3+j3;
+                               outG[base]           = bayer[i + j];
+                               outG[base + sx3 + 3] = bayer[i + j + sx + 1];
+                               outR[base + 3]       = bayer[i + j + 1];
+                               outB[base + sx3]     = bayer[i + j + sx];
+                       }
+               }
+               // process GREEN channel
+               for (i3= 3*sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=6; j3 < sx3 - 9; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outB[base - 6] +
+                                                  outB[base + 6]) >> 1) -
+                                                  outB[base]);
+                               dv = abs(((outB[base - (sx3<<1)] +
+                                                  outB[base + (sx3<<1)]) >> 1) 
-
+                                                  outB[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP16(tmp, outG[base], bits);
+                       }
+               }
+               
+               for (i3=2*sx3; i3 < (sy - 3)*sx3; i3 += (sx3<<1)) {
+                       for (j3=9; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outR[base - 6] +
+                                                  outR[base + 6]) >>1 ) -
+                                                  outR[base]);
+                               dv = abs(((outR[base - (sx3<<1)] +
+                                                  outR[base + (sx3<<1)]) >>1 ) 
-
+                                                  outR[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP16(tmp, outG[base], bits);
+                       }
+               }
+               // process RED channel
+               for (i3=0; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - 3] -
+                                         outG[base - 3] +
+                                         outR[base + 3] -
+                                         outG[base + 3]) >> 1);
+                               CLIP16(tmp, outR[base], bits);
+                       }
+               }
+               for (i3=sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=3; j3 < sx3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3] -
+                                         outG[base - sx3] +
+                                         outR[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP16(tmp, outR[base], bits);
+                       }
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outR[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outR[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outR[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP16(tmp, outR[base], bits);
+                       }
+               }
+
+               // process BLUE channel
+               for (i3=sx3; i3 < sy*sx3; i3 += (sx3<<1)) {
+                       for (j3=3; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - 3] -
+                                         outG[base - 3] +
+                                         outB[base + 3] -
+                                         outG[base + 3]) >> 1);
+                               CLIP16(tmp, outB[base], bits);
+                       }
+               }
+               for (i3=2*sx3; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {
+                       for (j3=0; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3] -
+                                         outG[base - sx3] +
+                                         outB[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP16(tmp, outB[base], bits);
+                       }
+                       for (j3=3; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outB[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outB[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outB[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP16(tmp, outB[base], bits);
+                       }
+               }
+               break;
+
+    case DC1394_COLOR_FILTER_BGGR:        
//---------------------------------------------------------
+    case DC1394_COLOR_FILTER_RGGB:
+        // copy original RGB data to output images
+               for (i = 0, i3=0; i < sy*sx; i += (sx<<1), i3 += (sx3<<1)) {
+                       for (j = 0, j3=0; j < sx; j += 2, j3+=6) {
+                               base=i3+j3;
+                               outB[base] = bayer[i + j];
+                               outR[base + sx3 + 3] = bayer[i + sx + (j + 1)];
+                               outG[base + 3] = bayer[i + j + 1];
+                               outG[base + sx3] = bayer[i + sx + j];
+                       }
+               }
+               // process GREEN channel
+               for (i3=2*sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=6; j3 < sx3 - 9; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outB[base - 6] +
+                                                  outB[base + 6]) >> 1) -
+                                                  outB[base]);
+                               dv = abs(((outB[base - (sx3<<1)] +
+                                                  outB[base + (sx3<<1)]) >> 1) 
-
+                                                  outB[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP16(tmp, outG[base], bits);
+                       }
+               }
+               for (i3=3*sx3; i3 < (sy - 3)*sx3; i3 += (sx3<<1)) {
+                       for (j3=9; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               dh = abs(((outR[base - 6] +
+                                                  outR[base + 6]) >> 1) -
+                                                  outR[base]);
+                               dv = abs(((outR[base - (sx3<<1)] +
+                                                  outR[base + (sx3<<1)]) >> 1) 
-
+                                                  outR[base]);
+                               tmp = (((outG[base - 3]   + outG[base + 3]) >> 
1) * (dh<=dv) +
+                                          ((outG[base - sx3] + outG[base + 
sx3]) >> 1) * (dh>dv));
+                               //tmp = (dh==dv) ? tmp>>1 : tmp;
+                               CLIP16(tmp, outG[base], bits);
+                       }
+               }
+               // process RED channel
+               for (i3=sx3; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {        // 
G-points (1/2)
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - 3] -
+                                         outG[base - 3] +
+                                         outR[base + 3] -
+                                         outG[base + 3]) >>1);
+                               CLIP16(tmp, outR[base], bits);
+                       }
+               }
+               for (i3=2*sx3; i3 < (sy - 2)*sx3; i3 += (sx3<<1)) {
+                       for (j3=3; j3 < sx3; j3+=6) {        // G-points (2/2)
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3] -
+                                         outG[base - sx3] +
+                                         outR[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP16(tmp, outR[base], bits);
+                       }
+                       for (j3=6; j3 < sx3 - 3; j3+=6) {        // B-points
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outR[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outR[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outR[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outR[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP16(tmp, outR[base], bits);
+                       }
+               }
+
+               // process BLUE channel
+               for (i = 0,i3=0; i < sy*sx; i += (sx<<1), i3 += (sx3<<1)) {
+                       for (j = 1, j3=3; j < sx - 2; j += 2, j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - 3] -
+                                         outG[base - 3] +
+                                         outB[base + 3] -
+                                         outG[base + 3]) >> 1);
+                               CLIP16(tmp, outB[base], bits);
+                       }
+               }
+               for (i3=sx3; i3 < (sy - 1)*sx3; i3 += (sx3<<1)) {
+                       for (j3=0; j3 < sx3 - 3; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3] -
+                                         outG[base - sx3] +
+                                         outB[base + sx3] -
+                                         outG[base + sx3]) >> 1);
+                               CLIP16(tmp, outB[base], bits);
+                       }
+                       for (j3=3; j3 < sx3 - 6; j3+=6) {
+                               base=i3+j3;
+                               tmp = outG[base] +
+                                       ((outB[base - sx3 - 3] -
+                                         outG[base - sx3 - 3] +
+                                         outB[base - sx3 + 3] -
+                                         outG[base - sx3 + 3] +
+                                         outB[base + sx3 - 3] -
+                                         outG[base + sx3 - 3] +
+                                         outB[base + sx3 + 3] -
+                                         outG[base + sx3 + 3]) >> 2);
+                               CLIP16(tmp, outB[base], bits);
+                       }
+               }
+               break;
+    }
+
+    ClearBorders_uint16(rgb, sx, sy, 3);
+
+    return DC1394_SUCCESS;
 }
 
 /* coriander's Bayer decoding */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/dc1394/conversions.h 
new/libdc1394-2.2.4/dc1394/conversions.h
--- old/libdc1394-2.2.3/dc1394/conversions.h    2011-08-21 08:27:26.000000000 
+0200
+++ new/libdc1394-2.2.4/dc1394/conversions.h    2016-02-03 14:08:22.000000000 
+0100
@@ -141,10 +141,10 @@
  *  - 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.        
                    *
+ *                       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          *
+ *                       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"                               
                 *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/dc1394/usb/capture.c 
new/libdc1394-2.2.4/dc1394/usb/capture.c
--- old/libdc1394-2.2.3/dc1394/usb/capture.c    2013-10-29 15:26:26.000000000 
+0100
+++ new/libdc1394-2.2.4/dc1394/usb/capture.c    2015-03-22 15:59:16.000000000 
+0100
@@ -26,6 +26,7 @@
 #include <inttypes.h>
 #include <pthread.h>
 #include <unistd.h>
+#include <sys/time.h>
 #ifdef HAVE_MACOSX
 #include <CoreFoundation/CoreFoundation.h>
 #endif
@@ -40,6 +41,13 @@
 static void
 LIBUSB_CALL callback (struct libusb_transfer * transfer)
 {
+       // Get a software timestamp as soon as possible in this callback. Note 
that this timestamp
+       // is not as accurate as the bus timestamp we get with the IEEE1394 
interface. For more
+       // accurate timings, consider using either a hardware external trigger 
or the camera
+       // timestamps that can be inserted within the video frame (see Point 
Grey documentation)
+       struct timeval filltime;
+       gettimeofday(&filltime,NULL);
+
     struct usb_frame * f = transfer->user_data;
     platform_camera_t * craw = f->pcam;
 
@@ -62,6 +70,7 @@
 
     pthread_mutex_lock (&craw->mutex);
     f->status = status;
+       f->frame.timestamp = filltime.tv_sec*1000000 + filltime.tv_usec;
     craw->frames_ready++;
     pthread_mutex_unlock (&craw->mutex);
 
@@ -107,6 +116,44 @@
     return NULL;
 }
 
+static int
+find_interface (libusb_device * usb_dev, uint8_t endpoint_address)
+{
+    struct libusb_device_descriptor usb_desc;
+    struct libusb_config_descriptor * config_desc;
+    int ret;
+    int i, a, e;
+    uint8_t ea;
+
+    ret = libusb_get_device_descriptor(usb_dev, &usb_desc);
+
+    if (ret < 0) {
+        dc1394_log_error ("usb: Failed to get device descriptor");
+        return DC1394_FAILURE;
+    }
+
+    if (usb_desc.bNumConfigurations) {
+        ret = libusb_get_active_config_descriptor (usb_dev, &config_desc);
+        if (ret) {
+            dc1394_log_error ("usb: Failed to get config descriptor");
+            return DC1394_FAILURE;
+        }
+
+        for (i = 0; i < config_desc->bNumInterfaces; i++) {
+            for (a = 0; a < config_desc->interface[i].num_altsetting; a++) {
+                for (e = 0; e < 
config_desc->interface[i].altsetting[a].bNumEndpoints; e++) {
+                    ea = 
config_desc->interface[i].altsetting[a].endpoint[e].bEndpointAddress;
+                    // Return the interface number for the first suitable 
interface
+                    if (ea == endpoint_address)
+                        return i;
+                }
+            }
+        }
+    }
+
+    return DC1394_FAILURE;
+}
+
 static dc1394error_t
 init_frame(platform_camera_t *craw, int index, dc1394video_frame_t *proto)
 {
@@ -226,7 +273,14 @@
     }
     libusb_free_device_list (list, 1);
 
-    if (libusb_claim_interface (craw->thread_handle, 0) < 0) {
+       // Point Grey uses endpoint 0x81, but other manufacturers or models may 
use another endpoint
+    int usb_interface = find_interface 
(libusb_get_device(craw->thread_handle), 0x81);
+    if (usb_interface == DC1394_FAILURE) {
+        dc1394_log_error ("usb: capture thread failed to find suitable 
interface on device");
+        dc1394_usb_capture_stop (craw);
+        return DC1394_FAILURE;
+    }
+    if (libusb_claim_interface (craw->thread_handle, usb_interface) < 0) {
         dc1394_log_error ("usb: capture thread failed to claim interface");
         dc1394_usb_capture_stop (craw);
         return DC1394_FAILURE;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/dc1394/usb/control.c 
new/libdc1394-2.2.4/dc1394/usb/control.c
--- old/libdc1394-2.2.3/dc1394/usb/control.c    2014-03-06 03:56:19.000000000 
+0100
+++ new/libdc1394-2.2.4/dc1394/usb/control.c    2015-02-12 23:44:23.000000000 
+0100
@@ -79,7 +79,9 @@
     { 0x1e10, 0x3008 }, // Point Grey Flea 3 (FL3-U3-88S2C)
     { 0x1e10, 0x300a }, // Point Grey Flea 3 (FL3-U3-13E4C)
     { 0x1e10, 0x300b }, // Point Grey Flea 3 (FL3-U3-13E4M with 1.43.3.2 FW)
+    { 0x1e10, 0x3103 }, // Point Grey Grasshopper 3 (GS3-U3-23S6M)
     { 0x1e10, 0x3300 }, // Point Grey Flea 3 (FL3-U3-13E4M with 2.7.3.0 FW)
+       { 0x1e10, 0x3800 }, // Point Grey Ladybug 5 (LD5-U3-51S5C-44)
     { 0, 0 }
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/examples/Makefile.am 
new/libdc1394-2.2.4/examples/Makefile.am
--- old/libdc1394-2.2.3/examples/Makefile.am    2013-10-27 05:21:06.000000000 
+0100
+++ new/libdc1394-2.2.4/examples/Makefile.am    2015-02-12 23:51:16.000000000 
+0100
@@ -4,7 +4,7 @@
 
 A = grab_gray_image grab_partial_image grab_color_image \
        grab_color_image2 helloworld ladybug grab_partial_pvn \
-       basler_sff_info basler_sff_extended_data
+       basler_sff_info basler_sff_extended_data ladybug5capture
 B = dc1394_reset_bus
 
 if HAVE_LIBSDL
@@ -45,6 +45,8 @@
 
 ladybug_SOURCES = ladybug.c
 
+ladybug5capture_SOURCES = ladybug5capture.c
+
 grab_gray_image_SOURCES = grab_gray_image.c
 
 grab_color_image_SOURCES = grab_color_image.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/examples/Makefile.in 
new/libdc1394-2.2.4/examples/Makefile.in
--- old/libdc1394-2.2.3/examples/Makefile.in    2014-09-10 01:28:21.000000000 
+0200
+++ new/libdc1394-2.2.4/examples/Makefile.in    2016-02-03 14:13:06.000000000 
+0100
@@ -109,7 +109,7 @@
        grab_color_image$(EXEEXT) grab_color_image2$(EXEEXT) \
        helloworld$(EXEEXT) ladybug$(EXEEXT) grab_partial_pvn$(EXEEXT) \
        basler_sff_info$(EXEEXT) basler_sff_extended_data$(EXEEXT) \
-       $(am__EXEEXT_3) $(am__EXEEXT_4)
+       ladybug5capture$(EXEEXT) $(am__EXEEXT_3) $(am__EXEEXT_4)
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
 am_basler_sff_extended_data_OBJECTS =  \
        basler_sff_extended_data.$(OBJEXT)
@@ -179,6 +179,10 @@
 ladybug_OBJECTS = $(am_ladybug_OBJECTS)
 ladybug_LDADD = $(LDADD)
 ladybug_DEPENDENCIES = ../dc1394/libdc1394.la
+am_ladybug5capture_OBJECTS = ladybug5capture.$(OBJEXT)
+ladybug5capture_OBJECTS = $(am_ladybug5capture_OBJECTS)
+ladybug5capture_LDADD = $(LDADD)
+ladybug5capture_DEPENDENCIES = ../dc1394/libdc1394.la
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -219,14 +223,16 @@
        $(dc1394_vloopback_SOURCES) $(grab_color_image_SOURCES) \
        $(grab_color_image2_SOURCES) $(grab_gray_image_SOURCES) \
        $(grab_partial_image_SOURCES) $(grab_partial_pvn_SOURCES) \
-       $(helloworld_SOURCES) $(ladybug_SOURCES)
+       $(helloworld_SOURCES) $(ladybug_SOURCES) \
+       $(ladybug5capture_SOURCES)
 DIST_SOURCES = $(basler_sff_extended_data_SOURCES) \
        $(basler_sff_info_SOURCES) $(dc1394_iso_SOURCES) \
        $(dc1394_multiview_SOURCES) $(dc1394_reset_bus_SOURCES) \
        $(dc1394_vloopback_SOURCES) $(grab_color_image_SOURCES) \
        $(grab_color_image2_SOURCES) $(grab_gray_image_SOURCES) \
        $(grab_partial_image_SOURCES) $(grab_partial_pvn_SOURCES) \
-       $(helloworld_SOURCES) $(ladybug_SOURCES)
+       $(helloworld_SOURCES) $(ladybug_SOURCES) \
+       $(ladybug5capture_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -449,8 +455,8 @@
 AM_CPPFLAGS = -I$(top_srcdir)
 A = grab_gray_image grab_partial_image grab_color_image \
        grab_color_image2 helloworld ladybug grab_partial_pvn \
-       basler_sff_info basler_sff_extended_data $(am__append_1) \
-       $(am__append_3)
+       basler_sff_info basler_sff_extended_data ladybug5capture \
+       $(am__append_1) $(am__append_3)
 B = dc1394_reset_bus $(am__append_2)
 @HAVE_LINUX_TRUE@@HAVE_OPENGL_TRUE@GL_LIBS = -lGL
 @HAVE_OPENGL_TRUE@@HAVE_WINDOWS_TRUE@GL_LIBS = -lopengl32
@@ -458,6 +464,7 @@
 LDADD = ../dc1394/libdc1394.la
 helloworld_SOURCES = helloworld.c
 ladybug_SOURCES = ladybug.c
+ladybug5capture_SOURCES = ladybug5capture.c
 grab_gray_image_SOURCES = grab_gray_image.c
 grab_color_image_SOURCES = grab_color_image.c
 grab_color_image2_SOURCES = grab_color_image2.c
@@ -619,6 +626,10 @@
        @rm -f ladybug$(EXEEXT)
        $(AM_V_CCLD)$(LINK) $(ladybug_OBJECTS) $(ladybug_LDADD) $(LIBS)
 
+ladybug5capture$(EXEEXT): $(ladybug5capture_OBJECTS) 
$(ladybug5capture_DEPENDENCIES) $(EXTRA_ladybug5capture_DEPENDENCIES) 
+       @rm -f ladybug5capture$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(ladybug5capture_OBJECTS) $(ladybug5capture_LDADD) 
$(LIBS)
+
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
 
@@ -639,6 +650,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grab_partial_pvn.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ladybug.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ladybug5capture.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF 
$(DEPDIR)/$*.Tpo -c -o $@ $<
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdc1394-2.2.3/examples/ladybug5capture.c 
new/libdc1394-2.2.4/examples/ladybug5capture.c
--- old/libdc1394-2.2.3/examples/ladybug5capture.c      1970-01-01 
01:00:00.000000000 +0100
+++ new/libdc1394-2.2.4/examples/ladybug5capture.c      2015-02-12 
23:55:40.000000000 +0100
@@ -0,0 +1,205 @@
+/*
+ * File: ladybug5capture.c
+ *
+ * Capture program prototype for the spherical 6-CCD Ladybug 5
+ *   camera from Point Grey
+ *
+ * Written by Martin Peris <[email protected]>
+ *
+ * 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
+ *
+ * Notes:
+ *
+ * - Uses the first camera on the bus, then prints the camera information
+ *  and sets up the camera in RAW8 mode (mode 7_0), capture NFRAMES
+ *  frames to the HDD and prints the information of each frame.
+ *
+ * - In RAW8 mode the 6 images come in a big array of 2528x12484 pixels.
+ *   Each individual image is supposed to be 2448x2048 but the camera 
+ *   introduces some padding.
+ *   
+ * - Ladybug 5 sensors are arranged in "portrait" orientation to increase
+ *   the vertical field of view. As a result, height measurements appear
+ *   as width, and width measurements appear as height
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+#include <dc1394/dc1394.h>
+
+#define NFRAMES 10
+
+void print_format7_info(dc1394format7modeset_t *info)
+{
+    for (int i = 0; i < DC1394_VIDEO_MODE_FORMAT7_NUM; i++) {
+        if (info->mode[i].present) {
+            printf("------ Camera format 7_%d information ------\n", i);
+            printf("Size x                             :        %u\n", 
info->mode[i].size_x);
+            printf("Size y                             :        %u\n", 
info->mode[i].size_y);
+            printf("Max Size x                         :        %u\n", 
info->mode[i].max_size_x);
+            printf("Max Size y                         :        %u\n", 
info->mode[i].max_size_y);
+            printf("Pos x                              :        %u\n", 
info->mode[i].pos_x);
+            printf("Pos y                              :        %u\n", 
info->mode[i].pos_y);
+            printf("Unit Size x                        :        %u\n", 
info->mode[i].unit_size_x);
+            printf("Unit Size y                        :        %u\n", 
info->mode[i].unit_size_y);
+            printf("Unit Pos x                         :        %u\n", 
info->mode[i].unit_pos_x);
+            printf("Unit Pos y                         :        %u\n", 
info->mode[i].unit_pos_y);
+            printf("Color codings                      :        ");
+            for (int j = 0; j < info->mode[i].color_codings.num; j++) {
+                printf("%u%c ", info->mode[i].color_codings.codings[j], j == 
info->mode[i].color_codings.num-1 ? ' ':',');
+            }
+            printf("\n");
+            printf("Color coding                       :        %u\n", 
info->mode[i].color_coding);
+            printf("Pixnum                             :        %u\n", 
info->mode[i].pixnum);
+            printf("Packet size                        :        %u\n", 
info->mode[i].packet_size);
+            printf("Unit Packet size                   :        %u\n", 
info->mode[i].unit_packet_size);
+            printf("Max Packet size                    :        %u\n", 
info->mode[i].max_packet_size);
+        }
+    }
+}
+
+void print_frame_info(dc1394video_frame_t *frame)
+{
+    printf("------ Frame information ------\n");
+    printf("Size x                             :        %u\n", frame->size[0]);
+    printf("Size y                             :        %u\n", frame->size[1]);
+    printf("Pos x                              :        %u\n", 
frame->position[0]);
+    printf("Pos y                              :        %u\n", 
frame->position[1]);
+    printf("Color coding                       :        %u\n", 
frame->color_coding);
+    printf("Color filter                       :        %u\n", 
frame->color_filter);
+    printf("yuv byte order                     :        %u\n", 
frame->yuv_byte_order);
+    printf("data depth                         :        %u\n", 
frame->data_depth);
+    printf("stride                             :        %u\n", frame->stride);
+    printf("video mode                         :        %d\n", 
frame->video_mode);
+    printf("total bytes                        :        %lu\n", 
frame->total_bytes);
+    printf("image bytes                        :        %u\n", 
frame->image_bytes);
+    printf("padding bytes                      :        %u\n", 
frame->padding_bytes);
+    printf("packet size                        :        %u\n", 
frame->packet_size);
+    printf("packets per frame                  :        %u\n", 
frame->packets_per_frame);
+    printf("timestamp                          :        %lu\n", 
frame->timestamp);
+    printf("frames behind                      :        %u\n", 
frame->frames_behind);
+    printf("id                                 :        %u\n", frame->id);
+    printf("allocated image bytes              :        %lu\n", 
frame->allocated_image_bytes);
+    printf("little emdian                      :        %s\n", 
frame->little_endian == DC1394_TRUE ? "Yes" : "No");
+    printf("data in padding                    :        %s\n", 
frame->data_in_padding == DC1394_TRUE ? "Yes" : "No");
+}
+
+int main(int argc, const char * argv[]) {
+
+    dc1394_t *d;
+    dc1394camera_list_t *list;
+    dc1394error_t err;
+    dc1394camera_t *camera;
+    dc1394format7modeset_t modeset;
+    dc1394video_frame_t *frame;
+    FILE* imagefile;
+    char filename[256];
+    int i = 0;
+
+    d = dc1394_new();
+    if (!d) {
+        return 1;
+    }
+
+    err = dc1394_camera_enumerate(d, &list);
+    DC1394_ERR_RTN(err, "Failed to enumerate cameras");
+    if (list->num == 0) {
+        dc1394_log_error("No cameras found");
+        dc1394_free(d);
+        return 1;
+    }
+    printf("Detected %d cameras\n", list->num);
+
+    // Assume that Ladybug 5 is detected as camera #0
+    camera = dc1394_camera_new(d, list->ids[0].guid);
+    if (!camera) {
+        dc1394_log_error("Failed to initialize camera with guid %llx", 
list->ids[0].guid);
+        dc1394_free(d);
+    }
+    dc1394_camera_free_list(list);
+    printf("Using camera %s %s\n", camera->vendor, camera->model);
+
+    // Report camera info
+    err = dc1394_camera_print_info(camera, stdout);
+    DC1394_ERR_RTN(err, "Could not print camera info");
+
+
+    // Setup video mode, etc...
+    err = dc1394_video_set_operation_mode(camera, DC1394_OPERATION_MODE_1394B);
+    DC1394_ERR_RTN(err, "Could not set B mode");
+    err = dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_MAX);
+    DC1394_ERR_RTN(err, "Could not set max speed");
+    err = dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_FORMAT7_0);
+    DC1394_ERR_RTN(err, "Could not set DC1394_VIDEO_MODE_FORMAT7_0");
+
+    // Get format7 mode info
+    err = dc1394_format7_get_modeset(camera, &modeset);
+    DC1394_ERR_RTN(err, "Could not get format 7 mode info\n");
+    print_format7_info(&modeset);
+
+
+    // Set format 7 roi
+    err = dc1394_format7_set_roi(camera,
+                                 DC1394_VIDEO_MODE_FORMAT7_0,
+                                 modeset.mode[0].color_coding,
+                                 modeset.mode[0].max_packet_size,
+                                 modeset.mode[0].pos_x,
+                                 modeset.mode[0].pos_y,
+                                 modeset.mode[0].max_size_x,
+                                 modeset.mode[0].max_size_y);
+    DC1394_ERR_RTN(err, "Could not set max ROI");
+
+    // Set capture
+    err = dc1394_capture_setup(camera, 10, DC1394_CAPTURE_FLAGS_DEFAULT);
+    DC1394_ERR_RTN(err, "Could not setup capture");
+    err = dc1394_video_set_transmission(camera, DC1394_ON);
+    DC1394_ERR_RTN(err, "Could not start transmission");
+
+    while (i < NFRAMES) {
+        // Capture image
+        printf("Capturing image %d\n", i);
+        err = dc1394_capture_dequeue(camera, DC1394_CAPTURE_POLICY_WAIT, 
&frame);
+        DC1394_ERR_RTN(err, "Could not dequeue a frame");
+        
+        // Do something with the image
+        print_frame_info(frame);
+
+        // Save the image
+        sprintf(filename, "%05d.pgm",i);
+        imagefile = fopen(filename, "wb");
+        if ( imagefile == NULL ) {
+            printf("Could not save image\n");
+            continue;
+        }
+        fprintf(imagefile, "P5\n%u %u 255\n", frame->size[0], frame->size[1]);
+        fwrite(frame->image, 1, frame->image_bytes, imagefile);
+        fclose(imagefile);
+        printf("Saved image %s\n", filename);
+
+        err = dc1394_capture_enqueue(camera, frame);
+        DC1394_ERR_RTN(err, "Could enqueue a frame");
+
+        i++;
+    }
+
+    dc1394_camera_free(camera);
+    dc1394_free(d);
+    return 0;
+}


Reply via email to