[FFMPEG] Fix for artifacts with ATI cards and DXVA2 decoding
#16
(btw, the dxva2_mpeg2.c code *does* check that the buffer is big enough: if (size > end - current) {
av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream");
break;

Anyway, that's not the problem. My guess is that it somehow doesn't send enough slices ...
Reply
#17
Ok, I found a bit of time today and .... I have solved the bug in the MPEG DXVA code ! Smile

Exactly as I suggested, the hardware decoder is decoding less slices than the software decoder. This difference is caused by the fact that the hardware decoder limits the maximum amount of slices ! It's defined as follows:

#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
#define SLICE_MIN_START_CODE 0x00000101
#define SLICE_MAX_START_CODE 0x000001af

0x1af0-0x101 +1 = 175 slices maximum.

It just stops there. The software decoder goes beyond, because there ARE more slices than 175 Smile You can easily verify by letting the hardware decoder output the number of decoded slices (will always be 175) and let the software decoder output the decoded slices (will be more than 175).

If you simply set the MAX_SLICES constant in dxva2_mpeg2.c to for example 220, the testvideo's posted below decode perfectly correct Smile I haven't investigated if just simply increasing this value might have negative consequences (eg yield problems) in other situations, I guess that should be looked into before submitting the patch. But I'm calling it a day for now Wink
Reply
#18
wow,

Aren't you a smart cookie! hahaha, this is great news! hopefully this yeilds no problems to current playback, so we can get it merged with main branch. Can't wait to see this fixed and merged, along with DXVA de-interlacing, then PVR video playback experience will be fulfilled by all for future releases.

Thanks a million for looking into this!

make sure those XBMC developers know about this so it gets picked up :-)

Loggio.
Reply
#19
@thespecialist:

I only can say WOW! Smile

I only had time for a quick look at ffmpeg's code and now you already solved it.

Good job!
Reply
#20
@thespecialist:

You may want to open a new thread for this patch for collecting bug reports (if any) and the corresponding ticket at track.

This way we can be sure the patch will be included in a next release and everybody enjoy it.
Reply
#21
Thanks guys Smile I don't have much time today, but I'll try to look at it today or tomorrow. I think they just inserted that check because they figured that if there are more slices than there are startcodes, something must be wrong Smile Maybe the check just should be deleted; the software decoder doesn't check for it and in some video's, like the ones posted below, some startcodes appear twice in the stream, hence you'll get more slices than different startcodes. Anyway, like said, I'll take a look at it later and indeed post a new thread and ticket for it.
Reply
#22
Hi Guys,

I'm not sure if my problem is related to this one, but it sure seems like it. Recently I've started ripping my Blu-Ray's and storing the ripped files in an MKV container. For the most part this seems to work okay, but there are a few video's I'm having problems with - one of them being Battlestar Galactica the Miniseries Pt1 - which just so happens to be a VC1 stream!

I don't get the green screen issue with this video - I do with This is England which is also VC1 - instead with BSG Pt1 it crashes at 5m 01s everytime without failure.

My HTPC is an E5700 Pentium with an HD 5550 graphics card doing the decoding. I've tried the BSG video with DXVA off and on and it crashes 100% consistently each time.

In my last few attempts I turned debugging on and you can see the debug file here: http://www.mediafire.com/file/hkce6fb5jbqtu12/xbmc.zip

I have tried the DLL file 'thespecialist' recommended here: http://forum.xbmc.org/showthread.php?p=8...post818486 but this still crashed the file consistently too.

I don't know if it's worth noting, but with this is England I was getting a crash when I included the directors commentary audio stream - when I stripped it out of the MKV the crash no longer happened, but the 'green flicks' still did.
Reply
#23
craigweb Wrote:Hi Guys,
I don't get the green screen issue with this video - I do with This is England which is also VC1 - instead with BSG Pt1 it crashes at 5m 01s everytime without failure.
Crashes ? Do you use the DLL I posted with the official Dharma release ? That DLL is only compatible with that official release, NOT with the nightly builds. A crash sounds like you're trying to use the DLL with a nightly build.

If you want it to work on the nightly build, without having to compile yourself: Isidrogar shared an installer based on the latest nightly builds in his topic for dxva anti-aliasing. That should include my patch as well.

If you're confident you did everything right, then please post a cutout part of the video so I can look at it.

DGSplit1.2: http://neuron2.net/dgsplit/dgsplit12.zip should work to cut he video.

BTW: "This is England", I love that movie Wink
Reply
#24
thespecialist Wrote:Crashes ? Do you use the DLL I posted with the official Dharma release ? That DLL is only compatible with that official release, NOT with the nightly builds. A crash sounds like you're trying to use the DLL with a nightly build.

If you want it to work on the nightly build, without having to compile yourself: Isidrogar shared an installer based on the latest nightly builds in his topic for dxva anti-aliasing. That should include my patch as well.

If you're confident you did everything right, then please post a cutout part of the video so I can look at it.

Hi thespecialist. Thanks for the reply - to clarify:

I'm using the official 10.1. With and without your DLL file the BSG S00E01 mkv crashes @ 5m 01s. Actually I'm not sure crash is the right word as the video just cuts out - much as it would if a file reaches the end of it's run time.

I can happily suppy you with the first couple of chapters of this file, but I suspect it would probably be a couple of GB. First - how to I do this? Second - where could I store a file of this size?

Thanks again - Craig
Reply
#25
craigweb Wrote:Hi thespecialist. Thanks for the reply - to clarify:

I'm using the official 10.1. With and without your DLL file the BSG S00E01 mkv crashes @ 5m 01s. Actually I'm not sure crash is the right word as the video just cuts out - much as it would if a file reaches the end of it's run time.

I can happily suppy you with the first couple of chapters of this file, but I suspect it would probably be a couple of GB. First - how to I do this? Second - where could I store a file of this size?

Thanks again - Craig

Are both that BSG 00e01.mkv and "This is England" using VC1 codec ?

You can split WMV/VC1 with 'DGsplit' (see my link below in my previous post). For splitting MKV I'd suggest http://www.solveigmm.com/en/products/avi-trimmer-mkv/

As you said the 'crash' happend with and without the patch, it seems it doesn't have to do with my patch at all. However I would still like to see what the problem is and see if I can fix it Smile
Reply
#26
Oh, and lastly, does the crash happen when you switch off DXVA ?
*EDIT* ah, I just looked at the debug log, that MKV contains indeed VC1. Like said, since the crash happens with and without my dll, it must be some other issue, but I'd like to look at it anyway. Would be nice if you could cut out the problematic part of the video. And please test without DXVA, It think this might have nothing to do with the decoding (but for example with the parsing of the MKV container, so then you should get the same behaviour without DXVA enabled).
Reply
#27
Just looked at your debug log, it looks like a problem in your MKV container. The Matroska code can't parse it.

*EDIT* Again, this would indicate that you'll have the problem also without DXVA. If so, please see if the video plays with commercial players like PowerDVD. If you get the same problems, you'll know that your video is just messed up.
Reply
#28
@craigweb:
Looking at your logs and your description of your problem I agree with thespecialist. The problem doesnt't seem to be related with DXVA2 and is more likely to be caused by an error in MKV container.

As thespecialist says test the problematic files with other players like PowerDVD or MPC-HC to confirm it.
Reply
#29
Hi, I'm having artifacts on some h.264 videos if DXVA2 is enabled

I've installed XBMC ver 10.1, is this patch intended for that version? I get an error if I replace the dll file and attempt to play a h.264 video.

If I attempt to resume playback from some point in a previously started video I don't get an error massage but nothing happens.

GPU: Radeon HD 2600 pro, latest Catalyst drivers, windows 7 64 bit, q6600.

Thanks
Reply
#30
The patch/dll only must be used with lastest HEAD git revisions.
Reply

Logout Mark Read Team Forum Stats Members Help
[FFMPEG] Fix for artifacts with ATI cards and DXVA2 decoding0