HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfConvert.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_CONVERT_H
7 #define INCLUDED_IMF_CONVERT_H
8 
9 //-----------------------------------------------------------------------------
10 //
11 // Routines for converting between pixel data types,
12 // with well-defined behavior for exceptional cases,
13 // without depending on how hardware and operating
14 // system handle integer overflows and floating-point
15 // exceptions.
16 //
17 //-----------------------------------------------------------------------------
18 
19 #include "ImfExport.h"
20 #include "ImfNamespace.h"
21 
22 #include <half.h>
23 
25 
26 
27 //---------------------------------------------------------
28 // Conversion from half or float to unsigned int:
29 //
30 // input result
31 // ---------------------------------------------------
32 //
33 // finite, >= 0 input, cast to unsigned int
34 // (rounds towards zero)
35 //
36 // finite, < 0 0
37 //
38 // NaN 0
39 //
40 // +infinity UINT_MAX
41 //
42 // -infinity 0
43 //
44 //---------------------------------------------------------
45 
46 IMF_EXPORT unsigned int halfToUint (half h);
47 IMF_EXPORT unsigned int floatToUint (float f);
48 
49 
50 //---------------------------------------------------------
51 // Conversion from unsigned int or float to half:
52 //
53 // input result
54 // ---------------------------------------------------
55 //
56 // finite, closest possible half
57 // magnitude <= HALF_MAX
58 //
59 // finite, > HALF_MAX +infinity
60 //
61 // finite, < -HALF_MAX -infinity
62 //
63 // NaN NaN
64 //
65 // +infinity +infinity
66 //
67 // -infinity -infinity
68 //
69 //---------------------------------------------------------
70 
71 IMF_EXPORT half uintToHalf (unsigned int ui);
73 
74 
76 
77 
78 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:80
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition: half.h:266
GLfloat f
Definition: glcorearb.h:1926
#define IMF_EXPORT
Definition: ImfExport.h:54
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
IMF_EXPORT half uintToHalf(unsigned int ui)
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:79
IMF_EXPORT unsigned int floatToUint(float f)
IMF_EXPORT half floatToHalf(float f)
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER IMF_EXPORT unsigned int halfToUint(half h)