Color management: skip generating byte buffers in verify_buffer_float
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 5 Jul 2012 09:41:12 +0000 (09:41 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 5 Jul 2012 09:41:12 +0000 (09:41 +0000)
This saves some time in cases color management is used by sipping
generating non-color managed buffers.

source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_image/image_draw.c
source/blender/imbuf/intern/colormanagement.c

index 61834b19da421ec3647558b916c6d0cd908498f6..f1c8516cb8c34d1508180a16dc42f4cbfc59cfba 100644 (file)
@@ -245,12 +245,18 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
                ED_region_info_draw(ar, str, block, 0.6f);
 }
 
+/* OCIO_TODO: after finishing proper color management pipeline integration
+ *            this wouldn't be needed -- color managed display buffer
+ *            would be used unstead
+ */
+#if 0
 static void verify_buffer_float(ImBuf *ibuf)
 {
        if (ibuf->rect_float && (ibuf->rect == NULL || (ibuf->userflags & IB_RECT_INVALID))) {
                IMB_rect_from_float(ibuf);
        }
 }
+#endif
 
 static void draw_movieclip_buffer(wmWindow *win, SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
                                   int width, int height, float zoomx, float zoomy)
@@ -270,7 +276,8 @@ static void draw_movieclip_buffer(wmWindow *win, SpaceClip *sc, ARegion *ar, ImB
                unsigned char *display_buffer;
                void *cache_handle;
 
-               verify_buffer_float(ibuf);
+               /* OCIO_TODO: finally get rid of this stuff */
+               /* verify_buffer_float(ibuf); */
 
                view_settings = IMB_view_settings_get_effective(win, &sc->view_settings);
                display_buffer = IMB_display_buffer_acquire(ibuf, view_settings, &win->display_settings, &cache_handle);
index a4211508ae4489f61ad553e6b26a5db5ea4e8ffe..23b70903c4341c170ba6b2679b0de6c427c17f46 100644 (file)
 
 #define HEADER_HEIGHT 18
 
+/* OCIO_TODO: after finishing proper color management pipeline integration
+ *            this wouldn't be needed -- color managed display buffer
+ *            would be used unstead
+ */
 static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage)
 {
        /* detect if we need to redo the curve map.
@@ -96,7 +100,12 @@ static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage)
                else
                        ibuf->profile = IB_PROFILE_NONE;
 
-               IMB_rect_from_float(ibuf);
+               /* OCIO_TODO: currently only get rid of old-style color managed byte
+                *            buffer calculation to save some time on buffer display,
+                *            but still need to set image buffer's profile to prevent
+                *            comatibility breackage
+                */
+               /* IMB_rect_from_float(ibuf); */
        }
 }
 
index 49f25c274b886b024b8183f8fc11006d86087738..f2e4a826a477c706db94f0423bd609fc7878c1e9 100644 (file)
@@ -702,6 +702,13 @@ static void *do_display_buffer_apply_tonemap_thread(void *handle_v)
 static void display_buffer_apply_tonemap(ImBuf *ibuf, unsigned char *display_buffer,
                                          imb_tonecurveCb tonecurve_func)
 {
+       /* XXX: IMB_buffer_byte_from_float_tonecurve isn't thread-safe because of
+        *      possible non-initialized sRGB conversion stuff. Make sure it's properly
+        *      initialized before starting threads, but likely this stuff should be
+        *      initialized somewhere before to avoid possible issues in other issues.
+        */
+       BLI_init_srgb_conversion();
+
        display_buffer_apply_threaded(ibuf, ibuf->rect_float, display_buffer, tonecurve_func,
                                      do_display_buffer_apply_tonemap_thread);
 }