MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / indexToColorAndPos

Function indexToColorAndPos

sources/lut-calibrator/BoardUtils.cpp:48–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46{
47
48 int indexToColorAndPos(int index, byte3& color, int2& position)
49 {
50 int currentIndex = index % SCREEN_SAMPLES_PER_BOARD;
51 int boardIndex = index / SCREEN_SAMPLES_PER_BOARD;
52
53 position = int2(0, 1);
54 position.y += currentIndex / (SCREEN_BLOCKS_X / 2);
55 position.x += (currentIndex % (SCREEN_BLOCKS_X / 2)) * 2 + ((position.y + boardIndex )% 2);
56
57 int B = (index % SCREEN_COLOR_DIMENSION) * SCREEN_COLOR_STEP;
58 int G = ((index / (SCREEN_COLOR_DIMENSION)) % SCREEN_COLOR_DIMENSION) * SCREEN_COLOR_STEP;
59 int R = (index / (SCREEN_COLOR_DIMENSION * SCREEN_COLOR_DIMENSION)) * SCREEN_COLOR_STEP;
60
61 color.x = std::min(R, 255);
62 color.y = std::min(G, 255);
63 color.z = std::min(B, 255);
64
65 return boardIndex;
66 }
67
68 CapturedColor readBlock(const Image<ColorRgb>& yuvImage, int2 position, byte3* _color)
69 {

Callers 2

parseBoardFunction · 0.70
createTestBoardsFunction · 0.70

Calls 1

int2Class · 0.85

Tested by

no test coverage detected