Include a pre-rendered pdf version
[dirac-spec-errata.git] / bs-spec.tex
blob6d756036c5f3fd92fe0f94bf7c86cb242bcf1dff
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % - This chapter defines the bytestream structure - %
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 \label{streamstructure}
7 This section specifies the overall structure of Dirac streams.
8 Subsequent sections define the processes for
9 parsing pictures, and Section~\ref{picturedec} specifies how pictures
10 are decoded.
12 \subsection{Pseudocode}
13 The parsing process is normatively defined using pseudocode and/or mathematical formulae.
14 The definitions of stream syntax operations and pseudocode shall be as defined in
15 Section~\ref{spec-conventions}.
17 The Dirac stream syntax uses a state model to express the stream in a way that can
18 be parsed and used for decoding operations. The parsing and decoding operations are
19 specified in terms of modifying the decoder state according to the data extracted
20 from the Dirac stream. The state of the decoder is stored in the global variable $\StateName$.
21 This is a map (Section~\ref{datatypes}) and individual elements are accessed by
22 means of named labels, e.g. $\StateName[\text{VAR\_NAME}]$.
23 The state variables comprise the parameters that shall be used in parsing and decoding a picture.
24 The variable $\StateName$ is a global variable and shall be accessible to all decoder functions and processes.
25 All other variables shall be local to the function or process in which they are defined.
27 Decoder state variables (that is elements of state) may not directly correspond
28 to parts of the stream, but may be calculated from them taking into account the
29 decoder state as a whole. For example, a state variable value may be differentially
30 encoded with respect to another value, with the difference, not the variable itself,
31 encoded in the stream. Some parameters are encoded in the stream as indices
32 to tables of values. The indices are coded as variable length integers.
33 This allows the tables to be extended to contain new entries, in future versions
34 of this specification, without changing the syntax.
37 \subsection{Stream}
38 \label{stream}
40 A stream is a concatenation of Dirac sequences. The process for parsing a stream
41 is to parse all sequences it contains. A Dirac sequence shall be decoded as a separate entity.
43 \subsection{Sequence}
45 The data contained in a Dirac sequence corresponds to a single video sequence with
46 constant video parameters as defined in Sections \ref{sourceparameters}.
47 A Dirac sequence can be excised from a Dirac stream and decoded entirely
48 independently.
50 A Dirac sequence shall comprise an alternating sequence of parse info headers and
51 data units. The first data unit shall be a sequence header, and further sequence
52 headers may be inserted at any data unit point in the sequence.
53 The process for parsing a Dirac sequence shall be as defined below:
55 \begin{pseudo}{parse\_sequence}{}
56 \bsCODE{\StateName=\{\}}
57 \bsCODE{\RefBuffer=\{\}}
58 %\bsCODE{\DecodedBuffer=\{\}}
59 \bsCODE{parse\_info()}{\ref{parseinfoheader}}
60 \bsCODE{\VideoParams=sequence\_header()}{\ref{sequenceheader}}
61 \bsCODE{parse\_info()}{\ref{parseinfoheader}}
62 \bsWHILE {is\_end\_of\_sequence()==\false}{\ref{parsecodevalues}}
63 \bsIF{is\_seq\_header()==\true}{\ref{parsecodevalues}}
64 \bsCODE{\VideoParams=sequence\_header()}{\ref{sequenceheader}}
65 \bsELSEIF{is\_picture()}{\ref{parsecodevalues}}
66 \bsCODE{picture\_parse()}{\ref{pictureparse}}
67 \bsELSEIF{is\_auxiliary\_data()}{\ref{parsecodevalues}}
68 \bsCODE{auxiliary\_data()}{\ref{auxdata}}
69 \bsELSEIF{is\_padding()}{\ref{parsecodevalues}}
70 \bsCODE{padding()}{\ref{paddingdata}}
71 \bsEND
72 \bsCODE{parse\_info()}{\ref{parseinfoheader}}
73 \bsEND
74 \end{pseudo}
76 Each Dirac sequence shall start and end with a parse info header.
78 \subsection{Parse Info headers}
80 Parse info headers shall contain a 32 bit code so that the decoder can
81 be synchronized with the stream. They are defined in Section~\ref{parseinfoheader}.
82 The parse info headers support navigating through the stream without the
83 need to decode any data units. Each parse info header contains pointers
84 to the location of the next and previous parse info headers within the stream.
85 The stream may thus be thought of as a doubly linked list of data units.
86 Each parse info headers contains a code that identifies the type of data held
87 in the following data unit. This is the only information contained within
88 the parse info headers that is needed to decode the sequence.
90 \subsection{Data units}
92 Data units may be one of:
93 \begin{itemize}
94 \item a sequence header,
95 \item a picture,
96 \item auxiliary data, and
97 \item padding data.
98 \end{itemize}
100 A sequence header shall contain metadata describing the coded sequence
101 and metadata needed to decode the stream. The sequence header is defined
102 in Section~\ref{sequenceheader}. The first data unit in a sequence shall be a
103 sequence header. To support reverse-parsing applications, the last data unit in
104 a sequence should also be a sequence header.
106 Each sequence shall contain at least one picture and at least one sequence header.
107 The first picture after each sequence header (if there is one) shall be an intra picture.
109 If a sequence contains more than one sequence header, the data
110 in each sequence header shall be the same (byte-for-byte identical) within the sequence.
112 Each picture, whether a frame or field, may be coded with a dependency
113 on prior pictures in the stream (reference pictures).
115 A picture data unit shall contain sufficient data to decode a single picture
116 (frame or field of video), subject to having parsed a sequence header within
117 the sequence and decoded any reference pictures.
119 Pictures within a sequence shall either all be fields or all be frames.
120 Where pictures are fields, a sequence shall contain an even number of pictures,
121 comprising a whole number of frames.
123 Auxiliary data and padding data do not contribute to the decoding
124 process and so may be discarded.
127 Auxiliary and padding data units comprise undefined data for the purposes
128 of this standard. These data units (together with the correct preceding
129 parse info header) may be interposed at any point in the stream, but
130 may safely be skipped by a compliant decoder. For the purposes of
131 subsequent parts of this standard, the potential presence of auxiliary
132 and padding data shall be ignored.
134 Padding data units shall not be used for any form of auxiliary data
135 service or content. They may be used by an encoder, where required,
136 to insert additional data to assist in complying with constant or constrained bit rate requirements.
138 \subsubsection{Auxiliary data}\label{auxdata}
140 The $auxiliary\_data()$ process for reading auxiliary data shall be as follows:
142 \begin{pseudo}{auxiliary\_data}{}
143 \bsCODE{byte\_align()}
144 \bsFOR{i=1}{\NextParseOffset-13}
145 \bsCODE{read\_byte()}
146 \bsEND
147 \end{pseudo}
149 \subsubsection{Padding data}\label{paddingdata}
151 The $padding()$ process for reading padding data shall be as follows:
153 \begin{pseudo}{padding}{}
154 \bsCODE{byte\_align()}
155 \bsFOR{i=1}{\NextParseOffset-13}
156 \bsCODE{read\_byte()}
157 \bsEND
158 \end{pseudo}
160 \subsection{Parse info header syntax}
161 \label{parseinfoheader}
163 The parse info header provides information identifying the subsequent data unit
164 type and length codes determining the number of bytes from the current parse
165 info header to the next and previous parse info headers.
167 The parse info header shall be byte-aligned. It shall occur:
168 \begin{itemize}
169 \item at the beginning of a sequence
170 \item at the end of a sequence
171 \item before each data unit
172 \end{itemize}
174 The parse info header shall consist of 13 whole bytes. Thus subsequent data elements
175 shall be byte aligned.
177 The value of the parse code, which is a component of the parse info header,
178 shall be used to determine the type and format of the subsequent data unit.
180 The $parse\_info()$ process for reading parse info headers shall be as follows:
182 \begin{pseudo}{parse\_info}{}
183 \bsCODE{byte\_align()}
184 \bsCODE{\ParseInfoPrefix=read\_uint\_lit(4)}
185 \bsCODE{\ParseCode=read\_uint\_lit(4)}
186 \bsCODE{\NextParseOffset=read\_uint\_lit(4)}
187 \bsCODE{\PrevParseOffset=read\_uint\_lit(4)}
188 \end{pseudo}
190 The Parse Info parameters shall satisfy the following constraints:
192 \begin{itemize}
193 \item $\ParseInfoPrefix$ shall be set to be 0x42 0x42 0x43 0x44, which is the character string ``BBCD'' as expressed by ISO/IEC 646.
194 \item $\ParseCode$ shall be one of the supported values set out
195 in Table \ref{table:parsecodes}
196 \item $\NextParseOffset$ shall be the number of bytes from the first byte of the current
197 Parse Info header to the first byte of the next Parse Info header,
198 if there is one. If there
199 is no subsequent Parse Info header, it shall be be zero.
200 \item $\PrevParseOffset$ shall be the number of bytes from the first byte of the current
201 Parse Info header to the first byte of the previous Parse Info header,
202 if there is one. If there is no subsequent Parse Info header, it shall be be zero.
203 \end{itemize}
205 Consequently, the previous parse offset value of the current parse info header
206 shall equal the next parse offset value of the previous parse info header,
207 if there is one.
209 \begin{informative}
210 \begin{enumerate}
211 \item The parse info prefix, next parse offset and previous parse offset
212 values are provided to support navigation and are not required to decode
213 the sequence. See Section~\ref{nonsequential}.
214 \item The parse offset values will normally be non-zero. However at the beginning
215 and end of a stream there is no preceding or following parse info header respectively.
216 In these circumstances the value of the offset is zero: these are the only
217 places where zero values can occur.
218 \end{enumerate}
219 \end{informative}
221 \subsubsection{Parse code values}
222 \label{parsecodevalues}
224 Parse code values shall be divided into three sets: generic,
225 core syntax and low delay
226 syntax.
228 The value of parse codes allowed within the Dirac syntax shall
229 be as shown in Table \ref{table:parsecodes}
231 \begin{table}[!ht]
232 \centering
233 \begin{tabular}{|c|c|l|c|}
234 \hline
235 \rowcolor[gray]{0.75}
236 \ParseCode & {\bf Bits} & {\bf Description} & \begin{tabular}{c} {\bf Number of}\\ {\bf Reference}\\{\bf Pictures}\end{tabular}\\
237 \hline
238 \multicolumn{4}{|c|}{\cellcolor[gray]{0.85}\bf Generic}\\
239 \hline
240 0x00 & 0000 0000 & Sequence header &--\\
241 \hline
242 0x10 & 0001 0000 & End of Sequence & -- \\
243 \hline
244 0x20 & 0010 0000 & Auxiliary data & -- \\
245 \hline
246 0x30 & 0011 0000 & Padding data & -- \\
247 \hline
248 \multicolumn{4}{|c|}{\cellcolor[gray]{0.85}\bf Core syntax}\\
249 \hline
250 0x0C & 0000 1100 & Intra Reference Picture (arithmetic coding) & 0\\
251 \hline
252 0x08 & 0000 1000 & Intra Non Reference Picture (arithmetic coding) & 0\\
253 \hline
254 0x4C & 0100 1100 & Intra Reference Picture (no arithmetic coding) & 0\\
255 \hline
256 0x48 & 0100 1000 & Intra Non Reference Picture (no arithmetic coding) & 0\\
257 \hline
258 0x0D & 0000 1101 & Inter Reference Picture (arithmetic coding) & 1\\
259 %\hline
260 %0x4D & 0100 1101 & Inter Reference Picture (no arithmetic coding) & 1\\
261 \hline
262 0x0E & 0000 1110 & Inter Reference Picture (arithmetic coding) & 2\\
263 %\hline
264 %0x4E & 0100 1110 & Inter Reference Picture (no arithmetic coding) & 2\\
265 \hline
266 0x09 & 0000 1001 & Inter Non Reference Picture (arithmetic coding)& 1\\
267 %\hline
268 %0x49 & 0100 1001 & Inter Non Reference Picture (no arithmetic coding) & 1\\
269 \hline
270 0x0A & 0000 1010 & Inter Non Reference Picture (arithmetic coding) & 2\\
271 %\hline
272 %0x4A & 0100 1010 & Inter Non Reference Picture (no arithmetic coding)& 2\\
273 \hline
274 \multicolumn{4}{|c|}{\cellcolor[gray]{0.85}\bf Low-delay syntax}\\
275 \hline
276 0xCC & 1100 1100 & Intra Reference Picture & 0\\
277 \hline
278 0xC8 & 1100 1000 & Intra Non Reference Picture & 0\\
279 \hline
280 \end{tabular}
281 \caption{Parse codes}\label{table:parsecodes}
282 \end{table}
284 Future versions of this specification may introduce new parse codes. In order that
285 decoders complying with this version of the specification may decode future
286 versions of the coded stream, the decoder shall discard data units that immediately
287 follow parse info blocks containing unknown parse codes.
289 The parse codes shall be associated with a group of functions, listed below, which shall determine the type of subsequent data and the parsing and decoding processes which
290 shall be used. All functions shall return a
291 boolean, except for $num\_refs()$ which shall returns an integer:
293 \begin{pseudo}{is\_seq\_header}{}
294 \bsRET{\ParseCode==\text{0x00}}
295 \end{pseudo}
297 \begin{pseudo}{is\_end\_of\_sequence}{}
298 \bsRET{\ParseCode==\text{0x10}}
299 \end{pseudo}
301 \begin{pseudo}{is\_auxiliary\_data}{}
302 \bsRET{(\ParseCode \& \text{0xF8})==\text{0x20}}
303 \end{pseudo}
305 \begin{pseudo}{is\_padding}{}
306 \bsRET{\ParseCode==\text{0x30}}
307 \end{pseudo}
309 \begin{pseudo}{is\_picture}{}
310 \bsRET{((\ParseCode \&\text{0x08})==\text{0x08})}
311 \end{pseudo}
313 \begin{pseudo}{is\_low\_delay}{}
314 \bsRET{((\ParseCode \&\text{0x88})==\text{0x88})}
315 \end{pseudo}
317 \begin{pseudo}{is\_core\_syntax}{}
318 \bsRET{((\ParseCode \&\text{0x88})==\text{0x08})}
319 \end{pseudo}
321 \begin{pseudo}{using\_ac}{}
322 \bsRET{((\ParseCode \&\text{0x48})==\text{0x08})}
323 \end{pseudo}
325 \begin{pseudo}{is\_reference}{}
326 \bsRET{((\ParseCode \&\text{0x0C})==\text{0x0C})}
327 \end{pseudo}
329 \begin{pseudo}{is\_non\_reference}{}
330 \bsRET{((\ParseCode \&\text{0x0C})==\text{0x08})}
331 \end{pseudo}
333 \begin{pseudo}{num\_refs}{}
334 \bsRET{(\ParseCode \&\text{0x03})}
335 \end{pseudo}
337 \begin{pseudo}{is\_intra}{}
338 \bsRET{is\_picture() \text{ and } (num\_refs()==0)}
339 \end{pseudo}
341 \begin{pseudo}{is\_inter}{}
342 \bsRET{is\_picture() \text{ and }(num\_refs()>0)}
343 \end{pseudo}
345 \begin{informative*}
346 \subsubsection{Parse code value rationale (Informative)}
348 The rationale for the parse code values in Table \ref{table:parsecodes} is as follows:
349 \begin{itemize}
350 \item The MS bit (bit 7) is used to indicate the picture syntax (core or low delay syntax)
351 and only applies to pictures. Core syntax codes whole frames rather than slices. Low delay syntax codes slices not frames.
352 \item The second MS bit (bit 6) is used to indicate whether arithmetic coding is used and
353 only applies to pictures. Core syntax may optionally use arithmetic coding. Low delay
354 syntax does not use arithmetic coding. The permutation of the two bits which
355 might indicate low delay syntax with arithmetic coding is reserved. Only arithmetic coding is supported on
356 Inter pictures.
357 \item The next three MS bits (bits 5, 4 and 3) indicate the type of data unit following the parse info unit. Bit 3 indicates whether it is a picture or non-picture data unit. Bits 5 and 4 indicate the 4 other parse codes.
358 \item The three LS bits (bits 2, 1 and 0) indicate picture types. Bit 2 indicates whether a picture
359 is a reference picture or not. Bits 0 and 1 indicate the number of references a picture has
360 for motion compensation purposes: if these are both 0, the picture is an Intra picture.
361 \end{itemize}
363 \end{informative*}
365 \clearpage
366 \section{Sequence header}
367 \label{sequenceheader}
369 This section defines the structure of the sequence header syntax.
370 The sequence header shall be byte aligned.
371 Parsing this header consists of reading the sequence parameters
372 (parse parameters, base video format, source parameters and
373 picture coding mode) and initializing the decoder parameters. The decoder
374 parameters are initialized in the $set\_coding\_parameters()$ process (Section
375 \ref{codingparameters}).
377 The sequence header shall remain byte identical throughout a sequence.
379 The process for parsing the sequence header shall be as follows:
381 \begin{pseudo}{sequence\_header}{}
382 \bsCODE{byte\_align()}
383 \bsCODE{parse\_parameters()}{\ref{parseparameters}}
384 \bsITEM{base\_video\_format}{uint}{\ref{videoformat}}
385 \bsCODE{\VideoParams=source\_parameters(base\_video\_format)}{\ref{sourceparameters}}
386 \bsITEM{picture\_coding\_mode}{uint}{\ref{picturecodingmode}}
387 \bsCODE{set\_coding\_parameters(\VideoParams,picture\_coding\_mode)}{\ref{codingparameters}}
388 \bsRET{\VideoParams}
389 \end{pseudo}
391 Parse parameters contain information a decoder may use to determine whether
392 it is able to parse or decode the stream. Parse parameters are not used to decode the stream.
394 The base video format is a numerical index denoting a default set of parameters
395 that describe the video source. For many common video formats the predefined
396 values indicated by the base video format and defined in Annex~\ref{videoformatdefaults}, will be sufficient
397 without the need for further metadata to be present in the stream. However, to provide
398 flexibility, source parameters may override the parameters indicated
399 by the base video format (with the exception of the top field first flag).
401 Source parameters are parameters that describe the source video, not all of
402 which are required to decode the stream. The source parameters are needed by
403 applications that use the decoded video and so should be made available to them.
405 The picture coding mode indicates whether the video has been coded as a sequence
406 of frames or fields.
408 Once the base video format, source parameters and picture coding mode have
409 been read from the stream the information they contain may be decoded to
410 provide the parameters used for decoding pictures. It is the purpose of the
411 $set\_coding\_parameters()$ process to initialize these parameters.
413 \begin{informative}
414 Note that video parameters indicate whether the video sequence is interlaced or progressive.
415 In particular a change from interlaced to progressive video, or vice-versa, necessitates that
416 the Dirac sequence be terminated and a new sequence begun. The coding mode indicates whether
417 the pictures within a Dirac sequence are fields or frames. Note that progressive video may
418 still be encoded as fields, to provide backward compatibility with pseudo-progressive frame (PSF)
419 video transmission.
421 The video parameters are not used by the Dirac decoder. Video parameter values should
422 be made available using appropriate interfaces and standards to any downstream video
423 processing device or display, but their use and interpretation by other devices is not specified in this standard.
424 Neverthless, Annex~\ref{vidsys} specifies the video systems model that should be used for the interpretation
425 of video parameters.
426 \end{informative}
428 %%%%%%%%%%%%%%%%%%%%%%%%%%
429 \subsection{Parse parameters}
430 \label{parseparameters}
432 This section specifes the structure of the parse parameters, which is as follows:
434 \begin{pseudo}{parse\_parameters}{}
435 \bsITEM{\VersionMajor}{uint}{}
436 \bsITEM{\VersionMinor}{uint}{}
437 \bsITEM{\Profile}{uint}{}
438 \bsITEM{\Level}{uint}{}
439 \end{pseudo}
441 Parse parameter data shall be constant (byte-for-byte identical) for all instances
442 of the sequence header within a Dirac sequence. For stream interchange, parse
443 parameter data should also be constant across all sequences within a stream.
445 \subsubsection{Version number}
447 The major version number shall define the version of the syntax with
448 which the stream complies. A decoder complies with a major version
449 number if it can parse all bit streams that comply with
450 that version number. Decoders that comply with a major version of
451 the specification may not be able to parse the bit stream corresponding
452 to a later specification.
454 Depending on the profile and level defined, a decoder compliant
455 with a given major version number may still not be able to decode
456 fully all parts of a stream.
458 All minor versions of the specification shall be functionally compatible
459 with earlier minor versions with the same major version number. Later minor
460 versions may contain corrections, clarifications, and removal of ambiguities.
461 Later minor version numbers shall not contain new features or new
462 normative provisions.
464 Functional compatibility shall imply that a decode with the same major version
465 number but a later minor version number than that contained in a stream, shall
466 be capable of decoding the stream and producing pictures substantially equivalent
467 to that of a decoder with the same version numbers as the stream.
469 The major version number of a stream compliant with this version
470 of the Dirac specification shall be \MajorVersion.
472 The minor version number of a stream compliant with this version
473 of the Dirac specification shall be \MinorVersion.
476 \subsubsection{Profiles and levels}
478 A profile shall define the toolset that is sufficient to decode a sequence.
480 A level shall determine decoder resources (picture and data buffers; computational resources) sufficient
481 to decode a sequence, including the sizes $\RefBufferSize$ and $\DPBSize$ of
482 the reference picture and decoded picture buffers.
484 Applicable values of profile and level and the variables they set are specified in Annex
485 \ref{profilelevel}.
487 \subsection{Base video format}
488 \label{videoformat}
490 The value of $base\_video\_format$ decoded in parsing the sequence header shall be
491 an index into table \ref{table:videoformats}. For each entry in the table
492 parameters are defined, in Annex~\ref{videoformatdefaults}, indicating base
493 video parameters corresponding to one of a set of predefined formats.
495 The selection of a base format represents an initial approximation to the video
496 format which can then be refined to capture all the video format characteristics
497 accurately by overriding parameters as necessary. In particular, the predefined
498 video formats listed in table \ref{table:videoformats} do not represent all the
499 video formats supported by Dirac; any video format parameters may in principle be
500 defined and supported by Dirac sequence.
502 These base parameters may be modified by subsequent metadata present in the stream,
503 with the exception of the top field first parameter which shall only be set
504 by the base video format (see Section~\ref{scanformat}).
506 \begin{table}[!ht]
507 \centering
508 \begin{tabular}{|c|c|}
509 \hline
510 \rowcolor[gray]{0.75}Video format index & Video format description \\
511 \hline
512 0 & Custom Format\\
513 \hline
514 1 & QSIF525\\
515 \hline
516 2 & QCIF\\
517 \hline
518 3 & SIF525\\
519 \hline
520 4 & CIF\\
521 \hline
522 5 & 4SIF525\\
523 \hline
524 6 & 4CIF\\
525 \hline
526 7 & SD 480I-60 (525 Line 59.94 Field/s Standard Definition)\\
527 \hline
528 8 & SD 576I-50 (625 Line 50 Field/s Standard Definition)\\
529 \hline
530 9 & HD 720P-60 (720 Line 59.94 Frame/s High Definition)\\
531 \hline
532 10 & HD 720P-50 (720 Line 50 Frame/s High Definition)\\
533 \hline
534 11 & HD 1080I-60 (1080 Line 60 Field/s High Definition)\\
535 \hline
536 12 & HD 1080I-50 (1080 Line 50 Field/s High Definition)\\
537 \hline
538 13 & HD 1080P-60 (1080 Line 59.94 Frame/s High Definition)\\
539 \hline
540 14 & HD 1080P50 (1080 Line 50 Frame/s High Definition)\\
541 \hline
542 15 & DC 2K-24 (2K D-Cinema, 24 Frame/s)\\
543 \hline
544 16 & DC 4K-24 (4K D-Cinema, 24 Frame/s)\\
545 \hline
546 17 & UHDTV 4K-60 (2160-line 59.94 Frame/s UHDTV)\\
547 \hline
548 18 & UHDTV 4K-50 (2160-line 50 Frame/s UHDTV)\\
549 \hline
550 19 & UHDTV 8K-60 (4320-line 59.94 Frame/s UHDTV)\\
551 \hline
552 20 & UHDTV 8K-50 (4320-line 50 Frame/s UHDTV)\\
553 \hline
554 \end{tabular}
555 \caption{Dirac predefined video formats}
556 \label{table:videoformats}
557 \end{table}
559 \begin{informative}
560 \begin{enumerate}
561 \item The custom format is intended for use when no other suitable base video
562 format is available from the table. Video format defaults will still be set as
563 per Annex~\ref{videoformatdefaults}, but these are token values which are expected
564 to be almost wholly overridden by the subsequent source parameters.
565 \item The base video format ought to be as close as possible to the desired video
566 format, especially in terms of picture dimensions and frame rate.
567 \item True 60Hz formats can be encoded by overriding the frame rate parameters
568 (Section~\ref{framerate}).
569 \end{enumerate}
570 \end{informative}
572 \subsection{Source parameters}
573 \label{sourceparameters}
575 The source parameters are intended to indicate the format of the video that was
576 originally encoded. They provide metadata that indicates how the decoded video
577 should be displayed.
579 The source parameters shall comprise frame size, chroma sampling format,
580 scan format, frame rate, pixel aspect ratio, clean area, signal range
581 and colour specification. The frame size, chroma sampling format,
582 scanning format and the signal range are required to decode the video. Display
583 and downstream processing falls outside the scope of this specification,
584 hence the interpretation of the other parameters (not required to decode
585 the video) is not normatively defined, with the exception of frame rate
586 (Section~\ref{framerate}). The frame rate may impose requirements on
587 compliant decoders for a given level and profile (Annex~\ref{profilelevel}).
589 Source parameter data shall remain constant throughout a Dirac sequence.
591 Default values for the source parameters shall be derived from the video
592 format, as defined in Annex~\ref{videoformatdefaults}. These default
593 values shall be the source parameters unless they are overridden
594 with alternative values encoded
595 as part of the Source Parameters part of the stream.
597 The $source\_parameters()$ process shall return a structure defining
598 the video source parameters. It shall be defined as follows:
600 \begin{pseudo}{source\_parameters}{base\_video\_format}
601 \bsCODE{\VideoParams = set\_source\_defaults(base\_video\_format)}{\ref{setsourcedefaults}}
602 \bsCODE{frame\_size(\VideoParams)}{\ref{framedimensions}}
603 \bsCODE{chroma\_sampling\_format(\VideoParams)}{\ref{chromaformat}}
604 \bsCODE{scan\_format(\VideoParams)}{\ref{scanformat}}
605 \bsCODE{frame\_rate(\VideoParams)}{\ref{framerate}}
606 \bsCODE{pixel\_aspect\_ratio(\VideoParams)}{\ref{aspectratio}}
607 \bsCODE{clean\_area(\VideoParams)}{\ref{cleanarea}}
608 \bsCODE{signal\_range(\VideoParams)}{\ref{signalrange}}
609 \bsCODE{colour\_spec(\VideoParams)}{\ref{colourspec}}
610 \bsRET{\VideoParams}
611 \end{pseudo}
613 \subsubsection{Setting source defaults}
614 \label{setsourcedefaults}
616 The function that sets the default values of the source video parameters
617 shall take the video format index as an argument. That is, the signature of this
618 function is: $set\_source\_defaults(base\_video\_format)$ where
619 $base\_video\_format$ is an unsigned integer. The function returns a map
620 of source video parameters.
622 The source video parameters shall be set, based on the video format index,
623 as defined in Annex~\ref{videoformatdefaults}. The parameters set by this
624 function shall be: frame size, sampling format (4:4:4, 4:2:2 or 4:2:0),
625 scan format (progressive or interlace), frame rate, pixel aspect ratio,
626 clean area, signal range, colour specification. The labels used to access the
627 map returned by the function shall be as defined in the
628 subsequent sections that specify how to override the base video source
629 parameters.
631 \subsubsection{Frame size}
632 \label{framedimensions}
634 The frame size decoding process shall be as follows:
636 \begin{pseudo}{frame\_size}{\VideoParams}
637 \bsITEM{custom\_dimensions\_flag}{bool}{}
638 \bsIF{custom\_dimensions\_flag==\true}
639 \bsITEM{\SFrameWidth}{uint}{}
640 \bsITEM{\SFrameHeight}{uint}{}
641 \bsEND
642 \end{pseudo}
644 Thus is $custom\_dimensions\_flag$ is $\true$, the frame size determined by the
645 base video format shall be overridden.
647 The frame width shall correspond to the width of the coded video, in pixels, that
648 is coded in the stream. The frame height shall correspond to the number of lines
649 per frame in the coded video, irrespective of whether the coded video is
650 progressively scanned or is interlaced.
652 \subsubsection{Chroma sampling format}
653 \label{chromaformat}
655 The chroma sampling format decoding process shall be as follows:
657 \begin{pseudo}{chroma\_sampling\_format}{\VideoParams}
658 \bsITEM{custom\_chroma\_format\_flag}{bool}{}
659 \bsIF{custom\_chroma\_format\_flag==\true}
660 \bsITEM{\SChromaFormatIndex}{uint}{}
661 \bsEND
662 \end{pseudo}
664 Thus if $custom\_chroma\_format\_flag$ is $\true$ then the base video format
665 value is overridden.
667 The decoded value of $\SChromaFormatIndex$ shall lie in the range 0 to 2 with
668 values as defined in table \ref{tab:chromaformats}:
670 \begin{table}[!ht]
671 \centering
672 \begin{tabular}{|c|c|}
673 \hline
674 \rowcolor[gray]{0.75}\SChromaFormatIndex & {\bf Chroma format} \\
675 \hline
676 0 & 4:4:4 \\
677 \hline
678 1 & 4:2:2 \\
679 \hline
680 2 & 4:2:0 \\
681 \hline
682 \end{tabular}
683 \caption{Supported chroma sampling formats}\label{tab:chromaformats}
684 \end{table}
686 The chroma sampling format shall be used to determine the width and height of the
687 chroma components of the coded video as described in Section~\ref{picturedimensions} below.
689 \subsubsection{Scan format}
690 \label{scanformat}
692 The scan format parameter shall indicate whether the source video
693 represents progressive frames or interlaced fields.
695 The scan format decoding process shall be defined as follows:
697 \begin{pseudo}{scan\_format}{\VideoParams}
698 \bsITEM{custom\_scan\_format\_flag}{bool}{}
699 \bsIF{custom\_scan\_format\_flag==\true}
700 \bsITEM{\SSourceSampling}{uint}{}
701 \bsEND
702 \end{pseudo}
704 If the custom scan format flag is set to $\true$, the source sampling
705 parameter defined by the base video format values shall be overridden by new values.
707 If $\SSourceSampling$ is set to 0, then the source video shall be progressively
708 sampled. If it is 1, then the source video shall be interlaced. Values greater than 1 shall be reserved.
710 If the source video is interlaced, then $\STopFieldFirst$ shall be $\true$
711 if the top line of the frame is in the earlier field, else $\STopFieldFirst$
712 shall be $\false$. This shall be set only by the base video format and
713 cannot be overridden in the source parameters.
715 Both interlaced and progressive video may be coded as fields or frames.
717 \subsubsection{Frame rate}
718 \label{framerate}
720 The frame rate value (in frames per second) shall be
721 $\SFrameRateNumer$ divided by $\SFrameRateDenom$
723 The process for decoding the frame rate parameters shall be as follows:
725 \begin{pseudo}{frame\_rate}{\VideoParams}
726 \bsITEM{custom\_frame\_rate\_flag}{bool}{}
727 \bsIF{custom\_frame\_rate\_flag==\true}
728 \bsITEM{index}{uint}{}
729 \bsIF{index == 0}
730 \bsITEM{\SFrameRateNumer}{uint}{}
731 \bsITEM{\SFrameRateDenom}{uint}{}
732 \bsELSE
733 \bsCODE{preset\_frame\_rate(\VideoParams,index)}
734 \bsEND
735 \bsEND
736 \end{pseudo}
738 If $custom\_frame\_rate\_flag$ is set to $\true$ the frame rate parameters set
739 by the base video format shall be overridden by new values.
741 The decoded value of $index$ shall fall in the range 0 to 10.
743 If $index$ is 0, then the frame rate numerator and denominator shall be
744 individually defined by unsigned integer values.
746 For values greater than $0$, the process $preset\_frame\_rate(\VideoParams,index)$
747 shall set frame rate elements of $\VideoParams$ according to table \ref{table:frameratevalues}.
749 \begin{table}[!ht]
750 \centering
751 \begin{tabular}{|c|c|c|}
752 \hline
753 \rowcolor[gray]{0.75}$index$ & Numerator & Denominator \\
754 \hline
755 1 & 24000 & 1001 \\
756 \hline
757 2 & 24 & 1 \\
758 \hline
759 3 & 25 & 1 \\
760 \hline
761 4 & 30000 & 1001 \\
762 \hline
763 5 & 30 & 1 \\
764 \hline
765 6 & 50 & 1 \\
766 \hline
767 7 & 60000 & 1001 \\
768 \hline
769 8 & 60 & 1 \\
770 \hline
771 9 & 15000 & 1001 \\
772 \hline
773 10 & 25 & 2 \\
774 \hline
775 \end{tabular}
776 \caption{Available preset frame rate values}\label{table:frameratevalues}
777 \end{table}
779 \begin{informative}
780 Note that what is encoded is frame rate, not picture rate. If the video is coded
781 as fields, then picture rate is twice the encoded frame rate.
782 \end{informative}
784 \subsubsection{Pixel aspect ratio}
785 \label{aspectratio}
787 The pixel aspect ratio shall be defined as the ratio of the parameters:
788 \[\SAspectRatioNumer : \SAspectRatioDenom\]
790 The process for decoding the pixel aspect ratio parameters shall be defined as follows:
792 \begin{pseudo}{pixel\_aspect\_ratio}{\VideoParams}
793 \bsITEM{custom\_pixel\_aspect\_ratio\_flag}{bool}{}
794 \bsIF{custom\_pixel\_aspect\_ratio\_flag==\true}
795 \bsITEM{index}{uint}{}
796 \bsIF{index == 0}
797 \bsITEM{\SAspectRatioNumer}{uint}{}
798 \bsITEM{\SAspectRatioDenom}{uint}{}
799 \bsELSE
800 \bsCODE{preset\_pixel\_aspect\_ratio(\VideoParams,index)}
801 \bsEND
802 \bsEND
803 \end{pseudo}
805 If $custom\_pixel\_aspect\_ratio\_flag$ is set to $\true$, the pixel aspect ratio
806 defined by the default values shall be overridden by the new values defined by the
807 index value.
809 The decoded value of $index$ shall fall in the range 0 to 6.
811 If the value of $index$ is 0, then the pixel aspect ratio numerator and denominator
812 shall be individually defined by unsigned integer values.
814 If $index>0$, the process $preset\_pixel\_aspect\_ratio(\VideoParams, index)$
815 shall set the pixel aspect ratio according to table \ref{table:aspectratiovalues}.
817 \begin{table}[!ht]
818 \centering
819 \begin{tabular}{|c|c|c|}
820 \hline
821 \rowcolor[gray]{0.75}$index$ & Numerator & Denominator \\
822 \hline
823 1 (Square Pixels) & 1 & 1 \\
824 \hline
825 2 (525-line systems) & 10 & 11 \\
826 \hline
827 3 (625-line systems) & 12 & 11 \\
828 \hline
829 4 (16:9 525-line systems) & 40 & 33 \\
830 \hline
831 5 (16:9 625-line systems) & 16 & 11 \\
832 \hline
833 6 (reduced horizontal resolution) & 4 & 3 \\
834 \hline
835 \end{tabular}
836 \caption{Available preset pixel aspect ratio values}\label{table:aspectratiovalues}
837 \end{table}
839 \begin{informative}
841 \begin{enumerate}
842 \item The pixel aspect ratio value defines the intended ratio of the pixel
843 sampling such that the viewed picture has no geometric distortion. The pixel aspect
844 ratio of an image is the ratio of the spacing of horizontal samples
845 (pixels) to the spacing of vertical samples (picture lines) on the display device.
846 Pixel aspect ratios (PARs) are fundamental properties of sampled images because
847 they determine the displayed shape of objects in the image. Failure to use the right
848 PAR will result in distorted images, for example circles will be displayed as
849 ellipses etc.
850 \item The pixel apect ratios shown in table \ref{table:aspectratiovalues} assume
851 a 704x480 active picture for 525-line systems and a 704x576 active picture for
852 625-line systems.
853 \item Some video processing tools require an image aspect ratio. This can be
854 derived from the pixel aspect ratio by multiplying the ratio of horizontal to vertical
855 pixels by the pixel aspect ratio. So, for example, for a 704 x 480 line picture, with
856 a pixel aspect ratio of 10:11 the image aspect ratio is (704 x 10)/(480 x 11) which is
857 exactly 4:3.
858 \end{enumerate}
859 \end{informative}
861 \subsubsection{Clean area}
862 \label{cleanarea}
864 The process for decoding the clean area parameters shall be as follows:
866 \begin{pseudo}{clean\_area}{\VideoParams}
867 \bsITEM{custom\_clean\_area\_flag}{bool}{}
868 \bsIF{custom\_clean\_area\_flag==\true}
869 \bsITEM{\SCleanWidth}{uint}{}
870 \bsITEM{\SCleanHeight}{uint}{}
871 \bsITEM{\SLeftOffset}{uint}{}
872 \bsITEM{\STopOffset}{uint}{}
873 \bsEND
874 \end{pseudo}
876 The following restrictions shall apply:
878 \begin{itemize}
879 \item $\SCleanWidth+\SLeftOffset
880 \leq \SFrameWidth$
881 \item $\SCleanHeight+\STopOffset
882 \leq \SFrameHeight$
883 \end{itemize}
885 \begin{informative}
886 The meaning and use of clean area are application defined: it might correspond
887 to that picture which is to be displayed, or define a ``container'' within
888 a picture of larger size.
889 \end{informative}
891 \subsubsection{Signal range}
892 \label{signalrange}
894 The signal range parameters indicate how the signal range of the picture
895 component data, decoded by the Dirac decoder, should be adjusted prior to
896 the colour matrixing operations (described in informative Annex~\ref{signalranges}).
898 The signal range parameters shall also be used to determine the luma depth
899 and chroma depth parameters (Section~\ref{videodepth}) and the resulting
900 clipping levels applied to the decoded video (Section~\ref{pictureclip}).
902 The process for decoding the signal range parameters is as follows:
904 \begin{pseudo}{signal\_range}{\VideoParams}
905 \bsITEM{custom\_signal\_range\_flag}{bool}{}
906 \bsIF{custom\_signal\_range\_flag==\true}
907 \bsITEM{index}{uint}{}
908 \bsIF{index == 0}
909 \bsITEM{\SLumaOffset}{uint}{}
910 \bsITEM{\SLumaExcursion}{uint}{}
911 \bsITEM{\SChromaOffset}{uint}{}
912 \bsITEM{\SChromaExcursion}{uint}{}
913 \bsELSE
914 \bsCODE{preset\_signal\_ranges(\VideoParams,index)}
915 \bsEND
916 \bsEND
917 \end{pseudo}
919 If $custom\_signal\_range\_flag$ is set to $\true$ then the base video format
920 signal range parameters shall be overridden by new values.
922 The decoded value of $index$ shall fall in the range 0 to 4.
924 If $index>0$ the process $preset\_signal\_ranges(\VideoParams,index)$
925 shall set the signal range elements of $\VideoParams$ according to table
926 \ref{table:signalrangevalues}.
928 \begin{table}[!ht]
929 \centering
930 \begin{tabular}{|c|c|c|c|c|}
931 \hline
932 \rowcolor[gray]{0.75}$index$ & Luma offset & Luma excursion & Chroma offset & Chroma excursion\\
933 \hline
934 1 (8 Bit Full Range) & 0 & 255 & 128 & 255\\
935 \hline
936 2 (8 Bit Video) & 16 & 219 & 128 & 224\\
937 \hline
938 3 (10 Bit Video) & 64 & 876 & 512 & 896\\
939 \hline
940 4 (12 Bit Video) & 256 & 3504 & 2048 & 3584\\
941 \hline
942 \end{tabular}
943 \caption{Available signal range presets}\label{table:signalrangevalues}
944 \end{table}
946 \begin{informative}
947 Decoded video is represented within the decoder specification as bi-polar
948 signals. An offset is added when video is output so that it is represented by unsigned
949 integer values.
950 \end{informative}
952 \subsubsection{Color specification}
953 \label{colourspec}
955 The colour specification shall consist of three component parts:
956 \begin{itemize}
957 \item Color primaries
958 \item Color matrix
959 \item Transfer function
960 \end{itemize}
962 Defaults are available for all three parts collectively and individually.
964 The process for decoding the colour specification parameters shall be follows:
966 \begin{pseudo}{colour\_spec}{\VideoParams}
967 \bsITEM{custom\_colour\_spec\_flag}{bool}{}
968 \bsIF{custom\_colour\_spec\_flag==\true}
969 \bsITEM{index}{uint}{}
970 \bsCODE{preset\_colour\_specs(\VideoParams,index)}
971 \bsIF{index == 0}
972 \bsCODE{colour\_primaries(\VideoParams)}{\ref{colourprimaries}}
973 \bsCODE{colour\_matrix(\VideoParams)}{\ref{colourmatrix}}
974 \bsCODE{transfer\_function(\VideoParams)}{\ref{transferfunction}}
975 \bsEND
976 \bsEND
977 \end{pseudo}
979 The decoded value of $index$ shall fall in the range 0 to 4.
981 $preset\_colour\_spec(index)$ shall set the colour primaries, matrix and transfer function elements of $\VideoParams$ as specified
982 in Table \ref{table:colourspecvalues}. If the value of $index$ is 0, these values may be overridden as defined in the succeeding sections.
984 \begin{table}[!ht]
985 \centering
986 \begin{tabular}{|c|c|c|c|c|}
987 \hline
988 \rowcolor[gray]{0.75}$index$ & {\bf Description}& {\bf Primaries} & {\bf Matrix}& {\bf Transfer function}\\
989 \hline
990 0 & Custom & HDTV & HDTV & TV gamma \\
991 \hline
992 1 & SDTV 525 & SDTV 525 & SDTV & TV gamma \\
993 \hline
994 2 & SDTV 625 & SDTV 625 & SDTV & TV gamma \\
995 \hline
996 3 & HDTV & HDTV & HDTV & TV gamma \\
997 \hline
998 4 & D-Cinema & HDTV & HDTV & DCinema gamma\\
999 \hline
1000 \end{tabular}
1001 \caption{Color specification presets}\label{table:colourspecvalues}
1002 \end{table}
1004 \paragraph{Color primaries}
1005 \label{colourprimaries}
1006 $\ $\newline
1007 The colour primaries decoding process shall be defined as follows:
1009 \begin{pseudo}{colour\_primaries}{\VideoParams}
1010 \bsITEM{custom\_colour\_primaries\_flag}{bool}{}
1011 \bsIF{custom\_colour\_primaries\_flag==\true}
1012 \bsITEM{index}{uint}{}
1013 \bsCODE{preset\_colour\_primaries(\VideoParams,index)}
1014 \bsEND
1015 \end{pseudo}
1017 The decoded value of $index$ shall fall in the range 0 to 3.
1019 $preset\_colour\_primaries(\VideoParams,index)$ shall set the colour primaries
1020 element of $\VideoParams$ as specified
1021 in Table \ref{table:primariesvalues}.
1023 \begin{table}[!ht]
1024 \centering
1025 \begin{tabular}{|c|c|c|c|}
1026 \hline
1027 \rowcolor[gray]{0.75}$index$ & {\bf Description} & {\bf Specification} & {\bf Comment} \\
1028 \hline
1029 0 & HDTV & ITU-R BT.709 & Also Computer, Web, sRGB \\
1030 \hline
1031 1 & SDTV 525 & SMPTE 170M & 525 primaries \\
1032 \hline
1033 2 & SDTV 625 & EBU Tech 3213-E & 625 primaries \\
1034 \hline
1035 3 & D-Cinema & SMPTE 428.1 & CIE XYZ \\
1036 \hline
1037 \end{tabular}
1038 \caption{Color primaries presets}\label{table:primariesvalues}
1039 \end{table}
1041 \paragraph{Color matrix}
1042 \label{colourmatrix}
1043 $\ $\newline
1044 The colour matrix decoding process shall be defined as follows:
1046 \begin{pseudo}{colour\_matrix}{}
1047 \bsITEM{colour\_matrix\_flag}{bool}{}
1048 \bsIF{colour\_matrix\_flag==\true}
1049 \bsITEM{index}{uint}{}
1050 \bsCODE{preset\_colour\_matrices(index)}
1051 \bsEND
1052 \end{pseudo}
1054 The decoded value of $index$ shall fall in the range 0 to 2.
1056 The $preset\_colour\_matrices(\VideoParams,index)$ process shall set the colour
1057 matrix element in $\VideoParams$ as specified
1058 in Table \ref{table:matrixvalues}.
1060 \begin{table}[!ht]
1061 \centering
1062 \begin{tabular}{|c|c|c|c|c|}
1063 \hline
1064 \rowcolor[gray]{0.75}$index$ & {\bf Description} & {\bf Specification} & {\bf Color matrix} & {\bf Comment}\\
1065 \hline
1066 0 & HDTV & ITU-R BT.709 & $K_R=0.2126$, $K_B=0.0722$ & Also computer and web\\
1067 \hline
1068 1 & SDTV & ITU-R BT.601 & $K_R=0.299$, $K_B=0.114$ & \\
1069 \hline
1070 2 & Reversible & ITU-T H.264 & YCgCo & \\
1071 \hline
1072 \end{tabular}
1073 \caption{Color matrix presets}\label{table:matrixvalues}
1074 \end{table}
1076 \paragraph{Transfer function}
1077 \label{transferfunction}
1078 $\ $\newline
1079 The transfer function decoding process shall be defined as follows:
1081 \begin{pseudo}{transfer\_function}{\VideoParams}
1082 \bsITEM{custom\_transfer\_function\_flag}{bool}{}
1083 \bsIF{custom\_transfer\_function\_flag==\true}
1084 \bsITEM{index}{uint}{}
1085 \bsCODE{preset\_transfer\_function(\VideoParams,index)}
1086 \bsEND
1087 \end{pseudo}
1089 $index$ shall fall in the range 0 to 3. The $preset\_transfer\_function(\VideoParams,index)$ process shall set the transfer function
1090 element of $\VideoParams$ as specified
1091 in Table \ref{table:transfervalues}.
1093 \begin{table}[!ht]
1094 \centering
1095 \begin{tabular}{|c|c|c|}
1096 \hline
1097 \rowcolor[gray]{0.75}$index$ & {\bf Description} & {\bf Specification}\\
1098 \hline
1099 0 & TV gamm & ITU-R BT.1361\\
1100 \hline
1101 1 & Extended Gamut & ITU-R BT.1361 1998 Annex 1\\
1102 \hline
1103 2 & Linear & Linear\\
1104 \hline
1105 3 & DCI Gamma & SMPTE 428.1\\
1106 \hline
1107 \end{tabular}
1108 \caption{Transfer function presets}\label{table:transfervalues}
1109 \end{table}
1111 \subsection{Picture coding mode}
1112 \label{picturecodingmode}
1114 The picture coding mode value in the sequence header shall determine
1115 whether source video is coded as frames or fields.
1117 If the picture coding mode value is $1$ then pictures shall correspond to fields.
1118 If it is $0$ then pictures shall correspond to frames. Other picture coding mode
1119 values shall be reserved for future extensions.
1121 If video is coded as fields then the earliest field in each frame shall have
1122 an even picture number (Section~\ref{pictureheader}). That is the LSB of the
1123 picture number, expressed as a binary number, indicates field parity.
1125 With field coding each frame shall be split into two fields as indicated
1126 by the scan format (Section~\ref{scanformat}).
1128 An effect of field coding shall be to halve the vertical dimensions of
1129 coded pictures. Hence, once the picture coding mode is known, the
1130 picture dimensions, which shall be stored as part of the global
1131 state variable, shall be set (Section~\ref{picturedimensions}).
1133 \begin{informative}
1134 It is possible to code progressive video as fields. In this case,
1135 the assignment of frame lines to fields will be determined by the
1136 value of the top field first parameter in the base video format
1137 (Annex~\ref{videoformatdefaults}). Note that, according to
1138 Section~\ref{scanformat}, this base format default cannot be overridden
1139 for progressive video, as to do so would be artificial.
1141 Sometimes progressive source video is conveyed as if it were interlaced
1142 (for example using interlaced SDI modes), and could be signaled as such.
1143 This is known as progressive segmented frames (PSF). A Dirac encoder could
1144 detect PSF, and signal video as progressive, yet still code the video as
1145 fields in order to introduce no additional buffering delay in the signal
1146 chain. Or it could take the signaled video format at face value.
1147 \end{informative}
1149 \subsection{Initializing coding parameters}
1150 \label{codingparameters}
1152 The $set\_coding\_parameters()$ process shall initialize the dimensions of the coded picture (frame or field), and the video depth (the maximum number of bits in a decoded video sample), which are needed to decode pictures.
1154 Picture dimensions and video depth shall remain constant throughout a Dirac sequence.
1156 Initialization of the coding parameters shall be as defined in the table below:
1158 \begin{pseudo}{set\_coding\_parameters}{\VideoParams, picture\_coding\_mode}
1159 \bsCODE{picture\_dimensions(\VideoParams, picture\_coding\_mode)}{\ref{picturedimensions}}
1160 \bsCODE{video\_depth(\VideoParams)}{\ref{videodepth}}
1161 \end{pseudo}
1163 \subsubsection{Picture dimensions}
1164 \label{picturedimensions}
1165 The picture dimensions process, which determines the size of coded pictures, shall be defined as follows:
1167 \begin{pseudo}{picture\_dimensions}{\VideoParams, picture\_coding\_mode}
1168 \bsCODE{\LumaWidth = \SFrameWidth}
1169 \bsCODE{\LumaHeight = \SFrameHeight}
1170 \bsCODE{\ChromaWidth = \LumaWidth}
1171 \bsCODE{\ChromaHeight = \LumaHeight}
1172 \bsCODE{chroma\_format\_index = \SChromaFormatIndex]}
1173 \bsIF{chroma\_format\_index == 1}
1174 \bsCODE{\ChromaWidth //= 2}
1175 \bsELSEIF{chroma\_format\_index == 2}
1176 \bsCODE{\ChromaWidth //= 2}
1177 \bsCODE{\ChromaHeight //= 2}
1178 \bsEND
1179 \bsIF{picture\_coding\_mode==1}
1180 \bsCODE{\LumaHeight //=2}
1181 \bsCODE{\ChromaHeight //=2}
1182 \bsEND
1183 \end{pseudo}
1185 The parameter $\SFrameHeight$ refers to the height of a frame. The parameter $\LumaHeight$ refers to the height of a picture. A picture may be either a frame or a field depending on whether it is being coded in an interlaced or progressive mode.
1187 Frame height shall be an integer multiple of picture chroma height.
1189 For convenience, the following utility functions shall be defined:
1191 \begin{pseudo}{chroma\_h\_ratio}{}
1192 \bsRET{\LumaWidth//\ChromaWidth}
1193 \end{pseudo}
1195 \begin{pseudo}{chroma\_v\_ratio}{}
1196 \bsRET{\LumaHeight//\ChromaHeight}
1197 \end{pseudo}
1199 \subsubsection{Video depth}
1200 \label{videodepth}
1201 The $video\_depth()$ process, which determines the maximum number of bits required to represent a sample of the decoded video, shall be defined as follows:
1203 \begin{pseudo}{video\_depth}{\VideoParams}
1204 \bsCODE{\LumaDepth =\intlog2(\SLumaExcursion+1)}
1205 \bsCODE{\ChromaDepth =\intlog2(\SChromaExcursion+1)}
1206 \end{pseudo}
1208 Note that for YCoCg format the luma and chroma depths are different.
1210 \section{Picture syntax}
1211 \label{picturesyntax}
1212 This section specifies the structure of Dirac picture data units.
1214 \subsection{Picture parsing}
1215 \label{picture}
1216 \label{pictureparse}
1218 This section specifies the operation of the $picture\_parse()$ process. The process for
1219 decoding and outputting pictures is specified in Section~\ref{picturedec}.
1221 Picture data may be successfully parsed after parsing a sequence header within the
1222 same Dirac sequence. The picture parsing process shall be defined as follows:
1224 \begin{pseudo}{picture\_parse}{}
1225 \bsCODE{byte\_align()}
1226 \bsCODE{picture\_header()}{\ref{pictureheader}}
1227 \bsIF{is\_inter()}{\ref{parsecodevalues}}
1228 \bsCODE{byte\_align()}
1229 \bsCODE{picture\_prediction()}{\ref{pictureprediction}}
1230 \bsEND
1231 \bsCODE{byte\_align()}
1232 \bsCODE{wavelet\_transform()}{\ref{wavelettransform}}
1233 \end{pseudo}
1235 \subsubsection{Picture header}
1236 \label{pictureheader}
1238 The picture header shall immediately follow a parse info header with a picture parse
1239 code (Section~\ref{parseinfoheader}). The picture header parsing process shall be defined as follows:
1241 \begin{pseudo}{picture\_header}{}
1242 \bsCODE{\PictureNumber=read\_uint\_lit(4)}
1243 \bsIF{is\_inter()}{\ref{parsecodevalues}}
1244 \bsCODE{\RefOneNum=(\PictureNumber+read\_sint())\%2^{32}}
1245 \bsIF{num\_refs() == 2}{\ref{parsecodevalues}}
1246 \bsCODE{\RefTwoNum=(\PictureNumber+read\_sint())\%2^{32}}
1247 \bsEND\bsEND
1248 \bsIF{is\_reference()}{\ref{parsecodevalues}}
1249 \bsCODE{\RetiredPicture=(\PictureNumber+read\_sint())\% 2^{32}}
1250 \bsEND
1251 \end{pseudo}
1253 Picture numbers shall be unique within a sequence and the set of all picture numbers
1254 within a sequence shall form a contiguous block of numbers.
1256 Reference picture numbers shall encoded differentially with respect to the
1257 picture number.
1259 The pictures corresponding to the reference picture numbers of a given picture
1260 shall occur before the given picture in the sequence.
1262 The retired picture shall be a picture which shall be removed from
1263 the reference picture buffer before the current picture is decoded
1264 (Section~\ref{overallpicturedec}). The rules for the
1265 use of the reference picture buffer shall be as defined in Section~\ref{refbuffer}.
1267 %%%%%%%%%%%%%%%%%%%%%%%%%%
1268 \subsection{Picture prediction data}
1269 \label{pictureprediction}
1271 This section defines the picture prediction process that shall be used for decoding
1272 picture prediction parameters and motion vector fields for motion compensation.
1274 The picture prediction process shall be defined as follows:
1276 \begin{pseudo}{picture\_prediction}{}
1277 \bsCODE{picture\_prediction\_parameters()}{\ref{picpredparams}}
1278 \bsCODE{byte\_align()}
1279 \bsCODE{block\_motion\_data()}{\ref{motiondec}}
1280 \end{pseudo}
1282 The decoding and generation of block motion vector fields shall be as defined in Section~\ref{motiondec}.
1284 \subsubsection{Picture prediction parameters}
1285 \label{picpredparams}
1287 Picture prediction parameters consist of metadata required for successful parsing of the
1288 motion data and for performing motion compensation (Section~\ref{motioncompensate}).
1290 The picture prediction parameters shall be defined as follows:
1292 \begin{pseudo}{picture\_prediction\_parameters}{}
1293 \bsCODE{block\_parameters()}{\ref{blockparameters}}
1294 \bsCODE{motion\_vector\_precision()}{\ref{mvprecision}}
1295 \bsCODE{global\_motion()}{\ref{globalmotion}}
1296 \bsCODE{picture\_prediction\_mode()}{\ref{picpredmode}}
1297 \bsCODE{reference\_picture\_weights()}{\ref{refpicweights}}
1298 \end{pseudo}
1300 \subsubsection{Block parameters}
1301 \label{blockparameters}
1303 This section specifies the operation of the process for
1304 setting motion compensation block parameters, which shall consist of the state variables
1305 $\LumaXBlen$, $\LumaYBlen$, $\LumaXBsep$, and $\LumaYBsep$
1306 defining luma blocks, and $\ChromaXBlen$, $\ChromaYBlen$, $\ChromaXBsep$,
1307 and $\ChromaYBsep$ defining chroma blocks.
1309 \begin{pseudo}{block\_parameters}{}
1310 \bsITEM{index}{uint}
1311 \bsIF{index == 0}
1312 \bsITEM{\LumaXBLen}{uint}{}
1313 \bsITEM{\LumaYBLen}{uint}{}
1314 \bsITEM{\LumaXBSep}{uint}{}
1315 \bsITEM{\LumaYBSep}{uint}{}
1316 \bsELSE
1317 \bsCODE{preset\_block\_params(index)}
1318 \bsEND
1319 \bsCODE{chroma\_block\_params()}{\ref{chromablockparams}}
1320 \bsCODE{motion\_data\_dimensions()}{\ref{motiondatadimensions}}
1321 \end{pseudo}
1323 $index$ shall lie in the range 0 to 4.
1325 The $preset\_block\_params(index)$ shall set the block parameters as specified
1326 in Table \ref{blockparamsvalues}.
1328 Chroma block parameter values shall be determined from luma values
1329 as defined in Section~\ref{chromablockparams}).
1331 The dimensions of motion data arrays (numbers of blocks and superblocks) shall
1332 be as defined in Section~\ref{motiondatadimensions}.
1334 \begin{table}[!ht]
1335 \centering
1336 \begin{tabular}{|c|c|c|c|c|}
1337 \hline
1338 \rowcolor[gray]{0.75}$index$ & \LumaXBlen & \LumaYBlen & \LumaXBsep & \LumaYBsep \\
1339 \hline
1340 1 & 8 & 8 & 4 & 4 \\
1341 \hline
1342 2 & 12 & 12 & 8 & 8\\
1343 \hline
1344 3 & 16 & 16 & 12 & 12\\
1345 \hline
1346 4 & 24 & 24 & 16 & 16\\
1347 \hline
1348 \end{tabular}
1349 \caption{Luma block parameter presets}\label{blockparamsvalues}
1350 \end{table}
1352 Block parameters shall satisfy the following constraints:
1354 \begin{enumerate}
1355 \item $\LumaXBlen$, $\LumaYBlen$, $\LumaXBsep$, and $\LumaYBsep$ shall all be positive
1356 multiples of 4
1357 \item $\LumaXBlen\geq\LumaXBsep$ and $\LumaYBlen\geq\LumaYBsep$
1358 \item $\LumaXBlen\leq 2*\LumaXBsep$ and $\LumaYBlen\leq 2*\LumaYBsep$
1359 \end{enumerate}
1361 \begin{informative}
1362 Note that these requirements do not preclude length from equalling separation, i.e.
1363 motion compensation blocks that are not overlapped.
1364 \end{informative}
1366 \subsubsection{Setting chroma block parameters}
1367 \label{chromablockparams}
1369 This section defines how chroma block parameters shall be derived from luma block dimensions.
1371 Chroma block parameters shall be equal to the corresponding luma block parameters scaled according to the chroma vertical and horizontal subsampling ratios. In this way chroma blocks and luma blocks are co-located in the video picture.
1373 \begin{pseudo}{chroma\_block\_params}{}
1374 \bsCODE{\ChromaXBlen=\LumaXBlen//chroma\_h\_ratio()}{\ref{picturedimensions}}
1375 \bsCODE{\ChromaYBlen=\LumaYBlen//chroma\_v\_ratio()}{\ref{picturedimensions}}
1376 \bsCODE{\ChromaXBsep=\LumaXBsep//chroma\_h\_ratio()}{\ref{picturedimensions}}
1377 \bsCODE{\ChromaYBsep=\LumaYBsep//chroma\_v\_ratio()}{\ref{picturedimensions}}
1378 \end{pseudo}
1380 \subsubsection{Numbers of blocks and superblocks}
1381 \label{motiondatadimensions}
1383 The number of blocks and superblocks horizontally and vertically shall be set
1384 as follows:
1386 \begin{pseudo}{motion\_data\_dimensions}{}
1387 \bsCODE{\SuperblocksX = \LumaWidth+4*\LumaXBsep-1}
1388 \bsCODE{\SuperblocksX//= 4*\LumaXBsep}
1389 \bsCODE{\SuperblocksY = \LumaHeight+4*\LumaYBsep-1}
1390 \bsCODE{\SuperblocksY//= 4*\LumaYBsep}
1391 \bsCODE{\BlocksX = 4*\SuperblocksX}
1392 \bsCODE{\BlocksY = 4*\SuperblocksY}
1393 \end{pseudo}
1395 These values shall determine the size of motion data arrays as per Section
1396 \ref{motioninit}.
1398 \begin{informative}
1399 The number of superblocks is set so that the dimensions of the picture are
1400 entirely covered by superblocks at a separation of $4*\LumaXBsep$ horizontally
1401 and $4*\LumaYBsep$ vertically.
1402 \end{informative}
1404 \subsubsection{Motion vector precision}
1405 \label{mvprecision}
1407 The motion vector precision process shall be as follows:
1409 \begin{pseudo}{motion\_vector\_precision}{}
1410 \bsITEM{\MotionVectorPrecision}{uint}
1411 \end{pseudo}
1413 $\MotionVectorPrecision$ shall lie in the range 0 (pixel-accurate) to 3 (1/8th-pixel accurate).
1415 \subsubsection{Global motion}
1416 \label{globalmotion}
1418 Global motion parameters shall be encoded if the $\PictureUsingGlobal$ flag is set
1419 to $\true$. Up to two sets shall be encoded,
1420 depending upon the number of references.
1422 The global motion process shall be as follows:
1424 \begin{pseudo}{global\_motion}{}
1425 \bsITEM{\PictureUsingGlobal}{bool}{}
1426 \bsIF{\PictureUsingGlobal==\true}
1427 \bsCODE{global\_motion\_parameters(\GlobalParams[1])}
1428 \bsIF{num\_refs() == 2}
1429 \bsCODE{global\_motion\_parameters(\GlobalParams[2])}
1430 \bsEND
1431 \bsEND
1432 \end{pseudo}
1434 Each of the global motion parameters shall consist of three elements:
1436 \begin{itemize}
1437 \item an integer pan/tilt vector $\GlobalParams[n][\PanTilt]$
1438 \item an integer 2x2 matrix element $\GlobalParams[n][\ZRS]$
1439 capturing zoom, rotation and shear, together with a scaling exponent
1440 $\GlobalParams[n][\ZRSexponent]$
1441 \item an integer perspective vector $\GlobalParams[n][pespective]$
1442 capturing the effect of non-orthogonal projection onto the image plane, together
1443 with a scaling exponent $\GlobalParams[n][pespective\_exp]$
1444 \end{itemize}
1446 Their interpretation and the process for generating a global motion vector field
1447 shall be as defined in Section~\ref{globalmv}.
1449 The global motion parameters process shall be defined as follows:
1451 \begin{pseudo}{global\_motion\_parameters}{gparams}
1452 \bsCODE{pan\_tilt(gparams)}
1453 \bsCODE{zoom\_rotate\_shear(gparams)}
1454 \bsCODE{perspective(gparams)}
1455 \end{pseudo}
1457 The $pan\_tilt()$ process shall extracts horizontal and vertical translation elements
1458 and shall be defined as follows:
1460 \begin{pseudo}{pan\_tilt}{gparams}
1461 \bsCODE{gparams[\PanTilt]={\mathbf{0}} }
1462 \bsITEM{nonzero\_pan\_tilt\_flag}{bool}{}
1463 \bsIF{nonzero\_pan\_tilt\_flag==\true}
1464 \bsITEM{gparams[\PanTilt][0]}{sint}{}
1465 \bsITEM{gparams[\PanTilt][1]}{sint}{}
1466 \bsEND
1467 \end{pseudo}
1469 The $zoom\_rotate\_shear()$ process shall extract a linear matrix element and shall be
1470 as defined as follows:
1472 \begin{pseudo}{zoom\_rotation\_shear}{gparams}
1473 \bsITEM{nontrivial\_zrs\_flag}{bool}{}
1474 \bsIF{nontrivial\_zrs\_flag==\true}
1475 \bsITEM{gparams[\ZRSexponent]}{uint}{}
1476 \bsITEM{gparams[\ZRS][0][0]}{sint}{}
1477 \bsITEM{gparams[\ZRS][0][1]}{sint}{}
1478 \bsITEM{gparams[\ZRS][1][0]}{sint}{}
1479 \bsITEM{gparams[\ZRS][1][1]}{sint}{}
1480 \bsELSE
1481 \bsCODE{gparams[\ZRSexponent]=0}
1482 \bsCODE{gparams[\ZRS][0][0]=1}
1483 \bsCODE{gparams[\ZRS][0][1]=0}
1484 \bsCODE{gparams[\ZRS][1][0]=0}
1485 \bsCODE{gparams[\ZRS][1][1]=1}
1486 \bsEND
1487 \end{pseudo}
1489 The $perspective()$ process shall extract horizontal and vertical perspective
1490 elements and shall be defined as follows:
1492 \begin{pseudo}{perspective}{gparams}
1493 \bsITEM{nonzero\_perspective\_flag}{bool}{}
1494 \bsIF{nonzero\_perspective\_flag==\true}
1495 \bsITEM{gparams[\PerspectiveExponent]}{uint}{}
1496 \bsITEM{gparams[\Perspective][0]}{sint}{}
1497 \bsITEM{gparams[\Perspective][1]}{sint}{}
1498 \bsELSE
1499 \bsCODE{gparams[\PerspectiveExponent]=0}
1500 \bsCODE{gparams[\Perspective]={\mathbf{0}} }
1501 \bsEND
1502 \end{pseudo}
1504 \subsubsection{Picture prediction mode}
1505 \label{picpredmode}
1507 The picture prediction mode encodes alternative methods of motion compensation
1508 and is present to support future extensions of this specification.
1510 It shall be defined as follows:
1512 \begin{pseudo}{picture\_prediction\_mode}{}
1513 \bsITEM{\PicturePredictionModeIndex}{uint}
1514 \end{pseudo}
1516 In this specification, $\PicturePredictionModeIndex$ shall be 0.
1518 \subsubsection{Reference picture weight values}
1519 \label{refpicweights}
1521 Reference picture weight values shall be determined as follows:
1523 \begin{pseudo}{reference\_picture\_weights}{}
1524 \bsCODE{\RefsWeightPrecision=1}
1525 \bsCODE{\RefOneWeight=1}
1526 \bsCODE{\RefTwoWeight=1}
1527 \bsITEM{custom\_weights\_flag}{bool}
1528 \bsIF{custom\_weights\_flag==\true}
1529 \bsITEM{\RefsWeightPrecision}{uint}
1530 \bsITEM{\RefOneWeight}{sint}
1531 \bsIF{num\_refs() == 2}
1532 \bsITEM{\RefTwoWeight}{sint}
1533 \bsEND
1534 \bsEND
1535 \end{pseudo}
1537 \begin{informative}
1538 For bi-directional prediction modes, reference 1 data will be weighted by
1540 $\dfrac{\RefOneWeight}{2^\RefsWeightPrecision}$
1542 and reference 2 data by
1544 $\dfrac{\RefTwoWeight}{2^\RefsWeightPrecision}$
1546 (see Section~\ref{blockmc}).
1548 The picture weights are signed integers and may be negative. In
1549 addition, they may not sum to $2^\RefsWeightPrecision$, to accomodate fade
1550 prediction.
1551 \end{informative}
1553 %%%%%%%%%%%%%%%%%%%%%%%%%%
1554 \subsection{Wavelet transform data}
1555 \label{wavelettransform}
1557 The wavelet transform syntax shall provide metadata determining the wavelet transform
1558 parameters (including filter type, transform depth, and codeblock or slice structures) together with the transformed wavelet coefficients.
1560 The wavelet transform process for parsing transform metadata and coefficients shall be defined as follows:
1562 \begin{pseudo}{wavelet\_transform}{}
1563 \bsCODE{\ZeroResidual = \false}
1564 \bsIF{is\_inter()}{\ref{parsecodevalues}}
1565 \bsITEM{\ZeroResidual}{bool}
1566 \bsEND
1567 \bsIF{\ZeroResidual == \false}
1568 \bsCODE{transform\_parameters()}{\ref{transformparameters}}
1569 \bsCODE{byte\_align()}
1570 \bsCODE{transform\_data()}{\ref{wltunpacking}}
1571 \bsEND
1572 \end{pseudo}
1574 Parsing (unpacking) the wavelet transform data shall be as defined in Section~\ref{wltunpacking}.
1576 Decoding the transformed wavelet transform data to produce decoded pictures shall be
1577 as defined in Section~\ref{picturedec}.
1579 If $\ZeroResidual=\true$ then all component pixels shall be
1580 set to zero (Section~\ref{overallpicturedec}).
1582 \subsubsection{Transform parameters}
1583 \label{transformparameters}
1585 The wavelet transform parameters shall define the metadata required to configure the inverse wavelet transform for both the low delay and core syntax.
1587 The $transform\_parameters()$ process shall be defined as follows:
1589 \begin{pseudo}{transform\_parameters}{}
1590 \bsITEM{\WaveletIndex}{uint}{\ref{wltfilter}}
1591 \bsITEM{\TransformDepth}{uint}{\ref{wltdepth}}
1592 \bsIF{is\_low\_delay()==\false}
1593 \bsCODE{codeblock\_parameters()}{\ref{codeblockparams}}
1594 \bsELSE
1595 \bsCODE{slice\_parameters()}{\ref{sliceparams}}
1596 \bsCODE{quant\_matrix()}{\ref{quantmatrix}}
1597 \bsEND
1598 \end{pseudo}
1600 \paragraph{Wavelet filters}
1601 \label{wltfilter}
1602 $\ $\newline
1604 The wavelet filter parameter shall define the wavelet filter used by the Dirac stream. T
1605 The value of $\WaveletIndex$ shall lie in the range 0 to 6 with values as
1606 defined in Table \ref{wltfilterpresets}:
1608 \begin{table}[!ht]
1609 \centering
1610 \begin{tabular}{|c|c|}
1611 \hline
1612 \rowcolor[gray]{0.75}\WaveletIndex & {\bf Filter} \\
1613 \hline
1614 0 & Deslauriers-Dubuc (9,7) \\
1615 \hline
1616 1 & LeGall (5,3) \\
1617 \hline
1618 2 & Deslauriers-Dubuc (13,7) \\
1619 \hline
1620 3 & Haar with no shift \\
1621 \hline
1622 4 & Haar with single shift per level\\
1623 \hline
1624 5 & Fidelity filter \\
1625 \hline
1626 6 & Daubechies (9,7) integer approximation \\
1627 \hline
1628 \end{tabular}
1629 \caption{Wavelet filter presets}\label{wltfilterpresets}
1630 \end{table}
1633 The implementation of the chosen wavelet filter shall be as defined
1634 in Section~\ref{wltfilters}.
1637 \begin{informative}
1638 For consistency, the filter nomenclature $(m, n)$ refers to the length of the analysis low-pass
1639 and high-pass filters in the conventional prefiltering (i.e. before subsampling)
1640 model of wavelet filtering. They do not reflect the length of lifting filters, which
1641 operate in the subsampled domain: see Section~\ref{wltfilters}. Deslauriers-Dubuc
1642 filters are normally referred to in terms of the number of vanishing moments of their
1643 synthesis filters, so the (9,7) and (13,7) filters may be referred to in the literature
1644 as (2,2) and (4,2) filters respectively.
1645 \end{informative}
1647 \subsubsection{Transform depth}
1648 \label{wltdepth}
1650 The transform depth parameter shall determine the number of stages in the wavelet transform.that the vertical and horizontal wavelet filters are applied.
1652 Note: The transform depth determines the number of
1653 subbands and the the dimensions of the subband data array (Section~\ref{wltinit}).
1655 \subsubsection{Codeblock parameters (core syntax only)}
1656 \label{spatialpartition}
1657 \label{codeblockparams}
1659 In the core syntax only, each subband may be partitioned into a number of code blocks.
1661 The process for extracting codeblock parameters shall be as follows:
1663 \begin{pseudo}{codeblock\_parameters}{}
1664 \bsCODE{\CodeblockMode=0}
1665 \bsFOR{level=0}{\TransformDepth}
1666 \bsCODE{\CodeblocksX[level]=1}
1667 \bsCODE{\CodeblocksY[level]=1}
1668 \bsEND
1669 \bsITEM{spatial\_partition\_flag}{bool}
1670 \bsIF{spatial\_partition\_flag==\true}
1671 \bsFOR{level=0}{\TransformDepth}
1672 \bsITEM{\CodeblocksX[level]}{uint}
1673 \bsITEM{\CodeblocksY[level]}{uint}
1674 \bsEND
1675 \bsITEM{\CodeblockMode}{uint}
1676 \bsEND
1677 \end{pseudo}
1679 The presence of codeblocks in subbands shall be indicated by setting $spatial\_partition\_flag$ to $\true$; otherwise it shall be $\false$.
1681 The number of codeblocks to be used for subbands at each transform depth level shall be encoded in $\CodeblocksY[level]$ and $\CodeblocksX[level]$ for vertical and horizontal axes respectively.
1683 The codeblock mode is encoded in $\CodeblockMode$, which shall have value 0 or 1, with meanings as defined in Table \ref{codeblockmodes}.
1685 \begin{table}[!ht]
1686 \centering
1687 \begin{tabular}{|c|c|}
1688 \hline
1689 \rowcolor[gray]{0.75}$\CodeblockMode$ & {\bf Description} \\
1690 \hline
1691 0 & Single quantiser per subband, used for all codeblocks\\
1692 \hline
1693 1 & Multiple Quantiser per subband, one for each codeblock \\
1694 \hline
1695 \end{tabular}
1696 \caption{Codeblock modes}\label{codeblockmodes}
1697 \end{table}
1699 The operation of subband codeblock decoding shall be as defined in Section~\ref{codeblocks}.
1701 \subsubsection{Slice coding parameters (low delay syntax only)}
1702 \label{sliceparams}
1704 This slice parameters process shall be defined as follows:
1706 \begin{pseudo}{slice\_parameters}{}
1707 \bsITEM{\SlicesX}{uint}
1708 \bsITEM{\SlicesY}{uint}
1709 \bsITEM{\SliceBytesNum}{uint}
1710 \bsITEM{\SliceBytesDenom}{uint}
1711 \end{pseudo}
1713 \subsubsection{Quantisation matrices (low-delay syntax)}
1714 \label{quantmatrix}
1716 The quantization matrix shall be used to modify the slice quantizer for each subband in
1717 a slice. The quantization matrix shall be encoded in the $\QuantMatrix$ decoder variable.
1719 The $quant\_matrix()$ process shall be defined as follows:
1721 \begin{pseudo}{quant\_matrix}{}
1722 \bsITEM{custom\_quant\_matrix}{bool}
1723 \bsIF{custom\_quant\_matrix==\true}
1724 \bsITEM{\QuantMatrix[0][\LL]}{uint}
1725 \bsFOR{level=1}{\TransformDepth}
1726 \bsITEM{\QuantMatrix[level][\HL]}{uint}
1727 \bsITEM{\QuantMatrix[level][\LH]}{uint}
1728 \bsITEM{\QuantMatrix[level][\HH]}{uint}
1729 \bsEND
1730 \bsELSE
1731 \bsCODE{set\_quant\_matrix()}
1732 \bsEND
1733 \end{pseudo}
1735 If $\TransformDepth> 4$ then $custom\_quant\_matrix$ shall be $\true$.
1737 If $\TransformDepth \leq 4$, then custom quantization
1738 matrices may still be transmitted,
1739 for example to apply a different degree of perceptual weighting
1740 (see Annex~\ref{qmatrixdesign}).
1742 The function $set\_quant\_matrix()$ shall set the quantization matrix
1743 based on the wavelet filter as per Annex~\ref{defaultquantmatrices}. These are
1744 unweighted matrices, whose values merely compensate for the differential power
1745 gain of the different subband ?lters. For perceptual weighting a custom
1746 quantisation matrix must be used.