我是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
}
}
答案 0 :(得分:1)
您必须执行以下操作:
*(__m128i *)&dst[idx]
取消引用已转换为向量数组的地址。
答案 1 :(得分:1)
你只是错过了演员:
_mm_store_si128( (__m128 *)&dst[(j+0)*width+i], destiny );