Page 1 of 1

Stereo width control

Posted: Tue Jul 28, 2015 3:54 pm
by blatantleesly
stereo width control.fsm
(7.56 KiB) Downloaded 1288 times


Hi all,

A simple stereo width control using DSP.

Re: Stereo width control

Posted: Tue Jul 28, 2015 4:55 pm
by tulamide
Thank you, I'll make use of it. :)

To all asm-gurus: Is this already as fast as possible, or could one of you optimize the asm code?

Re: Stereo width control

Posted: Tue Jul 28, 2015 7:27 pm
by KG_is_back
there is a minor bug in the code:

Code: Select all

out1 = mid - side;
out2 = mid + side;

The signs should be swapped, because mid=left+right and side=left-right => left=mid+side

here is ASM optimized version of the code:

Code: Select all

streamin in1;
streamin in2;
streamin width;
streamout out1;
streamout out2;
float x=0.5;

movaps xmm0,width;
mulps xmm0,x;

movaps xmm0,in1;
movaps xmm1,in2;
movaps xmm2,xmm0;
addps xmm0,xmm1;
subps xmm2,xmm1;

movaps xmm3,x;
mulps xmm0,xmm3;
mulps xmm2,xmm3;
mulps xmm2,width;
movaps xmm1,xmm0;
addps xmm0,xmm2;
subps xmm1,xmm2;
movaps out1,xmm0;
movaps out2,xmm1;


the CPU savings will be minuscule though - the code is only using + - * which are very CPU cheap and those few intermediate variables don't make much difference.

Re: Stereo width control

Posted: Wed Jul 29, 2015 12:19 am
by tulamide
Will test it later, but wanted to already thank you.

Re: Stereo width control

Posted: Tue Sep 01, 2015 2:41 pm
by Rocko
Hi,

From theory side, can't this code be optimized by SSE, meaning by packing L+R into a single SSE, then processing SSE(0) and SSE(1), and then unpacking?

Or is that true only if running the same exact processing on both Left and Right inputs, which is not the case here?