MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / bitmapFromData

Function bitmapFromData

third-party/tinyexr/tinyexr.h:3024–3044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3022const int BITMAP_SIZE = (USHORT_RANGE >> 3);
3023
3024static void bitmapFromData(const unsigned short data[/*nData*/], int nData,
3025 unsigned char bitmap[BITMAP_SIZE],
3026 unsigned short &minNonZero,
3027 unsigned short &maxNonZero) {
3028 for (int i = 0; i < BITMAP_SIZE; ++i) bitmap[i] = 0;
3029
3030 for (int i = 0; i < nData; ++i) bitmap[data[i] >> 3] |= (1 << (data[i] & 7));
3031
3032 bitmap[0] &= ~1; // zero is not explicitly stored in
3033 // the bitmap; we assume that the
3034 // data always contain zeroes
3035 minNonZero = BITMAP_SIZE - 1;
3036 maxNonZero = 0;
3037
3038 for (int i = 0; i < BITMAP_SIZE; ++i) {
3039 if (bitmap[i]) {
3040 if (minNonZero > i) minNonZero = i;
3041 if (maxNonZero < i) maxNonZero = i;
3042 }
3043 }
3044}
3045
3046static unsigned short forwardLutFromBitmap(
3047 const unsigned char bitmap[BITMAP_SIZE], unsigned short lut[USHORT_RANGE]) {

Callers 1

CompressPizFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected