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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 ***************** */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user