X video extension
Encyclopedia
The X video extension, often abbreviated as XVideo or Xv, is a video output mechanism for the X Window System
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

. The protocol was designed by David Carver; the specification for version 2 of the protocol was written in July 1991. Its main use today is to rescale video playback in the video controller hardware, in order to enlarge a given video or to watch it in full screen mode. Without XVideo, X would have to do this scaling on the main CPU. That requires a considerable amount of processing power, sometimes to the point of slowing down/degrading the video stream; the video controller is specifically designed for this kind of computation, so can do it much more cheaply. Similarly, the X video extension has the video controller perform color space
Color space
A color model is an abstract mathematical model describing the way colors can be represented as tuples of numbers, typically as three or four values or color components...

 conversions. It can also have the controller change contrast, brightness and hue of a displayed video stream.

In order for this to work, three things have to come together:
  • The video controller has to provide the required functions.
  • The device driver
    Device driver
    In computing, a device driver or software driver is a computer program allowing higher-level computer programs to interact with a hardware device....

     software for the video controller and the X server program have to implement the XVideo interface.
  • The video playback software has to make use of this interface.


Most modern video controllers provide the functions required for XVideo; the feature is known as hardware scaling and YUV
YUV
YUV is a color space typically used as part of a color image pipeline. It encodes a color image or video taking human perception into account, allowing reduced bandwidth for chrominance components, thereby typically enabling transmission errors or compression artifacts to be more efficiently...

 acceleration
or sometimes as 2D hardware acceleration. The XFree86
XFree86
XFree86 is an implementation of the X Window System. It was originally written for Unix-like operating systems on IBM PC compatibles and is now available for many other operating systems and platforms. It is free and open source software under the XFree86 License version 1.1. It is developed by the...

 X server has implemented XVideo since version 4.0.2. To check whether a given X server supports XVideo, one can use the utility xdpyinfo. To check whether the video controller provides the required functions and whether the X device driver implements XVideo for any of them, one can use the xvinfo program.

Playback and processing

Video playback programs that run under the X Window system, such as MPlayer
MPlayer
MPlayer is a free and open source media player. The program is available for all major operating systems, including Linux and other Unix-like systems, Microsoft Windows and Mac OS X. Versions for OS/2, Syllable, AmigaOS and MorphOS are also available. The Windows version works, with some minor...

, MythTV
MythTV
MythTV is a free and open source home entertainment application with a simplified "10-foot user interface" design for the living-room TV, and turns a computer with the necessary hardware into a network streaming digital video recorder, a digital multimedia home entertainment system, or home theater...

 or xine
Xine
xine is a multimedia playback engine for Unix-like operating systems released under the GNU General Public License. xine is built around a shared library that supports different frontend player applications. Another important feature of xine is the ability to manually correct the synchronization...

, typically have an option to enable XVideo output. It is very advisable to switch on this option if the system GPU
Graphics processing unit
A graphics processing unit or GPU is a specialized circuit designed to rapidly manipulate and alter memory in such a way so as to accelerate the building of images in a frame buffer intended for output to a display...

 video-hardware and device drivers supports XVideo – the speedup is very noticeable even on a fast CPU
Central processing unit
The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...

.

While the protocol itself has features for reading and writing of video streams from and to video adapters, in practice today only the functions XvPutImage and XvShmPutImage are used: the client program repeatedly prepares images and passes them on to the graphics hardware to be scaled, converted and displayed.

Display

After video has been scaled and prepared for display on the video card, it must be displayed. There are a few possible ways to display accelerated video at this stage. Since full acceleration means that the video controller is responsible for scaling, converting, and drawing the video, the technique used depends entirely on what the video is being drawn onto.

The role of window manager support and compositing

Under X, how video is finally drawn depends largely on the X window manager
X window manager
An X window manager is a window manager which runs on top of the X Window System, a windowing system mainly used on Unix-like systems.Unlike the Mac OS and Microsoft Windows platforms which have historically provided a vendor-controlled, fixed set of ways to control how windows and panes display...

 in use. With properly installed drivers, and GPU
Graphics processing unit
A graphics processing unit or GPU is a specialized circuit designed to rapidly manipulate and alter memory in such a way so as to accelerate the building of images in a frame buffer intended for output to a display...

 hardware such as supported Intel, ATI
Ati
As a word, Ati may refer to:* Ati, a town in Chad* Ati, a Negrito ethnic group in the Philippines* Ati-Atihan Festival, an annual celebration held in the Philippines* Ati, a queen of the fabled Land of Punt in Africa...

, and nVidia
NVIDIA
Nvidia is an American global technology company based in Santa Clara, California. Nvidia is best known for its graphics processors . Nvidia and chief rival AMD Graphics Techonologies have dominated the high performance GPU market, pushing other manufacturers to smaller, niche roles...

 chip sets, some window managers, called compositing window manager
Compositing window manager
A compositing window manager is a type of window manager. A window manager is software that draws a graphical user interface on a computer display – it positions windows, draws additional elements on windows , and controls how windows interact with each other, and with the rest of the desktop...

s allow windows to be separately processed and then rendered (or composited). This involves all windows being rendered to separate output buffers in memory first, and later combined to form a complete graphical interface. While in (video) memory, individual windows can be transformed separately, and accelerated video may be added at this stage using a texture filter, before the window is composited and drawn. XVideo can also be used to accelerate video playback during the drawing of windows using an OpenGL Framebuffer Object
Framebuffer Object
The frame buffer object architecture is an extension to OpenGL for doing flexible off-screen rendering, including rendering to a texture. By capturing images that would normally be drawn to the screen, it can be used to implement a large variety of image filters, and post-processing effects. The...

 or pbuffer.

Metacity
Metacity
Metacity was the window manager used by default in the GNOME desktop environment until GNOME 3, where it was replaced by Mutter. The development of Metacity was started by Havoc Pennington and it is released under the GNU General Public License....

, an X window manager
X window manager
An X window manager is a window manager which runs on top of the X Window System, a windowing system mainly used on Unix-like systems.Unlike the Mac OS and Microsoft Windows platforms which have historically provided a vendor-controlled, fixed set of ways to control how windows and panes display...

 uses compositing in this way. The compositing can also make use of 3D pipelines accelerations such as GLX_EXT_texture_from_pixmap. Among other things, this process allows many video outputs to share the same screen without interfering with each other. Other compositing window manager
Compositing window manager
A compositing window manager is a type of window manager. A window manager is software that draws a graphical user interface on a computer display – it positions windows, draws additional elements on windows , and controls how windows interact with each other, and with the rest of the desktop...

s such as Compiz
Compiz
Compiz is one of the first compositing window managers for the X Window System that uses 3D graphics hardware to create fast compositing desktop effects for window management. The effects, such as a minimization effect and a cube workspace are implemented as loadable plugins...

 also use compositing.

However on a system with limited OpenGL acceleration function, and specifically the lack of an OpenGL Framebuffer Object
Framebuffer Object
The frame buffer object architecture is an extension to OpenGL for doing flexible off-screen rendering, including rendering to a texture. By capturing images that would normally be drawn to the screen, it can be used to implement a large variety of image filters, and post-processing effects. The...

 or pbuffer, the use of an OpenGL environment like Xgl
Xgl
Xgl was an X server architecture designed to take advantage of modern graphics cards via their OpenGL drivers, layered on top of OpenGL via glitz. It supported hardware acceleration of all X, OpenGL and XVideo applications and graphical effects by a compositing window manager such as Compiz or...

 makes xv hardware accelerations impossible.

The disadvantages of chroma keying

In the event that the window manager doesn't directly support compositing, it is more difficult to isolate where the video stream should be rendered, because by the time it can be accelerated the output has already been turned into a single image. The only way to do this is usually to employ a post processed hardware overlay
Hardware overlay
In computing, hardware overlay, a type of video overlay, provides a method of rendering an image to a display screen with a dedicated memory buffer inside computer video hardware. The technique aims to improve the display of a fast-moving video image — such as a computer game, a DVD, or the signal...

, using chroma keying. After all of the windows have already been drawn, the only pieces of information we have available are the size and position of the video window's canvas. A third piece of information is required to indicate which parts of the video window's canvas are obscured by other windows and which are not. Therefore the video player draws its canvas using a solid color (we'll say green), and this color becomes a make-shift third dimension. When all windows have been drawn, windows covering the video player will block out the green color. When the video stream is added to the output, the graphics card can simply scan the co-ordinates of the canvas. When it encounters green, it knows its found a visible portion of the video window, and only draws those portions of the video. This same process was also the only available option to render hardware accelerated video under Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

 and earlier, since its window management features were so deeply embedded into the operating system that accelerating them would have been impossible.

If the window manager doesn't support compositing, post processed hardware overlay
Hardware overlay
In computing, hardware overlay, a type of video overlay, provides a method of rendering an image to a display screen with a dedicated memory buffer inside computer video hardware. The technique aims to improve the display of a fast-moving video image — such as a computer game, a DVD, or the signal...

s using chroma keying as described in the previous paragraph can make it impossible to produce a proper screenshot
Screenshot
A screenshot , screen capture , screen dump, screengrab , or print screen is an image taken by a computer to record the visible items displayed on the monitor, television, or another visual output device...

s of Xvideo applications. It can also make it impossible to view this kind of playback on a secondary display when only one overlay is allowed at the hardware level.

See also

  • X-Video Motion Compensation - XvMC
  • MIT-SHM
    MIT-SHM
    The MIT Shared Memory Extension or MIT-SHM is a X Window System extension for exchange of image data between client and server using shared memory.The basic capability provided is that of shared memory XImages...

    - The MIT Shared Memory Extension

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK