diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/imbuf/intern/IMB_colormanagement_intern.h | 10 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 108 |
2 files changed, 59 insertions, 59 deletions
diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h index 35a6ea9b207..ba9e20ac411 100644 --- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h +++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h @@ -35,7 +35,7 @@ #define BCM_CONFIG_FILE "config.ocio" -struct ConstProcessorRcPtr; +struct OCIO_ConstProcessorRcPtr; struct ImBuf; typedef struct ColorSpace { @@ -44,8 +44,8 @@ typedef struct ColorSpace { char name[64]; char description[64]; - struct ConstProcessorRcPtr *to_scene_linear; - struct ConstProcessorRcPtr *from_scene_linear; + struct OCIO_ConstProcessorRcPtr *to_scene_linear; + struct OCIO_ConstProcessorRcPtr *from_scene_linear; int is_invertible; int is_data; @@ -57,8 +57,8 @@ typedef struct ColorManagedDisplay { char name[64]; ListBase views; - struct ConstProcessorRcPtr *to_scene_linear; - struct ConstProcessorRcPtr *from_scene_linear; + struct OCIO_ConstProcessorRcPtr *to_scene_linear; + struct OCIO_ConstProcessorRcPtr *from_scene_linear; } ColorManagedDisplay; typedef struct ColorManagedView { diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 50000b9eeea..c7bdd532bb9 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -96,7 +96,7 @@ static int global_tot_view = 0; static pthread_mutex_t processor_lock = BLI_MUTEX_INITIALIZER; typedef struct ColormanageProcessor { - ConstProcessorRcPtr *processor; + OCIO_ConstProcessorRcPtr *processor; CurveMapping *curve_mapping; } ColormanageProcessor; @@ -419,9 +419,9 @@ static void colormanage_cache_handle_release(void *cache_handle) /*********************** Initialization / De-initialization *************************/ -static void colormanage_role_color_space_name_get(ConstConfigRcPtr *config, char *colorspace_name, const char *role, const char *backup_role) +static void colormanage_role_color_space_name_get(OCIO_ConstConfigRcPtr *config, char *colorspace_name, const char *role, const char *backup_role) { - ConstColorSpaceRcPtr *ociocs; + OCIO_ConstColorSpaceRcPtr *ociocs; ociocs = OCIO_configGetColorSpace(config, role); @@ -440,7 +440,7 @@ static void colormanage_role_color_space_name_get(ConstConfigRcPtr *config, char } } -static void colormanage_load_config(ConstConfigRcPtr *config) +static void colormanage_load_config(OCIO_ConstConfigRcPtr *config) { int tot_colorspace, tot_display, tot_display_view, index, viewindex, viewindex2; const char *name; @@ -456,7 +456,7 @@ static void colormanage_load_config(ConstConfigRcPtr *config) /* load colorspaces */ tot_colorspace = OCIO_configGetNumColorSpaces(config); for (index = 0 ; index < tot_colorspace; index++) { - ConstColorSpaceRcPtr *ocio_colorspace; + OCIO_ConstColorSpaceRcPtr *ocio_colorspace; const char *description; int is_invertible, is_data; @@ -521,10 +521,10 @@ static void colormanage_free_config(void) /* free precomputer processors */ if (colorspace->to_scene_linear) - OCIO_processorRelease((ConstProcessorRcPtr *) colorspace->to_scene_linear); + OCIO_processorRelease((OCIO_ConstProcessorRcPtr *) colorspace->to_scene_linear); if (colorspace->from_scene_linear) - OCIO_processorRelease((ConstProcessorRcPtr *) colorspace->from_scene_linear); + OCIO_processorRelease((OCIO_ConstProcessorRcPtr *) colorspace->from_scene_linear); /* free color space itself */ MEM_freeN(colorspace); @@ -539,10 +539,10 @@ static void colormanage_free_config(void) /* free precomputer processors */ if (display->to_scene_linear) - OCIO_processorRelease((ConstProcessorRcPtr *) display->to_scene_linear); + OCIO_processorRelease((OCIO_ConstProcessorRcPtr *) display->to_scene_linear); if (display->from_scene_linear) - OCIO_processorRelease((ConstProcessorRcPtr *) display->from_scene_linear); + OCIO_processorRelease((OCIO_ConstProcessorRcPtr *) display->from_scene_linear); /* free list of views */ BLI_freelistN(&display->views); @@ -562,7 +562,7 @@ void colormanagement_init(void) const char *ocio_env; const char *configdir; char configfile[FILE_MAX]; - ConstConfigRcPtr *config = NULL; + OCIO_ConstConfigRcPtr *config = NULL; OCIO_init(); @@ -649,7 +649,7 @@ static void display_transform_get_from_ctx(const bContext *C, ColorManagedViewSe static const char *display_transform_get_colorspace_name(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings) { - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); const char *display = display_settings->display_device; const char *view = view_settings->view_transform; @@ -673,12 +673,12 @@ static ColorSpace *display_transform_get_colorspace(const ColorManagedViewSettin return NULL; } -static ConstProcessorRcPtr *create_display_buffer_processor(const char *view_transform, const char *display, +static OCIO_ConstProcessorRcPtr *create_display_buffer_processor(const char *view_transform, const char *display, float exposure, float gamma) { - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); - DisplayTransformRcPtr *dt; - ConstProcessorRcPtr *processor; + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_DisplayTransformRcPtr *dt; + OCIO_ConstProcessorRcPtr *processor; dt = OCIO_createDisplayTransform(); @@ -689,7 +689,7 @@ static ConstProcessorRcPtr *create_display_buffer_processor(const char *view_tra /* fstop exposure control */ if (exposure != 0.0f) { - MatrixTransformRcPtr *mt; + OCIO_MatrixTransformRcPtr *mt; float gain = powf(2.0f, exposure); const float scale4f[] = {gain, gain, gain, gain}; float m44[16], offset4[4]; @@ -697,25 +697,25 @@ static ConstProcessorRcPtr *create_display_buffer_processor(const char *view_tra OCIO_matrixTransformScale(m44, offset4, scale4f); mt = OCIO_createMatrixTransform(); OCIO_matrixTransformSetValue(mt, m44, offset4); - OCIO_displayTransformSetLinearCC(dt, (ConstTransformRcPtr *) mt); + OCIO_displayTransformSetLinearCC(dt, (OCIO_ConstTransformRcPtr *) mt); OCIO_matrixTransformRelease(mt); } /* post-display gamma transform */ if (gamma != 1.0f) { - ExponentTransformRcPtr *et; + OCIO_ExponentTransformRcPtr *et; float exponent = 1.0f / MAX2(FLT_EPSILON, gamma); const float exponent4f[] = {exponent, exponent, exponent, exponent}; et = OCIO_createExponentTransform(); OCIO_exponentTransformSetValue(et, exponent4f); - OCIO_displayTransformSetDisplayCC(dt, (ConstTransformRcPtr *) et); + OCIO_displayTransformSetDisplayCC(dt, (OCIO_ConstTransformRcPtr *) et); OCIO_exponentTransformRelease(et); } - processor = OCIO_configGetProcessor(config, (ConstTransformRcPtr *) dt); + processor = OCIO_configGetProcessor(config, (OCIO_ConstTransformRcPtr *) dt); OCIO_displayTransformRelease(dt); OCIO_configRelease(config); @@ -723,11 +723,11 @@ static ConstProcessorRcPtr *create_display_buffer_processor(const char *view_tra return processor; } -static ConstProcessorRcPtr *create_colorspace_transform_processor(const char *from_colorspace, +static OCIO_ConstProcessorRcPtr *create_colorspace_transform_processor(const char *from_colorspace, const char *to_colorspace) { - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); - ConstProcessorRcPtr *processor; + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_ConstProcessorRcPtr *processor; processor = OCIO_configGetProcessorWithNames(config, from_colorspace, to_colorspace); @@ -736,49 +736,49 @@ static ConstProcessorRcPtr *create_colorspace_transform_processor(const char *fr return processor; } -static ConstProcessorRcPtr *colorspace_to_scene_linear_processor(ColorSpace *colorspace) +static OCIO_ConstProcessorRcPtr *colorspace_to_scene_linear_processor(ColorSpace *colorspace) { if (colorspace->to_scene_linear == NULL) { BLI_mutex_lock(&processor_lock); if (colorspace->to_scene_linear == NULL) { - ConstProcessorRcPtr *to_scene_linear; + OCIO_ConstProcessorRcPtr *to_scene_linear; to_scene_linear = create_colorspace_transform_processor(colorspace->name, global_role_scene_linear); - colorspace->to_scene_linear = (struct ConstProcessorRcPtr *) to_scene_linear; + colorspace->to_scene_linear = (struct OCIO_ConstProcessorRcPtr *) to_scene_linear; } BLI_mutex_unlock(&processor_lock); } - return (ConstProcessorRcPtr *) colorspace->to_scene_linear; + return (OCIO_ConstProcessorRcPtr *) colorspace->to_scene_linear; } -static ConstProcessorRcPtr *colorspace_from_scene_linear_processor(ColorSpace *colorspace) +static OCIO_ConstProcessorRcPtr *colorspace_from_scene_linear_processor(ColorSpace *colorspace) { if (colorspace->from_scene_linear == NULL) { BLI_mutex_lock(&processor_lock); if (colorspace->from_scene_linear == NULL) { - ConstProcessorRcPtr *from_scene_linear; + OCIO_ConstProcessorRcPtr *from_scene_linear; from_scene_linear = create_colorspace_transform_processor(global_role_scene_linear, colorspace->name); - colorspace->from_scene_linear = (struct ConstProcessorRcPtr *) from_scene_linear; + colorspace->from_scene_linear = (struct OCIO_ConstProcessorRcPtr *) from_scene_linear; } BLI_mutex_unlock(&processor_lock); } - return (ConstProcessorRcPtr *) colorspace->from_scene_linear; + return (OCIO_ConstProcessorRcPtr *) colorspace->from_scene_linear; } -static ConstProcessorRcPtr *display_from_scene_linear_processor(ColorManagedDisplay *display) +static OCIO_ConstProcessorRcPtr *display_from_scene_linear_processor(ColorManagedDisplay *display) { if (display->from_scene_linear == NULL) { BLI_mutex_lock(&processor_lock); if (display->from_scene_linear == NULL) { const char *view_name = colormanage_view_get_default_name(display); - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); - ConstProcessorRcPtr *processor = NULL; + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_ConstProcessorRcPtr *processor = NULL; if (view_name && config) { const char *view_colorspace = OCIO_configGetDisplayColorSpaceName(config, display->name, view_name); @@ -787,24 +787,24 @@ static ConstProcessorRcPtr *display_from_scene_linear_processor(ColorManagedDisp OCIO_configRelease(config); } - display->from_scene_linear = (struct ConstProcessorRcPtr *) processor; + display->from_scene_linear = (struct OCIO_ConstProcessorRcPtr *) processor; } BLI_mutex_unlock(&processor_lock); } - return (ConstProcessorRcPtr *) display->from_scene_linear; + return (OCIO_ConstProcessorRcPtr *) display->from_scene_linear; } -static ConstProcessorRcPtr *display_to_scene_linear_processor(ColorManagedDisplay *display) +static OCIO_ConstProcessorRcPtr *display_to_scene_linear_processor(ColorManagedDisplay *display) { if (display->to_scene_linear == NULL) { BLI_mutex_lock(&processor_lock); if (display->to_scene_linear == NULL) { const char *view_name = colormanage_view_get_default_name(display); - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); - ConstProcessorRcPtr *processor = NULL; + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_ConstProcessorRcPtr *processor = NULL; if (view_name && config) { const char *view_colorspace = OCIO_configGetDisplayColorSpaceName(config, display->name, view_name); @@ -813,13 +813,13 @@ static ConstProcessorRcPtr *display_to_scene_linear_processor(ColorManagedDispla OCIO_configRelease(config); } - display->to_scene_linear = (struct ConstProcessorRcPtr *) processor; + display->to_scene_linear = (struct OCIO_ConstProcessorRcPtr *) processor; } BLI_mutex_unlock(&processor_lock); } - return (ConstProcessorRcPtr *) display->to_scene_linear; + return (OCIO_ConstProcessorRcPtr *) display->to_scene_linear; } static void init_default_view_settings(const ColorManagedDisplaySettings *display_settings, @@ -1533,7 +1533,7 @@ void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspac */ void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], ColorSpace *colorspace) { - ConstProcessorRcPtr *processor; + OCIO_ConstProcessorRcPtr *processor; if (!colorspace) { /* should never happen */ @@ -1550,7 +1550,7 @@ void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], ColorSpac /* same as above, but converts colors in opposite direction */ void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpace *colorspace) { - ConstProcessorRcPtr *processor; + OCIO_ConstProcessorRcPtr *processor; if (!colorspace) { /* should never happen */ @@ -1566,7 +1566,7 @@ void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpac void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide) { - ConstProcessorRcPtr *processor; + OCIO_ConstProcessorRcPtr *processor; if (!colorspace) { /* should never happen */ @@ -1577,9 +1577,9 @@ void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, in processor = colorspace_to_scene_linear_processor(colorspace); if (processor) { - PackedImageDesc *img; + OCIO_PackedImageDesc *img; - img = OCIO_createPackedImageDesc(buffer, width, height, channels, sizeof(float), + img = OCIO_createOCIO_PackedImageDesc(buffer, width, height, channels, sizeof(float), channels * sizeof(float), channels * sizeof(float) * width); if (predivide) @@ -1587,7 +1587,7 @@ void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, in else OCIO_processorApply(processor, img); - OCIO_packedImageDescRelease(img); + OCIO_OCIO_PackedImageDescRelease(img); } } @@ -1597,7 +1597,7 @@ void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, in */ void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], ColorManagedDisplay *display) { - ConstProcessorRcPtr *processor; + OCIO_ConstProcessorRcPtr *processor; processor = display_from_scene_linear_processor(display); @@ -1608,7 +1608,7 @@ void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], ColorManaged /* same as above, but converts color in opposite direction */ void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], ColorManagedDisplay *display) { - ConstProcessorRcPtr *processor; + OCIO_ConstProcessorRcPtr *processor; processor = display_to_scene_linear_processor(display); @@ -1892,7 +1892,7 @@ void IMB_display_buffer_release(void *cache_handle) const char *colormanage_display_get_default_name(void) { - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); const char *display_name; display_name = OCIO_configGetDefaultDisplay(config); @@ -2003,7 +2003,7 @@ const char *IMB_colormanagement_display_get_none_name(void) const char *colormanage_view_get_default_name(const ColorManagedDisplay *display) { - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig(); const char *name; name = OCIO_configGetDefaultView(config, display->name); @@ -2511,10 +2511,10 @@ void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor, flo } if (cm_processor->processor && channels >= 3) { - PackedImageDesc *img; + OCIO_PackedImageDesc *img; /* apply OCIO processor */ - img = OCIO_createPackedImageDesc(buffer, width, height, channels, sizeof(float), + img = OCIO_createOCIO_PackedImageDesc(buffer, width, height, channels, sizeof(float), channels * sizeof(float), channels * sizeof(float) * width); if (predivide) @@ -2522,7 +2522,7 @@ void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor, flo else OCIO_processorApply(cm_processor->processor, img); - OCIO_packedImageDescRelease(img); + OCIO_OCIO_PackedImageDescRelease(img); } } |