Wraping the signal.
Posted: Fri Nov 08, 2013 4:49 am
Has anyone made any components that wrap the signal between -1 and 1 or 0 and 1? Would you be able to share with me?
DSP Robotics and FlowStone Graphical Programming Software Support and Forums
https://dsprobotics.com/support/
Code: Select all
streamin in;
streamout out;
float one = 1.0;
float two = 2.0;
float half = 0.5;
movaps xmm0,in;
//Scale -1..1 to 0..1
addps xmm0,one;
mulps xmm0,half;
//Wrap to 0..1 by removing integer part.
movaps xmm1,xmm0;
addps xmm1,half;
cvtps2dq xmm1,xmm1;
cvtdq2ps xmm1,xmm1;
subps xmm0,xmm1;
//Scale 0..1 to -1..1
mulps xmm0,two;
subps xmm0,one;
movaps out,xmm0;