@@ -452,15 +452,15 @@ void InfiniteProcessing::calibrateColorInColorspace(const std::shared_ptr<const
452452 const size_t i011 = b0 + g1 * LUT_DIMENSION + r1 * LUT_DIMENSION * LUT_DIMENSION;
453453 const size_t i111 = b1 + g1 * LUT_DIMENSION + r1 * LUT_DIMENSION * LUT_DIMENSION;
454454
455- auto c00 = linalg::lerp (calibrationSnapshot->lut [i000], calibrationSnapshot->lut [i100], r_frac );
456- auto c10 = linalg::lerp (calibrationSnapshot->lut [i010], calibrationSnapshot->lut [i110], r_frac );
457- auto c01 = linalg::lerp (calibrationSnapshot->lut [i001], calibrationSnapshot->lut [i101], r_frac );
458- auto c11 = linalg::lerp (calibrationSnapshot->lut [i011], calibrationSnapshot->lut [i111], r_frac );
455+ auto c00 = linalg::lerp (calibrationSnapshot->lut [i000], calibrationSnapshot->lut [i100], b_frac );
456+ auto c10 = linalg::lerp (calibrationSnapshot->lut [i010], calibrationSnapshot->lut [i110], b_frac );
457+ auto c01 = linalg::lerp (calibrationSnapshot->lut [i001], calibrationSnapshot->lut [i101], b_frac );
458+ auto c11 = linalg::lerp (calibrationSnapshot->lut [i011], calibrationSnapshot->lut [i111], b_frac );
459459
460460 auto c0 = linalg::lerp (c00, c10, g_frac);
461461 auto c1 = linalg::lerp (c01, c11, g_frac);
462462
463- color = clamp (linalg::lerp (c0, c1, b_frac ), 0 .0f , 1 .0f );
463+ color = clamp (linalg::lerp (c0, c1, r_frac ), 0 .0f , 1 .0f );
464464 return ;
465465 }
466466 }
@@ -850,23 +850,48 @@ void InfiniteProcessing::test()
850850 { 1 .0f , 0 .760f , 1 .0f }
851851 );
852852
853+
854+ ColorRgb target_black = { 10 , 20 , 15 };
855+ ColorRgb target_white = { 240 , 235 , 245 };
856+ ColorRgb target_red = { 220 , 50 , 60 };
857+ ColorRgb target_green = { 60 , 210 , 50 };
858+ ColorRgb target_blue = { 50 , 60 , 220 };
859+ ColorRgb target_cyan = { 50 , 220 , 215 };
860+ ColorRgb target_magenta = { 220 , 60 , 220 };
861+ ColorRgb target_yellow = { 220 , 210 , 60 };
862+
863+ std::list<std::pair<linalg::vec<float , 3 >, linalg::vec<float , 3 >>> testPoints = {
864+ std::make_pair (linalg::vec<float ,3 >{0 .0f , 0 .0f , 0 .0f }, linalg::vec<float ,3 >{0 .0392156862745098f , 0 .0784313725490196f , 0 .058823529411764705f }),
865+ std::make_pair (linalg::vec<float ,3 >{1 .0f , 0 .0f , 0 .0f }, linalg::vec<float ,3 >{0 .8627450980392157f , 0 .19607843137254902f , 0 .23529411764705882f }),
866+ std::make_pair (linalg::vec<float ,3 >{0 .0f , 1 .0f , 0 .0f }, linalg::vec<float ,3 >{0 .23529411764705882f , 0 .8235294117647058f , 0 .19607843137254904f }),
867+ std::make_pair (linalg::vec<float ,3 >{0 .0f , 0 .0f , 1 .0f }, linalg::vec<float ,3 >{0 .19607843137254902f , 0 .23529411764705882f , 0 .8627450980392157f }),
868+ std::make_pair (linalg::vec<float ,3 >{0 .0f , 1 .0f , 1 .0f }, linalg::vec<float ,3 >{0 .19607843137254902f , 0 .8627450980392157f , 0 .8431372549019607f }),
869+ std::make_pair (linalg::vec<float ,3 >{1 .0f , 0 .0f , 1 .0f }, linalg::vec<float ,3 >{0 .8627450980392157f , 0 .23529411764705882f , 0 .8627450980392157f }),
870+ std::make_pair (linalg::vec<float ,3 >{1 .0f , 1 .0f , 0 .0f }, linalg::vec<float ,3 >{0 .8627450980392157f , 0 .8235294117647058f , 0 .23529411764705882f }),
871+ std::make_pair (linalg::vec<float ,3 >{1 .0f , 1 .0f , 1 .0f }, linalg::vec<float ,3 >{0 .9411764705882353f , 0 .9215686274509804f , 0 .9607843137254903f }),
872+ std::make_pair (linalg::vec<float ,3 >{0 .3f , 0 .3f , 0 .3f }, linalg::vec<float ,3 >{0 .35015686274509805f , 0 .3573137254901961f , 0 .35864705882352943f }),
873+ std::make_pair (linalg::vec<float ,3 >{0 .7f , 0 .7f , 0 .7f }, linalg::vec<float ,3 >{0 .6878823529411764f , 0 .6797450980392157f , 0 .6980196078431372f }),
874+ std::make_pair (linalg::vec<float ,3 >{0 .1f , 0 .4f , 0 .8f }, linalg::vec<float ,3 >{0 .25113725490196076f , 0 .4676078431372549f , 0 .7128627450980393f }),
875+ std::make_pair (linalg::vec<float ,3 >{0 .8f , 0 .4f , 0 .1f }, linalg::vec<float ,3 >{0 .7178039215686275f , 0 .44015686274509797f , 0 .27913725490196073f }),
876+ std::make_pair (linalg::vec<float ,3 >{0 .4f , 0 .2f , 0 .7f }, linalg::vec<float ,3 >{0 .4459607843137255f , 0 .33537254901960784f , 0 .6515294117647058f }),
877+ std::make_pair (linalg::vec<float ,3 >{0 .4f , 0 .7f , 0 .2f }, linalg::vec<float ,3 >{0 .45772549019607844f , 0 .6294901960784313f , 0 .32603921568627453f }),
878+ std::make_pair (linalg::vec<float ,3 >{0 .2f , 0 .6f , 0 .4f }, linalg::vec<float ,3 >{0 .3143529411764706f , 0 .5684705882352942f , 0 .4420392156862745f }),
879+ std::make_pair (linalg::vec<float ,3 >{0 .6f , 0 .3f , 0 .9f }, linalg::vec<float ,3 >{0 .6048627450980392f , 0 .42584313725490197f , 0 .8083529411764706f })
880+ };
853881
854- run_test (" Pipeline - Niezalezna Weryfikacja LUT" , { 0 .5f , 0 .5f , 0 .5f },
855- [](auto & p) {
856- p.generateColorspace (false ,
857- { 240 , 50 , 30 }, // target_red
858- { 10 , 250 , 11 }, // target_green
859- { 23 , 45 , 255 }, // target_blue
860- { 0 ,255 ,255 },
861- { 255 ,0 ,255 },
862- { 250 , 240 , 0 }, // target_yellow
863- { 255 ,255 ,255 },
864- { 1 , 2 , 2 } // target_black
865- );
866- },
867- run_full_pipeline,
868- { 0 .511f , 0 .549f , 0 .526f }
869- );
882+ for (const auto & t : testPoints)
883+ {
884+ run_test (" Pipeline - Niezalezna Weryfikacja Kalibracji RGBCMYK" , t.first ,
885+ [=](auto & p) {
886+ p.generateColorspace (false ,
887+ target_red, target_green, target_blue,
888+ target_cyan, target_magenta, target_yellow,
889+ target_white, target_black);
890+ },
891+ [](auto & p, auto c) { p.calibrateColorInColorspace (p.getColorspaceCalibrationSnapshot (), c); return c; },
892+ t.second
893+ );
894+ }
870895
871896 std::cout << " ========================================\n " ;
872897 std::cout << " Koniec testów\n " ;
0 commit comments