[PATCH] Hardware deinterlacing for both software and DXVA2 decoded material

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Voyager Offline
Team-Kodi Member
Posts: 356
Joined: Apr 2010
Reputation: 5
Location: Belgium
Post: #31
isidrogar Wrote:@Voyager-xbmc, @thespecialist:

Thank you for your help here.

It seems the problem is more complicated. I have tested a DVD with a still menu image and when you navigate into DVD menu pages the background is mixed with last and new page.

This is because the processor is trying to deinterlace with totally different backward reference frames. The same occurs in your videos but in that case the "last page" doesn't exit and a black image is shown.

With this information any solution based in pts==0 will not always work. The a11559's patch is probably working because it defaults to "none" deinterlacing method or you have this selected. Can you please confirm the framerate is not doubled pressing "O" in still menu? Can you also confirm a11559's behavior with a forced deinterlacing method to "Best available" (you must have double framerate in this case)?

To avoid the problem in my code for now you can select "Auto" deinterlacing method as it will properly deinterlace when needed. Anyway I will keep working in a solution for the case you have forced deinterlacing.

Thanks for this. A couple of comments: the a11559 patch wouldn't actually do anything when playing software decoded (dvd) materials. The unfortunate thing about "auto" is that it doesn't always work correctly with some dvd material that incorrectly reports its frame interlacing type. I have tested my problem dvd with "auto" and "best available". The only difference I notice is a bit of flickering (because of my own code change re. pts==0 I proposed above). Pressing O shows fr:25.000 each time (so also with "best avail").

Regarding pts==0 as an indication of stills, I'm curious why wouldn't it always work?
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #32
Ok, the issue indeed only happens with ISO's (where I dont' get DXVA2 decoding anyway). If I then select 'best available' or 'best available inverted' I get a black screen. The other options (bob etc) work.

When I unpack the ISO and play the VOB files, everything works ok (I get both DXVA2 decoding and the 'best available' options work ...

My guess is that when the ISO problem is resolved, your patches will works as well.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #33
BTW, to make it more clear:
When I unpack the ISO and play the video directory, it's of course the same issue (no DXVA2 decoding and blackscreen on 'best available'). When I play the VOB files, everything is ok.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #34
And some MORE testing Smile I have several ISO's. None decode with DXVA acceleration (like described before). However, some DO work with interlace 'best available' and some don't (blackscreen). Now, the debug log of those last video's says:

18:45:33 T:3292 M:786759680 ERROR: DXVA - failed executing m_process->VideoProcessBlt(target, &blt, samples.get(), count, NULL) at line 1362 with error 80070057
18:45:36 T:1092 M:787947520 ERROR: CDVDPlayerVideo::OpenStream - Invalid framerate 4, using forced 25fps and just trust timestamps

*EDIT* and indeed, that last DVD has both VOB's at 25 fps and VOB's at 29.97 fps. So it seems that's the source of the problems ....

What are you guys going to do ? If you are busy with other stuff, I can try to debug and fix DXVA2 decoding for ISO's/DVD structure's. But if you want to do it, that's perfectly fine as well. Just want to make sure we're not doing the same thing.
(This post was last modified: 2011-06-19 19:05 by thespecialist.)
find quote
Voyager Offline
Team-Kodi Member
Posts: 356
Joined: Apr 2010
Reputation: 5
Location: Belgium
Post: #35
thespecialist Wrote:What are you guys going to do ? If you are busy with other stuff, I can try to debug and fix DXVA2 decoding for ISO's/DVD structure's. But if you want to do it, that's perfectly fine as well. Just want to make sure we're not doing the same thing.

That would be a great addition to DVD playback. I don't have plans on debugging/fixing this, but I'll be happy to test anything you come up with.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #36
Voyager-xbmc Wrote:That would be a great addition to DVD playback. I don't have plans on debugging/fixing this, but I'll be happy to test anything you come up with.

Ok, if isidrogar isn't planning to do so, I will look into this next week.

Furthermore, I've tested the interlace patches with quite a few ISO's and DVD structures; it turned out it worked perfectly with almost all of them, except those 2 I tested first. They contain a mix of PAL and NTSC content, I think that's why it goes wrong. However, as I think that is outside the specs, I don't think this is really a problem.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #37
Well, thinking of it, now that I know what the source of the deinterlacing problems is (dvd outside specs instead of the lack of dxva2 decoding), I don't really *need* dxva2 decoding for dvd's anyway (Zacate is fast enough for it). So, dunno yet if I want to invest time into this ... If nobody wants to do it though, I'll probably take a look anyway next week, but no promises ... Invested quite a bit more time than I had planned into fixing DXVA-VC1, also got other stuff to do ...
find quote
isidrogar Offline
Member
Posts: 59
Joined: Jun 2011
Reputation: 1
Location: Spain
Post: #38
Just to get all things clear and don't mix anything, a few reminders:

- DXVA deinterlacing with software decoded content will NEVER work with Dharma nor a11559's (thus you will never get "Best available" option) because it isn't implemented. This is the reason why I made my patch.
- You only will get DXVA decoding (note the word DECODING) for DVD content if your card supports MPEG2_VLD bitstream decoding. Only a few cards can do this.
- I don't now if there is a bug in DVD ISO/VOB parsing, but if it is really there I have no plans for looking at it for now. I want to focus in fixing "black screen" bug for DXVA. Using your information and my tests I think this is only related to trying to present and deinterlace an incorrect still progressive frame detected (or forced) as interlaced.

Anyway thank you so much guys for your posts. All these reports and future are welcome.

I hope to fix the bug soon...
find quote
isidrogar Offline
Member
Posts: 59
Joined: Jun 2011
Reputation: 1
Location: Spain
Post: #39
Voyager-xbmc Wrote:Thanks for this. A couple of comments: the a11559 patch wouldn't actually do anything when playing software decoded (dvd) materials. The unfortunate thing about "auto" is that it doesn't always work correctly with some dvd material that incorrectly reports its frame interlacing type. I have tested my problem dvd with "auto" and "best available". The only difference I notice is a bit of flickering (because of my own code change re. pts==0 I proposed above). Pressing O shows fr:25.000 each time (so also with "best avail").

Regarding pts==0 as an indication of stills, I'm curious why wouldn't it always work?

@Voyager-xbmc
I said pts==0 will not always work because it only will fix "black screen" at the beginning of the stream. I have tested other DVDs and when you navigate across the menus with diferent background still images the current is incorrectly presentes as previous, and in this case pts!=0.

One more generic workaround must be implemented. I'm looking at it...
find quote
loggio Offline
Fan
Posts: 593
Joined: May 2010
Reputation: 6
Post: #40
isidrogar,

I've tested Margro's last two pre-eden builds of his PVR branch located here - http://www.scintilla.utwente.nl/~mar...ld.html#master

They contain a11599's De-interlace patch.

De-interlace is working great with pvr... However i noticed an issue that when watching live tv and pushing 'C' to bring up the channel list, the video stutters and drops a lot of frames... I'm not sure if this is a problem with the Confluence skin or his patch.

But i'm willing to bet that the problem is probably the same when using your patch.

I realise these are pre-releases and are buggy, but i can confirm that the problem only exists when De-interlacing is enabled, if you changed video de-interlace settings to 'none' the problem goes away... This leads me to believe it's not a skin related issue.
So it's worth addressing.

Just thought maybe you could test your patch with Margro's git source and have a look to see if the issue is skin related, or a bug with the patch?

Cheers,
Loggio.
find quote
isidrogar Offline
Member
Posts: 59
Joined: Jun 2011
Reputation: 1
Location: Spain
Post: #41
After many tests I have found the best way to fix "black/mixed screen" problem with a generic solution.

It is based on detecting when a still image is presented cheking if there is repeated presentation time, and in this case set SampleFormat of the samples to DXVA2_SampleProgressiveFrame. The processor then renders the frame using only the last (correct) surface.

I'm at work now, but I'll post a compiled version soon for getting your feedback.
find quote
isidrogar Offline
Member
Posts: 59
Joined: Jun 2011
Reputation: 1
Location: Spain
Post: #42
loggio Wrote:isidrogar,

I've tested Margro's last two pre-eden builds of his PVR branch located here - http://www.scintilla.utwente.nl/~mar...ld.html#master

They contain a11599's De-interlace patch.

De-interlace is working great with pvr... However i noticed an issue that when watching live tv and pushing 'C' to bring up the channel list, the video stutters and drops a lot of frames... I'm not sure if this is a problem with the Confluence skin or his patch.

But i'm willing to bet that the problem is probably the same when using your patch.

I realise these are pre-releases and are buggy, but i can confirm that the problem only exists when De-interlacing is enabled, if you changed video de-interlace settings to 'none' the problem goes away... This leads me to believe it's not a skin related issue.
So it's worth addressing.

Just thought maybe you could test your patch with Margro's git source and have a look to see if the issue is skin related, or a bug with the patch?

Cheers,
Loggio.

Hi Loggio,

I'm planning to create a pvr branch in my git with deinterlacing patches and opdenkamp's fork. I will post the installer for testing when ready. We then can check if this problem appears here.
find quote
a11599 Offline
Team-Kodi Member
Posts: 304
Joined: Sep 2010
Reputation: 3
Location: Budapest, Hungary
Post: #43
Wow, quite a lot of movement here. Smile

Loggio:
What are your hardware specs? I recently realized that low-end hardware like the ION just don't cut with advanced video processing like deinterlacing or advanced scalers. XBMC also renders its own GUI and I have seen stutterings on ION with some more advanced processing when subtitle/OSD is to be rendered besides the video (@1920x1080).

With DXVA deinterlacing your video will become 2x its original framerate which means XBMC will also render its OSD at 2x framerate. This is 50 Hz for PAL or ~60 Hz for NTSC. Simply your hardware might not be able to render the GUI at this framerate. If you press "O" during playback you should see the playback framerate not being able to keep up with the video, hence you are seeing dropped frames.

It's not necessarily the GPU power, in my case for example OC'ing RAM of my ION system (DDR2-800 dual channel) mitigated the issue, so the ION is clearly starving for memory bandwidth - at least with DDR2 boards.

My patches (source code) :: Windows installer builds
These builds are unofficial! If you find a bug, make sure it is also present in a recent official build and you can reproduce it before filing a ticket.
find quote
loggio Offline
Fan
Posts: 593
Joined: May 2010
Reputation: 6
Post: #44
A1159,

I'm not sure this is the problem... I forgot to mention that I can bring up ANY other osd with deinterlace enabled and I get no drops what so ever, it's only when I bring up the channel list... (which isn't any different to other OSD's)

I can even exit full screen mode and browse xbmc with little to none frame drops.

If I disable dxva and watch tv and enable de-interlacing, then bring up the channel list it works fine with no frame drops.

dxva deinterlacing using your patch, drops frames if your refresh rate is set below 50hz. I had mine set at a cutom 47.956hz with modified timings, I found this achieved smooth 1080p playback with 23.976fps mkv's

However after applying your patch i couldnt use this refresh rate, as i would get frame drops. So I moved back to 60hz and tv playback worked great with no frame drops.

As I said, it's only this channel list that's causing mass frame drops... Maybe confluemce isnt applying it as 'background' loading or something... I have no idea.

I just need someone to look at it! Hehe

Cheers,
Loggio.
(This post was last modified: 2011-06-20 22:25 by loggio.)
find quote
Voyager Offline
Team-Kodi Member
Posts: 356
Joined: Apr 2010
Reputation: 5
Location: Belgium
Post: #45
@isidrogar: as mentioned in the other thread, we have noticed that Zoom does not work anymore above 1.0x. Some older "widescreen" dvds which were actually recorded as 4:3 with black bars cannot be zoomed to fit screen. Above 1x they turn "all black" and only the overlays continue to appear.

EDIT: this appears to happen only if scaling method = DXVA. As a matter of fact this is the only scaling method that reasonbly works ok on my ION, with the deinterlacing going on we are reaching the limits of the hardware due to the double framerate (even on Automatic). Would it be possible to use DXVA deinterlacing in combination with DXVA HQ scalers from a11559 patch?

EDIT2: Actually I'm already using the DXVA hq scalers and they are turned on. I'm not sure whether they actually work or not. Now if they are working, it could also be that the combination of BOTH DXVA deinterlacing and DXVA scaling is to heavy on the ION chip? I will try to deactivate the HQ scaler and just try software scaling instead. One other thing I noticed : I don't have the bi-linear scaling option anymore, which was the "lightest" one of all.
(This post was last modified: 2011-06-21 09:21 by Voyager.)
find quote
Post Reply