# Dirac

- FOURCC: BBCD
- Company: BBC
- Website: http://diracvideo.org
- Samples: Libav Samples DiracVideo Samples

Experimental wavelet-based video codec being developed by the BBC. The development of a C++ Dirac implementation under the MPL license called libdirac is hosted at SourceForge. The Schrödinger Project is an implementation written in ANSI C89, jointly developed by Fluendo and BBC.

A Dirac decoder and encoder has been developed as part of FFmpeg's Summer of Code 2007 but has not yet been committed.

## About Wavelets

Continuous Wavelet Transform (CWT) is an alternative to the Windowed Fourier Transform (WFT). The data analysis at different factor or resolutions is the main difference between CWT and WFT, also called multi-resolution analysis (MRA) which is also the justification for the algorithm of the Fast Wavelet Transform (FWT). In front of Fourier Transform which has only the sin() and cs() functions available, the Wavelet transform has infinite available functions, with that property the access to the information is immediate. The WFT projects a time function (the signal) into a A and B function, where A is known as scale and B is known as translation. A and B are also known as 'mother wavelet' and 'child wavelets'. A and B could be Quadrature Mirror Filter (QMF).

The Fast Wavelet Transform is designed to turn a waveform in the time domain into a sequence of coefficients based on an orthogonal basis of small finite waves or wavelets. The transform can be easily extended from time to other domains like images (2D-WT) or videos (3D-WT).

For 1D-WT, applying two QMF Filters L and H would split the original signal into two halves, the low-pass (L) subband (or reference signal) and the high-pass (H) subband (or signal detail). In case of 2D-WT (e.g. Pictures), the FWT is applied to each row and each column generating four sub-bands: low-low (LL), high-low (HL), low-high (LH), high-high (HH). Each subband would contain respectively the following: a reference Picture of the original, the horizontal details, the vertical details, the diagonal details. Each subband is a quarter from the original size. 3D-WT follows the same principle of 2D-WT but generating nine subband. The transform can be applied as many times as it is desired, this is called iterations, the number of iterations isn't limited, that's why there is no limitations of size for the wavelet transform.

## Dirac Video Codec

Is an experimental wavelet-based video codec being developed by the BBC. The development of a C++ Dirac implementation under MPL license called libdirac is hosted at SourceForge. The Schröedinger project is an implementation written in ANSI C89, jointly developed by Fluendo and BBC. Libdirac is considered obsolete and the usage of libschroedinger is suggested.

The structure of a Dirac decoder is similar to a well known block oriented codecs but where one would find a DCT/IDCT (Discrete Cosine Transform) a DWT/IDWT (Discrete Wavelet Transform) is found. Different wavelet filters are available for the DWT/IDWT step. Arithmetic coding was selected to provide a better bitstream compression.

Dirac uses Overlapped Block Motion Compensation (OBMC) reducing the block artifacts with bigger block sizes. OBMC overlapps blocks making a pixel belong to more than a block. In addition motion compensation precission can afford from full pixel (fpel) until eighth pixel (epel).

A dirac decoder and encoder was developed as part of FFmpeg's Summer of Code 2007. Refinements to that implementation will be carried out during the present Libav's Summer of Code 2011.

- Features of Dirac.

- Intra Coded Images (I)

- Predictive Images (P)

- Bi-Predictive Images (B)

- Maximum reference frames per picture is 2

- Field or Frame Picture Coding Mode

- The transform depth isn't limited but if greater than 4, customised quantisation matrices would be needed.

- Low Delay slice encoding/decoding

- Motion Vector precision up to 1/8 pixel

- Allows multiple quantisers per subband

- Defined profiles:

- Low Delay

- Simple (Intra Non-arithmetic coding)

- Main (Intra Arithmetic coding)

- Main (Long GOP)

- Defined Levels

- 0: Reserved, shall not be used

- 1: Use video parameters defined in standard (Annex C). Available for profiles, Low delay, Simple and Main (Intra).

- 128: Use video parameters defined in standard (Annex C) but range is restricted to 8 bits and frame dimension may be overriden. Available for Main (Long GOP) profile only.

- Supported Filters:

- Deslauriers-Dubuc (9,7)

- LeGall (5,3)

- Deslauriers-Dubuc (13,7)

- Haar with no shift

- Haar with single shift per level

- Fidelity filter

- Daubechies (9,7) integer approximation

## SMPTE VC-2 (Dirac Pro)

It is a subset of Dirac optimised for professional production especially emphatising on quality and low-latency.

Low latency and lossless compression are typical requirements for production systems.

- Scenarios:

- Lossless or visually lossless compression for archives

- Mezzanine compression for re-use of existing equipment, such as 1080P 50Hz carried in a 1080I 25 Hz channel. Mezzanine videos are compressed videos that take up less space than the full res files.

- Low latency compression for live video links.

- Features:

- Mainly intra prediction (Inter prediction is available if required)

- 10 Bit 4:2:2

- No subsampling

- Lossless or visually lossless compression

- Low latency on encode/decode

- Robust over multiple passes

- Low complexity for decoding

- Multiple vendor

- Support for multiple HD image formats and frame rates.

- Differences with Dirac:

Basically the main enhancements of Dirac Pro come in the treatment of the final process, the arithmetic coding. Arithmetic coding was discarded in dirac Pro because the benefits in low compression material is not worth the high resources consumption of the method.