|
@@ -419,135 +419,154 @@ void lct_coordcal_sel_minimum_value(flt32 *pfDelayDeviationSumMatrix, uint16 wMa
|
|
|
LCT_MINIMUM_VALUE_T astMinmumValueList[128] = {0};
|
|
|
uint8 byMinimumValueNum = (uint8)gg_stLctCoordcalParam.dwMinimumValueNum;
|
|
|
|
|
|
-
|
|
|
- for (uint16 wRow = 0; wRow < wMatrixRow; wRow++)
|
|
|
+ uint8 byWhildFlag = 1;
|
|
|
+ int8 byValidThres = 5;
|
|
|
+
|
|
|
+ do
|
|
|
{
|
|
|
- for (uint16 wCol = 0; wCol < wMatrixCol; wCol++)
|
|
|
+
|
|
|
+ if (byValidThres < 3)
|
|
|
{
|
|
|
- wIndex = wRow * wMatrixCol + wCol;
|
|
|
- fDeviation = pfDelayDeviationSumMatrix[wIndex];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ byValidThres--;
|
|
|
|
|
|
-
|
|
|
- byValidFlag = 1;
|
|
|
- for (uint8 i = 0; i < 1; i++)
|
|
|
+
|
|
|
+ for (uint16 wRow = 0; wRow < wMatrixRow; wRow++)
|
|
|
+ {
|
|
|
+ for (uint16 wCol = 0; wCol < wMatrixCol; wCol++)
|
|
|
{
|
|
|
-
|
|
|
- if ((wCol + 1) < wMatrixCol)
|
|
|
+ wIndex = wRow * wMatrixCol + wCol;
|
|
|
+ fDeviation = pfDelayDeviationSumMatrix[wIndex];
|
|
|
+
|
|
|
+
|
|
|
+ byValidFlag = 0;
|
|
|
+ for (uint8 i = 0; i < 1; i++)
|
|
|
{
|
|
|
- wTmpIndex = wRow * wMatrixCol + wCol + 1;
|
|
|
- fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
- if (fDeviation >= fTmpDeviation)
|
|
|
- {
|
|
|
- byValidFlag = 0;
|
|
|
- break;
|
|
|
+
|
|
|
+ if ((wCol + 1) < wMatrixCol)
|
|
|
+ {
|
|
|
+ wTmpIndex = wRow * wMatrixCol + wCol + 1;
|
|
|
+ fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
+ if (fDeviation >= fTmpDeviation)
|
|
|
+ {
|
|
|
+ byValidFlag = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ byValidFlag++;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if ((wRow + 1) < wMatrixRow)
|
|
|
- {
|
|
|
- wTmpIndex = (wRow + 1) * wMatrixCol + wCol;
|
|
|
- fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
- if (fDeviation >= fTmpDeviation)
|
|
|
- {
|
|
|
- byValidFlag = 0;
|
|
|
- break;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ((wRow + 1) < wMatrixRow)
|
|
|
+ {
|
|
|
+ wTmpIndex = (wRow + 1) * wMatrixCol + wCol;
|
|
|
+ fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
+ if (fDeviation >= fTmpDeviation)
|
|
|
+ {
|
|
|
+ byValidFlag = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ byValidFlag++;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if ((wCol - 1) >= 0)
|
|
|
- {
|
|
|
- wTmpIndex = wRow * wMatrixCol + wCol - 1;
|
|
|
- fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
- if (fDeviation >= fTmpDeviation)
|
|
|
- {
|
|
|
- byValidFlag = 0;
|
|
|
- break;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ((wCol - 1) >= 0)
|
|
|
+ {
|
|
|
+ wTmpIndex = wRow * wMatrixCol + wCol - 1;
|
|
|
+ fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
+ if (fDeviation >= fTmpDeviation)
|
|
|
+ {
|
|
|
+ byValidFlag = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ byValidFlag++;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ((wRow - 1) >= 0)
|
|
|
+ {
|
|
|
+ wTmpIndex = (wRow - 1) * wMatrixCol + wCol;
|
|
|
+ fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
+ if (fDeviation >= fTmpDeviation)
|
|
|
+ {
|
|
|
+ byValidFlag = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ byValidFlag++;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if ((wRow - 1) >= 0)
|
|
|
+
|
|
|
+ if (byValidFlag == byValidThres)
|
|
|
{
|
|
|
- wTmpIndex = (wRow - 1) * wMatrixCol + wCol;
|
|
|
- fTmpDeviation = pfDelayDeviationSumMatrix[wTmpIndex];
|
|
|
- if (fDeviation >= fTmpDeviation)
|
|
|
- {
|
|
|
- byValidFlag = 0;
|
|
|
+ byWhildFlag = 0;
|
|
|
+ stMinimumValue.stCoord = pstRefPointMatrix[wIndex];
|
|
|
+ stMinimumValue.fDelayDeviationSum = fDeviation;
|
|
|
+ astMinmumValueList[wCounter] = stMinimumValue;
|
|
|
+
|
|
|
+ wCounter++;
|
|
|
+ if (wCounter >= 128)
|
|
|
+ {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if (byValidFlag)
|
|
|
+ if (wCounter >= 128)
|
|
|
{
|
|
|
- stMinimumValue.stCoord = pstRefPointMatrix[wIndex];
|
|
|
- stMinimumValue.fDelayDeviationSum = fDeviation;
|
|
|
- astMinmumValueList[wCounter] = stMinimumValue;
|
|
|
-
|
|
|
- wCounter++;
|
|
|
- if (wCounter >= 128)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
+ byWhildFlag = 0;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (wCounter >= 128)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ } while (byWhildFlag);
|
|
|
|
|
|
|
|
|
if (wCounter > 0)
|
|
@@ -702,7 +721,7 @@ void lct_coordcal_dbcheck_minimum_value(uint8 byFirstPathFlag, LCT_FIRSTPATH_T *
|
|
|
dwX = pstMiminumValueData->stCoord.dwX;
|
|
|
if (dwGapX < 350)
|
|
|
{
|
|
|
- dwX = util_distance_gen_rand_num((dwMaxValueX + dwMinValueX) / 2, 50);
|
|
|
+ dwX = util_distance_gen_rand_num((dwMaxValueX + dwMinValueX) / 2, dwGapX / 2);
|
|
|
}
|
|
|
else if (dwGapX >= 350 && dwGapX < 900)
|
|
|
{
|
|
@@ -718,7 +737,7 @@ void lct_coordcal_dbcheck_minimum_value(uint8 byFirstPathFlag, LCT_FIRSTPATH_T *
|
|
|
dwY = pstMiminumValueData->stCoord.dwY;
|
|
|
if (dwGapY < 350)
|
|
|
{
|
|
|
- dwY = util_distance_gen_rand_num((dwMaxValueY + dwMinValueY) / 2, 50);
|
|
|
+ dwY = util_distance_gen_rand_num((dwMaxValueY + dwMinValueY) / 2, dwGapY / 10);
|
|
|
}
|
|
|
else if (dwGapY >= 350 && dwGapY < 900)
|
|
|
{
|
|
@@ -731,7 +750,7 @@ void lct_coordcal_dbcheck_minimum_value(uint8 byFirstPathFlag, LCT_FIRSTPATH_T *
|
|
|
pstMiminumValueData->stCoord.dwY = dwY;
|
|
|
|
|
|
|
|
|
- if ((dwX >= dwMinValueX) && (dwX <= dwMaxValueX) && (dwY >= dwMinValueY) && (dwY <= dwMaxValueY))
|
|
|
+ if ((dwX >= (dwMinValueX - 300)) && (dwX <= (dwMaxValueX + 300)) && (dwY >= (dwMinValueY - 300)) && (dwY <= (dwMaxValueY + 300)))
|
|
|
{
|
|
|
if (byFirstPathFlag == CAL_PATH)
|
|
|
{
|
|
@@ -763,3 +782,90 @@ void lct_coordcal_dbcheck_minimum_value(uint8 byFirstPathFlag, LCT_FIRSTPATH_T *
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+void lct_coordcal_two_dimension_check(LCT_MINIMUM_VALUE_GROUP_T *pstMinmumValueGroup, COORD_T *pstPredictionCoord, COORD_T *pstAheadCoord, int8 byDirectionX, int8 byDirectionY)
|
|
|
+{
|
|
|
+
|
|
|
+ for (uint8 i = 0; i < pstMinmumValueGroup->byCalMinimumListLen; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (byDirectionX == 1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwX <= pstAheadCoord->dwX)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwX = pstPredictionCoord->dwX;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionX == -1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwX >= pstAheadCoord->dwX)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwX = pstPredictionCoord->dwX;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (byDirectionY == 1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwY <= pstAheadCoord->dwY)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwY = pstPredictionCoord->dwY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionY == -1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwY >= pstAheadCoord->dwY)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astCalMinimumList[i].stCoord.dwY = pstPredictionCoord->dwY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (uint8 i = 0; i < pstMinmumValueGroup->byTrackMinimumListLen; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (byDirectionX == 1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwX <= pstAheadCoord->dwX)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwX = pstPredictionCoord->dwX;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionX == -1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwX >= pstAheadCoord->dwX)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwX = pstPredictionCoord->dwX;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (byDirectionY == 1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwY <= pstAheadCoord->dwY)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwY = pstPredictionCoord->dwY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionY == -1)
|
|
|
+ {
|
|
|
+ if (pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwY >= pstAheadCoord->dwY)
|
|
|
+ {
|
|
|
+ pstMinmumValueGroup->astTrackMinimumList[i].stCoord.dwY = pstPredictionCoord->dwY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|