diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-16 16:20:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-16 16:20:41 +0300 |
commit | 57a3163096199b336840fcf30a0dc78782c42d96 (patch) | |
tree | 70cf187f706150260d06cc51b80c1e14b759a819 /source/blender/editors/render | |
parent | 5576524e880305595f75cb523d5f5a07cfcd9824 (diff) |
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.
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 35 |
1 files changed, 14 insertions, 21 deletions
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) { |