Tuesday, October 28, 2014

MPlayer for AmigaOS4 is going full HD 1080p



Mplayer is going full HD 1080p, well at least we can play not so demanding codices, this big improvement from only being able to play 720p HD ready movies.

Here comes the story of the new MPlayer, I was approached by Matthew Leaman, about the work did with composition in the MPlayer version your using, he asked me if I was interested in working on "Composition accelerated video support" as he calls it, I just calls it YUV bitmap's. 

At the same time I was working on porting over my work form old MPlayer to new MPlayer 1.1.1 (2014) source code from MPlayerHQ.

When I accepted the challenge I got some example code from Hans, and got access to what I need to start adapting the code into mplayer video output "comp", it was relatively easy to adapt the code for mplayer.

First version with composition video bitmaps, cut time/cpu needed to display the video in half.

Hans asked me if it was possible to support DRI, so spent some time investigating, this was bit more work as need to adapt code from mplayer Xv video output and combine it with comp_yuv. This did not work out of the box, so to speak, Mplayer expected none Interleaved YUV420p bitmaps, but AmigaOS4.1 only supported Interleaved, so I removed the restriction and got it working.

The DRI gives a major speed up on any Codec that supports it, like MPEG video you find on DVD's and its also lot of older MPEG videos on the net.

Sorry don't have any numbers but speed difference was major.

Trever tested Mplayer and wondered about DVD playback, so looked into that did some testing and extermination, tried to find some bottlenecks, this work was big undertaking, things did not add up and mplayer benchmark was giving me nonsense numbers.

In the end, I decided to test MPlayer LibDVDCSS and do some benchmarking on that, so wrote a small program that only benchmark it, this is when I noticed that numbers where showing slow speed, so having excluded the rest of MPlayer from my test, I was able to focus on improving Libdvdcss and getting the speed up, what I quickly understood was that Mplayer was only reading 1 block, almost never tried to read more then 1, the result was the mplayer had to seek to a lot instead of just reading a chunk of data.

Then communication went silent for a while, Hans had been taking a bit about DMA, but I did not know if they where working on it.

So just before Amiwest I got a e-mail again about DMA being enabled, Steven Sollie provided SDK and OS files need and work started to get MPlayer to support DMA, there was some alignment problems.

MPlayer with DMA support was just ready for Amiwest, just two weeks before.

Just before Amiwest Andy sent me a e-mail, and exchanged few e-mail's

The funny thing was I did not know DVDNAV menu worked, I guess I typed the wrong command line :-)

Anyway I always used DVD option in MPlayer to play DVD's, from my experience it plays smoother, because you can enable cache, so that MPlayer don't need to wait for disk io.

This is what your going to get in the new MPlayer:

* comp_yuv and comp_yuv2 uses YUV420p bitmaps (NEW)

Enabled mplayer to take advantage of "Radeon HD" yuv420p support, this removed the need to convert yuv420p video to (32bit) ARGB bitmap format be-fore displaying it.

* comp_yuv and comp_yuv2 support DRI (NEW)

I spent some time reading and investigating Xv (X-Windows video) video output in MPlayer, to take advantage of DRI.

* MPlayer can now playback DVD's on X1000 at good speed (NEW)

AmigaOS4 does not read ahead blocks, this caused major slowdown in MPlayer, so hacked in read ahead buffering into MPlayer, to speed it up.

* Mplayer can playback file larger then 2Gb (NEW)

AmigaOS4 SDK does not support typedef off_t as 64bit, changed MPlayer to workaround the problem. 

* Mplayer can playback DVD's copied to hard-drives (NEW)

I have spent some time fixing path problems and getting this working, the support for native files and directories is intended for Linux mount points, but a bit of work it also works on AmigaOS4.1 directories.

You might experienced some crashed with AAC audio codec in old MPlayer, the AAC codec was replaced by MPlayerHQ developers so, no more crashed in that one.

It has not been easy not being able to say anything to anyone, in the forums, as people where used to get regular updates, but In the end I think every one is going to be happy.