在 iPhone 应用程序中使用图形硬件进行音频处理
我们正在开发一个 iPhone 应用程序,需要实时处理音频数据,但我们的性能受到了影响。瓶颈在于音频效果,实际上非常简单,但是当添加几个时,性能受到的影响就很明显。
大多数音频效果代码都是用 C 编写的。
我们认为有两个地方可以使用 GPU 硬件来加速:使用 openCL 实现效果和使用硬件进行插值/平滑。我们对此还很陌生,不知道从哪里开始。
We are developing an iphone app that needs to process audio data in real time, but we are suffering with performance. The bottlenecks are in audio effects, which are in fact quite simple, but the performance hit is noticeable when several are added.
Most of the audio effects code is written in C.
We think there are two places we can use gpu hardware to speed things up: using openCL for effects and hardware for interpolation/smoothing. We are fairly new to this and don't know where to begin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能指的是 OpenGL,因为 OpenCL 仅存在于桌面上。是的,如果您想执行一些非常快速的并行处理,您可以为此使用 OpenGL ES 2.0 可编程着色器,但这将非常复杂。
您可能首先想看看 Accelerate 框架,它具有硬件加速功能,用于执行音频处理所需的任务。一个很好的起点是 Apple 的 WWDC 2010 会议 202 - “iPhone 的加速框架” OS”,以及他们的“利用 Accelerate Framework” 文章。
另外,不要忽视汉斯的建议,即首先分析代码,因为性能瓶颈可能出现在您意想不到的地方。
You probably mean OpenGL, as OpenCL is only present on the desktop. Yes, you could use OpenGL ES 2.0 programmable shaders for this, if you wanted to perform some very fast parallel processing, but that will be extremely complex to pull off.
You might first want to look at the Accelerate framework, which has hardware-accelerated functions for doing just the kind of tasks needed for audio processing. A great place to start is Apple's WWDC 2010 session 202 - "The Accelerate framework for iPhone OS", along with their "Taking Advantage of the Accelerate Framework" article.
Also, don't dismiss Hans' suggestion that you profile your code first, because your performance bottleneck might be somewhere you don't expect.
您可能会为 ARM NEON SIMD 单元获得更好的 DSP 加速编码。 NEON 专为 DSP 运算而设计,每个周期可以流水线执行多个单精度浮点运算。虽然从 GPU 内存中获取音频数据是可能的,但可能不会那么快。
但您可能想要分析您的代码以查看其他内容是否是瓶颈。 iPhone 4 CPU 可以轻松应对实时音频流上的多个 FFT 和 IIR 滤波器。
You might get better DSP acceleration coding for the ARM NEON SIMD unit. NEON is designed for DSP operations and can pipeline multiple single precision floating point operations per cycle. Whereas getting audio data in and out of GPU memory may be possible, but may not be that fast.
But you might want to profile your code to see if something else is the bottleneck. The iPhone 4 CPU can easily keep up with doing multiple FFT's and IIR filters on a real-time audio stream.