From 1ea16dcf9b5337a7f8983a09d7f92b6164a7670f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 15 Mar 2013 09:46:37 +0000 Subject: 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. --- source/blender/imbuf/intern/cineon/cineonlib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/imbuf/intern/cineon/cineonlib.c') 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; } -- cgit v1.2.3