






Moderators: electrogear, exonerate
streamin i;streamout o;
float Fmin=0.999;
float Fmax=-0.999;
movaps xmm0,i;
minps xmm0,Fmin;
maxps xmm0,Fmax;
movaps o,xmm0;

My ASM code is indeed a "clipper" which is a subset of limiters:aliasant wrote:Hey. What is the difference between this static limiter and any clipper?


infuzion wrote:I believe the above OSM has "soft limiting", due to a sort of compression to it.
.......
Very true! That's why most of the scenarios I listed I was expecting the signal to be over only 0.0001 or so.bootsy wrote:...hard-clipping introduces heavy aliasing in any case (can't be compensated).

//Limiter Code by Martin Rodensjo / aliasant
streamin in;
streamin release;
streamout out;
streamout red;
float rectified=0;
float c=0;
float thres=0;
float x=0;
float x1=0;
float env=0;
float F1=1;
float F0=0;
float F2=2;
float F1eM008=1e-008;
float F0P001=0.001;
float F1000=1000;
movaps xmm0,in;
cmpps xmm0,F0,1;
movaps xmm1,xmm0;
andps xmm1,F2;
movaps xmm2,F1;
subps xmm2,xmm1;
movaps xmm3,in;
mulps xmm3,xmm2;
movaps xmm4,xmm3;
addps xmm4,F1eM008;
//Assignment> sLeft=xmm4
movaps rectified,xmm4;
movaps xmm0,rectified;
subps xmm0,F0P001;
//Assignment> sLeft=xmm0
movaps x,xmm0;
movaps xmm0,F1000;
minps xmm0,x;
//Assignment> sLeft=xmm0
movaps x,xmm0;
movaps xmm0,F0;
maxps xmm0,x;
//Assignment> sLeft=xmm0
movaps x1,xmm0;
movaps xmm0,x1;
cmpps xmm0,env,5;
movaps xmm1,F0;
subps xmm1,release;
andps xmm0,xmm1;
movaps xmm1,release;
addps xmm1,xmm0;
//Assignment> sLeft=xmm1
movaps c,xmm1;
movaps xmm0,env;
subps xmm0,x1;
movaps xmm1,c;
mulps xmm1,xmm0;
movaps xmm2,xmm1;
addps xmm2,x1;
movaps xmm3,xmm2;
subps xmm3,F1eM008;
//Assignment> sLeft=xmm3
movaps env,xmm3;
movaps xmm0,env;
addps xmm0,F1;
movaps xmm1,F1;
divps xmm1,xmm0;
//Assignment> sLeft=xmm1
movaps red,xmm1;
movaps xmm0,red;
mulps xmm0,in;
//Assignment> sLeft=xmm0
movaps out,xmm0;
That's some tight ASM! I can't do betterexonerate wrote:Ok I saw some glaring obvious optimizations so I just couldn't help my self.. Now the limiter is inside one ASM block, I've not checked the CPU usage but It will be considerably less.


Users browsing this forum: No registered users and 1 guest