Dirac Specification
Total Page:16
File Type:pdf, Size:1020Kb
Dirac Specification Version 2.2.3 Issued: September 23, 2008 Abstract This document is the specification of the Dirac video decoder and stream syntax. Dirac is a royalty-free video compression system developed by the BBC utilising wavelet transforms and motion compensation. It is designed to be simple, flexible, yet highly effective. It can operate across a wide range of resolutions and application domains, including: internet and mobile streaming, delivery of standard-definition and high-definition television, digital television and cinema production and distribution, and low-power devices and embedded applications. The system offers several key features: • lossy and lossless coding using a common tool set • intra-coded modes for professional production applications • a special low delay mode for link adaption applications, such as the carriage of HDTV over SDTV infrastructure • motion-compensated (‘long-GOP’) modes for distribution applications • gradual quality reduction with increasing compression CONTENTS 1 Contents 1 Introduction 9 2 Scope 9 3 Conformance notation 11 4 Normative References 11 5 Definition of abbreviations and terms 12 5.1 Abbreviations .............................................. 12 5.2 Terms .................................................. 12 6 Conventions 14 6.1 State representation .......................................... 14 6.2 Number formats ............................................ 14 6.3 Data types ............................................... 14 6.3.1 Elementary data types ..................................... 14 6.3.2 Compound data types ..................................... 14 6.4 Functions and operators ........................................ 15 6.4.1 Assignment ........................................... 15 6.4.2 Boolean functions and operators ............................... 15 6.4.3 Integer functions and operators ................................ 16 6.4.4 Array and map functions and operators ........................... 17 6.4.5 Precedence and associativity of operators .......................... 18 6.5 Pseudocode ............................................... 18 6.5.1 Processes and functions .................................... 18 6.5.2 Variables ............................................ 18 6.5.3 Control flow ........................................... 19 7 Overall specification 21 8 Video formats 22 8.1 Colour model .............................................. 22 8.2 Interlace ................................................. 22 8.3 Component sampling .......................................... 22 8.4 Bit resolution .............................................. 22 8.5 Picture frame size and rate ...................................... 23 9 Stream syntax 24 9.1 Pseudocode ............................................... 24 CONTENTS 2 9.2 Stream .................................................. 24 9.3 Sequence ................................................. 24 9.4 Parse Info headers ........................................... 25 9.5 Data units ................................................ 25 9.5.1 Auxiliary data ......................................... 26 9.5.2 Padding data .......................................... 26 9.6 Parse info header syntax ........................................ 26 9.6.1 Parse code values ........................................ 27 9.6.2 Parse code value rationale (Informative) ........................... 28 10 Sequence header 30 10.1 Parse parameters ............................................ 30 10.1.1 Version number ......................................... 31 10.1.2 Profiles and levels ....................................... 31 10.2 Base video format ........................................... 31 10.3 Source parameters ........................................... 32 10.3.1 Setting source defaults ..................................... 33 10.3.2 Frame size ............................................ 33 10.3.3 Chroma sampling format ................................... 33 10.3.4 Scan format ........................................... 34 10.3.5 Frame rate ........................................... 34 10.3.6 Pixel aspect ratio ........................................ 35 10.3.7 Clean area ........................................... 36 10.3.8 Signal range ........................................... 36 10.3.9 Color specification ....................................... 37 10.3.9.1 Color primaries ................................... 38 10.3.9.2 Color matrix ..................................... 38 10.3.9.3 Transfer function ................................... 39 10.4 Picture coding mode .......................................... 39 10.5 Initializing coding parameters ..................................... 39 10.5.1 Picture dimensions ....................................... 40 10.5.2 Video depth ........................................... 40 11 Picture syntax 40 11.1 Picture parsing ............................................. 41 11.1.1 Picture header ......................................... 41 11.2 Picture prediction data ......................................... 41 11.2.1 Picture prediction parameters ................................. 42 CONTENTS 3 11.2.2 Block parameters ........................................ 42 11.2.3 Setting chroma block parameters ............................... 43 11.2.4 Numbers of blocks and superblocks .............................. 43 11.2.5 Motion vector precision .................................... 43 11.2.6 Global motion ......................................... 43 11.2.7 Picture prediction mode .................................... 45 11.2.8 Reference picture weight values ................................ 45 11.3 Wavelet transform data ........................................ 45 11.3.1 Transform parameters ..................................... 46 11.3.1.1 Wavelet filters .................................... 46 11.3.2 Transform depth ........................................ 47 11.3.3 Codeblock parameters (core syntax only) .......................... 47 11.3.4 Slice coding parameters (low delay syntax only) ....................... 47 11.3.5 Quantisation matrices (low-delay syntax) .......................... 48 12 Block motion data syntax 49 12.1 Prediction modes and splitting modes ................................ 49 12.1.1 Prediction modes ........................................ 49 12.1.2 Splitting modes ......................................... 49 12.2 Structure of block motion data arrays ................................ 50 12.2.1 Block motion data initialisation ................................ 50 12.3 Motion data decoding process ..................................... 50 12.3.1 Superblock splitting modes .................................. 51 12.3.2 Propagating data between blocks ............................... 52 12.3.3 Block prediction modes .................................... 52 12.3.3.1 Block prediction mode ................................ 52 12.3.3.2 Block global mode .................................. 53 12.3.4 Block motion vector elements ................................. 53 12.3.5 DC values ............................................ 54 12.3.6 Spatial prediction of motion data elements ......................... 54 12.3.6.1 Prediction apertures ............................................ 54 12.3.6.2 Superblock split prediction ............................. 55 12.3.6.3 Block mode prediction ................................ 55 12.3.6.4 Block global flag prediction ............................. 56 12.3.6.5 Motion vector prediction .............................. 56 12.3.6.6 DC value prediction ................................. 57 12.3.7 Block motion parameter contexts ............................... 58 CONTENTS 4 12.3.7.1 Superblock splitting mode ............................. 58 12.3.7.2 Motion vectors .................................... 58 12.3.7.3 DC values ...................................... 58 13 Transform data syntax 59 13.1 Subband data structures ........................................ 59 13.1.1 Wavelet data initialisation ................................... 59 13.1.2 Subband dimensions ...................................... 61 13.2 Inverse quantisation .......................................... 61 13.2.1 Quantisation factors and offsets ................................ 62 13.3 Intra DC subband prediction ..................................... 63 13.4 Core syntax wavelet coefficient unpacking .............................. 63 13.4.1 Overall process ......................................... 64 13.4.2 Subbands ............................................ 64 13.4.2.1 Zero subband ..................................... 64 13.4.2.2 Non-skipped subbands ................................ 65 13.4.3 Subband codeblocks ...................................... 65 13.4.3.1 Codeblock dimensions ................................ 65 13.4.3.2 Codeblock unpacking loop ............................. 65 13.4.3.3 Skipped codeblock flag ............................... 66 13.4.3.4 Codeblock quantiser offset ............................. 66 13.4.4 Subband coefficients ...................................... 67 13.4.4.1 Zero parent ...................................... 67 13.4.4.2 Zero neighbourhood ................................. 67 13.4.4.3 Sign prediction .................................... 68 13.4.4.4 Coefficient context selection ............................. 68 13.5 Low delay wavelet coefficient unpacking ............................... 71 13.5.1 Overall process ......................................... 71 13.5.2 Slices .............................................