> On Apr 11, 2016, at 6:19 PM, Jonathan Tilden (2K) <[email protected]>
> wrote:
>
> In the test, I'm currently going through 2500 files in a single directory
> sequentially. In the app, I'll be trawling a complex directory structure, so
> its more than liking going to be unpredictable
So, basically, you will visit each file once, examine the alpha channel, and
then move on to the next file and not return?
If that is correct, I have a plan, which is to bypass the ImageCache entirely.
Try this (pseudocode, I don't feel like being careful with my Python syntax):
for each file :
buf = oiio.ImageBuf(file)
spec = buf.spec()
if spec.nchannels > 3 :
# This file has an alpha channel, so you have things to do.
# Now do the full read of pixels, and force it to read directly
# bypassing the cache:
buf.read (0, 0, True) # Parameters: subimage, miplevel, force
# ... do whatever else you need with the pixels now
# force the buf to destroy
buf = None
# And tell the cache to close the file
cache.invalidate (file)
Does that help?
Also, at the end of the run, or perhaps at various intermediate points (every
100 files?), you may want:
print cache.getstats()
And see if any of the statistics look like they are growing without bounds. In
particular, if you are invalidating the files when you're done with them the
"current" number of ImageInputs should stay low.
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org