OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

[BUG] soft invalidation does not work for jpgs when autotile=0

Open ThiagoIze opened this issue 4 years ago • 0 comments

Describe the bug Every time I do a soft invalidation on a jpg and with autotile=0, OIIO will detect the file as needing invalidation. This hurts performance. If nothing is changing, I don't expect it to be invalidated.

Here's some debug output to show it in action:

// printfs I added report the following. Since they got printed out, it also shows an invalidation occurred.
// level.spec.tile_width = 1000
// level.spec.tile_height = 1000
// m_autotile = 0

            // Invalidate if any untiled subimage doesn't match the current
            // auto-tile setting.
            if (sub.untiled) {
                for (int m = 0, mend = f->miplevels(s); m < mend; ++m) {
                    const ImageCacheFile::LevelInfo& level(f->levelinfo(s, m));
                    if (level.spec.tile_width != m_autotile
                        || level.spec.tile_height != m_autotile) {
                       printf("level.spec.tile_width = %d\n", level.spec.tile_width);
                       printf("level.spec.tile_height = %d\n", level.spec.tile_height);
                       printf("m_autotile = %d\n", m_autotile);
                        all_files.push_back(name);
                        break;
                    }
                }
            }

To Reproduce Steps to reproduce the behavior: I suspect any jpg or other untiled/unmipped image that you call soft invalidate on will do this.

Expected behavior don't invalidate if nothing changed.

Evidence See above.

Platform information:

  • OIIO branch/version: Master, maybe a week or so old, though there are some custom changes, but I don't think they are related.

ThiagoIze avatar Jan 19 '22 03:01 ThiagoIze