~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/3rdparty/openexr/IlmImf/ImfCRgbaFile.h

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
 
4
Digital Ltd. LLC
 
5
 
 
6
All rights reserved.
 
7
 
 
8
Redistribution and use in source and binary forms, with or without
 
9
modification, are permitted provided that the following conditions are
 
10
met:
 
11
*       Redistributions of source code must retain the above copyright
 
12
notice, this list of conditions and the following disclaimer.
 
13
*       Redistributions in binary form must reproduce the above
 
14
copyright notice, this list of conditions and the following disclaimer
 
15
in the documentation and/or other materials provided with the
 
16
distribution.
 
17
*       Neither the name of Industrial Light & Magic nor the names of
 
18
its contributors may be used to endorse or promote products derived
 
19
from this software without specific prior written permission.
 
20
 
 
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
23
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
24
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
25
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
26
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
27
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
28
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
29
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
30
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
31
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
32
 
 
33
*/
 
34
 
 
35
#ifndef INCLUDED_IMF_C_RGBA_FILE_H
 
36
#define INCLUDED_IMF_C_RGBA_FILE_H
 
37
 
 
38
 
 
39
#include <stdlib.h>
 
40
 
 
41
#ifdef __cplusplus
 
42
extern "C" {
 
43
#endif
 
44
 
 
45
/*
 
46
** Interpreting unsigned shorts as 16-bit floating point numbers
 
47
*/
 
48
 
 
49
typedef unsigned short ImfHalf;
 
50
 
 
51
void    ImfFloatToHalf (float f,
 
52
            ImfHalf *h);
 
53
 
 
54
void    ImfFloatToHalfArray (int n,
 
55
                const float f[/*n*/],
 
56
                ImfHalf h[/*n*/]);
 
57
 
 
58
float   ImfHalfToFloat (ImfHalf h);
 
59
 
 
60
void    ImfHalfToFloatArray (int n,
 
61
                const ImfHalf h[/*n*/],
 
62
                float f[/*n*/]);
 
63
 
 
64
/*
 
65
** RGBA pixel; memory layout must be the same as struct Imf::Rgba.
 
66
*/
 
67
 
 
68
struct ImfRgba
 
69
{
 
70
    ImfHalf     r;
 
71
    ImfHalf     g;
 
72
    ImfHalf     b;
 
73
    ImfHalf     a;
 
74
};
 
75
 
 
76
typedef struct ImfRgba ImfRgba;
 
77
 
 
78
/*
 
79
** Magic number; this must be the same as Imf::MAGIC
 
80
*/
 
81
 
 
82
#define IMF_MAGIC               20000630
 
83
 
 
84
/*
 
85
** Version number; this must be the same as Imf::EXR_VERSION
 
86
*/
 
87
 
 
88
#define IMF_VERSION_NUMBER      2
 
89
 
 
90
/*
 
91
** Line order; values must the the same as in Imf::LineOrder.
 
92
*/
 
93
 
 
94
#define IMF_INCREASING_Y        0
 
95
#define IMF_DECREASING_Y        1
 
96
#define IMF_RAMDOM_Y            2
 
97
 
 
98
 
 
99
/*
 
100
** Compression types; values must be the same as in Imf::Compression.
 
101
*/
 
102
 
 
103
#define IMF_NO_COMPRESSION      0
 
104
#define IMF_RLE_COMPRESSION     1
 
105
#define IMF_ZIPS_COMPRESSION    2
 
106
#define IMF_ZIP_COMPRESSION     3
 
107
#define IMF_PIZ_COMPRESSION     4
 
108
#define IMF_PXR24_COMPRESSION   5
 
109
#define IMF_B44_COMPRESSION     6
 
110
#define IMF_B44A_COMPRESSION    7
 
111
 
 
112
 
 
113
/*
 
114
** Channels; values must be the same as in Imf::RgbaChannels.
 
115
*/
 
116
 
 
117
#define IMF_WRITE_R             0x01
 
118
#define IMF_WRITE_G             0x02
 
119
#define IMF_WRITE_B             0x04
 
120
#define IMF_WRITE_A             0x08
 
121
#define IMF_WRITE_Y             0x10
 
122
#define IMF_WRITE_C             0x20
 
123
#define IMF_WRITE_RGB           0x07
 
124
#define IMF_WRITE_RGBA          0x0f
 
125
#define IMF_WRITE_YC            0x30
 
126
#define IMF_WRITE_YA            0x18
 
127
#define IMF_WRITE_YCA           0x38
 
128
 
 
129
 
 
130
/*
 
131
** Level modes; values must be the same as in Imf::LevelMode
 
132
*/
 
133
 
 
134
#define IMF_ONE_LEVEL           0
 
135
#define IMF_MIPMAP_LEVELS       1
 
136
#define IMF_RIPMAP_LEVELS       2
 
137
 
 
138
 
 
139
/*
 
140
** Level rounding modes; values must be the same as in Imf::LevelRoundingMode
 
141
*/
 
142
 
 
143
#define IMF_ROUND_DOWN          0
 
144
#define IMF_ROUND_UP            1
 
145
 
 
146
 
 
147
/*
 
148
** RGBA file header
 
149
*/
 
150
 
 
151
struct ImfHeader;
 
152
typedef struct ImfHeader ImfHeader;
 
153
 
 
154
ImfHeader *     ImfNewHeader (void);
 
155
 
 
156
void            ImfDeleteHeader (ImfHeader *hdr);
 
157
 
 
158
ImfHeader *     ImfCopyHeader (const ImfHeader *hdr);
 
159
 
 
160
void            ImfHeaderSetDisplayWindow (ImfHeader *hdr,
 
161
                       int xMin, int yMin,
 
162
                       int xMax, int yMax);
 
163
 
 
164
void            ImfHeaderDisplayWindow (const ImfHeader *hdr,
 
165
                    int *xMin, int *yMin,
 
166
                    int *xMax, int *yMax);
 
167
 
 
168
void            ImfHeaderSetDataWindow (ImfHeader *hdr,
 
169
                    int xMin, int yMin,
 
170
                    int xMax, int yMax);
 
171
 
 
172
void            ImfHeaderDataWindow (const ImfHeader *hdr,
 
173
                     int *xMin, int *yMin,
 
174
                     int *xMax, int *yMax);
 
175
 
 
176
void            ImfHeaderSetPixelAspectRatio (ImfHeader *hdr,
 
177
                          float pixelAspectRatio);
 
178
 
 
179
float           ImfHeaderPixelAspectRatio (const ImfHeader *hdr);
 
180
 
 
181
void            ImfHeaderSetScreenWindowCenter (ImfHeader *hdr,
 
182
                        float x, float y);
 
183
 
 
184
void            ImfHeaderScreenWindowCenter (const ImfHeader *hdr,
 
185
                         float *x, float *y);
 
186
 
 
187
void            ImfHeaderSetScreenWindowWidth (ImfHeader *hdr,
 
188
                           float width);
 
189
 
 
190
float           ImfHeaderScreenWindowWidth (const ImfHeader *hdr);
 
191
 
 
192
void            ImfHeaderSetLineOrder (ImfHeader *hdr,
 
193
                       int lineOrder);
 
194
 
 
195
int             ImfHeaderLineOrder (const ImfHeader *hdr);
 
196
 
 
197
void            ImfHeaderSetCompression (ImfHeader *hdr,
 
198
                     int compression);
 
199
 
 
200
int             ImfHeaderCompression (const ImfHeader *hdr);
 
201
 
 
202
int             ImfHeaderSetIntAttribute (ImfHeader *hdr,
 
203
                      const char name[],
 
204
                      int value);
 
205
 
 
206
int             ImfHeaderIntAttribute (const ImfHeader *hdr,
 
207
                       const char name[],
 
208
                       int *value);
 
209
 
 
210
int             ImfHeaderSetFloatAttribute (ImfHeader *hdr,
 
211
                        const char name[],
 
212
                        float value);
 
213
 
 
214
int             ImfHeaderSetDoubleAttribute (ImfHeader *hdr,
 
215
                         const char name[],
 
216
                         double value);
 
217
 
 
218
int             ImfHeaderFloatAttribute (const ImfHeader *hdr,
 
219
                         const char name[],
 
220
                         float *value);
 
221
 
 
222
int             ImfHeaderDoubleAttribute (const ImfHeader *hdr,
 
223
                          const char name[],
 
224
                          double *value);
 
225
 
 
226
int             ImfHeaderSetStringAttribute (ImfHeader *hdr,
 
227
                         const char name[],
 
228
                         const char value[]);
 
229
 
 
230
int             ImfHeaderStringAttribute (const ImfHeader *hdr,
 
231
                         const char name[],
 
232
                      const char **value);
 
233
 
 
234
int             ImfHeaderSetBox2iAttribute (ImfHeader *hdr,
 
235
                        const char name[],
 
236
                        int xMin, int yMin,
 
237
                        int xMax, int yMax);
 
238
 
 
239
int             ImfHeaderBox2iAttribute (const ImfHeader *hdr,
 
240
                     const char name[],
 
241
                     int *xMin, int *yMin,
 
242
                     int *xMax, int *yMax);
 
243
 
 
244
int             ImfHeaderSetBox2fAttribute (ImfHeader *hdr,
 
245
                        const char name[],
 
246
                        float xMin, float yMin,
 
247
                        float xMax, float yMax);
 
248
 
 
249
int             ImfHeaderBox2fAttribute (const ImfHeader *hdr,
 
250
                     const char name[],
 
251
                     float *xMin, float *yMin,
 
252
                     float *xMax, float *yMax);
 
253
 
 
254
int             ImfHeaderSetV2iAttribute (ImfHeader *hdr,
 
255
                         const char name[],
 
256
                         int x, int y);
 
257
 
 
258
int             ImfHeaderV2iAttribute (const ImfHeader *hdr,
 
259
                       const char name[],
 
260
                       int *x, int *y);
 
261
 
 
262
int             ImfHeaderSetV2fAttribute (ImfHeader *hdr,
 
263
                          const char name[],
 
264
                          float x, float y);
 
265
 
 
266
int             ImfHeaderV2fAttribute (const ImfHeader *hdr,
 
267
                       const char name[],
 
268
                       float *x, float *y);
 
269
 
 
270
int             ImfHeaderSetV3iAttribute (ImfHeader *hdr,
 
271
                          const char name[],
 
272
                          int x, int y, int z);
 
273
 
 
274
int             ImfHeaderV3iAttribute (const ImfHeader *hdr,
 
275
                       const char name[],
 
276
                       int *x, int *y, int *z);
 
277
 
 
278
int             ImfHeaderSetV3fAttribute (ImfHeader *hdr,
 
279
                          const char name[],
 
280
                          float x, float y, float z);
 
281
 
 
282
int             ImfHeaderV3fAttribute (const ImfHeader *hdr,
 
283
                       const char name[],
 
284
                       float *x, float *y, float *z);
 
285
 
 
286
int             ImfHeaderSetM33fAttribute (ImfHeader *hdr,
 
287
                       const char name[],
 
288
                       const float m[3][3]);
 
289
 
 
290
int             ImfHeaderM33fAttribute (const ImfHeader *hdr,
 
291
                    const char name[],
 
292
                    float m[3][3]);
 
293
 
 
294
int             ImfHeaderSetM44fAttribute (ImfHeader *hdr,
 
295
                       const char name[],
 
296
                       const float m[4][4]);
 
297
 
 
298
int             ImfHeaderM44fAttribute (const ImfHeader *hdr,
 
299
                    const char name[],
 
300
                    float m[4][4]);
 
301
 
 
302
/*
 
303
** RGBA output file
 
304
*/
 
305
 
 
306
struct ImfOutputFile;
 
307
typedef struct ImfOutputFile ImfOutputFile;
 
308
 
 
309
ImfOutputFile * ImfOpenOutputFile (const char name[],
 
310
                   const ImfHeader *hdr,
 
311
                   int channels);
 
312
 
 
313
int                     ImfCloseOutputFile (ImfOutputFile *out);
 
314
 
 
315
int                     ImfOutputSetFrameBuffer (ImfOutputFile *out,
 
316
                         const ImfRgba *base,
 
317
                         size_t xStride,
 
318
                         size_t yStride);
 
319
 
 
320
int                     ImfOutputWritePixels (ImfOutputFile *out,
 
321
                          int numScanLines);
 
322
 
 
323
int                     ImfOutputCurrentScanLine (const ImfOutputFile *out);
 
324
 
 
325
const ImfHeader *       ImfOutputHeader (const ImfOutputFile *out);
 
326
 
 
327
int                     ImfOutputChannels (const ImfOutputFile *out);
 
328
 
 
329
 
 
330
/*
 
331
** Tiled RGBA output file
 
332
*/
 
333
 
 
334
struct ImfTiledOutputFile;
 
335
typedef struct ImfTiledOutputFile ImfTiledOutputFile;
 
336
 
 
337
ImfTiledOutputFile *    ImfOpenTiledOutputFile (const char name[],
 
338
                            const ImfHeader *hdr,
 
339
                        int channels,
 
340
                        int xSize, int ySize,
 
341
                        int mode, int rmode);
 
342
 
 
343
int             ImfCloseTiledOutputFile (ImfTiledOutputFile *out);
 
344
 
 
345
int             ImfTiledOutputSetFrameBuffer (ImfTiledOutputFile *out,
 
346
                          const ImfRgba *base,
 
347
                          size_t xStride,
 
348
                          size_t yStride);
 
349
 
 
350
int             ImfTiledOutputWriteTile (ImfTiledOutputFile *out,
 
351
                     int dx, int dy,
 
352
                     int lx, int ly);
 
353
 
 
354
int             ImfTiledOutputWriteTiles (ImfTiledOutputFile *out,
 
355
                                          int dxMin, int dxMax,
 
356
                                          int dyMin, int dyMax,
 
357
                                          int lx, int ly);
 
358
 
 
359
const ImfHeader *       ImfTiledOutputHeader (const ImfTiledOutputFile *out);
 
360
 
 
361
int             ImfTiledOutputChannels (const ImfTiledOutputFile *out);
 
362
 
 
363
int             ImfTiledOutputTileXSize (const ImfTiledOutputFile *out);
 
364
 
 
365
int             ImfTiledOutputTileYSize (const ImfTiledOutputFile *out);
 
366
 
 
367
int             ImfTiledOutputLevelMode (const ImfTiledOutputFile *out);
 
368
int             ImfTiledOutputLevelRoundingMode
 
369
                        (const ImfTiledOutputFile *out);
 
370
 
 
371
 
 
372
/*
 
373
** RGBA input file
 
374
*/
 
375
 
 
376
struct ImfInputFile;
 
377
typedef struct ImfInputFile ImfInputFile;
 
378
 
 
379
ImfInputFile *          ImfOpenInputFile (const char name[]);
 
380
 
 
381
int                     ImfCloseInputFile (ImfInputFile *in);
 
382
 
 
383
int                     ImfInputSetFrameBuffer (ImfInputFile *in,
 
384
                        ImfRgba *base,
 
385
                        size_t xStride,
 
386
                        size_t yStride);
 
387
 
 
388
int                     ImfInputReadPixels (ImfInputFile *in,
 
389
                        int scanLine1,
 
390
                        int scanLine2);
 
391
 
 
392
const ImfHeader *       ImfInputHeader (const ImfInputFile *in);
 
393
 
 
394
int                     ImfInputChannels (const ImfInputFile *in);
 
395
 
 
396
const char *            ImfInputFileName (const ImfInputFile *in);
 
397
 
 
398
 
 
399
/*
 
400
** Tiled RGBA input file
 
401
*/
 
402
 
 
403
struct ImfTiledInputFile;
 
404
typedef struct ImfTiledInputFile ImfTiledInputFile;
 
405
 
 
406
ImfTiledInputFile *     ImfOpenTiledInputFile (const char name[]);
 
407
 
 
408
int             ImfCloseTiledInputFile (ImfTiledInputFile *in);
 
409
 
 
410
int             ImfTiledInputSetFrameBuffer (ImfTiledInputFile *in,
 
411
                         ImfRgba *base,
 
412
                         size_t xStride,
 
413
                         size_t yStride);
 
414
 
 
415
int             ImfTiledInputReadTile (ImfTiledInputFile *in,
 
416
                       int dx, int dy,
 
417
                       int lx, int ly);
 
418
 
 
419
int             ImfTiledInputReadTiles (ImfTiledInputFile *in,
 
420
                                        int dxMin, int dxMax,
 
421
                                        int dyMin, int dyMax,
 
422
                                        int lx, int ly);
 
423
 
 
424
const ImfHeader *       ImfTiledInputHeader (const ImfTiledInputFile *in);
 
425
 
 
426
int             ImfTiledInputChannels (const ImfTiledInputFile *in);
 
427
 
 
428
const char *            ImfTiledInputFileName (const ImfTiledInputFile *in);
 
429
 
 
430
int             ImfTiledInputTileXSize (const ImfTiledInputFile *in);
 
431
 
 
432
int             ImfTiledInputTileYSize (const ImfTiledInputFile *in);
 
433
 
 
434
int             ImfTiledInputLevelMode (const ImfTiledInputFile *in);
 
435
 
 
436
int             ImfTiledInputLevelRoundingMode
 
437
                           (const ImfTiledInputFile *in);
 
438
 
 
439
/*
 
440
** Lookup tables
 
441
*/
 
442
 
 
443
struct ImfLut;
 
444
typedef struct ImfLut ImfLut;
 
445
 
 
446
ImfLut *                ImfNewRound12logLut (int channels);
 
447
 
 
448
ImfLut *                ImfNewRoundNBitLut (unsigned int n, int channels);
 
449
 
 
450
void                    ImfDeleteLut (ImfLut *lut);
 
451
 
 
452
void                    ImfApplyLut (ImfLut *lut,
 
453
                     ImfRgba *data,
 
454
                     int nData,
 
455
                     int stride);
 
456
/*
 
457
** Most recent error message
 
458
*/
 
459
 
 
460
const char *            ImfErrorMessage (void);
 
461
 
 
462
 
 
463
#ifdef __cplusplus
 
464
} /* extern "C" */
 
465
#endif
 
466
 
 
467
#endif