Sum array of unsigned 8-bit integers using the Accelerate framework

末鹿安然 提交于 2019-11-29 22:43:54

问题


Can I use the Accelerate Framework to sum an array of unsigned 8-bit integers without converting to an array of floats.

My current approach is:

vDSP_vfltu8(intArray, 1, floatArray, 1, size);
vDSP_sve(floatArray, 1, &result, size);

But vDSP_vfltu8 is quite slow.


回答1:


  1. If it is important to you that vDSP_vfltu8( ) be fast, please file a bug report. If there's any question, file a bug report. Inadequate performance is a bug, and will be treated as such if you report it. Library writers use this sort of feedback to determine how to prioritize their work; your bug report is the difference between a function being at the front of the queue for optimization and it being #1937 in the queue.
  2. As has been hinted, integer accumulation is complicated by overflow concerns, but if it would be useful to have an optimized function for a specific case provided by the vDSP library, please file a bug report to request such a function (noticing a pattern?). Library writers are not psychic, and do not write functions that are not requested. Be sure to explain how you would use such a function--given this information, they may come up with a slightly different function that is even more useful to you.
  3. If you decide to write some NEON code yourself, you will want to make use of the vaddw_u8( ) intrinsic.


来源:https://stackoverflow.com/questions/5567517/sum-array-of-unsigned-8-bit-integers-using-the-accelerate-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!