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 // Conversion from half or float to unsigned int:
28 //
29 // input result
30 // ---------------------------------------------------
31 //
32 // finite, >= 0 input, cast to unsigned int
33 // (rounds towards zero)
34 //
35 // finite, < 0 0
36 //
37 // NaN 0
38 //
39 // +infinity UINT_MAX
40 //
41 // -infinity 0
42 //
43 //---------------------------------------------------------
44 
45 IMF_EXPORT unsigned int halfToUint (half h);
46 IMF_EXPORT unsigned int floatToUint (float f);
47 
48 //---------------------------------------------------------
49 // Conversion from unsigned int or float to half:
50 //
51 // input result
52 // ---------------------------------------------------
53 //
54 // finite, closest possible half
55 // magnitude <= HALF_MAX
56 //
57 // finite, > HALF_MAX +infinity
58 //
59 // finite, < -HALF_MAX -infinity
60 //
61 // NaN NaN
62 //
63 // +infinity +infinity
64 //
65 // -infinity -infinity
66 //
67 //---------------------------------------------------------
68 
69 IMF_EXPORT half uintToHalf (unsigned int ui);
71 
73 
74 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
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:80
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)