Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

shufps bug ? (And interpolation)

DSP related issues, mathematics, processing and techniques

shufps bug ? (And interpolation)

Postby Tepeix » Tue May 31, 2022 1:50 am

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 ?
Attachments
Interpolate4sample shufps bug v2.fsm
(73.14 KiB) Downloaded 206 times
Last edited by Tepeix on Sat Jul 23, 2022 11:13 am, edited 1 time in total.
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ?

Postby Tepeix » Tue May 31, 2022 2:25 pm

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)
Attachments
Interpolate4sample v2.fsm
(62.3 KiB) Downloaded 216 times
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Sat Jul 23, 2022 11:22 am

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...
Attachments
interpolation test.fsm
(6.31 KiB) Downloaded 176 times
interpolation fail.png
interpolation fail.png (12.28 KiB) Viewed 4432 times
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Sat Jul 23, 2022 6:11 pm

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..
Attachments
interpolation test2.fsm
(5.67 KiB) Downloaded 174 times
interpolation 2.png
interpolation 2.png (5.56 KiB) Viewed 4416 times
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Sun Jul 24, 2022 3:56 pm

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 ?
Image

I find here the cubic interpolation : http://paulbourke.net/miscellaneous/interpolation/

(i just try and add the Hermite, but it only attenuate the bounce)
Attachments
interpolation test3.fsm
(63.18 KiB) Downloaded 172 times
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Sun Jul 24, 2022 5:33 pm

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
Attachments
interpolation test4 Another Hermite.fsm
(64.79 KiB) Downloaded 174 times
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Sun Jul 24, 2022 9:24 pm

I make a little error.
This is not an Hermite interpolation but a cubic/Catmull-Rom splines.
Will try the Hermite latter..
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Mon Jul 25, 2022 1:00 pm

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=10

I was surprise to see that the Lagrange take not so much instruction !
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby Tepeix » Mon Jul 25, 2022 2:44 pm

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..
Attachments
interpolation test5 True Hermite with Bias and Tension.fsm
(87.91 KiB) Downloaded 165 times
Tepeix
 
Posts: 193
Joined: Sat Oct 16, 2021 3:11 pm

Re: shufps bug ? (And interpolation)

Postby juha_tp » Sun Aug 28, 2022 9:55 am

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/file

BTW, there is a collection of interpolation methods @MathWorks FileExchange (MatLab language):
https://www.mathworks.com/matlabcentral ... -utilities
juha_tp
 
Posts: 54
Joined: Fri Nov 09, 2018 10:37 pm

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 6 guests