[Bf-blender-cvs] [2249d71] master: Color management: added utility function to apply processor on a pixel
Sergey Sharybin
noreply at git.blender.org
Wed Dec 18 10:53:31 CET 2013
Commit: 2249d71e2636b99691281139c82b03f754c313b7
Author: Sergey Sharybin
Date: Wed Dec 18 15:51:09 2013 +0600
http://developer.blender.org/rB2249d71e2636b99691281139c82b03f754c313b7
Color management: added utility function to apply processor on a pixel
It applies color management on a pixel in a way, based on number of
channels of this pixel.
Simplifies partial update code a bit.
===================================================================
M source/blender/imbuf/IMB_colormanagement.h
M source/blender/imbuf/intern/colormanagement.c
===================================================================
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 98962f7..263216c 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -166,6 +166,7 @@ struct ColormanageProcessor *IMB_colormanagement_colorspace_processor_new(const
void IMB_colormanagement_processor_apply_v4(struct ColormanageProcessor *cm_processor, float pixel[4]);
void IMB_colormanagement_processor_apply_v4_predivide(struct ColormanageProcessor *cm_processor, float pixel[4]);
void IMB_colormanagement_processor_apply_v3(struct ColormanageProcessor *cm_processor, float pixel[3]);
+void IMB_colormanagement_processor_apply_pixel(struct ColormanageProcessor *cm_processor, float *pixel, int channels);
void IMB_colormanagement_processor_apply(struct ColormanageProcessor *cm_processor, float *buffer, int width, int height,
int channels, bool predivide);
void IMB_colormanagement_processor_free(struct ColormanageProcessor *cm_processor);
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 91d558c..cc8a453 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2690,17 +2690,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe
}
if (!is_data) {
- if (channels == 4) {
- IMB_colormanagement_processor_apply_v4_predivide(cm_processor, pixel);
- }
- else if (channels == 3) {
- IMB_colormanagement_processor_apply_v3(cm_processor, pixel);
- }
- else /* if (channels == 1) */ {
- if (cm_processor->curve_mapping) {
- curve_mapping_apply_pixel(cm_processor->curve_mapping, pixel, 1);
- }
- }
+ IMB_colormanagement_processor_apply_pixel(cm_processor, pixel, channels);
}
if (display_buffer_float) {
@@ -2917,6 +2907,24 @@ void IMB_colormanagement_processor_apply_v3(ColormanageProcessor *cm_processor,
OCIO_processorApplyRGB(cm_processor->processor, pixel);
}
+void IMB_colormanagement_processor_apply_pixel(struct ColormanageProcessor *cm_processor, float *pixel, int channels)
+{
+ if (channels == 4) {
+ IMB_colormanagement_processor_apply_v4_predivide(cm_processor, pixel);
+ }
+ else if (channels == 3) {
+ IMB_colormanagement_processor_apply_v3(cm_processor, pixel);
+ }
+ else if (channels == 1) {
+ if (cm_processor->curve_mapping) {
+ curve_mapping_apply_pixel(cm_processor->curve_mapping, pixel, 1);
+ }
+ }
+ else {
+ BLI_assert(!"Incorrect number of channels passed to IMB_colormanagement_processor_apply_pixel");
+ }
+}
+
void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor, float *buffer, int width, int height,
int channels, bool predivide)
{
More information about the Bf-blender-cvs
mailing list