From 57a3163096199b336840fcf30a0dc78782c42d96 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 16 Nov 2015 18:20:41 +0500 Subject: Speedup OpenGL sequencer animation rendering The idea is to avoid having roundtrip from byte to float and back to byte buffer and use render result's byte buffer to store result of sequencer rendering. This actually matches to what regular render pipeline is doing and this gives around 2-3 times speedup of sequencer export on a simple scenes. --- source/blender/editors/render/render_opengl.c | 35 +++++++++++---------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'source/blender/editors/render') diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 2b23b683af0..04c1d682cde 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -282,29 +282,22 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr) ibuf = BKE_sequencer_give_ibuf(&context, CFRA, chanshown); if (ibuf) { - ImBuf *linear_ibuf; - - BLI_assert((oglrender->sizex == ibuf->x) && (oglrender->sizey == ibuf->y)); - - linear_ibuf = IMB_dupImBuf(ibuf); + ImBuf *out = IMB_dupImBuf(ibuf); IMB_freeImBuf(ibuf); - - if (linear_ibuf->rect_float == NULL) { - /* internally sequencer working in display space and stores both bytes and float buffers in that space. - * It is possible that byte->float onversion didn't happen in sequencer (e.g. when adding image sequence/movie - * into sequencer) there'll be only byte buffer. Create float buffer from existing byte buffer, making it linear - */ - - IMB_float_from_rect(linear_ibuf); + /* OpenGL render is considered to be preview and should be + * as fast as possible. So currently we're making sure sequencer + * result is always byte to simplify color management pipeline. + * + * TODO(sergey): In the case of output to float container (EXR) + * it actually makes sense to keep float buffer instead. + */ + if (out->rect_float != NULL) { + IMB_rect_from_float(out); + imb_freerectfloatImBuf(out); } - else { - /* ensure float buffer is in linear space, not in display space */ - BKE_sequencer_imbuf_from_sequencer_space(scene, linear_ibuf); - } - - memcpy(rectf, linear_ibuf->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey); - - IMB_freeImBuf(linear_ibuf); + BLI_assert((oglrender->sizex == ibuf->x) && (oglrender->sizey == ibuf->y)); + RE_render_result_rect_from_ibuf(rr, &scene->r, out, oglrender->view_id); + IMB_freeImBuf(out); } if (gpd) { -- cgit v1.2.3