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/cineonlib.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/cineonlib.c')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineonlib.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index b858251a6b9..4b9ca1dd539 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -196,6 +196,13 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t cineon->width = swap_uint(header.imageHeader.element[0].pixels_per_line, cineon->isMSB); cineon->height = swap_uint(header.imageHeader.element[0].lines_per_image, cineon->isMSB); + + if (cineon->width == 0 || cineon->height == 0) { + if (verbose) printf("Cineon: Wrong image dimension: %dx%d\n", cineon->width, cineon->height); + logImageClose(cineon); + return 0; + } + cineon->depth = header.imageHeader.elements_per_image; cineon->srcFormat = format_Cineon; @@ -205,6 +212,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t cineon->numElements = header.imageHeader.elements_per_image; else { if (verbose) printf("Cineon: Data interleave not supported: %d\n", header.imageHeader.interleave); + logImageClose(cineon); return 0; } @@ -235,6 +243,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t } else { if (verbose) printf("Cineon: Cineon image depth unsupported: %d\n", cineon->depth); + logImageClose(cineon); return 0; } @@ -264,6 +273,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t default: /* Not supported */ if (verbose) printf("Cineon: packing unsupported: %d\n", header.imageHeader.packing); + logImageClose(cineon); return 0; } |