Thanks. Knowing it's 2.1 and on Mac makes it easy for me to try to reproduce on 
my end. I'll give it a shot tomorrow.

        -- lg


> On Oct 11, 2020, at 11:30 PM, Arman Garakani <[email protected]> 
> wrote:
> 
> 
> I am using a brew. I will certainly clone and built off of repo sometime 
> tomorrow. 
> 
> macOS 10.15.6
> 
> $ brew info openimageio
> openimageio: stable 2.1.18 (bottled), HEAD
> Library for reading, processing and writing images
> https://openimageio.org/ <https://openimageio.org/>
> /usr/local/Cellar/openimageio/2.1.18_1 (93 files, 16.3MB) *
>   Poured from bottle on 2020-10-08 at 14:19:55
> From: 
> https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openimageio.rb 
> <https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openimageio.rb>
> License: BSD-3-Clause
> ==> Dependencies
> Build: cmake ✘, pkg-config ✔
> Required: boost ✔, boost-python3 ✔, ffmpeg ✔, freetype ✔, giflib ✔, ilmbase 
> ✔, jpeg ✔, libheif ✔, libpng ✔, libraw ✔, libtiff ✔, opencolorio ✔, openexr 
> ✔, [email protected] ✔, webp ✔
> ==> Options
> --HEAD
>       Install HEAD version
> ==> Analytics
> install: 306 (30 days), 1,135 (90 days), 4,118 (365 days)
> install-on-request: 271 (30 days), 983 (90 days), 3,259 (365 days)
> build-error: 0 (30 days)
> 
> Thanks for responding so quickly. 
> 
> -Arman. 
> 
>> On Oct 11, 2020, at 9:35 PM, Larry Gritz <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Which platform (OS, compiler)? Which version of OIIO?
>> 
>> If you run with a debug build, can you get a stack trace that shows the call 
>> sequence or line where it crashed?
>> 
>> 
>> 
>>> On Oct 11, 2020, at 9:12 PM, Arman Garakani <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> I am adding unit test as part of adding OpenImageIO to our app ( Machine 
>>> Learning / Computer Vision / Biological Assays ). Before going further, 
>>> oiio solves a fundamental problem in developing media accessing 
>>> functionality. I have a very directed functionality for videos. Oiio has 
>>> more functionality, simpler API and supports much wider image format APIs. 
>>> 
>>> Here is the problem I am having with small tif stack files I use for 
>>> testing. <zser16.tif><zser8.tif>
>>> 
>>> 
>>> Here is what iinfo says about it:
>>> 
>>> $ iinfo zser8.tif 
>>> zser8.tif :  160 x  128, 1 channel, uint8 tiff (11 subimages)
>>> 
>>> OpenImageIO ImageCache statistics (shared) ver 2.1.18
>>>   Options:  max_memory_MB=2048.0 max_open_files=100 autotile=0
>>>             autoscanline=0 automip=0 forcefloat=0 accept_untiled=1
>>>             accept_unmipped=1 deduplicate=1 unassociatedalpha=0
>>>             failure_retries=0 
>>> 
>>> In the function below, the output before the loop calling add_tile, outputs:
>>> 11 (160,128) 255::-1::-1::NA::8
>>> 
>>> 
>>> call to add_tile generates a memory access fault. The interesting thing 
>>> here is that similar file but containing 16bit data works fine. 
>>> 
>>> 
>>> 
>>> 
>>>  This is a simple test I am developing to assess hit and miss performance 
>>> with ImageCache. The test function is a lambda here for simplicity. 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> TEST(oiio, basic){
>>>     
>>>     auto test_file = [](const ustring& filename){
>>>         // Create a private ImageCache so we can customize its cache size
>>>         // and instruct it store everything internally as floats.
>>>     ImageCache* ic = ImageCache::create(true);
>>>     ic->attribute("autotile", 0);
>>>     ic->attribute("max_memory_MB", 2048.0);
>>> 
>>>     
>>>     ImageSpec spec;
>>>     int number_of_subimages = 0;
>>>     while (ic->get_imagespec (filename, spec, number_of_subimages)){
>>>         number_of_subimages++;
>>>     }
>>>     unsigned int maxval = (unsigned int)get_intsample_maxval(spec);
>>>     int xres = spec.width;
>>>     int yres = spec.height;
>>>     int channels = spec.nchannels;
>>>     int i = spec.get_int_attribute ("oiio:subimages", -1.0);
>>>     int bp = spec.get_int_attribute ("oiio:BitsPerSample", -1);
>>>     float fps = spec.get_float_attribute ("Fps", -1.0f);
>>>     std::string s = spec.get_string_attribute ("DateTime", "NA");
>>>     
>>>     std::vector<unsigned char> pixels (xres*yres*channels);
>>>     std::cout << number_of_subimages << " (" << xres << "," << yres << ") " 
>>> <<
>>>         maxval << "::" << i << "::" <<  fps << "::" << s << "::" << bp << 
>>> std::endl;
>>> 
>>>     for (int ss = 0; ss < number_of_subimages; ss++){
>>>         if (ss & 1)
>>>             ic->add_tile(filename, ss, 0, 0, 0, 0, 1, 0, TypeDesc::UINT8, 
>>> pixels.data());
>>>     }
>>>     
>>>     {
>>>     std::cout << " Half Cached " << std::endl;
>>>             // average hit time and miss time
>>>         float hits(0.0), miss(0.0);
>>>         int hitn(0), missn(0);
>>>         for (int ss = 0; ss < number_of_subimages; ss++){
>>>             if (ss & 1){
>>>                 OIIO::Timer hitimer;
>>>                 auto tile = ic->get_tile(filename, ss, 0, 0, 0, 0, 1, 0);
>>>                 assert(tile != nullptr);
>>>                 hits += hitimer();
>>>                 hitn++;
>>>             }
>>>             else{
>>>                 OIIO::Timer misstimer;
>>>                 ic->add_tile(filename, ss, 0, 0, 0, 0, 1, 0, 
>>> TypeDesc::UINT8, pixels.data());
>>>                 miss += misstimer();
>>>                 missn++;
>>>             }
>>>         }
>>>         hits /= hitn;
>>>         miss /= missn;
>>>         std::cout << hitn << "," << missn << std::endl;
>>>         
>>>         std::cout << hits * 1000 << " , " << miss * 1000 << std::endl;
>>>     }
>>>     
>>>     std::cout << " All Cached " << std::endl;
>>>     
>>>     float hits(0.0), miss(0.0);
>>>     int hitn(0), missn(0);
>>>     for (int ss = 0; ss < number_of_subimages; ss++){
>>>         OIIO::Timer hitimer;
>>>         auto tile = ic->get_tile(filename, ss, 0, 0, 0, 0, 1, 0);
>>>         if (tile != nullptr){
>>>             hits += hitimer();
>>>             hitn++;
>>>         }
>>>         else{
>>>             miss += hitimer();
>>>             missn++;
>>>         }
>>>     }
>>>     hits /= hitn;
>>>     if (missn) miss /= missn;
>>>     std::cout << hitn << "," << missn << std::endl;
>>>     std::cout << hits * 1000 << " , " << miss * 1000 << std::endl;
>>>     std::cout << ic->getstats() << std::endl;
>>>         
>>>     };
>>>     
>>>     
>>>     auto res = dgenv_ptr->asset_path("zser8.tif");
>>>     EXPECT_TRUE(res.second);
>>>     EXPECT_TRUE(boost::filesystem::exists(res.first));
>>>     ustring filename (res.first.c_str());
>>>     test_file(filename);
>>>     
>>> }
>>> 
>>> 
>>> _______________________________________________
>>> Oiio-dev mailing list
>>> [email protected] <mailto:[email protected]>
>>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
>>> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>> 
>> --
>> Larry Gritz
>> [email protected] <mailto:[email protected]>
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Oiio-dev mailing list
>> [email protected] <mailto:[email protected]>
>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
> 
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]




_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to