Results 1 to 2 of 2

Thread: Some additions to CL_SoundSSE

  1. #1
    Lesser Knight
    Join Date
    Mar 2009
    Posts
    54

    Default Some additions to CL_SoundSSE

    Hey,
    Any chance of adding the following 2 functions to CL_SoundSSE?

    Code:
    void unpack_float_stereo(float *input, int size, float *output[2])
    {
    #ifndef CL_DISABLE_SSE2
        int sse_size = (size/8)*8;
    
        for (int i = 0; i < sse_size; i+=8)
        {
            __m128 samples0 = _mm_loadu_ps(input+i);
            __m128 samples1 = _mm_loadu_ps(input+i+4);
            __m128 tmp0 = _mm_shuffle_ps(samples0, samples1, _MM_SHUFFLE(2,0,2,0));
            __m128 tmp1 = _mm_shuffle_ps(samples0, samples1, _MM_SHUFFLE(3,1,3,1));
    
            _mm_storeu_ps(output[0]+i/2, tmp0);
            _mm_storeu_ps(output[1]+i/2, tmp1);
        }
    
    #else
        const int sse_size = 0;
    #endif
    
        // unpack remaining
        for (int i = sse_size; i < size; i+=2)
        {
            output[0][i/2] = input[i];
            output[1][i/2] = input[i+1];
        }
    }
    
    void unpack_float_mono(float *input, int size, float *output)
    {
    #ifndef CL_DISABLE_SSE2
        int sse_size = (size/4)*4;
    
        for (int i = 0; i < sse_size; i+=4)
        {
            __m128 samples0 = _mm_loadu_ps(input+i);
            _mm_storeu_ps(output+i, samples0);
        }
    
    #else
        const int sse_size = 0;
    #endif
    
        // unpack remaining
        if(sse_size < size)
            memcpy(output, input, (size-sse_size)*sizeof(float));
    }

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Patch applied to ClanLib 2.2 SVN

    Many thanks

Similar Threads

  1. Dictionary Additions Thread
    By Seth in forum Dungeon Scroll for PC and iPhone
    Replies: 39
    Last Post: 04-29-2016, 09:43 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •