diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-30 16:36:03 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-30 16:36:03 +0400 |
commit | d0f67e498ea4109b35911fce70e39f82e7563b27 (patch) | |
tree | cd28c1c20dda061e20009bd3a33c81fced52027f /source/blender/compositor/operations | |
parent | 244a1c564a16f637d20e0efeeede716b94fd4063 (diff) |
Color management fixes and improvements
- Made color management cache safe for situations when one area
requested a display buffer, then some changes were done which
invalidated cache, other area requested display buffer which
changed cached buffer.
Suck case could be fatal for first used of display buffer,
which didn't happen yet because cache is being accessed from
main thread only, but better to keep this things completely
thread save to avoid headache in the future.
- Baked RRT transformations, which gives ~3-4 times boost
hopefully without visible artifacts.
- Added support of partial updates to display buffers.
This would create special context which hols display buffer
which imbuf had to the time of creating this context and
later this context would allow to run a color correction
from given linear buffer within given region.
This is being used by compositor to enable more realtime
display update when compositing.
- Added support of color management backdrop for nodes editor.
There's now special menu called display properties in N-panel
of nodes editor.
Probably this better be de-duplicated somehow, but not sure
yet how. Currently it's not so harmful to have panel for two
spaces which contains only 2 properties.
There's currently one unsolved issue with backdrop:
it's not being updated progressively when just loading the
file -- it's simply because there's no color managed display
buffer for backdrop yet, and compositor doesn't actually
know which color space to use here to generate preview to.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r-- | source/blender/compositor/operations/COM_ViewerBaseOperation.cpp | 16 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_ViewerBaseOperation.h | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp index 574ac9eb9dc..edaa1c8d3c2 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp @@ -60,7 +60,7 @@ void ViewerBaseOperation::initImage() { Image *anImage = this->m_image; ImBuf *ibuf = BKE_image_acquire_ibuf(anImage, this->m_imageUser, &this->m_lock); - + if (!ibuf) return; if (ibuf->x != (int)getWidth() || ibuf->y != (int)getHeight()) { imb_freerectImBuf(ibuf); @@ -73,27 +73,27 @@ void ViewerBaseOperation::initImage() anImage->ok = IMA_OK_LOADED; } - /* viewer might have been change size, invalidate cached - * display buffers so they'll be used with a proper size - */ - IMB_display_buffer_invalidate(ibuf); + this->m_partialBufferUpdate = IMB_partial_buffer_update_context_new(ibuf); /* now we combine the input with ibuf */ this->m_outputBuffer = ibuf->rect_float; this->m_outputBufferDisplay = (unsigned char *)ibuf->rect; - + BKE_image_release_ibuf(this->m_image, this->m_lock); } void ViewerBaseOperation:: updateImage(rcti *rect) { + IMB_partial_buffer_update_rect(this->m_partialBufferUpdate, this->m_outputBuffer, rect); + WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL); } void ViewerBaseOperation::deinitExecution() { ImBuf *ibuf = BKE_image_acquire_ibuf(this->m_image, this->m_imageUser, &this->m_lock); - if (ibuf) - IMB_display_buffer_invalidate(ibuf); + + IMB_partial_buffer_update_free(this->m_partialBufferUpdate, ibuf); + BKE_image_release_ibuf(this->m_image, this->m_lock); this->m_outputBuffer = NULL; diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h index f3fd1e9c9df..4052c49ebbc 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h @@ -40,6 +40,7 @@ protected: bool m_doColorManagement; bool m_doColorPredivide; + struct PartialBufferUpdateContext *m_partialBufferUpdate; public: bool isOutputOperation(bool rendering) const { return isActiveViewerOutput(); } void initExecution(); |