Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAudio_internal_simd.c #25

Merged
merged 14 commits into from
Aug 17, 2018
Merged

FAudio_internal_simd.c #25

merged 14 commits into from
Aug 17, 2018

Conversation

8thMage
Copy link
Contributor

@8thMage 8thMage commented Aug 16, 2018

… data, not real game. Also did not compile the original project, only a bogus project.

@flibitijibibo
Copy link
Member

Cleaned this up a fair bit and plugged it into a new system that includes scalar fallbacks:

8thMage#1

The resampler code needs cleaning up but it sounds okay to me!

@flibitijibibo
Copy link
Member

flibitijibibo commented Aug 16, 2018

With the above changes I did manage to get a crash, but the good news is it's consistent. If you own Dust: AET, the Content/sfx/ folder should have sfx_project.xgs and weather_wavs.xwb. You can make facttool, load those two files (ignore the streaming assert), and playing wave 0 should crash after about half a second. (If you don't have these files, e-mail me and I'll send it over.)

#1  FAudio_INTERNAL_ResampleMono_SSE2 (voice=0x7fffa4001030, resampleCache=0x7fffc4ff3d18, 
    toResample=301) at src/FAudio_internal_simd.c:508
        res_half_1 = {0.00241746102, 0.00108728209, 0, 0}
        next_cur = 2
        res_half_2 = {0.00196883222, 0.000190024643, 0, 0}
        cur_shifted = {2, 2}
        res = {0.00241746102, 0.00196883222, 0.00108728209, 0.000190024643}
        i = 0
        dCache = 0x555556de8670
        resampleOffset = 0x7fffa40010f0
        resampleStep = 1973090080
        header = 4
        cur_scalar = 2252795744
        cur = {10145156064, 9796368928}
        adder = {1973090080, 1973090080}
        next_cur = 6198975904
        dCache_next = 0x555556de8674
        next_adder = {5919270240, 5919270240}
        one_over_fixed_one = {2.3283064365386963e-10, 2.3283064365386963e-10}
        half = {0.5, 0.5}
        half_fixed = {2147483648, 2147483648}
        fixed_fraction_maskvec = {4294967295, 4294967295}
        tail = 1
#2  0x00007fffdd1ded32 in FAudio_INTERNAL_MixSource (voice=0x7fffa4001030) at src/FAudio_internal.c:501
        i = 1
        j = 1024
        co = 2
        ci = 2
        toDecode = 141
        toResample = 305
        resampleCache = 0x555556de295c
        stream = 0x5555567d0b20
        mixed = 719
        oChan = 2
        out = 0x555555d9fc20
        outputRate = 21845
        stepd = 4.6355714935394502e-310
        effectOut = 0x555556de1e10

Using an isolated test program with the exact same raw MSADPCM data works fine, so I think this is just an alignment issue.

@8thMage
Copy link
Contributor Author

8thMage commented Aug 17, 2018

i changed the mono SSE2 functions from using doubles to using floats. The double function was not checked like the float function, so it makes sense it crashed. the float function now has better variable names and explanation for most of the non trivial work.

@flibitijibibo
Copy link
Member

That fixed it! I'll run through this one more time with some of my stuff, do one last cleanup (your editor really hates /**/ comments!), and we'll get this merged in.

@flibitijibibo flibitijibibo changed the title vectorised audio resampler and volume amplifier, only checks on bogus… FAudio_internal_simd.c Aug 17, 2018
@flibitijibibo
Copy link
Member

This should be the last of it: 8thMage#2

@flibitijibibo flibitijibibo merged commit ffc93e8 into FNA-XNA:master Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants