Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/python3.12/ImagingUtils.h
$ cat -n /usr/include/python3.12/ImagingUtils.h 1 #ifdef WORDS_BIGENDIAN 2 #define MAKE_UINT32(u0, u1, u2, u3) \ 3 ((UINT32)(u3) | ((UINT32)(u2) << 8) | ((UINT32)(u1) << 16) | ((UINT32)(u0) << 24)) 4 #define MASK_UINT32_CHANNEL_0 0xff000000 5 #define MASK_UINT32_CHANNEL_1 0x00ff0000 6 #define MASK_UINT32_CHANNEL_2 0x0000ff00 7 #define MASK_UINT32_CHANNEL_3 0x000000ff 8 #else 9 #define MAKE_UINT32(u0, u1, u2, u3) \ 10 ((UINT32)(u0) | ((UINT32)(u1) << 8) | ((UINT32)(u2) << 16) | ((UINT32)(u3) << 24)) 11 #define MASK_UINT32_CHANNEL_0 0x000000ff 12 #define MASK_UINT32_CHANNEL_1 0x0000ff00 13 #define MASK_UINT32_CHANNEL_2 0x00ff0000 14 #define MASK_UINT32_CHANNEL_3 0xff000000 15 #endif 16 17 #define SHIFTFORDIV255(a) ((((a) >> 8) + a) >> 8) 18 19 /* like (a * b + 127) / 255), but much faster on most platforms */ 20 #define MULDIV255(a, b, tmp) (tmp = (a) * (b) + 128, SHIFTFORDIV255(tmp)) 21 22 #define DIV255(a, tmp) (tmp = (a) + 128, SHIFTFORDIV255(tmp)) 23 24 #define BLEND(mask, in1, in2, tmp1) DIV255(in1 *(255 - mask) + in2 * mask, tmp1) 25 26 #define PREBLEND(mask, in1, in2, tmp1) (MULDIV255(in1, (255 - mask), tmp1) + in2) 27 28 #define CLIP8(v) ((v) <= 0 ? 0 : (v) < 256 ? (v) : 255) 29 30 /* This is to work around a bug in GCC prior 4.9 in 64 bit mode. 31 GCC generates code with partial dependency which is 3 times slower. 32 See: https://stackoverflow.com/a/26588074/253146 */ 33 #if defined(__x86_64__) && defined(__SSE__) && !defined(__NO_INLINE__) && \ 34 !defined(__clang__) && defined(GCC_VERSION) && (GCC_VERSION < 40900) 35 static float __attribute__((always_inline)) inline _i2f(int v) { 36 float x; 37 __asm__("xorps %0, %0; cvtsi2ss %1, %0" : "=x"(x) : "r"(v)); 38 return x; 39 } 40 #else 41 static float inline _i2f(int v) { return (float)v; } 42 #endif
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™