File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414#include < memory>
1515
16- #ifndef USE_BIG_ENDIAN_IN_ICC
17- #define USE_BIG_ENDIAN_IN_ICC true
18- #endif
16+ #include " ultrahdr/jpegr.h "
17+ #include " ultrahdr/gainmapmath.h "
18+ #include " ultrahdr/jpegrutils.h "
1919
2020#undef Endian_SwapBE32
2121#undef Endian_SwapBE16
22- #if USE_BIG_ENDIAN_IN_ICC
23- #define Endian_SwapBE32 (n ) EndianSwap32(n)
24- #define Endian_SwapBE16 (n ) EndianSwap16(n)
25- #else
22+
23+ #if UHDR_HOST_BIG_ENDIAN == true
2624#define Endian_SwapBE32 (n ) (n)
2725#define Endian_SwapBE16 (n ) (n)
26+ #else
27+ #define Endian_SwapBE32 (n ) EndianSwap32(n)
28+ #define Endian_SwapBE16 (n ) EndianSwap16(n)
2829#endif
2930
30- #include " ultrahdr/jpegr.h"
31- #include " ultrahdr/gainmapmath.h"
32- #include " ultrahdr/jpegrutils.h"
33-
3431namespace ultrahdr {
3532
3633typedef int32_t Fixed;
Original file line number Diff line number Diff line change 1313
1414#include " ultrahdr/jpegr.h"
1515
16+ #if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
17+ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
18+ defined (_WIN32) || defined(_WIN64)
19+ #define UHDR_HOST_BIG_ENDIAN false
20+ #elif (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
21+ __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
22+ defined (__BIG_ENDIAN__)
23+ #define UHDR_HOST_BIG_ENDIAN true
24+ #else
25+ #error "Unable to detect endianness."
26+ #endif
27+
1628// TODO (dichenzhang): This is old version metadata, new version can be found in
1729// https://drive.google.com/file/d/1yUGmjGytRuBa2vpr9eM5Uu8CVhyyddjp/view?resourcekey=0-HGzFrzPQzu5FNYLRAJXQBA
1830// and in gainmapmetadata.h/.cpp
Original file line number Diff line number Diff line change 1313
1414#include < memory>
1515
16+ #include " ultrahdr/jpegr.h"
17+ #include " ultrahdr/gainmapmath.h"
18+ #include " ultrahdr/jpegrutils.h"
19+
1620#ifndef USE_BIG_ENDIAN_IN_MPF
1721#define USE_BIG_ENDIAN_IN_MPF true
1822#endif
1923
2024#undef Endian_SwapBE32
2125#undef Endian_SwapBE16
22- #if USE_BIG_ENDIAN_IN_MPF
23- #define Endian_SwapBE32 (n ) EndianSwap32(n)
24- #define Endian_SwapBE16 (n ) EndianSwap16(n)
25- #else
26+
27+ #if (USE_BIG_ENDIAN_IN_MPF == UHDR_HOST_BIG_ENDIAN)
2628#define Endian_SwapBE32 (n ) (n)
2729#define Endian_SwapBE16 (n ) (n)
30+ #else
31+ #define Endian_SwapBE32 (n ) EndianSwap32(n)
32+ #define Endian_SwapBE16 (n ) EndianSwap16(n)
2833#endif
2934
30- #include " ultrahdr/jpegr.h"
31- #include " ultrahdr/gainmapmath.h"
32- #include " ultrahdr/jpegrutils.h"
33-
3435namespace ultrahdr {
3536
3637constexpr size_t kNumPictures = 2 ;
You can’t perform that action at this time.
0 commit comments