Lines Matching defs:runHistory

75 static int finderPenaltyCountPatterns(const int runHistory[7], int qrsize);
76 static int finderPenaltyTerminateAndCount(bool currentRunColor, int currentRunLength, int runHistory[7], int qrsize);
77 static void finderPenaltyAddHistory(int currentRunLength, int runHistory[7], int qrsize);
644 int runHistory[7] = {0};
653 finderPenaltyAddHistory(runX, runHistory, qrsize);
655 result += finderPenaltyCountPatterns(runHistory, qrsize) * PENALTY_N3;
660 result += finderPenaltyTerminateAndCount(runColor, runX, runHistory, qrsize) * PENALTY_N3;
666 int runHistory[7] = {0};
675 finderPenaltyAddHistory(runY, runHistory, qrsize);
677 result += finderPenaltyCountPatterns(runHistory, qrsize) * PENALTY_N3;
682 result += finderPenaltyTerminateAndCount(runColor, runY, runHistory, qrsize) * PENALTY_N3;
716 static int finderPenaltyCountPatterns(const int runHistory[7], int qrsize) {
717 int n = runHistory[1];
719 bool core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
722 return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0)
723 + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
728 static int finderPenaltyTerminateAndCount(bool currentRunColor, int currentRunLength, int runHistory[7], int qrsize) {
730 finderPenaltyAddHistory(currentRunLength, runHistory, qrsize);
734 finderPenaltyAddHistory(currentRunLength, runHistory, qrsize);
735 return finderPenaltyCountPatterns(runHistory, qrsize);
740 static void finderPenaltyAddHistory(int currentRunLength, int runHistory[7], int qrsize) {
741 if (runHistory[0] == 0)
743 memmove(&runHistory[1], &runHistory[0], 6 * sizeof(runHistory[0]));
744 runHistory[0] = currentRunLength;