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

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #16
isidrogar Wrote:I have uploaded a new installer version with all the fixes for bugs found in previous posts and also including your patch for VC-1 and mine for H264. Smile
Cool, thanks for compiling this, must be the ultimate XBMC package for people who are dependent on DXVA2 Smile
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #17
isidrogar Wrote:@Voyager-xbmc
Thanks for your comments.

Yes, the problem about "black still image" is generated because the processor must have enough forward and backward reference frames to render the image. My code differs from a11559's in that the Render method verifies it has all the frames.

Obiously this may cause problems in case there is only one frame to show. Your workaround about adding the same surface is a good idea but the problem it only will work in case only one backward refererence frame is needed.

I have updated the code with a more generic solution where the Add method do all the work:
Code:
do {
      m_time += 2;
      
      m_samples[m_index].Time = m_time;
      m_samples[m_index].SrcSurface = source;
      
      m_index = (m_index + 1) % m_size;
  }
  while (m_samples[m_index].SrcSurface == NULL);

Hmmm... I just installed your installer and it still has the problem: black screen after playing an interlaced ISO. It happened only with the 3rd interlaced video I tried though... Video played fine with a11559's patch. If you need any more info or anything at all, just let me know.
find quote
Voyager Offline
Team-XBMC Member
Posts: 347
Joined: Apr 2010
Reputation: 5
Location: Belgium
Post: #18
thespecialist Wrote:Hmmm... I just installed your installer and it still has the problem: black screen after playing an interlaced ISO. It happened only with the 3rd interlaced video I tried though... Video played fine with a11559's patch. If you need any more info or anything at all, just let me know.

could it be that there is a stream change right before the still, and that therefore the m_samples array ISN'T empty, so that the fix doesn't work?

I've compiled a version of the code that has this in it: download here
Code:
if (pts==0) {
    CLog::Log(LOGDEBUG,"DXVA - deinterlace encountered still image pts==0 - clearing samples array");
    for (unsigned s=0; s<m_size; s++)
        m_samples[s].SrcSurface = NULL;
  }

(same as before)
    picture->proc = this;
    picture->proc_id = picture->iFlags & DVP_FLAG_DROPPED ? 0 : Add(surface);    
    picture->format = DVDVideoPicture::FMT_DXVA;

Upon pts==0, it will clear the samples array to avoid any black still after black video.
(This post was last modified: 2011-06-19 09:20 by Voyager.)
find quote
isidrogar Offline
Member
Posts: 59
Joined: Jun 2011
Reputation: 1
Location: Spain
Post: #19
Swifty Wrote:@isidrogar

You mentioned in your first post that you are following the PVR branch of XBMC - are your installers based on the PVR branch ?

I quickly took a look at one earlier today but it didn't appear to have any LiveTV option Confused

Cheers!

Hi Swifty,

Yes I'm following PVR branch but the installer is only compiled againt master HEAD. I want to fix all the bugs before merging it with PVR.

When the patch become stable I will create a new PVR branch in my GIT and its installer with all things together Smile.
find quote
isidrogar Offline
Member
Posts: 59
Joined: Jun 2011
Reputation: 1
Location: Spain
Post: #20
@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.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #21
Ok, will try the things you asked for. Just finished testing the solution that voyager posted, unfortunately it didnt make any difference.

Furthermore, I switched of DXVA2 in the system menu, that didn't make any difference, but I guess that was to be expected. When I startup the video, it uses DXVA deinterlacing anyway and that's the problem. More precise:

15:13:20 T:3256 M:704425984 ERROR: DXVA - failed executing m_process->VideoProcessBlt(target, &blt, samples.get(), count, NULL) at line 1362 with error 80070057
15:13:31 T:3256 M:706027520 ERROR: Previous line repeats 444 times.

It's not the decoding, it's the rendering (processblt), so that's why it doesnt matter that I switch off DXVA2 in the system menu.

Will try the things you asked for now.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #22
BTW, even when I switch interlaced to none, in your build, and I see that the framerate isnt' doubled, I still only have a black picture ! It's still set to DXVA scaling, but I can't turn that off, might that be the problem ?

I'll now check a11559's patch.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #23
LOL, I know what it is Smile

The thing is, that your patch tries to invoke DXVA stuff when playing a regular DVD. The a11559's patch doesn't even show any trace at all of DXVA when playing such a DVD.

If I try to play a 1080i mpg, THEN both of your patches use dxva deinterlacing correctly.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #24
I should formulate it better: the problem is ISO Smile

The a11559 patch doesn't use DXVA2 for ISO's, yours does and that's where it goes wrong.
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #25
Hmmm, actually, it's not even that it seems .... I just found an ISO that doesnt play on a11559's patch AND now I just even found a regular .vob that doesnt play on his patch .....
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #26
I'll try on my other system and I'll also see if I can cut out some part of the VOB to post it here.
*EDIT* weird stuff, I found that the VOB plays fine on a11559's patch, but there is one of my iso's that problematic on his patch as well and if I play that iso first and THEN any other VOB, THEN none of the VOB's play anymore ... So it does seem it definately has to do something with iSO.

Furthermore, with some DVD ISO's his patch *does* use dxva decoding and for others it doesnt, that's weird anyway isnt it ?
(This post was last modified: 2011-06-19 16:06 by thespecialist.)
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #27
It's getting even weirder ! the ISO's that used DXVA2 before on his patch didnt after the last reboot ! I then tried an MKV and I just got a black screen on that ! I couldnt even quit the video anymore ...

Going to delve deeper into this, wtf .... Smile
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #28
Ok, I know a little more. I reverted back to Dharma 10.1 and guess what, that ISO still didnt play ! It then popped into my mind that I had changed some DVD options and yep, that was it Smile I deselected 'attempt to skip introduction before DVD menu' and the video played ! Pfffff... that sh*t was messing up my tests Smile

Now, going to try yours and a11559' patches again Smile
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #29
Ok, still on Dharma10.1 I tried to play ISO's again. At least, after deselecting that DVD option, they all play. However (!!) I don't get any DXVA2 acceleration ! The debug log:

http://pastebin.com/4K6zqEs2

ProcessBlt fails !?!

Hmmm ... I installed the new catalyst (11.6) yesterday, maybe that's the problem here .... Going to revert to good old 11.4 and see if that changes anything .... But then again, thinking of it, I dont think I even checked before while playing DVD's if it was DXVA2 accelerated, so it might not even be a driver issue ... going to do some more testing Smile

Anyway, it seems all this isn't even related to your patches, sorry for cluttering up your thread, lol Wink Will let you guys know once I find out more.

*EDIT* Same issue on catalyst 11.4 ... seems like a bug in the official Dharma release (and later), going to investigate more ...
*EDIT2* No it's not the *same* issue on 11.4. On 11.4 XBMC doesnt even attempt to use DXVA for DVD's !?!? Again, investigating more ..
(This post was last modified: 2011-06-19 17:31 by thespecialist.)
find quote
thespecialist Offline
Senior Member
Posts: 126
Joined: Mar 2007
Reputation: 0
Post: #30
Ok, There were several issue's here:

1) That option in the system/video/dvd menu that tries to skip intro's, that's definately buggy, should be switched off
2) catalyst 11.6 gives me process blt errors, 11.4 is fine
3) There's no DXVA2 decoding support for DVD ISO's it seems. It just doesnt even try to select it, so I think there's a bug there

Then, your patches:
There's still an issue with your patch, isidrogar. When I try to play a certain ISO and I have the deinterlace default to 'best available', i get the black screen. When I then switch while playing the video, to bob etc, and then back to 'best available', it works *EDIT* nope, it still doesnt work that way*! This issue doesnt seem to happen when I try to play VOB files, so I think it might be correlated with that above issue in ISO's ....

Will investigate more Smile
(This post was last modified: 2011-06-19 18:30 by thespecialist.)
find quote
Post Reply