File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
// Note: libdpx originally from: https://github.com/PatrickPalmer/dpx
12
12
// But that seems not to be actively maintained.
13
+ //
14
+ // Nevertheless, because the contents of the libdpx subdirectory is "imported"
15
+ // code, we have always strived to keep our copy as textually close to the
16
+ // original as possible, to enable us to diff it against the original and keep
17
+ // up with any changes (if there ever are any). So we exclude this file from
18
+ // clang-format and try to keep changes as minimal as possible.
19
+ //
20
+ // At some point, we may want to consider just accepting that we forked long
21
+ // ago and are probably the sole maintainers of this code, and just allow
22
+ // ourselves to diverge from the original.
23
+
13
24
#include " libdpx/DPX.h"
14
25
#include " libdpx/DPXColorConverter.h"
15
26
#include " libdpx/DPXHeader.h"
Original file line number Diff line number Diff line change 36
36
#ifndef _DPX_ENDIANSWAP_H
37
37
#define _DPX_ENDIANSWAP_H 1
38
38
39
+ #include < OpenImageIO/fmath.h>
40
+
41
+ #define USE_OIIO_BYTESWAP 1
42
+
39
43
40
44
namespace dpx
41
45
{
42
46
47
+ #if USE_OIIO_BYTESWAP
48
+
49
+ template <typename T>
50
+ inline T
51
+ SwapBytes (T& value)
52
+ {
53
+ return value = OIIO::byteswap (value);
54
+ }
55
+
56
+ template <typename T>
57
+ void
58
+ SwapBuffer (T* buf, unsigned int len)
59
+ {
60
+ OIIO::byteswap_span (OIIO::span<T>(buf, len));
61
+ }
62
+
63
+ #else
64
+
43
65
template <typename T>
44
66
T SwapBytes (T& value)
45
67
{
@@ -92,6 +114,8 @@ void SwapBuffer(T *buf, unsigned int len)
92
114
SwapBytes (buf[i]);
93
115
}
94
116
117
+ #endif
118
+
95
119
96
120
template <DataSize SIZE>
97
121
void EndianSwapImageBuffer (void *data, int length)
You can’t perform that action at this time.
0 commit comments