| 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 | { |
no test coverage detected