VC-1 interlaced B-frames support by updating VC-1 related files closer to ffmpeg master #96

Closed
wants to merge 60 commits into
from

Projects

None yet

5 participants

@JeroenDeKleijn

I rebased the pull request which I submitted to the OpenElec master as you suggested Fritsch.

This adds the missing B-frame support in the case of hardware acceleration, for software B-frames are still disabled.

and others added some commits May 28, 2012
@FernetMenta VideoRenerers: add buffering 7fa1cf8
@FernetMenta linuxrenderer: delete all textures on reconfigure e32f28f
@wsnipex wsnipex configure: add --enable-pvraddons-with-dependencies switch
for intree building of PVR Addons
1687a45
@FernetMenta drop frame counter in application, ask render manager instead ca3b4cd
@FernetMenta videoplayer: adopt lateness detection and dropping to buffering 448f4dc
@FernetMenta videoplayer: update frametime, it might change due to fps detection cc7a858
@FernetMenta videoplayer: give streams with invalid fps a chance for fps detection 884eef3
@FernetMenta dvdplayer: allow rewinding at end of stream, do a seek after rewind 88ba9cc
@FernetMenta vdpau: redesign 1e0cf70
@FernetMenta vaapi: adopt to buffering in renderer a808709
@FernetMenta video player: present correct pts to user for a/v sync (after bufferi…
…ng in renderer)
5340d7a
@FernetMenta linuxrenderer: drop method RenderMultiPass 65c5fdc
@FernetMenta linuxrenderer: implement progressive weave for vdpau 13be4f0
@FernetMenta X11: add SDL joystick until we have a better solution 49a67cb
@elupus elupus X11: factor out code handling device reset notification 5701b6c
@FernetMenta X11: move xrandr events to WinEventsX11 9d9ff41
@FernetMenta X11: ditch SDL for video and window events 04a08a1
@FernetMenta X11: Add xbmc icon 63af7b4
@FernetMenta xrandr: remove method RestoreState 3ea8690
@FernetMenta xrandr: observe orientation 2d9d979
@FernetMenta X11: remove all DefaultScreen and RootWindow macros 5b3717f
@FernetMenta X11: fix multi-head setups f17ec66
@FernetMenta xrandr: allow getting info for multiple screen's
Refactored by: Joakim Plate <elupus@xbmc.org>
f2de871
@FernetMenta X11: recreate gl context after output has changed 577ce2c
@FernetMenta X11: fix video calibrations bfa54ce
@FernetMenta X11: remove all DefaultScreen and RootWindow macros (VideoRefClock)
Note this is on a separate display connection.
4ec5007
@FernetMenta X11: deactivate screen saver on startup 56b8759
@FernetMenta X11: hook video reference clock in windowing 36ea7f9
@FernetMenta X11: change method of going full-screen f9716ab
@FernetMenta videorefclock: temp deactivate of nv settings 5185655
@FernetMenta add missing keys to xbmc keytable 6beb532
@FernetMenta X11: reset key repeat and key modifier on focus lost and gain 44699dc
@elupus elupus X11: replace custom utf8 to unicode with charset convertor (squash to…
… x11 events)
3f3045e
@elupus elupus X11: fixed invalid usage of sizeof() (squash into x11 changes) 9678534
@FernetMenta X11: fix icon texture after cc5ed3c e923d21
@FernetMenta X11: check for window manager 0864776
@FernetMenta X11: dont set window on xrandr if no mode available effc96e
@FernetMenta X11: fix crash after a resolution change on startup 6efa485
@FernetMenta videorefclock: ask graphics context for refresh rate 1730dcb
@FernetMenta X11: lock graphics context in NotifyXRREvent bd6dd91
@FernetMenta ffmpeg: add xvba hwaccel 91d1759
@FernetMenta xvba: add decoder 995b65f
@FernetMenta dvdplayer: observe pts counter overflow 804ccfb
@FernetMenta ffmpeg: add av_find_default_stream_index to interface 774e19f
@FernetMenta dvdplayer: avoid short screen flicker caused by unnecessary reconfigu…
…re of renderer
4262cf6
@FernetMenta xvba: do not use vaapi if xvba is present 1ae62b5
@FernetMenta vdpau: advanced settings for auto deinterlacing 1b2db77
@FernetMenta dvdplayer: correct determination if video is playing 4c40ca0
@FernetMenta rendermanager: fix stuttering in non full-screen mode, squash to add …
…buffering
3450d8e
@FernetMenta rendermanager: forgot to set flip event if buffering is not used b624c05
@FernetMenta vdpau: fix small mem leak fa18e9d
@FernetMenta xvba: do not render if there is no valid texture 3042978
@FernetMenta player: fix rewind 9287a18
@fritsch fritsch xvba: do not create decoder for surfaces larger than width 2048 or he…
…ight 1536
41e2060
@fritsch fritsch xvba: add string for available decoders - we are important so make su…
…re we are there
c83cd3a
@fritsch fritsch xvba: revisit Artefacts. There are more broken video files out there 22a3b26
@FernetMenta xvba: reactivate accidently disabled IsDecodingFinished b4bed1f
@FernetMenta xrandr: fix query for multiple screens 38f0f6e
@FernetMenta X11: add debug log to print out refresh after xrr event fb20782
Jeroen VC-1 interlaced B-frames support by updating VC-1 related files close…
…r to ffmpeg master.
69f74ed
@fritsch

@JeroenDeKleijn:

Thank you very much for this work.

But, in order to get that one stepwize upstream, it would be good if you could split the commits. What you currently have for xvba-vc1 must be separated from the other commits, cause they have a different destination and need to be stored separately when a upstream rebase /merge with ffmpeg happens. Normally xbmc upstream stores the specific ffmpeg patches also in patchfile form to not loose track.

I also think there will be some discussion on your xvba-vc1 changes.

@FernetMenta: What do you think is the easiest way to get that feature on the right track?

@FernetMenta
Owner

As you suggested, this huge commit has to be split into manageable chunks:

  • backports from ffmpeg
  • additional work to ffmpeg
  • changes to xvba code in ffmpeg
  • changes to xbmc
@JeroenDeKleijn

Maybe the first question to ask is if it is not better to wait until XBMC goes to a newer branch of ffmpeg. This all depends of course when XBMC goes to a newer branch.

So if I understand correctly you want two commits. One with the changes to the xvba-vc1.c file and one with all the other changes?

The changes to the xvba-vc1.c I can explain. Looking at how the interlaced support was added for dxva2 in commit FFmpeg/FFmpeg@b87ff34#libavcodec/dxva2_vc1.c
I saw the ´!s->first_field´ was changed to ´v->second_field´. I just copied this as I saw the second_field was used all over the vc1 code and not the first_field parameter.
The other changes to xvba-vc1.c are strictly not necessary, but are inspired by ffmpeg-0.10.6-0020-dxva-vc1-Take-BI-into-account-for-forward-and-backwa.patch. The behaviour what was fixed here for dxva seems not to be fixed in the xvba case. I do not know what problem this ffmpeg patch exactly fixes, but I do not see a difference. I hoped it solved the remaing blocking artefacts since they seem to be related to using wrong reference frames.

@JeroenDeKleijn

@FernetMenta

looking at your points basically everything is backporting changes made to the vc1 related files in ffmpeg + the ''v->second_field' thing in the xvba-vc1.c file. I did not make any changes myself to the FFmpeg code or to xbmc.

Perhaps the commit could even be smaller, because I think a lot of the changes to the vc1 ffmpeg files are only for software decoding which is not interesting for the XVBA case. But since I have no idea what changes exactly influence the hardware decoding part I just diffed the vc1 related files completely.

@fritsch

@JeroenDeKleijn:
If you did not have to "port" too much, it could be a good idea to reference the upstream commits, that then can be merged in, so in case there is an update - those come for free.

And concerning your xvba-vc1 change. I don't like the the switch case to if transformation as there are side effects. The second_field seems reasonable, as this just uses the new functionality, we get with the new ffmpeg vc1 deinterlace features.

@JeroenDeKleijn

@fritsch

The problem with using the upstream commits is that ffmpeg made changes to function names and enumerations. For example all the CODEC_IDs are AV_CODEC_ID and some function named got 'ff_' in front of them. Perhaps it is not a problem, but I have no idea how these kind of interface changes are handled in the whole upstream story.
That combined with my lack of knowledge of what code effects the hardware acceleration I just diffed all the vc1 related files and made sure the enumerations kept there ffmpeg 0.10 branch names.

@FernetMenta
Owner

I think you are right, backporting all the ffmpeg changes is not worth the effort because we will upgrade within 2 months or so. In the meantime we can test with external ffmpeg.

@JeroenDeKleijn you still see artifacts, right. I think this is because xvba does not handle field interlaced vc-1 correctly, none of the decoders does. We need to transport this info to xvba when it creates the session. Each field needs its separate video surface.

@JeroenDeKleijn

@FernetMenta

Yes, I see the same artefacts when using XVBA both with and without my changes. My changes don't solve this. The strange thing is that they are not visible with DXVA acceleration in MPC-HC. However when using XBMC on windows with DXVA the player freezes at the same moment. It seems that each platform/player shows different artefacts at the same time positions, except for MPC-HC using DXVA. Even when I disable XVBA in OpenElec and thus use software decoding I see some artefacts, but these are far less noticable than with XVBA enabled. It is a strange puzzle :)

Perhaps what you think is the problem, is the thing that Hendrik Leppkes solved for MPC-HC. Are you able to make those changes?

@FernetMenta
Owner

Are you able to make those changes?

Well, anything can be made working :)
Currently I am working on some other stuff I want to finish. We'll touch this area anyway as soon the new xvba SDK is out.

@JeroenDeKleijn

How do you know the new xvba SDK will be out? I thought AMD never gave any guarantees that they would bring out a new SDK, let alone a date. Ofcourse this would be great news for MPEG2 support etc.

@fritsch

@JeroenDeKleijn: Sometimes things get known. Merry Christmas.

@JeroenDeKleijn

@fritsch

Any news on the XVBA SDK? Santa didn't seem to have brought a new version.

Today I also saw that FFmpeg 1.1 has been released. This has all the required fixes mentioned to get VC-1 B-frames to work. You guys have any idea if this version is going to be used by XBMC or perhaps by the people behind OpenELEC?

@fritsch

@JeroenDeKleijn:

Santa "could not bring" it. I think, it is not wise to tell details in public, as we are dependend on AMD.

The people behind OpenELEC use fernetmenta master branch for their vdpau / xvba code. So basically, the man behind OE Video and Audio is @fernetmenta.

@FernetMenta
Owner

We are short final for release of Frodo. In general our ffmpeg fork gets updated soon after a release. Frodo is branched and development continues on master.

@JeroenDeKleijn

Since ffmpeg 1.2 has been commited to xbmc master this pull request is not relevant anymore. Therefore, I close it. The only thing would now still be the !s->first_field in xvba_vc1.c, which should be v->second_field.

@fritsch

@JeroenDeKleijn:
Thanks for all your time and work you invested. I will send a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment