How do I convert a YUV (444) into a display on WPF, would prefer using DirectX somehow for hardware acceleration

StackOverflow https://stackoverflow.com/questions/4505736

문제

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#.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top