Files
renderdoc/renderdoc/3rdparty/tinyexr
baldurk 3a309dcd14 Fix for compile errors/warnings on linux
* The daily linux auto-compile script was broken, it's fixed now!
2015-02-25 19:02:26 +00:00
..

From https://github.com/syoyo/tinyexr

Tiny OpenEXR image library.

Example

tinyexr is a small library to load and save OpenEXR(.exr) images. tinyexr is written in portable C++(no library dependency except for STL), thus tinyexr is good to embed into your application. To use tinyexr, simply copy tinyexr.cc and tinyexr.h into your project.

tinyexr currently supports:

  • OpenEXR version 1.x.
  • Normal image
    • Scanline format.
    • Uncompress("compress" = 0) and ZIP compression("compress" = 3).
    • Half pixel type.
  • Deep image
    • Scanline format.
    • ZIPS compression("compress" = 2).
    • Half, float pixel type.
  • Litte endian machine.
  • C interface.
    • You can easily write language bindings(e.g. golang)
  • EXR saving
    • with ZIP compression.

Use case

Usage

Reading ordinal EXR file.

  const char* input = "asakusa.exr";
  float* out; // width * height * RGBA
  int width;
  int height;
  const char* err;

  int ret = LoadEXR(&out, &width, &height, input, &err);

Reading deep image EXR file. See example/deepview for actual usage.

  const char* input = "deepimage.exr";
  const char* err;
  DeepImage deepImage;

  int ret = LoadDeepEXR(&deepImage, input, &err);

  // acccess to each sample in the deep pixel.
  for (int y = 0; y < deepImage.height; y++) {
    int sampleNum = deepImage.offset_table[y][deepImage.width-1];
    for (int x = 0; x < deepImage.width-1; x++) {
      int s_start = deepImage.offset_table[y][x];
      int s_end   = deepImage.offset_table[y][x+1];
      if (s_start >= sampleNum) {
        continue;
      }
      s_end = (s_end < sampleNum) ? s_end : sampleNum;
      for (int s = s_start; s < s_end; s++) {
        float val = deepImage.image[depthChan][y][s];
        ...
      }
    }
  }

Example

deepview

examples/deepview is simple deep image viewer in OpenGL.

DeepViewExample

TODO

Contribution is welcome!

  • Tile format.
  • Support for various compression type.
  • Multi-channel.
  • Multi-part(EXR2.0)
  • Pixel order.
  • Pixel format(UINT, FLOAT).
  • Big endian machine.
  • Optimization
    • ISPC?
    • multi-threading.

Similar projects

License

3-clause BSD

tinyexr uses miniz, which is developed by Rich Geldreich richgel99@gmail.com, and licensed under public domain.

Author(s)

Syoyo Fujita(syoyo@lighttransport.com)

Contributor(s)