/usr/include/OpenImageIO/deepdata.h is in libopenimageio-dev 1.7.17~dfsg0-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | /*
Copyright 2015 Larry Gritz and the other authors and contributors.
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 software's owners 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 THE COPYRIGHT
OWNER OR CONTRIBUTORS 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.
(This is the Modified BSD License)
*/
#pragma once
#ifndef OPENIMAGEIO_DEEPDATA_H
#define OPENIMAGEIO_DEEPDATA_H
#include "export.h"
#include "oiioversion.h"
#include "array_view.h"
OIIO_NAMESPACE_BEGIN
struct TypeDesc;
class ImageSpec;
/// Structure to hold "deep" data -- multiple samples per pixel.
class OIIO_API DeepData {
public:
/// Construct an empty DeepData.
DeepData ();
/// Construct and init from an ImageSpec.
DeepData (const ImageSpec &spec);
/// Copy constructor
DeepData (const DeepData &d);
~DeepData ();
/// Copy assignment
const DeepData& operator= (const DeepData &d);
/// Clear the vectors and reset size to 0.
void clear ();
/// Deallocate all space in the vectors
void free ();
/// Initialize size and allocate nsamples, pointers.
void init (int npix, int nchan, array_view<const TypeDesc> channeltypes,
array_view<const std::string> channelnames);
/// Initialize size and allocate nsamples based on the number
/// of pixels, channels, and channel types in the ImageSpec.
void init (const ImageSpec &spec);
/// Retrieve the total number of pixels.
int pixels () const;
/// Retrieve the number of channels.
int channels () const;
/// The name of channel c.
string_view channelname (int c) const;
/// Retrieve the channel type of channel c.
TypeDesc channeltype (int c) const;
/// The size for each sample of channel c
size_t channelsize (int c) const;
/// The size for all channels of one sample.
size_t samplesize () const;
/// Retrieve the number of samples for the given pixel index.
int samples (int pixel) const;
/// Set the number of samples for the given pixel. This must be called
/// after init().
void set_samples (int pixel, int samps);
/// Set the number of samples for all pixels. The samples.size() is
/// required to match pixels().
void set_all_samples (array_view<const unsigned int> samples);
/// Set the capacity of samples for the given pixel. This must be called
/// after init().
void set_capacity (int pixel, int samps);
/// Retrieve the capacity (number of allocated samples) for the given
/// pixel index.
int capacity (int pixel) const;
/// Insert n samples at the given pixel, starting at the indexed
/// position.
void insert_samples (int pixel, int samplepos, int n=1);
/// Erase n samples at the given pixel, starting at the indexed
/// position.
void erase_samples (int pixel, int samplepos, int n=1);
/// Retrieve deep sample value within a pixel, cast to a float.
float deep_value (int pixel, int channel, int sample) const;
/// Retrieve deep sample value within a pixel, as an untigned int.
uint32_t deep_value_uint (int pixel, int channel, int sample) const;
/// Set deep sample value within a pixel, as a float.
void set_deep_value (int pixel, int channel, int sample, float value);
/// Set deep sample value within a pixel, as a uint32.
void set_deep_value (int pixel, int channel, int sample, uint32_t value);
/// Retrieve the pointer to a given pixel/channel/sample, or NULL if
/// there are no samples for that pixel. Use with care, and note that
/// calls to insert_samples and erase_samples can invalidate pointers
/// returend by prior calls to data_ptr.
void *data_ptr (int pixel, int channel, int sample);
const void *data_ptr (int pixel, int channel, int sample) const;
array_view<const TypeDesc> all_channeltypes () const;
array_view<const unsigned int> all_samples () const;
array_view<const char> all_data () const;
/// Fill in the vector with pointers to the start of the first
/// channel for each pixel.
void get_pointers (std::vector<void*> &pointers) const;
/// Copy the designated sample from a source DeepData into this
/// DeepData. The two DeepData structures need to have the same channel
/// layout.
bool copy_deep_sample (int pixel, int sample,
const DeepData &src, int srcpixel, int srcsample);
/// Copy the designated pixel from a source DeepData into this DeepData.
/// The two DeepData structures need to have the same channel layout.
bool copy_deep_pixel (int pixel, const DeepData &src, int srcpixel);
/// Split all samples of that pixel at the given depth zsplit. Samples
/// that span z (i.e. z < zsplit < zback) will be split into two samples
/// with depth ranges [z,zsplit] and [zsplit,zback] with appropriate
/// changes to their color and alpha values. Samples not spanning zsplit
/// will remain intact. This operation will have no effect if there are
/// not Z and Zback channels present.
void split (int pixel, float depth);
/// Sort the samples of a pixel by Z.
void sort (int pixel);
/// Merge any adjacent samples in the pixel that exactly overlap in z
/// range. This is only useful if the pixel has previously been split at
/// all sample starts and ends, and sorted by Z. Note that this may
/// change the number of samples in the pixel.
void merge_overlaps (int pixel);
/// Merge src's samples into dst's samples
void merge_deep_pixels (int pixel, const DeepData &src, int srcpixel);
/// Occlusion cull samples hidden behind opaque samples.
void occlusion_cull (int pixel);
private:
class Impl;
Impl *m_impl; // holds all the nontrivial stuff
int m_npixels, m_nchannels;
};
OIIO_NAMESPACE_END
#endif // OPENIMAGEIO_DEEPDATA_H
|