"Fossies" - the Fresh Open Source Software Archive

Member "quicktime4linux-2.3/colormodels.h" (11 Jul 2008, 4735 Bytes) of package /linux/privat/old/quicktime4linux-2.3-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * This library is free software; you can redistribute it and/or modify it
    3  * under the terms of the GNU Lesser General Public License as published
    4  * by the Free Software Foundation; either version 2 of the License, or
    5  * (at your option) any later version.
    6  * 
    7  * This library is distributed in the hope that it will be useful, but
    8  * WITHOUT ANY WARRANTY; without even the implied warranty of
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10  * Lesser General Public License for more details.
   11  * 
   12  * You should have received a copy of the GNU Lesser General Public
   13  * License along with this library; if not, write to the Free Software
   14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
   15  * USA
   16  */
   17  
   18  
   19 #ifndef COLORMODELS_H
   20 #define COLORMODELS_H
   21 
   22 // Colormodels
   23 #define BC_TRANSPARENCY 0
   24 #define BC_COMPRESSED   1
   25 #define BC_RGB8         2
   26 #define BC_RGB565       3
   27 #define BC_BGR565       4
   28 #define BC_BGR888       5
   29 #define BC_BGR8888      6
   30 // Working bitmaps are packed to simplify processing
   31 #define BC_RGB888       9
   32 #define BC_RGBA8888     10
   33 #define BC_ARGB8888     20
   34 #define BC_ABGR8888     21
   35 #define BC_RGB161616    11
   36 #define BC_RGBA16161616 12
   37 #define BC_YUV888       13
   38 #define BC_YUVA8888     14
   39 #define BC_YUV161616    15
   40 #define BC_YUVA16161616 16
   41 #define BC_YUV422       19
   42 #define BC_A8           22
   43 #define BC_A16          23
   44 #define BC_A_FLOAT      31
   45 #define BC_YUV101010    24
   46 #define BC_VYU888       25
   47 #define BC_UYVA8888     26
   48 #define BC_RGB_FLOAT    29
   49 #define BC_RGBA_FLOAT   30
   50 // Planar
   51 #define BC_YUV420P      7
   52 #define BC_YUV422P      17
   53 #define BC_YUV444P      27
   54 #define BC_YUV411P      18
   55 #define BC_YUV9P        28     // Disasterous cmodel from Sorenson
   56 
   57 // Colormodels purely used by Quicktime are done in Quicktime.
   58 
   59 // For communication with the X Server
   60 #define FOURCC_YV12 0x32315659  /* YV12   YUV420P */
   61 #define FOURCC_YUV2 0x32595559  /* YUV2   YUV422 */
   62 #define FOURCC_I420 0x30323449  /* I420   Intel Indeo 4 */
   63 
   64 #undef CLAMP
   65 #define CLAMP(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x))))
   66 
   67 #undef CLIP
   68 #define CLIP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
   69 
   70 
   71 #ifdef __cplusplus
   72 extern "C" {
   73 #endif
   74 
   75 typedef struct
   76 {
   77     int rtoy_tab[0x100], gtoy_tab[0x100], btoy_tab[0x100];
   78     int rtou_tab[0x100], gtou_tab[0x100], btou_tab[0x100];
   79     int rtov_tab[0x100], gtov_tab[0x100], btov_tab[0x100];
   80 
   81     int vtor_tab[0x100], vtog_tab[0x100];
   82     int utog_tab[0x100], utob_tab[0x100];
   83 // Used by init_yuv only
   84     int *vtor, *vtog, *utog, *utob;
   85 
   86     float vtor_float_tab[0x100], vtog_float_tab[0x100];
   87     float utog_float_tab[0x100], utob_float_tab[0x100];
   88     float *vtor_float, *vtog_float, *utog_float, *utob_float;
   89 
   90     int rtoy_tab16[0x10000], gtoy_tab16[0x10000], btoy_tab16[0x10000];
   91     int rtou_tab16[0x10000], gtou_tab16[0x10000], btou_tab16[0x10000];
   92     int rtov_tab16[0x10000], gtov_tab16[0x10000], btov_tab16[0x10000];
   93 
   94     int vtor_tab16[0x10000], vtog_tab16[0x10000];
   95     int utog_tab16[0x10000], utob_tab16[0x10000];
   96     int *vtor16, *vtog16, *utog16, *utob16;
   97 
   98     float v16tor_float_tab[0x10000], v16tog_float_tab[0x10000];
   99     float u16tog_float_tab[0x10000], u16tob_float_tab[0x10000];
  100     float *v16tor_float, *v16tog_float, *u16tog_float, *u16tob_float;
  101 } cmodel_yuv_t;
  102 
  103 extern cmodel_yuv_t *yuv_table;
  104 
  105 int cmodel_calculate_pixelsize(int colormodel);
  106 int cmodel_calculate_datasize(int w, int h, int bytes_per_line, int color_model);
  107 int cmodel_calculate_max(int colormodel);
  108 int cmodel_components(int colormodel);
  109 int cmodel_is_yuv(int colormodel);
  110 
  111 // Tell when to use plane arguments or row pointer arguments to functions
  112 int cmodel_is_planar(int color_model);
  113 void cmodel_to_text(char *string, int cmodel);
  114 int cmodel_from_text(const char *text);
  115 
  116 
  117 
  118 void cmodel_transfer(unsigned char **output_rows, /* Leave NULL if non existent */
  119     unsigned char **input_rows,
  120     unsigned char *out_y_plane, /* Leave NULL if non existent */
  121     unsigned char *out_u_plane,
  122     unsigned char *out_v_plane,
  123     unsigned char *in_y_plane, /* Leave NULL if non existent */
  124     unsigned char *in_u_plane,
  125     unsigned char *in_v_plane,
  126     int in_x,        /* Dimensions to capture from input frame */
  127     int in_y, 
  128     int in_w, 
  129     int in_h,
  130     int out_x,       /* Dimensions to project on output frame */
  131     int out_y, 
  132     int out_w, 
  133     int out_h,
  134     int in_colormodel, 
  135     int out_colormodel,
  136     int bg_color,         /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
  137     int in_rowspan,       /* For planar use the luma rowspan */
  138     int out_rowspan);     /* For planar use the luma rowspan */
  139 
  140 void cmodel_init_yuv(cmodel_yuv_t *yuv_table);
  141 void cmodel_delete_yuv(cmodel_yuv_t *yuv_table);
  142 int cmodel_bc_to_x(int color_model);
  143 
  144 #ifdef __cplusplus
  145 }
  146 #endif
  147 
  148 #endif