From 5b04d88f3adfccf5299afa1850dfe789c060ccbe Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Wed, 7 Apr 2021 10:52:55 +0200 Subject: [PATCH] CMSIS-DSP: Correcting issue #1167 --- Source/FilteringFunctions/arm_conv_partial_f32.c | 9 ++++++++- Source/FilteringFunctions/arm_conv_partial_fast_q15.c | 9 ++++++++- Source/FilteringFunctions/arm_conv_partial_fast_q31.c | 9 ++++++++- Source/FilteringFunctions/arm_conv_partial_q15.c | 9 ++++++++- Source/FilteringFunctions/arm_conv_partial_q31.c | 9 ++++++++- Source/FilteringFunctions/arm_conv_partial_q7.c | 9 ++++++++- Testing/Source/Tests/MISCF32.cpp | 6 ++++-- Testing/Source/Tests/MISCQ15.cpp | 3 +++ Testing/Source/Tests/MISCQ31.cpp | 5 ++++- Testing/Source/Tests/MISCQ7.cpp | 3 +++ 10 files changed, 62 insertions(+), 9 deletions(-) diff --git a/Source/FilteringFunctions/arm_conv_partial_f32.c b/Source/FilteringFunctions/arm_conv_partial_f32.c index 835ac58a..4264baf5 100644 --- a/Source/FilteringFunctions/arm_conv_partial_f32.c +++ b/Source/FilteringFunctions/arm_conv_partial_f32.c @@ -539,7 +539,14 @@ arm_status arm_conv_partial_f32( count = srcBLen - 1U; /* Working pointer of inputA */ - pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + if (firstIndex > srcALen) + { + pSrc1 = (pIn1 + firstIndex) - (srcBLen - 1U); + } + else + { + pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + } px = pSrc1; /* Working pointer of inputB */ diff --git a/Source/FilteringFunctions/arm_conv_partial_fast_q15.c b/Source/FilteringFunctions/arm_conv_partial_fast_q15.c index f819a9e6..f52606e7 100644 --- a/Source/FilteringFunctions/arm_conv_partial_fast_q15.c +++ b/Source/FilteringFunctions/arm_conv_partial_fast_q15.c @@ -574,7 +574,14 @@ arm_status arm_conv_partial_fast_q15( count = srcBLen - 1U; /* Working pointer of inputA */ - pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + if (firstIndex > srcALen) + { + pSrc1 = (pIn1 + firstIndex) - (srcBLen - 1U); + } + else + { + pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + } px = pSrc1; /* Working pointer of inputB */ diff --git a/Source/FilteringFunctions/arm_conv_partial_fast_q31.c b/Source/FilteringFunctions/arm_conv_partial_fast_q31.c index cc3d25e5..a1b45404 100644 --- a/Source/FilteringFunctions/arm_conv_partial_fast_q31.c +++ b/Source/FilteringFunctions/arm_conv_partial_fast_q31.c @@ -526,7 +526,14 @@ arm_status arm_conv_partial_fast_q31( count = srcBLen - 1U; /* Working pointer of inputA */ - pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + if (firstIndex > srcALen) + { + pSrc1 = (pIn1 + firstIndex) - (srcBLen - 1U); + } + else + { + pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + } px = pSrc1; /* Working pointer of inputB */ diff --git a/Source/FilteringFunctions/arm_conv_partial_q15.c b/Source/FilteringFunctions/arm_conv_partial_q15.c index 7e5e5bed..365cc78a 100644 --- a/Source/FilteringFunctions/arm_conv_partial_q15.c +++ b/Source/FilteringFunctions/arm_conv_partial_q15.c @@ -580,7 +580,14 @@ arm_status arm_conv_partial_q15( count = srcBLen - 1U; /* Working pointer of inputA */ - pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + if (firstIndex > srcALen) + { + pSrc1 = (pIn1 + firstIndex) - (srcBLen - 1U); + } + else + { + pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + } px = pSrc1; /* Working pointer of inputB */ diff --git a/Source/FilteringFunctions/arm_conv_partial_q31.c b/Source/FilteringFunctions/arm_conv_partial_q31.c index 45f08048..b9b55cdc 100644 --- a/Source/FilteringFunctions/arm_conv_partial_q31.c +++ b/Source/FilteringFunctions/arm_conv_partial_q31.c @@ -499,7 +499,14 @@ arm_status arm_conv_partial_q31( count = srcBLen - 1U; /* Working pointer of inputA */ - pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + if (firstIndex > srcALen) + { + pSrc1 = (pIn1 + firstIndex) - (srcBLen - 1U); + } + else + { + pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + } px = pSrc1; /* Working pointer of inputB */ diff --git a/Source/FilteringFunctions/arm_conv_partial_q7.c b/Source/FilteringFunctions/arm_conv_partial_q7.c index c6c9bf1a..627cc734 100644 --- a/Source/FilteringFunctions/arm_conv_partial_q7.c +++ b/Source/FilteringFunctions/arm_conv_partial_q7.c @@ -602,7 +602,14 @@ arm_status arm_conv_partial_q7( count = srcBLen - 1U; /* Working pointer of inputA */ - pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + if (firstIndex > srcALen) + { + pSrc1 = (pIn1 + firstIndex) - (srcBLen - 1U); + } + else + { + pSrc1 = (pIn1 + srcALen) - (srcBLen - 1U); + } px = pSrc1; /* Working pointer of inputB */ diff --git a/Testing/Source/Tests/MISCF32.cpp b/Testing/Source/Tests/MISCF32.cpp index 6bace43e..6d20d109 100755 --- a/Testing/Source/Tests/MISCF32.cpp +++ b/Testing/Source/Tests/MISCF32.cpp @@ -91,13 +91,12 @@ For tests of the error value of the Levinson Durbin algorithm this->first, NBPOINTS); - - memcpy((void*)tmpp,(void*)&outp[this->first],NBPOINTS*sizeof(float32_t)); ASSERT_TRUE(status==ARM_MATH_SUCCESS); ASSERT_SNR(ref,tmp,(float32_t)SNR_THRESHOLD); ASSERT_CLOSE_ERROR(ref,tmp,ABS_ERROR,REL_ERROR); + } @@ -790,6 +789,7 @@ For tests of the error value of the Levinson Durbin algorithm tmp.create(ref.nbSamples(),MISCF32::TMP_F32_ID,mgr); } + break; case MISCF32::TEST_CONV_PARTIAL_F32_85: { @@ -800,6 +800,7 @@ For tests of the error value of the Levinson Durbin algorithm tmp.create(ref.nbSamples(),MISCF32::TMP_F32_ID,mgr); } + break; case MISCF32::TEST_CONV_PARTIAL_F32_86: { @@ -810,6 +811,7 @@ For tests of the error value of the Levinson Durbin algorithm tmp.create(ref.nbSamples(),MISCF32::TMP_F32_ID,mgr); } + break; } diff --git a/Testing/Source/Tests/MISCQ15.cpp b/Testing/Source/Tests/MISCQ15.cpp index 821faf53..a162b36e 100755 --- a/Testing/Source/Tests/MISCQ15.cpp +++ b/Testing/Source/Tests/MISCQ15.cpp @@ -578,6 +578,7 @@ a double precision computation. scratchA.create(24,MISCQ15::SCRATCH1_Q15_ID,mgr); scratchB.create(24,MISCQ15::SCRATCH2_Q15_ID,mgr); } + break; case MISCQ15::TEST_CONV_PARTIAL_Q15_52: case MISCQ15::TEST_CONV_PARTIAL_FAST_Q15_55: @@ -595,6 +596,7 @@ a double precision computation. scratchB.create(24,MISCQ15::SCRATCH2_Q15_ID,mgr); } + break; case MISCQ15::TEST_CONV_PARTIAL_Q15_53: case MISCQ15::TEST_CONV_PARTIAL_FAST_Q15_56: @@ -612,6 +614,7 @@ a double precision computation. scratchB.create(24,MISCQ15::SCRATCH2_Q15_ID,mgr); } + break; } diff --git a/Testing/Source/Tests/MISCQ31.cpp b/Testing/Source/Tests/MISCQ31.cpp index c3a12f06..b3c7a892 100755 --- a/Testing/Source/Tests/MISCQ31.cpp +++ b/Testing/Source/Tests/MISCQ31.cpp @@ -14,7 +14,7 @@ a double precision computation. */ #define ABS_ERROR_Q31 ((q31_t)2) -#define ABS_ERROR_FAST_Q31 ((q31_t)6) +#define ABS_ERROR_FAST_Q31 ((q31_t)11) /* @@ -817,6 +817,7 @@ For tests of the error value of the Levinson Durbin algorithm tmp.create(ref.nbSamples(),MISCQ31::TMP_Q31_ID,mgr); } + break; case MISCQ31::TEST_CONV_PARTIAL_Q31_85: case MISCQ31::TEST_CONV_PARTIAL_FAST_Q31_88: @@ -828,6 +829,7 @@ For tests of the error value of the Levinson Durbin algorithm tmp.create(ref.nbSamples(),MISCQ31::TMP_Q31_ID,mgr); } + break; case MISCQ31::TEST_CONV_PARTIAL_Q31_86: case MISCQ31::TEST_CONV_PARTIAL_FAST_Q31_89: @@ -839,6 +841,7 @@ For tests of the error value of the Levinson Durbin algorithm tmp.create(ref.nbSamples(),MISCQ31::TMP_Q31_ID,mgr); } + break; } diff --git a/Testing/Source/Tests/MISCQ7.cpp b/Testing/Source/Tests/MISCQ7.cpp index fa5dd0be..546eac29 100755 --- a/Testing/Source/Tests/MISCQ7.cpp +++ b/Testing/Source/Tests/MISCQ7.cpp @@ -523,6 +523,7 @@ a double precision computation. scratchA.create(24,MISCQ7::SCRATCH1_Q15_ID,mgr); scratchB.create(24,MISCQ7::SCRATCH2_Q15_ID,mgr); } + break; case MISCQ7::TEST_CONV_PARTIAL_Q7_52: case MISCQ7::TEST_CONV_PARTIAL_OPT_Q7_55: @@ -538,6 +539,7 @@ a double precision computation. scratchB.create(24,MISCQ7::SCRATCH2_Q15_ID,mgr); } + break; case MISCQ7::TEST_CONV_PARTIAL_Q7_53: case MISCQ7::TEST_CONV_PARTIAL_OPT_Q7_56: @@ -553,6 +555,7 @@ a double precision computation. scratchB.create(24,MISCQ7::SCRATCH2_Q15_ID,mgr); } + break; }