colorspaces.h

00001
00002 /***************************************************************************
00003  *  colorspaces.h - This header defines utility functions to deal with
00004  *                  color spaces
00005  *
00006  *  Generated: Tue Feb 23 13:49:38 2005
00007  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024
00025 #ifndef __FIREVISION_UTILS_COLOR_COLORSPACES_H_
00026 #define __FIREVISION_UTILS_COLOR_COLORSPACES_H_
00027 
00028 #include <sys/types.h>
00029 
00030 /** Color spaces. */
00031 typedef enum {
00032   CS_UNKNOWN            =  0,   /**< Unknown color space */
00033   RGB                   =  1,   /**< RGB, three bytes per pixel, one byte per color, ordered
00034                                  * line by line */
00035   YUV411_PACKED         =  2,   /**< YUV image with 4:1:1 sampling, byte order U Y0 Y1 V Y2 Y3 */
00036   YUV411_PLANAR         =  3,   /**< YUV image with 4:1:1 sampling, first Y plane, then U then V plane */
00037   YUY2                  =  4,   /**< YUV image with 4:2:2 sampling, byte order Y0 U Y1 V */
00038   BGR                   =  5,   /**< RGB, 3 bytes per pixel, one byte per color, ordererd
00039                                  * line by line, pixels orderd B G R */
00040   YUV422_PACKED         =  6,   /**< YUV image with 4:2:2 sampling, byte order U Y0 V Y1 */
00041   YUV422_PLANAR         =  7,   /**< YUV image with 4:2:2 sampling, first Y plane, then U then V plane */
00042   GRAY8                 =  8,   /**< plain gray buffer, one byte per pixel */
00043   RGB_WITH_ALPHA        =  9,   /**< RGB with alpha, 4 bytes per pixel, byte order R G B A */
00044   BGR_WITH_ALPHA        = 10,   /**< RGB with alpha, 4 bytes per pixel, byte order B G R A */
00045   BAYER_MOSAIC_RGGB     = 11,   /**< Image has RGGB bayer pattern */
00046   BAYER_MOSAIC_GBRG     = 12,   /**< Image has GBRG bayer pattern */
00047   BAYER_MOSAIC_GRBG     = 13,   /**< Image has GRBG bayer pattern */
00048   BAYER_MOSAIC_BGGR     = 14,   /**< Image has BGGR bayer pattern */
00049   RAW16                 = 15,   /**< Raw image, 2 bytes per pixel, format depends on camera */
00050   RAW8                  = 16,   /**< Raw image, 1 byte per pixel, format depends on camera */
00051   MONO8                 = 17,   /**< Like GRAY8 */
00052   MONO16                = 18,   /**< Gray-scale image, 2 bytes per pixel */
00053   YUV444_PACKED         = 19,   /**< Full sampled YUV, byte order Y U V */
00054   YVU444_PACKED         = 20,   /**< Full sampled YUV, byte order Y V U */
00055   YVY2                  = 21,   /**< YUV image with 4:2:2 sampling, byte order Y0 V Y1 U */
00056   YUV422_PLANAR_QUARTER = 22,   /**< YUV 422 image in planar format, but only quarter of the image,
00057                                  * used for scale-conversion target, buffer is YUV422_PLANAR formatted. */
00058   COLORSPACE_N          = 23    /**< number of colorspaces */
00059 } colorspace_t;
00060
00061
00062 size_t           colorspace_buffer_size(colorspace_t cspace, unsigned int width, unsigned int height);
00063 colorspace_t     colorspace_by_name(const char *colorspace);
00064 const char *     colorspace_to_string(colorspace_t colorspace);
00065 unsigned char *  malloc_buffer(colorspace_t colorspace, unsigned int width, unsigned int height);
00066
00067 #endif