如何将 YUV (444) 转换为 WPF 上的显示,更喜欢使用 DirectX 以某种方式进行硬件加速

发布于 2024-10-08 10:08:46 字数 154 浏览 0 评论 0原文

我正在努力在屏幕上播放一部 Y4M 电影。解析我可以处理的文件,但是我目前有一个包含帧的 YUV 值的 2d 字节数组。是否有内置硬件加速方式或者我必须将其转换为 RGB 并创建位图?如果有人有一个关于 WPF 中的 DirectX 教程的好网站,我们将不胜感激。顺便说一句,这是在 C# 中。

I am working on displaying a Y4M movie to a screen. Parsing the file I can handle however I currently have a 2d byte array with the YUV values of the frame. Is there a built in hardware accelerated way or do I have to convert it to RGB and create a Bitmap? If anyone has a good website for a tutorial in DirectX in WPF it would be greatly appreciated as well. By the way this is in C#.

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

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

发布评论

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

评论(1

携余温的黄昏 2024-10-15 10:08:46

YUV 表面可能是特定硬件供应商 (IHV) FourCC 支持的特殊表面。您需要从 IHV 那里了解他们是否有可以使用的 FourCC,并且您不能依赖它在其他平台上工作。

4:2:2 有一个标准的 D3DFORMAT(D3DFMT_YUY2 或 D3DFMT_UYVY),但 4:4:4 没有默认格式。我确信大多数 IHV 确实为此类渲染提供了 FourCC。

值得记住的是,如果您知道传入数据的 FourCC,那么直接尝试使用该 FourCC 创建表面可能是值得的。如果它有效,您就可以开始了:)如果没有,那么您也许可以找到一个有效的替代方案,或者您可能需要进行一些手动格式转换。

YUV surfaces are likely special surfaces supported by a specific hardware vendor (IHV) FourCC. You will need to find out from the IHV if they have a FourCC you can use and you can't rely on it working on other platforms.

There is a standard D3DFORMAT for 4:2:2 (D3DFMT_YUY2 or D3DFMT_UYVY) but there is no default one for 4:4:4. I'm sure most IHVs do provide a FourCC for such rendering.

Its worth bearing in mind that if you know the FourCC of the incoming data then it may well be worth simply trying to create a surface with that FourCC directly. If it works, you are ready to go :) If not then you may be able to find an alternative that works or you may have to do some manual format conversion.

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