[Bf-blender-cvs] [6e77dfe] master: Color management: get rid of original byte buffer partial update

Sergey Sharybin noreply at git.blender.org
Wed Dec 18 10:26:01 CET 2013


Commit: 6e77dfeb1acc40cda7fee2b3f7f9d6497f4e7c19
Author: Sergey Sharybin
Date:   Wed Dec 18 15:20:07 2013 +0600
http://developer.blender.org/rB6e77dfeb1acc40cda7fee2b3f7f9d6497f4e7c19

Color management: get rid of original byte buffer partial update

It was only used by opengl render and in fact it needed just to
set DISPLAY_BUFFER_INVALID flag for the image buffer.

In theory it wouldn't make any change to opengl render speed
(because this change just moved rect_from_float from color
management code to image save code). And could not see any speed
changes on my laptop.

===================================================================

M	source/blender/compositor/operations/COM_ViewerOperation.cpp
M	source/blender/editors/render/render_internal.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/imbuf/IMB_colormanagement.h
M	source/blender/imbuf/intern/colormanagement.c

===================================================================

diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index 13b5091..8997f7b 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -171,7 +171,7 @@ void ViewerOperation::updateImage(rcti *rect)
 {
 	IMB_partial_display_buffer_update(this->m_ibuf, this->m_outputBuffer, NULL, getWidth(), 0, 0,
 	                                  this->m_viewSettings, this->m_displaySettings,
-	                                  rect->xmin, rect->ymin, rect->xmax, rect->ymax, false);
+	                                  rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 
 	this->updateDraw();
 }
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 7ecada9..091dc11 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -192,7 +192,7 @@ static void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf
 	IMB_partial_display_buffer_update(ibuf, rectf, NULL,
 	                                  linear_stride, linear_offset_x, linear_offset_y,
 	                                  &scene->view_settings, &scene->display_settings,
-	                                  rxmin, rymin, rxmin + xmax, rymin + ymax, false);
+	                                  rxmin, rymin, rxmin + xmax, rymin + ymax);
 }
 
 /* ****************************** render invoking ***************** */
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 107674b..a95e36d 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -298,13 +298,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 	ibuf = BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
 
 	if (ibuf) {
-		/* update display buffer */
-		if (ibuf->rect == NULL)
-			imb_addrectImBuf(ibuf);
-
-		IMB_partial_display_buffer_update(ibuf, rr->rectf, rect, rr->rectx, 0, 0,
-		                                  &scene->view_settings, &scene->display_settings,
-		                                  0, 0, rr->rectx, rr->recty, true);
+		ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
 
 		/* write file for animation */
 		if (oglrender->write_still) {
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 7e115b2..98962f7 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -155,8 +155,7 @@ void IMB_colormanagement_colorspace_items_add(struct EnumPropertyItem **items, i
 void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_buffer, const unsigned char *buffer_byte,
                                        int stride, int offset_x, int offset_y, const struct ColorManagedViewSettings *view_settings,
                                        const struct ColorManagedDisplaySettings *display_settings,
-                                       int xmin, int ymin, int xmax, int ymax,
-                                       bool update_orig_byte_buffer);
+                                       int xmin, int ymin, int xmax, int ymax);
 
 void IMB_partial_display_buffer_update_delayed(struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);
 
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 6047b16..91d558c 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2055,8 +2055,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
 			IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect,
 			                                  ibuf->x, 0, 0, applied_view_settings, display_settings,
 			                                  ibuf->invalid_rect.xmin, ibuf->invalid_rect.ymin,
-			                                  ibuf->invalid_rect.xmax, ibuf->invalid_rect.ymax,
-			                                  false);
+			                                  ibuf->invalid_rect.xmax, ibuf->invalid_rect.ymax);
 		}
 
 		BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0);
@@ -2769,22 +2768,8 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe
 void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer, const unsigned char *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 update_orig_byte_buffer)
+                                       int xmin, int ymin, int xmax, int ymax)
 {
-	if ((ibuf->rect && ibuf->rect_float) || update_orig_byte_buffer) {
-		/* update byte buffer created by legacy color management */
-
-		unsigned char *rect = (unsigned char *) ibuf->rect;
-		int channels = ibuf->channels;
-		int width = xmax - xmin;
-		int height = ymax - ymin;
-		int rect_index = (ymin * ibuf->x + xmin) * 4;
-		int linear_index = ((ymin - offset_y) * stride + (xmin - offset_x)) * channels;
-
-		IMB_buffer_byte_from_float(rect + rect_index, linear_buffer + linear_index, channels, ibuf->dither,
-		                           IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, TRUE, width, height, ibuf->x, stride);
-	}
-
 	if (ibuf->display_buffer_flags) {
 		ColormanageCacheViewSettings cache_view_settings;
 		ColormanageCacheDisplaySettings cache_display_settings;




More information about the Bf-blender-cvs mailing list