packages: libdc1394/libdc1394.spec, libdc1394/libdc1394-avt.patch (NEW) - a...

qboosh qboosh at pld-linux.org
Sun Jan 23 17:29:00 CET 2011


Author: qboosh                       Date: Sun Jan 23 16:29:00 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- added avt patch (AVT cameras support enhancement from vendor)
- P: libdc1394*(avt)
- release 2

---- Files affected:
packages/libdc1394:
   libdc1394.spec (1.31 -> 1.32) , libdc1394-avt.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/libdc1394/libdc1394.spec
diff -u packages/libdc1394/libdc1394.spec:1.31 packages/libdc1394/libdc1394.spec:1.32
--- packages/libdc1394/libdc1394.spec:1.31	Thu Jan  6 09:23:39 2011
+++ packages/libdc1394/libdc1394.spec	Sun Jan 23 17:28:55 2011
@@ -7,13 +7,15 @@
 Summary(pl.UTF-8):	Biblioteka dla specyfikacji Kamera Cyfrowa 1394
 Name:		libdc1394
 Version:	2.1.3
-Release:	1
+Release:	2
 License:	LGPL v2.1+
 Group:		Libraries
 Source0:	http://downloads.sourceforge.net/libdc1394/%{name}-%{version}.tar.gz
 # Source0-md5:	d8b2cbfae1b329fdeaa638da80427334
 Patch0:		%{name}-link.patch
 Patch1:		%{name}-ac.patch
+# libdc1394-2.1.2 vs libdc1394_avt-2.1.2 diff (http://www.alliedvisiontec.com/fileadmin/content/PDF/Software/AVT_software/zip_files/AVTFire4Linux3v0.src.tar/libdc1394_avt-2.1.2.tar.gz)
+Patch2:		%{name}-avt.patch
 URL:		http://sourceforge.net/projects/libdc1394/
 BuildRequires:	autoconf >= 2.60
 BuildRequires:	automake >= 1:1.9.6
@@ -24,6 +26,7 @@
 BuildRequires:	xorg-lib-libX11-devel
 BuildRequires:	xorg-lib-libXext-devel
 BuildRequires:	xorg-lib-libXv-devel
+Provides:	libdc1394(avt) = %{version}-%{release}
 Requires:	libraw1394 >= 1.2.0
 Requires:	libusb >= 1.0
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -45,6 +48,7 @@
 Summary:	libdc1394 header files
 Summary(pl.UTF-8):	Pliki nagłówkowe libdc1394
 Group:		Development/Libraries
+Provides:	libdc1394-devel(avt) = %{version}-%{release}
 Requires:	%{name} = %{version}-%{release}
 Requires:	libraw1394-devel >= 1.2.0
 Requires:	libusb-devel >= 1.0
@@ -59,6 +63,7 @@
 Summary:	Static libdc1394 library
 Summary(pl.UTF-8):	Statyczna biblioteka libdc1394
 Group:		Development/Libraries
+Provides:	libdc1394-static(avt) = %{version}-%{release}
 Requires:	%{name}-devel = %{version}-%{release}
 
 %description static
@@ -71,6 +76,7 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__libtoolize}
@@ -90,6 +96,7 @@
 
 # man pages for noinst examples
 %{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/{dc1394_multiview,grab_{color,gray,partial}_image}.1
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/avt_singleview.1
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -126,6 +133,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.32  2011/01/23 16:28:55  qboosh
+- added avt patch (AVT cameras support enhancement from vendor)
+- P: libdc1394*(avt)
+- release 2
+
 Revision 1.31  2011/01/06 08:23:39  qboosh
 - updated to 2.1.3
 

================================================================
Index: packages/libdc1394/libdc1394-avt.patch
diff -u /dev/null packages/libdc1394/libdc1394-avt.patch:1.1
--- /dev/null	Sun Jan 23 17:29:01 2011
+++ packages/libdc1394/libdc1394-avt.patch	Sun Jan 23 17:28:55 2011
@@ -0,0 +1,7522 @@
+diff -Nur libdc1394-2.1.2/dc1394/bayer_avt.c libdc1394_avt-2.1.2/dc1394/bayer_avt.c
+--- libdc1394-2.1.2/dc1394/bayer_avt.c	1970-01-01 01:00:00.000000000 +0100
++++ libdc1394_avt-2.1.2/dc1394/bayer_avt.c	2010-01-12 16:30:41.000000000 +0100
+@@ -0,0 +1,342 @@
++/*
++ * 1394-Based Digital Camera Control Library
++ *
++ * AVT Bayer pattern decoding functions
++ *
++ * Copyright (C) 2010 Allied Vision Technologies GmbH
++ *
++ * 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 <stdint.h>
++#include <dc1394/types.h>
++#include <dc1394/log.h>
++#include <string.h>
++
++#ifndef MIN
++  #define MIN(a,b) ((a) < (b) ? (a) : (b))
++#endif
++#ifndef MAX
++  #define MAX(a,b) ((a) < (b) ? (b) : (a))
++#endif
++
++//! Structure for accessing data in the YUV 4:4:4 format (YUV)
++typedef struct
++{
++    uint8_t Y;   //!< Luma
++    uint8_t U;   //!< U
++    uint8_t V;   //!< V
++} S_YUV444;
++
++//! Structure for accessing data in the YUV 4:2:2 format (UYVY)
++typedef struct
++{
++    uint8_t U;   //!< the U part for both pixels
++    uint8_t Y0;  //!< the intensity of the first pixel
++    uint8_t V;   //!< the V part for both pixels
++    uint8_t Y1;  //!< the intensity of the second pixel
++}  S_YUV422;
++
++//! Structure for accessing data in the 24 bit RGB format
++typedef struct
++{
++    uint8_t R;   //!< red
++    uint8_t G;   //!< green
++    uint8_t B;   //!< blue
++}  S_RGB8;
++
++////////////////////////////////////////////////////////////////////////////////
++// Convert raw mode with 8 bit values
++////////////////////////////////////////////////////////////////////////////////
++
++void dc1394_avt_Raw8ToYUV444(uint8_t *pDst1, const uint8_t *pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern)
++{
++    const uint8_t    *pBuf    =   pSrc;
++    const uint8_t    *pR,*pB,*pG0,*pG1; // G0:the green pixel in the same column as the red pixel
++    uint32_t         i,j;
++    S_YUV444 *pDst         = (S_YUV444*) pDst1;
++    uint32_t uColorOffsetY = (uint32_t) bayerPattern/2;
++    uint32_t uColorOffsetX = (uint32_t) bayerPattern%2;
++    int16_t U;
++    int16_t V;
++    uint8_t G;
++
++
++    for(i=uColorOffsetY; i<YSize+uColorOffsetY-1; i++,pBuf+=XSize)
++    {
++        switch((i&1)+2*uColorOffsetX)
++        {
++        case 3:
++            pB  = pBuf; 
++            pG0 = pB+1; 
++            pG1 = pB+XSize; 
++            pR  = pG1+1;
++            break;
++        case 2:
++            pG1 = pBuf; 
++            pR  = pG1+1;
++            pB  = pG1+XSize; 
++            pG0 = pB+1;
++            break;
++        case 1:
++            pG0 = pBuf; 
++            pB  = pG0+1;
++            pR  = pG0+XSize; 
++            pG1 = pR+1;
++            break;
++        case 0:
++        default:
++            pR  = pBuf; 
++            pG1 = pR+1; 
++            pG0 = pR+XSize; 
++            pB  = pG0+1;
++            break;
++        }
++
++        // Go through all pixels
++        for(j=uColorOffsetX;j<XSize+uColorOffsetX-1;j++)
++        {
++            G       = (uint8_t)(((uint16_t)*pG0+*pG1)/2);
++            U       = ((*pB)<<7) - 43* *pR - 85* G;
++            V       = ((*pR)<<7) -107* G - 21* *pB;
++            pDst->Y = (uint8_t)(( 77* *pR +150* G + 29* *pB) >>8);
++            pDst->U = (uint8_t)((U>>8) + 128);
++            pDst->V = (uint8_t)((V>>8) + 128);
++
++            pDst++;
++
++            if(j&1)
++            {
++                pB  +=2; 
++                pG1 +=2;
++            }
++            else
++            {
++                pR  +=2; 
++                pG0 +=2;
++            }
++        }
++        pDst->Y = (pDst-1)->Y;
++        pDst->U = (pDst-1)->U;
++        pDst->V = (pDst-1)->V;
++
++        pDst++;
++    }
++
++    memcpy(pDst,pDst-XSize,XSize*sizeof(S_YUV444));
++}
++
++
++/*
++ * Inplace YUV444->YUV422 conversion with horizontal averaging.
++ * A 4x1 averaging window is used.
++ * Image width is expected to be a multiple of 2.
++ * The resulting data is not packed in YUV 422 format, data format is still YUV444.
++ * However, valid U and V components are stored only for pixels with even X-coordinate.
++ */
++void dc1394_avt_YUV_averaging_4(uint8_t *pDst, uint32_t XSize, uint32_t YSize)
++{
++    S_YUV444 *dst = (S_YUV444*) pDst;
++
++    S_YUV444 *pLineEnd = dst + XSize - 4;
++    S_YUV444 *pFrameEnd = dst + (XSize*YSize) - 2;
++
++    for(;;)
++    {
++        dst[0].U = (uint8_t) ( ( (uint16_t) dst[0].U + dst[1].U + dst[2].U + dst[3].U ) / 4 );
++        dst[0].V = (uint8_t) ( ( (uint16_t) dst[0].V + dst[1].V + dst[2].V + dst[3].V ) / 4 );
++
++        if( dst == pLineEnd )
++        {
++            /* a smaller averaging window is used for the last column */
++            dst += 2;
++            dst[0].U = (uint8_t) ( ( (uint16_t) dst[0].U + dst[1].U ) / 2 );
++            dst[0].V = (uint8_t) ( ( (uint16_t) dst[0].V + dst[1].V ) / 2 );
++            if( dst == pFrameEnd )
++            {
++                break;
++            }
++            pLineEnd += XSize;
++        } 
++        dst += 2;
++    }
++}
++
++
++/*
++ * Inplace YUV444->YUV422 conversion with horizontal averaging.
++ * A 2x1 averaging window is used.
++ * Image width is expected to be a multiple of 2.
++ * The resulting data is not packed in YUV 422 format, data format is still YUV444.
++ * However, valid U and V components are stored only for pixels with even X-coordinate.
++ */
++void dc1394_avt_YUV_averaging_2(void *pDst, uint32_t XSize, uint32_t YSize) 
++
++{
++
++    S_YUV444        *dst    = (S_YUV444*) ( pDst);
++
++    S_YUV444        *pFrameEnd = dst+(XSize*YSize);
++
++    for(;;)
++    {
++        dst[0].U = (uint8_t) ( ( (uint16_t) dst[0].U + dst[1].U ) / 2 );
++        dst[0].V = (uint8_t) ( ( (uint16_t) dst[0].V + dst[1].V ) / 2 );
++        dst += 2;
++        if( dst >= pFrameEnd )
++        {
++            break;
++        }
++    }
++}
++
++
++/*
++ * Inplace YUV444->YUV422 conversion with horizontal averaging.
++ * A 4x2 averaging window is used.
++ * Image width is expected to be a multiple of 2.
++ * The resulting data is not packed in YUV 422 format, data format is still YUV444.
++ * However, valid U and V components are stored only for pixels with even X-coordinate.
++ */
++void dc1394_avt_YUV_averaging_42(uint8_t *pDst, uint32_t XSize, uint32_t YSize)
++{
++    S_YUV444 *pYUV         = (S_YUV444 *) pDst;
++    S_YUV444 *pYUV_NextRow = pYUV + XSize;
++    S_YUV444 *pLineEnd     = pYUV + XSize - 4;
++    S_YUV444 *pFrameEnd    = pYUV + (XSize*(YSize-1));
++
++    /* special treatment for first pixel */
++    pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[0].U + pYUV[1].U + pYUV[2].U + 
++                              pYUV_NextRow[0].U + pYUV_NextRow[1].U + pYUV_NextRow[2].U + 3 ) / 6 ); 
++    pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[0].V + pYUV[1].V + pYUV[2].V + 
++                              pYUV_NextRow[0].V + pYUV_NextRow[1].V + pYUV_NextRow[2].V + 3 ) / 6 ); 
++
++    for (;;)
++    {
++        /* main loop - standard processing */
++        pYUV += 2;
++        pYUV_NextRow += 2;
++        pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[-1].U + pYUV[0].U + pYUV[1].U + pYUV[2].U + 
++                                  pYUV_NextRow[-1].U + pYUV_NextRow[0].U + pYUV_NextRow[1].U + pYUV_NextRow[2].U + 4 ) / 8 );
++        pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[-1].V + pYUV[0].V + pYUV[1].V + pYUV[2].V + 
++                                  pYUV_NextRow[-1].V + pYUV_NextRow[0].V + pYUV_NextRow[1].V + pYUV_NextRow[2].V + 4 ) / 8 );
++
++        if( pYUV == pLineEnd )
++        {
++            /* special treatment for last pixel of each row */
++            pYUV += 2;
++            pYUV_NextRow += 2;
++            pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[-1].U + pYUV[0].U + pYUV[1].U + 
++                                  pYUV_NextRow[-1].U + pYUV_NextRow[0].U + pYUV_NextRow[1].U + 3 ) / 6 ); 
++            pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[-1].V + pYUV[0].V + pYUV[1].V  + 
++                                  pYUV_NextRow[-1].V + pYUV_NextRow[0].V + pYUV_NextRow[1].V + 3 ) / 6 );
++            pLineEnd += XSize;
++
++            pYUV += 2;
++            pYUV_NextRow += 2;
++            if ( pYUV == pFrameEnd )
++            {
++                break;
++            }
++
++            /* special treatment for first pixel of each row */
++            pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[0].U + pYUV[1].U + pYUV[2].U + 
++                              pYUV_NextRow[0].U + pYUV_NextRow[1].U + pYUV_NextRow[2].U + 3 ) / 6 ); 
++            pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[0].V + pYUV[1].V + pYUV[2].V + 
++                              pYUV_NextRow[0].V + pYUV_NextRow[1].V + pYUV_NextRow[2].V + 3 ) / 6 ); 
++        }
++    }
++
++    /* special treatment for last line */
++    pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[0].U + pYUV[1].U + pYUV[2].U + 1 ) / 3 ); 
++    pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[0].V + pYUV[1].V + pYUV[2].V + 1 ) / 3 ); 
++    for (;;)
++    {
++        pYUV += 2;
++        pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[-1].U + pYUV[0].U + pYUV[1].U + pYUV[2].U + 2 ) / 4 ); 
++        pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[-1].V + pYUV[0].V + pYUV[1].V + pYUV[2].V + 2 ) / 4 );
++        if( pYUV == pLineEnd )
++        {
++            /* special treatment for last pixel */
++            pYUV += 2;
++            pYUV[0].U = (uint8_t) ( ( (uint16_t) pYUV[-1].U + pYUV[0].U + pYUV[1].U + 1 ) / 3 ); 
++            pYUV[0].V = (uint8_t) ( ( (uint16_t) pYUV[-1].V + pYUV[0].V + pYUV[1].V + 1 ) / 3 );
++            break;
++        }
++    }
++}
++
++
++
++/*
++ * Inplace YUV422->RGB conversion.
++ * Image width is expected to be a multiple of 2.
++ * The input data is expected to be in "YUV422 unpacked" format as produced by
++ * dc1394_avt_YUV_averaging_2, dc1394_avt_YUV_averaging_4, dc1394_avt_YUV_averaging_42.
++ */
++void dc1394_avt_YUV422UnpackedToRGB(uint8_t *pDst, uint32_t nPixelCount)
++{
++    S_RGB8 *rgb = (S_RGB8*) (pDst);
++    S_RGB8 *pFrameEnd = rgb + nPixelCount - 2;
++    for(;;)
++    {
++        S_YUV444 *yuv = (S_YUV444*) rgb;
++        uint8_t Y0 = yuv[0].Y;
++        uint8_t U  = yuv[0].U;
++        uint8_t V  = yuv[0].V;
++        uint8_t Y1 = yuv[1].Y;
++
++        const int32_t vr      = (int16_t) ( (float) (V-128) * 1.4022 );
++        const int32_t uvg     = (int16_t) ( (float) (V-128) * (-0.7144) ) + 
++                                 (int16_t) ( (float) (U-128) * (-0.3457) );
++        const int32_t ub      = (int16_t) ( (float) (U-128) * 1.7710 );
++
++        rgb[0].R = MAX( MIN( (int32_t) Y0 + vr , 255 ), 0);
++        rgb[0].G = MAX( MIN( (int32_t) Y0 + uvg, 255 ), 0);
++        rgb[0].B = MAX( MIN( (int32_t) Y0 + ub , 255 ), 0);
++        rgb[1].R = MAX( MIN( (int32_t) Y1 + vr , 255 ), 0);
++        rgb[1].G = MAX( MIN( (int32_t) Y1 + uvg, 255 ), 0);
++        rgb[1].B = MAX( MIN( (int32_t) Y1 + ub , 255 ), 0);
++
++        if( rgb == pFrameEnd )
++        {
++            break;
++        }
++        rgb += 2;
++    }
++}
++
++void dc1394_avt_Raw8ToRGB_YUV422(uint8_t *restrict pDst, const uint8_t *restrict pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern)  
++{
++    dc1394_avt_Raw8ToYUV444(pDst, pSrc, XSize, YSize, bayerPattern);
++    dc1394_avt_YUV_averaging_2( pDst, XSize, YSize);
++    dc1394_avt_YUV422UnpackedToRGB(pDst, XSize*YSize );
++}
++
++void dc1394_avt_Raw8ToRGB_LCAA(uint8_t *restrict pDst, const uint8_t *restrict pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern) 
++{
++    dc1394_avt_Raw8ToYUV444(pDst, pSrc, XSize, YSize, bayerPattern);
++    dc1394_avt_YUV_averaging_4(pDst, XSize, YSize );
++    dc1394_avt_YUV422UnpackedToRGB(pDst, XSize*YSize);
++}
++
++void dc1394_avt_Raw8ToRGB_LCAAV(uint8_t *restrict pDst, const uint8_t *restrict pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern) 
++{
++    dc1394_avt_Raw8ToYUV444(pDst, pSrc, XSize, YSize, bayerPattern);
++    dc1394_avt_YUV_averaging_42( pDst, XSize, YSize);
++    dc1394_avt_YUV422UnpackedToRGB(pDst, XSize*YSize);
++}
++
++
+diff -Nur libdc1394-2.1.2/dc1394/bayer.c libdc1394_avt-2.1.2/dc1394/bayer.c
+--- libdc1394-2.1.2/dc1394/bayer.c	2009-06-11 06:05:47.000000000 +0200
++++ libdc1394_avt-2.1.2/dc1394/bayer.c	2010-01-12 15:47:01.000000000 +0100
+@@ -26,6 +26,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include "conversions.h"
++#include "vendor/avt.h"
+ 
+ #define CLIP(in, out)\
+    in = in < 0 ? 0 : in;\
+@@ -37,6 +38,16 @@
+    in = in > ((1<<bits)-1) ? ((1<<bits)-1) : in;\
+    out=in;
+ 
++
++/* debayering methods defined in bayer_avt.c */
++extern void dc1394_avt_Raw8ToRGB_YUV422(uint8_t *restrict pDst, const uint8_t *restrict pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern);
++
++extern void dc1394_avt_Raw8ToRGB_LCAA(uint8_t *restrict pDst, const uint8_t *restrict pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern);
++
++extern void dc1394_avt_Raw8ToRGB_LCAAV(uint8_t *restrict pDst, const uint8_t *restrict pSrc, uint32_t XSize, uint32_t YSize, dc1394color_filter_t bayerPattern);
++
++
++
+ void
+ ClearBorders(uint8_t *rgb, int sx, int sy, int w)
+ {
+@@ -1997,6 +2008,15 @@
+         return dc1394_bayer_VNG(bayer, rgb, sx, sy, tile);
+     case DC1394_BAYER_METHOD_AHD:
+         return dc1394_bayer_AHD(bayer, rgb, sx, sy, tile);
++    case DC1394_BAYER_METHOD_AVT_YUV422:
++        dc1394_avt_Raw8ToRGB_YUV422( rgb, bayer, sx, sy, tile);
++        return DC1394_SUCCESS;
++    case DC1394_BAYER_METHOD_AVT_LCAA:
++        dc1394_avt_Raw8ToRGB_LCAA( rgb, bayer, sx, sy, tile);
++        return DC1394_SUCCESS;
++    case DC1394_BAYER_METHOD_AVT_LCAAV:
++        dc1394_avt_Raw8ToRGB_LCAAV( rgb, bayer, sx, sy, tile);
++        return DC1394_SUCCESS;
+     default:
+         return DC1394_INVALID_BAYER_METHOD;
+   }
+@@ -2006,6 +2026,10 @@
+ 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)
+ {
++    /* bits=0 indicates MSB-aligned data */
++    if(bits==0)
++        bits = 16;
++
+     switch (method) {
+     case DC1394_BAYER_METHOD_NEAREST:
+         return dc1394_bayer_NearestNeighbor_uint16(bayer, rgb, sx, sy, tile, bits);
+@@ -2023,6 +2047,10 @@
+         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);
++    case DC1394_BAYER_METHOD_AVT_YUV422:
++    case DC1394_BAYER_METHOD_AVT_LCAA:
++    case DC1394_BAYER_METHOD_AVT_LCAAV:
++        return DC1394_FUNCTION_NOT_SUPPORTED;
+     default:
+         return DC1394_INVALID_BAYER_METHOD;
+     }
+@@ -2064,7 +2092,9 @@
+ 
+     // 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) )
++	 (in->color_coding==DC1394_COLOR_CODING_MONO16)  ||
++     (in->color_coding==DC1394_COLOR_CODING_AVT_RAW12) ||
++     (in->color_coding==DC1394_COLOR_CODING_AVT_MONO12) )
+         out->data_depth=in->data_depth;
+     else
+         out->data_depth=8;
+@@ -2148,6 +2178,15 @@
+             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);
++        case DC1394_BAYER_METHOD_AVT_YUV422:
++            dc1394_avt_Raw8ToRGB_YUV422(out->image, in->image, in->size[0], in->size[1], in->color_filter);
++            return DC1394_SUCCESS;
++        case DC1394_BAYER_METHOD_AVT_LCAA:
++            dc1394_avt_Raw8ToRGB_LCAA(out->image, in->image, in->size[0], in->size[1], in->color_filter);
++            return DC1394_SUCCESS;
++        case DC1394_BAYER_METHOD_AVT_LCAAV:
++            dc1394_avt_Raw8ToRGB_LCAAV(out->image, in->image, in->size[0], in->size[1], in->color_filter);
++            return DC1394_SUCCESS;
+         }
+         break;
+     case DC1394_COLOR_CODING_MONO16:
+@@ -2156,23 +2195,33 @@
+         if(DC1394_SUCCESS != Adapt_buffer_bayer(in,out,method))
+             return DC1394_MEMORY_ALLOCATION_FAILURE;
+             
++        int bits;
++        if(in->camera && DC1394_AVT_VENDOR_ID==in->camera->vendor_id)
++            bits = 16;
++        else
++            bits = in->data_depth;
++
+         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);
++            return dc1394_bayer_NearestNeighbor_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_Simple_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_Bilinear_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_HQLinear_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_Downsample_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_EdgeSense_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_VNG_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
+         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);
++            return dc1394_bayer_AHD_uint16((uint16_t*)in->image, (uint16_t*)out->image, in->size[0], in->size[1], in->color_filter, bits);
++        case DC1394_BAYER_METHOD_AVT_YUV422:
++        case DC1394_BAYER_METHOD_AVT_LCAA:
++        case DC1394_BAYER_METHOD_AVT_LCAAV:
++            return DC1394_FUNCTION_NOT_SUPPORTED;
+         }
+         break;
+     default:
+diff -Nur libdc1394-2.1.2/dc1394/conversions.c libdc1394_avt-2.1.2/dc1394/conversions.c
+--- libdc1394-2.1.2/dc1394/conversions.c	2009-06-11 06:05:47.000000000 +0200
++++ libdc1394_avt-2.1.2/dc1394/conversions.c	2010-01-14 18:19:49.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include "conversions.h"
++#include "vendor/avt.h"
+ 
+ // this should disappear...
+ extern void swab();
+@@ -217,12 +218,76 @@
+ }
+ 
+ dc1394error_t
++dc1394_MONO12_to_YUV422(const uint8_t* restrict src, uint8_t* restrict dest, uint32_t width, uint32_t height, uint32_t byte_order,                                 uint32_t bits)
++{
++    if(width%2!=0)
++    return DC1394_FUNCTION_NOT_SUPPORTED;
++
++    const uint8_t *       packed   = src;
++    const uint8_t * const frameEnd = src + (width*height*3/2);
++          uint8_t *       yuv      = dest;
++
++    switch (byte_order) {
++    case DC1394_BYTE_ORDER_YUYV:
++        if( bits == 12 || bits == 0 ) {
++            while( packed < frameEnd ) {
++                yuv[0] = packed[0];
++                yuv[1] = 128;
++                yuv[2] = packed[2];
++                yuv[3] = 128; 
++                yuv += 4;
++                packed += 3;
++            }
++        }
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libdc1394/libdc1394.spec?r1=1.31&r2=1.32&f=u



More information about the pld-cvs-commit mailing list