Blender V4.3
colormanagement_inline.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#ifndef __IMB_COLORMANAGEMENT_INLINE_C__
10#define __IMB_COLORMANAGEMENT_INLINE_C__
11
12#include "BLI_math_color.h"
13#include "BLI_math_matrix.h"
14#include "BLI_math_vector.h"
16
21
22float IMB_colormanagement_get_luminance(const float rgb[3])
23{
25}
26
28{
29 float rgbf[3];
30 float val;
31
32 rgb_uchar_to_float(rgbf, rgb);
34
35 return unit_float_to_uchar_clamp(val);
36}
37
38void IMB_colormanagement_xyz_to_scene_linear(float scene_linear[3], const float xyz[3])
39{
40 mul_v3_m3v3(scene_linear, imbuf_xyz_to_scene_linear, xyz);
41}
42
43void IMB_colormanagement_scene_linear_to_xyz(float xyz[3], const float scene_linear[3])
44{
45 mul_v3_m3v3(xyz, imbuf_scene_linear_to_xyz, scene_linear);
46}
47
48void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
49{
50 mul_v3_m3v3(scene_linear, imbuf_rec709_to_scene_linear, rec709);
51}
52
53void IMB_colormanagement_scene_linear_to_rec709(float rec709[3], const float scene_linear[3])
54{
55 mul_v3_m3v3(rec709, imbuf_scene_linear_to_rec709, scene_linear);
56}
57
58void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
59{
60 mul_v3_m3v3(srgb, imbuf_scene_linear_to_rec709, scene_linear);
61 linearrgb_to_srgb_v3_v3(srgb, srgb);
62}
63
64void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
65{
66 srgb_to_linearrgb_v3_v3(scene_linear, srgb);
68}
69
70void IMB_colormanagement_aces_to_scene_linear(float scene_linear[3], const float aces[3])
71{
72 mul_v3_m3v3(scene_linear, imbuf_aces_to_scene_linear, aces);
73}
74
75void IMB_colormanagement_scene_linear_to_aces(float aces[3], const float scene_linear[3])
76{
77 mul_v3_m3v3(aces, imbuf_scene_linear_to_aces, scene_linear);
78}
79
80#endif /* __IMB_COLORMANAGEMENT_INLINE_H__ */
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
void mul_m3_v3(const float M[3][3], float r[3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
unsigned char uchar
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_get_luminance_coefficients(float r_rgb[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])
uchar IMB_colormanagement_get_luminance_byte(const uchar rgb[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])
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])
#define unit_float_to_uchar_clamp(val)