Blender  V3.3
colormanagement_inline.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2015 Blender Foundation. All rights reserved. */
3 
8 #ifndef __IMB_COLORMANAGEMENT_INLINE_C__
9 #define __IMB_COLORMANAGEMENT_INLINE_C__
10 
11 #include "BLI_math_vector.h"
13 
15 {
17 }
18 
19 unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char rgb[3])
20 {
21  float rgbf[3];
22  float val;
23 
24  rgb_uchar_to_float(rgbf, rgb);
25  val = dot_v3v3(imbuf_luma_coefficients, rgbf);
26 
27  return unit_float_to_uchar_clamp(val);
28 }
29 
30 void IMB_colormanagement_xyz_to_scene_linear(float scene_linear[3], const float xyz[3])
31 {
32  mul_v3_m3v3(scene_linear, imbuf_xyz_to_scene_linear, xyz);
33 }
34 
35 void IMB_colormanagement_scene_linear_to_xyz(float xyz[3], const float scene_linear[3])
36 {
37  mul_v3_m3v3(xyz, imbuf_scene_linear_to_xyz, scene_linear);
38 }
39 
40 void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
41 {
42  mul_v3_m3v3(scene_linear, imbuf_rec709_to_scene_linear, rec709);
43 }
44 
45 void IMB_colormanagement_scene_linear_to_rec709(float rec709[3], const float scene_linear[3])
46 {
47  mul_v3_m3v3(rec709, imbuf_scene_linear_to_rec709, scene_linear);
48 }
49 
50 void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
51 {
52  mul_v3_m3v3(srgb, imbuf_scene_linear_to_rec709, scene_linear);
53  linearrgb_to_srgb_v3_v3(srgb, srgb);
54 }
55 
56 void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
57 {
58  srgb_to_linearrgb_v3_v3(scene_linear, srgb);
60 }
61 
62 void IMB_colormanagement_aces_to_scene_linear(float scene_linear[3], const float aces[3])
63 {
64  mul_v3_m3v3(scene_linear, imbuf_aces_to_scene_linear, aces);
65 }
66 
67 void IMB_colormanagement_scene_linear_to_aces(float aces[3], const float scene_linear[3])
68 {
69  mul_v3_m3v3(aces, imbuf_scene_linear_to_aces, scene_linear);
70 }
71 
72 #endif /* __IMB_COLORMANAGEMENT_INLINE_H__ */
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
Definition: math_color.c:376
void mul_m3_v3(const float M[3][3], float r[3])
Definition: math_matrix.c:926
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
Definition: math_matrix.c:897
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float imbuf_scene_linear_to_aces[3][3]
float imbuf_luma_coefficients[3]
float imbuf_rec709_to_scene_linear[3][3]
float imbuf_scene_linear_to_rec709[3][3]
float imbuf_scene_linear_to_xyz[3][3]
float imbuf_xyz_to_scene_linear[3][3]
float imbuf_aces_to_scene_linear[3][3]
void IMB_colormanagement_scene_linear_to_aces(float aces[3], const float scene_linear[3])
void IMB_colormanagement_xyz_to_scene_linear(float scene_linear[3], const float xyz[3])
void IMB_colormanagement_scene_linear_to_rec709(float rec709[3], const float scene_linear[3])
float IMB_colormanagement_get_luminance(const float rgb[3])
void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
void IMB_colormanagement_aces_to_scene_linear(float scene_linear[3], const float aces[3])
void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char rgb[3])
void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
void IMB_colormanagement_scene_linear_to_xyz(float xyz[3], const float scene_linear[3])
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)