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

Function createTestBoards

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

Source from the content-addressed store, hash-verified

280 }
281
282 void createTestBoards(const char* pattern)
283 {
284 const int2 margin(3, 2);
285 int maxIndex = std::pow(SCREEN_COLOR_DIMENSION, 3);
286 int boardIndex = 0;
287 Image<ColorRgb> image(1920, 1080);
288 const int2 delta(image.width() / SCREEN_BLOCKS_X, image.height() / SCREEN_BLOCKS_Y);
289
290 auto saveImage = [](Image<ColorRgb>& image, const int2& delta, int boardIndex, const char* pattern, int2 margin)
291 {
292 for (int line = 0; line < SCREEN_BLOCKS_Y; line += SCREEN_BLOCKS_Y - 1)
293 {
294 int2 position = int2((line + boardIndex) % 2, line);
295
296 for (int x = 0; x < boardIndex + SCREEN_CRC_COUNT; x++, position.x += 2)
297 {
298 const int2 start = position * delta;
299 const int2 end = ((position + int2(1, 1)) * delta) - int2(1, 1);
300 image.fastBox(start.x + margin.x, start.y + margin.y, end.x - margin.x, end.y - margin.y, 255, 255, 255);
301 }
302 }
303 utils_image::savePng(QString(pattern).arg(QString::number(boardIndex)).toStdString(), image);
304 };
305
306
307 image.clear();
308
309 if (256 % SCREEN_COLOR_STEP > 0 || image.width() % SCREEN_BLOCKS_X || image.height() % SCREEN_BLOCKS_Y)
310 return;
311
312 for (int index = 0; index < maxIndex; index++)
313 {
314 byte3 color;
315 int2 position;
316 int currentBoard = indexToColorAndPos(index, color, position);
317
318 if (currentBoard < 0)
319 return;
320
321 if (boardIndex != currentBoard)
322 {
323 saveImage(image, delta, boardIndex, pattern, margin);
324 image.clear();
325 boardIndex = currentBoard;
326 }
327
328 const int2 start = position * delta;
329 const int2 end = ((position + int2(1, 1)) * delta) - int2(1, 1);
330
331 image.fastBox(start.x + margin.x, start.y + margin.y, end.x - margin.x, end.y - margin.y, color.x, color.y, color.z);
332 }
333 saveImage(image, delta, boardIndex, pattern, margin);
334 }
335
336 bool verifyTestBoards(Logger* _log, const char* pattern)
337 {

Callers

nothing calls this directly

Calls 7

int2Class · 0.85
saveImageFunction · 0.85
indexToColorAndPosFunction · 0.70
widthMethod · 0.45
heightMethod · 0.45
fastBoxMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected