什么显示出更好的性能?使用 UIImageView 播放影片剪辑或动画图像序列?

发布于 2024-08-05 14:17:05 字数 185 浏览 3 评论 0 原文

规格:约 320 x 270 像素,5 秒。我不知道流畅的动画到底需要多少图像,但我们假设 30 个。

播放此图像的最佳方式是什么?作为某种 Quicktime 视图中的电影文件(如果可用),或者作为 UIImageView 的动画图像序列?我不确定,但我相信在 iPod touch 上每秒加载 30 张图像几乎是不可能的。有什么想法吗?

Specs: about 320 x 270 px, 5 seconds. I don't know exactly how many images needed for a fluid animation, but let's assume 30.

What would be the best way to playback this? As a movie file in some kind of quicktime view (if available), or as an animated image sequence with UIImageView? I'm not sure but I believe loading 30 images per second is nearby impossible on the ipod touch. Any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

演出会有结束 2024-08-12 14:17:05

一般来说,电影会应用一些压缩,甚至可能使用有损压缩。这意味着处理器需要更加努力地工作,但可供读取的内存却少得多。 CPU 是一种快速资源。与CPU相比,内存速度较慢。因此,压缩的电影(逻辑上)将具有更好的性能。

实际上,这可能取决于很多因素,尽管电影确实往往针对动画进行了更好的优化。如果 CPU 较慢且内存速度极快,多图像动画可能会更快。此外,这还取决于您存储这些图像的方式。但99%的情况下,电影都会有更好的表现。

In general, a movie will have applied some compression and possibly even used a lossy compression. This means the processor would need to work harder but it has a lot less memory to read. The CPU is a fast resource. Compared to the CPU, memory is slow. Thus a compressed movie would (logically) have the better performance.

In practice, it could depend on a lot of factors, although movies do tend to be better optimized for animations. With a slow CPU and extremely fast memory, a multi-image animation might just be faster. Also, it depends on how you store those many images. But in 99% of all situations, movies will have better performance.

谜兔 2024-08-12 14:17:05

好吧,我想这取决于……如果它应该是静态的,那么电影是最合适的方式……它是硬件加速的,并且很容易编写使用它的代码。如果您打算修改动画并重用它,您可以加载和修改图像,或者连续加载一堆图像,但我认为这对于该任务来说是相当大的编码过度。

Well, I guess it depends.... if it supposed to be static, than a movie is the most appropriate way... it's hardware accelerated, and easy to write the code for using it. If you plan to modify the animation, and reuse it, you could load and modify images, or load a bunch of them in succession, but I imagine it's quite coding overkill for the task.

小红帽 2024-08-12 14:17:05

为什么您不想想要使用视频文件?如果您没有非常具体的原因,我建议您仅使用Apple提供的标准视频播放功能。

这给你带来了几个优点:

  • 即使你提出的方法可以流畅地运行,它肯定不会对图形芯片进行很好的优化,因此会消耗更多的电池
  • 它很容易实现,而你的想法会相当复杂,而且你会花费大量时间在应用程序中可能不太重要的部分上。
  • 它不会引入任何新的错误,并且很可能比您的自定义解决方案经过更好的测试。

查看此内容以开始使用:

http://developer.apple.com/iphone/library/navigation/index.html?section=Topics&topic=Audio%20%26amp%3B%20Video

Why would you not want to use a video file? If you don't have very specific reasons, I would recommend just using the standard video playback functions provided by Apple.

This gives you several advantages:

  • Even if your proposed method would run fluidly, it certainly wouldn't be as well optimised for the graphics chip and therefore use up more battery
  • It's very easy to implement, whereas your idea would be rather complicated, and you'd spend a lot of time on a probably less important part of your app.
  • It's won't introduce any new bugs and is most likely a lot better tested than your custom solution.

Check out this to get started:

http://developer.apple.com/iphone/library/navigation/index.html?section=Topics&topic=Audio%20%26amp%3B%20Video

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文