The mathematical operators used in this book are similar to those used in the C programming language. However, integer division with truncation and rounding are specifically defined. The bitwise operators are defined assuming two’s-complement representation of integers. Numbering and counting loops generally begin from 0.
+ | Addition |
- | Subtraction (as a binary operator) or negation (as a unary operator) |
++ | Increment |
-- | Decrement |
* | Multiplication |
^ | Power |
/ | Integer division with truncation of the result toward 0. For example, 7/4 and -7/-4 are truncated to 1 and -7/4 and 7/-4 are truncated to -1. |
// | Integer division with rounding to the nearest integer. Half-integer values are rounded away from 0 unless otherwise specified. For example, 3//2 is rounded to 2 and -3//2 is rounded to -2. |
DIV | Integer division with truncation of the result toward -. |
% | Modulus operator; defined only for positive numbers. |
|| | Logical OR |
&& | Logical AND |
! | Logical NOT |
> | Greater than |
≥ | Greater than or equal to |
< | Less than |
≤ | Less than or equal to |
== | Equal to |
!= | Not equal to |
max [,…,] | The maximum value in the argument list |
& | AND |
| | OR |
>> | Shift right with sign extension |
<< | Shift left with O fill |
= | Assignment operator |
The following mnemonics are defined to describe the different data types used in the coded bitstream.
bslbf | Bit string, left bit first, where “left” is the order in which bit strings are written in the Recommendation I International Standard. Bit strings are written as a string of Is and Os within single quote marks (e.g., ‘1000 0001’). Blanks within a bit string are for ease of reading and have no significance. |
ch | Channel |
gr | Granule of 3 * 32 subband samples in Audio Layer II, 18 * 32 subband samples in Audio Layer III. |
main_data | The main_data portion of the bitstream contains the scale-factors, Huffman encoded data, and ancillary information. |
main_data_beg | This gives the location in the bitstream of the beginning of the main_data for the frame. The location is equal to the ending location of the previous frame’s main_data plus 1 bit. It is calculated from the main_data_end value of the previous frame. |
part 2_length | This value contains the number of main_data bits used for scalefactors. |
rpchof | Remainder polynomial coefficients, highest order first. |
sb | Subband |
scfsi | Scalefactor selector information |
switch_point_l | The number of the scalefactor band (long block scalefactor band) from which point on window switching is used. |
switch_point_s | The number of the scalefactor band (short block scalefactor band) from which point on window switching is used. |
tcimsbf | Two’s complement integer, msb (sign) bit first. |
uimsbf | Unsigned integer, most significant bit first. |
vlclbf | Variable length code, left bit first, where “left” refers to the order in which the VLC codes are written. |
window | The number of an actual time slot in the case of block_type==2, 0 ≤ window ≤ 2. |
The byte order of multibyte words is most significant byte first.
3.14159265359 | |
e | 2.71828182845 |
The action caused by a decoded data element in a bitstream depends on the value of that data element and on data elements previously decoded. The decoding of the data elements and definition of the state variables used in their decoding are described in the clauses containing the semantic description of the syntax. The following constructs are used to express the conditions when data elements are present and are in normal type.1
1 Note: This syntax uses the “C”-code convention that a variable or expression evaluating to a nonzero value is equivalent to a condition that is true.
while (condition) { | If the condition is true, the group of data elements occurs next in the data stream. This repeats until the condition is not true. |
data_element | The data element always occurs at least once. |
… } do { data_element … |
The data element is repeated until the condition is not true. |
} while (condition) if (condition) { |
If the condition is true, the first group of data elements occurs next in data_element in the data stream. |
else { … } |
… If the condition is not true, the second group of data elements occurs next in data_element in the data stream. |
for (i = 0;i < n; i++) { data_element … } |
The group of data elements occurs n times. Conditional constructs within the group of data elements may depend on the value of the loop control variable i, which is set to 0 for the first occurrence, incremented to 1 for the second occurrence, and so forth. |
As noted, the group of data elements may contain nested conditional constructs. For compactness, the { } are omitted when only one data element follows.
data_element [ ] | An array of data. The number of data elements is indicated by the context. |
data_element [n] | The n + 1th element of an array of data. |
data element [m][n] | The m + 1, n + 1th element of a two-dimensional array of data. |
data_element[l][m][n] | The 1 + 1, m + 1, n + 1th element of a three-dimensional array of data. |
data_element[m…n] | The inclusive range of bits between bit m and bit n in the data_element. |
bytealigned( ) | This function returns ‘1’ if the current position is on a byte boundary; that is, the next bit in the bitstream is the first bit in a byte. Otherwise, it returns ‘0’. |
nextbits( ) | This function permits comparison of a bit string with the next bits to be decoded in the bitstream. |
next_start_code | This function removes any 0 bit and 0 byte stuffing and locates the next start code. The function checks whether the current position is byte aligned. If it is not, 0 stuffing bits are present. After that, any number of 0 bytes may be present before the start_code. Therefore, start codes are always byte aligned and may be preceded by any number of 0 stuffing bits. |