| 1 | #ifndef CVD_COLOURSPACE_H |
| 2 | #define CVD_COLOURSPACE_H |
| 3 | |
| 4 | namespace CVD |
| 5 | { |
| 6 | /// Internal colourspace conversions |
| 7 | namespace ColourSpace |
| 8 | { |
| 9 | /// Convert YUV 411 pixel data to RGB |
| 10 | /// @param yuv411 The input data |
| 11 | /// @param npix The number of pixels |
| 12 | /// @param out The output data |
| 13 | void yuv411_to_rgb(const unsigned char* yuv411, int npix, unsigned char* out); |
| 14 | /// Convert YUV 411 pixel data to Y only |
| 15 | /// @param yuv411 The input data |
| 16 | /// @param npix The number of pixels |
| 17 | /// @param out The output data |
| 18 | void yuv411_to_y(const unsigned char* yuv411, int npix, unsigned char* out); |
| 19 | /// Convert YUV 411 pixel data to Y and RGB |
| 20 | /// @param yuv411 The input data |
| 21 | /// @param npix The number of pixels |
| 22 | /// @param outc colour output data |
| 23 | /// @param outy luma output data |
| 24 | void yuv411_to_rgb_y(const unsigned char* yuv411, int npix, unsigned char* outc, unsigned char* outy); |
| 25 | |
| 26 | /// Convert yuv422 to rgb444. |
| 27 | /// @param yuv The yuv422 data: yuyvyuyv.... |
| 28 | /// @param rgb The output data |
| 29 | /// @param width The width of the image |
| 30 | /// @param height The height of the image |
| 31 | |
| 32 | void yuv422_to_rgb(const unsigned char* yuv, unsigned char* rgb, unsigned int width, unsigned int height); |
| 33 | |
| 34 | /// Convert yuv422 to grey. |
| 35 | /// @param yuv The yuv422 data: yuyvyuyv.... |
| 36 | /// @param grey The output data |
| 37 | /// @param width The width of the image |
| 38 | /// @param height The height of the image |
| 39 | void yuv422_to_grey(const unsigned char* yuv, unsigned char* grey, unsigned int width, unsigned int height); |
| 40 | |
| 41 | /// Convert yuv420 planar to rgb444 |
| 42 | /// @param y The y plane: one byte per pixel |
| 43 | /// @param u The u plane: one byte per 2 pixel square |
| 44 | /// @param v The v plane: one byte per 2 pixel square |
| 45 | /// @param rgb The output data |
| 46 | /// @param width The width of the image |
| 47 | /// @param rowpairs The number of rows pairs (i.e., height/2) in the image |
| 48 | void yuv420p_to_rgb(const unsigned char* y, const unsigned char* u, const unsigned char* v, |
| 49 | unsigned char* rgb, unsigned int width, unsigned int rowpairs); |
| 50 | |
| 51 | /// Convert yuv420 planar to grey |
| 52 | /// @param y The y plane: one byte per pixel |
| 53 | /// @param u The u plane: one byte per 2 pixel square |
| 54 | /// @param v The v plane: one byte per 2 pixel square |
| 55 | /// @param grey The output data |
| 56 | /// @param width The width of the image |
| 57 | /// @param height The height of the image |
| 58 | void yuv420p_to_grey(const unsigned char* y, const unsigned char* u, const unsigned char* v, |
| 59 | unsigned char* grey, unsigned int width, unsigned int height); |
| 60 | |
| 61 | /// Convert vuy422 to rgb444. |
| 62 | /// @param yuv The vuy422 data: uyvyuyvy.... |
| 63 | /// @param rgb The output data |
| 64 | /// @param width The width of the image |
| 65 | /// @param height The height of the image |
| 66 | void vuy422_to_rgb(const unsigned char* yuv, unsigned char* rgb, unsigned int width, unsigned int height); |
| 67 | |
| 68 | /// Convert yuv422 to grey. |
| 69 | /// @param yuv The vuy422 data: uyvyuyvy.... |
| 70 | /// @param grey The output data |
| 71 | /// @param width The width of the image |
| 72 | /// @param height The height of the image |
| 73 | void vuy422_to_grey(const unsigned char* yuv, unsigned char* grey, unsigned int width, unsigned int height); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | #endif |