Hi,
I tried to report this bug via TI customer support, but they redirected me to the e2e forum. So, the case is:
During our internal tests it was found that two HERCULES-DSPLIB (Cortex-R4 CMSIS DSP Lib) functions show buggy behaviour: the index of the minimum value of the provided vector is calculated improperly. The fix is provided as the attachment. Test data is also provided for reference. The cv_q15 vector has minimum value of 18660 at index 13. However, the arm_min_q15() function returns the index 4. Similar bug was found in arm_min_q7() function.
Cortex-R4 CMSIS DSP Library - arm_min_q15 - BUG:
cv_q15 short[16] [19490,19896,20599,19017,20221...] 0x0800310C [0] short 19490 0x0800310C [1] short 19896 0x0800310E [2] short 20599 0x08003110 [3] short 19017 0x08003112 [4] short 20221 0x08003114 [5] short 19979 0x08003116 [6] short 19263 0x08003118 [7] short 19906 0x0800311A [8] short 19593 0x0800311C [9] short 19838 0x0800311E [10] short 19674 0x08003120 [11] short 19847 0x08003122 [12] short 18811 0x08003124 [13] short 18660 0x08003126 [14] short 18846 0x08003128 [15] short 19434 0x0800312A ---------------------------------------------------------------------------------- hwStatistics struct <unnamed> {cell_Vmin=18660,cellIndex_Vmin=4,cell_Vavg=19567,cell_Vmax=0,cellIndex_Vmax=0...} 0x080032BC cell_Vmin unsigned short 18660 0x080032BC cellIndex_Vmin unsigned int 4 0x080032C0 ----------------------------------------------------------------------------------
Cortex-R4 CMSIS DSP Library - arm_min_q15 - FIX:
--- "/c/ti/Hercules/Cortex-R4 CMSIS DSP Library/1.0.0/Source/StatisticsFunctions/arm_min_q15.c" 2011-12-15 15:30:34.000000000 +0100 +++ "/c/ti/Hercules/Cortex-R4 CMSIS DSP Library/1.0.0/Source/StatisticsFunctions/arm_min_q15.c" 2020-06-17 12:34:39.761963500 +0200 @@ -131,7 +131,7 @@ { /* Update the minimum value and its index */ out = minVal1; - outIndex = blockSize - count; + outIndex = blockSize - blkCnt; } blkCnt--;
Cortex-R4 CMSIS DSP Library - arm_min_q7 - FIX:
--- "/c/ti/Hercules/Cortex-R4 CMSIS DSP Library/1.0.0/Source/StatisticsFunctions/arm_min_q7.c" 2011-12-15 15:30:34.000000000 +0100 +++ "/c/ti/Hercules/Cortex-R4 CMSIS DSP Library/1.0.0/Source/StatisticsFunctions/arm_min_q7.c" 2020-06-17 12:55:51.892146400 +0200 @@ -130,7 +130,7 @@ { /* Update the minimum value and its index */ out = minVal1; - outIndex = blockSize - count; + outIndex = blockSize - blkCnt; } blkCnt--;
Best Regards,
Ritchie