2

我是 SSE 的新手,到目前为止,您已经设法从 unsigned char 数组加载,但我不知道如何将结果存储回来。请帮我。

void calculate_borders_parallel( unsigned char *src, unsigned char *dst, int width, int height )
  {
      // TO DO
      __m128i sourceUp;
      __m128i sourceDown;
      __m128i destiny;

#pragma omp parallel for

     for (int j = 1; j<height; j++)
     {
         for (int i = 0; i<width; i+=4)
         {

             sourceUp = _mm_loadu_si128( (const __m128i*)&src[(j-1)*width+i] );
             sourceDown = _mm_loadu_si128( (const __m128i*)&src[(j+1)*width+i] );
             destiny = _mm_subs_epu8(sourceDown, sourceUp);

             _mm_store_si128( &dst[(j+0)*width+i], destiny );  // <----- ERROR HERE .. cannot convert from __m128i to unsigned char


         }
     }
4

2 回答 2

1

您必须执行以下操作:

*(__m128i *)&dst[idx]

取消引用地址,该地址已转换为向量数组。

于 2013-11-14T14:15:42.933 回答
1

你只是缺少一个演员:

         _mm_store_si128( (__m128 *)&dst[(j+0)*width+i], destiny );
于 2013-11-14T23:43:37.640 回答