Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/math_color_inline.c
| Context not available. | |||||
| return 0.35f * rgb[0] + 0.45f * rgb[1] + 0.2f * rgb[2]; | return 0.35f * rgb[0] + 0.45f * rgb[1] + 0.2f * rgb[2]; | ||||
| } | } | ||||
| /* non-linear luma from ITU-R BT.601-2 | /* non-linear luma from ITU-R BT.601-7 | ||||
| * see: http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC11 | * see: http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC11 | ||||
| * note: the values used for are not exact matches to those documented above, | * | ||||
| * but they are from the same */ | * luma defined by 'YCC_JFIF', see #rgb_to_ycc | ||||
| MINLINE float rgb_to_grayscale(const float rgb[3]) | */ | ||||
| { | |||||
| return 0.3f * rgb[0] + 0.58f * rgb[1] + 0.12f * rgb[2]; | |||||
| } | |||||
| MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]) | |||||
| { | |||||
| return (unsigned char)(((76 * (unsigned short)rgb[0]) + | |||||
| (148 * (unsigned short)rgb[1]) + | |||||
| (31 * (unsigned short)rgb[2])) / 255); | |||||
| } | |||||
| /* luma from defined by 'YCC_JFIF', see #rgb_to_ycc */ | |||||
| MINLINE float rgb_to_luma(const float rgb[3]) | MINLINE float rgb_to_luma(const float rgb[3]) | ||||
| { | { | ||||
| return 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2]; | return 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2]; | ||||
| Context not available. | |||||