Page 1 of 2
shufps bug ? (And interpolation)
Posted: Tue May 31, 2022 1:50 am
by Tepeix
I'm breaking my head with this..
Is there something i don't understand or is this a shufps bug ?
I wanted to test a simple interpolation of 4 sample.
I make a mono delay to test it. It write four continuous sample in SSE.
Trying to debug my mess.. I test an interpolated result of channel 0 to 1, 1 to 2 and 2 to 3 and it worked fine.
But only when i shufps before the process.. Not after..
Also the output result of channel 1 is supposed to be the right mix of channel 1 and 2.
But it's not...
A problem when we make a copy of a variable and shufps the original and the copy ?
Re: shufps bug ?
Posted: Tue May 31, 2022 2:25 pm
by Tepeix
I updated the bug file.
Sorry, i didn't see that there was some variable false value that make noise when the code initialize.
Also the synth was with no clip. So i add one in the end of the chain.
(i use those no clip synth when testing overdrive)
Finally i make the delay. In a less optimized way due to the bug.
Trying it with sound, it seams ok.
But using a bode plot i get strange result. Like most frequency get double volume when frac is high...
Is this one better than a 2 sample interpolated delay ? I doubt it. I don't hear a difference. But maybe ?
The bode plot seams to indicate some problem like an increasing feedback. But i didn't see or hear it with sound.
This delay was more to test the interpolation.
What do you think of this interpolation ? Do you think that there's a better one that are not too much cpu hungry ?
Here's how it works : a = ((4s - 0s) * frac ) +0s /// b = ((2s -1s)*frac) +1s
frac2 = 0.5- abs(frac-0.5) /// result = b + ((b-a)*frac2)
Re: shufps bug ? (And interpolation)
Posted: Sat Jul 23, 2022 11:22 am
by Tepeix
I was not hearing it. But the interpolation was not very good.
Doing an angle at the center...
Sorry, now i could see more clearly what it does with an array.
I make another one that's very similar and low cpu, but now there's angles at the edges...
Re: shufps bug ? (And interpolation)
Posted: Sat Jul 23, 2022 6:11 pm
by Tepeix
I make a better tool to evaluate the interpolation.
Evaluating more sample to see the continuity.
The second interpolated solution with a mod is a little better.
But with sharp angle, or in some situation, it need improvement.
I will loose some time to find my own solution.)..
But i'm almost sure that copying a cubic interpolation would do better with not so much more calculation..
Re: shufps bug ? (And interpolation)
Posted: Sun Jul 24, 2022 3:56 pm
by Tepeix
As intended, i tried some formula, but none was better than a cubic interpolation.
But even with this one i'm not completely satisfied with the behavior in some situation.
(even if others are perfect)
Here in red the result of the cubic one. But i want something like the green that i do by hand.
Do you know a way to do so ?

I find here the cubic interpolation :
http://paulbourke.net/miscellaneous/interpolation/(i just try and add the Hermite, but it only attenuate the bounce)
Re: shufps bug ? (And interpolation)
Posted: Sun Jul 24, 2022 5:33 pm
by Tepeix
I find another way to calculate the Hermite (i get the same result for every value i try for now)
But i'm not sure which take more cpu.
Maybe just a little advantage because 2 variables are not needed.
If i count right the Hermite is 10 (+or-) and 9 *.
And my formula 14 (+or-) and 7*.
(or 6* if there's an output control that could be adjusted and merged with the last multiply)
Here's the formula :
A=((y1-y0)*mu)+y1
B=((y2-y1)*mu)+y1
C=((y3-y2)*mu)+y2+y2-y3
X=((B-A)*mu)+A
Y=((C-B)*mu)+B
Z=((Y-X)*mu)+X
Result = (Z+B)*0.5
Re: shufps bug ? (And interpolation)
Posted: Sun Jul 24, 2022 9:24 pm
by Tepeix
I make a little error.
This is not an Hermite interpolation but a cubic/Catmull-Rom splines.
Will try the Hermite latter..
Re: shufps bug ? (And interpolation)
Posted: Mon Jul 25, 2022 1:00 pm
by Tepeix
Doing more research i found some treasury in this forum. (like always

In this topic there's a file with code for a lot of interpolation :
viewtopic.php?f=2&t=4016&hilit=interpolation&start=10I was surprise to see that the Lagrange take not so much instruction !
Re: shufps bug ? (And interpolation)
Posted: Mon Jul 25, 2022 2:44 pm
by Tepeix
Here's a Hermite with bias and tension control.
I like this one that give more possibility, but it take a lot more multiply..
Maybe some optimization are possible..
Re: shufps bug ? (And interpolation)
Posted: Sun Aug 28, 2022 9:55 am
by juha_tp
Tepeix wrote:...
This is not an Hermite interpolation but a cubic/Catmull-Rom splines.
Will try the Hermite latter..
Depends on what you're after in this thread but IIRC, Catmull-Rom is widely used in DSP applications.
I did some 5-point comparisons with random y data:
https://www.mediafire.com/file/rawkg0al ... 2.mkv/fileBTW, there is a collection of interpolation methods @MathWorks FileExchange (MatLab language):
https://www.mathworks.com/matlabcentral ... -utilities