00001 /*************************************************************************** 00002 converter.h - description 00003 ------------------- 00004 begin : Thu Nov 30 2000 00005 copyright : (C) 2000-2004 by Michael Repplinger 00006 email : repplinger@cs.uni-sb.de 00007 ***************************************************************************/ 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. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef CONVERTER_H 00019 #define CONVERTER_H 00020 #define CLIPPED(x) ((x)>255?255:((x)<0?0:(x))) 00021 typedef int (*l1394_converter)(unsigned char*, int,unsigned char*); 00022 //extern "C" { void unpack422rgb32_mmx(unsigned char *src, int n, unsigned char *dst);} 00023 00024 #include <string> 00025 #include <map> 00026 00027 using std::string; 00028 using std::map; 00029 00030 namespace L1394_MM 00031 { 00032 00033 /*! \class Converter 00034 * \ingroup L1394_Display 00035 * \brief This class provides functions to convert image formats. 00036 * 00037 * The idea of this class is to say which source and destination format yo need, and this 00038 * class returns a pointer to the correct converter routine. <BR> 00039 * To add your own Converter functions inherit from this class and implement your own Converter routines. 00040 * All Converter routines have the same parameter. 00041 * The first parameter is an unsigned char pointer to the source array. The second parameter is 00042 * an integer value with the size of the source array and the third parameter 00043 * is an unsigned char pointer to the destination array. The destination array must have correct size.<BR> 00044 * 00045 * This class is still under develop. The converter routines are still public. Use 00046 * these functions instead the getConverter() function. 00047 *@author Michael Repplinger 00048 */ 00049 00050 class Converter { 00051 public: 00052 /*! \fn Converter() 00053 * \brief constructor 00054 */ 00055 Converter(); 00056 00057 /*! \fn ~Converter() 00058 * \brief destructor 00059 */ 00060 virtual ~Converter(); 00061 00062 /*! \fn getConverter(string source_format, string destination_format, bool mmx) 00063 * \brief With this function you can get a pointer to Converter routine you need. 00064 * 00065 * You need to cast the void pointer to a Converter_t. Example: 00066 * \code 00067 * Converter c; 00068 * l1394_converter converter = (l1394_converter) c.getConverter(YUV_422, RGB, 24, true); 00069 * converter(source_pointer, source_size, destination_pointer); 00070 * \endcode 00071 * \param source_format : source format of your image 00072 * \param destination_format : format you will decode the image 00073 * \param color_depth : color depth of your destination format 00074 * \param mmx : if true a mmx optimized function will be returned (if one exist), else a normal C-routine. 00075 * \return void* : pointer to the converter function, or NULL, if no converter exist 00076 */ 00077 virtual l1394_converter getConverter(string source_format, string destination_format, bool mmx); 00078 00079 static int UYVYtoBGRA32(unsigned char* source, int source_size,unsigned char* destination); 00080 //static int UYVYtoBGRA32_MMX(unsigned char* source, int source_size,unsigned char* destination); 00081 static int RGB24toBGRA32(unsigned char* source, int source_size,unsigned char* destination); 00082 private: 00083 void createMap(); 00084 map<string,l1394_converter> converter_map; 00085 00086 }; 00087 } 00088 #endif