加载8bit的uint8_t有作为uint32_t的? [英] Load 8bit uint8_t as uint32_t?

查看:431
本文介绍了加载8bit的uint8_t有作为uint32_t的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图像处理项目与灰度图像。我有ARM Cortex-A8处理器的平台。我想利用NEON的。

我有一个灰度图像(考虑下面的例子),并在我的算法FFT,我只添加列。

我如何可以加载 4个8位像素值并行,这是的 uint8_t有,因为四uint32_t的到128之一位NEON寄存器?什么内在的我必须使用要做到这一点?

我的意思是:

我必须加载它们作为32位,因为如果你仔细看,那一刻我做255 + 255为512,不能在一个8位寄存器举行。

例如

  255 255 255 255 .........(640像素)
255 255 255 255
255 255 255 255
255 255 255 255





(480像素)


解决方案

我会建议您多花一点时间了解SIMD如何工作的ARM。请看:

看看:


  1. http://blogs.arm.com/software-enablement/161-coding-for-neon-part-1-load-and-stores/

  2. http://blogs.arm.com/software-enablement/196-coding-for-neon-part-2-dealing-with-leftovers/

  3. http://blogs.arm.com/software-enablement/241-coding-for-neon-part-3-matrix-multiplication/

  4. http://blogs.arm.com/software-enablement/277-coding-for-neon-part-4-shifting-left-and-right/

让你开始。然后,您可以实现您的SIMD code。使用内联汇编或domen推荐相应的ARM内部函数。

my image processing project works with grayscale images. I have ARM Cortex-A8 processor platform. I want to make use of the NEON.

I have a grayscale image( consider the example below) and in my alogorithm, I have to add only the columns.

How can I load four 8-bit pixel values in parallel, which are uint8_t, as four uint32_t into one of the 128-bit NEON registers? What intrinsic do I have to use to do this?

I mean:

I must load them as 32 bits because if you look carefully, the moment I do 255 + 255 is 512, which can't be held in a 8-bit register.

e.g.

255 255 255 255 ......... (640 pixels)
255 255 255 255
255 255 255 255
255 255 255 255
.
.
.
.
.
(480 pixels) 

解决方案

I will recommend that you spend a bit of time understanding how SIMD works on ARM. Look at:

Take a look at:

  1. http://blogs.arm.com/software-enablement/161-coding-for-neon-part-1-load-and-stores/
  2. http://blogs.arm.com/software-enablement/196-coding-for-neon-part-2-dealing-with-leftovers/
  3. http://blogs.arm.com/software-enablement/241-coding-for-neon-part-3-matrix-multiplication/
  4. http://blogs.arm.com/software-enablement/277-coding-for-neon-part-4-shifting-left-and-right/

to get you started. You can then implement your SIMD code using inline assembler or corresponding ARM intrinsics recommended by domen.

这篇关于加载8bit的uint8_t有作为uint32_t的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆