Kodi Community Forum
[WINDOWS] GPU assisted video decoding in XBMC for Windows via a custom DXVA renderer? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Feature Requests (https://forum.kodi.tv/forumdisplay.php?fid=9)
+--- Thread: [WINDOWS] GPU assisted video decoding in XBMC for Windows via a custom DXVA renderer? (/showthread.php?tid=33323)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


- BrokenCodes - 2009-05-30

You have that backwards
I'm rendering video in the gpu, and using layer 0 for secondary renders (controls, status etc) Problem I'm having is, with 32bpp, I'm masked off by 30 bits (2 colors) and it looks like shite.

24bpp shows nothing
16 bpp shows nothing
8 bpp shows nothing...


- BrokenCodes - 2009-05-30

Also, scren caps are black... Or I'd show one... I can do a cam shot if you like...


- natethomas - 2009-05-30

I don't really have a stake in the argument, but I would like seeing a screen shot, if only to say, "This is where Windows GPU decoding started."

Even a cam shot would be cool. It'd be documentary style.


- BrokenCodes - 2009-05-30

Trying to produce a screenshot is useless, output is just black... I will try to find the cables for my cameraphone... also, in order to test the last addons I am working on, still waiting for the Vidcard from Newegg.


- Meglivorn - 2009-05-30

Topfs2 Wrote:Just try screenshot, with any app not just printscreen a VMR9 enabled player in vista and it should fail.

Errr... I don't want to pretend I can do any programming or even understand most of the technical side, but about the screenshots:
http://i558.photobucket.com/albums/ss28/Meglivorn/screenshot.jpg
simple printscreen key, that's why on xnview from clipboard.
The video screenshot from the program always worked perfectly.

Vista Ultimate x64, EVR custom on MPC-HC.
My old MPC still on, I used VMR9 Windowed and all the same.


If I misunderstood something, and writing nonsense, than sorry.


- topfs2 - 2009-05-30

Meglivorn Wrote:Errr... I don't want to pretend I can do any programming or even understand most of the technical side, but about the screenshots:
http://i558.photobucket.com/albums/ss28/Meglivorn/screenshot.jpg
simple printscreen key, that's why on xnview from clipboard.
The video screenshot from the program always worked perfectly.

Vista Ultimate x64, EVR custom on MPC-HC.
My old MPC still on, I used VMR9 Windowed and all the same.


If I misunderstood something, and writing nonsense, than sorry.

Huh, how about that. Looks like I stand corrected, I never was able to do that when I used windows and all I've read about the subject tells me it's not possible Smile
Is that using DXVA? noticed the "Playing [DXVA]".

When a friend tried to write an application that did that he just got a black texture, no failure no nothing and it was meant as a safe guard against copying. DRM protection. Perhaps that was without EVR.

@BrokenCodes
Ah ok, now I get how your are trying to do it. If that works then cool, But how would you go about doing rendering stuff underneath the video? I mean for instance when not in fullscreen video, as it is now depth clipping is done in OpenGL and I think thats the case with VDPAU aswell, can't say for sure but motdk2 could probably tell if that is the case.


- BrokenCodes - 2009-05-30

I cannot get a screenshot (fullscreen maybe?) Always returns black image in clipboard.

As for the secondary renders, I'm trying to use d3d watermarking, with alpha set to 75%, and resize the video to fit... Still cannot figure out how to open the color depth masking.


- BrokenCodes - 2009-05-30

For those wondering HOW I'm doing this, the classes come with the Windows 2008 SDK, and the Vista SDK...

http://msdn.microsoft.com/en-us/library/ms697067(VS.85).aspx

The nice thing about this is the work is done by the OS, the hardest parts have all been done for us already. Control is done stream side, and all the features of DirectX are available to us, such as bloom, watermark, alpha, and colorspace adjust.

Code:
HRESULT GetVPService(
    IDirect3DDeviceManager9 *pDeviceManager,
    IDirectXVideoProcessorService **ppVPService
    )
{
    HRESULT hr;
    HANDLE hDevice;
    hr = pDeviceManager->OpenDeviceHandle(&hDevice);
    if (SUCCEEDED(hr))
    {
        hr = pDeviceManager->GetVideoService(
                hDevice,
                __uuidof(IDirectXVideoProcessorService),
                (void**)ppVPService
                );
        pD3DManager->CloseDeviceHandle(hDevice)
    }
    return hr;
}

Above creates the device for DXVA, and tells us what supported values are there for our consumption... and ties it to D3D as a layer seen in the handle
for hDevice.


Now, rendering a watermark via a blit is easy, but the depth mask is not straight forward...
Code:
HRESULT VideoProcessBlt(
  [in]   IDirect3DSurface9 *pRT,
  [in]   const DXVA2_VideoProcessBltParams *pBltParams,
  [in]   const DXVA2_VideoSample *pSamples,
  [in]   UINT NumSamples,
  [out]  HANDLE *pHandleComplete
);

the hard part is encoding our display as a DXVA compliant stream, so it can be blended...
Thats what I'm trying to finger out now...


Lookie here...

Code:
typedef struct _DXVA2_VideoSample {
  REFERENCE_TIME       Start;
  REFERENCE_TIME       End;
  DXVA2_ExtendedFormat SampleFormat;
  IDirect3DSurface9*   SrcSurface;
  RECT                 SrcRect;
  RECT                 DstRect;
  DXVA2_AYUVSample8    Pal[16];
  DXVA2_Fixed32        PlanarAlpha;
  DWORD                SampleData;
} DXVA2_VideoSample;


Closer... everyday I learn something new.


Last thing to do will be to add a fallback mode for when DXVA rendering fails... to use standard codecs.
Harder than SDL, but easier than people make it out to be...


- BrokenCodes - 2009-05-30

Of intersting note...

One of the new features in Windows 7, is Media Foundation Recorder...

Whats the point of DRM, if the layer in control of DRM allows you to record the DRM'd materials?

WTG Microshaft.


- Geeba - 2009-05-31

motd2k Wrote:At the sake of sounding like a bit of a prick. Bollocks.

Good input..... Huh


- motd2k - 2009-05-31

Geeba Wrote:Good input..... Huh

Likewise


- BrokenCodes - 2009-05-31

Feed the binary I will give you to the bollocks, then I'll give up the source when you figure out why acting like this makes people not want to help out...

Your clique is too clicked...

My Vid card will be here June 5th...


- althekiller - 2009-05-31

motd2k is just dishing out what he took Smile

Put up, then you can give it back to the next guy Wink


- BrokenCodes - 2009-05-31

Maybe its just me, but it feels like people here like to say "I call bullshit" until proof arrives... which is to entice me to finish my project? What kind of enticement is that? Makes me want to keep my developments to meself...


Strange clique indeed...


- Freddo - 2009-06-01

Sorry if you feel that way brokencodes, I don't know if you've been lurking the forums at all before you started posting but, well basically DXVA is an extremely longstanding feature request and a webrowser is an even older feature request.

One person coming along and saying they're not only doing both but have infact already done so and are just polishing up is likely to set off lots of veterans bullshit alarms. I hope that explains some of the skepticism for you. Of course it also means massive Kudos from the very same people if you can back up your claims.

Personally I hope your not just screwing people around, and if you've done what you say you've done your the John Carmack of HTPC software lol.

Like Gamester17 said, Happy Coding!