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]> 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]
> 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