Skip to main content

5. Syntax and Semantics

This section preserves the RFC text for APV, including bitstream syntax, syntax element processing, decoding and parsing processes, metadata, profiles, levels, bands, raw bitstream format, and implementation references.

Original RFC Text

5.  Syntax and Semantics

5.1. Method of Specifying Syntax

The syntax tables specify a superset of the syntax of all allowed
bitstreams. Note that a decoder MUST implement some means for
identifying entry points into the bitstream and some means to
identify and handle non-conforming bitstreams. The methods for
identifying and handling errors and other such situations are not
specified in this document.

The APV bitstream is described using syntax code based on the C
programming language [ISO9899] -- including use of if/else, while,
and for -- as well as functions defined within this document.

The syntax table in syntax code is presented in a two-column format
such as shown in Figure 7. In this form, the type column provides a
type referenced in that same line of syntax code by using the syntax
elements processing functions defined in Section 5.2.5.

syntax code | type
--------------------------------------------------------------|-----
ExampleSyntaxCode(){ |
operations |
syntax_element | u(n)
} |

Figure 7: A depiction of type-labeled syntax code for syntax
description in this document

5.2. Syntax Functions and Descriptors

The functions presented in this document are used in the syntactical
description. These functions are expressed in terms of the value of
a bitstream pointer that indicates the position of the next bit to be
read by the decoding process from the bitstream.

5.2.1. byte_aligned()

* If the current position in the bitstream is on the last bit of a
byte, i.e., the next bit in the bitstream is the first bit in a
byte, the return value of byte_aligned() is equal to TRUE.

* Otherwise, the return value of byte_aligned() is equal to FALSE.

5.2.2. more_data_in_tile()

* If the current position in the i-th tile() syntax structure is
less than TileSize[i] in bytes from the beginning of the
tile_header() syntax structure of the i-th tile, the return value
of more_data_in_tile() is equal to TRUE.

* Otherwise, the return value of more_data_in_tile() is equal to
FALSE.

5.2.3. next_bits(n)

This function provides the next n bits in the bitstream for
comparison purposes, without advancing the bitstream pointer.

5.2.4. read_bits(n)

This function indicates that the next n bits from the bitstream are
to be read and it advances the bitstream pointer by n bit positions.
When n is equal to 0, read_bits(n) is specified to return a value
equal to 0 and to not advance the bitstream pointer.

5.2.5. Syntax Element Processing Functions

b(8): byte having any pattern of bit string (8 bits). The parsing
process for this descriptor is specified by the return value of
the function read_bits(8).

f(n): fixed-pattern bit string using n bits written (from left to
right) with the left bit first, i.e., big endian format. The
parsing process for this descriptor is specified by the return
value of the function read_bits(n).

u(n): unsigned integer using n bits. The parsing process for this
descriptor is specified by the return value of the function
read_bits(n) interpreted as a binary representation of an unsigned
integer with the most significant bit written first.

h(v): variable-length entropy coded syntax element with the left bit
first, i.e., big endian format. The parsing process for this
descriptor is specified in Section 7.1.

5.3. List of Syntax and Semantics

5.3.1. Access Unit

syntax code | type
--------------------------------------------------------------|-----
access_unit(au_size){ |
signature | f(32)
currReadSize = 4 |
do(){ |
pbu_size | u(32)
currReadSize += 4 |
pbu() |
currReadSize += pbu_size |
} while (au_size > currReadSize) |
} |

Figure 8: access unit syntax code

signature
A four-character code that identifies the bitstream as an APV AU.
The value MUST be 'aPv1' (0x61507631).

pbu_size
the size of a primitive bitstream unit in bytes. A value of 0 is
prohibited and the value of 0xFFFFFFFF for pbu_size is reserved
for future use.

Note: An AU consists of one primary frame, zero or more non-primary
frames such as a frame for additional view, zero or more alpha
frames, zero or more depth frames, zero or more preview frames such
as a frame with smaller resolution, zero or more metadata, and zero
or more fillers.

5.3.2. Primitive Bitstream Unit

syntax code | type
--------------------------------------------------------------|-----
pbu(){ |
pbu_header() |
if((1 <= pbu_type && pbu_type <=2) || |
(25 <= pbu_type && pbu_type <= 27)) |
frame() |
else if(pbu_type == 65) |
au_info() |
else if(pbu_type == 66) |
metadata() |
else if (pbu_type == 67) |
filler() |
} |

Figure 9: primitive bitstream unit syntax code

5.3.3. Primitive Bitstream Unit Header

syntax code | type
--------------------------------------------------------------|-----
pbu_header(){ |
pbu_type | u(8)
group_id | u(16)
reserved_zero_8bits | u(8)
} |

Figure 10: primitive bitstream unit header syntax code

pbu_type
indicates the type of data in a PBU listed in Table 3. Other
values of pbu_type are reserved for future use.

+==========+=========================+=======+
| pbu_type | meaning | notes |
+==========+=========================+=======+
| 0 | reserved | |
+----------+-------------------------+-------+
| 1 | primary frame | |
+----------+-------------------------+-------+
| 2 | non-primary frame | |
+----------+-------------------------+-------+
| 3...24 | reserved | |
+----------+-------------------------+-------+
| 25 | preview frame | |
+----------+-------------------------+-------+
| 26 | depth frame | |
+----------+-------------------------+-------+
| 27 | alpha frame | |
+----------+-------------------------+-------+
| 28...64 | reserved | |
+----------+-------------------------+-------+
| 65 | access unit information | |
+----------+-------------------------+-------+
| 66 | metadata | |
+----------+-------------------------+-------+
| 67 | filler | |
+----------+-------------------------+-------+
| 68...255 | reserved | |
+----------+-------------------------+-------+

Table 3: List of PBU types

Note: A PBU with pbu_type equal to 65 (access unit information)
may happen in an AU. If it exists, it MUST be the first PBU in an
AU, and it can be ignored by a decoder.

group_id
indicates the identifier to associate a coded frame with metadata.
More than two frames can have the same group_id in a single AU. A
primary frame and a non-primary frame MUST have different group_id
values, and two non-primary frames MUST have different group_id
values. When the value of group_id is equal to 0, the value of
pbu_type MUST be greater than 64. The value of 0xFFFF for
group_id is reserved for future use.

reserved_zero_8bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

5.3.4. Frame

syntax code | type
--------------------------------------------------------------|-----
frame(){ |
frame_header() |
for(i = 0; i < NumTiles; i++){ |
tile_size[i] | u(32)
tile(i) |
} |
filler() |
} |

Figure 11: frame() syntax code

tile_size[i]
indicates the size in bytes of i-th tile data (i.e., tile(i)) in
raster order in a frame. The value of 0 for tile_size[i] is
reserved for future use.

The variable TileSize[i] is set equal to tile_size[i].

5.3.5. Frame Header

syntax code | type
--------------------------------------------------------------|-----
frame_header(){ |
frame_info() |
reserved_zero_8bits | u(8)
color_description_present_flag | u(1)
if(color_description_present_flag){ |
color_primaries | u(8)
transfer_characteristics | u(8)
matrix_coefficients | u(8)
full_range_flag | u(1)
} |
use_q_matrix | u(1)
if(use_q_matrix){ |
quantization_matrix() |
} |
tile_info() |
reserved_zero_8bits | u(8)
byte_alignment() |
} |

Figure 12: frame_header() syntax code

reserved_zero_8bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

color_description_present_flag equal to 1
specifies that color_primaries, transfer_characteristics, and
matrix_coefficients are present. color_description_present_flag
equal to 0 specifies that color_primaries,
transfer_characteristics, and matrix_coefficients are not present.

color_primaries
MUST have the semantics of ColourPrimaries as specified in [H273].
When the color_primaries syntax element is not present, the value
of color_primaries is inferred to be equal to 2.

transfer_characteristics
MUST have the semantics of TransferCharacteristics as specified in
[H273]. When the transfer_characteristics syntax element is not
present, the value of transfer_characteristics is inferred to be
equal to 2.

matrix_coefficients
MUST have the semantics of MatrixCoefficients as specified in
[H273]. When the matrix_coefficients syntax element is not
present, the value of matrix_coefficients is inferred to be equal
to 2.

full_range_flag
MUST have the semantics of VideoFullRangeFlag as specified in
[H273]. When the full_range_flag syntax element is not present,
the value of full_range_flag is inferred to be equal to 0.

use_q_matrix
with a value of 1 specifies that the quantization matrices are
present. A value of 0 specifies that the quantization matrices
are not present.

reserved_zero_8bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

5.3.6. Frame Information

syntax code | type
--------------------------------------------------------------|-----
frame_info(){ |
profile_idc | u(8)
level_idc | u(8)
band_idc | u(3)
reserved_zero_5bits | u(5)
frame_width | u(24)
frame_height | u(24)
chroma_format_idc | u(4)
bit_depth_minus8 | u(4)
capture_time_distance | u(8)
reserved_zero_8bits | u(8)
} |

Figure 13: frame_info() syntax code

profile_idc
indicates a profile to which the coded frame conforms as specified
in Section 9. Bitstreams SHALL NOT contain values of profiles_idc
other than those specified in Section 9. Other values of
profile_idc are reserved for future use.

level_idc
indicates a level to which the coded frame conforms as specified
in Section 9. Bitstreams SHALL NOT contain values of level_idc
other than those specified in Section 9. Other values of
level_idc are reserved for future use.

band_idc
specifies a maximum coded data rate of level_idc as specified in
Section 9. Bitstreams SHALL NOT contain values of band_idc other
than those specified in Section 9. The value of band_idc MUST be
in the range of 0 to 3. Other values of band_idc are reserved for
future use.

reserved_zero_5bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

frame_width
specifies the width of the frame in units of luma samples.
frame_width MUST be a multiple of 2 when chroma_format_idc has a
value of 2. The value 0 is reserved for future use.

frame_height
specifies the height of the frame in units of luma samples. The
value 0 is reserved for future use.

The variables FrameWidthInMbsY, FrameHeightInMbsY,
FrameWidthInSamplesY, FrameHeightInSamplesY, FrameWidthInSamplesC,
FrameHeightInSamplesC, FrameSizeInMbsY, and FrameSizeInSamplesY
are derived as follows:
* FrameWidthInSamplesY = frame_width

* FrameHeightInSamplesY = frame_height

* FrameWidthInMbsY = ceil(FrameWidthInSamplesY / MbWidth)

* FrameHeightInMbsY = ceil(FrameHeightInSamplesY / MbHeight)

* FrameWidthInSamplesC = FrameWidthInSamplesY // SubWidthC

* FrameHeightInSamplesC = FrameHeightInSamplesY // SubHeightC

* FrameSizeInMbsY = FrameWidthInMbsY * FrameHeightInMbsY

* FrameSizeInSamplesY = FrameWidthInSamplesY *
FrameHeightInSamplesY

chroma_format_idc
specifies the chroma sampling relative to the luma sampling as
specified in Table 2. The value of chroma_format_idc MUST be 0,
2, 3, or 4. Other values are reserved for future use.

bit_depth_minus8
specifies the bit depth of the samples. The variables BitDepth
and QpBdOffset are derived as follows:

* BitDepth = bit_depth_minus8 + 8

* QpBdOffset = bit_depth_minus8 * 6

bit_depth_minus8 MUST be in the range of 2 to 8, inclusive. Other
values are reserved for future use.

capture_time_distance
indicates the time difference between the capture time of the
frames in the previous access unit and frames in the current
access unit in milliseconds if there has been any access unit
preceding the access unit this frame belongs to.

reserved_zero_8bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

5.3.7. Quantization Matrix

syntax code | type
--------------------------------------------------------------|-----
quantization_matrix(){ |
for(i = 0; i < NumComps; i++){ |
for(y = 0; y < 8; y++){ |
for(x = 0; x < 8; x++){ |
q_matrix[i][x][y] | u(8)
} |
} |
} |
} |

Figure 14: quantization_matrix() syntax code

q_matrix[i][x][y]
specifies a scaling value in the quantization matrices. When
q_matrix[i][x][y] is not present, it is inferred to be equal to
16. The array index i specifies an indicator for the color
component; when chroma_format_idc is equal to 2 or 3, the value of
the index i is equal to 0 for Y component, 1 for Cb, and 2 for Cr.
The value of 0 for q_matrix[i][x][y] is reserved for future use.

The quantization matrix, QMatrix[i][x][y], is derived as follows:

* QMatrix[i][x][y] = q_matrix[i][x][y]

5.3.8. Tile Info

syntax code | type
--------------------------------------------------------------|-----
tile_info(){ |
tile_width_in_mbs | u(20)
tile_height_in_mbs | u(20)
startMb = 0 |
for(i = 0; startMb < FrameWidthInMbsY; i++){ |
ColStarts[i] = startMb * MbWidth |
startMb += tile_width_in_mbs |
} |
ColStarts[i] = FrameWidthInMbsY*MbWidth |
TileCols = i |
startMb = 0 |
for(i = 0; startMb < FrameHeightInMbsY; i++){ |
RowStarts[i] = startMb * MbHeight |
startMb += tile_height_in_mbs |
} |
RowStarts[i] = FrameHeightInMbsY*MbHeight |
TileRows = i |
NumTiles = TileCols * TileRows |
tile_size_present_in_fh_flag | u(1)
if(tile_size_present_in_fh_flag){ |
for(i = 0; i < NumTiles; i++){ |
tile_size_in_fh[i] | u(32)
} |
} |
} |

Figure 15: tile_info() syntax code

tile_width_in_mbs
specifies the width of a tile in units of MBs.

tile_height_in_mbs
specifies the height of a tile in units of MBs.

tile_size_present_in_fh_flag
equal to 1 specifies that tile_size_in_fh[i] is present in the
frame header. tile_size_present_in_fh_flag equal to 0 specifies
that tile_size_in_fh[i] is not present in the frame header.

tile_size_in_fh[i]
indicates the size in bytes of i-th tile data in raster order in a
frame. The value of tile_size_in_fh[i] MUST have the same value
with tile_size[i]. When it is not present, the value of
tile_size_in_fh[i] is inferred to be equal to tile_size[i]. The
value of 0 for tile_size_in_fh[i] is reserved for future use.

5.3.9. Access Unit Information

syntax code | type
--------------------------------------------------------------|-----
au_info(){ |
num_frames | u(16)
for(i = 0; i < num_frames; i++){ |
pbu_type | u(8)
group_id | u(16)
reserved_zero_8bits | u(8)
frame_info() |
} |
reserved_zero_8bits | u(8)
byte_alignment() |
filler() |
} |

Figure 16: au_info() syntax code

num_frames
indicates the number of frames contained in the current AU.

pbu_type
has the same semantics as pbu_type in the pbu_header() syntax.

Note: The value of pbu_type MUST be 1, 2, 25, 26, or 27 in
bitstreams conforming to this document.

group_id
has the same semantics as group_id in the pbu_header() syntax.

reserved_zero_8bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

5.3.10. Metadata

syntax code | type
--------------------------------------------------------------|-----
metadata(){ |
metadata_size | u(32)
currReadSize = 0 |
do{ |
payloadType = 0 |
while(next_bits(8) == 0xFF){ |
ff_byte | f(8)
payloadType += ff_byte |
currReadSize++ |
} |
metadata_payload_type | u(8)
payloadType += metadata_payload_type |
currReadSize++ |
|
payloadSize = 0 |
while(next_bits(8) == 0xFF){ |
ff_byte | f(8)
payloadSize += ff_byte |
currReadSize++ |
} |
metadata_payload_size | u(8)
payloadSize += metadata_payload_size |
currReadSize++ |
|
metadata_payload(payloadType, payloadSize) |
currReadSize += payloadSize |
} while(metadata_size > currReadSize) |
filler() |
} |

Figure 17: metadata() syntax code

metadata_size
specifies the size of metadata before filler() in the current PBU.

ff_byte
is a byte equal to 0xFF.

metadata_payload_type
specifies the last byte of the payload type of a metadata.

metadata_payload_size
specifies the last byte of the payload size of a metadata.

Syntax and semantics of metadata_payload() are specified in
Section 8.

5.3.11. Filler

syntax code | type
--------------------------------------------------------------|-----
filler(){ |
while(next_bits(8) == 0xFF) |
ff_byte | f(8)
} |

Figure 18: filler() syntax code

ff_byte
is a byte equal to 0xFF.

5.3.12. Tile

syntax code | type
--------------------------------------------------------------|-----
tile(tileIdx){ |
tile_header(tileIdx) |
for(i = 0; i < NumComps; i++){ |
tile_data(tileIdx, i) |
} |
while(more_data_in_tile()){ |
tile_dummy_byte | b(8)
} |
} |

Figure 19: tile() syntax code

tile_dummy_byte
has any pattern of 8-bit string.

5.3.13. Tile Header

syntax code | type
--------------------------------------------------------------|-----
tile_header(tileIdx){ |
tile_header_size | u(16)
tile_index | u(16)
for(i = 0; i < NumComps; i++){ |
tile_data_size[i] | u(32)
} |
for(i = 0; i < NumComps; i++){ |
tile_qp[i] | u(8)
} |
reserved_zero_8bits | u(8)
byte_alignment() |
} |

Figure 20: tile_header() syntax code

tile_header_size
indicates the size of the tile header in bytes.

tile_index
specifies the tile index in raster order in a frame. tile_index
MUST have the same value as tileIdx.

tile_data_size[i]
indicates the size of the i-th color component data in a tile in
bytes. The array index i specifies an indicator for the color
component; when chroma_format_idc is equal to 2 or 3, the value of
the index i is equal to 0 for Y component, 1 for Cb, and 2 for Cr.
The value of 0 for tile_data_size[i] is reserved for future use.

tile_qp[i]
specifies the quantization parameter value for i-th color
component. The array index i specifies an indicator for the color
component; when chroma_format_idc is equal to 2 or 3, the value of
the index i is equal to 0 for Y component, 1 for Cb, and 2 for Cr.
The Qp[i] to be used for the MBs in the tile are derived as
follows:

* Qp[i] = tile_qp[i] - QpBdOffset

* Qp[i] MUST be in the range of -QpBdOffset to 51, inclusive.

reserved_zero_8bits
MUST be equal to 0 in bitstreams conforming to the profiles
specified in Section 9. Values of reserved_zero_8bits greater
than 0 are reserved for future use. Decoders conforming to the
profiles specified in Section 9 MUST ignore PBU with values of
reserved_zero_8bits greater than 0.

5.3.14. Tile Data

syntax code | type
--------------------------------------------------------------|-----
tile_data(tileIdx, cIdx){ |
x0 = ColStarts[tileIdx % TileCols] |
y0 = RowStarts[tileIdx // TileCols] |
numMbColsInTile = (ColStarts[tileIdx % TileCols + 1] - |
ColStarts[tileIdx % TileCols]) // MbWidth |
numMbRowsInTile = (RowStarts[tileIdx // TileCols + 1] - |
RowStarts[tileIdx // TileCols]) // MbHeight |
numMbsInTile = numMbColsInTile * numMbRowsInTile |
PrevDC = 0 |
PrevDcDiff = 20 |
Prev1stAcLevel = 0 |
for(i = 0; i < numMbsInTile; i++){ |
xMb = x0 + ((i % numMbColsInTile) * MbWidth) |
yMb = y0 + ((i // numMbColsInTile) * MbHeight) |
macroblock_layer(xMb, yMb, cIdx) |
} |
byte_alignment() |
} |

Figure 21: tile_data() syntax code

The tile_data() syntax calculates the location of the macroblocks
belonging to each tile and collects them.

5.3.15. Macroblock Layer

syntax code | type
--------------------------------------------------------------|-----
macroblock_layer(xMb, yMb, cIdx){ |
subW = (cIdx == 0)? 1 : SubWidthC |
subH = (cIdx == 0)? 1 : SubHeightC |
blkWidth = (cIdx == 0)? MbWidth : MbWidthC |
blkHeight = (cIdx == 0)? MbHeight : MbHeightC |
TrSize = 8 |
for(y = 0; y < blkHeight; y += TrSize){ |
for(x = 0; x < blkWidth; x += TrSize){ |
abs_dc_coeff_diff | h(v)
if(abs_dc_coeff_diff) |
sign_dc_coeff_diff | u(1)
TransCoeff[cIdx][xMb // subW + x][yMb // subH + y] = |
PrevDC + abs_dc_coeff_diff * |
(1 - 2*sign_dc_coeff_diff) |
PrevDC = |
TransCoeff[cIdx][xMb // subW + x][yMb // subH + y] |
PrevDcDiff = abs_dc_coeff_diff |
ac_coeff_coding(xMb // subW + x, yMb // subH + y, |
log2(TrSize), log2(TrSize), cIdx) |
} |
} |
} |

Figure 22: macroblock_layer() syntax code

abs_dc_coeff_diff
specifies the absolute value of the difference between the current
DC transform coefficient level and PrevDC.

sign_dc_coeff_diff
specifies the sign of the difference between the current DC
transform coefficient level and PrevDC. sign_dc_coeff_diff equal
to 0 specifies that the difference has a positive value.
sign_dc_coeff_diff equal to 1 specifies that the difference has a
negative value.

The transform coefficients are represented by the arrays
TransCoeff[cIdx][x0][y0]. The array indices x0, y0 specify the
location (x0, y0) relative to the top-left sample for each component
of the frame. The array index cIdx specifies an indicator for the
color component; when chroma_format_idc is equal to 2 or 3, the value
of the index i is equal to 0 for Y component, 1 for Cb, and 2 for Cr.
The value of TransCoeff[cIdx][x0][y0] MUST be in the range of -32768
to 32767, inclusive.

5.3.16. AC Coefficient Coding

syntax code | type
--------------------------------------------------------------|-----
ac_coeff_coding(x0, y0, log2BlkWidth, log2BlkHeight, cIdx){ |
scanPos = 1 |
firstAC = 1 |
PrevLevel = Prev1stAcLevel |
PrevRun = 0 |
do{ |
coeff_zero_run | h(v)
for(i = 0; i < coeff_zero_run; i++){ |
blkPos = ScanOrder[scanPos] |
xC = blkPos & ((1 << log2BlkWidth) - 1) |
yC = blkPos >> log2BlkWidth |
TransCoeff[cIdx][x0+xC][y0 + yC] = 0 |
scanPos++ |
} |
PrevRun = coeff_zero_run |
if(scanPos < (1 << (log2BlkWidth + log2BlkHeight))){ |
abs_ac_coeff_minus1 | h(v)
sign_ac_coeff | u(1)
level = (abs_ac_coeff_minus1 + 1) * |
(1 - 2 * sign_ac_coeff) |
blkPos = ScanOrder[scanPos] |
xC = blkPos & ((1 << log2BlkWidth) - 1) |
yC = blkPos >> log2BlkWidth |
TransCoeff[cIdx][x0 + xC][y0 + yC] = level |
scanPos++ |
PrevLevel = abs_ac_coeff_minus1 + 1 |
if(firstAC == 1){ |
firstAC = 0 |
Prev1stAcLevel = PrevLevel |
} |
} |
} while(scanPos < (1 << (log2BlkWidth + log2BlkHeight))) |
} |

Figure 23: ac_coeff_coding() syntax code

coeff_zero_run
specifies the number of zero-valued transform coefficient levels
that are located before the position of the next non-zero
transform coefficient level in a scan of transform coefficient
levels.

abs_ac_coeff_minus1
plus 1 specifies the absolute value of an AC transform coefficient
level at the given scanning position.

sign_ac_coeff
specifies the sign of an AC transform coefficient level for the
given scanning position. sign_ac_coeff equal to 0 specifies that
the corresponding AC transform coefficient level has a positive
value. sign_ac_coeff equal to 1 specifies that the corresponding
AC transform coefficient level has a negative value.

The array ScanOrder[sPos] specifies the mapping of the zig-zag scan
position sPos, ranging from 0 to (1 << log2BlkWidth) * (1 <<
log2BlkHeight) - 1, inclusive, to a raster scan position rPos.
ScanOrder is derived by invoking Section 4.4.1 with input parameters
blkWidth equal to (1 << log2BlkWidth) and blkHeight equal to (1 <<
log2BlkHeight).

5.3.17. Byte Alignment

syntax code | type
--------------------------------------------------------------|-----
byte_alignment(){ |
while(!byte_aligned()) |
alignment_bit_equal_to_zero | f(1)
} |

Figure 24: byte_alignment() syntax code

alignment_bit_equal_to_zero
MUST be equal to 0.