diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-03-15 13:46:37 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-03-15 13:46:37 +0400 |
commit | 1ea16dcf9b5337a7f8983a09d7f92b6164a7670f (patch) | |
tree | 1e22b1bad4d657cb9d315ed51332b9366eb318b5 /source/blender/imbuf/intern/cineon/cineon_dpx.c | |
parent | 42660a204a553b331a7d99d4f49987c46707fa2c (diff) |
Patch #34632: DPX/Cineon speed up
Done by Julien Enche (aka trap), thanks!
From the patch comment:
This patch speeds up Cineon/DPX file loading.
Some more checks are done in dpxOpen and cineonOpen functions so IB_test
flag can now be taken into account safely, and an unnecessary call to
IMB_rect_from_float has been removed.
DPX/Cineon file now loads around 3 times faster on my computer.
Own comment:
Ideally, IB_rect shall indeed indicate which buffers to load, however
currently all places which reads image uses this flag.
This fact already mentioned in OpenEXR reader and it shall be fine
to skip doing rect_from_float in readers themselves.
Diffstat (limited to 'source/blender/imbuf/intern/cineon/cineon_dpx.c')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineon_dpx.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 6cf628448a2..48bda418d82 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -70,30 +70,23 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, size_t size, int us logImageGetSize(image, &width, &height, &depth); - if (width == 0 || height == 0) { - logImageClose(image); - return 0; - } - ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags); if (ibuf == 0) { logImageClose(image); return 0; } - if (logImageGetDataRGBA(image, ibuf->rect_float, 1) != 0) { - /* Conversion not possible (probably because the format is unsupported) */ - logImageClose(image); - MEM_freeN(ibuf); - return 0; + if (!(flags & IB_test)) { + if (logImageGetDataRGBA(image, ibuf->rect_float, 1) != 0) { + logImageClose(image); + IMB_freeImBuf(ibuf); + return 0; + } + IMB_flipy(ibuf); } logImageClose(image); ibuf->ftype = use_cineon ? CINEON : DPX; - IMB_flipy(ibuf); - - if (flags & IB_rect) - IMB_rect_from_float(ibuf); if (flags & IB_alphamode_detect) ibuf->flags |= IB_alphamode_premul; |