Use a single definition of BayerTile enum

Use a single definition of BayerTile enum inside a new
include file bayer-types.h instead of (conditionally!)
duplicating the definition from libgphoto2/bayer.h to
camlibs/stv680-demosaic-sharpen.h.
This commit is contained in:
Hans Ulrich Niedermann
2021-10-07 00:04:30 +02:00
parent eb0430ab31
commit 9cb01c2641
5 changed files with 52 additions and 30 deletions

View File

@@ -27,4 +27,3 @@ void light_enhance(unsigned int vw, unsigned int vh, unsigned int coarse, unsign
unsigned char avg_pix_val, unsigned char *output);
#endif /* !defined(CAMLIBS_STV0680_BAYER_H) */

View File

@@ -3,18 +3,9 @@
#ifndef CAMLIBS_STV0680_DEMOSAIC_SHARPEN_H
#define CAMLIBS_STV0680_DEMOSAIC_SHARPEN_H
#ifndef LIBGPHOTO2_BAYER_H
typedef enum _BayerTile{
BAYER_TILE_RGGB = 0,
BAYER_TILE_GRBG = 1,
BAYER_TILE_BGGR = 2,
BAYER_TILE_GBRG = 3,
BAYER_TILE_RGGB_INTERLACED = 4, /* scanline order: R1,G1,R2,G2,...,G1,B1,G2,B2,... */
BAYER_TILE_GRBG_INTERLACED = 5,
BAYER_TILE_BGGR_INTERLACED = 6,
BAYER_TILE_GBRG_INTERLACED = 7
} BayerTile;
#endif
#include "bayer-types.h"
void demosaic_sharpen (const int width, const int height,
const unsigned char * const src_region,

View File

@@ -26,7 +26,7 @@ libgphoto2_la_LDFLAGS = \
libgphoto2_la_SOURCES = \
gphoto2-abilities-list.c\
ahd_bayer.c \
bayer.c bayer.h \
bayer.c bayer.h bayer-types.h \
gphoto2-camera.c \
gphoto2-context.c \
exif.c exif.h \

44
libgphoto2/bayer-types.h Normal file
View File

@@ -0,0 +1,44 @@
/** \file bayer-types.h
* \brief bayer type definitions common to camlibs and libgphoto2
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* \note
* 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.
*
* \note
* 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.
*
* \note
* 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_BAYER_TYPES_H
#define LIBGPHOTO2_BAYER_TYPES_H
/**
* \brief how the bayer CCD array is laid out
*
* This enumeration defines how the CCD bayer array is laid out.
*/
typedef enum {
BAYER_TILE_RGGB = 0, /**< \brief raster is RG,GN */
BAYER_TILE_GRBG = 1, /**< \brief raster is GR,BG */
BAYER_TILE_BGGR = 2, /**< \brief raster is BG,GR */
BAYER_TILE_GBRG = 3, /**< \brief raster is RG,GB */
BAYER_TILE_RGGB_INTERLACED = 4, /**< \brief scanline order: R1,G1,R2,G2,...,G1,B1,G2,B2,... */
BAYER_TILE_GRBG_INTERLACED = 5, /**< \brief scanline order: G1,R1,R2,G2,...,B1,G1,B2,G2,... */
BAYER_TILE_BGGR_INTERLACED = 6, /**< \brief scanline order: B1,G1,R2,G2,...,G1,R1,G2,R2,... */
BAYER_TILE_GBRG_INTERLACED = 7, /**< \brief scanline order: G1,B1,G2,B2,...,R1,G1,R2,G2,... */
} BayerTile;
#endif /* !defined(LIBGPHOTO2_BAYER_TYPES_H) */

View File

@@ -1,4 +1,4 @@
/** \file
/** \file bayer.h
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
@@ -24,21 +24,9 @@
#ifndef LIBGPHOTO2_BAYER_H
#define LIBGPHOTO2_BAYER_H
/**
* \brief how the bayer CCD array is laid out
*
* This enumeration defines how the CCD bayer array is laid out.
*/
typedef enum {
BAYER_TILE_RGGB = 0, /**< \brief raster is RG,GN */
BAYER_TILE_GRBG = 1, /**< \brief raster is GR,BG */
BAYER_TILE_BGGR = 2, /**< \brief raster is BG,GR */
BAYER_TILE_GBRG = 3, /**< \brief raster is RG,GB */
BAYER_TILE_RGGB_INTERLACED = 4, /**< \brief scanline order: R1,G1,R2,G2,...,G1,B1,G2,B2,... */
BAYER_TILE_GRBG_INTERLACED = 5, /**< \brief scanline order: G1,R1,R2,G2,...,B1,G1,B2,G2,... */
BAYER_TILE_BGGR_INTERLACED = 6, /**< \brief scanline order: B1,G1,R2,G2,...,G1,R1,G2,R2,... */
BAYER_TILE_GBRG_INTERLACED = 7, /**< \brief scanline order: G1,B1,G2,B2,...,R1,G1,R2,G2,... */
} BayerTile;
#include "bayer-types.h"
int gp_bayer_expand (unsigned char *input, int w, int h, unsigned char *output,
BayerTile tile);