| 370 | } // namespace |
| 371 | |
| 372 | std::shared_ptr<ImageBuffer> loadImage(const DeviceRef& device, |
| 373 | const std::string& filename, |
| 374 | DataType dataType, |
| 375 | Storage storage) |
| 376 | { |
| 377 | const std::string ext = getExtension(filename); |
| 378 | std::shared_ptr<ImageBuffer> image; |
| 379 | |
| 380 | if (ext == "pfm") |
| 381 | image = loadImagePFM(device, filename, dataType, storage); |
| 382 | else if (ext == "phm") |
| 383 | image = loadImagePHM(device, filename, dataType, storage); |
| 384 | else |
| 385 | #if OIDN_USE_OPENIMAGEIO |
| 386 | image = loadImageOIIO(device, filename, dataType, storage); |
| 387 | #else |
| 388 | throw std::runtime_error("cannot load unsupported image file format: '" + filename + "'"); |
| 389 | #endif |
| 390 | |
| 391 | return image; |
| 392 | } |
| 393 | |
| 394 | void saveImage(const std::string& filename, const ImageBuffer& image) |
| 395 | { |
no test coverage detected