{"action":"created","issue":{"url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1123","labels_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1123/labels{/name}","comments_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1123/comments","events_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1123/events","html_url":"https://github.com/OpenImageIO/oiio/issues/1123","id":69176261,"number":1123,"title":"ImageCache: On-demand layer reading for multi-layered files","user":{"login":"MrKepzie","id":4058448,"avatar_url":"https://avatars.githubusercontent.com/u/4058448?v=3","gravatar_id":"","url":"https://api.github.com/users/MrKepzie","html_url":"https://github.com/MrKepzie","followers_url":"https://api.github.com/users/MrKepzie/followers","following_url":"https://api.github.com/users/MrKepzie/following{/other_user}","gists_url":"https://api.github.com/users/MrKepzie/gists{/gist_id}","starred_url":"https://api.github.com/users/MrKepzie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrKepzie/subscriptions","organizations_url":"https://api.github.com/users/MrKepzie/orgs","repos_url":"https://api.github.com/users/MrKepzie/repos","events_url":"https://api.github.com/users/MrKepzie/events{/privacy}","received_events_url":"https://api.github.com/users/MrKepzie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2015-04-17T16:57:22Z","updated_at":"2015-10-16T18:03:51Z","closed_at":null,"body":"Hi,\r\n\r\nFirst off thanks for this amazing library. We use it extensively in Natron  (open-source compositing software) (https://github.com/MrKepzie/Natron/tree/workshop via OpenFX: https://github.com/MrKepzie/openfx-io ) for most of the image reading/writing.\r\n\r\nWe have received some complaints by our users that the reading of multi-layered EXR files was freakishly slow compared to other similar applications. I have narrowed it down to the ImageCache of OIIO. We make use of the ImageCache::get_pixels function. The problem is that if the image is not present into the cache, the OIIO cache internaly will create a new Tile and calls\r\n    ImageInput::read_image\r\n which in turns calls   \r\n    ImageInput::read_scanlines(ybegin,yend,z,0,m_spec.nchannels,format,data,xstride,ystride)\r\n\r\nSo basically regardless of what we requested via the *get_pixels* function with *chbegin* and *chend*, the Tile will always decode all available layers in the image. Needless to say that for EXR files rendered out with many passes it takes a while.  \r\n\r\nCould this be improved to only read the channels that were requested by *ImageCache::get_pixels* in the first place ?\r\n\r\nOur temporary workaround is to use the ImageInput::read_scanlines API directly, but we suffer from the lack of caching because if the user of Natron requests more than 1 layer to display, it will open as many ImageInput on our side that the the user requested, which is not efficient at all. \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/OpenImageIO/oiio/issues/comments/148787250","html_url":"https://github.com/OpenImageIO/oiio/issues/1123#issuecomment-148787250","issue_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1123","id":148787250,"user":{"login":"lgritz","id":504179,"avatar_url":"https://avatars.githubusercontent.com/u/504179?v=3","gravatar_id":"","url":"https://api.github.com/users/lgritz","html_url":"https://github.com/lgritz","followers_url":"https://api.github.com/users/lgritz/followers","following_url":"https://api.github.com/users/lgritz/following{/other_user}","gists_url":"https://api.github.com/users/lgritz/gists{/gist_id}","starred_url":"https://api.github.com/users/lgritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgritz/subscriptions","organizations_url":"https://api.github.com/users/lgritz/orgs","repos_url":"https://api.github.com/users/lgritz/repos","events_url":"https://api.github.com/users/lgritz/events{/privacy}","received_events_url":"https://api.github.com/users/lgritz/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T18:03:51Z","updated_at":"2015-10-16T18:03:51Z","body":"Currently, when autotile is on, it will autotile all untiled files.\r\n\r\nJust use a big tile size (say, 256) and see what happens. That will still break big images up into manageable chunks. Lower res files will still get tiled, but only a few tiles, so there's very little extra work.\r\n"}}