Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

alphablend.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (C) 2000  Thomas Mirlacher
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *
00019  * The author may be reached as <dent@linuxvideo.org>
00020  *
00021  *------------------------------------------------------------
00022  *
00023  */
00024 
00025 #ifndef __ALPHABLEND_H__
00026 #define __ALPHABLEND_H__
00027 
00028 #include <xine/video_out.h>
00029 
00030 typedef struct {
00031   void *buffer;
00032   int buffer_size;
00033 
00034   int disable_exact_blending;
00035 } alphablend_t;
00036 
00037 void _x_alphablend_init(alphablend_t *extra_data, xine_t *xine);
00038 void _x_alphablend_free(alphablend_t *extra_data);
00039 
00040 /* _MSC_VER port changes */
00041 #undef ATTRIBUTE_PACKED
00042 #undef PRAGMA_PACK_BEGIN 
00043 #undef PRAGMA_PACK_END
00044 
00045 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined(__ICC)
00046 #define ATTRIBUTE_PACKED __attribute__ ((packed))
00047 #define PRAGMA_PACK 0
00048 #endif
00049 
00050 #if !defined(ATTRIBUTE_PACKED)
00051 #define ATTRIBUTE_PACKED
00052 #define PRAGMA_PACK 1
00053 #endif
00054 
00055 #if PRAGMA_PACK
00056 #pragma pack(8)
00057 #endif
00058 
00059 typedef struct {         /* CLUT == Color LookUp Table */
00060   uint8_t cb    : 8;
00061   uint8_t cr    : 8;
00062   uint8_t y     : 8;
00063   uint8_t foo   : 8;
00064 } ATTRIBUTE_PACKED clut_t;
00065 
00066 
00067 #if PRAGMA_PACK
00068 #pragma pack()
00069 #endif
00070 
00071 #define XX44_PALETTE_SIZE 32
00072 
00073 typedef struct {
00074   unsigned size;
00075   unsigned max_used;
00076   uint32_t cluts[XX44_PALETTE_SIZE];
00077   /* cache palette entries for both colors and clip_colors */
00078   int lookup_cache[OVL_PALETTE_SIZE*2];
00079 } xx44_palette_t;
00080 
00081 
00082 void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl,
00083                   int img_width, int img_height,
00084                   int dst_width, int dst_height,
00085                   alphablend_t *extra_data);
00086 
00087 void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl,
00088                   int img_width, int img_height,
00089                   int dst_width, int dst_height,
00090                   alphablend_t *extra_data);
00091 
00092 void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl,
00093                   int img_width, int img_height,
00094                   int dst_width, int dst_height,
00095                   alphablend_t *extra_data);
00096 
00097 void blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl,
00098                 int dst_width, int dst_height, int dst_pitches[3],
00099                 alphablend_t *extra_data);
00100 
00101 void blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl,
00102                  int dst_width, int dst_height, int dst_pitch,
00103                  alphablend_t *extra_data);
00104 
00105 /*
00106  * This function isn't too smart about blending. We want to avoid creating new
00107  * colors in the palette as a result from two non-zero colors needed to be
00108  * blended. Instead we choose the color with the highest alpha value to be
00109  * visible. Some parts of the code taken from the "VeXP" project.
00110  */
00111 
00112 void blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl,
00113                 int dst_width, int dst_height, int dst_pitch, 
00114                 alphablend_t *extra_data,
00115                 xx44_palette_t *palette,int ia44);
00116 
00117 /*
00118  * Functions to handle the xine-specific palette.
00119  */
00120 
00121 void clear_xx44_palette(xx44_palette_t *p);
00122 void init_xx44_palette(xx44_palette_t *p, unsigned num_entries);
00123 void dispose_xx44_palette(xx44_palette_t *p);
00124 
00125 /*
00126  * Convert the xine-specific palette to something useful.
00127  */
00128 
00129 void xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette,
00130                           unsigned first_xx44_entry, unsigned num_xx44_entries,
00131                           unsigned num_xvmc_components, char *xvmc_components);
00132 
00133 
00134 #endif

Generated on Sat Nov 5 16:17:31 2005 for OPIE by  doxygen 1.4.2