Stereo width control

Post any examples or modules that you want to share here
Post Reply
blatantleesly
Posts: 21
Joined: Wed May 20, 2015 2:46 pm

Stereo width control

Post by blatantleesly »

stereo width control.fsm
(7.56 KiB) Downloaded 1289 times


Hi all,

A simple stereo width control using DSP.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Stereo width control

Post 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?
"There lies the dog buried" (German saying translated literally)
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Stereo width control

Post 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.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Stereo width control

Post by tulamide »

Will test it later, but wanted to already thank you.
"There lies the dog buried" (German saying translated literally)
Rocko
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Stereo width control

Post 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?
Post Reply