Blender V4.3
colormanagement.cc File Reference
#include "IMB_colormanagement.hh"
#include "IMB_colormanagement_intern.hh"
#include <cmath>
#include <cstring>
#include "DNA_color_types.h"
#include "DNA_image_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "IMB_filetype.hh"
#include "IMB_filter.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "IMB_metadata.hh"
#include "IMB_moviecache.hh"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math_color.h"
#include "BLI_math_color.hh"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BLI_task.hh"
#include "BLI_threads.h"
#include "BKE_appdir.hh"
#include "BKE_colortools.hh"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_image_format.hh"
#include "BKE_main.hh"
#include "GPU_capabilities.hh"
#include "RNA_define.hh"
#include "SEQ_iterator.hh"
#include <ocio_capi.h>

Go to the source code of this file.

Classes

struct  ColormanageProcessor
 
struct  global_gpu_state
 
struct  global_color_picking_state
 
struct  ColormanageCacheViewSettings
 
struct  ColormanageCacheDisplaySettings
 
struct  ColormanageCacheKey
 
struct  ColormanageCacheData
 
struct  ColormanageCache
 
struct  DisplayBufferThread
 
struct  DisplayBufferInitData
 
struct  ProcessorTransformThread
 
struct  ProcessorTransformInitData
 
struct  ImbufByteToFloatData
 
struct  PartialThreadData
 

Functions

Color Managed Cache
static MovieCachecolormanage_moviecache_get (const ImBuf *ibuf)
 
static ColormanageCacheDatacolormanage_cachedata_get (const ImBuf *ibuf)
 
static uint colormanage_hashhash (const void *key_v)
 
static bool colormanage_hashcmp (const void *av, const void *bv)
 
static MovieCachecolormanage_moviecache_ensure (ImBuf *ibuf)
 
static void colormanage_cachedata_set (ImBuf *ibuf, ColormanageCacheData *data)
 
static void colormanage_view_settings_to_cache (ImBuf *ibuf, ColormanageCacheViewSettings *cache_view_settings, const ColorManagedViewSettings *view_settings)
 
static void colormanage_display_settings_to_cache (ColormanageCacheDisplaySettings *cache_display_settings, const ColorManagedDisplaySettings *display_settings)
 
static void colormanage_settings_to_key (ColormanageCacheKey *key, const ColormanageCacheViewSettings *view_settings, const ColormanageCacheDisplaySettings *display_settings)
 
static ImBufcolormanage_cache_get_ibuf (ImBuf *ibuf, ColormanageCacheKey *key, void **cache_handle)
 
static ucharcolormanage_cache_get (ImBuf *ibuf, const ColormanageCacheViewSettings *view_settings, const ColormanageCacheDisplaySettings *display_settings, void **cache_handle)
 
static void colormanage_cache_put (ImBuf *ibuf, const ColormanageCacheViewSettings *view_settings, const ColormanageCacheDisplaySettings *display_settings, uchar *display_buffer, void **cache_handle)
 
static void colormanage_cache_handle_release (void *cache_handle)
 
Initialization / De-initialization
static bool colormanage_role_color_space_name_get (OCIO_ConstConfigRcPtr *config, char *colorspace_name, const char *role, const char *backup_role)
 
static bool colormanage_load_config (OCIO_ConstConfigRcPtr *config)
 
static void colormanage_free_config ()
 
void colormanagement_init ()
 
void colormanagement_exit ()
 
Internal functions
static bool has_explicit_look_for_view (const char *view_name)
 
static bool colormanage_compatible_look (const ColorManagedLook *look, const char *view_name, const bool has_explicit_look)
 
static bool colormanage_compatible_look (const ColorManagedLook *look, const char *view_name)
 
static bool colormanage_use_look (const char *look, const char *view_name)
 
void colormanage_cache_free (ImBuf *ibuf)
 
void IMB_colormanagement_display_settings_from_ctx (const bContext *C, ColorManagedViewSettings **r_view_settings, ColorManagedDisplaySettings **r_display_settings)
 
static const char * get_display_colorspace_name (const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static ColorSpacedisplay_transform_get_colorspace (const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static OCIO_ConstCPUProcessorRcPtrcreate_display_buffer_processor (const char *look, const char *view_transform, const char *display, const float exposure, const float gamma, const float temperature, const float tint, const bool use_white_balance, const char *from_colorspace)
 
static OCIO_ConstProcessorRcPtr * create_colorspace_transform_processor (const char *from_colorspace, const char *to_colorspace)
 
static OCIO_ConstCPUProcessorRcPtrcolorspace_to_scene_linear_cpu_processor (ColorSpace *colorspace)
 
static OCIO_ConstCPUProcessorRcPtrcolorspace_from_scene_linear_cpu_processor (ColorSpace *colorspace)
 
static OCIO_ConstCPUProcessorRcPtrdisplay_from_scene_linear_processor (ColorManagedDisplay *display)
 
static OCIO_ConstCPUProcessorRcPtrdisplay_to_scene_linear_processor (ColorManagedDisplay *display)
 
void IMB_colormanagement_init_default_view_settings (ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static void curve_mapping_apply_pixel (const CurveMapping *curve_mapping, float *pixel, int channels)
 
void colorspace_set_default_role (char *colorspace, int size, int role)
 
void colormanage_imbuf_set_default_spaces (ImBuf *ibuf)
 
void colormanage_imbuf_make_linear (ImBuf *ibuf, const char *from_colorspace)
 
Generic Functions
static void colormanage_check_display_settings (ColorManagedDisplaySettings *display_settings, const char *what, const ColorManagedDisplay *default_display)
 
static void colormanage_check_view_settings (ColorManagedDisplaySettings *display_settings, ColorManagedViewSettings *view_settings, const char *what)
 
static void colormanage_check_colorspace_settings (ColorManagedColorspaceSettings *colorspace_settings, const char *what)
 
static bool seq_callback (Sequence *seq, void *)
 
void IMB_colormanagement_check_file_config (Main *bmain)
 
void IMB_colormanagement_validate_settings (const ColorManagedDisplaySettings *display_settings, ColorManagedViewSettings *view_settings)
 
const char * IMB_colormanagement_role_colorspace_name_get (int role)
 
void IMB_colormanagement_check_is_data (ImBuf *ibuf, const char *name)
 
void IMB_colormanagegent_copy_settings (ImBuf *ibuf_src, ImBuf *ibuf_dst)
 
void IMB_colormanagement_assign_float_colorspace (ImBuf *ibuf, const char *name)
 
void IMB_colormanagement_assign_byte_colorspace (ImBuf *ibuf, const char *name)
 
const char * IMB_colormanagement_get_float_colorspace (ImBuf *ibuf)
 
const char * IMB_colormanagement_get_rect_colorspace (ImBuf *ibuf)
 
bool IMB_colormanagement_space_is_data (ColorSpace *colorspace)
 
static void colormanage_ensure_srgb_scene_linear_info (ColorSpace *colorspace)
 
bool IMB_colormanagement_space_is_scene_linear (ColorSpace *colorspace)
 
bool IMB_colormanagement_space_is_srgb (ColorSpace *colorspace)
 
bool IMB_colormanagement_space_name_is_data (const char *name)
 
bool IMB_colormanagement_space_name_is_scene_linear (const char *name)
 
bool IMB_colormanagement_space_name_is_srgb (const char *name)
 
blender::float3x3 IMB_colormanagement_get_xyz_to_scene_linear ()
 
blender::float3x3 IMB_colormanagement_get_scene_linear_to_xyz ()
 
Functions for converting between color temperature/tint and RGB white points
void IMB_colormanagement_get_whitepoint (const float temperature, const float tint, float whitepoint[3])
 
bool IMB_colormanagement_set_whitepoint (const float whitepoint[3], float &temperature, float &tint)
 
Threaded Display Buffer Transform Routines
static void display_buffer_init_handle (void *handle_v, int start_line, int tot_line, void *init_data_v)
 
static void display_buffer_apply_get_linear_buffer (DisplayBufferThread *handle, int height, float *linear_buffer, bool *is_straight_alpha)
 
static void do_display_buffer_apply_no_processor (DisplayBufferThread *handle)
 
static void * do_display_buffer_apply_thread (void *handle_v)
 
static void display_buffer_apply_threaded (ImBuf *ibuf, const float *buffer, uchar *byte_buffer, float *display_buffer, uchar *display_buffer_byte, ColormanageProcessor *cm_processor)
 
static bool is_colorspace_same_as_display (const ColorSpace *colorspace, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static void colormanage_display_buffer_process_ex (ImBuf *ibuf, float *display_buffer, uchar *display_buffer_byte, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static void colormanage_display_buffer_process (ImBuf *ibuf, uchar *display_buffer, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
Threaded Processor Transform Routines
static void processor_transform_init_handle (void *handle_v, int start_line, int tot_line, void *init_data_v)
 
static void * do_processor_transform_thread (void *handle_v)
 
static void processor_transform_apply_threaded (uchar *byte_buffer, float *float_buffer, const int width, const int height, const int channels, ColormanageProcessor *cm_processor, const bool predivide, const bool float_from_byte)
 
Color Space Transformation Functions
static void colormanagement_transform_ex (uchar *byte_buffer, float *float_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide, bool do_threaded)
 
void IMB_colormanagement_transform (float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
 
void IMB_colormanagement_transform_threaded (float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
 
void IMB_colormanagement_transform_byte (uchar *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
 
void IMB_colormanagement_transform_byte_threaded (uchar *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
 
void IMB_colormanagement_transform_from_byte (float *float_buffer, uchar *byte_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
 
void IMB_colormanagement_transform_from_byte_threaded (float *float_buffer, uchar *byte_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
 
void IMB_colormanagement_transform_v4 (float pixel[4], const char *from_colorspace, const char *to_colorspace)
 
void IMB_colormanagement_colorspace_to_scene_linear_v3 (float pixel[3], ColorSpace *colorspace)
 
void IMB_colormanagement_scene_linear_to_colorspace_v3 (float pixel[3], ColorSpace *colorspace)
 
void IMB_colormanagement_colorspace_to_scene_linear_v4 (float pixel[4], bool predivide, ColorSpace *colorspace)
 
void IMB_colormanagement_colorspace_to_scene_linear (float *buffer, int width, int height, int channels, ColorSpace *colorspace, bool predivide)
 
void IMB_colormanagement_scene_linear_to_colorspace (float *buffer, int width, int height, int channels, ColorSpace *colorspace)
 
void IMB_colormanagement_imbuf_to_byte_texture (uchar *out_buffer, const int offset_x, const int offset_y, const int width, const int height, const ImBuf *ibuf, const bool store_premultiplied)
 
static void imbuf_byte_to_float_cb (void *__restrict userdata, const int y, const TaskParallelTLS *__restrict)
 
void IMB_colormanagement_imbuf_to_float_texture (float *out_buffer, const int offset_x, const int offset_y, const int width, const int height, const ImBuf *ibuf, const bool store_premultiplied)
 
void IMB_colormanagement_scene_linear_to_color_picking_v3 (float color_picking[3], const float scene_linear[3])
 
void IMB_colormanagement_color_picking_to_scene_linear_v3 (float scene_linear[3], const float color_picking[3])
 
void IMB_colormanagement_scene_linear_to_display_v3 (float pixel[3], ColorManagedDisplay *display)
 
void IMB_colormanagement_display_to_scene_linear_v3 (float pixel[3], ColorManagedDisplay *display)
 
void IMB_colormanagement_pixel_to_display_space_v4 (float result[4], const float pixel[4], const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
void IMB_colormanagement_pixel_to_display_space_v3 (float result[3], const float pixel[3], const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static void colormanagement_imbuf_make_display_space (ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, bool make_byte)
 
void IMB_colormanagement_imbuf_make_display_space (ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
static ImBufimbuf_ensure_editable (ImBuf *ibuf, ImBuf *colormanaged_ibuf, bool allocate_result)
 
ImBufIMB_colormanagement_imbuf_for_write (ImBuf *ibuf, bool save_as_render, bool allocate_result, const ImageFormatData *image_format)
 
Public Display Buffers Interfaces
ucharIMB_display_buffer_acquire (ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, void **cache_handle)
 
ucharIMB_display_buffer_acquire_ctx (const bContext *C, ImBuf *ibuf, void **cache_handle)
 
void IMB_display_buffer_transform_apply (uchar *display_buffer, float *linear_buffer, int width, int height, int channels, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, bool predivide)
 
void IMB_display_buffer_transform_apply_float (float *float_display_buffer, float *linear_buffer, int width, int height, int channels, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, bool predivide)
 
void IMB_display_buffer_release (void *cache_handle)
 
Display Functions
const char * colormanage_display_get_default_name ()
 
ColorManagedDisplaycolormanage_display_get_default ()
 
ColorManagedDisplaycolormanage_display_add (const char *name)
 
ColorManagedDisplaycolormanage_display_get_named (const char *name)
 
ColorManagedDisplaycolormanage_display_get_indexed (int index)
 
int IMB_colormanagement_display_get_named_index (const char *name)
 
const char * IMB_colormanagement_display_get_indexed_name (int index)
 
const char * IMB_colormanagement_display_get_default_name ()
 
ColorManagedDisplayIMB_colormanagement_display_get_named (const char *name)
 
const char * IMB_colormanagement_display_get_none_name ()
 
const char * IMB_colormanagement_display_get_default_view_transform_name (ColorManagedDisplay *display)
 
View Functions
const char * colormanage_view_get_default_name (const ColorManagedDisplay *display)
 
ColorManagedViewcolormanage_view_get_default (const ColorManagedDisplay *display)
 
ColorManagedViewcolormanage_view_add (const char *name)
 
ColorManagedViewcolormanage_view_get_named (const char *name)
 
ColorManagedViewcolormanage_view_get_indexed (int index)
 
ColorManagedViewcolormanage_view_get_named_for_display (const char *display_name, const char *name)
 
int IMB_colormanagement_view_get_named_index (const char *name)
 
const char * IMB_colormanagement_view_get_indexed_name (int index)
 
const char * IMB_colormanagement_view_get_default_name (const char *display_name)
 
const char * IMB_colormanagement_view_get_raw_or_default_name (const char *display_name)
 
Color Space Functions
static void colormanage_description_strip (char *description)
 
ColorSpacecolormanage_colorspace_add (const char *name, const char *description, bool is_invertible, bool is_data)
 
ColorSpacecolormanage_colorspace_get_named (const char *name)
 
ColorSpacecolormanage_colorspace_get_roled (int role)
 
ColorSpacecolormanage_colorspace_get_indexed (int index)
 
int IMB_colormanagement_colorspace_get_named_index (const char *name)
 
const char * IMB_colormanagement_colorspace_get_indexed_name (int index)
 
const char * IMB_colormanagement_colorspace_get_name (const ColorSpace *colorspace)
 
void IMB_colormanagement_colorspace_from_ibuf_ftype (ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf)
 
Looks Functions
ColorManagedLookcolormanage_look_add (const char *name, const char *process_space, bool is_noop)
 
ColorManagedLookcolormanage_look_get_named (const char *name)
 
ColorManagedLookcolormanage_look_get_indexed (int index)
 
int IMB_colormanagement_look_get_named_index (const char *name)
 
const char * IMB_colormanagement_look_get_indexed_name (int index)
 
const char * IMB_colormanagement_look_get_default_name ()
 
const char * IMB_colormanagement_look_validate_for_view (const char *view_name, const char *look_name)
 
RNA Helper Functions
void IMB_colormanagement_display_items_add (EnumPropertyItem **items, int *totitem)
 
static void colormanagement_view_item_add (EnumPropertyItem **items, int *totitem, ColorManagedView *view)
 
void IMB_colormanagement_view_items_add (EnumPropertyItem **items, int *totitem, const char *display_name)
 
void IMB_colormanagement_look_items_add (EnumPropertyItem **items, int *totitem, const char *view_name)
 
void IMB_colormanagement_colorspace_items_add (EnumPropertyItem **items, int *totitem)
 
Partial Display Buffer Update
static void partial_buffer_update_rect (ImBuf *ibuf, uchar *display_buffer, const float *linear_buffer, const uchar *byte_buffer, int display_stride, int linear_stride, int linear_offset_x, int linear_offset_y, ColormanageProcessor *cm_processor, const int xmin, const int ymin, const int xmax, const int ymax)
 
static void partial_buffer_update_rect_thread_do (void *data_v, int scanline)
 
static void imb_partial_display_buffer_update_ex (ImBuf *ibuf, const float *linear_buffer, const uchar *byte_buffer, int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax, bool do_threads)
 
void IMB_partial_display_buffer_update (ImBuf *ibuf, const float *linear_buffer, const uchar *byte_buffer, int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax)
 
void IMB_partial_display_buffer_update_threaded (ImBuf *ibuf, const float *linear_buffer, const uchar *byte_buffer, int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax)
 
void IMB_partial_display_buffer_update_delayed (ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax)
 
Pixel Processor Functions
ColormanageProcessorIMB_colormanagement_display_processor_new (const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
 
ColormanageProcessorIMB_colormanagement_colorspace_processor_new (const char *from_colorspace, const char *to_colorspace)
 
bool IMB_colormanagement_processor_is_noop (ColormanageProcessor *cm_processor)
 
void IMB_colormanagement_processor_apply_v4 (ColormanageProcessor *cm_processor, float pixel[4])
 
void IMB_colormanagement_processor_apply_v4_predivide (ColormanageProcessor *cm_processor, float pixel[4])
 
void IMB_colormanagement_processor_apply_v3 (ColormanageProcessor *cm_processor, float pixel[3])
 
void IMB_colormanagement_processor_apply_pixel (ColormanageProcessor *cm_processor, float *pixel, int channels)
 
void IMB_colormanagement_processor_apply (ColormanageProcessor *cm_processor, float *buffer, int width, int height, int channels, bool predivide)
 
void IMB_colormanagement_processor_apply_byte (ColormanageProcessor *cm_processor, uchar *buffer, int width, int height, int channels)
 
void IMB_colormanagement_processor_free (ColormanageProcessor *cm_processor)
 
static void curve_mapping_to_ocio_settings (CurveMapping *curve_mapping, OCIO_CurveMappingSettings *curve_mapping_settings)
 
static OCIO_CurveMappingSettingsupdate_glsl_curve_mapping (const ColorManagedViewSettings *view_settings)
 
bool IMB_colormanagement_support_glsl_draw (const ColorManagedViewSettings *)
 
bool IMB_colormanagement_setup_glsl_draw_from_space (const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, ColorSpace *from_colorspace, float dither, bool predivide, bool do_overlay_merge)
 
bool IMB_colormanagement_setup_glsl_draw (const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float dither, bool predivide)
 
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx (const bContext *C, ColorSpace *from_colorspace, float dither, bool predivide)
 
bool IMB_colormanagement_setup_glsl_draw_ctx (const bContext *C, float dither, bool predivide)
 
void IMB_colormanagement_finish_glsl_draw ()
 

Global declarations

#define DISPLAY_BUFFER_CHANNELS   4
 
static char global_role_data [MAX_COLORSPACE_NAME]
 
static char global_role_scene_linear [MAX_COLORSPACE_NAME]
 
static char global_role_color_picking [MAX_COLORSPACE_NAME]
 
static char global_role_texture_painting [MAX_COLORSPACE_NAME]
 
static char global_role_default_byte [MAX_COLORSPACE_NAME]
 
static char global_role_default_float [MAX_COLORSPACE_NAME]
 
static char global_role_default_sequencer [MAX_COLORSPACE_NAME]
 
static ListBase global_colorspaces = {nullptr, nullptr}
 
static ListBase global_displays = {nullptr, nullptr}
 
static ListBase global_views = {nullptr, nullptr}
 
static ListBase global_looks = {nullptr, nullptr}
 
static int global_tot_colorspace = 0
 
static int global_tot_display = 0
 
static int global_tot_view = 0
 
static int global_tot_looks = 0
 
float imbuf_luma_coefficients [3] = {0.0f}
 
float imbuf_scene_linear_to_xyz [3][3] = {{0.0f}}
 
float imbuf_xyz_to_scene_linear [3][3] = {{0.0f}}
 
float imbuf_scene_linear_to_rec709 [3][3] = {{0.0f}}
 
float imbuf_rec709_to_scene_linear [3][3] = {{0.0f}}
 
float imbuf_scene_linear_to_aces [3][3] = {{0.0f}}
 
float imbuf_aces_to_scene_linear [3][3] = {{0.0f}}
 
static pthread_mutex_t processor_lock = BLI_MUTEX_INITIALIZER
 
static struct global_gpu_state global_gpu_state = {false}
 
static struct global_color_picking_state global_color_picking_state = {nullptr}
 

Rendering Tables

static const float blackbody_table_r [7][3]
 
static const float blackbody_table_g [7][3]
 
static const float blackbody_table_b [7][4]
 
static float cie_color_match [81][3]
 
static void blackbody_temperature_to_rec709 (float rec709[3], float t)
 
void IMB_colormanagement_blackbody_temperature_to_rgb (float r_dest[4], float value)
 
void IMB_colormanagement_blackbody_temperature_to_rgb_table (float *r_table, const int width, const float min, const float max)
 
static void wavelength_to_xyz (float xyz[3], float lambda_nm)
 
void IMB_colormanagement_wavelength_to_rgb (float r_dest[4], float value)
 
void IMB_colormanagement_wavelength_to_rgb_table (float *r_table, const int width)
 

Macro Definition Documentation

◆ DISPLAY_BUFFER_CHANNELS

#define DISPLAY_BUFFER_CHANNELS   4

Definition at line 61 of file colormanagement.cc.

Referenced by display_buffer_init_handle(), and IMB_display_buffer_acquire().

Function Documentation

◆ blackbody_temperature_to_rec709()

static void blackbody_temperature_to_rec709 ( float rec709[3],
float t )
static

◆ colormanage_cache_free()

◆ colormanage_cache_get()

◆ colormanage_cache_get_ibuf()

static ImBuf * colormanage_cache_get_ibuf ( ImBuf * ibuf,
ColormanageCacheKey * key,
void ** cache_handle )
static

Definition at line 332 of file colormanagement.cc.

References colormanage_moviecache_get(), and IMB_moviecache_get().

Referenced by colormanage_cache_get().

◆ colormanage_cache_handle_release()

static void colormanage_cache_handle_release ( void * cache_handle)
static

Definition at line 451 of file colormanagement.cc.

References IMB_freeImBuf().

Referenced by IMB_display_buffer_release().

◆ colormanage_cache_put()

◆ colormanage_cachedata_get()

static ColormanageCacheData * colormanage_cachedata_get ( const ImBuf * ibuf)
static

◆ colormanage_cachedata_set()

static void colormanage_cachedata_set ( ImBuf * ibuf,
ColormanageCacheData * data )
static

Definition at line 288 of file colormanagement.cc.

References ImBuf::colormanage_cache, ColormanageCache::data, and data.

Referenced by colormanage_cache_put().

◆ colormanage_check_colorspace_settings()

static void colormanage_check_colorspace_settings ( ColorManagedColorspaceSettings * colorspace_settings,
const char * what )
static

◆ colormanage_check_display_settings()

static void colormanage_check_display_settings ( ColorManagedDisplaySettings * display_settings,
const char * what,
const ColorManagedDisplay * default_display )
static

◆ colormanage_check_view_settings()

◆ colormanage_colorspace_add()

◆ colormanage_colorspace_get_indexed()

ColorSpace * colormanage_colorspace_get_indexed ( int index)

◆ colormanage_colorspace_get_named()

◆ colormanage_colorspace_get_roled()

ColorSpace * colormanage_colorspace_get_roled ( int role)

◆ colormanage_compatible_look() [1/2]

static bool colormanage_compatible_look ( const ColorManagedLook * look,
const char * view_name )
static

◆ colormanage_compatible_look() [2/2]

static bool colormanage_compatible_look ( const ColorManagedLook * look,
const char * view_name,
const bool has_explicit_look )
static

◆ colormanage_description_strip()

static void colormanage_description_strip ( char * description)
static

Definition at line 3276 of file colormanagement.cc.

References ELEM.

Referenced by colormanage_colorspace_add().

◆ colormanage_display_add()

ColorManagedDisplay * colormanage_display_add ( const char * name)

◆ colormanage_display_buffer_process()

static void colormanage_display_buffer_process ( ImBuf * ibuf,
uchar * display_buffer,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings )
static

Definition at line 1941 of file colormanagement.cc.

References colormanage_display_buffer_process_ex().

Referenced by IMB_display_buffer_acquire().

◆ colormanage_display_buffer_process_ex()

◆ colormanage_display_get_default()

◆ colormanage_display_get_default_name()

const char * colormanage_display_get_default_name ( )

◆ colormanage_display_get_indexed()

ColorManagedDisplay * colormanage_display_get_indexed ( int index)

Definition at line 3073 of file colormanagement.cc.

References BLI_findlink(), and global_displays.

Referenced by IMB_colormanagement_display_get_indexed_name().

◆ colormanage_display_get_named()

◆ colormanage_display_settings_to_cache()

static void colormanage_display_settings_to_cache ( ColormanageCacheDisplaySettings * cache_display_settings,
const ColorManagedDisplaySettings * display_settings )
static

◆ colormanage_ensure_srgb_scene_linear_info()

◆ colormanage_free_config()

◆ colormanage_hashcmp()

static bool colormanage_hashcmp ( const void * av,
const void * bv )
static

Definition at line 260 of file colormanagement.cc.

References b.

Referenced by colormanage_moviecache_ensure().

◆ colormanage_hashhash()

static uint colormanage_hashhash ( const void * key_v)
static

◆ colormanage_imbuf_make_linear()

◆ colormanage_imbuf_set_default_spaces()

void colormanage_imbuf_set_default_spaces ( ImBuf * ibuf)

◆ colormanage_load_config()

static bool colormanage_load_config ( OCIO_ConstConfigRcPtr * config)
static

Definition at line 497 of file colormanagement.cc.

References ColorSpace::aliases, BLI_addtail(), BLI_genericNodeN(), BLI_strncpy(), colormanage_colorspace_add(), colormanage_display_add(), colormanage_look_add(), colormanage_role_color_space_name_get(), colormanage_view_add(), colormanage_view_get_named(), G, global_role_color_picking, global_role_data, global_role_default_byte, global_role_default_float, global_role_default_sequencer, global_role_scene_linear, global_role_texture_painting, global_tot_display, global_tot_view, imbuf_aces_to_scene_linear, imbuf_luma_coefficients, imbuf_rec709_to_scene_linear, imbuf_scene_linear_to_aces, imbuf_scene_linear_to_rec709, imbuf_scene_linear_to_xyz, imbuf_xyz_to_scene_linear, invert_m3_m3(), MAX_COLORSPACE_NAME, MEM_callocN, mul_m3_m3m3(), ColorSpace::num_aliases, OCIO_ACES_TO_XYZ, OCIO_colorSpaceGetAlias(), OCIO_colorSpaceGetDescription(), OCIO_colorSpaceGetNumAliases(), OCIO_colorSpaceIsData(), OCIO_colorSpaceIsInvertible(), OCIO_colorSpaceRelease(), OCIO_configGetColorSpace(), OCIO_configGetColorSpaceNameByIndex(), OCIO_configGetDefaultLumaCoefs(), OCIO_configGetDisplay(), OCIO_configGetLook(), OCIO_configGetLookNameByIndex(), OCIO_configGetNumColorSpaces(), OCIO_configGetNumDisplays(), OCIO_configGetNumLooks(), OCIO_configGetNumViews(), OCIO_configGetView(), OCIO_configGetXYZtoSceneLinear(), OCIO_lookGetProcessSpace(), OCIO_lookRelease(), OCIO_ROLE_COLOR_PICKING, OCIO_ROLE_DATA, OCIO_ROLE_DEFAULT_BYTE, OCIO_ROLE_DEFAULT_FLOAT, OCIO_ROLE_DEFAULT_SEQUENCER, OCIO_ROLE_SCENE_LINEAR, OCIO_ROLE_TEXTURE_PAINT, OCIO_XYZ_TO_REC709, and printf.

Referenced by colormanagement_init().

◆ colormanage_look_add()

◆ colormanage_look_get_indexed()

ColorManagedLook * colormanage_look_get_indexed ( int index)

Definition at line 3465 of file colormanagement.cc.

References BLI_findlink(), and global_looks.

Referenced by IMB_colormanagement_look_get_indexed_name().

◆ colormanage_look_get_named()

◆ colormanage_moviecache_ensure()

static MovieCache * colormanage_moviecache_ensure ( ImBuf * ibuf)
static

◆ colormanage_moviecache_get()

static MovieCache * colormanage_moviecache_get ( const ImBuf * ibuf)
static

◆ colormanage_role_color_space_name_get()

static bool colormanage_role_color_space_name_get ( OCIO_ConstConfigRcPtr * config,
char * colorspace_name,
const char * role,
const char * backup_role )
static

◆ colormanage_settings_to_key()

static void colormanage_settings_to_key ( ColormanageCacheKey * key,
const ColormanageCacheViewSettings * view_settings,
const ColormanageCacheDisplaySettings * display_settings )
static

◆ colormanage_use_look()

static bool colormanage_use_look ( const char * look,
const char * view_name )
static

◆ colormanage_view_add()

ColorManagedView * colormanage_view_add ( const char * name)

Definition at line 3159 of file colormanagement.cc.

References BLI_addtail(), global_tot_view, global_views, STRNCPY, and view.

Referenced by colormanage_load_config().

◆ colormanage_view_get_default()

◆ colormanage_view_get_default_name()

◆ colormanage_view_get_indexed()

ColorManagedView * colormanage_view_get_indexed ( int index)

Definition at line 3186 of file colormanagement.cc.

References BLI_findlink(), and global_views.

Referenced by IMB_colormanagement_view_get_indexed_name().

◆ colormanage_view_get_named()

◆ colormanage_view_get_named_for_display()

ColorManagedView * colormanage_view_get_named_for_display ( const char * display_name,
const char * name )

◆ colormanage_view_settings_to_cache()

◆ colormanagement_exit()

◆ colormanagement_imbuf_make_display_space()

static void colormanagement_imbuf_make_display_space ( ImBuf * ibuf,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
bool make_byte )
static

◆ colormanagement_init()

◆ colormanagement_transform_ex()

static void colormanagement_transform_ex ( uchar * byte_buffer,
float * float_buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace,
bool predivide,
bool do_threaded )
static

◆ colormanagement_view_item_add()

static void colormanagement_view_item_add ( EnumPropertyItem ** items,
int * totitem,
ColorManagedView * view )
static

◆ colorspace_from_scene_linear_cpu_processor()

◆ colorspace_set_default_role()

◆ colorspace_to_scene_linear_cpu_processor()

◆ create_colorspace_transform_processor()

◆ create_display_buffer_processor()

static OCIO_ConstCPUProcessorRcPtr * create_display_buffer_processor ( const char * look,
const char * view_transform,
const char * display,
const float exposure,
const float gamma,
const float temperature,
const float tint,
const bool use_white_balance,
const char * from_colorspace )
static

◆ curve_mapping_apply_pixel()

static void curve_mapping_apply_pixel ( const CurveMapping * curve_mapping,
float * pixel,
int channels )
static

◆ curve_mapping_to_ocio_settings()

◆ display_buffer_apply_get_linear_buffer()

static void display_buffer_apply_get_linear_buffer ( DisplayBufferThread * handle,
int height,
float * linear_buffer,
bool * is_straight_alpha )
static

◆ display_buffer_apply_threaded()

◆ display_buffer_init_handle()

static void display_buffer_init_handle ( void * handle_v,
int start_line,
int tot_line,
void * init_data_v )
static

◆ display_from_scene_linear_processor()

◆ display_to_scene_linear_processor()

◆ display_transform_get_colorspace()

static ColorSpace * display_transform_get_colorspace ( const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings )
static

◆ do_display_buffer_apply_no_processor()

static void do_display_buffer_apply_no_processor ( DisplayBufferThread * handle)
static

◆ do_display_buffer_apply_thread()

◆ do_processor_transform_thread()

◆ get_display_colorspace_name()

◆ has_explicit_look_for_view()

static bool has_explicit_look_for_view ( const char * view_name)
static

◆ IMB_colormanagegent_copy_settings()

◆ IMB_colormanagement_assign_byte_colorspace()

◆ IMB_colormanagement_assign_float_colorspace()

◆ IMB_colormanagement_blackbody_temperature_to_rgb()

◆ IMB_colormanagement_blackbody_temperature_to_rgb_table()

void IMB_colormanagement_blackbody_temperature_to_rgb_table ( float * r_table,
const int width,
const float min,
const float max )

◆ IMB_colormanagement_check_file_config()

◆ IMB_colormanagement_check_is_data()

void IMB_colormanagement_check_is_data ( ImBuf * ibuf,
const char * name )

◆ IMB_colormanagement_color_picking_to_scene_linear_v3()

◆ IMB_colormanagement_colorspace_from_ibuf_ftype()

◆ IMB_colormanagement_colorspace_get_indexed_name()

const char * IMB_colormanagement_colorspace_get_indexed_name ( int index)

Definition at line 3385 of file colormanagement.cc.

References colormanage_colorspace_get_indexed(), and ColorSpace::name.

◆ IMB_colormanagement_colorspace_get_name()

const char * IMB_colormanagement_colorspace_get_name ( const ColorSpace * colorspace)

Definition at line 3396 of file colormanagement.cc.

References ColorSpace::name.

Referenced by image_colorspace_from_imbuf().

◆ IMB_colormanagement_colorspace_get_named_index()

int IMB_colormanagement_colorspace_get_named_index ( const char * name)

◆ IMB_colormanagement_colorspace_items_add()

◆ IMB_colormanagement_colorspace_processor_new()

◆ IMB_colormanagement_colorspace_to_scene_linear()

void IMB_colormanagement_colorspace_to_scene_linear ( float * buffer,
int width,
int height,
int channels,
ColorSpace * colorspace,
bool predivide )

Converts a (width)x(height) block of float pixels from given color space to scene linear space. This is much higher performance than converting pixels one by one.

Definition at line 2311 of file colormanagement.cc.

References colorspace_to_scene_linear_cpu_processor(), OCIO_cpuProcessorApply(), OCIO_cpuProcessorApply_predivide(), OCIO_createOCIO_PackedImageDesc(), OCIO_PackedImageDescRelease(), and printf.

Referenced by blender::compositor::colorspace_to_scene_linear(), IMB_float_from_rect_ex(), pixels_to_scene_linear_byte(), and pixels_to_scene_linear_float().

◆ IMB_colormanagement_colorspace_to_scene_linear_v3()

void IMB_colormanagement_colorspace_to_scene_linear_v3 ( float pixel[3],
ColorSpace * colorspace )

◆ IMB_colormanagement_colorspace_to_scene_linear_v4()

◆ IMB_colormanagement_display_get_default_name()

const char * IMB_colormanagement_display_get_default_name ( )

◆ IMB_colormanagement_display_get_default_view_transform_name()

const char * IMB_colormanagement_display_get_default_view_transform_name ( ColorManagedDisplay * display)

◆ IMB_colormanagement_display_get_indexed_name()

const char * IMB_colormanagement_display_get_indexed_name ( int index)

Definition at line 3092 of file colormanagement.cc.

References colormanage_display_get_indexed().

◆ IMB_colormanagement_display_get_named()

◆ IMB_colormanagement_display_get_named_index()

int IMB_colormanagement_display_get_named_index ( const char * name)

◆ IMB_colormanagement_display_get_none_name()

const char * IMB_colormanagement_display_get_none_name ( )

◆ IMB_colormanagement_display_items_add()

◆ IMB_colormanagement_display_processor_new()

◆ IMB_colormanagement_display_settings_from_ctx()

◆ IMB_colormanagement_display_to_scene_linear_v3()

void IMB_colormanagement_display_to_scene_linear_v3 ( float pixel[3],
ColorManagedDisplay * display )

◆ IMB_colormanagement_finish_glsl_draw()

void IMB_colormanagement_finish_glsl_draw ( )

◆ IMB_colormanagement_get_float_colorspace()

◆ IMB_colormanagement_get_rect_colorspace()

◆ IMB_colormanagement_get_scene_linear_to_xyz()

◆ IMB_colormanagement_get_whitepoint()

void IMB_colormanagement_get_whitepoint ( const float temperature,
const float tint,
float whitepoint[3] )

Functions for converting between color temperature/tint and RGB white points.

Definition at line 1529 of file colormanagement.cc.

References IMB_colormanagement_xyz_to_scene_linear(), and blender::math::whitepoint_from_temp_tint().

◆ IMB_colormanagement_get_xyz_to_scene_linear()

◆ IMB_colormanagement_imbuf_for_write()

ImBuf * IMB_colormanagement_imbuf_for_write ( ImBuf * ibuf,
bool save_as_render,
bool allocate_result,
const ImageFormatData * image_format )

Prepare image buffer to be saved on disk, applying color management if needed color management would be applied if image is saving as render result and if file format is not expecting float buffer to be in linear space (currently JPEG2000 and TIFF are such formats – they're storing image as float but file itself stores applied color space).

Both byte and float buffers would contain applied color space, and result's float_colorspace would be set to display color space. This should be checked in image format write callback and if float_colorspace is not NULL, no color space transformation should be applied on this buffer.

Definition at line 2679 of file colormanagement.cc.

References BKE_image_format_is_byte(), BKE_imtype_requires_linear_float(), ImBuf::byte_buffer, ImBuf::channels, colormanage_colorspace_get_named(), colormanagement_imbuf_make_display_space(), ImBufByteBuffer::colorspace, ImBufFloatBuffer::colorspace, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImageFormatData::display_settings, display_transform_get_colorspace(), ImBuf::float_buffer, global_role_default_byte, global_role_scene_linear, IB_DISPLAY_BUFFER_INVALID, IB_RECT_INVALID, IMB_alpha_under_color_byte(), IMB_alpha_under_color_float(), IMB_colormanagement_transform(), IMB_colormanagement_transform_byte_threaded(), IMB_float_from_rect(), imb_freerectImBuf(), IMB_rect_from_float(), imbuf_ensure_editable(), ImageFormatData::imtype, ImageFormatData::linear_colorspace_settings, ColorManagedColorspaceSettings::name, ColorSpace::name, ImageFormatData::planes, R_IMF_PLANES_RGBA, STREQ, ImBuf::userflags, ImageFormatData::view_settings, ImBuf::x, and ImBuf::y.

Referenced by BKE_image_render_write(), image_save_single(), and RE_WriteRenderViewsMovie().

◆ IMB_colormanagement_imbuf_make_display_space()

void IMB_colormanagement_imbuf_make_display_space ( ImBuf * ibuf,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings )

◆ IMB_colormanagement_imbuf_to_byte_texture()

void IMB_colormanagement_imbuf_to_byte_texture ( uchar * out_buffer,
const int offset_x,
const int offset_y,
const int width,
const int height,
const ImBuf * ibuf,
const bool store_premultiplied )

◆ IMB_colormanagement_imbuf_to_float_texture()

◆ IMB_colormanagement_init_default_view_settings()

◆ IMB_colormanagement_look_get_default_name()

const char * IMB_colormanagement_look_get_default_name ( )

◆ IMB_colormanagement_look_get_indexed_name()

const char * IMB_colormanagement_look_get_indexed_name ( int index)

Definition at line 3482 of file colormanagement.cc.

References colormanage_look_get_indexed(), and ColorManagedLook::name.

◆ IMB_colormanagement_look_get_named_index()

int IMB_colormanagement_look_get_named_index ( const char * name)

◆ IMB_colormanagement_look_items_add()

◆ IMB_colormanagement_look_validate_for_view()

const char * IMB_colormanagement_look_validate_for_view ( const char * view_name,
const char * look_name )

◆ IMB_colormanagement_pixel_to_display_space_v3()

void IMB_colormanagement_pixel_to_display_space_v3 ( float result[3],
const float pixel[3],
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings )

◆ IMB_colormanagement_pixel_to_display_space_v4()

void IMB_colormanagement_pixel_to_display_space_v4 ( float result[4],
const float pixel[4],
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings )

◆ IMB_colormanagement_processor_apply()

◆ IMB_colormanagement_processor_apply_byte()

void IMB_colormanagement_processor_apply_byte ( ColormanageProcessor * cm_processor,
uchar * buffer,
int width,
int height,
int channels )

◆ IMB_colormanagement_processor_apply_pixel()

◆ IMB_colormanagement_processor_apply_v3()

◆ IMB_colormanagement_processor_apply_v4()

◆ IMB_colormanagement_processor_apply_v4_predivide()

◆ IMB_colormanagement_processor_free()

◆ IMB_colormanagement_processor_is_noop()

bool IMB_colormanagement_processor_is_noop ( ColormanageProcessor * cm_processor)

◆ IMB_colormanagement_role_colorspace_name_get()

const char * IMB_colormanagement_role_colorspace_name_get ( int role)

Definition at line 1356 of file colormanagement.cc.

References BLI_assert, COLOR_ROLE_COLOR_PICKING, COLOR_ROLE_DATA, COLOR_ROLE_DEFAULT_BYTE, COLOR_ROLE_DEFAULT_FLOAT, COLOR_ROLE_DEFAULT_SEQUENCER, COLOR_ROLE_SCENE_LINEAR, COLOR_ROLE_TEXTURE_PAINTING, G, global_role_color_picking, global_role_data, global_role_default_byte, global_role_default_float, global_role_default_sequencer, global_role_scene_linear, global_role_texture_painting, and printf.

Referenced by add_ibuf_for_tile(), assign_render_pass_ibuf_colorspace(), BKE_image_add_generated(), BKE_image_format_color_management_copy_from_scene(), BKE_image_format_init_for_write(), BKE_image_format_update_color_space_for_type(), BKE_image_save_options_init(), colormanage_colorspace_get_roled(), colorspace_set_default_role(), image_colorspace_from_imbuf(), image_exr_from_scene_linear_to_output(), image_node_colorspace(), IMB_colormanagement_colorspace_from_ibuf_ftype(), IMB_colormanagement_get_float_colorspace(), IMB_colormanagement_get_rect_colorspace(), IMB_rect_from_float(), blender::ed::sculpt_paint::paint::image::PaintingKernel< ImageBuffer >::init_brush_color(), blender::nodes::node_composite_convert_color_space_cc::node_composit_init_convert_colorspace(), RE_render_result_rect_to_ibuf(), render_result_exr_file_cache_read(), render_result_new_from_exr(), scene_init_data(), seq_add_set_view_transform(), SEQ_render_imbuf_from_sequencer_space(), SEQ_render_pixel_from_sequencer_space_v4(), wm_main_playanim_intern(), blender::ed::object::write_external_bake_pixels(), and blender::ed::object::write_internal_bake_pixels().

◆ IMB_colormanagement_scene_linear_to_color_picking_v3()

void IMB_colormanagement_scene_linear_to_color_picking_v3 ( float color_picking[3],
const float scene_linear[3] )

Conversion between color picking role. Typically we would expect such a requirements:

  • It is approximately perceptually linear, so that the HSV numbers and the HSV cube/circle have an intuitive distribution.
  • It has the same gamut as the scene linear color space.
  • Color picking values 0..1 map to scene linear values in the 0..1 range, so that picked albedo values are energy conserving.

Definition at line 2526 of file colormanagement.cc.

References BLI_mutex_lock(), BLI_mutex_unlock(), copy_v3_v3(), global_color_picking_state::cpu_processor_to, create_colorspace_transform_processor(), global_color_picking_state::failed, global_role_color_picking, global_role_scene_linear, OCIO_cpuProcessorApplyRGB(), OCIO_processorGetCPUProcessor(), OCIO_processorRelease(), and processor_lock.

Referenced by ui_scene_linear_to_perceptual_space().

◆ IMB_colormanagement_scene_linear_to_colorspace()

void IMB_colormanagement_scene_linear_to_colorspace ( float * buffer,
int width,
int height,
int channels,
ColorSpace * colorspace )

Converts a (width)x(height) block of float pixels from scene linear space to given color space. This is much higher performance than converting pixels one by one.

Definition at line 2341 of file colormanagement.cc.

References colorspace_from_scene_linear_cpu_processor(), OCIO_cpuProcessorApply(), OCIO_createOCIO_PackedImageDesc(), OCIO_PackedImageDescRelease(), and printf.

Referenced by scene_linear_to_image_chunk_byte(), and scene_linear_to_image_chunk_float().

◆ IMB_colormanagement_scene_linear_to_colorspace_v3()

void IMB_colormanagement_scene_linear_to_colorspace_v3 ( float pixel[3],
ColorSpace * colorspace )

Convert pixel from scene linear space to specified color space. For performance, use IMB_colormanagement_scene_linear_to_colorspace when converting an array of pixels.

Definition at line 2278 of file colormanagement.cc.

References colorspace_from_scene_linear_cpu_processor(), OCIO_cpuProcessorApplyRGB(), and printf.

◆ IMB_colormanagement_scene_linear_to_display_v3()

void IMB_colormanagement_scene_linear_to_display_v3 ( float pixel[3],
ColorManagedDisplay * display )

Convert pixel from scene linear to display space using default view used by performance-critical areas such as color-related widgets where we want to reduce amount of per-widget allocations.

Definition at line 2586 of file colormanagement.cc.

References display_from_scene_linear_processor(), and OCIO_cpuProcessorApplyRGB().

Referenced by brush_painter_imbuf_new(), brush_painter_imbuf_update(), eyedropper_color_set(), blender::ui::greasepencil::eyedropper_grease_pencil_color_set(), ui_block_cm_to_display_space_v3(), ui_draw_but_COLORBAND(), and ui_draw_colorband_handle().

◆ IMB_colormanagement_set_whitepoint()

bool IMB_colormanagement_set_whitepoint ( const float whitepoint[3],
float & temperature,
float & tint )

◆ IMB_colormanagement_setup_glsl_draw()

bool IMB_colormanagement_setup_glsl_draw ( const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
float dither,
bool predivide )

Configures GLSL shader for conversion from scene linear to display space.

Definition at line 4388 of file colormanagement.cc.

References IMB_colormanagement_setup_glsl_draw_from_space().

Referenced by ED_draw_imbuf_clipping(), and ocio_transform_ibuf().

◆ IMB_colormanagement_setup_glsl_draw_ctx()

bool IMB_colormanagement_setup_glsl_draw_ctx ( const bContext * C,
float dither,
bool predivide )

Same as setup_glsl_draw, but color management settings are guessing from a given context.

Definition at line 4411 of file colormanagement.cc.

References IMB_colormanagement_setup_glsl_draw_from_space_ctx().

Referenced by sequencer_OCIO_transform_ibuf().

◆ IMB_colormanagement_setup_glsl_draw_from_space()

bool IMB_colormanagement_setup_glsl_draw_from_space ( const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
ColorSpace * from_colorspace,
float dither,
bool predivide,
bool do_overlay_merge )
Note
Same as IMB_colormanagement_setup_glsl_draw, but display space conversion happens from a specified space.

Configures GLSL shader for conversion from specified to display color space

Will create appropriate OCIO processor and setup GLSL shader, so further 2D texture usage will use this conversion.

When there's no need to apply transform on 2D textures, use IMB_colormanagement_finish_glsl_draw().

This is low-level function, use ED_draw_imbuf_ctx if you only need to display given image buffer

Definition at line 4321 of file colormanagement.cc.

References colormanage_use_look(), COLORMANAGE_VIEW_USE_HDR, COLORMANAGE_VIEW_USE_WHITE_BALANCE, ColorManagedDisplaySettings::display_device, ColorManagedViewSettings::exposure, ColorManagedViewSettings::flag, ColorManagedViewSettings::gamma, global_role_scene_linear, GPU_hdr_support(), global_gpu_state::gpu_shader_bound, IMB_colormanagement_init_default_view_settings(), ColorManagedViewSettings::look, max_ff(), ColorSpace::name, OCIO_configRelease(), OCIO_getCurrentConfig(), OCIO_gpuDisplayShaderBind(), powf, ColorManagedViewSettings::temperature, ColorManagedViewSettings::tint, update_glsl_curve_mapping(), and ColorManagedViewSettings::view_transform.

Referenced by ED_draw_imbuf_clipping(), gpu_viewport_draw_colormanaged(), IMB_colormanagement_setup_glsl_draw(), IMB_colormanagement_setup_glsl_draw_from_space_ctx(), and ocio_transform_ibuf().

◆ IMB_colormanagement_setup_glsl_draw_from_space_ctx()

bool IMB_colormanagement_setup_glsl_draw_from_space_ctx ( const bContext * C,
ColorSpace * from_colorspace,
float dither,
bool predivide )

Same as setup_glsl_draw_from_space, but color management settings are guessing from a given context.

Definition at line 4397 of file colormanagement.cc.

References IMB_colormanagement_display_settings_from_ctx(), and IMB_colormanagement_setup_glsl_draw_from_space().

Referenced by IMB_colormanagement_setup_glsl_draw_ctx(), and sequencer_OCIO_transform_ibuf().

◆ IMB_colormanagement_space_is_data()

bool IMB_colormanagement_space_is_data ( ColorSpace * colorspace)

Definition at line 1459 of file colormanagement.cc.

Referenced by IMB_colormanagement_imbuf_to_byte_texture().

◆ IMB_colormanagement_space_is_scene_linear()

bool IMB_colormanagement_space_is_scene_linear ( ColorSpace * colorspace)

◆ IMB_colormanagement_space_is_srgb()

◆ IMB_colormanagement_space_name_is_data()

◆ IMB_colormanagement_space_name_is_scene_linear()

◆ IMB_colormanagement_space_name_is_srgb()

bool IMB_colormanagement_space_name_is_srgb ( const char * name)

◆ IMB_colormanagement_support_glsl_draw()

bool IMB_colormanagement_support_glsl_draw ( const ColorManagedViewSettings * view_settings)

Test if GLSL drawing is supported for combination of graphics card and this configuration.

Definition at line 4316 of file colormanagement.cc.

References OCIO_supportGPUShader().

Referenced by screen_render_invoke().

◆ IMB_colormanagement_transform()

void IMB_colormanagement_transform ( float * buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace,
bool predivide )

◆ IMB_colormanagement_transform_byte()

void IMB_colormanagement_transform_byte ( unsigned char * buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace )

Similar to IMB_colormanagement_transform_threaded, but operates on byte buffer.

Definition at line 2159 of file colormanagement.cc.

References colormanagement_transform_ex().

◆ IMB_colormanagement_transform_byte_threaded()

void IMB_colormanagement_transform_byte_threaded ( uchar * buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace )

◆ IMB_colormanagement_transform_from_byte()

void IMB_colormanagement_transform_from_byte ( float * float_buffer,
unsigned char * byte_buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace )

Similar to IMB_colormanagement_transform_byte_threaded, but gets float buffer from display one.

Definition at line 2180 of file colormanagement.cc.

References IB_PROFILE_SRGB, IMB_buffer_float_from_byte(), and IMB_colormanagement_transform().

◆ IMB_colormanagement_transform_from_byte_threaded()

void IMB_colormanagement_transform_from_byte_threaded ( float * float_buffer,
uchar * byte_buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace )

◆ IMB_colormanagement_transform_threaded()

void IMB_colormanagement_transform_threaded ( float * buffer,
int width,
int height,
int channels,
const char * from_colorspace,
const char * to_colorspace,
bool predivide )

Convert the whole buffer from specified by name color space to another will do threaded conversion.

Definition at line 2147 of file colormanagement.cc.

References colormanagement_transform_ex().

Referenced by seq_imbuf_to_sequencer_space(), and SEQ_render_imbuf_from_sequencer_space().

◆ IMB_colormanagement_transform_v4()

void IMB_colormanagement_transform_v4 ( float pixel[4],
const char * from_colorspace,
const char * to_colorspace )

◆ IMB_colormanagement_validate_settings()

◆ IMB_colormanagement_view_get_default_name()

const char * IMB_colormanagement_view_get_default_name ( const char * display_name)

◆ IMB_colormanagement_view_get_indexed_name()

const char * IMB_colormanagement_view_get_indexed_name ( int index)

Definition at line 3219 of file colormanagement.cc.

References colormanage_view_get_indexed().

◆ IMB_colormanagement_view_get_named_index()

int IMB_colormanagement_view_get_named_index ( const char * name)

Definition at line 3208 of file colormanagement.cc.

References colormanage_view_get_named().

Referenced by colormanage_view_settings_to_cache().

◆ IMB_colormanagement_view_get_raw_or_default_name()

const char * IMB_colormanagement_view_get_raw_or_default_name ( const char * display_name)

◆ IMB_colormanagement_view_items_add()

void IMB_colormanagement_view_items_add ( EnumPropertyItem ** items,
int * totitem,
const char * display_name )

◆ IMB_colormanagement_wavelength_to_rgb()

void IMB_colormanagement_wavelength_to_rgb ( float r_dest[4],
float value )

◆ IMB_colormanagement_wavelength_to_rgb_table()

void IMB_colormanagement_wavelength_to_rgb_table ( float * r_table,
const int width )

◆ IMB_display_buffer_acquire()

◆ IMB_display_buffer_acquire_ctx()

uchar * IMB_display_buffer_acquire_ctx ( const bContext * C,
ImBuf * ibuf,
void ** cache_handle )

Same as IMB_display_buffer_acquire but gets view and display settings from context.

Definition at line 2929 of file colormanagement.cc.

References IMB_colormanagement_display_settings_from_ctx(), and IMB_display_buffer_acquire().

Referenced by sequencer_OCIO_transform_ibuf().

◆ IMB_display_buffer_release()

◆ IMB_display_buffer_transform_apply()

void IMB_display_buffer_transform_apply ( uchar * display_buffer,
float * linear_buffer,
int width,
int height,
int channels,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
bool predivide )

◆ IMB_display_buffer_transform_apply_float()

void IMB_display_buffer_transform_apply_float ( float * float_display_buffer,
float * linear_buffer,
int width,
int height,
int channels,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
bool predivide )

◆ IMB_partial_display_buffer_update()

void IMB_partial_display_buffer_update ( ImBuf * ibuf,
const float * linear_buffer,
const uchar * byte_buffer,
int stride,
int offset_x,
int offset_y,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
int xmin,
int ymin,
int xmax,
int ymax )

Definition at line 3936 of file colormanagement.cc.

References imb_partial_display_buffer_update_ex().

Referenced by image_buffer_rect_update().

◆ IMB_partial_display_buffer_update_delayed()

void IMB_partial_display_buffer_update_delayed ( ImBuf * ibuf,
int xmin,
int ymin,
int xmax,
int ymax )

◆ imb_partial_display_buffer_update_ex()

◆ IMB_partial_display_buffer_update_threaded()

void IMB_partial_display_buffer_update_threaded ( ImBuf * ibuf,
const float * linear_buffer,
const uchar * byte_buffer,
int stride,
int offset_x,
int offset_y,
const ColorManagedViewSettings * view_settings,
const ColorManagedDisplaySettings * display_settings,
int xmin,
int ymin,
int xmax,
int ymax )

Definition at line 3964 of file colormanagement.cc.

References imb_partial_display_buffer_update_ex().

Referenced by IMB_display_buffer_acquire().

◆ imbuf_byte_to_float_cb()

static void imbuf_byte_to_float_cb ( void *__restrict userdata,
const int y,
const TaskParallelTLS * __restrict )
static

◆ imbuf_ensure_editable()

static ImBuf * imbuf_ensure_editable ( ImBuf * ibuf,
ImBuf * colormanaged_ibuf,
bool allocate_result )
static

◆ is_colorspace_same_as_display()

◆ partial_buffer_update_rect()

◆ partial_buffer_update_rect_thread_do()

static void partial_buffer_update_rect_thread_do ( void * data_v,
int scanline )
static

◆ processor_transform_apply_threaded()

static void processor_transform_apply_threaded ( uchar * byte_buffer,
float * float_buffer,
const int width,
const int height,
const int channels,
ColormanageProcessor * cm_processor,
const bool predivide,
const bool float_from_byte )
static

◆ processor_transform_init_handle()

static void processor_transform_init_handle ( void * handle_v,
int start_line,
int tot_line,
void * init_data_v )
static

◆ seq_callback()

static bool seq_callback ( Sequence * seq,
void *  )
static

◆ update_glsl_curve_mapping()

◆ wavelength_to_xyz()

static void wavelength_to_xyz ( float xyz[3],
float lambda_nm )
static

Definition at line 4559 of file colormanagement.cc.

References cie_color_match, float, and int.

Referenced by IMB_colormanagement_wavelength_to_rgb().

Variable Documentation

◆ blackbody_table_b

const float blackbody_table_b[7][4]
static
Initial value:
= {
{5.96945309e-11f, -4.85742887e-08f, -9.70622247e-05f, -4.07936148e-03f},
{2.40430366e-11f, 5.55021075e-08f, -1.98503712e-04f, 2.89312858e-02f},
{-1.40949732e-11f, 1.89878968e-07f, -3.56632824e-04f, 9.10767778e-02f},
{-3.61460868e-11f, 2.84822009e-07f, -4.93211319e-04f, 1.56723440e-01f},
{-1.97075738e-11f, 1.75359352e-07f, -2.50542825e-04f, -2.22783266e-02f},
{-1.61997957e-13f, -1.64216008e-08f, 3.86216271e-04f, -7.38077418e-01f},
{6.72650283e-13f, -2.73078809e-08f, 4.24098264e-04f, -7.52335691e-01f}}

Definition at line 4453 of file colormanagement.cc.

Referenced by blackbody_temperature_to_rec709(), and svm_math_blackbody_color_rec709().

◆ blackbody_table_g

const float blackbody_table_g[7][3]
static
Initial value:
= {
{-4.88999748e+02f, 6.04330754e-04f, -7.55807526e-02f},
{-7.55994277e+02f, 3.16730098e-04f, 4.78306139e-01f},
{-1.02363977e+03f, 1.20223470e-04f, 9.36662319e-01f},
{-1.26571316e+03f, 4.87340896e-06f, 1.27054498e+00f},
{-1.42529332e+03f, -4.01150431e-05f, 1.43972784e+00f},
{-1.17554822e+03f, -2.16378048e-05f, 1.30408023e+00f},
{-5.00799571e+02f, -4.59832026e-06f, 1.09098763e+00f}}

Definition at line 4444 of file colormanagement.cc.

Referenced by blackbody_temperature_to_rec709(), and svm_math_blackbody_color_rec709().

◆ blackbody_table_r

const float blackbody_table_r[7][3]
static
Initial value:
= {{1.61919106e+03f, -2.05010916e-03f, 5.02995757e+00f},
{2.48845471e+03f, -1.11330907e-03f, 3.22621544e+00f},
{3.34143193e+03f, -4.86551192e-04f, 1.76486769e+00f},
{4.09461742e+03f, -1.27446582e-04f, 7.25731635e-01f},
{4.67028036e+03f, 2.91258199e-05f, 1.26703442e-01f},
{4.59509185e+03f, 2.87495649e-05f, 1.50345020e-01f},
{3.78717450e+03f, 9.35907826e-06f, 3.99075871e-01f}}

Definition at line 4436 of file colormanagement.cc.

Referenced by blackbody_temperature_to_rec709(), and svm_math_blackbody_color_rec709().

◆ cie_color_match

float cie_color_match[81][3]
static
Initial value:
= {
{0.0014f, 0.0000f, 0.0065f}, {0.0022f, 0.0001f, 0.0105f}, {0.0042f, 0.0001f, 0.0201f},
{0.0076f, 0.0002f, 0.0362f}, {0.0143f, 0.0004f, 0.0679f}, {0.0232f, 0.0006f, 0.1102f},
{0.0435f, 0.0012f, 0.2074f}, {0.0776f, 0.0022f, 0.3713f}, {0.1344f, 0.0040f, 0.6456f},
{0.2148f, 0.0073f, 1.0391f}, {0.2839f, 0.0116f, 1.3856f}, {0.3285f, 0.0168f, 1.6230f},
{0.3483f, 0.0230f, 1.7471f}, {0.3481f, 0.0298f, 1.7826f}, {0.3362f, 0.0380f, 1.7721f},
{0.3187f, 0.0480f, 1.7441f}, {0.2908f, 0.0600f, 1.6692f}, {0.2511f, 0.0739f, 1.5281f},
{0.1954f, 0.0910f, 1.2876f}, {0.1421f, 0.1126f, 1.0419f}, {0.0956f, 0.1390f, 0.8130f},
{0.0580f, 0.1693f, 0.6162f}, {0.0320f, 0.2080f, 0.4652f}, {0.0147f, 0.2586f, 0.3533f},
{0.0049f, 0.3230f, 0.2720f}, {0.0024f, 0.4073f, 0.2123f}, {0.0093f, 0.5030f, 0.1582f},
{0.0291f, 0.6082f, 0.1117f}, {0.0633f, 0.7100f, 0.0782f}, {0.1096f, 0.7932f, 0.0573f},
{0.1655f, 0.8620f, 0.0422f}, {0.2257f, 0.9149f, 0.0298f}, {0.2904f, 0.9540f, 0.0203f},
{0.3597f, 0.9803f, 0.0134f}, {0.4334f, 0.9950f, 0.0087f}, {0.5121f, 1.0000f, 0.0057f},
{0.5945f, 0.9950f, 0.0039f}, {0.6784f, 0.9786f, 0.0027f}, {0.7621f, 0.9520f, 0.0021f},
{0.8425f, 0.9154f, 0.0018f}, {0.9163f, 0.8700f, 0.0017f}, {0.9786f, 0.8163f, 0.0014f},
{1.0263f, 0.7570f, 0.0011f}, {1.0567f, 0.6949f, 0.0010f}, {1.0622f, 0.6310f, 0.0008f},
{1.0456f, 0.5668f, 0.0006f}, {1.0026f, 0.5030f, 0.0003f}, {0.9384f, 0.4412f, 0.0002f},
{0.8544f, 0.3810f, 0.0002f}, {0.7514f, 0.3210f, 0.0001f}, {0.6424f, 0.2650f, 0.0000f},
{0.5419f, 0.2170f, 0.0000f}, {0.4479f, 0.1750f, 0.0000f}, {0.3608f, 0.1382f, 0.0000f},
{0.2835f, 0.1070f, 0.0000f}, {0.2187f, 0.0816f, 0.0000f}, {0.1649f, 0.0610f, 0.0000f},
{0.1212f, 0.0446f, 0.0000f}, {0.0874f, 0.0320f, 0.0000f}, {0.0636f, 0.0232f, 0.0000f},
{0.0468f, 0.0170f, 0.0000f}, {0.0329f, 0.0119f, 0.0000f}, {0.0227f, 0.0082f, 0.0000f},
{0.0158f, 0.0057f, 0.0000f}, {0.0114f, 0.0041f, 0.0000f}, {0.0081f, 0.0029f, 0.0000f},
{0.0058f, 0.0021f, 0.0000f}, {0.0041f, 0.0015f, 0.0000f}, {0.0029f, 0.0010f, 0.0000f},
{0.0020f, 0.0007f, 0.0000f}, {0.0014f, 0.0005f, 0.0000f}, {0.0010f, 0.0004f, 0.0000f},
{0.0007f, 0.0002f, 0.0000f}, {0.0005f, 0.0002f, 0.0000f}, {0.0003f, 0.0001f, 0.0000f},
{0.0002f, 0.0001f, 0.0000f}, {0.0002f, 0.0001f, 0.0000f}, {0.0001f, 0.0000f, 0.0000f},
{0.0001f, 0.0000f, 0.0000f}, {0.0001f, 0.0000f, 0.0000f}, {0.0000f, 0.0000f, 0.0000f}}

CIE color matching functions xBar, yBar, and zBar for wavelengths from 380 through 780 nanometers, every 5 nanometers.

For a wavelength lambda in this range:

cie_color_match[(lambda - 380) / 5][0] = xBar
cie_color_match[(lambda - 380) / 5][1] = yBar
cie_color_match[(lambda - 380) / 5][2] = zBar
static float cie_color_match[81][3]

Definition at line 4530 of file colormanagement.cc.

Referenced by svm_math_wavelength_color_xyz(), and wavelength_to_xyz().

◆ global_color_picking_state

struct global_color_picking_state global_color_picking_state = {nullptr}
static

◆ global_colorspaces

◆ global_displays

◆ global_gpu_state

struct global_gpu_state global_gpu_state = {false}
static

◆ global_looks

◆ global_role_color_picking

◆ global_role_data

char global_role_data[MAX_COLORSPACE_NAME]
static

◆ global_role_default_byte

◆ global_role_default_float

char global_role_default_float[MAX_COLORSPACE_NAME]
static

◆ global_role_default_sequencer

◆ global_role_scene_linear

◆ global_role_texture_painting

char global_role_texture_painting[MAX_COLORSPACE_NAME]
static

◆ global_tot_colorspace

int global_tot_colorspace = 0
static

Definition at line 77 of file colormanagement.cc.

Referenced by colormanage_colorspace_add(), and colormanage_free_config().

◆ global_tot_display

◆ global_tot_looks

int global_tot_looks = 0
static

Definition at line 80 of file colormanagement.cc.

Referenced by colormanage_free_config(), and colormanage_look_add().

◆ global_tot_view

int global_tot_view = 0
static

◆ global_views

ListBase global_views = {nullptr, nullptr}
static

◆ imbuf_aces_to_scene_linear

float imbuf_aces_to_scene_linear[3][3] = {{0.0f}}

◆ imbuf_luma_coefficients

◆ imbuf_rec709_to_scene_linear

float imbuf_rec709_to_scene_linear[3][3] = {{0.0f}}

◆ imbuf_scene_linear_to_aces

float imbuf_scene_linear_to_aces[3][3] = {{0.0f}}

◆ imbuf_scene_linear_to_rec709

float imbuf_scene_linear_to_rec709[3][3] = {{0.0f}}

◆ imbuf_scene_linear_to_xyz

float imbuf_scene_linear_to_xyz[3][3] = {{0.0f}}

◆ imbuf_xyz_to_scene_linear

float imbuf_xyz_to_scene_linear[3][3] = {{0.0f}}

◆ processor_lock