diff --git a/src/libOpenImageIO/imageinput.cpp b/src/libOpenImageIO/imageinput.cpp index f63ab45de1..3ec308b0d2 100644 --- a/src/libOpenImageIO/imageinput.cpp +++ b/src/libOpenImageIO/imageinput.cpp @@ -232,8 +232,8 @@ ImageInput::read_scanlines (int ybegin, int yend, int z, TypeDesc chanformat = m_spec.channelformats[c+firstchan]; ok = convert_image (1 /* channels */, m_spec.width, nscanlines, 1, &buf[offset], chanformat, - pixel_bytes, AutoStride, AutoStride, - (char *)data + c*m_spec.format.size(), + native_pixel_bytes, native_scanline_bytes, 0, + (char *)data + c*format.size(), format, xstride, ystride, zstride); offset += chanformat.size (); } @@ -444,6 +444,9 @@ ImageInput::read_tiles (int xbegin, int xend, int ybegin, int yend, : (format.size() * nchans); stride_t full_pixelsize = native_data ? m_spec.pixel_bytes(true) : (format.size() * m_spec.nchannels); + stride_t full_tilewidthbytes = full_pixelsize * m_spec.tile_width; + stride_t full_tilewhbytes = full_tilewidthbytes * m_spec.tile_height; + stride_t full_tilebytes = full_tilewhbytes * m_spec.tile_depth; size_t prefix_bytes = m_spec.pixel_bytes (0,firstchan,true); std::vector buf; for (int z = zbegin; z < zend; z += std::max(1,m_spec.tile_depth)) { @@ -464,16 +467,14 @@ ImageInput::read_tiles (int xbegin, int xend, int ybegin, int yend, ok &= read_tile (x, y, z, format, tilestart, xstride, ystride, zstride); } else { - buf.resize (m_spec.tile_bytes()); + buf.resize (full_tilebytes); ok &= read_tile (x, y, z, format, &buf[0], - full_pixelsize, - full_pixelsize*m_spec.tile_width, - full_pixelsize*m_spec.tile_pixels()); + full_pixelsize, full_tilewidthbytes, + full_tilewhbytes); if (ok) copy_image (nchans, xw, yh, zd, &buf[prefix_bytes], pixelsize, full_pixelsize, - full_pixelsize*m_spec.tile_width, - full_pixelsize*m_spec.tile_pixels(), + full_tilewidthbytes, full_tilewhbytes, tilestart, xstride, ystride, zstride); } tilestart += m_spec.tile_width * xstride; diff --git a/src/libtexture/imagecache.cpp b/src/libtexture/imagecache.cpp index f25217039a..f4fead0190 100644 --- a/src/libtexture/imagecache.cpp +++ b/src/libtexture/imagecache.cpp @@ -415,6 +415,8 @@ ImageCacheFile::open (ImageCachePerThreadInfo *thread_info) invalidate_spec (); return false; } + // ImageCache can't store differing formats per channel + tempspec.channelformats.clear(); LevelInfo levelinfo (tempspec, nativespec); si.levels.push_back (levelinfo); ++nmip; diff --git a/testsuite/openexr-suite/ref/out.txt b/testsuite/openexr-suite/ref/out.txt index 463b637981..75b3da2975 100644 --- a/testsuite/openexr-suite/ref/out.txt +++ b/testsuite/openexr-suite/ref/out.txt @@ -66,7 +66,7 @@ Comparing "../../../../../openexr-images-1.5.0/ScanLines/Tree.exr" and "Tree.exr PASS Reading ../../../../../openexr-images-1.5.0/ScanLines/Blobbies.exr ../../../../../openexr-images-1.5.0/ScanLines/Blobbies.exr : 1040 x 1040, 5 channel, half/half/half/half/float openexr - SHA-1: 1D3D059692BB2074264393AA2B04D3E60DC52BDC + SHA-1: 64C3C765E0D40AA92E066F6EC9198A8053BF1179 channel list: R (half), G (half), B (half), A (half), Z (float) pixel data origin: x=-20, y=-20 full/display size: 1000 x 1000