mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
Add tinyexr from https://github.com/syoyo/tinyexr
* Unmodified, from revision 14ba590a376ffcb2436ede10f122a3d1797db4c4
This commit is contained in:
@@ -76,3 +76,7 @@ RenderDoc also uses several external libraries and components which include thei
|
||||
- [IronPython](http://ironpython.net/)
|
||||
distributed under the Apache 2.0 license.
|
||||
Copyright IronPython Team
|
||||
|
||||
- [tinyexr](https://github.com/syoyo/tinyexr)
|
||||
distributed under the New BSD License (3 Clause).
|
||||
Copyright 2014, Syoyo Fujita
|
||||
|
||||
@@ -119,6 +119,14 @@
|
||||
</externalLink>
|
||||
</para></listItem>
|
||||
|
||||
<listItem><para>
|
||||
<externalLink>
|
||||
<linkText>tinyexr</linkText>
|
||||
<linkAlternateText>Used for the OpenEXR file loading and saving.</linkAlternateText>
|
||||
<linkUri>https://github.com/syoyo/tinyexr</linkUri>
|
||||
</externalLink>
|
||||
</para></listItem>
|
||||
|
||||
<listItem><para>
|
||||
<externalLink>
|
||||
<linkText>Sandcastle Help File Builder</linkText>
|
||||
|
||||
Binary file not shown.
Vendored
+116
@@ -0,0 +1,116 @@
|
||||
From https://github.com/syoyo/tinyexr
|
||||
|
||||
# Tiny OpenEXR image library.
|
||||
|
||||

|
||||
|
||||
`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
|
||||
|
||||
* mallie https://github.com/lighttransport/mallie
|
||||
* Your project here!
|
||||
|
||||
## 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.
|
||||
|
||||

|
||||
|
||||
## TODO
|
||||
|
||||
Contribution is welcome!
|
||||
|
||||
- [ ] Tile format.
|
||||
- [ ] Support for various compression type.
|
||||
- [X] Multi-channel.
|
||||
- [ ] Multi-part(EXR2.0)
|
||||
- [ ] Pixel order.
|
||||
- [ ] Pixel format(UINT, FLOAT).
|
||||
- [ ] Big endian machine.
|
||||
- [ ] Optimization
|
||||
- [ ] ISPC?
|
||||
- [ ] multi-threading.
|
||||
|
||||
## Similar projects
|
||||
|
||||
* miniexr: https://github.com/aras-p/miniexr (Write OpenEXR)
|
||||
|
||||
## 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)
|
||||
|
||||
* Matt Ebb (http://mattebb.com) : deep image example. Thanks!
|
||||
* Matt Pharr (http://pharr.org/matt/) : Testing tinyexr with OpenEXR(IlmImf). Thanks!
|
||||
+8483
File diff suppressed because it is too large
Load Diff
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright (c) 2014, Syoyo Fujita
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __TINYEXR_H__
|
||||
#define __TINYEXR_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int num_channels;
|
||||
const char **channel_names;
|
||||
float **image; // image[channels][pixels]
|
||||
int width;
|
||||
int height;
|
||||
} EXRImage;
|
||||
|
||||
typedef struct {
|
||||
int num_channels;
|
||||
const char **channel_names;
|
||||
float ***image; // image[channels][scanlines][samples]
|
||||
int **offset_table; // offset_table[scanline][offsets]
|
||||
int width;
|
||||
int height;
|
||||
} DeepImage;
|
||||
|
||||
// Loads single-frame OpenEXR image. Assume EXR image contains RGB(A) channels.
|
||||
// Application must free image data as returned by `out_rgba`
|
||||
// Result image format is: float x RGBA x width x hight
|
||||
// Return 0 if success
|
||||
// Returns error string in `err` when there's an error
|
||||
extern int LoadEXR(float **out_rgba, int *width, int *height,
|
||||
const char *filename, const char **err);
|
||||
|
||||
// Loads multi-channel, single-frame OpenEXR image.
|
||||
// Application must free EXRImage
|
||||
// Return 0 if success
|
||||
// Returns error string in `err` when there's an error
|
||||
extern int LoadMultiChannelEXR(EXRImage *image, const char *filename,
|
||||
const char **err);
|
||||
|
||||
// Saves floating point RGBA image as OpenEXR.
|
||||
// Image is compressed with ZIP.
|
||||
// Return 0 if success
|
||||
// Returns error string in `err` when there's an error
|
||||
extern int SaveEXR(const float *in_rgba, int width, int height,
|
||||
const char *filename, const char **err);
|
||||
|
||||
// Saves multi-channel, single-frame OpenEXR image.
|
||||
// Application must free EXRImage
|
||||
// Return 0 if success
|
||||
// Returns error string in `err` when there's an error
|
||||
extern int SaveMultiChannelEXR(const EXRImage *image, const char *filename,
|
||||
const char **err);
|
||||
|
||||
// Loads single-frame OpenEXR deep image.
|
||||
// Application must free memory of variables in DeepImage(image, offset_table)
|
||||
// Return 0 if success
|
||||
// Returns error string in `err` when there's an error
|
||||
extern int LoadDeepEXR(DeepImage *out_image, const char *filename,
|
||||
const char **err);
|
||||
|
||||
// NOT YET IMPLEMENTED:
|
||||
// Saves single-frame OpenEXR deep image.
|
||||
// Return 0 if success
|
||||
// Returns error string in `err` when there's an error
|
||||
// extern int SaveDeepEXR(const DeepImage *in_image, const char *filename,
|
||||
// const char **err);
|
||||
|
||||
// NOT YET IMPLEMENTED:
|
||||
// Loads multi-part OpenEXR deep image.
|
||||
// Application must free memory of variables in DeepImage(image, offset_table)
|
||||
// extern int LoadMultiPartDeepEXR(DeepImage **out_image, int num_parts, const
|
||||
// char *filename,
|
||||
// const char **err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __TINYEXR_H__
|
||||
Reference in New Issue
Block a user