Optimization for render result save

Skip byte->float conversion if output file format
supports high bit depths but configured to only
output 8 bits per channel.

Gives around 30% speedup when re-exporting movie file
to PNG image sequence here on laptop.

Possible further optimization:

- Skip color space conversion in imbuf_for_write
  function if we've got already have buffer in
  that space.

  This doesn't seem to happen often after tweak
  to render result to imbuf.

- Skip black alpha-under if original image is
  opaque,

  This is a bit tricky to detect.
This commit is contained in:
Sergey Sharybin 2013-11-22 16:48:08 +06:00
parent 0469971b05
commit 885354daec
1 changed files with 7 additions and 1 deletions

View File

@ -1124,7 +1124,13 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
*/
if (ibuf->rect) {
if (BKE_imtype_valid_depths(rd->im_format.imtype) & (R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_24 | R_IMF_CHAN_DEPTH_32)) {
IMB_float_from_rect(ibuf);
if (rd->im_format.depth == R_IMF_CHAN_DEPTH_8) {
/* Higher depth bits are supported but not needed for current file output. */
ibuf->rect_float = NULL;
}
else {
IMB_float_from_rect(ibuf);
}
}
else {
/* ensure no float buffer remained from previous frame */