Hi, I am trying to make the function vec_reluf working from naturedsp_hifi4.
I've made a simple test
float32_t testIn[5] = {-1.0f, 2.3f, 3.0f, -4.4f, 2000.0f};
float32_t testOut[5] ={0};
vec_reluf(testOut, testIn, 1000.0f, 5);
the expected behavior is to obtain:
testOut={0, 2.3, 3, 0, 1000}
but the result is:
testOut = {0, 1.40129846e-45, 1.40129846e-45, 0 , 1.40129846e-45}
here is the function:
void vec_reluf (float32_t * y, const float32_t * x, float32_t K, int N)
{
ae_valign aY;
const xtfloatx2* restrict pX=(const xtfloatx2*)x;
xtfloatx2* restrict pY=( xtfloatx2*)y;
xtfloatx2 zero=XT_CONST_S(0);
int n;
if (N<=0) return;
if (((uintptr_t)pX)&7)
{
xtfloat t;
XT_LSIP(t,castxcc(xtfloat,pX),sizeof(xtfloat));
t=XT_MIN_S(K,t);
t=XT_MAX_S(t,zero);
XT_SSIP(t,castxcc(xtfloat,pY),sizeof(xtfloat));
N--;
}
aY=AE_ZALIGN64();
for(n=0; n<(N>>1); n++)
{
xtfloatx2 t;
XT_LSX2IP(t,pX,sizeof(xtfloatx2));
t=XT_MIN_SX2(K,t);
t=XT_MAX_SX2(t,zero);
XT_SASX2IP(t,aY,pY);
}
AE_SA64POS_FP(aY,pY);
if(N&1)
{
xtfloat t;
t=XT_LSI((const xtfloat*)pX,0);
t=XT_MIN_S(K,t);
t=XT_MAX_S(t,zero);
XT_SSI(t,(xtfloat*)pY,0);
}
}
Any suggestion?
Thx, Thomas
Hello Thomas,
Hope you are doing well.
Could you please tell me which version of the SDK you are working with. Also I am unable to find the code you have posted. I do see the NatureDSP_Signal_math.h which includes this definition but not the full function. I'd like to verify that I am also seeing the same on my end and can reproduce this behavior.
Best Regards,
Sabina
Hi Sabina,
Thank you to take the time to answer me, the problem has disappeared one morning after a restart of the computer. I am not sure the restart has solved this but I cannot reproduce the problem.
Just in case, hereafter the information asked:
Best regards,
Thomas