| 133 | } |
| 134 | |
| 135 | int readCrc(const Image<ColorRgb>& yuvImage, int line, CapturedColor& white) |
| 136 | { |
| 137 | int boardIndex = 0; |
| 138 | int x = 0; |
| 139 | |
| 140 | for (int i = 0; i < SCREEN_CRC_COUNT; i++, x += 2) |
| 141 | { |
| 142 | auto test = readBlock(yuvImage, int2(x, line)); |
| 143 | if (test.Y() + SCREEN_MAX_CRC_BRIGHTNESS_ERROR < white.Y()) |
| 144 | throw std::runtime_error("Invalid CRC header"); |
| 145 | } |
| 146 | |
| 147 | while (true && x < SCREEN_BLOCKS_X) |
| 148 | { |
| 149 | auto test = readBlock(yuvImage, int2(x, line)); |
| 150 | if (test.Y() + SCREEN_MAX_CRC_BRIGHTNESS_ERROR < white.Y()) |
| 151 | break; |
| 152 | boardIndex++; |
| 153 | x += 2; |
| 154 | } |
| 155 | |
| 156 | return boardIndex; |
| 157 | } |
| 158 | |
| 159 | bool parseBoard(Logger* _log, const Image<ColorRgb>& yuvImage, int& boardIndex, CapturedColors& allColors, bool multiFrame) |
| 160 | { |
no test coverage detected