Modifying FftBuffer to output the magnitude and phase
Closed this issue · 3 comments
robclouth commented
In the Postprocess Job you do this:
public void Execute(int i)
{
var x = X[i];
var l = math.float2(math.length(x.xy), math.length(x.zw));
O[i] = (MathUtils.dBFS(l * DivN) - F) * DivR;
}
I assume you're calculating the magnitude with math.length(x.xy)
but what is math.length(x.zw)
?
Why is each element of x float4? And why O is float2 if it's just magnitudes?
keijiro commented
I can't remember it correctly (I wrote it 1.5 years ago), but I think it's just a SIMD optimization. I mean, calculating float4 = float4 + float4
is faster than calculating float = float + float
4 times.
Originally, X was implemented as as a float2 array, and O was just a float array. I reinterpret them as float4 and float2 to utilize SIMD.
keijiro commented
I'm closing this issue now. Please feel free to reopen it for further problems.
robclouth commented
So it's just an optimization thing. Thanks :-)
…On Thu, 30 Sep 2021, 15:58 Keijiro Takahashi, ***@***.***> wrote:
Closed #45 <#45>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJP3IR2MNVL5AVLAK6ZHTLUERUJBANCNFSM5FCHJ5UA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.