Hello,
its quite a while since i posted any question here. I worked like 1 and a half year only on interfaces, and now i am finaly back to my decoding and encoding pipes.
Well i have 3 live sources that i encode in my current project :
1. Microphone
2. System mix via loopback
3. Direct3D RenderTarget
Currently all encodings are done via Software ( CPU ) and working correctly, but i still struggle with threading and encoding speed. The audio encodings are straight forward and besides mixing 2 streams with different sample rate there is no problem at all.
The live encoding of Direct3D surfaces however is very far from optimal. For Direct3D 9 surfaces my current encoding path is ok but still has to many copy actions in my opinion. My Direct3D 10 and 11 encoding well its working but .... horrible in terms of efficiency.
The problem is that for Direct3D 9 i can use MFCreateDXSurfaceBuffer but for Direct3D 10 and 11 i cant use MFCreateDXGISurfaceBuffer. I need to support Windows 7 so the latter function is out of question. Another problem is that in Direct3D 9 there are no formats that are not supported by MFCreateDXSurfaceBuffer but in Direct3D 10/11 well....some games have RGBA Format which is the only format that is not supported by MFCreateDXGISurfaceBuffer ( returns fail because of unsupported format, all other formats are working btw ... ).
To solve the RGBA Problem i wrote my own non-temporal store function via compiler intrinsics ( SSE2, SSE3, SSE4 and AVX tested ), basically an equivalent of MFCopyImage but with a Byte swap algorithm in it. In my older post i said i would invest in other technics because the current way does not satisfy me. Well since todays CPU's have also an iGPU and offering a Hardware MFT the best solution would be to encode with the Hardware Encoder directly from video memory.
At the moment i have only CPU ( Software ) encoding but i will update my program with "real" GPU encoding anyway. And with real i mean heavy OpenCL path for every GPU vendor with an own MFT implementation. But before i go that route i give it a last try here in the forum and a few days of search in the www.
So my question here again is :
Is it possible to decode/encode a Direct3D surface from vram with the Hardware MFT of the graphics card without any copy actions ?
My thoughts were that i could possibly use a Hardware MFT Decoder and link it as an upstream to a Hardware MFT Encoder with MFT_CONNECTED_TO_HW_STREAM as described here under "Handshake Sequence". It would be possible if a Hardware MFT Decoder would be capable of reading Direct3D surfaces from device memory. I might find that out next couple of days. With all the copy stages on my current CPU encoding path i will propably drop it all together and go directly for OpenCL.
Any help is welcome
regards
co0Kie