Projects » Amiga OS 4 Projects » RadeonHD Driver » RadeonHD Development Log » Composited Video (Radeon HD driver version 2.x)

Composited Video (Radeon HD driver version 2.x)

Version 2.4 of the driver was announced and released a while ago, so this post is on the late side. In fact, I almost forgot to write it (I did the work for this release a while ago). However, adding composited video is a major milestone so this development log wouldn't be complete without at least mentioning it.

Faster Video Playback Via Composited Video

The key goal for version 2.x was to improve video playback with Radeon HD cards. Video playback is an area in which we have been lacking, which is why A-EON Technology contacted me in early 2014 to commission this project.

Unlike older Radeon cards, Radeon HD graphics cards don't have overlay hardware (to the best of my knowledge). Hardware overlay is an old and rather obsolete method to accelerate video playback by allowing video frames to be displayed directly in their native YUV format.

Rather than try to emulate overlay using the GPU, I opted to add support for YUV formats directly into AmigaOS' CompositeTags() function. I call this "composited video," and it combines the advantages of "textured video" (the overlay replacement on other OSes) with all the power of compositing.

Some key features/advantages of composited video are:

  • Accelerates video playback by enabling planar YUV video frames to be rendered directly to a screen/window/bitmap
  • No limit to how many videos can be displayed simultaneously (overlay is restricted to 1-2 hardware surfaces)
  • Can be rendered anywhere, from full-screen to multiple videos in a webpage (on AmigaOS, overlay is restricted to a window)
  • Supports both SD and HD YUV video standards, and even custom YUV to RGB transformation matrices (NOTE: you can exploit this to get brightness, contrast & saturation adjustment for free)
  • Can use alpha blending for combining video with other graphics; this allows subtle anti-aliased blending, unlike overlay's on/off colour-keying
  • Can use video frames directly with the full power of CompositeTags(); this includes alpha blending, rotation, warping, cross-fades, vertex-arrays, etc.

The last item in the list above introduces a whole set of unique possibilities that previously weren't possible. It could be used for much more than just faster video display; it could be used for real-time video effects, from cross-fades to 3D transitions and more. You could even project video frames into the Composite3DDemo if you wanted to; yes, even wrapped around the ball (although, good luck watching the video that way ;-) ).

How Does it Improve Performance?

Composited video (and overlay) improve performance in two ways:

  • It reduces the bandwidth required to copy video frames to the graphics card (YUV420p bitmaps are 37.5% the size of an equivalent 32-bit RGBA bitmap)
  • It shifts the task of converting from YUV to RGB (the graphics card's native format) from the CPU to the GPU. The GPU is better suited to this task, and it frees the CPU up to work on other things, like decoding the next frame

The net result is that it takes less processing power and bus bandwidth to display the same video.

What is YUV? And why do video files use that format? Basically, the Y channel stores a pixel's brightness/luminance, while the U & V channels store the colour information. Video files use this format instead of RGB, because humans see brightness differences at a higher resolution than grayscale. So, we can get away with storing the colour channels at a lower resolution than the brightness without people noticing it. Effectively, we've compressed the video frame while maintaining high visual quality.

AmigaOS 4.1 Final Edition & DMA

This has nothing to do with the RadeonHD driver, but it's still part of the project to improve video playback. Since the video is still being decoded by the CPU, the speed at which video frames are copied to the graphics card directly affects performance. With the A1-X1000 (as at 10 January 2015, the most powerful AmigaOS machine), this was still being done by the CPU.

So, A-EON asked me to add DMA support to the graphics library for the A1-X1000. This had been done previously for ACube's Sam4x0 series. The results speak for themselves:

GfxBench2D MemCopy result

Comparing DMA accelerated WritePixelArray and ReadPixelArray with CPU based coping algorithms (hardware: A1-X1000 and Radeon HD R9 270).

As part of this project I optimized the process of copying full bitmaps to/from VRAM. Sam460ex users also benefit from this change.

Results & Final Comments

The net result of composited video and the DMA enhancements in AmigaOS 4.1 Final Edition, is faster video playback. In particular, A1-X1000 users can now play HD videos. Full 1080p video playback performance depends on the video codec. I had almost 50% CPU power to spare when playing a 1080p DIVX of Big Buck Bunny (see the screenshot below). H.264 encoded videos are a bit more hit and miss. Some 1080p H.264 videos play fine, while others are encoded with computationally intensive settings that are too much. Still, it's a big step up from what we used to have.

I'd like to quickly thank Kjetil, Stephen, and other developers who have worked hard (and are still doing so) to add composited video support to their software. Driver features only benefit users when applications make use of them.

What's next? Well, it would be great if we could use the video decoder that's built in to all Radeon HD cards. That would allow full HD playback of even the most demanding H.264 video. Yes, even with a lowly Sam440. That's quite a project, though. In the meantime, enjoy the improved video playback!

Big Bucj bunny 1080p being played in realtime on AmigaOS 4.1

A 1080p video being played in real-time on an A1-X1000 using composited video, with plenty of processing power to spare.

 



Projects » Amiga OS 4 Projects » RadeonHD Driver » RadeonHD Development Log » Composited Video (Radeon HD driver version 2.x)

Post your comment

Comments

  • Very nice reading ! It has been a pleasure to read it, thanks Hans

    Posted by Sofistisoftware, 19/05/2015 6:32am (9 years ago)

RSS feed for comments on this page | RSS feed for all comments


Projects » Amiga OS 4 Projects » RadeonHD Driver » RadeonHD Development Log » Composited Video (Radeon HD driver version 2.x)