diff options
author | Matt Ebb <matt@mke3.net> | 2010-03-31 03:32:16 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-03-31 03:32:16 +0400 |
commit | 05c2906b769a3a56939bd870589dab637b73d63d (patch) | |
tree | b3de8d412091615f9ea823894b1b4ea0af0042f7 /source/blender/blenlib/BLI_math_color.h | |
parent | c9f81c87b88574fa803050040a6b8ddf398968aa (diff) |
Patch from Xavier Thomas:
YCbCr conversion function according to ITU-R BT.601/709 and JFIF
Clarifies color space usage in rgb->ycc conversion, doesn't change existing results.
Diffstat (limited to 'source/blender/blenlib/BLI_math_color.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 8c84df9c245..72724c1c0f7 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -41,20 +41,25 @@ extern "C" { #define BLI_PR_NONE 0 #define BLI_PR_SRGB 1 #define BLI_PR_REC709 2 + +/* YCbCr */ +#define BLI_YCC_ITU_BT601 0 +#define BLI_YCC_ITU_BT709 1 +#define BLI_YCC_JFIF_0_255 2 /******************* Conversion to RGB ********************/ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b); void hex_to_rgb(char *hexcol, float *r, float *g, float *b); void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb); -void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb); +void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace); void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b, int colorspace); void cpack_to_rgb(unsigned int col, float *r, float *g, float *b); /***************** Conversion from RGB ********************/ void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv); -void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr); +void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace); void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); unsigned int rgb_to_cpack(float r, float g, float b); unsigned int hsv_to_cpack(float h, float s, float v); |