如何将 YUV (444) 转换为 WPF 上的显示,更喜欢使用 DirectX 以某种方式进行硬件加速
我正在努力在屏幕上播放一部 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.