| 178 | kaklik | 1 | #ifndef COLOURSPACE_H | 
      
        |  |  | 2 | #define COLOURSPACE_H | 
      
        |  |  | 3 |  | 
      
        |  |  | 4 | #include <cassert> | 
      
        |  |  | 5 | #ifndef NDEBUG | 
      
        |  |  | 6 | #include <iostream> | 
      
        |  |  | 7 | #endif | 
      
        |  |  | 8 | #include "colour_sensitivity.h" | 
      
        |  |  | 9 |  | 
      
        |  |  | 10 | namespace mimas { | 
      
        |  |  | 11 |  | 
      
        |  |  | 12 | /** @addtogroup imageIO | 
      
        |  |  | 13 |     @{ */ | 
      
        |  |  | 14 | /** @defgroup colourspace Fast colourspace transformations | 
      
        |  |  | 15 |     Mimas provides several fast algorithms for converting from different | 
      
        |  |  | 16 |     YUV formats to RGBA- and grey-level images. There also is a transformation | 
      
        |  |  | 17 |     from RGBA to the YV12 format. | 
      
        |  |  | 18 |  | 
      
        |  |  | 19 |     The methods are used internally by the image-I/O classes. | 
      
        |  |  | 20 |  | 
      
        |  |  | 21 |     See <A HREF="http://www.fourcc.org/yuv.php">http://www.fourcc.org/yuv.php</A> and | 
      
        |  |  | 22 |     <A HREF="http://www.fourcc.org/fccyvrgb.php">http://www.fourcc.org/fccyvrgb.php</A> | 
      
        |  |  | 23 |     for more information on colourspaces. | 
      
        |  |  | 24 |     @see imageIO | 
      
        |  |  | 25 |     @author Bala Amavasai (bpa@amavasai.org) | 
      
        |  |  | 26 |     @author Jan Wedekind (jan@wedesoft.de) | 
      
        |  |  | 27 |     @date Fri Jan 10 15:53:56 UTC 2006 | 
      
        |  |  | 28 |     @{ */ | 
      
        |  |  | 29 | /** Colour conversion from RGB to RGBA. | 
      
        |  |  | 30 |     Adding A-byte to RGB. | 
      
        |  |  | 31 |     @param in Input RGB data (8 bit) | 
      
        |  |  | 32 |     @param width Width of input image | 
      
        |  |  | 33 |     @param height Height of input image | 
      
        |  |  | 34 |     @param out Pointer to store RGBA data in | 
      
        |  |  | 35 |     @author Jan Wedekind (jan@wedesoft.de) | 
      
        |  |  | 36 |     @date Fri Jan 10 11:40:53 UTC 2006 */ | 
      
        |  |  | 37 | void rgb_to_rgba( const char *in, int width, int height, char *out ); | 
      
        |  |  | 38 |  | 
      
        |  |  | 39 | /** Colour conversion from YV12 to RGBA. | 
      
        |  |  | 40 |     Colourspace transformation from YV12 to RGBA. | 
      
        |  |  | 41 |     @param in Input YV12 data (8 bit) | 
      
        |  |  | 42 |     @param width Width of input image | 
      
        |  |  | 43 |     @param height Height of input image | 
      
        |  |  | 44 |     @param out Pointer to store RGBA data in | 
      
        |  |  | 45 |     @author Jan Wedekind (jan@wedesoft.de) | 
      
        |  |  | 46 |     @date Fri Jan 10 11:40:53 UTC 2006 */ | 
      
        |  |  | 47 | void yv12_to_rgba( const char *in, int width, int height, char *out ); | 
      
        |  |  | 48 |  | 
      
        |  |  | 49 | /** Colour conversion from YUV420p to RGBA. | 
      
        |  |  | 50 |     Colourspace transformation from YUV420p to RGBA. | 
      
        |  |  | 51 |     @param in Input YUV420p data (8 bit) | 
      
        |  |  | 52 |     @param width Width of input image | 
      
        |  |  | 53 |     @param height Height of input image | 
      
        |  |  | 54 |     @param out Pointer to store RGBA data in | 
      
        |  |  | 55 |     @author Bala Amavasai (bpa@amavasai.org) | 
      
        |  |  | 56 |     @date Fri Jan 10 18:37:08 UTC 2006 */ | 
      
        |  |  | 57 | void yuv420p_to_rgba( const char *in, int width, int height, char *out ); | 
      
        |  |  | 58 |  | 
      
        |  |  | 59 | /** Colour conversion from RGBA to YV12. | 
      
        |  |  | 60 |     Colourspace transformation from RGBA to YV12. | 
      
        |  |  | 61 |     @param in Input RGBA data (8 bit) | 
      
        |  |  | 62 |     @param width Width of input image | 
      
        |  |  | 63 |     @param height Height of input image | 
      
        |  |  | 64 |     @param out Pointer to store YV12 data in | 
      
        |  |  | 65 |     @author Jan Wedekind (jan@wedesoft.de) | 
      
        |  |  | 66 |     @date Fri Jan 10 11:40:53 UTC 2006 */ | 
      
        |  |  | 67 | void rgba_to_yv12( const char *in, int width, int height, char *out ); | 
      
        |  |  | 68 |  | 
      
        |  |  | 69 | /** Colour conversion from UYVY to RGBA. | 
      
        |  |  | 70 |     Colourspace transformation from UYVY to RGBA. | 
      
        |  |  | 71 |     @param in Input UYVY data (8 bit) | 
      
        |  |  | 72 |     @param width Width of input image | 
      
        |  |  | 73 |     @param height Height of input image | 
      
        |  |  | 74 |     @param out Pointer to store RGBA data in | 
      
        |  |  | 75 |     @author Jan Wedekind (jan@wedesoft.de) | 
      
        |  |  | 76 |     @date Fri Jan 10 11:40:53 UTC 2006 */ | 
      
        |  |  | 77 | void uyvy_to_rgba( const char *in, int width, int height, char *out ); | 
      
        |  |  | 78 |  | 
      
        |  |  | 79 | /** Colour conversion from YUY2 to RGBA. | 
      
        |  |  | 80 |     Colourspace transformation from YUY2 to RGBA. | 
      
        |  |  | 81 |     @param in Input YUY2 data (8 bit) | 
      
        |  |  | 82 |     @param width Width of input image | 
      
        |  |  | 83 |     @param height Height of input image | 
      
        |  |  | 84 |     @param out Pointer to store RGBA data in | 
      
        |  |  | 85 |     @author Jan Wedekind (jan@wedesoft.de) | 
      
        |  |  | 86 |     @date Fri Jan 10 11:40:53 UTC 2006 */ | 
      
        |  |  | 87 | void yuy2_to_rgba( const char *in, int width, int height, char *out ); | 
      
        |  |  | 88 |  | 
      
        |  |  | 89 | ///@} | 
      
        |  |  | 90 |  | 
      
        |  |  | 91 | ///@} | 
      
        |  |  | 92 |  | 
      
        |  |  | 93 | }; | 
      
        |  |  | 94 |  | 
      
        |  |  | 95 | #endif |