ISO/IEC DIS 23003-8
ISO/IEC DIS 23003-8
ISO/IEC DIS 23003-8: Information technology — MPEG audio technologies — Part 8: Biomedical and general waveform signal coding

ISO/IEC DIS 23003-8:2026(en)

ISO/IEC JTC 1/SC 29

Secretariat: JISC

Date: 2025-11-28

Information technology — MPEG audio technologies — Part 8: Biomedical and general waveform signal coding

© ISO/IEC 2026

All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.

ISO copyright office

CP 401 • Ch. de Blandonnet 8

CH-1214 Vernier, Geneva

Phone: +41 22 749 01 11

Email: copyright@iso.org

Website: www.iso.org

Published in Switzerland

CONTENTS

 

Foreword

ISO (the International Organization for Standardization) is a worldwide federation of national standards bodies (ISO member bodies). The work of preparing International Standards is normally carried out through ISO technical committees. Each member body interested in a subject for which a technical committee has been established has the right to be represented on that committee. International organizations, governmental and non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with the International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization.

The procedures used to develop this document and those intended for its further maintenance are described in the ISO/IEC Directives, Part 1. In particular, the different approval criteria needed for the different types of ISO documents should be noted. This document was drafted in accordance with the editorial rules of the ISO/IEC Directives, Part 2 (see www.iso.org/directives).

ISO draws attention to the possibility that the implementation of this document may involve the use of (a) patent(s). ISO takes no position concerning the evidence, validity or applicability of any claimed patent rights in respect thereof. As of the date of publication of this document, ISO [had/had not] received notice of (a) patent(s) which may be required to implement this document. However, implementers are cautioned that this may not represent the latest information, which may be obtained from the patent database available at www.iso.org/patents. ISO shall not be held responsible for identifying any or all such patent rights.

Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement.

For an explanation of the voluntary nature of standards, the meaning of ISO specific terms and expressions related to conformity assessment, as well as information about ISO's adherence to the World Trade Organization (WTO) principles in the Technical Barriers to Trade (TBT), see www.iso.org/iso/foreword.html.

This document was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 29, Coding of audio, picture, multimedia and hypermedia information, in collaboration with ITU-T (as provisionally named Rec. ITU-T H.BWC, planned Rec. ITU-T T.261).

A list of all parts in the ISO 23003 series can be found on the ISO website.

Any feedback or questions on this document should be directed to the user’s national standards body. A complete listing of these bodies can be found at www.iso.org/members.html.

Information technology — MPEG audio technologies — Part 8: Biomedical and general waveform signal coding

1.0 Scope

This Recommendation | International Standard specifies an interoperable format for efficient compression, transmission, and storage of waveform signals, including biomedical waveform signals such as electrocardiography (ECG), electroencephalography (EEG), electromyography (EMG), and photoplethysmogram (PPG) data, as well as other types of general waveform data. It supports various bit depths, a broad range of sampling rates, and large numbers of channels, as required by a range of biomedical and general signal processing applications. The Specification provides for lossy, near-lossless, and lossless compression, and includes features such as optimized data blocking, indexing for rapid access, independent channel decoding, and metadata support including metadata enabling support of efficient artificial intelligence-based workflows.

2.0 Normative references

The following Recommendations and International Standards contain provisions which, through reference in this text, constitute provisions of this Recommendation | International Standard. At the time of publication, the editions indicated were valid. All Recommendations and Standards are subject to revision, and parties to agreements based on this Recommendation | International Standard are encouraged to investigate the possibility of applying the most recent edition of the Recommendations and Standards listed below. Members of IEC and ISO maintain registers of currently valid International Standards. The Telecommunication Standardization Bureau of the ITU maintains a list of currently valid ITU-T Recommendations.

2.1 Identical Recommendations | International Standards

— None.

2.1.1 Paired Recommendations | International Standards equivalent in technical content

— None.

2.1.2 Additional references

ISO/IEC 10646:2020, Information technology — Universal coded character set (UCS)

IETF RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, DOI 10.17487/RFC3986, January 2005, https://www.rfc-editor.org/info/rfc3986

ISO/IEC 23001‑17:2024, Information technology — MPEG systems technologies, Part 17: Carriage of uncompressed video and images in ISO base media file format

ITU-R Recommendation TF.460-6 (02/2022), Standard-frequency and time-signal emissions

ITU-R Recommendation BS.2088-1 (10/2019), Long-form file format for the international exchange of audio programme materials with metadata

ISO 8601:2019, Date and time — Representations for information interchange

ISO/IEC 23008‑3:2022, Information technology — High efficiency coding and media delivery in heterogeneous environments, Part 3: 3D audio

ISO/IEC 11578:1996, Information technology — Open Systems Interconnection — Remote Procedure Call (RPC), Annex A

NIST FIPS PUB 180-4 (2015), Secure Hash Standard (SHS)

3.0 Terms and Definitions

For the purposes of this Recommendation | International Standard, the following definitions apply.

3.1

bin

One bit of a bin string.

3.2

bin string

An intermediate binary representation of values of syntax elements from the binarization of the syntax element.

3.3

binarization

A set of bin strings for all possible values of a syntax element.

3.4

bitstream

A sequence of bits that forms the representation of one or more coded waveform sequences.

3.5

coded waveform sequence (CWS)

A sequence of packets having the same WPS_waveform_parameter_set_id and containing at least one independent frame.

3.6

context variable

A variable specified for the context-based adaptive binary arithmetic decoding process of clause 9.5 of a bin in a manner that depends on the values of previously decoded bins.

3.7

decoder

An embodiment of a decoding process.

3.8

decoding order

The order in which syntax elements are processed by the decoding process.

3.9

decoding process

The process specified in this Specification that reads a bitstream and derives decoded samples from it.

3.10

dependent frame (DF)

A stream packet with stream_packet_type equal to DF_SPT.

3.11

encoder

An embodiment of an encoding process.

3.12

encoding process

A process that accepts waveform data as input and produces a bitstream conforming to this Specification.

3.13

flag

A variable or single-bit syntax element that can take one of the two possible values 0 and 1.

3.14

frame

Either an independent frame or a dependent frame.

3.15

frame sequence

A sequence of frames that starts with an independent frame followed by zero or more dependent frames.

3.16

independent frame (IF)

A stream packet with stream_packet_type equal to IF_SPT.

3.17

stream packet

A string of bytes containing a stream packet header and the syntax structure containing that data.

3.18

stream packet header

A syntax structure specifying the header of a stream packet. It contains a stream_packet_type, a stream_packet_label and a stream_packet_length syntax element that identifies the number of bytes in the syntax structure that follows within the stream packet.

3.19

stream packet stream

A sequence of stream packets.

3.20

syntax element

An element of data represented in the bitstream.

3.21

syntax structure

Zero or more syntax elements that are present together in the bitstream in a specified order.

3.22

transform

A part of the decoding process by which a block of transform coefficients is converted to a block of time-domain values.

3.23

transform block

A block of samples resulting from a transform in the decoding process.

3.24

transform coefficient

A scalar quantity, considered to be in a frequency domain, that is associated with a particular frequency index in a transform in the decoding process.

3.25

transform coefficient level

An integer quantity representing the value associated with a particular frequency index in the decoding process prior to scaling for computation of a transform coefficient value.

4.0 Abbreviations

For the purposes of this Recommendation | International Standard, the following abbreviations apply.

AC

Annotation Channel

AM

Auxiliary Metadata

CABAC

Context-based Adaptive Binary Arithmetic Coding

CRC

Cyclic Redundancy Check

CGPS

Channel Group Parameter Set

CPRD

Channel-normalized Percentage Root mean square Distortion

CWS

Coded Waveform Sequence

DCT

Discrete Cosine Transform

DST

Discrete Sine Transform

DF

Dependent Frame

EEG

Electroencephalography

EMG

Electromyography

EGk

Exponential-Golomb (aka Exp-Golomb) with order k

FL

Fixed-Length

HLS

High Level Syntax

IF

Independent Frame

LMS

Least Mean Squares

LPS

Least Probable Symbol

LSB

Least Significant Bit

MAE

Maximum Absolute Error

MSB

Most Significant Bit

PPG

Photoplethysmogram

PRD

Percentage Root (mean square) Distortion

QP

Quantization Parameter

TR

Truncated Rice

URI

Uniform Resource Identifier

UUID

Universally Unique Identifier

WPS

Waveform Parameter Set

UTC

Coordinated Universal Time

5.0 Conventions

5.1 General

The term "this Specification" is used to refer to this Recommendation | International Standard.

The word "shall" is used to express mandatory requirements for conformance to this Specification. When used to express a mandatory constraint on the values of syntax elements or the values of variables derived from these syntax elements, it is the responsibility of the encoder to ensure that the constraint is fulfilled.

The word "may" is used to refer to behaviour that is allowed, but not necessarily required.

The word "should" is used to refer to behaviour of an implementation that is encouraged to be followed under anticipated ordinary circumstances, but is not a mandatory requirement for conformance to this Specification.

Content of this Specification that is identified as "informative" does not establish any mandatory requirements for conformance to this Specification and is thus not considered an integral part of this Specification. Informative remarks in the text are, in some cases, set apart and prefixed with the word "note" or "NOTE".

The word "reserved" is used to specify that some values of a particular syntax element are for future use by ITU-T | ISO/IEC and shall not be used in syntax structures conforming to this version of this Specification, but could potentially be used in syntax structures conforming to future versions of this Specification by ITU‑T | ISO/IEC.

The word "unspecified" is used to describe some values of a particular syntax element to indicate that the values have no specified meaning in this Specification and are not expected to have a specified meaning in the future as an integral part of future versions of this Specification.

NOTE – The mathematical operators used in this Specification are similar to those used in the C programming language. However, the results of integer division and arithmetic shift operations are defined more precisely, and additional operations are defined, such as exponentiation and real-valued division. Numbering and counting conventions generally begin from 0, e.g., "the first" is equivalent to the 0-th, "the second" is equivalent to the 1-st.

5.1.1 Arithmetic operators

The following arithmetic operators are defined as follows:

+

addition

subtraction (as a two-argument operator) or negation (as a unary prefix operator)

*

multiplication, including matrix multiplication

xy

exponentiation, specifying x to the power of y. In other contexts, such notation is used for superscripting not intended for interpretation as exponentiation.

/

integer division with truncation of the result toward zero. For example, 7 / 4 and −7 / −4 are truncated to 1 and −7 / 4 and 7 / −4 are truncated to −1.

÷

division in mathematical equations where no truncation or rounding is intended

division in mathematical equations where no truncation or rounding is intended

summation of f( i ) with i taking all integer values from x up to and including y

x % y

modulus. Remainder of x divided by y, defined only for integers x and y with x >= 0 and y > 0

5.1.2 Logical operators

The following logical operators are defined as follows:

x && y

Boolean logical "and" of x and y

x | | y

Boolean logical "or" of x and y

!

Boolean logical "not"

x ? y : z

if x is TRUE, evaluates to the value of y; otherwise, evaluates to the value of z

When evaluating a logical expression, the value 0 is interpreted as FALSE and any numerical value not equal to 0 is interpreted as TRUE. The result of any logical expression that evaluates as FALSE is the value 0, and the result of any logical expression that evaluates as TRUE is the value 1.

5.1.3 Relational operators

>

greater than

>=

greater than or equal to

<

less than

<=

less than or equal to

= =

equal to

!=

not equal to

When a relational operator is applied to a syntax element or variable that has been assigned the value "na" (not applicable), the value "na" is treated as a distinct value for the syntax element or variable. The value "na" is considered not to be equal to any other value.

5.1.4 Bit-wise operators

&

bit-wise "and"

When operating on integer arguments, operates on a two's complement representation of the integer value. When operating on a binary argument that contains fewer bits than another argument, the shorter argument is extended by adding more significant bits equal to 0.

|

bit-wise "or"

When operating on integer arguments, operates on a two's complement representation of the integer value. When operating on a binary argument that contains fewer bits than another argument, the shorter argument is extended by adding more significant bits equal to 0.

^

bit-wise "exclusive or"

When operating on integer arguments, operates on a two's complement representation of the integer value. When operating on a binary argument that contains fewer bits than another argument, the shorter argument is extended by adding more significant bits equal to 0.

x >> y

arithmetic right shift of a two's complement integer representation of x by y binary digits

This function is defined only for non-negative integer values of y. Bits shifted into the most significant bits (MSBs) as a result of the right shift have a value equal to the MSB of x prior to the shift operation.

x << y

arithmetic left shift of a two's complement integer representation of x by y binary digits

This function is defined only for non-negative integer values of y. Bits shifted into the least significant bits (LSBs) as a result of the left shift have a value equal to 0.

5.1.5 Assignment operators

=

assignment operator

++

increment, i.e., x++ is equivalent to x = x + 1; when used in an array index, evaluates to the value of the variable prior to the increment operation

− −

decrement, i.e., x− − is equivalent to x = x − 1; when used in an array index, evaluates to the value of the variable prior to the decrement operation

+=

increment by amount specified, i.e., x += 3 is equivalent to x = x + 3, and x += (−3) is equivalent to x = x + (−3)

−=

decrement by amount specified, i.e., x −= 3 is equivalent to x = x − 3, and x −= (−3) is equivalent to x = x − (−3)

>>=

right shift the variable by the amount specified and store, i.e., x >>= 3 is equivalent to x = x >> 3

<<=

left shift the variable by the amount specified and store, i.e., x <<= 3 is equivalent to x = x << 3

5.1.6 Range notation

x = y..z

x takes on integer values starting from y to z, inclusive, with x, y, and z being integer numbers and z being greater than or equal to y.

5.1.7 Mathematical functions

 

Abs( x ) =

(1)

 

Ceil( x )    smallest integer greater than or equal to x.

(2)

 

Clip1( x ) = Clip3( 0, ( 1 << BitDepth ) − 1, x )

(3)

 

Cos( x )    trigonometric cosine of x radians

(4)

 

Clip3( x, y, z ) =

(5)

 

ClipH( v, w, x ) =

(6)

 

Floor( x )    largest integer less than or equal to x.

(7)

 

Log2( x )    base-2 logarithm of x.

(8)

 

Log10( x )    base-10 logarithm of x.

(9)

 

Min( x, y ) =

(10)

 

Max( x, y ) =

(11)

 

Round( x ) = Sign( x ) * Floor( Abs( x ) + 0.5 )

(12)

 

Sign( x ) =

(13)

 

Sin( x )    trigonometric sine of x radians

(14)

 

Sqrt( x )    square root of x

(15)

 

Swap( x, y ) = ( y, x )

(16)

 

BitWidth( x ) =

(17)

5.1.8 Mathematical constants

 

π    Archmedes’ constant; the ratio of the circumferance of a circle to its diameter

(18)

5.1.9 Order of operation precedence

When order of precedence in an expression is not indicated explicitly by use of parentheses, the following rules apply:

— Operations of a higher precedence are evaluated before any operation of a lower precedence.

— Operations of the same precedence are evaluated sequentially from left to right.

Table 5‑1 specifies the precedence of operations from highest to lowest; a higher position in the table indicates a higher precedence.

NOTE – For those operators that are also used in the C programming language, the order of precedence used in this Specification is the same as used in the C programming language.

Table 5‑1 — Operation precedence from highest (at top of table) to lowest (at bottom of table)

Operations (with operands x, y, and z)

"x++", "x− −"

"!x", "−x" (as a unary prefix operator)

xy

"x * y", "x / y", "x ÷ y", "", "x % y"

"x + y", "x − y" (as a two-argument operator), ""

"x  <<  y", "x  >>  y"

"x < y", "x  <=  y", "x > y", "x  >=  y"

"x  = =  y", "x  !=  y"

"x & y"

"x | y"

"x  &&  y"

"x  | |  y"

"x ? y : z"

"x..y"

"x = y", "x  +=  y", "x  −=  y"

5.1.10 Mathematical functions, operators, and processes for floating-point representations

5.1.11 Floating-point representation

The accuracy of all floating-point representations is specified by the following constant parameter:

— FPRNumDigitsVal specifies the number of significant binary digits in the floating-point representation. Given the value of FPRNumDigitsVal, all calculations for the significand of a floating-point representation can be implemented using signed integer arithmetic with N = FPRNumDigitsVal + 2 bits.

Division operations for floating-point representations are specified based on a look-up table. The accuracy of division operations is specified by the following two constant parameters:

— FPRLog2DivTabSize specifies the binary logarithm of the number of elements in the look-up table. The look-up table used for division operations has (1 << FPRLog2DivTabSize) elements.

— FPRNumDigitsDivTab specifies the number of significant binary digits for the values of the division look-up table. Given the value of FPRNumDigitsDivTab, the elements of the look-up table can be represented as unsigned integers with N = FPRNumDigitsDivTab bits or as signed integers with N = FPRNumDigitsDivTab +1 bits.

The division look-up table is referred to as FPRDivTab. It is determined as specified by the following pseudo-code:

 

nom = 1  <<  ( FPRLog2DivTabSize + FPRNumDigitsDivTab − 1 )

off = 1  <<  FPRLog2DivTabSize

for( k = 0; k < (1  <<  FPRLog2DivTabSize ); k++ ) {

denom = off + k

FPRDivTab[ k ] = ( nom + (denom >> 1 ) ) / denom

}

(19)

 

where the division represents an integer division with truncation towards zero.

For the following specification, the values FPRNumDigitsVal = 30, FPRLog2DivTabSize = 8, and FPRNumDigitsDivTab = 15 are used. All calculations for the significand of a floating-point representation can be implemented in 32-bit signed integer arithmetic. The look-up table FPRDivTab has 256 elements, and each of these elements can be represented as 16-bit signed integer. The total size required for storing the look-up table is 512 bytes.

A floating point representation is specified as a triple (val, exp, sgn) as follows:

— val is an integer number specifying the significant digits of a floating-point representation, also referred to as the significand. The value of val is represented as signed integer number of at least N = FPRNumDigitsVal + 2 bits. Even though the actual value of val can always be represented by an unsigned integer of FPRNumDigitsVal bits, two additional bits and a signed integer representation is required for intermediate values in calculations with the floating-point representation. With FPRNumDigitsVal = 30, all calculations related to the number val specifying the significand of a floating-point representation can be done using 32-bit signed integers;

— exp is an integer number representing the exponent;

— sgn is a bit representing the sign, where negative numbers have sgn = 1 and positive numbers have sgn = 0.

With x being a floating point representation, the elements of the triple (val, exp, sgn) specifying x are also referred to as x.val, x.exp, and x.sgn, respectively.

The floating-point value fx that is specified by a floating-point representation x is given by:

 

fx = (1 − 2 * x.sgn) * x.val * ( 1 << x.exp ).

(20)

NOTE – As shown in this equation, when x.val is equal to 0, the value represented is 0, regardless of the values of x.exp and x.sgn.

5.1.12 Arithmetic operators and functions for floating-point representations

In the following x, y, and z denote floating-point representations and a denotes an integer. The following functions and arithmetic operators are specified:

— Conversion of an integer to a floating-point representation:

 

 

x = FPRepr( a )

(21)

The floating-point representation x is derived by invoking the process for converting an integer to a floating-point representation as specified in clause 5.11.3.1 with a as input and the output is assigned to x.

— Conversion of a floating-point representation to an integer:

 

 

a = FPRToInteger( x )

(22)

The integer a is derived by invoking the process for converting a floating-point representation to an integer as specified in clause 5.11.3.2 with a as input and the output is assigned to a.

— Bit-shift to the left:

 

 

y = FPBitShiftLeft( x, a )

(23)

The floating-point representation y is derived by invoking the process for shifting a floating-point representation to the left as specified in clause 5.11.3.3 with x and a as inputs and the output is assigned to y.

— Bit-shift to the right:

 

 

y = FPBitShiftRight( x, a )

(24)

The floating-point representation y is derived by invoking the process for shifting a floating-point representation to the right as specified in clause 5.11.3.4 with x and a as inputs and the output is assigned to y.

— Negation:

 

 

y = FPNeg( x )

(25)

The floating-point representation y is derived by invoking the process for negating a floating-point representation as specified in clause 5.11.3.5 with x as input and the output is assigned to y.

— Addition:

 

 

z = FPAdd( x, y )

(26)

The floating-point representation z is derived by invoking the process for adding two floating-point representations as specified in clause 5.11.3.6 with x and y as inputs and the output is assigned to z.

— Subtraction:

 

 

z = FPSub( x, y )

(27)

The floating-point representation z is derived by invoking the process for subtracting two floating-point representations as specified in clause 5.11.3.7 with x and y as inputs and the output is assigned to z.

— Multiplication:

 

 

z = FPMult( x, y )

(28)

The floating-point representation z is derived by invoking the process for multiplying two floating-point representations as specified in clause 5.11.3.8 with x and y as inputs and the output is assigned to z.

— Reciprocal:

 

 

y = FPRec( x )

(29)

The floating-point representation y is derived by invoking the process for deriving the reciprocal of a floating-point representation as specified in clause 5.11.3.9 with x as input and the output is assigned to y.

— Division:

 

 

z = FPDiv( x, y )

(30)

The floating-point representation z is derived by invoking the process for dividing two floating-point representations as specified in clause 5.11.3.10 with x and y as inputs and the output is assigned to z.

The operator precedence for floating-point representations is the same as specified in clause 5.10.

5.1.13 Specification of arithmetic operations for floating-point representations

Process for converting an integer to a floating-point representation

Input to this process is a signed or unsigned integer value a.

Output of this process is a floating-point representation x = ( x.val, x.exp, x.sgn ) specifying the integer a.

The output value y is initialized with y.val = 0, y.exp = 0, and y.sgn = 0.

When a is not equal to 0, the output value y is modified as specified by the following pseudo-code:

 

if( a < 0 ) {

absVal = −a

y.sgn = 1

} else

absVal = a

y.exp = BitWidth( absVal ) − FPRNumDigitsVal

if( y.exp < 0 )

y.val = absVal << ( −y.exp )

else

y.val = absVal >> y.exp

(31)

Process for converting a floating-point representation to an integer

Input to this process is a floating-point representation x = ( x.val, x.exp, x.sgn ).

Output of this process is an integer a specifying the floating-point representation x rounded to an integer value.

The value of a is initially set to 0.

When x.val is not equal to 0, the value of a is modified as specified by the following pseudo-code:

 

if( x.exp >= 0 )

a = x.val  <<  x.exp

else

a = ( x.val + ( 1  <<  ( −x.exp − 1 ) ) )  >>  ( −x.exp )

if( x.sgn )

a = −a

(32)

Process for shifting a floating-point representation to the left

Inputs to this process are:

— a floating-point representation x = ( x.val, x.exp, x.sgn ), and

— a non-negative integer number a representing a bit shift to the left.

Output of this process is a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the result of the bit shift.

The floating-point representation y is determined as specified by the following pseudo-code:

 

y.val   = x.val

y.exp = x.exp + a

sgn = x.sgn

(33)

Process for shifting a floating-point representation to the right

Inputs to this process are:

— a floating-point representation x = ( x.val, x.exp, x.sgn ), and

— a non-negative integer number a representing a bit shift to the right.

Output of this process is a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the result of the bit shift.

The floating-point representation y is determined as specified by the following pseudo-code:

 

y.val = x.val

y.exp = x.exp − a

y.sgn = x.sgn

(34)

Process for negating a floating-point representation

Input to this process is a floating-point representation x = ( x.val, x.exp, x.sgn ).

Output of this process is a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the result of the negation of x.

The floating-point representation y is determined as specified by the following pseudo-code:

 

y.val = x.val

y.exp = x.exp

y.sgn = 1 − x.sgn

(35)

Process for adding two floating-point representations

Input to this process are:

— a floating-point representation x = ( x.val, x.exp, x.sgn ) specifying the first summand;

— a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the second summand.

Output of this process is a floating-point representation z = ( z.val, z.exp, z.sgn ) specifying the result of the addition of x and y.

If x.val is equal to 0, z is set equal to y, i.e., z.val = y.val, z.exp = y.exp, and z.sgn = y.sgn.

Otherwise, if y.val is equal to 0, z is set equal to x, i.e., z.val = x.val, z.exp = x.exp, and z.sgn = x.sgn.

Otherwise ( x.val is not equal to 0 and y.val is not equal to 0 ), the value of z is first initialized with z.val = 0, z.exp = 0, and z.sgn = 0 and then updated as specified by the following pseudo-code:

 

if( x.exp >= y.exp )

s = x.exp − y.exp

a = ( y.val + ( ( 1  <<  s ) >> 1 ) )  >>  s

b = ( 1 − 2 * x.sgn ) * x.val + ( 1 − 2 * y.sgn ) * a

c = x.exp

} else {

s = y.exp − x.exp

a = ( x.val + ( ( 1  <<  s ) >> 1 ) )  >>  s

b = ( 1 − 2 * x.sgn ) * a + ( 1 − 2 * y.sgn ) * y.val

c = y.exp

}

if( b < 0 ) {

b = −b

z.sgn = 1

}

if( b > 0 ) {

d = BitWidth( b ) − FPRNumDigitsVal

if( d < 0 )

z.val = b  <<  ( −d )

else

z.val = b  >>  d

z.exp = c +d

}

(36)

 

 

 

 

 

Process for subtracting two floating-point representations

Input to this process are:

— a floating-point representation x = ( x.val, x.exp, x.sgn ) specifying the minuend;

— a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the subtrahend.

Output of this process is a floating-point representation z = ( z.val, z.exp, z.sgn ) specifying the result of subtracting y from of x.

The floating point representation yn is derived by invoking the process for negating a floating-point representation as specified in clause 5.11.3.5 with y as input and the output is assigned to yn.

The floating point representation z is derived by invoking the process for adding two floating-point representation as specified in clause 5.11.3.6 with x and yn as inputs and the output is assigned to z.

Process for multiplying two floating-point representations

Input to this process are:

— a floating-point representation x = ( x.val, x.exp, x.sgn ) specifying the multiplier;

— a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the multiplicand.

Output of this process is a floating-point representation z = ( z.val, z.exp, z.sgn ) specifying the result of the multiplication of x and y.

If x.val is equal to 0 or y.val is equal to 0, z is set equal to zero, i.e., z.val = 0.

Otherwise ( x.val is not equal to 0 and y.val is not equal to 0 ), the floating-point representation z is derived as specified by the following pseudo-code:

 

HSHIFT = FPRNumDigitsVal  >>  1

LMASK = ( 1  <<  HSHIFT )  −  1

ah = x.val  >>  HSHIFT

bh = y.val  >>  HSHIFT

al  = x.val  &  LMASK

bl  = y.val  &  LMASK

z.val  = ( ( ah * bh )  <<  1 ) + ( ( ah * bl + al * bh + ( ( al * bl )  >>  HSHIFT ) )  >>  ( HSHIFT − 1 ) )

z.exp = x.exp + y.exp + FPRNumDigitsVal − 1

z.sgn = x.sgn ^ y.sgn

if( z.val >= ( 1  <<  FPRNumDigitsVal ) ) {

z.val  = z.val  >> 1

z.exp = z.exp + 1

}

(37)

 

 

 

 

 

Process for deriving the reciprocal of a floating-point representation

Input to this process is a floating-point representation x = ( x.val, x.exp, x.sgn ) with x.val being not equal to 0.

Output of this process is a floating-point representation y = ( y.val, y.exp, y.sgn ) specifying the reciprocal of x.

The floating-point representation y is derived as specified by the following pseudo-code:

 

DSHIFT = FPRNumDigitsVal − FPRLog2DivTabSize − 1

DADD   = ( 1  <<  ( DSHIFT − 1 ) )  −  ( 1  <<  ( FPRNumDigitsVal  − 1 ) )

DMASK = ( 1  <<  FPRLog2DivTabSize ) − 1

EXSUB  = FPRNumDigitsDivTab + FPRNumDigitsVal − 2

a = ( x.val + DADD )  >>  DSHIFT

b = FPRDivTab[ a & DMASK ]

c = BitWidth( b ) − FPRNumDigitsVal

y.val = b  <<  ( −c )

y.exp = c − x.exp − ( a  >>  FPRLog2DivTabSize ) − EXSUB

y.sgn = x.sgn

(38)

 

 

 

Process for dividing two floating-point representations

Input to this process are:

— a floating-point representation x = ( x.val, x.exp, x.sgn ) specifying the dividend;

— a floating-point representation y = ( y.val, y.exp, y.sgn ), with y.val being not equal to 0, specifying the divisor.

Output of this process is a floating-point representation z = ( z.val, z.exp, z.sgn ) specifying the result of the division of x and y.

The floating point representation yr is derived by invoking the process for deriving the reciprocal of a floating-point representation as specified in clause 5.11.3.9 with y as input and the output is assigned to yr.

The floating point representation z is derived by invoking the process for multiplying two floating-point representations as specified in clause 5.11.3.10 with x and yr as inputs and the output is assigned to z.

5.1.14 Processes for solving linear equation systems using floating-point representations

Derivation process for a sub vector

Inputs to this process are:

— an N-dimensional vector vec of floating-point representations, with N > 1;

— an index r.

Output of this process is an (N − 1)-dimensional vector subVec that is obtained by deleting the r-th element from the vector vec.

The (N − 1)-dimensional vector subVec is obtained as specified by the following peudo-code:

 

for( k = 0; k < N − 1; k++ )

subVec[ k ] = vec[ k + ( k >= r ? 1 : 0 ) ]

(39)

 

Derivation process for a sub-matrix

Inputs to this process are:

— an NxN matrix mat of floating-point representations, with N > 1;

— a row index r; and

— a column index c.

Output of this process is an ( N − 1 ) × ( N − 1 ) matrix subMat that is obtained by deleting the r-th row and the c-th column from the matrix mat.

The ( N − 1 ) × ( N − 1 ) matrix subMat is obtained as specified by the following pseudo-code:

 

for( k = 0; k < N − 1; k++ )

for( n = 0; n < N − 1; n++ )

subMat[ k ][ n ] = mat[ k + ( k >= c ? 1 : 0 ) ][ n + ( n >= r ? 1 : 0 ) ]

(40)

Derivation process for the determinant of a matrix

Inputs to this process is an NxN matrix mat of floating-point representations, with N > 0.

Output of this process is a floating-point representation det that specifies the determinant of the matrix mat.

If N is equal to 1, the determinant det is set equal to det = x[ 0 ][ 0 ].

Otherwise ( N is greater than 1 ), the determinant det is derived as specified by the following recursive process:

— The determinant is set equal to det = FPNum( 0 ).

— For k proceeding over the range from 0 to N − 1, inclusive, the following applies:

— The ( N − 1 ) × ( N − 1 ) sub-matrix subMat is derived by invoking the derivation process for a sub-matrix as specified in clause 5.11.4.2 with mat, the row index k, and the column index 0 as inputs and the output is assigned to the sub-matrix subMat.

— The determinant subDet of the ( N − 1 ) × ( N − 1 ) sub-matrix subMat is derived by invoking the derivation process for the determinant of a matrix as specified in this clause with subMat as input and the output is assigned to subDet.

— Depending on k, the determinant det is updated as specified by the following pseudo-code:

 

if( ( k & 1 )  = =  1 )

det = FPSub( det, FPMult( mat[ 0 ][ k ], subDet ) )

else

det = FPAdd( det, FPMult( mat[ 0 ][ k ], subDet ) )

(41)

 

Process for solving a linear equation system with floating-point matrices and vectors

Inputs to this process are:

— an NxN matrix mat of floating-point representations, with N > 0;

— a N-dimensional vector vec of floating-point representations;

— an unsigned integer bshift specifying the precision of the output.

Output of this process is an N-dimensional vector res of integer values.

The determinant detMat of the matrix mat is determined by invoking the derivation process for the determinant of a matrix as specified in clause 5.11.4.3 with mat as input and the output is assigned to detMat.

If detMat.val is equal to 0, the value of res[ 0 ] is set equal to res[ 0 ] = 0.

Otherwise ( detMat.val is not zero ), the value of res[ 0 ] is derived as follows:

— The NxN matrix matX of floating-point representations is derived as specifified by the following pseudo-code:

 

 

for( k = 0; k < N; k++ )

matX[ 0 ][ k ] = vec[ k ]

for( c = 1; c < N; c++ )

for( k = 0; k < N; k++ )

matX[ c ][ k ] = mat[ c ][ k ]

(42)

— The determinant detX of the matrix matX is determined by invoking the derivation process for the determinant of a matrix as specified in clause 5.11.4.3 with matX as input and the output is assigned to detX.

— The value of res[ 0 ] is derived by:

 

res[ 0 ] = FPRToInteger( FPBitShiftLeft( FPDiv( detX,  detMat ),  bshift ) )

(43)

When N is greater than 1, the values res[ k ] with k being in the range of 1 to N − 1, inclusive, are determined by the following recursive process:

— The ( N − 1 ) × ( N − 1 ) sub-matrix subMat is determined by invoking the derivation process for a sub-matrix as specified in clause 5.11.4.2 with mat, the row index 0, and the column index 0 as inputs and the output is assigned to the sub-matrix subMat.

— The ( N − 1 )-dimensional sub-vector subVec is determined by invoking the derivation process for a sub-vector as specified in clause 5.11.4.1 with vec and the index 0 as inputs and the output is assigned to the sub-vector subVec.

— The ( N − 1 )-dimensional sub-vector subVec is modified as specified by the following pseudo-code:

 

scale = FPBitShiftRight( FPNum( res[ 0 ] ), bshift )

for( k = 0; k < N − 1; k++ )

subVec[ k ] = FPSub( subVec[ k ], FPMult( scale, mat[ 0 ][ 1 + k ] ) )

(44)

— The process for solving a linear equation system with floating-point matrices and vectors as specified in this clause is invoked with the ( N − 1 ) × ( N − 1 ) matrix subMat, the ( N − 1 )-dimensional vector subVec, and the integer number bshift as input and the output is assigned to the ( N − 1 )-dimensional integer vector subRes.

— The values res[ k ] with k being in the range of 1 to N − 1, inclusive, are determined by:

 

for( k = 1; k < N; k++ )

res[ k ] = subRes[ k − 1 ]

(45)

 

Process for solving a linear equation system in integer arithmetic

Inputs to this process are:

— an NxN matrix mat of integer values, with N > 0;

— a N-dimensional vector vec of integer values;

— an unsigned integer bshift specifying the precision of the output.

Output of this process is an N-dimensional vector res of integer values.

The NxN matrix fprMat of floating-point representations is derived as specified by the following pseudo-code:

 

for( c = 0; c < N; c++ )

for( r = 0; r < N; r++ )

fprMat[ c ][ r ] = FPRepr( mat[ c ][ r ] )

(46)

The N-dimensional vector fprVec of floating-point representations is derived as specified by the following pseudo-code:

 

for( k = 0; k < N; k++ )

fprVec[ k ] = FPRepr ( vec[ k ] )

(47)

 

The N-dimensional output vector res is derived by invoking the process for solving a linear equation system with floating-point matrices and vectors as specified in clause 5.11.4.4 with fprMat, fprVec, and bshift as inputs and the output is assigned to res.

5.2 Variables, syntax elements and tables

Syntax elements in the bitstream are represented in bold type. Each syntax element is described by its name (all lower case letters with underscore characters), and one descriptor for its method of coded representation. The decoding process behaves according to the value of the syntax element and to the values of previously decoded syntax elements. When a value of a syntax element is used in the syntax tables or the text, it appears in regular (i.e., not bold) type.

In some cases the syntax tables and semantics use the values of other variables derived from the values of syntax elements. Such variables appear in the syntax tables, or text, named by a mixture of lower case and upper case letter and without any underscore characters. Variables starting with an upper case letter are derived for the decoding of the current syntax structure and all depending syntax structures. Variables starting with an upper case letter could, in some cases, be used in the decoding process for later syntax structures without mentioning the originating syntax structure of the variable. Variables starting with a lower case letter are only used within the clause in which they are derived.

In some cases, "mnemonic" names for syntax element values or variable values are used interchangeably with their numerical values. Sometimes "mnemonic" names are used without any associated numerical values. The association of values and names is specified in the text. The names are constructed from one or more groups of letters separated by an underscore character. Each group starts with an upper case letter and could contain more upper case letters.

NOTE – The syntax is described in a manner that closely follows the C-language syntactic constructs.

Functions that specify properties of the current position in the bitstream are referred to as syntax functions. These functions are specified in clause 7.2 and assume the existence of a bitstream pointer with an indication of the position of the next bit to be read by the decoding process from the bitstream. Syntax functions are described by their names, which are constructed as syntax element names and end with left and right round parentheses including zero or more variable names (for definition) or values (for usage), separated by commas (if more than one variable).

Functions that are not syntax functions (including mathematical functions specified in clause 5.8) are described by their names, which start with an upper case letter, contain a mixture of lower and upper case letters without any underscore character, and end with left and right parentheses including zero or more variable names (for definition) or values (for usage) separated by commas (if more than one variable).

A one-dimensional array is referred to as a list. A two-dimensional array is referred to as a matrix. Arrays can either be syntax elements or variables. Subscripts or square parentheses are used for the indexing of arrays. In reference to a visual depiction of a matrix, the first subscript is used as a row (vertical) index and the second subscript is used as a column (horizontal) index. The indexing order is reversed when using square parentheses rather than subscripts for indexing. Thus, an element of a matrix s at horizontal position x and vertical position y could be denoted either as s[ x ][ y ] or as syx. A single column of a matrix could be referred to as a list and denoted by omission of the row index. Thus, the column of a matrix s at horizontal position x could be referred to as the list s[ x ].

A specification of values of the entries in rows and columns of an array could be denoted by { {...} {...} }, where each inner pair of brackets specifies the values of the elements within a row in increasing column order and the rows are ordered in increasing row order. Thus, setting a matrix s equal to { { 1 6 } { 4 9 }} specifies that s[ 0 ][ 0 ] is set equal to 1, s[ 1 ][ 0 ] is set equal to 6, s[ 0 ][ 1 ] is set equal to 4, and s[ 1 ][ 1 ] is set equal to 9.

Binary notation is indicated by enclosing the string of bit values by single quote marks. For example, '01000001' represents an eight-bit string having only its second and its last bits (counted from the most to the least significant bit) equal to 1.

Hexadecimal notation, indicated by prefixing the hexadecimal number by "0x", is used in some cases instead of binary notation when the number of bits is an integer multiple of 4. For example, 0x41 represents an eight-bit string having only its second and its last bits (counted from the most to the least significant bit) equal to 1.

Numerical values not enclosed in single quotes and not prefixed by "0x" are decimal values.

A value equal to 0 represents a FALSE condition in a test statement. The value TRUE is represented by any value different from zero.

5.2.1 Text description of logical operations

In the text, a statement of logical operations as would be described mathematically in the following form:

 

if( condition 0 )

 

statement 0

 

else if( condition 1 )

 

statement 1

 

...

 

else /* informative remark on remaining condition */

 

statement n

is typically described in the following manner:

 

... as follows / ... the following applies:

 

If condition 0, statement 0

 

Otherwise, if condition 1, statement 1

 

...

 

Otherwise (informative remark on remaining condition), statement n

Each "If ... Otherwise, if ... Otherwise, ..." statement in the text is introduced with "... as follows" or "... the following applies" immediately followed by "If ... ". The last condition of the "If ... Otherwise, if ... Otherwise, ..." is always an "Otherwise, ...". Interleaved "If ... Otherwise, if ... Otherwise, ..." statements can be identified by matching "... as follows" or "... the following applies" with the ending "Otherwise, ...".

In the text, a statement of logical operations as would be described mathematically in the following form:

 

if( condition 0a && condition 0b )

 

statement 0

 

else if( condition 1a | | condition 1b )

 

statement 1

 

...

 

else

 

statement n

is typically described in the following manner:

 

... as follows / ... the following applies:

 

If all of the following conditions are true, statement 0:

 

 

condition 0a

 

 

condition 0b

 

Otherwise, if one or more of the following conditions are true, statement 1:

 

 

condition 1a

 

 

condition 1b

 

...

 

Otherwise, statement n

In the text, a statement of logical operations as would be described mathematically in the following form:

 

if( condition 0 )

 

statement 0

 

if( condition 1 )

 

statement 1

is typically described in the following manner:

 

When condition 0, statement 0

 

When condition 1, statement 1

5.2.2 Processes

Processes are used to describe the decoding of syntax elements. A process has a separate specification and invoking. All syntax elements and upper case variables that pertain to the current syntax structure and depending syntax structures are available in the process specification and invoking. A process specification might also have a lower case variable explicitly specified as input. Each process specification has explicitly specified an output. The output is a variable that can either be an upper case variable or a lower case variable.

When invoking a process, the assignment of variables is specified as follows:

— If the variables at the invoking and the process specification do not have the same name, the variables are explicitly assigned to lower case input or output variables of the process specification.

— Otherwise (the variables at the invoking and the process specification have the same name), assignment is implied.

In the specification of a process, a specific coding block is sometimes referred to by the variable name having a value equal to the address of the specific coding block.

6.0 Bitstream and waveform signal format

7.0 Syntax and semantics

7.1 Method of specifying syntax in tabular form

The syntax tables specify a superset of the syntax of all allowed bitstreams. Additional constraints on the syntax might be specified, either directly or indirectly, in other clauses.

NOTE – An actual decoder is expected to 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 Specification.

The following table lists examples of the syntax specification format. When syntax_element appears, it specifies that a syntax element is parsed from the bitstream and the bitstream pointer is advanced to the next position beyond the syntax element in the bitstream parsing process.

 

Descriptor

/* A statement can be a syntax element with an associated descriptor or can be an expression used to specify conditions for the existence, type and quantity of syntax elements, as in the following two examples */

 

syntax_element

ue(k)

conditioning statement

 

 

 

/* A group of statements enclosed in curly brackets is a compound statement and is treated functionally as a single statement. */

 

{

 

statement

 

statement

 

...

 

}

 

 

 

/* A "while" structure specifies a test of whether a condition is true, and if true, specifies evaluation of a statement (or compound statement) repeatedly until the condition is no longer true */

 

while( condition )

 

statement

 

 

 

/* A "do ... while" structure specifies evaluation of a statement once, followed by a test of whether a condition is true, and if true, specifies repeated evaluation of the statement until the condition is no longer true */

 

do

 

statement

 

while( condition )

 

 

 

/* An "if ... else" structure specifies a test of whether a condition is true and, if the condition is true, specifies evaluation of a primary statement, otherwise, specifies evaluation of an alternative statement. The "else" part of the structure and the associated alternative statement is omitted if no alternative statement evaluation is needed */

 

if( condition )

 

primary statement

 

else

 

alternative statement

 

 

 

/* A "for" structure specifies evaluation of an initial statement, followed by a test of a condition, and if the condition is true, specifies repeated evaluation of a primary statement followed by a subsequent statement until the condition is no longer true. */

 

for( initial statement; condition; subsequent statement )

 

primary statement

 

7.1.1 Specification of syntax functions and descriptors

The functions presented in this clause are used in the specification of the syntax. 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.

byte_aligned( ) is specified as follows:

— If the current position in the bitstream is a byte-aligned position, i.e., the current position is an integer multiple of 8 bits from the position of the first bit in the bitstream, the return value of byte_aligned( ) is equal to TRUE.

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

read_bits( n ) reads the next n bits from the bitstream and 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.

The following descriptors specify the parsing process of each syntax element:

— ae(ctxSet): context-adaptive arithmetic entropy-coded syntax element. The variable ctxSet is a non-negative integer used for deriving the context variables for parsing. The parsing process for this descriptor is specified in clause 9.5.

NOTE The variable ctxSet adds another dimension to the set of context variables. For example, many syntax elements use disjoint sets of context variables depending on the channel index.

— aep(): equal probable arithmetic entropy-coded syntax element. The syntax element does not use context variables for parsing. The parsing process for this descriptor is specified in clause 9.5.

— aet(): arithmetic entropy-coded termination syntax element. The syntax element does not use context variables for parsing. The parsing process for this descriptor is specified in clause 9.5.

— 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. The parsing process for this descriptor is specified by the return value of the function read_bits( n ).

— i(n): signed integer using n bits. When n is "v" in the syntax table, the number of bits varies in a manner dependent on the value of other syntax elements. The parsing process for this descriptor is specified by the return value of the function read_bits( n ) interpreted as a two's complement integer representation with most significant bit written first.

— se(v): signed integer 0-th order Exp-Golomb-coded syntax element with the left bit first. The parsing process for this descriptor is specified in clause 9.3 with the order k equal to 0.

— st(v): null-terminated string encoded as universal coded character set (UCS) transmission format-8 (UTF-8) characters as specified in ISO/IEC 10646. The parsing process is specified as follows: st(v) reads and returns a series of bytes from the bitstream, beginning at the current position and continuing up to but not including the next byte that is equal to 0x00, and advances the bitstream pointer by ( stringLength + 1 ) * 8 bit positions, where stringLength is equal to the number of bytes returned.

NOTE The st(v) syntax descriptor does not require that the current bit position in the bitstream is a byte-aligned position.

— u(n): unsigned integer using n bits. When n is "v" in the syntax table, the number of bits varies in a manner dependent on the value of other syntax elements. 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 most significant bit written first.

— ue(v): unsigned integer 0-th order Exp-Golomb-coded syntax element with the left bit first. The parsing process for this descriptor is specified in clause 9.3 with the order k equal to 0.

— ev(k,n,m): unsigned integer coded using escaped values. The parsing process for this descriptor is specified in clause 9.2.

— utr(c): unsigned integer un-truncated Rice (UTR)-coded syntax element. The parsing process for this descriptor is specified in clause 9.4 with “c” denoting the cRiceParam parameter.

7.1.2 Syntax in tabular form

7.1.3 Stream packet syntax

General stream packet unit syntax

stream_packet( ) {

Descriptor

stream_packet_header( )

 

NumBytesInSyntaxStructure = stream_packet_length

 

for( i = 0; i < NumBytesInSyntaxStructure; i++ )

 

syntax_structure_byte[ i ]

b(8)

}

 

Stream packet header syntax

stream_packet_header( ) {

Descriptor

stream_packet_type

ev(3,8,8)

stream_packet_label

ev(2,8,32)

stream_packet_length

ev(11,24,24)

}

 

7.1.4 Raw byte sequence payloads, trailing bits and byte alignment syntax

Waveform parameter set syntax

waveform_parameter_set( ) {

Descriptor

wps_waveform_parameter_set_id

u(4)

NumChannelGroups = 0

 

TotalNumChannels = 0

 

do {

 

wps_num_channels_in_next_group_minus1

ue(v)

wps_num_channel_group_repetitions

ue(v)

for( j = 0; j <= wps_num_channel_group_repetitions; j++ ) {

 

NumChannels[ NumChannelGroups ] =

wps_num_channels_in_next_group_minus1 + 1

 

ChannelGroupStartingPos[ NumChannelGroups++ ]= TotalNumChannels

 

TotalNumChannels += wps_num_channels_in_next_group_minus1 + 1

 

}

 

wps_more_channel_groups_present_flag

u(1)

} while( wps_more_channel_groups_present_flag )

 

wps_channel_reordering_flag

u(1)

if( wps_channel_reordering_ flag ) {

 

wps_num_channel_swaps_minus1

ue(v)

for( i = 0; i <= wps_num_channel_swaps_minus1; i++ ) {

 

wps_swap_frst_idx[ i ]

ue(v)

wps_swap_scnd_idx_min_frst_idx_min1[ i ]

ue(v)

}

 

}

 

wps_num_annotation_channels

ue(v)

for( j = 0; j < wps_num_annotation_channels; j++ )

 

AnnotationChannelNumSamples[ j ] = 0

ue(v)

trailing_bits( )

 

}

 

Channel group parameter set syntax

channel_group_parameter_set( ) {

Descriptor

cgps_channel_group_parameter_set_id

u(8)

cgps_waveform_parameter_set_id

u(4)

cgps_length_signal_mode_flag

u(1)

cgps_frame_length_shift

u(4)

cgps_max_min_block_size

u(6)

cgps_deblocking_mode

u(2)

cgps_max_bit_depth

u(3)

cgps_allow_cross_channel_pred_flag

u(1)

if( cgps_allow_cross_channel_pred_flag ) {

 

cgps_cc_pred_filtering_mode

u(2)

cgps_allow_cc_pred_mult_hyp_flag

u(1)

}

 

cgps_allow_block_matching_pred_flag

u(1)

if( cgps_allow_block_matching_pred_flag ) {

 

cgps_bm_pred_filtering_mode

u(2)

cgps_allow_bm_pred_mult_hyp_flag

u(1)

cgps_allow_bm_offset_pred_prev_ch_flag

u(1)

}

 

cgps_allow_DC_pred_flag

u(1)

cgps_allow_line_fit_flag

u(1)

cgps_allow_lpf_flag

u(1)

cgps_allow_sample_pred_fixed_weights_flag

u(1)

if( cgps_allow_lpf_flag )

 

cgps_lpf_allow_prev_ch_flag

u(1)

cgps_allow_transform_skip

u(1)

cgps_residual_quant_mode

u(2)

cgps_ch_indep_interval_idx

u(4)

DepChMask = ( 2 << cgps_ch_indep_interval_idx ) − 1

 

cgps_max_abs_delta_qp_idx

u(3)

MaxAbsDeltaQP = ( 1 << cgps_max_abs_delta_qp_idx ) − 1

 

cgps_qp

u(10)

if( cgps_allow_transform_skip )

 

cgps_allow_verbatim_coding

u(1)

cgps_allow_zero_lsb_flag

u(1)

cgps_allow_lms_flag

u(1)

if( cgps_ allow_lms_flag) {

 

cgps_allow_lms_split_flag

u(1)

cgps_lms_ar_order_over_four

u(4)

cgps_allow_cc_lms_flag

u(1)

if( cgps_ allow_cc_lms_flag) {

 

cgps_max_order_cc_lms_minus_one

u(6)

}

 

cgps_ctx_init_flag

u(1)

trailing_bits( )

 

}

 

Independent frame syntax

independent_frame( ) {

Descriptor

if_channel_group_parameter_set_id

u(8)

if( NumChannelGroups > 1 )

 

if_channel_group_id

u(v)

for( ch = 1; ch < NumChannels[ if_channel_group_id ]; ch++ ) {

 

if_mean_per_channel[ ch ]

u(16)

}

 

if( cgps_allow_cross_channel_pred_flag )

 

for( ch = 1; ch < NumChannels[ if_channel_group_id ]; ch++ )

 

for( n = 0; n <= cgps_allow_cc_pred_mult_hyp_flag; n++ )

 

CrossChannelPredInputChDistMinus1[ ch ][ n ] = 0

 

if( cgps_allow_block_matching_pred_flag )

 

for( ch = 0; ch < NumChannels[ if_channel_group_id ]; ch++ )

 

for( n = 0; n <= cgps_allow_bm_pred_mult_hyp_flag; n++ ) {

 

BlockMatchingPredOffsetMinusBlocksSize[ ch ][ n ] = 0

 

Log2BlockMatchingPredBlockSize[ ch ][ n ] = 0

 

}

 

if( cgps_allow_lpf_flag ) {

 

LPFMaxNumWeights = 16

 

for( ch = 0; ch < NumChannels[ if_channel_group_id ]; ch++ )

 

for( n = 0; n <= LPFMaxNumWeights; n++ ) {

 

LPFWeightsPred[ ch ][ n ] = 0

 

}

 

}

 

if( cgps_length_signal_mode_flag )

 

if_indep_num_samples_per_channel_minus1

u(32)

if( cgps_ctx_init_flag )

 

if_ctx_init_mode

u(1)

for( i = 0; i < NumChannels[ if_channel_group_id ]; i++ )

 

CurrBlockQP[ i ] = cgps_qp

 

byte_alignment( )

 

general_frame_data( NumChannels[ if_channel_group_id ] )

 

trailing_bits( )

 

}

 

Dependent frame syntax

dependent_frame( ) {

Descriptor

if( NumChannels > 1 )

 

df_channel_group_id

u(v)

general_frame_data( NumChannels[ df_channel_group_id ] )

 

trailing_bits( )

 

}

 

Annotation channel syntax

annotation_channel( ) {

Descriptor

ac_waveform_parameter_set_id

u(4)

ac_annotation_channel_id

ue(v)

ac_num_annotation_bytes_div2_minus1

ue(v)

byte_alignment()

 

annotation_channel_data( )

 

}

 

Timestamp syntax

timestamp_struct( ) {

Descriptor

ts_waveform_parameter_set_id

u(4)

if( NumChannelGroups > 1 )

 

ts_channel_group_id

u(v)

ts_time_idx_flag

u(1)

if( ts_time_idx_flag )

 

ts_time_idx

ue(v)

ts_offset_type_flag

u(1)

ts_time_world_flag

u(1)

if( ts_time_world_flag ) {

 

ts_type

u(3)

ts_time_type

u(7)

if( ts_time_type  = =  TIME_LONG ) {

 

ts_time_long

se(v)

ts_time_offset

se(v)

} else if( ts_time_type  = =  TIME_SHORT ) {

 

ts_time_short

ev(4,8,8)

ts_time_offset

ev(4,8,8)

} else if( ts_time_type  = =  TIME_UXT ) {

 

ts_time_uxt

se(v)

ts_time_offset

se(v)

} else if( ts_time_type  = =  TIME_TAI) { /* per ISO/IEC 23001-17 */

 

ts_time_tai

u(64)

ts_status_bits

u(8)

} else if( ts_time_type  = =  TIME_UTC )

 

ts_time_utc

st(v)

} else {

 

ts_time_long_relative

ue(v)

ts_time_offset_relative

ue(v)

}

 

trailing_bits( )

 

}

 

Segment payload syntax

segment_payload( ) {

Descriptor

sp_channel_group_parameter_set_id

u(8)

if( NumChannelGroups > 1 )

 

sp_channel_group_id

u(v)

SegmentPayloadFramesFlag = 1

 

sp_segment_payload_metadata_flag

u(1)

if( sp_segment_payload_metadata_flag ) {

 

segment_payload_metadata( )

 

sp_segment_payload_frames_flag

u(1)

SegmentPayloadFramesFlag = sp_segment_payload_frames_flag

 

}

 

if( SegmentPayloadFramesFlag ) {

 

sp_num_frames_per_segment_minus_one

ue(v)

segment_payload_metadata_coded_sizes( )

 

sp_num_sequences_minus_one

ue(v)

sp_varying_num_frames_per_sequence_flag

u(1)

if( sp_varying_num_frames_per_sequence_flag )

 

for( s = 0; s < sp_num_sequences_minus_one + 1; s++ ) {

 

sp_num_frames_per_sequence_minus_one

ue(v)

NumFramesPerSequence[ s ] = sp_num_frames_per_sequence_minus_one + 1

 

}

 

else

 

NumFramesPerSequence[ 0 ] = ( sp_num_frames_per_segment_minus_one + 1 ) /

( sp_num_sequences_minus_one + 1 )

 

s = 0

 

byte_alignment( )

 

for( n = 0; n < sp_num_frames_per_segment_minus_one + 1; n++ )

 

if( n % NumFramesPerSequence[ s ]  = =  0 ) {

 

independent_frame( )

 

s = ( sp_varying_num_frames_per_sequence_flag  = =  1 ) ? ( s + 1 ) : 0

 

} else

 

dependent_frame( )

 

}

 

trailing_bits( )

 

}

 

Segment payload metadata syntax

segment_payload_metadata( ) {

Descriptor

sp_num_features

ue(v)

for( i = 0; i < sp_num_features; i++ ) {

 

sp_feature_type

st(v)

sp_feature_segment_marking_flag

u(1)

if( sp_feature_segment_marking_flag ) {

 

sp_feature_segment_start

ue(v)

sp_feature_segment_length

ue(v)

}

 

}

 

sp_segment_distortion_measures_flag

u(1)

if( sp_segment_distortion_measures_flag ) {

 

DistortionMeasuresInChannelGroupFlag = 1

 

sp_distortion_measures_per_channel_flag

u(1)

if( sp_distortion_measures_per_channel_flag ) {

 

sp_distortion_measures_in_cg_flag

u(1)

DistortionMeasuresInChannelGroupFlag = sp_distortion_measures_in_cg_flag

 

sp_num_distortion_measures_per_channel

ev(3,8,8)

for( ch = 0; ch < NumChannels[ sp_channel_group_id ]; ch++ ) {

 

sp_variance[ ch ]

u(8)

sp_squared_error[ ch ]

u(8)

for( i = 0; i < sp_num_distortion_measures_per_channel; i++ ) {

 

sp_distortion_measure_type[ ch ][ i ]

st(v)

sp_distortion_measure[ ch ][ i ]

se(v)

}

 

}

 

}

 

if( DistortionMeasuresInChannelGroupFlag ) {

 

sp_num_distortion_measures_in_cg

ev(3,8,8)

sp_variance_cg

u(8)

sp_squared_error_cg

u(8)

for( i = 0; i < sp_num_distortion_measures_in_cg; i++ ) {

 

sp_distortion_measure_type_cg[ i ]

st(v)

sp_distortion_measure_cg[ i ]

se(v)

}

 

}

 

}

 

}

 

Segment payload metadata coded sizes syntax

segment_payload_metadata_coded_sizes( ) {

Descriptor

sp_frame_size[ 0 ]

ue(v)

if( sp_num_frames_per_segment_minus_one > 0 ) {

 

sp_delta_utr_param

u(v)

for( n = 1; n < sp_num_frames_per_segment_minus_one + 1; n++ ) {

 

sp_abs_delta

utr(sp_delta_utr_param)

sp_sign_delta

u(1)

delta = ( sp_sign_delta  = =  1 ) ? −sp_abs_delta : sp_abs_delta

 

sp_frame_size[ n ] = sp_frame_size[ n − 1 ] + delta

 

}

 

}

 

}

 

Feature set syntax

feature_set( ) {

Descriptor

ft_waveform_parameter_set_id

u(4)

if( NumChannelGroups > 1 )

 

ft_channel_group_id

u(v)

ft_num_features

ue(v)

for( i = 0; i < ft_num_features; i++ ) {

 

ft_feature_annotation_type[ i ]

u(2)

if( ft_feature_annotation_type  = =  0 )

 

ft_annotation_str

st(v)

else if( ft_feature_annotation_type  = =  1 )

 

ft_annotation_uri

st(v)

else if( ft_feature_annotation_type  = =  2 )

 

ft_annotation_channel_id

ue(v)

else

 

ft_feature_type_enum

ev(3,8,8)

FeatureType[ i ] = feat_extract( )

 

ft_feature_marking_present_flag[ i ]

u(1)

if( ft_feature_marking_present_flag[ i ] ) {

 

ft_feature_start[ i ]

ue(v)

ft_feature_length[ i ]

ue(v)

}

 

}

 

if( cs_enable_high_res_quality_metrics_flag ) {

 

ft_num_qualities

ev(3,8,8)

for( j = 0; j < ft_num_qualities; j++ ) {

 

ft_quality_start [ j ]

ue(v)

ft_quality_length [ j ]

ue(v)

ft_quality_value [ j ]

u(v)

}

 

}

 

trailing_bits( )

 

}

 

Config set syntax

config_set( ) {

Descriptor

cs_num_wps_ids

u(4)

for( i = 0; i < cs_num_wps_ids; i++ ) {

 

cs_wps_id

u(4)

cs_wps_id_label

ev(2,8,32)

if( cs_num_wps_ids > 1 )

 

cs_wps_id_label_zero

ev(2,8,32)

cs_num_channel_groups_in_wps[ i ]

ue(v)

cs_num_sampling_freqs_in_wps

u(4)

for( sf = 0; sf < cs_num_sampling_freqs_in_wps; sf++ )

 

cs_sampling_freq[ i ][ sf ]

ue(v)

if( cs_num_sampling_freqs_in_wps > 1 )

 

for( cg = 0; cg < cs_num_channel_groups_in_wps[ i ]; cg++ )

 

cs_sampling_freq_idx[ i ][ cg ]

u(v)

cs_num_signal_types_in_wps

u(4)

for( st = 0; st < cs_num_signal_types_in_wps; st++ ) {

 

cs_signal_type[ i ][ st ]

ev(3,8,8)

cs_signal_num_annotation_channels

ue(v)

for( ac = 0; ac < cs_signal_num_annotation_channels; ac++ )

 

cs_signal_annotation_channel_id[ i ][ st ][ ac ]

ue(v)

}

 

if( cs_num_signal_types_in_wps > 1 )

 

for(cg=0; cg < cs_num_channel_groups_in_wps[ i ]; cg++ )

 

cs_signal_type_idx[ i ][ cg ]

u(v)

cs_signal_info_data_flag_in_wps

u(1)

if( cs_signal_info_data_flag_in_wps ) {

 

for( cg = 0; cg < cs_num_channel_groups_in_wps[ i ]; cg++ ) {

 

cs_has_range_info

u(1)

if( cs_has_range_info ) {

 

cs_digital_min[ i ][ cg ]

se(v)

cs_digital_max[ i ][ cg ]

se(v)

cs_analogue_min[ i ][ cg ]

se(v)

cs_analogue_max[ i ][ cg ]

se(v)

cs_analogue_units[ i ][ cg ]

st(v)

}

 

cs_recording_start_time_flag[ i ][ cg ]

u(1)

}

 

}

 

}

 

cs_config_extension_flag

u(1)

if( cs_config_extension_flag )

 

config_extension_data( )

 

trailing_bits( )

 

}

 

Config extension data syntax

config_extension_data( ) {

Descriptor

for( i = 0; i < cs_num_wps_ids; i++ ) {

 

cs_features_in_wps_flag

u(1)

if( cs_features_in_wps_flag ) {

 

for( cg = 0; cg < cs_num_channel_groups_in_wps[ i ]; cg++ ) {

 

cs_features_in_cg_id_flag

u(1)

if( cs_features_in_cg_id_flag ) {

 

cs_num_features_in_cg_id[ i ][ cg ]

ue(v)

cs_enable_high_res_quality_metrics_flag

u(1)

if( cs_enable_high_res_quality_metrics_flag ) {

 

cs_has_custom_quality_lut_flag

u(1)

if( cs_has_custom_quality_lut_flag ) {

 

cs_quality_metric[ i ][ cg ]

u(3)

if( cs_quality_metric[ i ][ cg ]  = =  7 )

 

cs_quality_metric[ i ][ cg ]

st(v)

cs_quality_num_bands

ue(v)

for( j = 0; j < cs_quality_num_bands; j++ )

 

cs_quality_lut[ i ][ cg ][ j ]

u(7)

}

 

cs_uses_quality_threshold_flag

u(1)

cs_has_custom_quality_threshold_flag

u(1)

if( cs_has_custom_quality_threshold_flag )

 

cs_quality_threshold[ i ][ cg ]

u(7)

}

 

}

 

}

 

}

 

cs_segment_payload_frames_in_wps

u(2)

if( cs_segment_payload_frames_in_wps > 1 ) /* 2 or 3: partial */

 

for( cg = 0; cg < cs_num_channel_groups_in_wps[ i ]; cg++ )

 

cs_segment_payload_frames_in_cg_id_flag[ i ][ cg ]

u(1)

}

 

}

 

Synchronization structure syntax

synchronization_struct( ) {

Descriptor

syncword_8bits

u(8)

}

 

User identifier syntax

user_identifier( ) {

Descriptor

universally_unique_identifier( )

 

trailing_bits( )

 

}

 

Stream identifier syntax

stream_identifier( ) {

Descriptor

universally_unique_identifier( )

 

trailing_bits( )

 

}

 

Universally unique identifier syntax

universally_unique_identifier( ) {

Descriptor

uuid_segment_start_flag

u(1)

uuid_segment_stop_flag

u(1)

uuid_reserved_2bits

u(2)

uuid_segment_length_minus1

u(4)

for( i = 0; i <= uuid_segment_length_minus1; i++ )

 

uuid_data[ i ]

b(8)

}

 

Authentication start syntax

authentication_start( ) {

Descriptor

aust_id

u(8)

aust_sequence_id

u(1)

aust_hash_type

ev(4,8,8)

aust_key_id

ev(3,8,8)

aust_prov_id

ev(8,8,16)

if( aust_prov_id  = =  0 )

 

aust_key_source_uri

st(v)

aust_frame_types_present_flag

u(1)

if( aust_frame_types_present_flag ) {

 

aust_inclusion_types_flag

u(1)

aust_pactype_list_length_minus1

u(6)

for( i = 0; i <= aust_pactype_length_minus1; i++ )

 

aust_packet_type[ i ]

ev(8,8,8)

} else

 

aust_reserved_7bits

u(7)

aust_multi_stream_flag

u(1)

if( aust_multi_stream_flag ) {

 

aust_inclusion_labels_flag

u(1)

aust_label_list_length_minus1

u(6)

for( i = 0; i <= aust_label_list_length_minus1; i++ )

 

aust_add_packet_label[ i ]

ev(8,8,32)

}

 

trailing_bits( )

 

}

 

Authentication signature syntax

authentication_signature( ) {

Descriptor

ausig_id

u(8)

ausig_sequence_id

u(1)

ausig_partial_sig_flag

u(1)

if( ausig_partial_sig_flag ) {

 

ausig_segment_start_flag

u(1)

ausig_segment_stop_flag

u(1)

ausig_segment_length_minus1

u(6)

for( i = 0; i <= ausig_segment_length_minus1; i++ )

 

ausig_sig_partial[ i ]

b(8)

} else {

 

ausig_length_minus1

u(6)

for( i = 0; i <= ausig_segment_length_minus1; i++ )

 

ausig_sig_complete[ i ]

b(8)

}

 

trailing_bits( )

 

}

 

CRC 16 syntax

crc16_struct( ) {

Descriptor

}

 

CRC 32 syntax

crc32_struct( ) {

Descriptor

}

 

Global CRC 16 syntax

global_crc16_struct( ) {

Descriptor

}

 

Global CRC 32 syntax

global_crc32_struct( ) {

Descriptor

}

 

Auxiliary metadata syntax

auxiliary_metadata( ) {

Descriptor

am_header_crc32

u(32)

am_extension_present_flag

u(1)

am_waveform_type

u(2)

am_length_signal_mode

u(1)

am_allow_reconfig_flag

u(1)

am_copyright_flag

u(1)

am_original_flag

u(1)

am_private_flag

u(1)

am_stream_max_sampling_rate_minus1

u(24)

am_stream_max_num_channels_minus1

u(16)

if( am_length_signal_mode )

 

am_stream_num_samples_per_ch

u(32)

if( am_waveform_type = = WT_BS2088 ) {

 

am_metadata_reserved_flag

u(1)

am_metadata_num_bytes_minus1

u(31)

for( i = 0; i <= am_metadata_num_bytes_minus1; i++ )

 

am_metadata_payload_bytes[ i ]

u(8)

}

 

am_signal_type

u(8)

}

 

Trailing bits syntax

trailing_bits( ) {

Descriptor

stop_one_bit /* equal to 1 */

f(1)

while( !byte_aligned( ) )

 

alignment_zero_bit /* equal to 0 */

f(1)

}

 

Byte alignment syntax

byte_alignment( ) {

Descriptor

while( !byte_aligned( ) )

 

byte_alignment_bit_equal_to_zero /* equal to 0 */

f(1)

}

 

7.1.5 Frame data syntax

General frame data syntax

general_frame_data( numChannels ) {

Descriptor

FrameNumSamplesPerChannel = 0

 

Log2BlockSizeLast = −1

 

do {

 

if( FrameNumSamplesPerChannel > 0 )

 

end_of_frame_sequence_flag

aet()

if( !end_of_frame_sequence_flag ) {

 

if( MaxSplitDepth > 0 )

 

block_split_log2

ae(0)

Log2BlockSize = Log2MaxBlockSize − block_split_log2

 

prediction_trafo_data_block( numChannels )

 

FrameNumSamplesPerChannel += 1 << Log2BlockSize

 

end_of_truncated_frame_sequence_flag

aet()

if( end_of_truncated_frame_sequence_flag )

 

num_samples_per_channel_to_discard

u(v)

if( !end_of_truncated_frame_sequence_flag &&

FrameNumSamplesPerChannel = = ( 1 << Log2FrameLength ) )

 

end_of_frame_one_bit /* equal to 1 */

aet()

}

 

} while( !end_of_frame_sequence_flag && !end_of_truncated_frame_sequence_flag &&

!end_of_frame_one_bit )

 

}

 

Predictive transform coding block syntax

Prediction trafo block data syntax

prediction_trafo_data_block ( ) {

Descriptor

for( ch = 0; ch < numChannels; ch++ ) {

 

if( cgps_allow_block_matching_pred_flag | | ( cgps_allow_cross_channel_pred_flag &&

( ch & DepChMask ) > 0 ) )

 

block_matching_or_cross_channel_pred_flag

ae(ch)

if( block_matching_or_cross_channel_pred_flag ) {

 

if( cgps_allow_block_matching_pred_flag &&

cgps_allow_cross_channel_pred_flag

&& ( ch & DepChMask ) > 0 )

 

cross_channel_pred_flag

ae(ch)

if( cross_channel_pred_flag )

 

cross_channel_prediction_data( ch )

 

else

 

block_matching_prediction_data( ch )

 

} else

 

block_pred_mode

ae(ch)

if( block_matching_or_cross_channel_pred_flag | |

( block_pred_mode = = BPM_OFF ) ) {

 

sample_pred_mode( ch )

 

if( spred_lpf_flag )

 

linear_predictive_filtering_data( ch )

 

}

 

if( cgps_max_abs_delta_qp_idx > 0 ) {

 

block_abs_delta_qp

ae(ch)

if( block_abs_delta_qp > 0 )

 

block_delta_qp_sign_flag

aep()

blockDeltaQP = block_delta_qp_sign_flag ?

−block_abs_delta_qp : block_abs_delta_qp

 

CurrBlockQP[ ch ] =

Clip3( 0, 1023, CurrBlockQP[ ch ] + blockDeltaQP )

 

}

 

if( spred_lpf_or_diff_flag | | ( spred_rem_mode_idx = = 2 ) ) {

 

if( ( spred_rem_mode_idx = = 2 ) | | CurrBlockQP[ ch ] > 0 ) {

 

transform_present_flag

ae(ch)

TransformMode = TM_OFF

 

if( transform_present_flag ) {

 

transform_dst_flag

aep()

TransformMode = ( transform_dst_flag = = 1 ? TM_DST : TM_DCT )

 

}

 

}

 

}

 

if( cgps_allow_zero_lsb_flag && CurrBlockQP[ ch ] = = 0 ) {

 

zlsb_present_flag

ae(ch)

if( zlsb_present_flag )

 

num_zlsb_minus1

aep()

}

 

NumZLSB = zlsb_present_flag ? 1 + num_zlsb_minus1 : 0

 

quant_res_sample_data( ch )

 

}

 

}

 

Cross-channel prediction data syntax

cross_channel_prediction_data( ch ) {

Descriptor

cc_pred_offset_only_flag

ae(ch)

if( cgps_cc_pred_filtering_mode > 0 )

 

cc_pred_filter_flag

ae(ch)

if( cgps_cc_pred_filtering_mode = = 2 && cc_pred_filter_flag )

 

cc_pred_filter_idx

ae(ch)

if( (ch & DepChMask) > 1 ) {

 

if( cgps_allow_cc_pred_mult_hyp_flag )

 

cc_pred_mult_hyp_flag

ae(ch)

if( !cc_pred_mult_hyp_flag | | ( ch & DepChMask ) > 2 ) {

 

for( n = 0; n <= cc_pred_mult_hyp_flag; n++ ) {

 

cc_pred_abs_chd_greater0_flag[ n ]

ae(ch)

if( cc_pred_abs_chd_greater0_flag[ n ] ) {

 

cc_pred_abs_chd_minus1[ n ]

aep()

cc_pred_chd_sign_flag[ n ]

aep()

}

 

cCPredInputChDistDiffSign = cc_pred_chd_sign_flag[ n ] ? −1 : 1

 

cCPredInputChDistDiff = cc_pred_abs_chd_greater0_flag[ n ] ?

cCPredInputChDistDiffSign * (cc_pred_abs_chd_minus1[ n ] +1 ) : 0

 

CrossChannelPredInputChDistMinus1[ ch ][ n ] =

Max( 0, Min ( ( ch & DepChMask ) − 1, cCPredInputChDistDiff +

CrossChannelPredInputChDistMinus1[ ch ][ n ] ) )

 

}

 

}

 

}

 

}

 

Block matching prediction data syntax

block_matching_prediction_data( ch ) {

Descriptor

if( cgps_allow_bm_pred_mult_hyp_flag ) {

 

bm_pred_mult_hyp_flag

ae(ch)

bm_pred_add_offset_flag

ae(ch)

}

 

for( n = 0; n <= bm_pred_mult_hyp_flag; n++ ) {

 

if( cgps_bm_pred_filtering_mode > 0 )

 

bm_pred_filter_flag[ n ]

ae(ch)

if( bm_pred_filter_flag[ n ] && cgps_bm_pred_filtering_mode = = 2 )

 

bm_pred_filter_idx[ n ]

ae(ch)

if( cgps_allow_bm_offset_pred_prev_ch_flag && ( ch & DepChMask ) > 0 )

 

bm_pred_off_pred_prev_ch_flag[ n ]

ae(ch)

bm_pred_abs_offd_greater0_flag[ n ]

ae(ch)

if( bm_pred_abs_offd_greater0_flag[ n ] ) {

 

bm_pred_abs_offd_minus1[ n ]

ae(ch)

bm_pred_offd_sign_flag[ n ]

aep()

}

 

bmOffsetMinusBlockSizeDiffSign = bm_pred_offd_sign_flag[ n ] ? −1 :1

 

bmOffsetMinusBlockSizeDiff = bm_pred_abs_offd_greater0_flag[ n ] ?

bmOffsetMinusBlockSizeDiffSign *( bm_pred_abs_offd_minus1 + 1 ) : 0

 

bmOffsetMinusBlockSizePred = bm_pred_off_pred_prev_ch_flag[ n ] ?

BlockMatchingPredOffsetMinusBlocksSize[ ch − 1 ][ n ] :

BlockMatchingPredOffsetMinusBlocksSize[ ch ][ n ]

 

log2BMBlockSizePred = bm_pred_off_pred_prev_ch_flag[ n ] ?

Log2BlockMatchingPredBlockSize[ ch − 1 ][ n ] :

Log2BlockMatchingPredBlockSize[ ch ][ n ]

 

if( ( log2BMBlockSizePred = = Log2BlockSize ) | |

( log2BMBlockSizePred = = 0 ) ) {

 

BlockMatchingPredOffsetMinusBlocksSize[ ch ][ n ] =

bmOffsetMinusBlockSizePred + bmOffsetMinusBlockSizeDiff

 

} else {

 

bmOffsetPred = bmOffsetMinusBlockSizePred + ( 1 << log2BMBlockSizePred )

 

if( log2BMBlockSizePred > Log2BlockSize && bmOffsetMinusBlockSizePred >

( Log2BlockSize << 6 ) )

 

bmOffsetPred = bmOffsetPred >> ( log2BMBlockSizePred − Log2BlockSize )

 

if( bmOffsetPred < ( 1 << Log2BlockSize ) )

 

bmOffsetPred = bmOffsetPred << ( Log2BlockSize − log2BMBlockSizePred )

 

BlockMatchingPredOffsetMinusBlocksSize[ ch ][ n ] =

bmOffsetPred − ( 1 << Log2BlockSize ) + bmOffsetMinusBlockSizeDiff

 

}

 

BlockMatchingPredOffsetMinusBlocksSize[ ch ][ n ] = Clip3( 0, (1 << 16) − 1,

BlockMatchingPredOffsetMinusBlocksSize[ ch ][ n ] )

 

Log2BlockMatchingPredBlockSize[ ch ][ n ] = Log2BlockSize

 

}

 

}

 

Sample pred mode syntax

sample_pred_mode( ch ) {

Descriptor

spred_lpf_or_diff_flag

ae(ch)

if( cgps_allow_lpf_flag && spred_lpf_or_diff_flag )

 

spred_lpf_flag

ae(ch)

if( !spred_lpf_or_diff_flag )

 

spred_rem_mode_idx

ae(ch)

}

 

Linear predictive filtering data syntax

linear_predictive_filtering_data( ch ) {

Descriptor

if( ( ch & DepChMask ) > 0 &&

cgps_lpf_allow_prev_ch_flag )

 

lpf_prev_ch_flag

ae(ch)

if( lpf_prev_ch_flag ) {

 

lpf_prev_ch_idx

aep()

lpf_prev_ch_weight_abs

aep()

if( lpf_prev_ch_weight_abs > 0 )

 

lpf_prev_ch_weight_sign_flag

aep()

}

 

lpf_delta_coding_flag

ae(ch)

lpf_num_weights_idx

ae(ch)

LPFNumWeightsCurr = ( ( lpf_num_weights_idx + 1 ) << 1 )

 

for( n = 0; n < LPFNumWeightsCurr; n++ ) {

 

abs_lpf_weight_greater0_flag[ n ]

ae(ch)

if( abs_lpf_weight_greater0_flag[ n ] ) {

 

abs_lpf_weight_minus1[ n ]

ae(ch)

lpf_weight_sign_flag[ n ]

aep()

}

 

lpfWeightSign = lpf_weight_sign_flag[ n ] ? − 1 : 1

 

currentVal = abs_lpf_weight_greater0_flag[ n ] ?

lpfWeightSign * ( abs_lpf_weight_minus1[ n ] + 1 ) : 0

 

if( lpf_delta_coding_flag )

 

LPFWeightsCurr[ n ] = Clip3( −32, 32,

currentVal + LPFWeightsPred[ ch ][ n ] )

 

else

 

LPFWeightsCurr[ n ] = currentVal

 

}

 

for( n = 0; n < LPFMaxNumWeights; n++ ) {

 

LPFWeightsPred[ ch ][ n ] = (n < LPFNumWeightsCurr) ?

LPFWeightsCurr[ n ] : 0

 

}

 

}

 

Quant res sample data syntax

quant_res_sample_data( ch ) {

Descriptor

NumQuantIndices = 1  <<  Log2BlockSize

 

if( block_pred_mode = = BPM_OFF && TransformMode = = TM_OFF &&

SamplePredMode = = SPM_OFF && cgps_allow_verbatim_coding_flag = = 1 ) {

 

IntBitDepth = BitDepthMax − NumZLSB

 

offset = (1 << IntBitDepth ) >> 1

 

for( k = 0; k < NumQuantIndices; k = k + 1 ) {

 

coeff_bypass_value[ k ]

aep()

QuantIndices[ k ] = coeff_bypass_value[ k ] − offset

 

}

 

} else if( TransformMode = = TM_OFF ) {

 

numLevels = 0

 

sumAbsLevels = 0

 

TSkipRiceParameter = 1

 

for( k = NumQuantIndices − 1; k >= 0; k = k − 1 ) {

 

abs_tskip_coeff_gt0_flag[ k ]

ae(ch)

QuantIndices[ k ] = abs_tskip_coeff_gt0_flag[ k ]

 

if( QuantIndices[ k ] > 0 ) {

 

abs_tskip_coeff_offset[ k ]

ae(ch)

QuantIndices[ k ] += abs_tskip_coeff_offset[ k ]

 

}

 

if( QuantIndices[ k ] = = NumTSkipGtxFlags + 1 ) {

 

abs_tskip_coeff_rem_prefix[ k ]

ae(ch)

QuantIndices[ k ] += ( abs_tskip_coeff_rem_prefix[ k ]  <<  RiceParameter )

 

if( abs_tskip_coeff_rem_prefix[ k ] < MaxTSkipRemPrefix )

 

if( TSkipRiceParameter > 0 ) {

 

abs_tskip_coeff_rem_fl_suffix[ k ]

aep()

QuantIndices[ k ] += abs_tskip_coeff_rem_rice_suffix[ k ]

 

}

 

else {

 

abs_tskip_coeff_rem_eg0_suffix[ k ]

ae(ch)

QuantIndices[ k ] += abs_tskip_coeff_rem_eg0_suffix[ k ]

 

}

 

}

 

if( QuantIndices[ k ] > 0 ) {

 

tskip_coeff_sign_flag[ k ]

aep()

if( tskip_coeff_sign_flag[ k ] )

 

QuantIndices[ k ] = −QuantIndices[ k ]

 

}

 

numLevels += 1

 

sumAbsLevels += Abs( QuantIndices[ k ] )

 

if( sumAbsLevels > 15 * numLevels )

 

TSkipRiceParameter = 4

 

else if( sumAbsLevels > 5 * numLevels )

 

TSkipRiceParameter = 3

 

else if( sumAbsLevels > 2 * numLevels )

 

TSkipRiceParameter = 2

 

else

 

TSkipRiceParameter = 1

 

}

 

} else {

 

mean_value_trafo_block( ch )

 

last_pos_index_gt0_flag

ae(ch)

if( last_pos_index_gt0_flag ) {

 

last_pos_index_rem

ae(ch)

if( Log2BlockSize > 8  &&   Log2BlockSize  = =  Log2BlockSizeLast ) {

 

last_pos_index_sign

aep()

}

 

last_scan_pos = 1 + last_pos_index_rem

 

if( last_pos_index_sign ) {

 

last_scan_pos = −last_scan_pos

 

}

 

last_scan_pos = last_scan_pos + LastScanPosPrev

 

} else

 

last_scan_pos = 0

 

if( Log2BlockSize > 8 ) {

 

LastScanPosPrev = last_scan_pos

 

Log2BlockSizeLast = Log2BlockSize

 

}

 

if ( cgps_allow_lms_flag )

 

lms_data ( ch )

 

for( k = 0; k < NumQuantIndices; k = k + 1 )

 

QuantIndices[ k ] = 0

 

QState = 0

 

numCoeffsTemplateSum = 0

 

for( k = last_scan_pos; k >= 0; k = k − 1 ) {

 

TemplateSum = 0

 

for( n = k + 1; n <= k+numCoeffsTemplateSum; n = n + 1 )

 

TemplateSum += Abs( QuantIndices[ n ] )

 

if( numCoeffsTemplateSum < 4 )

 

numCoeffsTemplateSum += 1

 

pShift = ( TemplateSum > 3 ) ? 1 : 0

 

if( k  = =  last_scan_pos  &&  k > 0 )

 

QuantIndices[ k ] = 1

 

else {

 

abs_trafo_coeff_gt0_flag[ k ]

ae(ch)

QuantIndices[ k ] = abs_trafo_coeff_gt0_flag[ k ]

 

}

 

if( pShift > 0 ) {

 

abs_trafo_parity_flag[ k ]

ae(ch)

QuantIndices[ k ] += 1  −  abs_trafo_parity_flag[ k ]

 

if( abs_trafo_parity_flag[ k ] )

 

NumTCoeffGtxFlags = NumTCoeffGtxFlags  <<  1

 

}

 

if( QuantIndices[ k ] > 0 ) {

 

abs_trafo_coeff_offset[ k ]

ae(ch)

QuantIndices[ k ] += abs_trafo_coeff_offset[ k ]   <<  pShift

 

}

 

if( QuantIndices[ k ] = = NumTCoeffGtxFlags + 1 ) {

 

abs_trafo_coeff_remainder[ k ]

ae(ch)

QuantIndices[ k ] += abs_trafo_coeff_remainder[ k ]   <<  pShift

 

}

 

if( QuantIndices[ k ] > 0 ) {

 

trafo_coeff_sign_flag[ k ]

aep()

if( trafo_coeff_sign_flag[ k ] > 0 )

 

QuantIndices[ k ] = −QuantIndices[ k ]

 

}

 

QState = QStateTransTab[ QState ][ QuantIndices[ k ] & 1 ]

 

}

 

}

 

}

 

LMS data syntax

lms_data ( ch ) {

Descriptor

lms_flag

ae(ch)

if ( lms_flag ) {

 

if( cgps_allow_lms_split_flag )

 

lms_split_flag

ae(ch)

if( cgps_lms_ar_order_over_four > 0 ) {

 

enable_ar_lms[ 0 ]

ae(ch)

if ( lms_split_flag )

 

enable_ar_lms[ 1 ]

ae(ch)

}

 

if( cgps_allow_cc_lms_flag &&  ch > 0 ) {

 

enable_cc_lms[ 0 ]

ae(ch)

if ( lms_split_flag )

 

enable_cc_lms[ 1 ]

ae(ch)

}

 

}

 

}

 

Mean value trafo block syntax

mean_value_trafo_block ( ch ) {

Descriptor

MeanValueTrafoBlock = 0

 

mean_value_sig_flag

ae(ch)

if( mean_value_sig_flag = = 1 ) {

 

mean_value_abs_rem

aep()

mean_value_sign_flag

aep()

MeanValueTrafoBlock = (mean_value_sign_flag = =0 ) ? mean_value_abs_rem + 1 :

− ( mean_value_abs_rem + 1 )

 

}

 

}

 

7.1.6 Annotation channel data syntax

annotation_channel_data( ) {

Descriptor

offset = AnnotationChannelNumSamples[ ac_annotation_channel_id ]

 

for( i = 0; i < 2 * ( ac_num_annotation_bytes_div2_minus1 + 1 ); i++ ) {

 

am_annotation_byte

u(8)

AnnotationChannelBytes[ ac_annotation_channel_id ][ offset + i ] = am_annotation_byte

 

AnnotationChannelNumSamples[ ac_annotation_channel_id ]++

 

}

 

}

 

7.2 Semantics

7.2.1 Stream packet semantics

General stream packet semantics

syntax_structure_byte[ i ] is the i-th byte of the syntax structure contained in the stream packet.

Stream packet header semantics

stream_packet_type specifies the stream packet type, i.e., the type of syntax structure contained in the stream packet as specified in Table 7‑1.

Stream packets that have stream_packet_type in the range of UNSPEC_20 to UNSPEC_517, inclusive, for which semantics are not specified, shall not affect the decoding process specified in this Specification.

Table 7‑1 — Stream packet types

stream_packet_type

Name of stream_packet_type

Content of stream packet and associated syntax structure

0

FORBIDDEN_SPT

Reserved

1

WPS_SPT

Waveform parameter set

waveform_parameter_set( )

2

CGPS_SPT

Channel group parameter set

channel_group_parameter_set( )

3

TIMESTAMP_SPT

Timestamp

timestamp_struct( )

4

IF_SPT

Independent frame

independent_frame( )

5

DF_SPT

Dependent frame

dependent_frame( )

6

SEGMENT_SPT

Segment payload

segment_payload( )

7

AC_SPT

Annotation channel

annotation_channel( )

8

FEATURE_SPT

Feature Set

feature_set( )

9

SYNC_SPT

Synchronization structure

synchronization_struct()

10

CRC16_SPT

CRC 16

crc16_struct( )

11

CRC32_SPT

CRC 32

crc32_struct( )

12

UUID_U_SPT

User identifier

user_identifier( )

13

UUID_S_SPT

Stream identifier

stream_identifier( )

14

GLOBAL_CRC16_SPT

Global CRC 16

global_crc16_struct( )

15

GLOBAL_CRC32_SPT

Global CRC 32

global_crc32_struct( )

16

AUTH_START_SPT

Authentication start

authentication_start( )

17

AUTH_SIG_SPT

Authentication signature

authentication_signature( )

18

AM_SPT

Auxiliary metadata

auxiliary_metadata( )

19

CONFIG_SET_SPT

Configuration set metadata

config_set( )

20..517

UNSPEC_20..

UNSPEC_517

Reserved

stream_packet_label specifies a sub-stream indication. For values of 1 and higher, this element provides an indication of which packets in a stream belong together (so called sub-streams). In addition, packets with stream_packet_label set to a value of 0 apply to all sub-streams. A sub-stream is referring to a single CWS consisting of stream packets referencing to a particular wps_waveform_parameter_set_id of a WPS packet. Stream packets in a CWS shall have the same non-zero stream_packet_label as the one specified by the WPS packet or zero (apply to all sub-streams). In a multiplexed bitstream, stream_packet_label is used to facilitate sub-stream identification.

stream_packet_length indicates the length of the stream_packet_payload in bytes. It specifies the number of syntax structure bytes in the stream packet.

7.2.2 Raw byte sequence payloads, trailing bits and byte alignment semantics

Waveform parameter set semantics

A WPS shall be available to the decoding process prior to it being referenced by either of the following:

— a channel group parameter set with cgps_waveform_parameter_set_id equal to the value of wps_waveform_parameter_set_id in the WPS,

— a timestamp structure with ts_waveform_parameter_set_id equal to the value of wps_waveform_parameter_set_id in the WPS,

— a feature set with ft_waveform_parameter_set_id equal to the value of wps_waveform_parameter_set_id in the WPS,

— an annotation channel with ac_waveform_parameter_set_id equal to the value of wps_waveform_parameter_set_id in the WPS.

All WPS stream packets with a particular value of wps_waveform_parameter_set_id in a CWS shall have the same content.

wps_waveform_parameter_set_id provides an identifier for the WPS for reference by other syntax elements.

wps_num_channels_in_next_group_minus1 plus 1 specifies the number of channels in the next channel group in the sequence of channel groups.

wps_num_channel_group_repetitions specifies the number of channel groups that follow the previous channel group. Each of these channel groups has the same number of channels as the previous channel group.

wps_more_channel_groups_present_flag equal to 1 specifies that more channel groups are specified on the WPS.

wps_channel_reordering_flag equal to 1 specifies that syntax elements for reordering the channels in the decoded waveform sequence is present.

wps_num_channel_swaps_minus1 plus 1 specifies the number of channel swaps to be carried out in order to perform channel reordering on the decoded waveform sequence.

wps_swap_frst_idx[ i ] specifies the first channel of channel pair i to be swpped.

wps_swap_scnd_idx_min_frst_idx_min1[ i ] plus 1 plus wps_swap_frst_idx[ i ] specifies the second channel of channel pair i to be swapped.

wps_num_annotation_channels specifies the number of annotation channels present in the bitstream.

Channel group parameter set semantics

A CGPS shall be available to the decoding process prior to it being referenced by either of the following:

— an independent frame with if_channel_group_parameter_set_id equal to the value of cgps_channel_group_parameter_set_id in the CGPS,

— a dependent frame with df_channel_group_parameter_set_id equal to the value of cgps_channel_group_parameter_set_id in the CGPS,

— a segment metadata with sm_channel_group_parameter_set_id equal to the value of cgps_channel_group_parameter_set_id in the CGPS,

All CGPS stream packets with a particular value of cgps_channel_group_parameter_set_id in a coded channel group segment shall have the same content.

cgps_channel_group_parameter_set_id provides an identifier for the CGPS for reference by other syntax elements.

cgps_waveform_parameter_set_id specifies the value of wps_waveform_parameter_set_id for the WPS in use.

cgps_length_signal_mode_flag equal to 1 specifies that a syntax element if_indep_num_samples_per_channel_minus1 is present.

cgps_frame_length_shift specifies an offset for deriving the variable Log2FrameLength as follows:

 

Log2FrameLength = Log2MaxBlockSize + cgps_frame_length_shift

(48)

cgps_max_min_block_size specifies an index for deriving variable Log2MaxBlockSize as follows:

 

Log2MaxBlockSize = LutBlockSizeMaxLog2[ cgps_max_min_block_size ]

(49)

The value of cgps_max_min_block_size shall be in the range of 0 to 62, inclusive.

The array LutBlockSizeMaxLog2[ ] is specified as follows:

 

LutBlockSizeMaxLog2[ ] =

(50)

{

4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9,

9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,

11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13,

13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14

}

 

The array LutBlockSizeMinLog2[ ] is specified as follows:

 

LutBlockSizeMinLog2[ ] =

(51)

{

4, 4, 5, 4, 5, 6, 4, 5, 6, 7, 4, 5, 6, 7, 8, 4,

5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 7,

8, 9, 10, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 5, 6, 7,

8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13, 14

}

 

The variable MaxSplitDepth is derived as follows:

 

MaxSplitDepth = Log2MaxBlockSize − LutBlockSizeMinLog2[ cgps_max_min_block_size ]

(52)

cgps_deblocking_mode equal to 0 specifies that the deblocking process is not invoked. Otherwise, it specifies the strength of the applied deblocking process.

cgps_max_bit_depth specifies an index for deriving the variable BitDepthMax as follows:

 

BitDepthMax = LutBitDepthMax[ cgps_max_bit_depth ]

(53)

The value of cgps_max_bit_depth shall be in the range of 0 to 6, inclusive.

The array LutBitDepthMax[ ] is specified as follows:

 

LutBitDepthMax[ ] =

(54)

{4, 8, 12, 16, 20, 24, 28}

cgps_allow_cross_channel_pred_flag equal to 1 specifies that the cross-channel prediction mode is allowed.

cgps_cc_pred_filtering_mode specifies the allowed filtering options that may be applied to the cross-channel prediction signal as follows:

— If cgps_cc_pred_filtering_mode is equal to 0, no filtering may be applied to the cross-channel prediction signal.

— Otherwise, if cgps_cc_pred_filtering_mode is equal to 1, a half-sample position filtering of the cross-channel prediction signal is allowed.

— Otherwise (cgps_cc_pred_filtering_mode is equal to 2), a half-sample position filtering and a full-sample position filtering of the cross-channel prediction signal are allowed.

The value of cgps_cc_pred_filtering_mode shall lie in the range from 0 to 2, inclusive.

cgps_allow_cc_pred_mult_hyp_flag equal to 1 specifies that cross-channel prediction with two input channels is allowed.

cgps_allow_block_matching_pred_flag equal to 1 specifies that the block matching prediction mode is allowed.

cgps_bm_pred_filtering_mode specifies the allowed filtering options that may be applied to the block matching prediction signal as follows:

— If cgps_bm_pred_filtering_mode is equal to 0, no filtering may be applied to the block matching prediction.

— Otherwise, if cgps_bm_pred_filtering_mode is equal to 1, a half-sample position filtering of the block matching prediction signal is allowed.

— Otherwise (cgps_bm_pred_filtering_mode is equal to 2), a half-sample position filtering and a full-sample position filtering of the block matching prediction signal are allowed.

The value of cgps_bm_pred_filtering_mode shall lie in the range from 0 to 2, inclusive.

cgps_allow_bm_pred_mult_hyp_flag equal to 1 specifies that block matching prediction with two hypothesis is allowed.

cgps_allow_bm_offset_pred_prev_ch_flag equal to 1 specifies that offsets for the block matching prediction can be predicted from offsets for the block matching prediction of the previous channel.

cgps_allow_lpf_flag equal to 1 specifies that linear predictive filtering is allowed.

cgps_allow_sample_pred_fixed_weights_flag equal to 1 specifies that sample wise prediction with fixed weights is allowed.

cgps_lpf_allow_prev_ch_flag equal to 1 specifies that linear predictive filtering using input samples from a given number of previous channels is allowed.

cgps_allow_transform_skip equal to 1 specifies that a sample wise prediction is allowed

cgps_residual_quant_mode specifies the quantization mode.

cgps_ch_indep_interval_idx specifies the variable DepChMask = ( 2 << cps_ch_indep_interval_idx ) − 1. For the decoding process of clause 8, the channels can be grouped into consecutive groups of channels, each consisting of at most DepChMask +1 many channels, such that each group of channels can be processed independently from each other group of channels.

cgps_max_abs_delta_qp_idx determines the value of the variable MaxAbsDeltaQP = ( 1  <<  cgps_max_abs_delta_qp_idx ) − 1.

cgps_qp specifies the initial quantization parameter.

cgps_allow_verbatim_coding_flag equal to 1 specifies that fixed length binarization and fixed length coding is applied to the sample values if no prediction and no DCT are used on a given block. When cgps_allow_verbatim_coding_flag is not present, it is inferred to be zero.

cgps_allow_zero_lsb_flag equal to 1 specifies that a coding mode that transmis the number of zero least-significant bits per block is enabled.

cgps_ctx_init_flag equal to 1 indicates that if_ctx_init_mode is present.

cgps_allow_lms_flag equal to 1 specifies that LMS prediction is enabled.

cgps_lms_split_flag equal to 1 specifies that a resetting of the LMS prediction at the middle of the spectrum is enabled.

cgps_lms_ar_order_over_four specifies the LMS predictor order in the direction of the current channel, divided by four. As the LMS can operate on mulitple block lengths, the cgps_lms_order parameter is scaled relative to a block length of 2048. The variable LMSOrder is derived as follows:

 

GetLmsArOrder( cgps_lms_ar_order_over_four, log2blocksize ) {

If ( cgps_lms_ar_order_over_four > 0 ) {

lmsOrderOverFourScaled = ( (cgps_lms_ar_order_over_four << (1 + log2blocksize))) >> 11;

lmsOrderOverFourScaled = ( lmsOrderOverFourScaled + 1 ) >> 1;

lmsOrderOverFourScaled = lmsOrderOverFourScaled > 0 ? lmsOrderOverFourScaled : 1;

LMSOrder = lmsOrderOverFourScaled << 2;

}

else {

LMSOrder = 0;

}

return LMSOrder;

}cgps_allow_cc_lms_flag equal to one specifies that LMS in the direction of previously decoded channels is enabled.

cgps_max_order_cc_lms_minus_one plus 1specifies the maximal lms order in the direction of previously decoded channels.

Dependent on the maximum allowed blocksize the variable LMSMaxCCOrder is derived as follows:

 

GetMaxLmsCcOrder( cgps_max_order_cc_lms_minus_one, cgps_lms_ar_order_over_four, Log2MaxBlockSize ) {

maxLmsArOrder = GetLmsArOrder( cgps_lms_ar_order_over_four, Log2MaxBlockSize )

maxLmsCcOrder = cgps_max_order_cc_lms_minus_one + 1;

LMSMaxCCOrder = maxLmsCcOrder < 72 − maxLmsArOrder ? maxLmsCcOrder : 72 − maxLmsArOrder;

return LMSMaxCCOrder;

}

Independent frame semantics

if_channel_group_parameter_set_id specifies the value of cgps_channel_group_parameter_set_id for the CGPS in use.

if_channel_group_id identifies the channel group to which the current independent frame belongs. This channel group corresponds to the active channel group to be used when parsing syntax elements of the current independent frame. The length of this syntax element is Ceil( Log2( NumChannelGroups ) ) bits. When if_channel_group_id is not present, it is inferred to be equal to 0.

if_mean_per_channel specifies the coded data sample mean per channel.

if_indep_num_samples_per_channel_minus1 plus 1 specifies the number of samples per channel present in the current frame sequence.

if_ctx_init_mode indicates which parameters are used for context initialization.

Dependent frame semantics

It is a requirement of bitstream conformance that a DF unit only occurs in the bitstream if at least one IF occured before whose syntax element if_channel_group_parameter_set_id is equal to the value of df_channel_group_parameter_set_id of the current DF.

df_channel_group_id identifies the channel group to which the current independent frame belongs. This channel group corresponds to the active channel group to be used when parsing syntax elements of the current dependent frame. The length of this syntax element is Ceil( Log2( NumChannelGroups ) ) bits. When df_channel_group_id is not present, it is inferred to be equal to 0.

Annotation channel semantics

ac_waveform_parameter_set_id specifies the value of wps_waveform_parameter_set_id for the WPS in use.

ac_annotation_channel_id specifies the annotation channel index.

ac_num_annotation_bytes_div2_minus1 is used to determine the number of syntax elements am_annotaion_bytes present in the current AC as 2 * ( ac_num_annotation_bytes_div2_minus1 + 1).

Timestamp semantics

The timestamp shall be used for the following cases:

— Indicating the timing information related to the generation of a (first) sample of the signals (acquisition/recording time)

— Indicating the timing information related to the generation of coded data (encoding time)

— Indicating the true signal length or period triggered by an event (e.g., in the presence of discontinuity triggered by an encoder event due to sensor interruption, displacement or restart)

— Enabling signal alignment across multiple channels, sub-streams and signal types, e.g., compensating a clock drift between two input or decoded signals, each having a waveform acquisition timestamp.

Upon receiving the timing data, timestamp insertion into the bitstream can occur in both the encoder (signal input) and bitstream input sides.

ts_waveform_parameter_set_id specifies the value of wps_waveform_parameter_set_id for the WPS in use.

ts_channel_group_id identifies the channel group to which the current timestamp belongs. The length of this syntax element is Ceil( Log2( NumChannelGroups ) ) bits. When ts_channel_group_id is not present, it is inferred to be equal to 0.

ts_type indicates the timestamp use case as specified in Table 7‑2.

Table 7‑2 — Values of ts_type

ts_type

Timing use case

0

Waveform acquisition

1

Encoding start

2

Waveform acquisition and encoding start

3

Discontinuity: last useful sample

4

Discontinuity: first useful sample

5

Encoding end

6, 7

Reserved

ts_time_idx_flag equal to 1 indicates the usage of a timestamp identifier specified by ts_time_idx.

ts_time_idx indicates the unique index of the timestamp packet related to feature set.

ts_time_type indicates the time type as specified in Table 7‑3.

Table 7‑3 — Values of ts_time_type

ts_time_type

Timing scheme

0

TIME_LONG

1

TIME_SHORT

2

TIME_UXT

3

TIME_TAI

4

TIME_UTC

5..127

Reserved

ts_offset_type_flag equal to 0 specifies the unit of ts_time_offset in milliseconds. ts_offset_type_flag equal to 1 specifies the unit as the exact sample index. In this case, the resulting floating-point time resolution in seconds is calculated using the underlying signal sampling frequency, i.e., Ts = ts_time_offset ÷ SampFreq in seconds, where SampFreq denotes the sampling frequency.

ts_time_long is counted in seconds and the count starts on January 1st, 2025 at 00:00:00 UTC.

ts_time_offset specifies an offset of time, added to ts_time_long or ts_time_short or ts_time_uxt, respectively, in units signalled by ts_offset_type_flag.

ts_time_short in seconds elapsed since the last “ts_time_type  = =  TIME_LONG”-update.

ts_time_uxt specifies that time is in units of seconds or fractions thereof, such that the zero value corresponds to 00:00:00 UTC on 1 January 1970.

ts_time_tai specfies the time measurement of an International Atomic Time (TAI) clock and shall be used according to the syntax and semantics TAI_timestamp as specified in ISO/IEC 23001-17.

ts_status_bits shall be used according to the syntax and semantics synchronization_state, timestamp_generation_failure and timestamp_is_modified as specified ISO/IEC 23001-17. Each syntax element is a 1-bit element arranged sequentially from left-most bit to the right-most bit.

ts_time_utc specifies the UTC timing information as defined in ITU-R Recommendation TF.460-6 and the format shall follow ISO 8601, e.g.,. yyyy-mm-ddThh:mm:ss[.xxx]Z, e.g., 1970-01-01T00:00:00.000Z.

ts_time_world_flag equal to 1 indicates the timing information based on the dates of the Gregorian calendar and times based on a 24-hour clock; otherwise this indicates the timing information based on ts_time_long_relative and ts_time_offset_relative.

ts_time_long_relative is counted in seconds and the count starts from the very first sample of the waveform.

ts_time_offset_relative specifies an offset of time, added to ts_time_long_relative, in unit signalled by ts_offset_type_flag.

 

The time shall be set in a way that ( ts_time_long + ts_time_offset ) or ( ts_time_short + ts_time_offset ) or ( ts_time_uxt + ts_time_offset ) or ( ts_time_long_relative + ts_time_offset_relative ) indicates the time. If ts_offset_type_flag is equal to 0, the indicated timing information is, e.g., Ts = ( 1000 * ts_time_long + ts_time_offset ) in milliseconds. The uniquely associated sample index shall be obtained by ( Floor( 0.5 + Ts * SampFreq ÷ 1000 ) ), where SampFreq denotes the sampling frequency. If ts_offset_type_flag is equal to 1, the indicated timing information Ts is, e.g., ( ts_time_long + ts_time_offset ÷ SampFreq ) in seconds.

The time referring to the waveform indicates when the sample of following IF_SPT or DF_SPT with the same stream_packet_label has been recorded. The value stream_packet_label equal to to 0 indicates a timing information applied to all sub-streams.

Segment payload semantics

A segment is defined at a channel group level, refering to one of the channel groups specified by the WPS. Based on the desired configuration, a segment in a particular channel group may refer to the whole waveform, any waveform partition resulting from the whole waveform partitioning, or any arbitrary waveform excerpt. The definition also applies to the corresponding coded bitstream. Such a representation is mainly intended to facilitate random access interval and for archiving use case.

The following configuration applies:

— A single whole segment of a waveform or bitstream refers to a segment covering the whole waveform or the corresponding coded bitstream.

— A segment is also defined as a single or multiple of random access intervals. A random access interval consists of a single or multiple of frame sequences. A frame sequence is a sequence of one IF_SPT followed by zero or more DF_SPT frames. A bitstream may contain only IF_SPT frames or may also contain DF_SPT frames.

A segment payload contains syntax elements mainly consisting of, by default, concatenated headerless frame sequences within a segment (segment payload frames) and/or the segment payload metadata. Forming a segment payload packet from an existing sequence of payload packets in a segment requires the extraction of payload frame sizes from the payload packet headers to obtain the segment_payload_metadata_coded_sizes( ) data, followed by the concatenation of segment payload frames. Generating a segment payload from an input signal also follows the same procedure with the exception that the payload frame sizes are directly obtained from the framewise encoding process. Obtaining the sequence of individual payload packets from the segment payload packets is done by a reverse process of decoding the payload frame sizes to identify individual payload frames, assigning the correct payload packet type (IF_SPT or DF_SPT) to each segment payload frame, followed by generating the corresponding payload packet header. Alternatively, the last step can be substituted by generating the decoded signal.

sp_channel_group_parameter_set_id specifies the value of cgps_channel_group_parameter_set_id for the CGPS in use.

sp_channel_group_id identifies the channel group to which the current segment payload belongs. The length of this syntax element is Ceil( Log2( NumChannelGroups ) ) bits. When sp_channel_group_id is not present, it is inferred to be equal to 0.

sp_num_frames_per_segment_minus_one plus 1, indicates the number of payload frames carried in a segment.

sp_segment_payload_metadata_flag indicates whether segment payload metadata information is present or not.

sp_segment_payload_frames_flag indicates whether segment payload frames information is present or not.

sp_num_sequences_minus_one plus 1, specifies the number frame sequences within a segment.

sp_varying_num_frames_per_sequence_flag indicates whether there is a varying number of frames in each frame sequence in the segment.

sp_num_frames_per_sequence_minus_one plus 1, specifies the number of frames in a frame sequence.

Prior to extraction, a segment of interest is identified by a sub-stream identifier (see stream_packet_label), a channel group identifier and segment portion boundaries or markers (e.g., provided by a user or machine upon inspecting the signal).

Extracting a segment payload shall include the corresponding HLS packets (e.g., WPS, multiple CGPS packets) to ensure that the indicated payload packets are decodable. The payload packets of a segment consist of one or more frame sequences, with the possbility to drop trailing DF_SPT packets. The accompanying HLS packets are of types WPS_SPT, CGPS_SPT, TIMESTAMP_SPT and SEGMENT_SPT. An additional TIMESTAMP packet can be inserted to provide information on the location of an extracted segment within the source bitstream or signal. A segment payload or an extracted segment payload shall be decodable.

Obtaining the exact (input or decoded) signal portion as indicated by a segment shall utilize the segment’s boundary information (i.e., start and length as previously provided by a user or machine).

Segment payload metadata semantics

Segment payload metadata can provide information on the following:

— The presence of features within a segment with the possibility to specify feature markers and annotations

— Distortion measures.

The segment payload metadata packet, when sp_segment_payload_frames_flag = 0, is inserted at the end of each segment.

The distortion measure information can be used, for example, for the following purposes:

— Indicating or classifying the segment’s coding behaviour, i.e., lossless, near lossless (small distortion) or lossy.

— Deriving other distortion measure metrics.

— Enabling assessment of distortion at the decoder side without having access to the original signals. This use case is related to retrieval of lossy coded segments from a dataset by classifying and filtering of the segments in the context of further post-processing such as artificial intelligence-based training.

— Transcoding (encoding of a decoded bitstream) from lossless to lossy or tandem coding (lossy to lossy). According to the first use case of lossless to lossy, the first encoding stage is lossless, therefore during the second stage encoding, the signal from the first stage encoding can be used a a reference, thus enabling computation of the distortion measures. According to the second use case of tandem coding, the first encoding stage is lossy, therefore there is no direct access to the reference signal during the second encoding stage. In this case, estimating the distortion at the second stage involves estimating the distortion measures based on an approximation derived from the distortion measures or quantization parameters from the first encoding stage.

sp_num_features specifies the number of features within a segment.

sp_feature_type specifies the FeatureType, as defined in feat_extract( ) in clause 7.4.2.10, stored in string type value.

sp_feature_segment_marking_flag indicates the presence of feature marking.

sp_feature_segment_start indicates the offset start of a feature marking in units of samples.

sp_feature_segment_length indicates the length of a feature marking in units of samples.

sp_segment_distortion_measures_flag equal to 1 indicates the presence of distortion measures metadata in the segment. This is also indicating the coded data coding mode, a lossless codec shall set this to 0.

sp_distortion_measures_per_channel_flag indicates whether the per-channel distortion measure metadata is present.

sp_num_distortion_measures_per_channel indicates the number of other per-channel distortion measures calculated for the segment.

sp_variance indicates the estimated signal variance measured per channel in decibel units, as specified by the expression Round( 10 * Log10( x ) ), where x denotes the statistical variance of the signal of interest.

sp_squared_error indicates the estimated average signal squared error measured per channel in decibel units, as specified by the expression Round( 10 * Log10( ), where ei denotes the signal error introduced by the encoding of the i-th sample in a sequence of n samples.

sp_distortion_measure_type indicates other types of per-channel distortion measure calculated in a segment, e.g., maximum absolute error or maximum amplitude error, including its unit. Some distortion measures can also be derived from sp_variance or sq_squared_error such as the percentage root mean square distortion (PRD), channel-normalized percentage root mean square distortion (CPRD), as defined below.

 

where denotes the signal error introduced by the encoding of the i-th sample in a sequence of n sample, for the j-th channel out of M channels. denotes the encoding (original) input signal i-th sample of the j-th channel and denotes the mean of the encoding input for the j-th channel defined as

NOTE – The definition of the PRD includes a mean-removal in order to be invariant towards constant signal-shifts.

sp_distortion_measure indicates the per-channel distortion measure value.

sp_distortion_measures_in_cg_flag indicates the measure of distortion per-channel group.

sp_num_distortion_measures_in_cg indicates the number of other per-channel group distortion measures calculated for the segment.

sp_variance_cg indicates the estimated signal variance per-channel group in decibel units, as specified by the expression Round( 10 * Log10( x ) ), where x denotes the statistical variance of the signal of interest in the channel group.

sp_squared_error_cg indicates the estimated signal squared error per-channel group in decibel units.

sp_distortion_measure_type_cg indicates other types of per-channel group distortion measure calculated in a segment, e.g., maximum absolute error or maximum amplitude error, including its unit.

sp_distortion_measure_cg indicates the per-channel group distortion measure value.

Segment payload metadata coded sizes semantics

Segment payload metadata coded sizes is part of the segment payload storing the coded payload frame sizes.

sp_frame_size[ 0 ] indicates the size/length of the first (n equal to 0, IF_SPT) coded data frame in the segment. Subsequent frame sizes (for n greater than 0) are encoded using the un-truncated Rice or Golomb-Rice delta encoding method.

sp_delta_utr_param specifies the parameter that controls the un-truncated Rice or Golomb-Rice delta encoding of subsequent sp_frame_size[ n ]. It uses the fixed-length (FL) binarization process having cMax equal to 15, see clause 9.5.3.7.

sp_abs_delta for a given iteration n, specifies the encoded absolute value of the difference between the n-th and ( n – 1 )-th sp_frame_size values (encoded absolute delta value).

sp_sign_delta specifies the sign of abs_delta. It uses the fixed-length (FL) binarization process having cMax = 1, see clause 9.5.3.7.

Feature set semantics

The feature set syntax structure is used to indicate a portion of the signal that has particular characteristics or is of particular interest, such as for the following purposes:

— Defining, marking, annotating and maintaining a list of feature segments. Any arbitrary waveform excerpt can constitute a feature segment. Feature segments may be disjoint, overlapping or may have a superset/subset relationship.

— Indicating sparsely and ultra-low sampled measurements or metadata. The timestamp of instantaneous measurements or metadata is specified by setting ft_feature_length value to the same value as ft_feature_start, ensuring a single timestamp per measurement. The measurement value is stored in ft_annotation_str, ft_annotation_uri, or ft_annotation_channel_id.

ft_waveform_parameter_set_id specifies the value of wps_waveform_parameter_set_id for the WPS in use.

ft_channel_group_id identifies the channel group to which the current feature set belongs. The length of this syntax element is Ceil( Log2( NumChannelGroups ) ) bits. When ft_channel_group_id is not present, it is inferred to be equal to 0.

ft_num_features the number of features available in the bitstream.

ft_feature_annotation_type specifies the desired feature annotation type as indicated in Table 7‑4.

Table 7‑4 — Values of ft_feature_annotation_type

ft_feature_annotation_type

Annotation type

0

Embedded annotation

1

Out-of-band annotation

2

Annotation channel

3

Pre-defined annotation

ft_annotation_str specifies an arbitrary feature type annotation string.

ft_annotation_uri specifies the feature type annotation string as a URI which shall be as specified in IETF Internet Standard 66.

ft_annotation_channel_id indicates the annotation channel index of the specified annotation_channel ID (ac_annotation_channel_id). Together with ft_annotation_channel_wps_id, they shall point to the annotation stored in the annotation_channel_data of the specified annotation_channel.

ft_feature_type_enum indicates a certain type of features of the signal as indicated in the following tables (Table 7‑5, Table 7‑6, or Table 7‑7) for different signal types.

Table 7‑5 — Values of ft_feature_type_enum (for cs_signal_type ST_ECG or ST_PPG)

ft_feature_type_enum

Feature type

0

General

1

Abnormal rhythm

2

Abnormal rate

3..99

Reserved

All other values

May be used as determined by the application

Table 7‑6 — Values of ft_feature_type_enum (for cs_signal_type ST_EEG)

ft_feature_type_enum

Feature type

0

General

1

Triphasic waves

2

Interictal epileptiform discharges (IED)

3

Slowing/diffuse slowing/focal slowing

4

Electrocerebral inactivity

5

Burst suppression pattern

6

Breach rhythm

7..99

Reserved

All other values

May be used as determined by the application

Table 7‑7 — Values of ft_feature_type_enum (for cs_signal_type ST_EMG)

ft_feature_type_enum

Feature type

0

General

1..99

Reserved

All other values

May be used as determined by the application

feat_extract( ) function processes the input syntax elements ft_annotation_str or ft_annotation_uri or ft_annotation_channel_id or ft_feature_type_enum, and returns the FeatureType value. In case ft_feature_type_enum, feat_extract( ) returns FeatureType value as indicated by Feature type values in Table 7‑5, Table 7‑6 and Table 7‑7, depending on cs_signal_type. FeatureType provides a description or annotation to the portion of the signal that has particular characteristics or is of particular interest (feature segment).

ft_feature_marking_present_flag equal to 1 indicates the presence of markers defining feature segment boundaries in the bitstream. The markers, ft_feature_start and feature_length, define a feature segment associated with FeatureType. In the absence of such markers (ft_feature_marking_present_flat equal to 0), the feature segment is refering to the whole signal or bitstream.

ft_feature_start indicates the timestamp index ts_time_idx of the start of a feature marking. Utilizing ts_time_idx requires setting ts_time_idx_flag to 1.

ft_feature_length indicates the timestamp index ts_time_idx denoting the end of a feature marking defining the feature segment length. The segment length indicates the signal portion that has the corresponding portion of payload packets. Utilizing ts_time_idx requires setting ts_time_idx_flag to 1.

ft_num_qualities the number of quality level periods available in the bitstream.

ft_quality_start indicates the timestamp index ts_time_idx of the start of a quality level marking.

ft_quality_length indicates the timestamp index ts_time_idx denoting the end of a quality level marking defining the quality level length.

ft_quality_value indicates the value of the marked quality, as contained in the cs_quality_lut.

Prior to extraction, a feature segment of interest is identified by a sub-stream identifier (see stream_packet_label), a channel group identifier and segment portion boundaries or markers (either from the stored markers in FEATURE set packet in the bitstream or provided by a user or machine upon inspecting the signal).

Extracting a feature segment shall include the corresponding HLS packets (e.g., WPS, multiple CGPS packets) to ensure that the indicated payload packets of the segment are decodable. The payload packets of a segment consist of one or more frame sequences, with the possbility to drop trailing DF_SPT packets. The accompanying HLS packets of an extracted feature segment are of types WPS_SPT, CGPS_SPT, TIMESTAMP_SPT and FEATURE_SPT. An additional TIMESTAMP packet can be inserted to provide information on the location of an extracted segment within the source bitstream or signal. The extracted segment’s HLS packets shall be adjusted such that the number of features, ft_num_features, in FEATURE set packet and the TIMESTAMP packets indicated by ft_feature_start and ft_feature_length, correspond to the feature(s) contained in the extracted segment. A feature segment or an extracted feature segment shall be decodable.

Obtaining the exact (input or decoded) signal portion as indicated by a feature segment shall utilize the feature segment’s boundary information (i.e., start and length derived from FEATURE_SPT).

Config set semantics

The default syntax elements constitute the minimum configuration information. This can be extended by specifying config_extension_data( ).

cs_num_wps_ids specifies the number of WPS packets in the bitstream.

cs_wps_id specifies the value of wps_waveform_parameter_set_id for a particular WPS.

cs_wps_id_label specifies the stream_packet_label value of the WPS indicated by cs_wps_id.

cs_wps_id_label_zero specifies a non-zero value denoting the mapping of stream_packet_label 0 belonging to a subset of wps packets in the bitstream.

cs_num_channel_groups_in_wps indicates the number of channel groups in the indicated WPS.

cs_num_sampling_freqs_in_wps indicates the number of sampling frequencies in the indicated WPS.

cs_sampling_freq specifies the sampling frequency value.

cs_sampling_freq_idx specifies the corresponding index indicating the sampling frequency value. The number of bits required is calculated as Ceil( Log2( cs_num_sampling_freqs_in_wps ) ).

cs_num_signal_types_in_wps indicates the number of signal types in the indicated WPS.

cs_signal_type specifies the signal type value.

cs_signal_num_annotation_channels specifies the number of annotation channels associated with the signal type.

cs_signal_annotation_channel_id specifies the ac_annotation_channel_id in use.

cs_signal_type_idx specifies the corresponding index indicating the signal type value. The number of bits required is calculated as Ceil( Log2( cs_num_signal_types_in_wps ) ).

cs_signal_info_data_flag_in_wps indicates whether signal-specific metadata is included for the channel groups within the WPS

cs_has_range_info indicates whether the digital and analogue ranges are specified for the channel group.

cs_digital_min and cs_digital_max specify the minimum and maximum values that may occur for the signals within the channel group respectively.

cs_analogue_min and cs_analogue_max specify the analogue values to which cs_digital_min and cs_digital_max may be converted to respectively. Linear interpolation shall be used for the intermediate values.

cs_analogue_units specifies the analogue units for the waveforms within the channel group, e.g. ‘mV’.

cs_recording_start_time_flag indicates whether the starting time of the recording is included in a timestamp_struct( ).

cs_config_extension_flag indicates whether config_extension_data( ) is present.

Config extension data semantics

cs_features_in_wps_flag equal to 1 indicates the presence of feature segments in the indicated WPS.

cs_features_in_cg_id_flag equal to 1 indicates the presence of feature segments in a particular channel group within the indicated WPS.

cs_num_features_in_cg_id indicates the number of features present in the indicated channel group.

cs_enable_high_res_quality_metrics_flag specifies whether a feature_set( ) syntax structure may contain quality metrics for the encoding performance of the channels within the channel group.

cs_has_custom_quality_lut_flag specifies whether a custom look-up table is defined to be used with the quality metric.

cs_quality_metric specifies the metric used to asses the quality of the channel encoding, as specified in Table 7‑8. When cs_has_custom_quality_lut_flag is equal to 0, cs_quality_metric is inferred as specified by Table 7‑9.

Table 7‑8 — Values of cs_quality_metric

cs_quality_metric

Quality Metric

0

SNR

1

PSNR

2

PRD

3

MAE

4..6

Reserved

7

Defined by encoder as a string

Table 7‑9 — Default values of cs_quality_metric by cs_signal_type

cs_signal_type

cs_quality_metric to be used

ST_ECG

MAE

ST_EEG

MAE

ST_EMG

PSNR

ST_PPG

PSNR

default

SNR

cs_quality_num_bands specifies the number of bands that shall be used to construct the look up tables for the quality metric.

cs_quality_lut[ i ][ j ] specifies the lower bound for the quality specified by the jth entry into the look up table for the ith channel group. When cs_has_custom_quality_lut_flag is equal to 0, the values of cs_quality_lut[ i ] are inferred as specified by Table 7‑10 to Table 7‑13.

Table 7‑10 — Default cs_quality_lut[ i ][ j ] for cs_quality_metric = = SNR

cs_quality_lut[ i ][ j ]

Lower Bound

0

67

1

64

2

61

3

58

4

55

5

52

6

49

7

46

8

43

9

40

10

0

Table 7‑11 — Default cs_quality_lut[ i ][ j ] for cs_quality_metric = = PSNR

cs_quality_lut[ i ][ j ]

Lower Bound

0

100

1

95

2

90

3

85

4

80

5

75

6

70

7

65

8

60

9

55

10

0

Table 7‑12 — Default cs_quality_LUT[ i ][ j ] for cs_quality_metric = = PRD

cs_quality_LUT[ i ][ j ]

Upper Bound

0

1.5

1

2

2

2.5

3

3

4

4

5

6

6

8

7

10

8

13

9

16

10

20

11

100

Table 7‑13 — Default cs_quality_lut[ i ][ j ] for cs_quality_metric = = MAE

cs_quality_lut[ i ][ j ]

Upper Bound

0

2

1

4

2

8

3

16

4

32

5

64

6

128

7

256

8

inf

cs_uses_quality_threshold_flag specifies whether a minimum quality threshold is used. If true, all time periods are assumed to have a quality level at or above that given by cs_quality_threshold.

cs_has_custom_quality_threshold_flag specifies whether a minmum quality threshold value is provided in the bitstream.

cs_quality_threshold[ i ][ cg ] specifies the default quality value used for all time periods not indicated by a feature_set( ) quality period. When cs_has_custom_quality_threshold_flag is equal to 0, the values of [ i ][ cg ] are inferred as specified by Table 7‑14.

Table 7‑14 — Default values of cs_quality_threshold[ i ][ cg ]

cs_quality_metric

cs_quality_threshold[ i ][ cg ]

SNR

70

PSNR

100

PRD

1

MAE

2

cs_segment_payload_frames_in_wps equal to 0 indicates the absence of segment payload frames in the bitstream. Equal to 1 indicates that all channel groups have the segment payload frames. Setting it to values greather than 1 indicate the partial presence of segment payload frames. The partial presence in each channel group is indicated by cs_segment_payload_frames_in_cg_id_flag, where equal to 1 indicates the presence and 0 the absence in a channel group.

cs_segment_payload_frames_in_cg_id_flag equal to 1 indicates the presence of a segment payload frames in a channel group.

Synchronization structure semantics

syncword_8bits shall be equal to 0xDD.

User identifier semantics

The UUID specified in the user identifier data, indicates a user identifier and shall have a value specified as a UUID according to the procedures of ISO/IEC 11578, Annex A.

Stream identifier semantics

The UUID specified in the stream identifier data, indicates a stream identifier and shall have a value specified as a UUID according to the procedures of ISO/IEC 11578, Annex A.

Universally unique identifier semantics

uuid_segment_start_flag equal to 1 indicates the start of a UUID segment.

uuid_segment_stop_flag equal to 1 identifies the end of a uuid_segment. If both uuid_segment_start_flag and uuid_segment_stop_flag are equal to 1, the uuid_data-field contains the full UUID.

uuid_reserved_2bits shall be equal to 0 in bitstreams that conform to this version of this Specification. However, decoders that conform to this version of this Specification shall allow other values to be present and shall ignore the value. It is possible that a future version of this Specification will allow other values and specify their meaning.

uuid_segment_length_minus1 plus 1 specifies the length of the partial UUID in bytes.

uuid_data specifies a segment of a UUID or the full UUID.

Authentication start semantics

aust_id contains an identifying number of a verification system that may be applied for verifying that the coded packets represented by the current verification period have been produced by the content provider identified by this packet. It indicates the combination of aust_hash_type, aust_prov_id and aust_key_id to which the related authentication information belongs to. This can be used to enable authentication of one authentication sequence with different authentication configurations.

aust_sequence_id indicates the authentication sequence the related authentication information belongs to.

aust_hash_type indicates the hashing algorithm as specified in Table 7‑15.

Table 7‑15 — Values of aust_hash_type

aust_hash_type

Hashing algorithm

0

SHA-1 (see NIST FIPS PUB 180-4)

1

SHA-224 (see NIST FIPS PUB 180-4)

2

SHA-256 (see NIST FIPS PUB 180-4)

3

SHA-384 (see NIST FIPS PUB 180-4)

4

SHA-512 (see NIST FIPS PUB 180-4)

All other values

Reserved

aust_key_id identifies the authentication key used to calculate the value of the signature (ausig_sig_partial, ausig_sig_complete) as specified in Table 7‑16. The values of this field are implementation dependent and are not defined in the present document. This value shall be set to 0 in case there is no key needed of the underlying hash-function.

Table 7‑16 — Values of aust_key_id

aust_key_id

Hashing algorithm

0

No key.

1..2048

Reserved

All other values

May be used as determined by the application

aust_prov_id identifies the provider of the authentication system, as specified in Table 7‑17. In case aust_prov_id equals to 1, there is no provider. This mode can be used to create the message digest only by using the method identified by aust_hash_type.

Table 7‑17 — Values of aust_prov_id

aust_prov_id

Hashing algorithm

0

See authSourceURI.

1

Message Digest only

2..2048

Reserved

All other values

May be used as determined by the application

aust_key_source_uri contains a URI with syntax and semantics as specified in IETF Internet Standard 66.

aust_frame_types_present_flag indicates if authentication information for additional packet types is signalled.

aust_inclusion_types_flag indicates the following. If set to 1, all packet types signalled in aust_packet_type[ ] syntax elements shall be included into the calculation of the authentication information. If set to 0, all packet types signalled in aust_packet_type[ ] syntax elements shall be excluded from the calculation of the authentication information.

aust_reserved_7bits shall be equal to 0 in bitstreams that conform to this version of this Specification. However, decoders that conform to this version of this Specification shall allow other values to be present and shall ignore the value. It is possible that a future version of this Specification will allow other values and specify their meaning.

aust_pactype_length_minus1 plus 1 indicates the number of syntax elements aust_packet_type[ ] present.

aust_packet_type[ ] indicates the following. If aust_inclusion_types_flag is equal to 1, all packet types signalled in aust_packet_type[ ] syntax elements are included into the calculation of the authentication information. If aust_inclusion_types_flag is equal to 0, all packet types signalled in aust_packet_type[ ] syntax elements are excluded from the calculation of the authentication information.

aust_multi_stream_flag indicates if authentication information for additional labels is signalled.

aust_inclusion_labels_flag indicates the following. If equal to 1, all sub-streams signalled in aust_add_packet_label[ ] syntax elements are included into the calculation of the authentication information. If equal to 0, all sub-streams signalled in aust_add_packet_label[ ] syntax elements are excluded from the calculation of the authentication information.

aust_label_list_length_minus1 indicates the number of syntax elements aust_add_packet_label[ ] present.

aust_add_packet_label[ ] indicates the following. The value of aust_add_packet_label[ ] indicates that the sub-stream with this packet label are included in (aust_inclusion_labels_flag is equal to 1) or excluded from (aust_inclusion_labels_flag is equal to 0) the calculation of the authentication information in addition to the sub-stream with the same stream_packet_label as assigned to the AUTH_START_SPT packet.

stream_packet_label equal to 0 indicates that all sub-streams are included. In this case, aust_inclusion_labels_flag should be set to 0, to signal exclusion of the labels indicated in aust_add_packet_label[ ].

Authentication signature semantics

ausig_id contains an identifying number of a verification system that may be applied for verifying that the coded packets represented by the current verification period have been produced by the content provider indicated by the associated authentication start packet.

ausig_sequence_id indicates the authentication sequence the related authentication information belongs to.

ausig_partial_sig_flag indicates whether a partial or a complete signature is present.

ausig_segment_start_flag indicates whether the first part of new signature is present in ausig_sig_partial.

ausig_segment_stop_flag indicates whether the last part of new signature is present in ausig_sig_partial. If both ausig_segment_start_flag and and ausig_segment_stop_flag are equal to 1, ausig_sig_partial contains a signature which is complete, but shorter than a full signature resulting from the related hashing algorithm. In this case, verification may happen comparing only a subset of the bits resulting from the hashing algorithm.

ausig_segment_length_minus1 indicates the number of bytes for the syntax element ausig_sig_partial.

ausig_sig_partial carries partial protection information.

ausig_length_minus1 indicates the number of bytes for the syntax element ausig_sig_complete.

ausig_sig_complete carries complete protection information.

An authentication verification of protected encoded messages in the received packets shall be conducted to ensure their authenticity.

CRC 16

Shall be used according to the syntax and semantics mhasParity16Data for MHASPacketType PACTYP_CRC16 as specified in ISO/IEC 23008-3:2022.

CRC 32

Shall be used according to the syntax and semantics mhasParity32Data for MHASPacketType PACTYP_CRC16 as specified in ISO/IEC 23008-3:2022.

Global CRC 16

Shall be used according to the syntax and semantics global_CRC_type for MHASPacketType PACTYP_GLOBAL_CRC16 as specified in ISO/IEC 23008-3:2022.

Global CRC 32

Shall be used according to the syntax and semantics global_CRC_type for MHASPacketType PACTYP_GLOBAL_CRC32 as specified in ISO/IEC 23008-3:2022.

Auxiliary metadata semantics

An AM unit shall only occur as the first stream packet in the bitstream.

am_header_crc32 is the CRC calculated over the byte sequence starting with the byte containing the am_reserved_flag until the end of auxiliary_metadata( ).

am_extension_present_flag shall be equal to 0 in bitstreams that conform to this version of this Specification. However, decoders that conform to this version of this Specification shall allow the value 1 to be present and shall ignore the value. It is possible that a future version of this Specification will allow the value 1 and specify its meaning.

am_waveform_type specifies the waveform type according to Table 7‑18.

Table 7‑18 — Name association to am_waveform_type and type description

am_waveform_type

Name of am_waveform_type

Type of waveform

0

WT_GENERIC

Waveform type not indicated.

1

WT_BS2088

BW64, ITU-R BS.2088-1 metadata (RIFF chunk data bytes starting after cbSize field) is signalled in am_metadata_payload_bytes

All other values

WT_RESERVED

Reserved

am_length_signal_mode equal to 1 indicates that syntax element am_stream_num_samples_per_ch is present in the bitstream.

am_allow_reconfig_flag

am_copyright_flag

am_original_flag

am_private_flag

am_stream_max_sampling_rate_minus1 plus 1 specifies the maximum sampling rate present in the bitstream.

am_stream_max_num_channels_minus1 plus 1 specifies the maximum number of channels in the bitstream.

am_stream_num_samples_per_ch specifies the number of samples per channel present in the bitstream.

am_metadata_reserved_flag shall be equal to 0 in bitstreams that conform to this version of this Specification. However, decoders that conform to this version of this Specification shall allow the value 1 to be present and shall ignore the value. It is possible that a future version of this Specification will allow the value 1 and specify its meaning..

am_metadata_num_bytes_minus1 plus 1 specifies the number of metadata payload bytes present in the AM.

am_metadata_payload_bytes[ i ] specifies the i-th metadata payload byte. The array am_metadata_payload_bytes is a bitstream according to ITU-R BS.2088-1 (RIFF chunk data bytes starting after cbSize field).

am_signal_type indicates the present signal type as specified in Table 7‑19

Table 7‑19 — Name association to am_signal_type and cs_signal_type type description

am_signal_type

Name of am_signal_type

Signal type

0

ST_ECG

Electrocardiography (ECG) data

1

ST_EEG

Electroencephalography (EEG) data

2

ST_EMG

Electromyography (EMG) data

3

ST_PPG

Photoplethysmogram (PPG) data

All other values

ST_RESERVED

Reserved

Trailing bits semantics

stop_one_bit shall be equal to 1.

alignment_zero_bit shall be equal to 0.

Byte alignment semantics

byte_alignment_bit_equal_to_zero shall be equal to 0.

7.2.3 Frame data semantics

General frame data semantics

end_of_frame_sequence_flag equal to 1 indicates that that the current frame sequence is terminated. When end_of_frame_sequence_flag is not present, it is inferred to be equal to 0.

block_split_log2 specifies a parameter for calculating Log2BlockSize. When block_split_log2 is not present, it is inferred to be equal to 0.

end_of_truncated_frame_sequence_flag equal to 1 indicates that the current block is the last block of the frame sequence. When end_of_truncated_frame_sequence_flag is not present, it is inferred to be equal to 0.

num_samples_per_channel_to_discard specifies the number of samples per channel to be discarded at the end of the current block. Discarding of samples is only done if end_of_truncated_frame_sequence_flag equals 1. The length of this syntax element is Log2BlockSize bits. The value of num_samples_per_channel_to_discard shall not be equal to 0.

end_of_frame_one_bit equal to 1 indicates the end of a frame. When end_of_frame_one_bit is present, it shall be equal to 1. When end_of_frame_one_bit is not present, it is inferred to be equal to 0.

Predictive transform coding block semantics

Predictive trafo block data semantics

block_matching_or_cross_channel_pred_flag equal to 1 indicates that the predicition is generated by invoking either the block-matching or the linear model prediction mode. When block_matching_or_cross_channel_pred_flag is not present, it is inferred to be 0.

cross_channel_pred_flag equal to 1 indicates that the prediction is generated by invoking the cross-channel prediction mode.

When cross_channel_pred_flag is not present, it is inferred as follows:

— If cgps_allow_cross_channel_pred_flag is equal to 1 and block_matching_or_cross_channel_pred_flag is equal to 1, cross_channel_pred_flag is inferred to be 1.

— Otherwise (cgps_allow_cross_channel_pred_flag is equal to 0 or block_matching_or_cross_channel_pred_flag is equal to 0), the value of cross_channel_pred_flag is inferred to be 0.

block_pred_mode specifies the block prediction mode according to Table 7‑20. When block_pred_mode is not present, it is inferred to be equal to BPM_OFF.

Table 7‑20 — Name association to block_pred_mode and mode description

block_pred_mode

Name of block_pred_mode

Mode description

0

BPM_DC

Average value prediction

1

BPM_LF

Linear-function predictor

2

BPM_OFF

No block prediction

block_abs_delta_qp specifies the absolute value of the current QP-value-difference associated with the current block of the current channel. When block_abs_delta_qp is not present, it is inferred to be equal to 0.

block_delta_qp_sign_flag specifies the sign of the current QP-value-difference.

When block_delta_qp_sign_flag is not present, it is inferred to be 0.

transform_present_flag equal to 1 indicates that the identity transform is not used on the current block.

transform_dst_flag equal to 1 indicates that the discrete sine transform is used on the current block.

The syntax elements transform_present_flag and transform_dst_flag determine the block-wise transform TransformMode for the current block. The possible values of TransformMode are delineated in Table 7‑21.

Table 7‑21 — Name association to TransformMode and mode description

Name of transform_mode

Mode description

TM_OFF

Identity transform

TM_DCT

Discrete cosine transform

TM_DST

Discrete sine transform

zlsb_present_flag equal to 1 specifies that zero least significant bits are present. If zlsb_present_flag is not present, it is inferred to be equal to zero.

num_zlsb_minus1 plus 1, specifies the number of zero least significant bits.

Cross-channel prediction data semantics

cc_pred_offset_only_flag equal to 1 indicates that the cross-channel prediction mode is to be applied without a scaling factor.

cc_pred_filter_flag equal to 1 indicates that the output of the cross-channel prediction mode is to be filtered, where the set of filter coefficients is determined by the syntax element cc_pred_filter_idx. When cc_pred_filter_flag is not present, it is inferred to be 0.

cc_pred_filter_idx specifies the index filterIdx to derive the array CCFiltCoeffs as specified in Table 7‑22 for filtering the output of the cross-channel prediction.

Table 7‑22 — Name association to filterIdx

filterIdx

Filter coefficients

0

{-3, 0, 19, 32, 19, 0, -3, 0}

1

{-1, -4, 8, 29, 29, 8, -4, -1}

When cc_pred_filter_idx is not present, it is inferred to be 1:

cc_pred_mult_hyp_flag equal to 1 indicates that the cross-channel prediction mode with two hypotheses is used. When cc_pred_mult_hyp_flag is not present, it is inferred to be 0.

cc_pred_abs_chd_greater0_flag[ n ] equal to 1 indicates that the channel difference to the predicted input channel difference minus 1 for the n-th hypothesis of the cross-channel prediction is not 0.

cc_pred_abs_chd_minus1[ n ] plus 1 specifies the absolute value of the channel difference to the predicted input channel difference minus 1 for the n-th hypothesis of the cross-channel prediction.

cc_pred_chd_sign_flag[ n ] specifies the sign of the channel difference to the predicted input channel difference minus 1 for the n-th hypothesis of the cross-channel prediction.

When cc_pred_chd_sign_flag[ n ] is not present, it is inferred to be 0.

Block matching prediction data semantics

bm_pred_mult_hyp_flag equal to 1 indicates that the block matching prediction mode with two hypotheses is used. When bm_pred_mult_hyp_flag is not present, it is inferred to be 0.

bm_pred_add_offset_flag equal to 1 indicates that an offset, derived from previous reconstructed samples, is added to the block matching prediction.

bm_pred_filter_flag[ n ] equal to 1 indicates that the reference samples used for the n-th hypothesis of the block matching prediction are to be filtered, where the set of filter coefficients is determined by the syntax element bm_pred_filter_idx[ n ]. When bm_pred_filter_flag[ n ] is not present, it is inferred to be 0.

bm_pred_filter_idx[ n ] specifies the index filterIdx used to derive the array BMFiltCoeffs[ n ][ i ], with 0 <=i < 7, of filter coefficients according to Table 7‑22 for filtering the reference samples of the n-th hypothesis of the block matching prediction. When bm_pred_filter_idx[ n ] is not present, it is inferred to be 1.

bm_pred_off_pred_prev_ch_flag[ n ] equal to 1 indicates that the value of offset minus block size for the n-th block matching prediction hypothesis is predicted from the value of offset minus block size of the n-th hypothesis of the previous channel. When bm_pred_off_pred_prev_ch_flag[ n ] is not present, it is inferred to be 0.

bm_pred_abs_offd_greater0_flag[ n ] equal to 1 indicates that the offset difference to the predicted value of offset minus block size for the n-th hypothesis of the block matching prediction is not 0.

bm_pred_abs_offd_minus1[ n ] plus 1 specifies the absolute value of the offset difference to the predicted value of offset minus blocksize for the n-th hypothesis of the block matching prediction.

bm_pred_offd_sign_flag[ n ]specifies the sign of the offset difference to the predicted value of offset minus blocksize for the n-th hypothesis of the block matching prediction.

When bm_pred_offd_sign_flag[ n ] is not present, it is inferred to be 0.

Sample pred mode data semantics

The sample pred mode data syntax specifes the mode SamplePredMode for the sample wise prediction on a block. The supported options for SamplePredMode and their name and meaning are delinated in Table 7‑23.

Table 7‑23 — Name association to SamplePredMode and mode description

SamplePredMode

Name of SamplePredMode

Mode description

0

SPM_SLOPE

Full-slope delta coding

1

SPM_HALF_SLOPE

Half-slope delta coding

2

SPM_OFF

No sample prediction

3

SPM_LPF

Linear predictive filtering

4

SPM_DIFFS

Sample-wise delta coding

spred_lpf_or_diff_flag equal to 1 specifies that either linear predictive filtering or sample-wise delta coding is to be used as a sample wise prediction mode.

spred_lpf_flag equal to 1 specifies that linear predictive filtering is to be used as a sample wise prediction mode. When spred_lpf_flag is not present, it is inferred to be 0.

spred_rem_mode_idx specifies the sample wise prediction mode to be used among the first three options in Table 7‑23.

The variable SamplePredMode is derived as follows:

— When spred_lpf_or_diff_flag is equal to 1, the following applies:

— If spred_lpf_flag is equal to 0, SamplePredMode is set to 4.

— Otherwise (spred_lpf_flag is equal to 1), SamplePredMode is set to 3.

— Otherwise (spred_lpf_or_diff_flag is not equal to 0), SamplePredMode is set to spred_rem_mode_idx.

Linear predictive filtering data semantics

The array LPFWeightsCurr[  ] represents the filter coefficients used for the linear linear predictive filtering on the current block.

lpf_prev_ch_flag equal to 1 specifies that the weighted samples from a specified previous channel are added to the output of the linear predictive filtering. When lpf_prev_ch_flag is not present, it is inferred to be 0.

lpf_prev_ch_idx specifies the absolute value of the channel difference to the current channel minus 1 for the previous channel which contributes to the linear predictive filtering.

lpf_prev_ch_weight_abs specifies the absolute value of the weighting factor for the samples of a specified previous channel for the linear predictive filtering.

lpf_prev_ch_weight_sign_flag specifies the sign of the weighting factor for the samples of a specified previous channel for the linear predictive filtering.

When the lpf_prev_ch_weight_sign_flag is not present, it is inferred to be 0.

lpf_delta_coding_flag equal to 1 specifies that the current filter coefficients for the linear predictive filtering process are to be reconstructed predictively by using the filter coefficients LPFWeightsPred[  ] as a prediction input. When lpf_delta_coding_flag is not present, it is inferred to be 0.

lpf_num_weights_idx determines the number of filter coefficients for the linear predictive filtering process.

abs_lpf_weight_greater0_flag[ n ] equal to 1 specifies that the current coded filter coefficient value is not 0.

abs_lpf_weight_minus1[ n ] plus 1 specifies the absolute value of the current coded filter coefficient value.

lpf_weight_sign_flag[ n ] specifies the sign of the current coded filter coefficient value.

When lpf_weight_sign_flag[ n ] is not present, it is inferred to be 0.

Quant res sample data semantics

The array QuantIndices[ k ] represents an array of quantization indices for the current block. The array index k specifies the location of the quantization index within the current block.

The variables NumTSkipGtxFlags, MaxTSkipRemPrefix, Log2SbbSize, and NumTCoeffGtxFlags are specified as follows:

 

NumTSkipGtxFlags = 4

(55)

 

MaxTSkipRemPrefix = 32

(56)

 

Log2SbbSize = 1

(57)

 

NumTCoeffGtxFlags = 20

(58)

The array QStateTransTable is specified as follows:

— If cgps_residual_quant_mode is equal to 0, QStateTransTable is given by:

 

QStateTransTable[ ][ ] = { { 0, 0 } }

(59)

— Otherwise, if cgps_residual_quant_mode is equal to 1, QStateTransTable is given by:

 

QStateTransTable[ ][ ] = { { 0, 1 }, { 2, 3 }, { 1, 0 }, { 3, 2 } }

(60)

— Otherwise (cgps_residual_quant_mode is equal to 2), QStateTransTable is given by:

 

QStateTransTable[ ][ ] = { { 0, 2 }, { 5, 7 }, { 1, 3 }, { 6, 4 }, { 2, 0 }, { 4, 6 }, { 3, 1 }, { 7, 5 } }

(61)

coeff_bypass_value[ k ] represents, when the current block is coded in bypass mode, the quantization index at location k within the current block as an unsigned integer. The value of coeff_bypass_value[ k ] shall be in the range of 0 to ( 1 << IntBitDepth ) − 1, inclusive.

abs_tskip_coeff_gt0_flag[ k ] specifies, when the current block is coded with a sample-wise prediction mode, whether the quantization index at location k within the current block is non-zero as follows:

— If abs_tskip_coeff_gt0_flag[ k ] is equal to 0, the quantization index at location k is set equal to 0.

— Otherwise (abs_tskip_coeff_gt0_flag[ k ] is equal to 1), the quantization index at location k has non-zero value.

abs_tskip_coeff_offset[ k ] specifies, when the current block is coded with a sample-wise prediction mode, an offset, coded using truncated unary binarization, for the absolute value of the quantization index at location k. The value of abs_tskip_coeff_offset[ k ] shall be in the range of 0 to NumTSkipGtxFlags, inclusive. When abs_tskip_coeff_offset[ k ] is not present, it shall be inferred to be equal to 0.

abs_tskip_coeff_rem_prefix[ k ] specifies, when the current block is coded with a sample-wise prediction mode, a prefix for the remainder of the absolute quantization index at location k within the current block. The value of abs_tskip_coeff_rem_prefix[ k ] shall be in the range of 0 to MaxTSkipRemPrefix, inclusive. When abs_tskip_coeff_rem_prefix[ k ] is not present, it shall be inferred to be equal to 0.

abs_tskip_coeff_rem_fl_suffix[ k ] specifies, when the current block is coded with a sample-wise prediction mode, a suffix, coded using a fixed-length binarization, for the remainder of the absolute quantization index at location k within the current block. The value of abs_tskip_coeff_rem_fl_suffix[ k ] shall be in the range of 0 to ( 1 << RiceParameter ) − 1, inclusive. When abs_tskip_coeff_rem_fl_suffix[ k ] is not present, it shall be inferred to be equal to 0.

abs_tskip_coeff_rem_eg0_suffix[ k ] specifies, when the current block is coded with a sample-wise prediction mode, a suffix, coded using an exponential Goslomb code of order zero, for the remainder of the absolute quantization index at location k within the current block. When abs_tskip_coeff_rem_eg0_suffix[ k ] is not present, it shall be inferred to be equal to 0.

tskip_coeff_sign_flag[ k ] specifies, when the current block is coded with a sample-wise prediction mode, the sign of the quantization index at location k as follows:

— If tskip_coeff_sign_flag[ k ] is equal to 0, the quantization index at location k a non-negative value.

— Otherwise (tskip_coeff_sign_flag[ k ] is equal to 1), the quantization index at location k has a negative value.

When tskip_coeff_sign_flag[ k ] is not present, it shall be inferred to be equal to 0.

last_pos_index_gt0_flag specifies, when the current block is coded with a block-wise transform, whether the last non-zero quantization index within the current block is non-zero.

last_pos_index_rem specifies, when the current block is coded with a block-wise transform, the remainder of the last non-zero quantization index within the current block. The value of last_pos_index_rem shall be in the range of 0 to ( 1 << Log2BlockSize ) − 1, inclusive. When last_pos_index_rem is not present, it shall be inferred to be equal to 0.

last_pos_index_sign specifies, when the current block is coded with a block-wise transform, the sign of the coded last significant scanning position for the current block. If last_pos_index_sign is not present, it is inferred to be equal to 0.

abs_trafo_coeff_gt0_flag[ k ] specifies, when the current block is coded with a block-wise transform, whether the quantization index at location k within the current block is non-zero as follows:

— If abs_trafo_coeff_gt0_flag[ k ] is equal to 0, the quantization index at location k is set equal to 0.

— Otherwise (abs_trafo_coeff_gt0_flag[ k ] is equal to 1), the quantization index at location k has non-zero value.

When abs_trafo_coeff_gt0_flag[ k ] is not present, it is inferred as follows:

— If k is equal to last_scan_pos and k is greater than zero, the value of abs_trafo_coeff_gt0_flag[ k ] is inferred to be equal to 1.

— Otherwise (k is not equal to ( ( last_pos_index_gt0_flag + last_pos_index_rem )  <<  Log2SbbSize ) + last_index_offset or k is equal to 0), the value of abs_trafo_coeff_gt0_flag[ k ] is inferred to be equal to 0.

abs_trafo_parity_flag[ k ] specifies, when the current block is coded with a block-wise transform and the variable TemplateSum is greater than 3, the parity of the current absolute quantization index.

abs_trafo_coeff_offset[ k ] specifies, when the current block is coded with a block-wise transform, an offset, coded using truncated unary binarization, for the absolute value of the quantization index at location k. The value of abs_trafo_coeff_offset[ k ] shall be in the range of 0 to NumTCoeffGtxFlags, inclusive. When abs_trafo_coeff_offset[ k ] is not present, it shall be inferred to be equal to 0.

abs_trafo_coeff_remainder[ k ] specifies, when the current block is coded with a block-wise transform, the remainder of the absolute quantization index at location k within the current block. When abs_trafo_coeff_remainder[ k ] is not present, it shall be inferred to be equal to 0.

trafo_coeff_sign_flag[ k ] specifies, when the current block is coded with a block-wise transform, the sign of the quantization index at location k as follows:

— If trafo_coeff_sign_flag[ k ] is equal to 0, the quantization index at location k a non-negative value.

— Otherwise (trafo_coeff_sign_flag[ k ] is equal to 1), the quantization index at location k has a negative value.

When trafo_coeff_sign_flag[ k ] is not present, it shall be inferred to be equal to 0.

LMS data semantics

lms_flag equal to 1 indicates that least mean squares prediction is used for DCT coefficients.

lms_split_flag indicates that the DCT domain frequency and channel prediction is seperately controlled for the first half of the spectrum and the second half of the spectrum. When the spectrum is split (lms_split_flag equals to 1), two additional control bits are sent for each half of the spectrum. When lms_split_flag is equal to 0 then the prediction runs across the entire spectrum.

enable_ar_lms[ 0 ] and enable_ar_lms[ 1 ] (when present) enable the backward adaptive LMS predictor to run along frequency for the relevant part of the signal. If lms_split_flag is equal to 0, the value enable_ar_lms[ 0 ] applies to the entire signal; otherwise, there will be two values enable_ar_lms[ 0 ] and enable_ar_lms[ 1 ], which each apply to half of the signal.

enable_cc_lms[ 0 ] and enable_cc_lms[ 1 ] (when present) enable the backward adaptive LMS predictor to predict across channels for the relevant part of the signal. If lms_split_flag is equal to 0, the value enable_cc_lms[ 0 ] applies to the entire signal; otherwise, there will be two values enable_cc_lms[ 0 ] and enable_cc_lms[ 1 ], which each apply to half of the signal.

Mean value trafo block semantics

mean_value_sig_flag equal to one specifies that the mean value on the current block is not zero. When mean_value_sig_flag is not present, it is inferred to be zero.

mean_value_abs_rem specifies the absolute value minus one of the mean value on the current block.

mean_value_sign_flag specifies the sign of the mean value on the current block.

7.2.4 Annotation channel data semantics

am_annotation_byte specifies an annotation channel byte.

8.0 Decoding process

8.1 General decoding process

8.1.1 General

Input to this process is a bitstream BitstreamToDecode. Output of this process are a list of decoded channels, each having an associated waveform parameter set identifyer and an associated channel index.

The decoding process is specified such that all decoders that conform to the specification will produce numerically identical decoded output channels when invoking the decoding process. Any decoding process that produces identical decoded channels conforms to the decoding process requirements of this Specification.

8.1.2 Channel output index derivation process

Input of this process are:

— The syntax elements of a waveform parameter set according to clause 7.3.2.1,

— a channel group index chGrpIdx

— a channel index chIdxInChGroup in a channel group.

Output of this process is an output channel index outChIdx.

This index is derived as follows:

The variable chIdxBRd which specifies the channel index before reordering ( if applicable ) is set to ChannelGroupStartingPos[ chGrpIdx ] + chIdxInChGroup.

If wps_channel_reordering_flag is equal to zero, chIdxBdR is set equal to outChIdx.

Otherwise ( wps_channel_reordering_flag is not equal to zero ), the following process is invoked:

 

Set outChIdx = chIdxBRd.

 

Set i = 0

 

do

 

if( outChIdx = = wps_swap_frst_idx[ i ])

 

outChIdx += wps_swap_scnd_idx_min_frst_idx_min1[ i ] + 1

 

else if( outputChIx = = wps_swap_frst_idx[ i ] + wps_swap_scnd_idx_min_frst_idx_min1[ i ] + 1 )

 

outChIdx = wps_swap_frst_idx[ i ]

 

i = i + 1

 

while ( i <= wps_num_channel_swaps_minus1)

8.1.3 Decoding process for independent frames (stream packets of type IF_SPT)

The syntax elements of the last previously decoded waveform parameter set in the bitstream in decoding order that has the same waveform parameter set identifier as the current independent frame (waveform_parameter_set_id = = if_waveform_parameter_set_id) are inferred. It is a requirement of bitstream conformance that such a waveform parameter set exists. The set of syntax elements of this waveform parameter set shall be referred to as wpsCurr.

The variable wPId is set to if_waveform_parameter_set_id and the variable chGId is set to if_channel_group_id.

The frame decoding process of clause 8.2 is invoked with the variable frameStartPos set to 0 and the variable frameNumChannels set to NumChannels[ if_channel_group_id ].

The output of this process is assigned to the number of reconstructed samples numRecSmpls and the array of reconstructed sample values Rec[ wPId ][ chGId ][ c ][ i ] with 0 <= c < NumChannels[ if_channel_group_id ] and 0 <= i < numRecSmpls.

The variable NumSpls[ wPId ][ chGId ] which specifies the number of decoded samples corresponding to the current waveform parameter set id and to the current channel group id is set to numRecSmpls.

For each c with 0 <= c < NumChannels[ if_channel_group_id ], the following applies:

— The decoded output channel outCh[ c ] is specified as the channel of reconstructed sample values Rec[ wPId ][ chGId ][ c ][ i ] with 0 <= i < numRecSmpls.

— The waveform parameter set identifier associated to outCh[ c ] is set to wpId.

— The process of clause 8.1.2 is invoked with the set of waveform parameter set syntax elements set to wpsCurr, the variable chGrpIdx set to if_channel_group_id and the variable chIdxInChGroup set to c. The output of this process is assigned to the output channel index outputIdx associated to outCh[ c ].

8.1.4 Decoding process for dependent frames (stream packets of type DF_SPT)

The syntax elements of the independent frame header of the last previously decoded independent frame in the bitstream in decoding order that has the same waveform parameterset id and the same channel group id as the current dependent frame ( if_waveform_parameter_set_id = = df_waveform_parameter_set_id and if_channel_group_id = = df_channel_group_id ) are inferred. It is a requirement of bitstream conformance that such an independent frame exists. The set of syntax elements of the last previously decoded waveform parameter set that has the same waveform parameter set identifier as the current dependent frame ( waveform_parameter_set_id = = df_waveform_parameter_set_id ) shall be referred to as wpsCurr.

The variable wPId is set to df_waveform_parameter_set_id and the variable chGId is set to df_channel_group_id.

The frame decoding process of clause 8.2 is invoked with the variable frameStartPos set to NumSpls[ wPId ][ chGId ], the variable frameNumChannels set to NumChannels[ if_channel_group_id ] and the input array sample values recSamples[ c ][ i ] set to Rec[ wPId ][ chGId ][ c ][ i ] for 0 <= c < NumChannels[ df_channel_group_id ] and 0 <= i < NumSpls[ wPId ][ chGId ].

The output of this process is assigned to the number of currently reconstructed samples numRecSmpls and the reconstructed sample values rec[ c ][ i ] with 0 <= c < NumChannels[ df_channel_group_id ] and numSpls[ wPId ][ chGId ] <= i < numSpls[ wPId ][ chGId ] + numRecSmpls.

The values rec[ c ][ i ] are assigned to the variables Rec[ wPId ][ chGId ][ c ][ i ] for 0 <= c < NumChannels[ df_channel_group_id ] and numSpls[ wPId ][ chGId ] <= i < numSpls[ wPId ][ chGId ] + numRecSmpls.

The variable NumSpls[ wPId ][ chGId ] is set to NumSpls[ wPId ][ chGId ] + numRecSmpls.

For each c with 0 <= c < NumChannels[ df_channel_group_id ], the following applies:

— The decoded output channel outCh[ c ] is specified as the channel of reconstructed sample values Rec[ wPId ][ chGId ][ c ][ i ] with numSpls[ wPId ][ chGId ] <= i < numSpls[ wPId ][ chGId ] + numRecSmpls.

— The waveform parameter set identifier associated to outCh[ c ] is set to wpId.

— The process of clause 8.1.2 is invoked with the set of waveform parameter set syntax elements set to wpsCurr, the variable chGrpIdx set to df_channel_group_id and the variable chIdxInChGroup set to c to specify the output channel index outputIdx associated to outCh[ c ].

8.2 Frame data decoding process

Input to this process are:

— a starting position startPos.

— a number of channels numCh

— if starPos is not equal to zero: An array of reconstructed sample values rec[ c ][ i ] with 0 <= c < numCh and 0 <= i < startPos.

Output of this process are the number of reconstructed samples numRecSmpls and the newly reconstructed sample values rec[ c ][ i ] with 0 <= c <numCh and startPos <= i < startPos + numRecSmpls.

The ordered steps in the the decoding process of this clause follow the corresponding orderd steps in the syntax of clause 7.3.3.1, where at each step, the associated syntax elements are inferred from clause 7.3.3.

The variable currLog2TSize is set to 4 and the variable currTSize is set to ( 1 << currLog2Tsize ).

The variable maxVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1 and the variable minVal is set to −maxVal − 1.

The variable currBlockPos is initialized to 0.

For each step in the enclosing while loop of clause 7.3.3.1, the following ordered steps apply:

a) The variable blockSize is set equal to ( 1 << Log2BlockSize ).

b) For each channel with channel index currCh, 0 <= currCh < numCh, the following ordered steps apply:

1. The block-wise prediction decoding process of clause 8.3 is applied. The output of this process is assigned to the prediction sample values predCurr[ i ] with 0 <= i < blockSize and the extended left adjacent residual samples resiLeftCurr[ j ] with 0 <= j < currTSize.

2. If lms_flag is equal to 1, the Backward Adaptive (LMS prediction) process of clause 8.5 is applied.

3. The scaling and inverse block-wise transform process from clause 8.4 is applied. The output of this process is assigned to the intermediate reconstructed residual sample values resImdCurr[ i ] with 0 <= i < blockSize.

4. The sample wise prediction decoding process of clause 8.9 is applied. The output of this process is assigned to the final residual sample values resCurr[ i ] with 0 <= i < blockSize.

5. For 0 <= i < blockSize, the value Clip3( minVal, maxVal, predCurr[ i ] + resCurr[ i ] ) is assigned to the reconstructed sample values rec[ currCh ][ i ]

6. When transform_present_flag is equal to 1, currBlockPos is greater than 0 and cgps_deblocking_mode is greater than 0, the deblocking process of clause 8.10 is applied.

c) The variable currBlockPos is incremented as follows:

1) If end_of_truncated_frame_sequence_flag is equal to 1, the variable currBlockPos is set equal to currBlockPos + blockSize − num_samples_per_channel_to_discard

2) Otherwise ( end_of_truncated_frame_sequence_flag is not equal to 1 ), the variable currBlockPos is set equal to currBlockPos + blockSize.

The variable currBlockPos is set equal to numRecSmpls.

8.2.1 Block-wise prediction decoding process

Input to this process are:

— the current channel index currCh,

— the current block position currBlockPos,

— the array of reconstructed samples of previous channels rec[ c ][ i ] with
Max( currCh − ( DepChMask & currCh ), 0 ) <= c < currCh and 0 <= i < currBlockPos + ( 1  <<  Log2BlockSize ).

— the array of reconstructed samples of the current channel rec[ currCh ][ i ] with 0 < = i < currBlockPos.

— the parameter currLog2TSize which determines the size of the adjacent left residual samples to be computed and the size of the template for the parameter computation of the cross-channel and the block-matching prediction.

Output to this process are the prediction sample values pred [ i ] with 0 <= i < ( 1 << Log2BlockSize ) and the extended residual sample values resiLeft[ j ] with 0 <= j < ( 1 << currLog2TSize ). These values are derived as follows:

— If block_matching_or_cross_channel_pred_flag is equal to 1, the following applies:

— If cross_channel_pred_flag is equal to 1, the cross-channel prediction decoding process of clause 8.3.6 is invoked with chIdx set equal to currCh, blockPos set equal to currBlockPos, log2BlockSize set equal to Log2BlockSize, the reference sample values of previous channels ref[ c ][ i ] set equal to rec[ c ][ i ] for Max( currCh − ( DepChMask & currCh ), 0 ) <= c < currCh and 0 <= i < currBlockPos + ( 1 << Log2BlockSize ), the reference sample values of the current channel refCurr[ i ] set equal to rec[ currCh ][ i ] with 0 <= i < currBlockPos and log2TSize set equal to currLog2TSize.

— Otherwise ( cross_channel_pred_flag is not equal to 1 ), the block matching prediction decoding process of clause 8.3.7 is invoked with chIdx set equal to currCh, blockPos set equal to currBlockPos, log2BlockSize set equal to Log2BlockSize, the reference sample values ref[ i ] set equal to rec[ currCh ][ i ] with 0 <= i < currBlockPos and log2TSize set equal to currLog2TSize.

— Otherwise (block_matching_or_cross_channel_pred flag is not equal to 1), the following applies:

— If block_pred_mode is equal to BPM_DC, the DC prediction decoding process of clause 8.3.4 is invoked with blockPos set equal to currBlockPos, log2BlockSize set equal to Log2BlockSize, the reference sample values ref[ i ] set equal to rec[ currCh ][ i ] with 0 <= i < currBlockPos and log2TSize set equal to currLog2TSize.

— If block_pred_mode is equal to BPM_LF, the line fitting decoding process of clause 8.3.5 is invoked with blockPos set equal to currBlockPos, log2BlockSize set equal to Log2BlockSize, the reference sample values ref[ i ] set equal to rec[ currCh ][ i ] with 0 <= i < currBlockPos and log2TSize set equal to currLog2TSize.

— If block_pred_mode is equal to BPM_OFF, the zero prediction decoding process of clause 8.3.3 is invoked with log2BlockSize set equal to Log2BlockSize and log2TSize set equal to currLog2TSize.

8.2.2 Linear extrapolation process of an array to the right

Input to this process are:

— an input array size szArr >= 4,

— an input array of sample values p[ i ] with 0 <= i < szArr,

— an extrapolation size log2SzExt >= 0

Output to this process are the array values extrapolated to the right p[ szArr + j ] with 0 <= j < ( 1 << log2SzExt ) and an extrapolated mean value meanValExtr.

The variable szExt is set to 1 << log2SzExt.

The variable slope is set to 15*( p[ szArr − 1 ] − p[ szArr − 4 ] ) +5*( p[ szArr − 2 ] − p[ szArr − 3 ] ).

The variable offset is set to ( ( p[ szArr − 4 ] + p[ szArr − 3 ] + p[ szArr − 2 ] + p[ szArr − 1 ] +2 ) << 7 ).

For 0 <= j < szExt, the extrapolated array values p[ szArr + j ] are defined as follows:

— stepCurr = 25 + j * 10.

— slopeCurr = slope * ( 2 * szExt − j ).

— p[ szArr + j ] = ( ( offset << ( log2SzExt +1 ) )+ slopeCurr*stepCurr ) >> ( log2SzExt + 10 ).

Then meanValExtr is set to ( offset + 20 * slope ) >> 9.

8.2.3 Linear extrapolation process of an array to the left

Input to this process are:

— an input array starting position startPos

— an input array size szArr with szArr – startPos >= 4,

— an input array of sample values p[ i ] with startPos <= i < szArr,

— an extrapolation size szExt greater than 0

Output to this process are the array values extrapolated to the left p[ startPos − 1 − j ] with 0 <= j < szExt.

The mirrored input array sample values pMirror[ i ] with 0 <= i < szArr − startPos are defined as pMirror[ i ] = p[ szArr − 1− i ].

The extrapolation process to the right from clause 8.3.1 is invoked with the input array size szArr − startPos, the input array pMirror and the extrapolation size set to Ceil( Log2 ( szExt ) ) as input to obtain the array values pMirror[ szArr + j ] with 0 <= j < ( 1 << Ceil( Log2 ( szExt ) ) ).

For 0 <= j < szExt the value pMirror[ szArr + j ] is assigned to p[ startPos − 1 − j ].

8.2.4 Zero prediction decoding process

Input to this process are:

— a variable log2BlockSize that determines the size of the current block,

— the parameter log2TSize which determines the size of the adjacent left residual samples to be computed.

This process specifies as an output the arrays pred[ i ] = 0 with 0 <= i < ( 1 << log2BlockSize ) and the array of adjacent left residual samples resiLeft[ j ] = 0 with 0 <= j < ( 1 << log2TSize ).

8.2.5 DC prediction decoding process

Input to this process are:

— a variable blockPos specifying the position of the first sample of the current block,

— a variable log2BlockSize that determines the size of the current block,

— an array of reconstructed samples of the current channel ref[ i ] with 0 <= i < blockPos.

— a parameter log2TSize which determines the size of the adjacent left residual samples to be computed.

Output of this process are the array of DC prediction sample values pred[ i ] with 0 <= i < ( 1 << log2BlockSize ) and the array of adjacent left residual samples resiLeft[ j ] with 0 <= j < ( 1 << log2TSize ).

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to −maxPredVal − 1.

The variable blockSize is set to 1 << log2BlockSize.

The variable tSize is set to 1 << log2TSize.

— If blockPos < 4, the values pred[ i ] with 0 <= i < blockSize and the values resiLeft[ j ] with 0 <= j < tSize are set to 0.

— Otherwise ( blockPos >= 4 ), the following applies:

— The array q[ j ] with 0 <= j <4 is defined as q[ j ] = ref[ blockPos − 4 + j ].

— The linear extrapolation process to the right from clause 8.3.1 is invoked with input the input array size 4, the input array q and the extrapolation size 0 to obtain the extrapolated mean value meanValExtr.

— The variable meanClipped is set as
meanClipped = Clip3( minPredVal, maxPredVal, meanValExtr ).

— pred[ i ] is set equal to meanClipped for all i with 0 <= i < blockSize.

— If blockPos >= tSize, resiLeft[ j ] is set to ( ref[ blockPos − tSize + j ] − meanClipped ) for all j with 0 <= j < tSize.

— Otherwise ( blockPos < tSize ), resiLeft[ j ] is set to 0 for all j with 0 <= j < tSize.

8.2.6 Line fitting prediction decoding process

Input to this process are:

— a variable blockPos specifying the position of the first sample of the current block,

— a variable log2BlockSize that determines the size of the current block,

— the array of reconstructed samples of the current channel ref[ i ] with 0 <= i < blockPos.

— the parameter log2TSize which determines the size of the adjacent left residual samples to be computed.

Output of this process are the array of line fitting prediction sample values pred[ i ] with 0 <= i < (1 << log2BlockSize ) and the array of adjacent left residual samples resiLeft[ j ] with 0 <= j < ( 1 << log2TSize ).

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to − maxPredVal − 1.

The variable blockSize is set to 1 << log2BlockSize.

The variable tSize is set to 1 << log2TSize.

— If blockPos < 4, the values pred[ i ] with 0 <= i < blockSize and the values resiLeft[ j ] with 0 <= j < tSize are set to 0.

— Otherwise ( blockPos >= 4 ), the following applies:

— The array q[ j ] with 0 <= j <4 is defined as q[ j ] = ref[ blockPos − 4 + j ].

— The linear extrapolation process to the right from clause 8.3.1 is invoked with input the input array size 4, the input array q and the extrapolation size log2BlockSize to obtain the array values q[ 4 + i ] with 0 <= i < blockSize and the extrapolated mean value meanValExtr.

— pred[ i ] is set equal to Clip3( minPredVal, maxPredVal, q[ 4+i ] ) for all 0 <= i < blockSize.

— If blockPos >= tSize, resiLeft[ j ] is set to ( ref[ blockPos − tSize + j ] − meanValExtr ) for all j with 0 <= j < tSize.

— Otherwise ( blockPos < tSize ), resiLeft[ j ] is set to 0 for all j with 0 < = j < tSize.

8.2.7 Cross-channel prediction decoding process

Input to this process are:

— a variable chIdx specifying the current channel,

— a variable blockPos specifying the position of the first sample of the current block,

— a variable log2BlockSize that determinesthe size of the current block,

— the array of reference samples of previous channels ref[ c ][ i ] with
Max( chIdx − ( DepChMask & chIdx ), 0 ) <= c < chIdx and 0 <= i < blockPos + ( 1 << log2BlockSize ).

— the array of reference samples of the current channel refCurr[ i ] with 0 < = i < blockPos.

— the parameter log2TSize which determines the size of the adjacent left residual samples to be computed and which determines the size of the template used for parameter derivation.

Output of this process are the array of cross-channel prediction sample values pred[ i ] with 0 <= i < ( 1 << log2BlockSize ) and the array of adjacent left residual samples resiLeft[ j ] with 0 <= j < ( 1 << log2TSize ).

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to − maxPredVal − 1.

The variable blockSize is set to 1 << log2BlockSize.

The variable firstPrevCh which indexes the first input channel is set to

chIdx − 1 − CrossChannelPredInputChDistMinus1[ chIdx ][ 0 ].

If cc_pred_mult_hyp_flag is not equal to zero, the variable secondPrevCh, which indexes the second input channel, is set to chIdx − 1− CrossChannelPredInputChDistMinus1[ chIdx ][ 1 ].

The variable tSize is set to 1 << log2TSize.

The variable fPdL which specifies the length to the left for the prediction filters of clause 7.3.3.2.2 is set to 3.

The variable log2FPdR which which determines the length to the right for the prediction filters of clause 7.3.3.2.2 is set to 2.

The variable fPdR is set to 1 << log2FPdR.

The variable fSz which specifies the filter size for the filters of clause 7.3.3.2.2 is set to fPdL + fPdR.

— If blockPos < tSize, the following applies:

— The intermediate cross-channel prediction samples before filtering and extrapolation p[ i ] with 0 <= i < blockSize are defined as follows:

— If cc_pred_mult_hyp_flag is equal to zero, one pust p[ i ] = ref[ firstPrevCh ][ blockPos + i ].

— Otherwise ( cc_pred_mult_hyp_flag is not equal to zero ), one set
p[ i ] = ( ref[ firstPrevCh ][ blockPos + i ] + ref[ secondPrevCh ][ blockPos + i ] + 1 ) >> 1.

— If cc_pred_filter_flag is equal to zero, the final cross-channel prediction sample values pred[ i ] are set to Clip3( minPredVal, maxPredVal, p[ i ] ) for 0 <= i < blockSize.

— Otherwise ( cc_pred_filter_flag is not equal to zero ), the following applies:

— If blockPos < fPdL, the extrapolation process to the left from clause 8.3.2 is applied with the input starting position 0, the input array p, the input array size blockSize and the extension size fPdL to obtain the sample values p[ −fPdL + i ] with 0 <= i < fPdL.

— Otherwise ( blockPos >= fPdL ) the following applies:

— If cc_pred_mult_hyp_flag is equal to zero, for 0 <= i < fPdL the value ref[ firstPrevCh ][ blockPos −fPdL + i ] is assigned to p[ −fPdL + i ].

— Otherwise ( cc_pred_mult_hyp_flag is not equal to zero ) , for 0 <= i < fPdL the value ( ref[ firstPrevCh ][ blockPos −fPdL + i ] + ref[ secondPrevCh ][ blockPos −fPdL + i ]+ 1 ) >> 1 is assigned to p[ −fPdL + i ].

— The extrapolation process to the right from clause 8.3.1 is applied with the input array p, the input array size blockSize and the extension size log2FPdR. The output of this process is assigned to the sample values p[ blockSize +i  ] with 0 <= i < fPdR.

— The final cross-channel prediction sample values pred[ i ] with 0 <= i < blockSize are set to Clip3( minPredVal, maxPredVal, )

— The extended residual samples resiLeft[ i ] are set to 0 for 0 <= i < tSize.

— Otherwise ( blockPos >= tSize ), the following applies:

For 0 <= i < tSize, the previous reconstructed sample value currChTpl[ i ] in the current channel on the left template is set to refCurr[ blockPos − tSize + i ], with 0 <= i < tSize.

The array firstPrevChTpl[  ] of previous reconstructed sample values in the first input channel on the left template is defined as

firstPrevChTpl[ i ] = ref[ firstPrevCh ][ blockPos − tSize + i ], with 0 <= i < tSize.

If cc_pred_mult_hyp_flag is not equal to zero, the array secondPrevChTpl[  ] of previous reconstructed sample values in the second input channel on the left template is defined as

secondPrevChTpl[ i ] = ref[ secondPrevCh ][ blockPos − tSize + i ], with 0 <= i< tSize.

The intermediate cross-channel prediction signal samples before filtering and extrapolation to the right p[ i ] with 0 <= i < blockSize + tSize +fPdL are defined as follows:

— If cc_pred_offset_only_flag is equal to one, the following applies:

— The variable sum Diff is defined as follows:

— If cc_pred_mult_hyp_flag is equal to zero, sumDiff is set equal to

— Otherwise ( cc_pred_mult_hyp flag is not equal to zero ), sumDiff is set equal to

— The variable offset is defined as offset = (sumDiff + (1 << ( log2TSize − 1 ) ) ) >> log2TSize

— If cc_pred_mult_hyp_flag is equal to zero, the following applies:

— If tSize + fPdL <= blockPos, for 0 <= i < blockSize + tSize +fPdL, p[ i ] is set equal to ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + offset.

— Otherwise ( tSize + fPdL > blockPos ), the following applies:

— For fPdL <= i <blockSize + tSize +fPdL, p[ i ] is set equal to ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + offset.

— The extrapolation process to the left fom clause 8.3.2 is invoked with the input starting position fPdL, the input array size blockSize + tSize, the input array p and the extension size fPdL to obtain the values p[ i ] with 0 <= i < fPdL.

— Otherwise ( cc_pred_mult_hyp_flag is not equal to zero ), the following applies:

— If tSize + fPdL <= blockPos, for 0 <= i < blockSize + tSize +fPdL, p[ i ] is set equal to ( ( ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + ref[ chIdxScnd ][ blockPos − tSize − fPdL + i ] +1 ) >> 1 )+ offset.

— Otherwise ( tSize + fPdL > blockPos ), the following applies:

— For fPdL <= i <blockSize + tSize +fPdL, p[ i ] is set equal to ( ( ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + ref[ chIdxScnd ][ blockPos − tSize − fPdL + i ] +1 ) >> 1 )+ offset.

— The extrapolation process to the left fom clause 8.3.2 is invoked with the input starting position fPdL, the input array size blockSize + tSize, the input array p and the extension size fPdL to obtain the values p[ i ] with 0 <= i < fPdL.

— Otherwise ( cc_pred_offset_only flag is not equal to one ), if cc_pred_mult_hyp_flag is equal to zero, the following applies:

— The symmetric 2x2 matrix A with the following entries A[ 0 ][ 0 ], A[ 0 ][ 1 ], A[ 1 ][ 0 ], A[ 1 ][ 1 ] is defined:

— A[ 0 ][ 0 ] =

— A[ 0 ][ 1 ]

— A[ 1 ][ 1 ] = tSize

— The 2 dimensional vector b with the following entries band bs defined:

— b[ 0 ]=

— b[ 1 ]=

— The cross component precision ccShift is set to 16

— The process of clause 5.11.4.5 is invoked with matrix A, vector b and parameter ccShift as inputs and the output is assigned to the two-dimensional vector v with entries v[ 0 ] and v[ 1 ].

— The variable ccShiftOffst is set to ( (1 << ccShift ) − 1 ).

— The following is applied:

— If tSize + fPdL <= blockPos, for 0 <= i < blockSize + tSize +fPdL, p[ i ] is set equal to ( v[ 0 ]*ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + v[ 1 ] + ccShiftOffst ) ) >> ccShift.

— Otherwise ( tSize + fPdL > blockPos ), the following applies:

— For fPdL <= i <blockSize + tSize +fPdL, p[ i ] is set equal to ( v[ 0 ]*ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + v[ 1 ] + ccShiftOffst) ) >> ccShift.

— The extrapolation process to the left fom clause 8.3.2 is invoked with the input starting position fPdL, the input array size blockSize + tSize, the input array p and the extension size fPdL to obtain the values p[ i ] with 0 <= i < fPdL.

— Otherwise ( cc_pred_offset_only flag is not equal to one and cgps_cc_pred_mult_hyp_flag is equal to one ), the following applies:

— The symmetric 3x3 matric A with the entries A[ k ][ l ] with 0 <= k < 3 and 0 <= l < 3 is defined as follows:

— A[ 0 ][ 0 ] =

— A[ 0 ][ 1 ] =

— A[ 0 ][ 2 ] =

— A[ 1 ][ 0 ] = A[ 0 ][ 1 ]

— A[ 1 ][ 1 ] =

— A[ 1 ][ 2 ] =

— A[ 2 ][ 0 ] = A[ 0 ][ 2 ]

— A[ 2 ][ 1 ] = A[1 ][ 2 ]

— A[ 2 ][ 2 ] = tSize

— The 3 dimensional vector b with the following entries b[ 0 ], b[ 1 ] and b[ 2 ] is defined as follows:

— b[ 0 ] =

— b[ 1 ] =

— b[ 2 ] =

— The cross component precision ccShift is set to 16.

— The process of clause 5.11.4.5 is invoked with matrix A, vector b and parameter ccShift as inputs and the output is assigned to the three-dimensional vector v with entries v[ 0 ], v[ 1 ] and v[ 2 ].

— The following is applied:

— If tSize + fPdL <= blockPos, for 0 <= i < blockSize + tSize +fPdL p[ i ] is set equal to ( v[ 0 ]*ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + v[ 1 ]* ref[ chIdxSecond ][ blockPos − tSize − fPdL + i ] + v[ 2 ]+ccShiftOffst ) >> ccShift.

— Otherwise ( tSize + fPdL > blockPos ), the following applies:

— For fPdL <= i < blockSize + tSize +fPdL, p[ i ] is set equal to ( v[ 0 ]*ref[ chIdxFirst ][ blockPos − tSize − fPdL + i ] + v[ 1 ]* ref[ chIdxSecond ][ blockPos − tSize − fPdL + i ] + v[ 2 ] + ccShiftOffst ) >> ccShift

— The extrapolation process to the left fom clause 8.4.2 is invoked with the input starting position fPdL, the input array size blockSize + tSize, the input array p and the extension size fPdL to obtain the values p[ i ] with 0 <= i < fPdL.

— If cc_pred_filter_flag is equal to zero, the following applies:

— For 0 <= i < blockSize, pred[ i ] is set equal to Clip3( minPredVal, maxPredVal, p[ tSize +fPdL + i ] ).

— For 0 <= i < tSize, resiLeft[ i ] is set equal to currChTpl[ i ] − Clip3( minPredVal, maxPredVal, p[ fPdL +i ] ).

— Otherwise ( cc_pred_filter_flag is not equal to zero ), the following applies:

— The extrapolation process to the right from clause 8.3.1 is invoked with input array size fPdL + tSize +blockSize, input array p and extrapolation size log2FPdR to obtain the values p[ fPdL +tSize + blockSize + k ] with 0 <= k < fPdR.

— For 0 <= i < blockSize, pred[ i ] is set equal to Clip3 ( minPredVal, maxPredVal, ).

— For 0 <= j < tSize resiLeft[ i ] is set equal to currChTpl[ i ] − Clip3( minPredVal, maxPredVal, ).

8.2.8 Block matching prediction decoding process

Input to this process are:

— a variable chIdx specifying the current channel,

— a variable blockPos specifying the position of the first sample of the current block,

— a variable log2BlockSize which determines the size of the current block,

— the array of reconstructed samples of the current channel ref[ i ] with 0 < = i < blockPos.

— the parameter log2TSize which determines the size of the adjacent left residual samples to be computed.

Output of this process are the array of block matching prediction sample values pred[ i ] with 0 <= i < (1 << log2BlockSize ) and the array of adjacent left residual samples resiLeft[ j ] with 0 <= j < ( 1 << log2TSize ).

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to − maxPredVal − 1.

The variable blockSize is set to 1 << log2BlockSize

The variable tSize is set to 1 << log2TSize.

If blockPos < blockSize, one sets pred[ i ] = 0 for all i with 0 <= i < blockSize and resiLef[ j ] = 0 for all j with 0 <= j < tSize.

Otherwise ( blockPos >= blockSize ), the following applies:

The variable fPdL which specifies the padding length to the left for the prediction filters of clause 7.3.3.2.2 is set to 3.

The variable log2FPdR which which determines the length to the right for the prediction filters of clause 7.3.3.2.2 is set to 2.

The variable fPdR is set to 1 << log2FPdR.

The variable fSz which specifies the filter size for the filters of clause 7.3.3.2.2 is set as fSz = fPdL + fPdR.

The variable maxBMOffMinusBS is set to Min( ( 1 << 16) − 1, ( 1 << ( Log2MaxBlockSize + 6 ) ).

The variables offsetMinusBSFirst and blockOffsetFirst are derived as follows:

offsetMinusBSFirst =

Min( maxBMOffMinusBS, BlockMatchingPredOffsetMinusBlocksSize[ chIdx ][ 0 ] )

blockOffsetFirst = Min ( blockPos, blockSize + offsetMinusBSFirst ).

If bm_pred_mult_hyp_flag is equal to 1, the variables offsetMinusBSScnd and blockOffsetScnd are derived as follows:

offsetMinusBSScnd =

Min ( maxBMOffMinusBS, BlockMatchingPredOffsetMinusBlocksSize[ currCh ][ 1 ] ).

blockOffsetScnd = Min( blockPos, blockSize + offsetMinusBSScnd ).

If blockOffsetFirst < blockSize + fPdR or if bm_pred_mult_hyp_flag is equal to 1 and blockOffsetScnd < blockSize + fPdR , the extrapolation process to the right from clause 8.3.1 is invoked with input array size blockPos, input array ref and extension size log2FPdR to obtain the reference sample values ref[ i ] with blockPos <= i < blockPos + fPdR.

The variable minPos is set to Max( 0, blockPos − maxBMOffMinusBS − blockSize ).

If blockPos − blockOffsetFirst −fPdL < minPos or if bm_pred_mult_hyp_flag is equal to 1 and blockPos − blockOffsetScnd −fPdL < minPos, the extrapolation process to the left from clause 8.3.2 is invoked with input starting position minPos, input array size blockPos, input array ref and extension size fPdL to obtain the reference sample values ref[ minPos − fPdL + i  ] with 0 <= i < fPdL.

The intermediate prediction sample values of the first hypothesis pFirst[ i ] with 0 <= i < blockSize are derived as follows:

 

If bm_pred_filter_flag[ 0 ] is equal to 0, pFirst[ i ] is set equal to ref[ blockPos − blockOffsetFirst +  i ].

 

Otherwise ( bm_pred_filter_flag[ 0 ] is not equal to 0 ), pFirst[ i ] is set equal to

If bm_pred_mult_hyp_flag is equal to 1, the intermediate prediction values of the second hypothesis pScnd[ i ] with 0 <= i < blockSize are derived as follows:

 

If bm_pred_filter_flag[ 1 ] is equal to 0, pScnd[ i ] is set equal to ref[ currCh ][ blockPos − blockOffsetScnd +  i ].

 

Otherwise ( bm_pred_filter_flag[ 1 ] is not equal to 0 ), pScnd[ i ] is set equal to

The extended first left prediction sample values pFirstLeftExt[ i ] with 0 <= i < tSize are derived as follows:

 

If bm_pred_filter_flag[ 0 ] is equal to 0, the following applies:

 

 

If blockPos − blockOffsetFirst − tSize < minPos − fPdL, one sets pFirstLeftExt[ i ] = 0.

 

 

Otherwise (blockPos − blockOffsetFirst − tSize >= minPos − fPdL ), pFirstLeftExt[ i ] is set equal to ref[ blockPos − tSize − blockOffsetFirst + i ].

 

Otherwise ( bm_pred_filter_flag[ 0 ] is not equal to 0 ), the following applies:

 

 

If blockPos − blockOffsetFirst − tSize < minPos, pFirstLeftExt[ i ] is set equal to 0.

 

 

Otherwise (blockPos − blockOffsetFirst − tSize >= minPos),
pFirstLeftExt[ i ] is set equal to
6.

If bm_pred_mult_hyp_flag is equal to 1, the extended second left prediction sample values pScndLeftExt[ i ] with 0 <= i < tSize are derived as follows:

 

If bm_pred_filter_flag[ 1 ] is equal to 0, the following applies:

 

 

If blockPos − blockOffsetScnd − tSize < minPos − fPdL, one sets pScndLeftExt[ i ] = 0.

 

 

Otherwise ( blockPos − blockOffsetScnd − tSize >= minPos – fPdL ), pScndLeftExt[ i ] is set equal to ref[ blockPos − tSize − blockOffsetScnd + i].

 

Otherwise ( bm_pred_filter_flag[ 1 ] is not equal to 0 ), the following applies:

 

 

If blockPos − blockOffsetScnd − tSize < minPos, pScndLeftExt[ i ] is set equal to 0.

 

 

Otherwise ( blockPos − blockOffsetScnd − tSize >= minPos ),
pScndLeftExt[ i ] is set equal to
6.

The variable diffTpl is derived as follows:

 

If bm_pred_add_offset_flag is equal to zero, one sets diffTpl = 0

Otherwise if blockPos < tSize, diffTpl is set equal to 0.

Otherwise ( bm_pred_add_offset_flag is not equal to zero and blockPos >= tSize ), the following applies:

 

 

If bm_pred_mult_hyp_flag is equal to 0,
diffTpl is set equal to .

 

 

Otherwise ( bm_pred_mult_hyp_flag is not equal to 0 ),
diffTpl is set equal to

The variable offsetAdd is derived as offsetAd = ( diffTpl + ( 1 << ( log2TSize − 1 ) ) ) >> log2TSize.

The final block matching prediction sample values pred[ i ] with 0 <= i < blockSize are derived as follows:

 

If bm_pred_mult_hyp_flag is equal to 0, pred[ i ] is set equal to Clip3( minPredVal, maxPredVal, pFirst[ i ] + offsetAd ).

 

Oterwise (bm_pred_mult_hyp_flag is not equal to 0),
pred[ i ] is set equal to Clip3( minPredVal, maxPredVal, ( ( pFirst[ i ] + pSecond[ i ] + 1 ) >> 1 ) + offsetAd ).

The final adjacent left residual sample values resiLeft[ i ] with 0 <= i < tSize are derived as follows:

 

If blockPos < tSize, one sets reiLeft[ i  = 0

 

Otherwise ( blockPos >= tSize ), the following applies:

 

 

If bm_pred_mult_hyp_flag is equal to 0,
resiLeft[ i ] is set equal to ref[blockPos tSize + i] − Clip3( minPredVal, maxPredVal, pFirst[ i ] + offsetAd ).

 

 

Otherwise (bm_pred_mult_hyp_flag is not equal to 0),
resiLeft[ i ] is set equal to ref[blockPos tSize + i] − Clip3( minPredVal, maxPredVal, ( ( pFirst[ i ] + pSecond[ i ] + 1 ) >> 1 ) + offsetAd.

8.3 Block-wise scaling and inverse transformation decoding process

This process specifies the computation of the reconstructed residual sample values res[ i ] with 0 <= i < blockSize.

The following steps are applied:

— The process of clause 8.4.1 is invoked. The output of this process is assigned to the residual transform coefficients tCoeff[ i ] with 0 <= i < Log2BlockSize.

— The process of clause 8.4.2 is invoked with the variable blockSize set to ( 1 << Log2BlockSize ) and the residual transform coefficients tCoeffCurr[ i ] set to tCoeff[ i ] for 0 <= i < ( 1 << Log2BlockSize ). The output sample values of this process are assigned to the intermediate residual values resImd[ i ] with 0 <= i < ( 1 << Log2BlockSize ).

8.3.1 Scaling process for transform coefficient levels

Output of this process are the intermediate reconstructed residual transform coefficients tCoeff[ i ] with 0 <= i < (1 << Log2BlockSize).

The variable leftShiftTrigTrafo is set to be equal to 32 − BitDepthMax − dct_headroom[ Log2BlockSize ].

The variable maxCoeffVal is set to be equal to ( 1 << 31 ) − 1 and the variable minCoeffVal is set to be equal to −maxCoeffCal − 1.

The values of the variables qScale and qShift are determined as follows:

 

qScale = InvQuantScale[CurrBlockQP[ ch ] & 31]

qShift = 29 − ( CurrBlockQP[ ch ] >> 5 )

if( qShift < 0 ) {

qScale <<= −qShift

qScale = Min( qScale, ( 1 << 31 ) − 1 )

qShift = 0

}

downShift = qShift − 8

if( downShift > 0 ) {

addRound = 1 << ( downShift − 1 )

qScale = ( qScale + addRound ) >> downShift

qShift = 8

}

The reconstructed residual transform coefficients tCoeff[ i ] with 0 <= i < ( 1 << Log2BlockSize ) are derived as follows:

— If transform_present_flag is equal is not equal to 1, the following applies:

 

if ( qShift > 0 ) {

 

addRound = 1 << ( qShift − 1 )

 

tCoeff[ i ] = QuantIndices[ i ] * qScale +

 

( QuantIndices[ i ] < 0 ? addRound − 1 : addRound ) >> qShift

 

tCoeff[ i ] = Clip3( minCoeffVal, maxCoeffVal, tCoeff[ i ] )

 

} else

 

tCoeff[ i ] = Clip3( minCoeffVal, maxCoeffVal, tCoeff[ i ] * ( qScale << ( −qShift ) ) )

— Otherwise ( transform_present_flag is equal to 1 ) the following applies:

— The variable qShift is modified to qShift − leftShiftTrigTrafo + 1

— The variable tCoeff[ i ] is determined by the following pseudo-code process:

if( qShift > 0 ) {

offset = 1 << ( qShift − 1 )

nextState = 0

for( i = last_scan_pos, i >= 0 , i = i − 1 ) {

if( QuantIndices[ i ] != 0 ) {

valCurr = ( Abs( QuantIndices[ i ] ) << 1) − ( nextState & 1 ) ) * qScale )

valCurr = ( valCurr + offset ) >> qShift

tCoeff[ i ] = QuantIndices[ i ] < 0 ? Max( minCoeffVal, −valCurr ) :

Min( maxCoeffVal, valCurr )

} else

tCoeff[ i ] = 0

nextState = QStateTransTabel[nextState][QuantIndices[ i ] & 1]

}

} else {

nextState = 0

for( i = last_scan_pos, i >= 0 , i = i − 1 ) {

if( QuantIndices[ i ] != 0 ) {

offsetCurr = ( QuantIndices[ i ] < 0 ) ? nextState & 1 : −( nextState & 1 )

valCurr =(QuantIndices[ i ] << 1) + offsetCurr ) * qScale

tCoeff[ i ] = Clip3( minCoeffVal, maxCoeffVal, valCurr )

} else

tCoeff[ i ] = 0

nextState = QStateTransTabel[nextState][QuantIndices[ i ] & 1]

}

}

8.3.2 Inverse transformation process

Input to this process are a block size bSizeCurr and reconstructed transform coefficients tCoeffCurr[ i ] with 0 <= i < bSizeCurr. Output of this process are the intermediate residual sample values resImdCurr[ i ] with 0 <= i < bSizeCurr.

The following is applied

— If transform_present_flag is not equal to 1, the values tCoeffCurr[ i ] are assigned to the residual samples resImd[ i ].

— Otherwise ( transform_present_flag is equal to 1), the following applies:

— If transform_dst_flag is equal to 1, a DST-II transform process of clause 8.6 is applied where the values tCoeffCurr[ i ] are assigned to the input of this process. The output of this process is assigned to the residual sample values resImd[ i ].

— Otherwise ( transform_dst_flag is not equal to 1 ), the DCT-II transform process of clause 8.6 is invoked, where the values tCoeffCurr[ i ] are assigned to the input of this process. The output of this process is assigned to the residual sample values resImd[ i ].

8.4 Backward adaptive prediction

The backward adaptive prediction is based on a normalized least means squared (NLMS) prediction algorithm that operates in the DCT domain and provides both intra-channel and inter-channel prediction. For intra-channel prediction, the NMLS prediction algorithm operates in the negative frequency, that is higher frequencies are used to predict lower frequencies. The intra-channel prediction and inter-channel prediction can be enabled independently through the syntax elements enable_ar_lms and enable_cc_lms, respectively. Furthermore, the DCT spectrum can be split into two equal parts with the syntax element lms_split_flag. In the case that the lms_split_flag syntax element is enabled, the intra-channel and inter-channel prediction can be controlled independently, and there are two syntax elements for both enable_ar_lms and enable_cc_lms, see clause 7.3.3.2.7. The prediction coefficients and buffer states for both the intra-channel and inter-channel prediction shall be reset every frame. Furthermore, if bitstream lms_split_flag is enabled, the prediction coefficient and buffer states are reset for both halves of the DCT spectrum.

The DC term shall not be predicted if the syntax element lms_split_flag is disabled, however, the DC term shall be predicted if the syntax element lms_split_flag is enabled.

The NLMS update step is dependent on the DCT data bit-depth as specified in clause 8.4.1

Inputs to this process:

— A flag specifying if the LMS prediction is split ( lms_split_flag ) ( see clause 7.4.3.2.7 )

— An array of two flags enabling the LMS across frequency ( enable_ar_lms[ 0 ] and enable_ar_lms[ 1 ] ) ( see clause 7.4.3.2.7)

— An array of two flags enabling the LMS across channels ( enable_cc_lms[ 0 ] and enable_cc_lms[ 1 ] ) ( see clause 7.4.3.2.7 )

— A variable specifying the length of the transform ( blockLength )

— A variable specifying the bit depth of the transform data ( signalBitDepth ) ( see clause 8.4.1 )

— A variable specifying the quantizer parameter for the current channel ( CurrBlockQP[ ch ] ) ( see clause 8.4.1 )

— An array of transform data for the previous channels ( signal[ c ][ n ], with c = 0…Ch - 1 and n = 0...blockLength − 1 )

— An array of transform domain residual data ( res[ n ], with n = 0.. blockLength − 1 )

Outputs to this process:

— An array of transform data for the current channel ( signal[ Ch ][ n ], with n = 0...blockLength −1)

if( lms_split_flag == 1 )

numSplits = 2;

else

numSplits = 1;

 

for( ns = 0; ns = numSplits; ns++ ) {

if( numSplits == 1 ) {

startIndex = blockLength − 1;

stopIndex = −1;

} else if( ns == 0 ) {

startIndex = blockLength − 1;

stopIndex = ( blockLength >> 1) − 1;

}

else {

startIndex = ( blockLength >> 1 );

stopIndex = −1;

}

 

if( enable_cc_lms[ ns ] == 1 ) {

/* see clause 7.4.2.2 */

LMSMaxCCOrder = GetMaxLmsCcOrder(

cgps_max_order_cc_lms_minus_one, cgps_lms_ar_order_over_four, Log2MaxBlockSize );

startCh = Ch − LMSMaxCCOrder ;

startCh = ( startCh > 0 ) ? startCh : 0;

stopCh = Ch;

} else {

startCh = 0;

stopCh = 0;

}

 

if( enable_ar_lms[ ns ] == 1 ) {

/* Set LMSOrder based on cgps_lms_ar_order_over_four see clause 7.4.2.2 */

LMSOrder = GetLmsArOrder( cgps_lms_ar_order_over_four, log2_block_length );

}

else{

LMSOrder = 0;

}

 

for( n = 0; n < 64; n ++ ) {

predARCoeff[ n ] = 0;

predBuffer[ n ] = 0;

}

for( n = 0; n < 32; n ++ )

predICCoeff[ n ] = 0;

 

bufferPointer = 0;

bufferMask = 63;

energyShift = signalBitDepth − 24;

energyShift = ( energyShift > 0 ) ? energyShift : 0;

bufferEnergy = 0;

for( n = startIndex; n > stopIndex; n −− ) {

coeffMax = (1 << ( 19 + 5 ) ) − 1;

coeffMin = 1 − ( 1 << ( 19 + 5 ) );

energyNorm = 0;

accum = 0;

/* Compute inter-channel prediction */

for( k = startCh; k < stopCh; k++ ) {

accum += signal[ k ][ n ] * predICCoeff[ k ];

normEnergy += (signal[ k ][ n ] >> energyShift);

}

/* compute intra-channel predition */

index = bufferPointer − 1;

index &= BufferMask;

for( k = 0; k < lms_order; k++ ) {

accum += predARCoeff[ k ] * predBuffer[ index ];

index −−;

index &= bufferMask;

}

normEnergy += bufferEnergy;

accum = ( accum + (1 << (19 − 1 ) ) ) >> 19;

accum = ( accum < INT32_MAX ) ? accum : INT32_MAX;

accum = ( accum > INT32_MIN ) ? accum : INT32_MIN;

pred = accum;

 

if( CurrBlockQP[ ch ] > 0 ) {

res [ ch ][ n ] = InverseQuantize( residual[ ch ][ n ], CurrBlockQP[ ch ] ); /* See clause 8.4.1 */

}

/* Don’t predict DC value lms_split_flag = = 0 */

if( n == 0 && lms_split_flag = = 0 ) {

signal[ Ch ][ n ] = res[ Ch ][ n ];

}

else{

signal[ Ch ][ n ] = res[ Ch ][ n ] + pred;

}

/* compute update gain */

for( accum = normEnergy, log2Energy = 0; accum > 0; accum >>= 1, log2Energy ++ );

log2Energy += (energyShift << 1);

log2Energy >>= 1;

roundOffset = ( log2Energy > 0) ? (1 << (log2Energy − 1 ) ) : 0;

gain = ( ( ( ( residual << 19 ) >> log2Energy ) + 2 ) >> 2 );

gain = ( gain > -( 1 << 17 ) ) ? gain : −( 1 << 17 );

gain = ( gain < ( 1 << 17)) ? gain : ( 1 << 17 );

/* update inter-channel prediction coeff */

for( k = startCh; k < stopCh; k++ ) {

accum = gain * signal[ k ][ n ];

accum += roundOffset;

accum >> log2Energy;

predICCoeff[ k ] += accum;

predICCoeff[ k ] = ( predICCoeff[ k ] > coeffMin ) ? predICCoeff[ k ] : coeffMin;

predICCoeff[ k ] = ( predICCoeff[ k ] < coeffMax ) ? predICCoeff[ k ]: coeffMax;

}

/* update intra-channel prediction coeff */

index = bufferPointer − 1;

index &= bufferMask;

for( k = 0; k < LMSOrder; k++ ) {

accum += gain* predBuffer[ index ];

accum += roundOffset;

accum >> log2Energy;

predARCoeff [ k ] += accum;

predARCoeff[ k ] = ( predARCoeff[ k ] > coeffMin ) ? predARCoeff[ k ]: coeffMin;

predARCoeff[ k ] = ( predARCoeff[ k ] < Coeff_max ) ? predARCoeff[ k ]:Coeff_max;

index −−;

pointer &= bufferMask;

}

/* update buffer energy */

index = bufferPointer − LMSOrder;

index &= bufferMask;

bufferEnergy −= ( predBuffer[ index ] * predBuffer[ index ]) >> energyShift;

bufferEnergy += signal[ ch ][ n ] * signal[ Ch ][ n ] >> energyShift;

/* update buffer */

predBuffer[ bufferPointer ] = signal[ Ch ][ n ];

bufferPointer ++;

bufferPointer &= bufferMask;

}

}

8.4.1 Inverse integer reversible discrete cosine transform

8.4.2 General

The following clauses specify the integer reversible inverse discrete cosine transform. The following constants are defined for this purpose:

— INT_DCT2_MAX_BITS = 31

— INT_DCT2_ROUND_OFFSET = 107374182

8.4.3 Inverse integer reversible DCT for two signals (IntDualIDCT)

Inputs to the process are:

— a variable that specifies the base-2 logarithm of the length of the transform

— an array of input signal for the first channel; sigData0[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

— an array of input signal for the second channel; sigData1[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

Outputs of the process are ( this process is in-place ):

— a modified array containing the output signal for the first channel; sigData0[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing the output signal for the second channel; sigData1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength and halfDataLength are set as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

The arrays of rotation scales; rotScaleA and rotScaleB are initialized:

— If log2Length is equal to 4, the following applies:

rotScaleA = A4_16 /* specified in Annex B */

rotScaleB = B4_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA = A4_32 /* specified in Annex B */

rotScaleB = B4_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA = A4_64 /* specified in Annex B */

rotScaleB = B4_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA = A4_128 /* specified in Annex B */

rotScaleB = B4_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA = A4_256 /* specified in Annex B */

rotScaleB = B4_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA = A4_512 /* specified in Annex B */

rotScaleB = B4_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA = A4_1024 /* specified in Annex B */

rotScaleB = B4_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA = A4_2048 /* specified in Annex B */

rotScaleB = B4_2048 /* specified in Annex B */

The following internal scratch arrays for this process are assumed to be available: realVals0[ n ], imagVals0[ n ], realVals1[ n ], and imagVals1[ n ] with n = 0.. ( ( 1 << log2Length) – 1 )

The process for the two-channel inverse integer reversible DCT is as follows:

realVals0[ 0 ] = sigData0[ 0 ];

realVals0[ halfDataLength ] = sigData0[ halfDataLength ];

realVals1[ 0 ] = sigData1[ 0 ];

realVals1[ halfDataLength ] = sigData1[ halfDataLength ];

for( n = 1; n < halfDataLength; n ++ ) {

realVals0[ n ] = sigData0[ n ];

imagVals0[ n ] = -sigData0[ dataLength − n ];

realVals1[ n ] = sigData1[ n ];

imagVals1[ n ] = -sigData1[ dataLength − n ];

}

for( n = 1; n < halfDataLength; n ++ ) {

RotateInverseLift( rotScaleA[ n ], roatScaleB[ n ], realVals0[ n ], imagVals0[ n ] ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA[ n ], rotScaleB[ n ], realVals1[ n ], imagVals1[ n ] ); /* see clause 8.6.6*/

}

LiftDualRealIFFT( log2Length, realVals0, imagVals0, realVals1, imagVals1 ); /* see clause 8.6.10 */

for( n = 0; n < halfDataLength; n ++ ) {

sigData0[ 2 * n ] = realVals0[ n ];

sigData0[ dataLength − 2 * n − 1 ] = realVals0[ halfDataLength + n ];

sigData1[ 2 * n ] = realVals1[ n ];

sigData1[ Length − 2 * n − 1 ] = realVals1[ halfDataLength + n ];

}

8.4.4 Inverse integer reversible DCT for one signal (IntIDCT)

Inputs to the process are:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array of input signal; sigData[ n ], with n = 0..( ( 1 << log2Length ) – 1 )

Outputs of the process are ( this process is in-place ):

— a modified array of signal; sigData[ n ], with n = 0..( ( 1 << log2Length ) – 1 )

The variables dataLength and halfDataLength are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

The arrays of rotation scales; rotScaleA and rotScaleB are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA = A4_16 /* specified in Annex B */

rotScaleB = B4_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA = A4_32 /* specified in Annex B */

rotScaleB = B4_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA = A4_64 /* specified in Annex B */

rotScaleB = B4_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA = A4_128 /* specified in Annex B */

rotScaleB = B4_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA = A4_256 /* specified in Annex B */

rotScaleB = B4_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA = A4_512 /* specified in Annex B */

rotScaleB = B4_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA = A4_1024 /* specified in Annex B */

rotScaleB = B4_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA = A4_2048 /* specified in Annex B */

rotScaleB = B4_2048 /* specified in Annex B */

 

The following internal scratch arrays for this process are assumed to be available: realVals[ n ] and imagVals[ n ] with n = 0,…,( ( 1 << log2Length ) −1 )

The process for the single-channel inverse integer reversible DCT is as follows:

realVals[ 0 ] = sigData[ 0 ];

realVals[ halfDataLength ] = sigData[ halfDataLength ];

for( n = 1; n < halfDataLength; n++ ) {

realVals[ n ] = sigData[ n ];

imagVals[ n ] = −sigData[ dataLength − n ];

}

for( n = 1; n < halfDataLength; n++ ) {

RotateInverseLift( rotScaleA[ n ], rotScaleB[ n ], realVals[ n ], imagVals[ n ] ); /* see clause 8.6.6*/

}

LiftRealIFFT( log2Length, realVals, imagVals ); /* see clause 8.6.11 */

for( n = 0; n < halfDataLength; n++ ) {

sigData[ 2 * n ] = realVals[ n ];

sigData[ Length − 2 * n − 1 ] = realVals[ halfDataLength + n ];

}

8.4.5 Inverse integer reversible DST for two signals (IntDualIDST)

Inputs to the process are:

— a variable that specifies the base-2 logarithm of the length of the transform

— an array of input signal for the first channel; sigData0[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

— an array of input signal for the second channel; sigData1[ n ], for n = 0..( ( 1 << log2Length) − 1 )

Outputs of the process are (this process is in-place):

— a modified array containing the output signal for the first channel; sigData0[n], for n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing the output signal for the second channel; sigData1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength and halfDataLength are set as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

The arrays of rotation scales; rotScaleA and rotScaleB are initialized:

— If log2Length is equal to 4, the following applies:

rotScaleA = A4_16 /* specified in Annex B */

rotScaleB = B4_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA = A4_32 /* specified in Annex B */

rotScaleB = B4_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA = A4_64 /* specified in Annex B */

rotScaleB = B4_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA = A4_128 /* specified in Annex B */

rotScaleB = B4_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA = A4_256 /* specified in Annex B */

rotScaleB = B4_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA = A4_512 /* specified in Annex B */

rotScaleB = B4_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA = A4_1024 /* specified in Annex B */

rotScaleB = B4_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA = A4_2048 /* specified in Annex B */

rotScaleB = B4_2048 /* specified in Annex B */

 

The following internal scratch arrays for this process are assumed to be available: realVals0[ n ], imagVals0[ n ], realVals1[ n ], and imagVals1[ n ] with n = 0.. ( ( 1 << log2Length ) −1 )

The process for the two-channel inverse integer reversible DCT is as follows:

realVals0[ 0 ] = sigData0[ 0 ];

realVals0[ halfDataLength ] = sigData0[ halfDataLength ];

realVals1[ 0 ] = sigData1[ 0 ];

realVals1[ halfDataLength ] = sigData1[ halfDataLength ];

for( n = 1; n < halfDataLength; n ++ ) {

realVals0[ n ] = sigData0[ n ];

imagVals0[ n ] = -sigData0[ dataLength − n ];

realVals1[ n ] = sigData1[ n ];

imagVals1[ n ] = -sigData1[ dataLength − n ];

}

for( n = 1; n < halfDataLength; n ++ ) {

RotateInverseLift(rotScaleA[ n ], roatScaleB[ n ], realVals0[ n ], imagVals0[ n ] ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA[ n ], rotScaleB[ n ], realVals1[ n ], imagVals1[ n ] ); /* see clause 8.6.6*/

}

LiftDualRealIFFT( log2Length, realVals0, imagVals0, realVals1, imagVals1 ); /* see clause 8.6.10 */

for( n = 0; n < halfDataLength; n ++ ) {

sigData0[ 2 * n ] = realVals0[ n ];

sigData0[ dataLength − 2 * n − 1  = realVals0[ halfDataLength + n ];

sigData1[ 2 * n ] = realVals1[ n ];

sigData1[ Length − 2 * n − 1 ] = realVals1[ halfDataLength + n ];

}

8.4.6 Inverse integer reversible DST for one signal (IntIDST)

Inputs to the process are:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array of input signal; sigData[ n ], with n = 0..( ( 1 << log2Length) − 1 )

Outputs of the process are (this process is in-place):

— a modified array of signal; sigData[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength and halfDataLength are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

The arrays of rotation scales; rotScaleA and rotScaleB are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA = A4_16 /* specified in Annex B */

rotScaleB = B4_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA = A4_32 /* specified in Annex B */

rotScaleB = B4_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA = A4_64 /* specified in Annex B */

rotScaleB = B4_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA = A4_128 /* specified in Annex B */

rotScaleB = B4_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA = A4_256 /* specified in Annex B */

rotScaleB = B4_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA = A4_512 /* specified in Annex B */

rotScaleB = B4_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA = A4_1024 /* specified in Annex B */

rotScaleB = B4_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA = A4_2048 /* specified in Annex B */

rotScaleB = B4_2048 /* specified in Annex B */

 

The following internal scratch arrays for this process are assumed to be available: realVals[ n ] and imagVals[ n ] with n = 0,…,( ( 1 << log2Length ) − 1 )

The process for the single-channel inverse integer reversible DCT is as follows:

realVals[ 0 ] = sigData[ 0 ];

realVals[ halfDataLength ] = sigData[ halfDataLength ];

for( n = 1; n < halfDataLength; n++ ) {

realVals[ n ] = sigData[ n ];

imagVals[ n ] = -sigData[ dataLength − n ];

}

for( n = 1; n < halfDataLength; n++ ) {

RotateInverseLift( rotScaleA[ n ], rotScaleB[ n ], realVals[ n ], imagVals[ n ] ); /* see clause 8.6.6*/

}

LiftRealIFFT( log2Length, realVals, imagVals ); /* see clause 8.6.11 */

for( n = 0; n < halfDataLength; n++ ) {

sigData[ 2 * n ] = realVals[ n ];

sigData[ Length − 2 * n − 1 ] = realVals[ halfDataLength + n ];

}

8.4.7 Lifting factorization for inverse Givens rotations - (RotateInverseLift)

Inputs to the process are:

— a variable A that is the first rotation scale

— a variable B that is the second rotation scale

— a variable x0 that is the first value to be rotated

— a variable x1 that is the second value to be rotated

Outputs to the process are (this process is in-place):

— a modified variable x0 that is the first value after rotation

— a modified variable x1 that is the second value after rotation

The lifting based inverse rotation is specified as follows:

 

t = A * x1; /* the computation of t, as written, may require at least 64bit precision */

x0 −= ( t + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

t = B * x0; /* the computation of t, as written, may require at least 64bit precision */

x1 −= ( ( t + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

t = A * x1; /* the computation of t, as written, may require at least 64bit precision */

x0 −= ( ( t + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

8.4.8 Fixed-point fast Fourier transform (FPRadix2FFT)

The multi-dimensional lifting process to compute dual integer reversible inverse DFTs, as described in clause 8.6.8, calls the fixed-point fast Fourier transform specified in this clause. For lossless operation, the DFT must produce the exact same results as the transform specified in this clause.

Inputs to the process:

— the length of the transform in log base 2 ( log2FFTLength )

— an array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

Outputs of this process ( the process is in-place ):

— a modified array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables FFTLength, halfFFTLength are initialized as follows:

— FFTLength = 1 << log2FFTLength

— halfFFTLength = FFTLength >> 1

 

The variables normFFT, minFFTMSB, twiddleReal, and twiddleImag are initialized depending on the input variable log2FFTLength as follows:

— If log2FFTLength is equal to 2, the following applies:

minFFTMSB = 1

normFFT = 1073741824

twiddleReal = TwiddleReal_4 /* specified in Annex B */

twiddleImag = TwiddleImag_4 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 3, the following applies:

minFFTMSB = 2

normFFT = 759250125

twiddleReal = TwiddleReal_8 /* specified in Annex B */

twiddleImag = TwiddleImag_8 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 4, the following applies:

minFFTMSB = 2

normFFT = 536870912

twiddleReal = TwiddleReal_16 /* specified in Annex B */

twiddleImag = TwiddleImag_16 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 5, the following applies:

minFFTMSB = 3

normFFT = 379625062

twiddleReal = TwiddleReal_32 /* specified in Annex B */

twiddleImag = TwiddleImag_32 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 6, the following applies:

minFFTMSB = 3

normFFT = 268435456

twiddleReal = TwiddleReal_64 /* specified in Annex B */

twiddleImag = TwiddleImag_64 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 7, the following applies:

minFFTMSB = 4

normFFT = 189812531

twiddleReal = TwiddleReal_128 /* specified in Annex B */

twiddleImag = TwiddleImag_128 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 8, the following applies:

minFFTMSB = 4

normFFT = 134217728

twiddleReal = TwiddleReal_256 /* specified in Annex B */

twiddleImag = TwiddleImag_256 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 9, the following applies:

minFFTMSB = 5

normFFT = 94906266

twiddleReal = TwiddleReal_512 /* specified in Annex B */

twiddleImag = TwiddleImag_512 /* specified in Annex B */

— Otherwise, if log2FFTLength is equal to 10, the following applies:

minFFTMSB = 5

normFFT = 67108864

twiddleReal = TwiddleReal_1024 /* specified in Annex B */

twiddleImag = TwiddleImag_1024 /* specified in Annex B */

 

The fixed-point fast Fourier transform is as follows:

 

/* Compute MSB headroom */

maxVal = 0;

for( n = 0; n < FFTLength; n++ ) {

maxVal |= Abs( realVals[ n ] );

maxVal |= Abs( imagVals[ n ] );

}

for( log2MaxVal = 0; maxVal > 0; maxVal >>= 1 ) {

log2MaxVal++;

}

 

valShift = INT_DCT2_MAX_BITS − log2MaxValue − minFFTMSB - 1;

valShift = ( valShift < 15 ) ? valShift : 15;

if( valShift > 0 ) {

roundOffset = 1 << ( valShift − 1);

}else{

valShift = 0;

roundOffset = 0;

}

/* Normalize input by approximate square root of FFTLength */

for( n = 0; n < FFTLength; n++ ) {

realVals[ n ] <<= valShift;

imagVals[ n ] <<= valShift;

accum = ( INT64 ) realVals[ n ] * normFFT;

realVals[ n ] = ( ( accum + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

accum = ( INT64 ) imagVals[ n ] * normFFT;

imagVals[ n ] = ( ( accum + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

}

/* Perform decimation in frequency based FFT */

numFFT = 1;

for( s = halfFFTLength; s > 0; s >>= 1 ) {

index = 0;

for( n = 0; n < numFFT; n ++ ) {

index0 = index;

index1 = index0 + s;

twdIndex = 0;

for( m = 0; m < s; m ++ ) {

tempVal = realVals[ index0 ];

realVals[ index0 ] += realVals[ index1 ];

realVals[ index1 ] = tempVal − realVals[ index1 ];

tempVal = imagVals[ index0 ];

imagVals[ index0 ] += imagVals[ index1 ];

imagVals[ index1 ] = tempVal − imagVals[ index1 ];

if( m > 0 ) {

tempVal = realVals[ index1 ];

/* the computation of accum, as written, may require at least 64bit precision */

accum = realVals[ index1 ] * twiddleReal[ twdIndex ] - imagVals[ index1 ] * twiddleImag[ twdIndex ];

realVals[ index1 ] = ( accum + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS;

/* the computation of accum, as written, may require at least 64bit precision */

accum = tempVal * twiddleImag[ twdIndex ] + imagVals[ index1 ] * twiddleReal[  twdIndex ];

imagVals[ index1 ] = ( accum + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS;

}

index0 ++;

index1 ++;

twdIndex += numFFT;

}

index += ( s << 1 );

}

numFFT <<= 1;

}

/*Reorder Data */

n = 0;

for( m = 0; m < (FFTLength − 1 ); m ++ )

if(m < n ) {

swapVal = realVals[ m ];

realVals[ m ] = realVals[ n ];

realVals[ n ] = swapVal;

swapVal = imagVals[ m ];

imagVals[ m ] = imagVals[ n ];

imagVals[ n ] = swapVal;

}

i = halfFFTLength;

while( i <= n ) {

n -= i;

i >>= 1;

}

n += i;

}

 

if( valShift > 0 ) {

for( n = 0; n < FFTLength; n ++ ) {

realVals[ n ] += roundOffset;

real[ n ] >>= valShift;

imagVals[ n ] += roundOffset;

imagVals[ n ] >>= valShift;

}

}

8.4.9 Inverse integer reversible DFT for two complex sequences (IFFTLift)

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing real values realVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals1[ n ], with n = 0..( ( 1 << log2Length) − 1 )

Outputs to this process ( this process is in-place ):

— a modified array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing real values realVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variable dataLength is initialized as follows:

— dataLength = 1 << log2Length

The following internal scratch arrays for this process are assumed to be available: scratchReal[ n ] and scratchImag[ n ] with n = 0,…,( ( 1 << log2Length ) −–1 )

The process for the inverse integer reversible DFT for two complex sequences is as follows:

for( n = 0; n < dataLength; n ++ ) {

imagVals1[ n ] = −imagVals1[ n ];

}

for( n = 0; n < dataLength; n ++ ) {

realVals0[ n ] = −realVals0[ n ];

imagVals0[ n ] = −imagVals0[ n ];

scratchReal[ n ] = realVals0[ n ];

scratchImag[ n ] = −imagsVals0[ n ];

}

FPRadix2FFT( scratchReal , scratchImag ); /* see clause 8.6.7 */

for( n = 0; n < dataLength; n ++ ) {

realVals1[ n ] −= scratchReal[ n ];

imagVals1[ n ] += scratchImag[ n ];

 

scratchReal[ n ] = realVals1[ n ];

scratchImag[ n ] = imagVals1[ n ];

}

FPRadix2FFT( scratchReal, scratchImag ); /* see clause 8.6.7 */

for( n = 0; n < dataLength; n ++ ) {

realVals0[ n ] += scratchReal[ n ];

imagVals0[ n ] += scratchImag[ n ];

scratchReal[ n ] = realVals0[ n ];

scratchImag[ n ] = −imagVals0[ n ];

}

FPRadix2FFT( scratchReal , scratchImag ); /* see clause 8.6.7 */

for( n = 0; n < dataLength; n ++ ) {

realVals1[ n ] −= scratchReal[ n ];

imagVals1[ n ] += scratchImag[ n ];

swapVal = realVals0[ n ];

realVals0[ n ] = realVals1[ n ];

realVals1[ n ] = swapVal;

swapVal = imagVals0[ n ];

imagVals0[ n ] = imagVals1[ n ];

imagVals1[ n ] = swapVal;

}

for( n = 0; n < dataLength; n ++ ) {

imagVals1[ n ] = −imagVals1[ n ];

}

8.4.10 Inverse integer reversible DFT for a single complex sequence ( IFFTLiftSplit )

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) −1 )

— an array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) −1 )

Outputs of this process (the process is in-place):

— a modified array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) −1 )

— a modified array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) −1 )

The variables dataLength, halfDataLength, rotScaleA1, and rotScaleB1 are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

— rotScaleA1 = -889516852

— rotScaleB1 = 1518500249

The arrays of rotation scales; rotScaleA0 and rotScaleB0 are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA0 = A1_16 /* specified in Annex B */

rotScaleB0 = B1_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA0 = A1_32 /* specified in Annex B */

rotScaleB0 = B1_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA0 = A1_64 /* specified in Annex B */

rotScaleB0 = B1_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA0 = A1_128 /* specified in Annex B */

rotScaleB0 = B1_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA0 = A1_256 /* specified in Annex B */

rotScaleB0 = B1_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA0 = A1_512 /* specified in Annex B */

rotScaleB0 = B1_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA0 = A1_1024 /* specified in Annex B */

rotScaleB0 = B1_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA0 = A1_2048 /* specified in Annex B */

rotScaleB0 = B1_2048 /* specified in Annex B */

 

The following internal scratch arrays for this process are assumed to be available: scratchReal[ n ] and scratchImag[ n ] with n = 0,…,( ( 1 << log2Length ) − 1 )

The process for the inverse integer reversible DFT for a single complex sequence is as follows:

for( n = 0; n < halfDataLength; n ++ ) {

realVal0 = realVals[ n ];

imagVal0 = imagVals[ n ];

realVal1 = realVals[ halfDataLength + n ];

imagVal1 = imagVals[ halfDataLength + n ];

 

RotateInverseLift( rotScaleA1 , rotScaleB1 , realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift(( rotScaleA1 , rotScaleB1 , imagVal0 , imagVal1 ); /* see clause 8.6.6*/

 

RotateInverseLift( rotScaleA0[ n ] , rotScaleB0[ n ] , realVal1, imagVal1 ); /* see clause 8.6.6*/

scratchReal[ n ] = realVal0;

scratchImag[ n ] = imagVal0;

scratchReal[ halfDataLength + n ] = imagVal1;

scratchImag[ halfDataLength + n ] = −realVal1;

}

/* Note: scratchReal[ halfDataLength ] and scratchImag[ halfDataLength ] are arrays starting at halfDataLength */

IFFTLift( log2Length − 1, scratchReal, scratchImag, scratchReal[ halfDataLength ], scaratchImag[ halfDataLength ] ); /* see clause 8.6.8 */

for( n = 0, k = 0; n < halfDataLength; n ++, k += 2 ) {

realVals[ k ] = scratchReal[ n ];

imagVals[ k ] = scratchImag[ n ];

realVals[ k + 1 ] = scratchReal[ halfDataLength + n ];

imagVals[ k + 1 ] = scratchImag[ halfLength + n ];

}

8.4.11 Inverse integer reversible DFT for two real sequences (LiftDualRealIFFT)

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing real values realVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

Outputs of this process ( the process is in-place ):

— a modified array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength, halfDataLength, quartDataLength, rotScaleA0, and rotScaleB0 are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

— quartDataLength = halfDataLength >> 1

— rotScaleA0 = -889516852

— rotScaleB0 = 1518500249

The arrays of rotation scales; rotScaleA1 and rotScaleB1 are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA1 = A3_16 /* specified in Annex B */

rotScaleB1 = B3_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA1 = A3_32 /* specified in Annex B */

rotScaleB1 = B3_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA1 = A3_64 /* specified in Annex B */

rotScaleB1 = B3_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA1 = A3_128 /* specified in Annex B */

rotScaleB1 = B3_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA1 = A3_256 /* specified in Annex B */

rotScaleB1 = B3_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA1 = A3_512 /* specified in Annex B */

rotScaleB1 = B3_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA1 = A3_1024 /* specified in Annex B */

rotScaleB1 = B3_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA1 = A3_2048 /* specified in Annex B */

rotScaleB1 = B3_2048 /* specified in Annex B */

 

The process for the inverse integer invertible DFT for two real sequences is as follows:

for( n = 1; n < quartDataLength; n ++ ) {

realVal0 = realVals0[ n ];

imagVal0 = imagVals0[ n ];

realVal1 = realVals0[ halfDataLength − n ];

imagVal1 = − imagVals0[ halfDataLength − n ];

RotateInverseLift( rotScaleA0, rotScaleB0, realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, imagVal0, imagVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA1[ n ], rotScaleB1[ n ], realVal1, imagVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, imagVal0, imagVal1);

 

realVals0[ n ] = realVal0;

imagVals0[ n ] = imagVal0;

realVals0[ halfDataLength − n ] = -realVal1;

imagVals0[ halfDataLength − n ] = imagVal1;

 

realVal0 = realVals1[ n ];

imagVal0 = imagVals1[ n ];

realVal1 = realVals0[ halfDataLength − n ];

imagVal1 = −imagVals0[ halfDataLength − n ];

RotateInverseLift( rotScaleA0, rotScaleB0, realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, imagVal0, imagVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA1[ n ], rotScaleB1[ n ], realVal1, imagVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, imagVal0, imagVal1 ); /* see clause 8.6.6*/

 

realVals1[ n ] = realVal0;

imagVals1[ n ] = imagVal0;

realVals1[ halfDataLength − n ] = -realVal1;

imagVals1[ halfDataLength − n ] = imagVal1;

}

imagVal0[ quartDataLength ] = −imagVal0[ quartDataLength ];

imagVals0[ 0 ] = −realVals0[ halfDataLength ];

RotateInverseLift( −rotScalA0, −rotScaleB0, realVals0[ 0 ], imagVals0[ 0 ] ); /* see clause 8.6.6*/

 

imagVal1[ quartDataLength ] = −imagVal1[ quartDataLength ];

imagVals1[ 0 ] = −realVals1[ halfDataLength ];

RotateInverseLift( −rotScalA0, −rotScaleB0, realVals1[ 0 ], imagVals1[ 0 ] ); /* see clause 8.6.6*/

 

IFFTLift( log2Length − 1, realVals0, imagVals0, realVals1, imagVals1 ); /* see clause 8.6.8 */

 

for( n = 0; n < halfDataLength; n ++ ) {

imagVals0[ halfDataLength + n ] = realVals0[ n ];

imagVals1[ halfDataLength + n ] = realVals1[ n ];

}

for( n = 0, k = 0; n < halfDataLength; n ++, k += 2 ) {

realVals0[ k ] = iImagVals0[ halfDataLength + n ];

realVals0[  k + 1 ] = imagVals0[ n ];

imagVals0[  halfDataLength + n ] = 0;

imagVals0[ n ] = 0;

realVals1[ k ] =I ImagVals1[ halfDataLength + n ];

realVals1[  k + 1 ] = imagVals1[ n ];

imagVals1[ halfDataLength + n ] = 0;

imagVals1[ n ] = 0;

}

8.4.12 Inverse integer invertible DFT for one real sequence (LiftRealIFFT)

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

Outputs of this process ( the process is in-place ):

— a modified array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length) − 1 )

— a modified array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength, halfDataLength, quartDataLength, rotScaleA0, and rotScaleB0 are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

— quartDataLength = halfDataLength >> 1

— rotScaleA0 = −889516852

— rotScaleB0 = 1518500249

The arrays of rotation scales; rotScaleA1 and rotScaleB1 are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA1 = A3_16 /* specified in Annex B */

rotScaleB1 = B3_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA1 = A3_32 /* specified in Annex B */

rotScaleB1 = B3_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA1 = A3_64 /* specified in Annex B */

rotScaleB1 = B3_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA1 = A3_128 /* specified in Annex B */

rotScaleB1 = B3_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA1 = A3_256 /* specified in Annex B */

rotScaleB1 = B3_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA1 = A3_512 /* specified in Annex B */

rotScaleB1 = B3_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA1 = A3_1024 /* specified in Annex B */

rotScaleB1 = B3_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA1 = A3_2048 /* specified in Annex B */

rotScaleB1 = B3_2048 /* specified in Annex B */

 

The process for the inverse integer invertible DFT for one real sequence is as follows:

for( n = 1; n < quartDataLength; n ++ ) {

realVal0 = realVals[ n ];

imagVal0 = imagVals[ n ];

realVal1 = realVals[ halfDataLength − n ];

imagVal1 = -imagVals[ halfDataLength − n ];

RotateInverseLift( rotScaleA0, rotScaleB0, realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, imagVal0, imagVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA1[ n ], rotScaleB1[ n ], realVal1, imagVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, realVal0, realVal1 ); /* see clause 8.6.6*/

RotateInverseLift( rotScaleA0, rotScaleB0, imagVal0, imagVal1 ); /* see clause 8.6.6*/

 

realVals[ n ] = realVal0;

imagVals[ n ] = imagVal0;

realVals[ halfDataLength − n ] = −realVal1;

imagVals[ halfDataLength − n ] = imagVal1;

 

}

imagVal[ quartDataLength ] = −imagVal[ quartDataLength ];

imagVals[ 0 ] = −realVals[ halfDataLength ];

RotateInverseLift( −rotScalA0, -rotScaleB0, realVals[ 0 ], imagVals[ 0 ] ); /* see clause 8.6.6*/

 

IFFTLiftSplit( log2Length − 1, realVals, imagVals ); /* see clause 8.6.9 */

 

for( n = 0; n < halfDataLength; n ++ ) {

imagVals0[ halfDataLength + n ] = realVals0[ n ];

}

for( n = 0, k = 0; n < halfDataLength; n ++, k += 2 ) {

realVals[ k ] = iImagVals[ halfDataLength + n ];

realVals[ k + 1 ] = imagVals[ n ];

imagVals[ halfDataLength + n ] = 0;

imagVals[ n ] = 0;

}

8.5 Inverse DCT transformation process for multiple channels

To take advantage of the reduced lifting steps by processing two channels simultaneously, for signals with two or more channels, the channels are grouped into pairs in the order that the channels appear in the signal. If the signal contains an odd number of channels, the last remaining channel uses the single channel processing.

 

if( EnableDCT = = 1 ) {

for( p = 0, n = 0; p < ( numChannels >> 1 ); p++, n += 2) {

IntDualIDCT(IntDCT2Config, signal[ n ], signal[ n+1 ]) /* see clause 8.6.2 */

}

if( numChannels & 0x1 ) {

IntIDCT(IntDCT2Config, signal[ numChannels − 1 ]) /* see clause 8.6.3 */

}

}

8.5.1 Mean value correction process

The final step to reproduce the signal waveform is to replace any DC bias in the original signal as specified in the following pseudo-code:

 

for( k = 0; k < block_length; k++ ) {

signal[ ch ][ k ] += MeanValueTrafoBlock;

}

8.5.2 Sample wise prediction decoding process

8.5.3 Overview

Input to this process are:

— the current channel index currCh,

— the current block position currBlockPos,

— the array of reconstructed samples of previous channels rec[ c ][ i ] with
Max( currCh − ( DepChMask & currCh ), 0 ) <= c < currCh and with 0 <= i < currBlockPos + ( 1 << Log2BlockSize ),

— the array of reconstructed samples of the current channel rec[ currCh ][ i ] with 0 <= i < currBlockPos,

— the value maxTemplateSize,

— the array of left residual values resiLeftCurr[ j ] with 0 <= j < maxTemplateSize,

— the array of reconstructed intermediate residual sample values resImdCurr[ i ] with 0 <= i < ( 1 << Log2BlockSize ).

Output to this process are the residual sample values res[ i ] with 0 <= i < ( 1 << Log2BlockSize ). These values are derived as follows:

— If SamplePredMode is equal SPM_OFF, for 0 <= i < ( 1 << Log2BlockSize ) one sets res[ i ] = resImdCurr[ i ].

— If SamplePredMode is equal to SPM_DIFFS, the process of clause 8.9.2 is invoked with blockSize set to
(1 << Log2BlockSize), resiLeftVal set to resiLeftCurr[ maxTemplateSize − 1 ] and resImd set to resImdCurr .

— If SamplePredMode is equal to SPM_SLOPE, the process of clause 8.9.3 is invoked with blockSize set to
( 1 << Log2BlockSize ), resiLeftValFirst set to resiLeftCurr[ maxTemplateSize − 1 ], resiLeftValSecond set to resiLeftCurr[ maxTemplateSize − 2 ] and resImd set to resImdCurr .

— If SamplePredMode is equal to SPM_HALF_SLOPE, the process of clause 8.9.4 is invoked with blockSize set to ( 1 << Log2BlockSize ), resiLeftValFirst set to resiLeftCurr[ maxTemplateSize − 1 ], resiLeftValSecond set to resiLeftCurr[ maxTemplateSize − 2 ] and resImd set to resImdCurr .

— If SamplePredMode is equal to SPM_LPF, the following applies:

— The variable fltrSzCurrCh is set to 1 << ( lpf_num_weights_idx + 1 ).

— The process from clause 8.9.5 is invoked with fltrSz set to fltrSzCurrCh to obtain the filter weights for the current channel wghtCurr[ k ] with 0 <= k < fSCurrCh.

— If lpf_prev_ch_flag is equal 1, the following applies:

— The variable lpfPrevChWeight is set to lpf_prev_ch_weight_sign_flag ? – lpf_prev_ch_weight_abs : lpf_prev_ch_weight_abs.

— The process from clause 8.9.7 is invoked with blockSize set to ( 1 << Log2BlockSize ), fltrSz set to fltrSzCurrCh, prevChScale set to lpfPrevChWeight, partialFilters set to 1 if currBlockPos < fltrSzCurrCh and set to 0 otherwise, w set to wghtCurr, refPrev[ l ] set to rec[ currCh − 1 – lpf_prev_ch_idx ][ l ], where 0 <= l < ( 1 << Log2BlockSize ), resiLeft[ k ] set to resiLeftCurr[ maxTemplateSize − fltrSzCurrCh + k ] for 0 <= k < fltrSzCurrCh and resImd set to resImdCurr.

Otherwise ( lpf_prev_ch_flag is not equal to 1 ), the following applies:

— The process from clause 8.9.6 is invoked with blockSize set to ( 1 << Log2BlockSize ), fltrSz set to fltrSzCurrCh, partialFilters set to 1 if currBlockPos < fltrSzCurrCh and set to 0 otherwise, w set to wghtCurr, resiLeft[ k ] set to resiLeftCurr[ maxTemplateSize − fltrSzCurrCh + k ] for 0 <= k < fltrSzCurrCh and resImd set to resImdCurr.

8.5.4 Sample wise one tap prediction decoding process

Input to this process are:

— a variable blockSize which determines the size of the current block,

— an adjacent left residual value resiLeftVal

— an array of intermediate reconstructed residual samples resImd[ j ] with 0 <= j < blockSize.

Output of this process are the reconstructed residual samples res[ i ] with 0 <= i < blockSize.

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to −maxPredVal − 1.

The array of input values q[ k ] with 0 <= k < blockSize + 1 is initialized with 0.

One sets q[ 0 ] = resiLeftVal

The following process is invoked:

Set j = 1

do

q[ j ] = q[ j − 1 ] + resImd[ j − 1  ]

j = j+1

while( j < blockSize + 1 )

For 0 <= i < blockSize one sets res[ i ] =Clip3( minResVal, maxResVal, q[ 1 + i ] ).

8.5.5 Sample wise full slope prediction decoding process

Input to this process are:

— a variable blockSize which determines the size of the current block,

— a directly adjacent left residual value resiLeftValFirst

— a penultimately adjacent left residual value resiLeftValSecond

— an array of intermediate reconstructed residual samples resImd[ j ] with 0 <= j < blockSize.

Output of this process are the reconstructed residual samples res[ i ] with 0 <= i < blockSize.

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to −maxPredVal − 1.

The array of input values q[ k ] with 0 <= k < blockSize + 2 is initialized with 0.

One sets q[ 0 ] = resiLeftValSecond and q[ 1 ] = resiLeftValFirst.

The following process is invoked:

Set j = 2.

do

q[ j ] = ( (q[ j − 1 ] − q[ j − 2 ] ) << 1 ) + resImd[ j − 2 ].

j = j+1

while( j < blockSize + 2 )

For 0 <= i < blockSize one sets res[ i ] =Clip3( minResVal, maxResVal, q[ 2 + i ] ).

8.5.6 Sample wise half slope prediction decoding process

Input to this process are:

— a variable blockSize which determines the size of the current block,

— a directly adjacent left residual value resiLeftValFirst

— a penultimately adjacent left residual value resiLeftValSecond

— an array of intermediate reconstructed residual samples resImd[ j ] with 0 <= j < blockSize.

Output of this process are the reconstructed residual samples res[ i ] with 0 <= i < blockSize.

The variable maxPredVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minPredVal is set to −maxPredVal − 1.

The array of input values q[ k ] with 0 <= k < blockSize + 2 is initialized with 0.

One sets q[ 0 ] = resiLeftValSecond and q[ 1 ] = resiLeftValFirst.

The following process is invoked:

Set j = 2.

do

q[ j ] = q[ j − 1 ] + ( ( q[ j − 1 ] − q[ j − 2 ] +1) >> 1 ) + resImd[ j − 2 ].

j = j+1

while( j < blockSize + 2 )

For 0 <= i < blockSize one sets res[ i ] =Clip3( minResVal, maxResVal, q[ 2 + i ] ).

8.5.7 Filter coefficient decoding process for linear predictive filtering

Input to this process is a filter size fltrSz.

Output of this process are the reconstructed filter coefficients w[ k ] with 0 <= k < fltrSz.

The variable weightPrec is set to 12.

The intermediate temporal coefficient values tempImdCoeff[ k ] with 0 <= k < fltrSz are defined as

tempImdCoeff[ k ] =( 32 − Abs( LPFWeightsCurr[ k ] ) ) << 1.

The temporal coefficient values tempCoeff[ k ] with 0 <= k < fltrSz are defined as

tempCoeff[ k ] =( ( 1 << 12 ) − tempImdCoeff[ k ]* tempImdCoeff[ k ] )*

( lpf_weight_sign_flag[ k ] > 0 ? − 1: 1 )

The following process is invoked:

Set a[ 0 ] = − ( 1 << 12 )

Set i = 1

do

set j = 1

do

b[ j ] = b[ j ] – ( ( tempCoeff[ i − 1 ]*a[ i − j ] + ( 1 << 11 ) ) >> 12 )

while( j <= i)

set j = 1

do

a[ j ] = b[ j ]

while ( j < i )

while( i <= fltrSz )

Set k = 0

do

w[ k ] = a[ k + 1 ]

while (k < fltrSz )

8.5.8 Single channel linear predictive filtering prediction decoding process

Input to this process are:

— a variable blockSize which specifies the size of the current block,

— a variable fltrSz which specifies the number of prediction filter coefficients,

— a variable partialFilters which specifies if the prediction for the first samples uses partial filters,

— an array of prediction filter coefficients w[ k ] with 0 <= k < fltrSz,

— an array of left adjacent residual samples resiLeft[ j ] with 0 <= j <fltrSz,

— an array of intermediate reconstructed residual samples resImd[ j ] with 0 <= j < blockSize.

Output of this process are the reconstructed residual samples res[ i ] with 0 <= i < blockSize.

The variable maxResVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minResVal is set to −maxPredVal − 1.

The array of input values q[ k ] with 0 <= k < blockSize + fltrSz is initialized with 0.

For 0 <= j < fltrSz one sets q[ j ] = resiLeft[ j ].

One sets leftShiftFltr = 12.

One sets offsetLeftShift = 1 << ( leftShiftFltr − 1 ).

If the variable partialFilters is equal to 1, the following process is invoked:

Set j = fltrSz

do

The process from clause 8.9.5 is invoked with fltrSz set to j − fltrSz to obtain the filter weights for the current channel wghtCurr[ k ] with 0 <= k < j − fltrSz.

q[ j ] = ( ( ( ) + offsetLeftShift) ) >> leftShiftFltr )+ resImd[ j − fltrSz ].

j = j+1

while( j < ( fltrSz << 1 ))

Otherwise ( partialFilters is equal to 0), set j = fltrSz.

Then, the following process is invoked:

do

q[ j ] = ( ( ( ) + offsetLeftShift) ) >> leftShiftFltr )+ resImd[ j − fltrSz ].

j = j+1

while( j < blockSize + fltrSz )

For 0 <= i < blockSize one sets res[ i ] =Clip3( minResVal, maxResVal, q[ fltrSz + i ] ).

8.5.9 Multi channel linear predictive filtering prediction decoding process

Input to this process are:

— a variable blockSize which specifies the size of the current block,

— a variable fltrSz which specifies the number of prediction filter coefficients,

— a variable prevChScale, which specifies the scaling factor for the sample values of a previous channel,

— a variable partialFilters which specifies if the prediction for the first samples uses partial filters,

— an array of prediction filter coefficients for the current channel w[ k ] with 0 <= k < fltrSz,

— an array of reconstructed sample values of a previous channel refPrev[ l ], where 0 <= l < blockSize.

— an array of left adjacent residual samples resiLeft[ j ] with 0 <= j < fltSz,

— an array of intermediate reconstructed residual samples resImd[ j ] with 0 <= j < blockSize.

Output of this process are the reconstructed residual samples res[ i ] with 0 <= i < blockSize.

The variable maxResVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1.

The variable minResVal is set to −maxResVal − 1.

The array of input values q[ k ] with 0 <= k < blockSize + fltrSz is initialized with 0.

For 0 <= j < fltrSz one sets q[ j ] = resiLeft[ j ].

One sets leftShiftFltr = 12.

One sets offsetLeftShift = 1 << ( leftShiftFltr − 1 ).

One sets scaleShift = 10.

One sets offsetScaleShift = 1 << ( scaleShift − 1 ).

If the variable partialFilters is equal to 1, the following process is invoked:

Set j = fltrSz

do

The process from clause 8.9.5 is invoked with fltrSz set to j − fltrSz to obtain the filter weights for the current channel wghtCurr[ k ] with 0 <= k < j − fltrSz.

q[ j ] = ( ( ( ) + offsetLeftShift ) ) >> leftShiftFltr )+ resImd[ j − fltrSz ].

j = j+1

while( j < ( fltrSz << 1 ))

Otherwise ( partialFilters is equal to 0), set j = fltrSz.

Then, the following process is invoked:

Set j = fltrSz

do

q[ j ] = ( ( ( ) +offsetLeftShift ) >> leftShiftFltr ) + resImd[ j − fltrSz ].

j = j + 1

while( j < blockSize + fltrSz )

Set k = fltrSz

do

q[ k ] += Clip3( minResVal, maxResVal,( + offsetScaleShift ) >> scaleShift ).

k = k+1

while( k < blockSize + fltrSz )

For 0 <= i < blockSize, res[ i ] is set equal to Clip3( minResVal, maxResVal, q[ fltrSz + i ] ).

8.6 Deblocking process

The time-domain deblocking process is the last operational step of the block-wise and channel-wise decoding process.

It is applied only when transform_present_flag associated with the given block and channel index currCh is equal to 1 and currBlockPos > 0 and when parameter cgps_deblocking_mode associated with the given channel group is greater than 0. Otherwise, all four steps below are bypassed and the reconstructed sample values rec[ currCh ] left unchanged.

 

Input to this process are:

— the current channel index currCh,

— the current block size blockSize,

the reconstructed sample values rec[ currCh ][ i ] with –4 <= i < blockSize.

Output to this process are the deblocked newly reconstructed sample values rec[ currCh ][ i ] with 0 <= i < blockSize.

 

The variable maxVal is set to ( 1 << ( BitDepthMax − 1 ) ) − 1 and the variable minVal is set to −maxVal − 1.

The deblocking process utilizes a three-step blocking detection algorithm, which is followed by the actual deblocking.

When transform_present_flag equals 1 and currBlockPos >= 4, the variable thresh is defined as the output tCoeff[ 0 ] resulting from invoking clause 8.4.1 on QuantIndices[ 0 ] = 1 with Log2BlockSize = 0 and transform_present_flag = 0, scaled by 1 << Max( 0, BitDepthMax – 12 ), and the following steps are applied to deblock sample values rec[ currCh ]:

— Step 1: linear fitting via fixed-point linear regression, on the four channel waveform samples on each side of the left boundary of the currently decoded block. Using each of the two linear models, the sample value between the first sample of the current and last sample of the previous block is estimated, and difference value valDiff is calculated. If valDiff ≠ 0 and |valDiff·2| is smaller than input bit depth dependent threshold thresh, proceed to step 2, otherwise abort.

The linear fit is applied by invoking the linear extrapolation process of clause 8.3.1 twice, first with array p = {rec[ currCh ][ –4 ], rec[ currCh ][ –3 ], rec[ currCh ][ –2 ], rec[ currCh ][ –1 ]}, szArr = 4 and szExt = 0, yielding slope, offset and meanValExtr of the left boundary side, and then with array p = {rec[ currCh ][ 3 ], rec[ currCh ][ 2 ], rec[ currCh ][ 1 ], rec[ currCh ][ 0 ]}, szArr = 4 and szExt = 0, yielding slope, offset and meanValExtr of the right boundary side. valDiff is set to the difference between the two meanValExtr values ( first minus second value ).

— Step 2: evaluation of each of the two linear models on the four samples on the corresponding side of the current block's left boundary and calculation of the 2 fitting errors ( sum of absolute distance-weighted differences between each line value and its associated actual sample value ). The evaluation is performed separately for each side, with scale = 4 – cgps_deblocking_mode and respective slope, offset and array p associated with that boundary side, as defined in step 1:

fitting error = 0;
for( ix = −15, i = 0; i < 4; ix += 10, i += 1 ) {
val = Clip3(− (231−1), (231−1), (offset + slope ix) >> 9);
fitting error += (scale << i) | val − p[ i ] | ;
}

If the product of both fitting error values is greater than or equal to zero, both errors are scaled by 2. Then, if both of the two errors are smaller than thresh, proceed to step 3, otherwise abort.

— Step 3: calculation of L1 norm of vector rec[ currCh ][ i ], yielding value sumAbsIn, and of a 1st-order high-pass filtered version of vector rec[ currCh ][ i ], yielding sumAbsHP, as follows:

samAbsIn = L1norm( rec[ currCh ][ i ] ),
sumAbsHP = L1norm( rec[ currCh ][ i ] – rec[ currCh ][ i – 1 ] ), 0 < i < blockSize,
where L1norm( x ) = sum( | x | ) and the values resulting for i < 1 are excluded in the summations. Value sumAbsHP is then modified as follows: sumAbsHP = max( sumAbsIn, sumAbsHP · 16 ).
If, for each fitting error of step 2, error sumAbsHP < thresh sumAbsIn ( current block signal is spectrally sufficiently low-pass to justify a deblocking ), proceed to step 4, otherwise abort.

— Step 4: execution of deblocking algorithm in-place on the first 4 reconstructed samples of the currently decoded block, by adding a fading ( away from boundary ) ramp signal using valDiff:

rec[ currCh ][ j ] = Clip3( minVal, maxVal, rec[ currCh ][ j ] + ( ( valDiff (7 – 2 j) + 4) >> 3 ) ), 0 <= j < 4.

9.0 Parsing process

9.1 General

Inputs to this process are bits from the stream packet syntax structure.

Outputs of this process are syntax element values.

This process is invoked when the descriptor of a syntax element in the syntax tables is equal to ev(k,m,n), ue(v), se(v), ae(ctxSet), aep() or aet() (see clauses 9.2, 9.3, and 9.5).

9.1.1 Parsing process for escaped values

This process is invoked when the descriptor of a syntax element in the syntax tables is equal to ev(k,m,n).

Inputs to this process are bits from the stream packet syntax structure and the variables k, m, n.

Outputs of this process are syntax element values.

Syntax elements coded as ev(k,m,n) are escaped-coded values that are coded with k bits, k + m bits, or k + m + n bits. The parsing process for escaped values is specified as follows:

 

val = read_bits( k )

if( val = = (1  <<  k) − 1 ) {

addVal = read_bits( m )

val += addVal

if( addVal = = (1  <<  m)  − 1 ) {

addVal = read_bits( n )

val += addVal

}

}

(62)

 

 

 

 

 

 

where the value returned from read_bits( ) is interpreted as a binary representation of an unsigned integer with most significant bit written first.

The value of a syntax element coded as ev(k,m,n) is set equal to val.

9.1.2 Parsing process for k-th order Exp-Golomb codes

9.1.3 General

This process is invoked when the descriptor of a syntax element in the syntax tables is equal to ue(v) or se(v).

Inputs to this process are bits from the bitstream.

Outputs of this process are syntax element values.

Syntax elements coded as ue(v) or se(v) are Exp-Golomb-coded with order k equal to 0. The parsing process for these syntax elements begins with reading the bits starting at the current location in the bitstream up to and including the first non-zero bit, and counting the number of leading bits that are equal to 0. This process is specified as follows:

 

leadingZeroBits = −1

for( b = 0; !b; leadingZeroBits ++ )

b = read_bits( 1 )

(63)

The variable codeNum is then assigned as follows:

 

codeNum = ( 2leadingZeroBits − 1 ) * 2k + read_bits( leadingZeroBits + k )

(64)

where the value returned from read_bits( leadingZeroBits ) is interpreted as a binary representation of an unsigned integer with most significant bit written first.

Table 9‑1 illustrates the structure of the 0-th order Exp-Golomb code by separating the bit string into "prefix" and "suffix" bits. The "prefix" bits are those bits that are parsed for the computation of leadingZeroBits, and are shown as either 0 or 1 in the bit string column of Table 9‑1. The "suffix" bits are those bits that are parsed in the computation of codeNum and are shown as xi in Table 9‑1, with i in the range of 0 to leadingZeroBits − 1, inclusive. Each xi is equal to either 0 or 1.

Table 9‑1 — Bit strings with "prefix" and "suffix" bits and assignment to codeNum ranges (informative)

Bit string form

Range of codeNum

1

0

0 1 x0

1..2

0 0 1 x1 x0

3..6

0 0 0 1 x2 x1 x0

7..14

0 0 0 0 1 x3 x2 x1 x0

15..30

0 0 0 0 0 1 x4 x3 x2 x1 x0

31..62

...

...

Table 9‑2 illustrates explicitly the assignment of bit strings to codeNum values.

Table 9‑2 — Exp-Golomb bit strings and codeNum in explicit form and used as ue(v) (informative)

Bit string

codeNum

1

0

0 1 0

1

0 1 1

2

0 0 1 0 0

3

0 0 1 0 1

4

0 0 1 1 0

5

0 0 1 1 1

6

0 0 0 1 0 0 0

7

0 0 0 1 0 0 1

8

0 0 0 1 0 1 0

9

...

...

Depending on the descriptor, the value of a syntax element is derived as follows:

— If the syntax element is coded as ue(v), the value of the syntax element is equal to codeNum.

— Otherwise (the syntax element is coded as se(v)), the value of the syntax element is derived by invoking the mapping process for signed Exp-Golomb codes as specified in clause 9.3.2 with codeNum as input.

9.1.4 Mapping process for signed Exp-Golomb codes

Input to this process is codeNum as specified in clause 9.3.1.

Output of this process is a value of a syntax element coded as se(v).

The syntax element is assigned to the codeNum by ordering the syntax element by its absolute value in increasing order and representing the positive value for a given absolute value with the lower codeNum. Table 9‑3 provides the assignment rule.

Table 9‑3 — Assignment of syntax element to codeNum for signed Exp-Golomb coded syntax elements se(v)

codeNum

syntax element value

0

0

1

1

2

−1

3

2

4

−2

5

3

6

−3

k

(−1)k + 1 * Ceil( k ÷ 2 )

9.2 Parsing process for un-truncated Rice (UTR) codes

This process is invoked when the descriptor of a syntax element in the syntax tables is equal to utr(c).

Inputs to this process are bits from the bitstream.

Output of this process is a value of a syntax element coded as utr(c).

Syntax elements coded as utr(c) are un-truncated Rice (UTR)-coded with “c” denoting the cRiceParam parameter. The parsing process for these syntax elements begins with reading the prefix bits starting at the current location in the bitstream up to and including the first zero bit. The prefixVal value is specified as follows:

 

prefixVal = 0

while( read_bits( 1 )  = =  1 )

prefixVal ++

(65)

Next, the parsing process continues with reading the suffix bits as follows:

 

suffixVal = read_bits( cRiceParam )

(66)

Finally, the value symbolVal is derived as follows:

 

symbolVal = suffixVal + ( prefixVal << cRiceParam )

(67)

The value of a syntax element coded as utr(c) is set equal to symbolVal.

9.2.1 CABAC parsing process for frame data

9.2.2 General

Inputs to this process are a request for a value of a syntax element and values of prior parsed syntax elements.

Output of this process is the value of the syntax element.

The initialization process as specified in clause 9.5.2 is invoked when starting the parsing of the general frame data syntax specified in clause 7.3.3.1.

The parsing of syntax elements proceeds as follows:

For each requested value of a syntax element a binarization is derived as specified in clause 9.5.3.

The binarization for the syntax element and the sequence of parsed bins determines the decoding process flow as described in clause 9.5.4.

9.2.3 Initialization process

General

Outputs of this process are initialized CABAC internal variables.

Each channel group maintains a decoding engine and associated context variables. The context variables of the arithmetic decoding engine associated with the active channel group are initialized as follows:

— The initialization process for context variables is invoked as specified in clause 9.5.2.2.

The decoding engine of each channel group maintains registers ivlCurrRange and ivlOffset both in 16 bit register precision. The registers ivlCurrRange and ivlOffset of the decoding engine associated with the active channel group are initialized by invoking the initialization process for the arithmetic decoding engine as specified in clause 9.5.2.3.

Initialization process for context variables

Outputs of this process are the initialized CABAC context variables of the decoding engine associated with the active channel group, indexed by:

— ctxSet as specified by the descriptor ae(ctxSet) of the associated syntax element,

— ctxTable and ctxIdx.

For each context variable, the three variables pBinCount, pStateIdx0 and pStateIdx1 are initialized as follows:

— Variable pBinCount is set to 63.

— Table 9‑5 to Table 9‑6 contain the values of the 12 bit variable initValue used in the initialization of context variables that are assigned to all syntax elements where the descriptor in the syntax tables of clause 7.3.3 is equal to ae(ctxSet).

— From the 12 bit table entry initValue, the two 2 bit variables qpPosProb0 and log2qpRange and the two 4 bit variables probStart and probEnd are derived as follows:

 

 

qpPosProb0 = ( 2 << ( initValue & 3 ) ) − 2

log2qpRange = ( ( initValue >> 2 ) & 3 ) + 3

probStart = ( ( initValue >> 4 ) & 15 ) * 8

probEnd = ( ( initValue >> 8 ) & 15 ) * 8

 

 

 

(68)

— The variables slopeMul and valAdd, used in the initialization of context variables, are derived from probStart, probEnd and log2qpRange as follows:

 

 

slopeMul = probEnd − probStart

valAdd = ( ( 1 << log2qpRange ) >> 1

 

(69)

— The two values assigned to pStateIdx0 and pStateIdx1 for the initialization are derived from cpgs_indep_init_block_qp. Given the variables m and n, the initialization is specified as follows:

 

 

currQP = ( cgps_qp >> 2 ) − qpPosProb0

preCtxState = ( currQP * slopeMul + ( probStart << log2qpRange ) + add ) >> log2qpRange

 

(70)

— The two values assigned to pStateIdx0 and pStateIdx1 for the initialization are derived as follows:

 

 

pStateIdx0 = Clip3( 32, 992, preCtxState << 3 ) − 512

pStateIdx1 = Clip3( 256, 7936, preCtxState << 6 ) − 4096

 

(71)

 

NOTE – The variables pStateIdx0 and pStateIdx1 correspond to the probability state indices further described in clause 9.5.4.3.

Table 9‑4 lists the range of ctxIdx values for which initialization is needed for each of the three initialization types, specified by the variable initType. It also lists the table number that includes the values of initValue needed for the initialization for each value of ctxIdx. The derivation of initType depends on the value of the cgps_ctx_init_flag syntax element and on the value of the if_ctx_init_mode syntax element. The variable initType is derived as follows:

 

if( !cgps_ctx_init_flag )

initType = 0

else if( if_ctx_init_mode = = 0 )

initType = 1

else

initType = 2

 

(72)

Table 9‑4 — Association of ctxIdx and syntax elements for each initializationType in the initialization process

Syntax structure

Syntax element

ctxTable

initType

0

1

2

general_frame_( )

block_split_log2

Table XX

0..8

9..17

18..26

prediction_trafo__block( )

block_matching_or_cross_channel_

pred_flag

Table XX

0

 

 

cross_channel_pred_flag

Table XX

0

 

 

block_pred_mode

Table XX

0

 

 

block_abs_delta_qp

Table XX

0..7

 

 

zlsb_present_flag

Table XX

0

 

 

transform_present_flag

Table XX

0

 

 

lms_flag

Table XX

0..1

 

 

lms_split_flag

Table XX

0

 

 

enable_ar_lms[ ]

Table XX

0..1

 

 

enable_cc_lms[ ]

Table XX

0..1

 

 

cross_channel_​prediction_data( )

cc_pred_offset_only_flag

Table XX

0

 

 

cc_pred_filter_flag

Table XX

0

 

 

cc_pred_filter_idx

Table XX

0

 

 

cc_pred_mult_hyp_flag

Table XX

0

 

 

cc_pred_abs_chd_greater0_flag[ ]

Table XX

0

 

 

cc_pred_abs_chd_minus1[ ]

Table XX

0..15

 

 

block_matching_​prediction_data( )

bm_pred_mult_hyp_flag

Table XX

0

 

 

bm_pred_add_offset_flag

Table XX

0

 

 

bm_pred_filter_flag[ ]

Table XX

0

 

 

bm_pred_filter_idx[ ]

Table XX

0

 

 

bm_pred_off_pred_prev_ch_flag[ ]

Table XX

0

 

 

bm_pred_abs_offd_greater0_flag[ ]

Table XX

0

 

 

bm_pred_abs_offd_minus1[ ]

Table XX

0..15

 

 

sample_pred_​mode( )

spred_lpf_or_diff_flag

Table XX

0

 

 

spred_lpf_flag

Table XX

0.

 

 

spred_rem_mode_idx

Table XX

0.

 

 

linear_predictive_​filtering_data( )

lpf_prev_ch_flag

Table XX

0

 

 

lpf_delta_coding_flag

Table XX

0

 

 

lpf_num_weights_idx

Table XX

0..9

 

 

abs_lpf_weight_greater0_flag[ ]

Table XX

0

 

 

abs_lpf_weight_minus1[ ]

Table XX

0

 

 

quant_res_sample_data( )

abs_tskip_coeff_gt0_flag[ ]

Table XXX

0

 

 

abs_tskip_coeff_offset[ ]

Table XXX

0..3

 

 

abs_tskip_coeff_rem_prefix[ ]

Table XXX

0..7

 

 

abs_tskip_coeff_rem_eg0_suffix[ ]

Table XXX

0..30

 

 

last_pos_index_gt0_flag

Table XXX

0

 

 

last_pos_index_rem

Table XXX

0..14

 

 

abs_trafo_coeff_gt0_flag[ ]

Table XXX

0..53

 

 

abs_trafo_parity_flag[ ]

Table XXX

0

 

 

abs_trafo_coeff_offset[ ]

Table XXX

0..8

 

 

abs_trafo_coeff_remainder[ ]

Table XXX

0..30

31..61

62..92

mean_value_trafo_block( )

mean_value_sig_flag

Table XXX

0

 

 

Table 9‑5 — Specification of initValue for ctxIdx of block_split_log2

Initialization variable

ctxIdx of block_split_log2

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

initValue

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

16

17

18

19

20

21

22

23

24

25

26

 

 

 

 

 

initValue

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Add init tables later.

Table 9‑6 — Specification of initValue for ctxIdx of abs_trafo_coeff_remainder

Initialization variable

ctxIdx of abs_trafo_coeff_remainder

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

initValue

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Initialization process for the arithmetic decoding engine

Outputs of this process are the initialized decoding engine registers ivlCurrRange and ivlOffset of the decoding engine associated with the active channel group, both in 16 bit register precision.

The status of the arithmetic decoding engine is represented by the variables ivlCurrRange and ivlOffset. In the initialization procedure of the arithmetic decoding process, ivlCurrRange is set equal to 510 and ivlOffset is set equal to the value returned from read_bits( 9 ) interpreted as a 9 bit binary representation of an unsigned integer with the most significant bit written first.

The bitstream shall not contain data that result in a value of ivlOffset being equal to 510 or 511.

NOTE – The description of the arithmetic decoding engine in this Specification utilizes the 16-bit register precision. However, a minimum register precision of 9 bits is required for storing the values of the variables ivlCurrRange and ivlOffset after invocation of the arithmetic decoding process ( DecodeBin ) as specified in clause 9.5.4.3. The arithmetic decoding process for a binary decision ( DecodeDecision ) as specified in clause 9.5.4.3.2 and the decoding process for a binary decision before termination ( DecodeTerminate ) as specified in clause 9.5.4.3.5 require a minimum register precision of 9 bits for the variables ivlCurrRange and ivlOffset. The bypass decoding process for binary decisions ( DecodeBypass ) as specified in clause 9.5.4.3.4 requires a minimum register precision of 10 bits for the variable ivlOffset and a minimum register precision of 9 bits for the variable ivlCurrRange.

9.2.4 Binarization process

General

Input to this process is a request for a syntax element.

Output of this process is the binarization of the syntax element.

Table 9‑7 specifies the type of binarization process associated with each syntax element and corresponding inputs.

The specification of the truncated Rice ( TR ) binarization process, the un-truncated Rice binarization process ( UTR ), the truncated binary ( TB ) binarization process, the k-th order Exp-Golomb ( EGk ) binarization process, the limited k-th order Exp-Golomb ( LEGk ) binarization process, and the fixed-length ( FL ) binarization process are given in clauses 0 through 9.5.3.7, respectively.

Table 9‑7 — Syntax elements and associated binarizations

Syntax structure

Syntax element

Binarization

Process

Input parameters

general_frame_​data( )

end_of_frame_sequence_flag

FL

cMax = 1

end_of_truncated_frame_sequence_

flag

FL

cMax = 1

end_of_frame_one_bit

FL

cMax = 1

block_split_log2

TR

cMax = MaxSplitDepth, cRiceParam = 0

prediction_trafo_data_block ( )

 

 

 

block_matching_or_cross_channel_

pred_flag

FL

cMax = 1

cross_channel_pred_flag

FL

cMax = 1

block_pred_mode

FL

cMax =2

block_abs_delta_qp

LEG0

maxPreExtLen = cgps_max_abs_delta_qp_idx

block_delta_qp_sign_flag

FL

cMax = 1

zlsb_present_flag

FL

cMax = 1

num_zlsb_minus1

EG0

-

transform_present_flag

FL

cMax = 1

transform_dst_flag

FL

cMax = 1

lms_flag

FL

cMax = 1

lms_split_flag

FL

cMax = 1

enable_ar_lms[ ]

FL

cMax = 1

enable_cc_lms[ ]

FL

cMax = 1

cross_channel_​prediction_data( )

cc_pred_offset_only_flag

FL

cMax = 1

cc_pred_filter_flag

FL

cMax = 1

cc_pred_filter_idx

FL

cMax = 1

cc_pred_mult_hyp_flag

FL

cMax = 1

cc_pred_abs_chd_greater0_flag[ ]

FL

cMax = 1

cc_pred_abs_chd_minus1[ ]

LEG0

maxPreExtLen = 15

cc_pred_chd_sign_flag[ ]

FL

cMax = 1

block_matching_​prediction_data( )

bm_pred_mult_hyp_flag

FL

cMax = 1

bm_pred_add_offset_flag

FL

cMax = 1

bm_pred_filter_flag[ ]

FL

cMax = 1

bm_pred_filter_idx[ ]

FL

cMax = 1

bm_pred_off_pred_prev_ch_flag[ ]

FL

cMax = 1

bm_pred_abs_offd_greater0_flag[ ]

FL

cMax = 1

bm_pred_abs_offd_minus1[ ]

LEG0

maxPreExtLen = 15

bm_pred_offd_sign_flag[ ]

FL

cMax = 1

sample_pred_mode( )

spred_lpf_or_diff_flag

FL

cMax = 1

spred_lpf_flag

FL

cMax = 1

spred_rem_mode_idx

FL

cMax = 2

linear_predictive_​filtering_data( )

lpf_prev_ch_flag

FL

cMax = 1

lpf_prev_ch_idx

EG0

-

lpf_prev_ch_weight_abs

EG0

-

lpf_prev_ch_weight_sign_flag

FL

cMax = 1

lpf_delta_coding_flag

FL

cMax = 1

lpf_num_weights_idx

TR

cMax = 6, cRiceParam = 1

abs_lpf_weight_greater0_flag[ ]

FL

cMax = 1

abs_lpf_weight_minus1[ ]

9.5.3.8

lpf_delta_coding_flag , filter coefficient index i, number of filter weights LPFNumWeightsCurr

lpf_weight_sign_flag[ ]

FL

cMax = 1

quant_res_sample_data( )

coeff_bypass_value[ ]

FL

cMax = ( 1 << IntBitDepth ) − 1

abs_tskip_coeff_gt0_flag[ ]

FL

cMax = 1

abs_tskip_coeff_offset[ ]

TR

cMax = NumTSkipGtxFlags, cRiceParam = 0

abs_tskip_coeff_rem_prefix[ ]

TR

cMax = MaxTSkipRemPrefix, cRiceParam = 0

abs_tskip_coeff_rem_fl_suffix[ ]

FL

cMax = TSkipRiceParameter

abs_tskip_coeff_rem_eg0_suffix[ ]

EG0

-

tskip_coeff_sign_flag[ ]

FL

cMax = 1

last_pos_index_gt0_flag

FL

cMax = 1

last_pos_index_rem

LEG0

maxPreExtLen = Log2BlockSize − Log2SbbSize − 1

last_pos_index_sign

FL

cMax = 1

abs_trafo_coeff_gt0_flag[ ]

FL

cMax = 1

abs_trafo_parity_flag[ ]

FL

cMax = 1

abs_trafo_coeff_offset[ ]

TR

cMax = NumTCoeffGtxFlags, cRiceParam = 0

abs_trafo_coeff_remainder[ ]

EG0

-

trafo_coeff_sign_flag[ ]

FL

cMax = 1

mean_value_trafo_block

mean_value_sig_flag

FL

cMax = 1

mean_value_abs_rem

EG0

-

mean_value_sign_flag

FL

cMax = 1

Untruncated Rice binarization process

Input to this process is a request for a Untruncated Rice ( UTR ) binarization and cRiceParam > 0.

Output of this process is the UTR binarization associating each value symbolVal with a corresponding bin string.

A UTR bin string is a concatenation of a prefix bin string and, when present, a suffix bin string.

For the derivation of the prefix bin string, the following applies:

— The prefix value of symbolVal, prefixVal, is derived as follows:

 

 

prefixVal = symbolVal  >>  cRiceParam

(73)

— The prefix of the TR bin string is specified as follows:

— The prefix bin string is a bit string of length prefixVal + 1 indexed by binIdx. The bins for binIdx less than prefixVal are equal to 1. The bin with binIdx equal to prefixVal is equal to 0. Table 9‑8 illustrates the bin strings of this unary binarization for prefixVal.

The suffix of the TR bin string is present and it is derived as follows:

— The suffix value suffixVal is derived as follows:

 

 

suffixVal = symbolVal − ( prefixVal  <<  cRiceParam )

(74)

— The suffix of the UTR bin string is specified by invoking the fixed-length (FL) binarization process as specified in clause 9.5.3.7 for suffixVal with a cMax value equal to ( 1  <<  cRiceParam ) − 1.

Truncated Rice binarization process

Input to this process is a request for a truncated Rice ( TR ) binarization, cMax and cRiceParam.

Output of this process is the TR binarization associating each value symbolVal with a corresponding bin string.

A TR bin string is a concatenation of a prefix bin string and, when present, a suffix bin string.

For the derivation of the prefix bin string, the following applies:

— The prefix value of symbolVal, prefixVal, is derived as follows:

 

 

prefixVal = symbolVal  >>  cRiceParam

(75)

— The prefix of the TR bin string is specified as follows:

— If prefixVal is less than cMax  >>  cRiceParam, the prefix bin string is a bit string of length prefixVal + 1 indexed by binIdx. The bins for binIdx less than prefixVal are equal to 1. The bin with binIdx equal to prefixVal is equal to 0. Table 9‑8 illustrates the bin strings of this unary binarization for prefixVal.

— Otherwise, the bin string is a bit string of length cMax  >>  cRiceParam with all bins being equal to 1.

Table 9‑8 — Bin string of the unary binarization (informative)

prefixVal

Bin string

0

0

 

 

 

 

 

1

1

0

 

 

 

 

2

1

1

0

 

 

 

3

1

1

1

0

 

 

4

1

1

1

1

0

 

5

1

1

1

1

1

0

...

 

 

 

 

 

 

binIdx

0

1

2

3

4

5

When cMax is greater than symbolVal and cRiceParam is greater than 0, the suffix of the TR bin string is present and it is derived as follows:

— The suffix value suffixVal is derived as follows:

 

 

suffixVal = symbolVal − ( prefixVal  <<  cRiceParam )

(76)

— The suffix of the TR bin string is specified by invoking the fixed-length ( FL ) binarization process as specified in clause 9.5.3.7 for suffixVal with a cMax value equal to ( 1  <<  cRiceParam ) − 1.

NOTE – For the input parameter cRiceParam = 0, the TR binarization is exactly a truncated unary binarization and it is always invoked with a cMax value equal to the largest possible value of the syntax element being decoded.

Truncated binary (TB) binarization process

Input to this process is a request for a TB binarization for a syntax element with value synVal and cMax. Output of this process is the TB binarization of the syntax element.The bin string of the TB binarization process of a syntax element synVal is specified as follows:

 

n = cMax + 1

k = Floor( Log2( n ) )

u = ( 1  <<  ( k + 1 ) ) − n

 

 

(77)

— If synVal is less than u, the TB bin string is derived by invoking the FL binarization process specified in clause 9.5.3.7 for synVal with a cMax value equal to ( 1  <<  k ) − 1.

— Otherwise ( synVal is greater than or equal to u ), the TB bin string is derived by invoking the FL binarization process specified in clause 9.5.3.7 for ( synVal + u ) with a cMax value equal to ( 1  <<  ( k + 1 ) ) − 1.

k-th order Exp-Golomb binarization process

Inputs to this process is a request for a k-th order Exp-Golomb ( EGk ) binarization.

Output of this process is the EGk binarization associating each value symbolVal with a corresponding bin string.

The bin string of the EGk binarization process for each value symbolVal is specified as follows, where each call of the function put( X ), with X being equal to 0 or 1, adds the binary value X at the end of the bin string:

 

absV = Abs( symbolVal )

stopLoop = 0

do

if( absV >= ( 1 << k ) ) {

put( 1 )

absV = absV − ( 1 << k )

k++

} else {

put( 0 )

while( k− − )

put( ( absV >> k ) & 1 )

stopLoop = 1

}

while( !stopLoop )

 

 

(78)

NOTE – The specification for the k-th order Exp-Golomb ( EGk ) code uses 1s and 0s in reverse meaning for the unary part of the Exp-Golomb code of k-th order as specified in clause 9.3.

Limited k-th order Exp-Golomb binarization process

Inputs to this process is a request for a limited k-th order Exp-Golomb ( EGk ) binarization, the order k, the variables maxPreExtLen and truncSuffixLen.

Output of this process is the limited EGk binarization associating each value symbolVal with a corresponding bin string.

When truncSuffixLen is not specified as input to this process, the value of truncSuffixLen is inferred to be equal to maxPreExtLen + k.

The bin string of the limited EGk binarization process for each value symbolVal is specified as follows, where each call of the function put( X ), with X being equal to 0 or 1, adds the binary value X at the end of the bin string:

 

codeValue = symbolVal >> k

preExtLen = 0

while( ( preExtLen < maxPreExtLen ) && ( codeValue > ( ( 2 << preExtLen ) − 2 ) ) ) {

preExtLen++

put( 1 )

}

if( preExtLen = = maxPreExtLen )

escapeLength = truncSuffixLen

else {

escapeLength = preExtLen + k

put( 0 )

}

symbolVal = symbolVal − ( ( ( 1 << preExtLen ) − 1 ) << k )

while( ( escapeLength− − ) > 0 )

put( ( symbolVal >> escapeLength ) & 1 )

(79)

Fixed-length binarization process

Inputs to this process are a request for a fixed-length ( FL ) binarization and cMax.

Output of this process is the FL binarization associating each value symbolVal with a corresponding bin string.

FL binarization is constructed by using the fixedLength‑bit unsigned integer bin string of the symbol value symbolVal, where fixedLength = Ceil( Log2( cMax + 1 ) ). The indexing of bins for the FL binarization is such that the binIdx = 0 relates to the most significant bit with increasing values of binIdx towards the least significant bit.

Binarization process for abs_lpf_weight_minus1

Input to this process is a request for the binarization of abs_lpf_weight_minus1[ ], the number of

filter coefficients LPFNumWeightsCurr, the filter coefficient index i and the syntax element lpf_delta_coding_flag.

Output of this process is a binarization of abs_lpf_weight_minus1[ i ].

The variable cMax is derived as follows:

— If lpf_delta_coding_flag is equal to 0, cMax is set equal to 32.

— Otherwise ( lpf_delta_coding_flag is not equal to 0 ), cMax is set equal to 64.

The variable cRiceParam is derived as

cRiceParam = Max( 2, 5 − ( (i + 3 ) >> 1 ) ) − 1.

The binarization of abs_lpf_weight_minus1[ i ] is specified by invoking the TR binarization process as specified in clause 0 with the variables cMax and cRiceParam as inputs.

9.2.5 Decoding process flow

General

Inputs to this process are:

— all bin strings of the binarization of the requested syntax element as specified in clause 9.5.3,

— the descriptor of the requested syntax element.

Output of this process is the value of the syntax element.

This process specifies how each bin of a bin string is parsed for each syntax element. After parsing each bin, the resulting bin string is compared to all bin strings of the binarization of the syntax element and the following applies:

— If the bin string is equal to one of the bin strings, the corresponding value of the syntax element is the output.

— Otherwise ( the bin string is not equal to one of the bin strings ), the next bit is parsed.

While parsing each bin, the variable binIdx is incremented by 1 starting with binIdx being set equal to 0 for the first bin.

The parsing of each bin is specified by the following two ordered steps:

1. If the descriptor of the requested syntax element is ae(ctxSet), the derivation process for ctxTable, ctxIdx, and bypassFlag as specified in clause 9.5.4.2 is invoked with binIdx as input and ctxTable, ctxIdx and bypassFlag as outputs.

i) Otherwise, if the descriptor of the requested syntax element is aet(), the variables ctxTable, ctxIdx, and bypassFlag are set to 0.

ii) Otherwise ( the descriptor of the requested syntax element is aep() ), the variables ctxTable and ctxIdx are set to 0 and bypassFlag is set to 1.

2. The arithmetic decoding process as specified in clause 9.5.4.3 is invoked with ctxTable, ctxIdx, and bypassFlag as inputs and the value of the bin as output.

Derivation process for ctxTable, ctxIdx and bypassFlag

General

Input to this process is the position of the current bin within the bin string, binIdx.

Outputs of this process are ctxTable, ctxIdx and bypassFlag.

The values of ctxTable, ctxIdx and bypassFlag are derived as follows based on the entries for binIdx of the corresponding syntax element in Table 9‑9:

— If the entry in Table 9‑9 is not equal to "bypass" and not equal to "na", the following applies:

— ctxTable is specified in Table 9‑4

— The variable ctxInc is specified by the corresponding entry in Table 9‑9 and when more than one value is listed in Table 9‑9 for a binIdx, the assignment process for ctxInc for that binIdx is further specified in the clauses given in parenthesis.

— The variable ctxIdxOffset set equal to the smallest value of ctxIdx is specified in Table 9‑4 for the current value of initType and the current syntax element.

— ctxIdx is set equal to the sum of ctxInc and ctxIdxOffset.

— bypassFlag is set equal to 0.

— Otherwise, if the entry in Table 9‑9 is equal to "bypass", the following applies:

— ctxTable is set equal to 0.

— ctxIdx is set equal to 0.

— bypassFlag is set equal to 1.

— Otherwise (the entry in Table 9‑9 is equal to "na"), the values of binIdx do not occur for the corresponding syntax element.

Table 9‑9 — Assignment of ctxInc to syntax elements with context coded bins

Syntax element

binIdx

0

1

2

3

4

>= 5

block_split_log2

Min( binIdx, 8 )

block_matching_or_cross_channel_
pred_flag

0

na

na

na

na

na

cross_channel_pred_flag

0

na

na

na

na

na

block_pred_mode

0

bypass

na

na

na

na

block_abs_delta_qp

Min( binIdx, 7 )

zlsb_present_flag

0

na

na

na

na

na

transform_present_flag

0

na

na

na

na

na

lms_flag

0..1
(clause 9.5.4.2.2)

na

na

na

na

na

lms_split_flag

0

na

na

na

na

na

enable_ar_lms[ i ]

i

na

na

na

na

na

enable_cc_lms[ i ]

i

na

na

na

na

na

cc_pred_offset_only_flag

0

na

na

na

na

na

cc_pred_filter_flag

0

na

na

na

na

na

cc_pred_filter_idx

0

na

na

na

na

na

cc_pred_mult_hyp_flag

0

na

na

na

na

na

cc_pred_abs_chd_greater0_flag[ ]

0

na

na

na

na

na

cc_pred_abs_chd_minus1[ ]
(if the bin with binIdx is part of the prefix code of the limited EG0 binarization)

Min( binIdx, 15 )

cc_pred_abs_chd_minus1[ ]
(if the bin with binIdx is part of the fixed-length suffix code of the limited EG0 binarization)

bypass

bypass

bypass

bypass

bypass

bypass

bm_pred_mult_hyp_flag

0

na

na

na

na

na

bm_pred_add_offset_flag

0

nan

nan

nan

nan

nan

bm_pred_filter_flag[ ]

0

na

na

na

na

na

bm_pred_filter_idx[ ]

0

na

na

na

na

na

bm_pred_off_pred_prev_ch_flag[ ]

0

na

na

na

na

na

bm_pred_abs_offd_greater0_flag[ ]

0

na

na

na

na

na

bm_pred_abs_offd_minus1[ ]
(if the bin with binIdx is part of the prefix code of the limited EG0 binarization)

Min( binIdx, 15 )

bm_pred_abs_offd_minus1[ ]
(if the bin with binIdx is part of the fixed-length suffix code of the limited EG0 binarization)

bypass

bypass

bypass

bypass

bypass

bypass

spred_lpf_or_diff_flag

0

Na

na

na

na

na

spred_lpf_flag

0

Na

na

na

na

na

spred_rem_mode_idx

0

bypass

na

na

na

na

lpf_prev_ch_flag

0

na

na

na

na

na

lpf_delta_coding_flag

0

na

na

na

na

na

lpf_num_weights_idx

0

1 if bin at index 0 is equal to 1, otherwise bypass

bypass

bypass

na

na

abs_lpf_weight_greater0_flag[ ]

0

na

na

na

na

na

abs_lpf_weight_minus1[ ]
(if the bin with binIdx is part of the fixed length suffix code of the Truncated Rice binarization)

Min( binIdx, 9 )

abs_lpf_weight_minus1[ ]
(if the bin with binIdx is part of the fixed length suffix code of the Truncated Rice binarization)

bypass

bypass

bypass

bypass

bypass

bypass

abs_tskip_coeff_gt0_flag[ ]

0

na

na

na

na

na

abs_tskip_coeff_offset[ ]

Min( binIdx, NumTSkipGtxFlags )

abs_tskip_coeff_rem_prefix[ ]

Min( binIdx, MaxTSkipRemPrefix )

abs_tskip_coeff_rem_eg0_suffix[ ]
(if the bin with binIdx is part of the unary prefix code of the EG0 binarization)

Min( binIdx, 30 )

abs_tskip_coeff_rem_eg0_suffix[ ]
(if the bin with binIdx is part of the fixed-length suffiox code of the EG0 binarization)

bypass

bypass

bypass

bypass

bypass

bypass

last_pos_index_gt0_flag

0

na

na

na

na

Na

last_pos_index_rem
(if the bin with binIdx is part of the unary prefix code of the limited EG0 binarization)s

Min( binIdx, 14 )

abs_trafo_coeff_gt0_flag[ ]

0..53
(clause 9.5.4.2.3)

na

na

na

na

na

abs_trafo_parity_flag

0

na

na

na

na

na

abs_trafo_coeff_offset[ ]

0..8
(clause 9.5.4.2.4)

abs_trafo_coeff_remainder[ ]
(if the bin with binIdx is part of the unary prefix code of the EG0 binarization)

Min( binIdx, 30 )

abs_trafo_coeff_remainder[ ]
(if the bin with binIdx is part of the fixed-length suffiox code of the EG0 binarization)

bypass

bypass

bypass

bypass

bypass

bypass

mean_value_sig_flag

0

na

na

na

na

na

Derivation process of ctxInc for the syntax element lms_flag

Output of this process is the variable ctxInc.

If block_matching_or_cross_channel_pred_flag is equal to 1 and cross_channel_pred_flag is equal to 0, ctxInc is set equal to 0. Otherwise ( block_matching_or_cross_channel_pred_flag is equal to 0 or cross_channel_pred_flag is equal to 1), ctxInc is set equal to 1.

Derivation process of ctxInc for the syntax element abs_trafo_coeff_gt0_flag

Inputs to this process is the location k of the current quantization index.

Output of this process is the variable ctxInc.

The variable templateClass is derived as templateClass = Min ( 2, TemplateSum ).

The variable posClass is derived as specified by the following pseudo-code:

 

posThresholds[ ] = { 0, 1, 2, 3, 7, 11, 15, 23 }

posClass = 0

for( n = 0; n < 8 ; n = n + 1 )

if( k > posThresholds[ n ] )

posClass += 1

(80)

The variable ctxInc is derived by

 

ctxInc = 27 * ( QState & 1 ) + 3 * posClass + templateClass

(81)

Derivation process of ctxInc for the syntax element abs_trafo_coeff_offset

Inputs is the location k of the current quantization index.

Output of this process is the variable ctxInc.

The variable posClass is derived as specified by the following pseudo-code:

 

posThresholds[ ] = { 0, 1, 2, 3, 7, 11, 15, 23 }

posClass = 0

for( n = 0; n < 8 ; n = n + 1 )

if( k > posThresholds[ n ] )

posClass += 1

(82)

 

 

 

 

The variable ctxInc is set equal to posClass.

Arithmetic decoding process

General

Inputs to this process are:

— the variables ctxTable, ctxIdx, and bypassFlag, as derived in clause 9.5.4.2,

— the state variables ivlCurrRange and ivlOffset of the arithmetic decoding engine associated with the active channel group.

Output of this process is the value of the bin.

The decoding of the value of a bin is specified as follows:

— If bypassFlag is equal to 1, DecodeBypass( ) as specified in clause 9.5.4.3.4 is invoked.

— Otherwise, if bypassFlag is equal to 0, ctxTable is equal to 0, and ctxIdx is equal to 0, DecodeTerminate( ) as specified in clause 9.5.4.3.5 is invoked.

— Otherwise ( bypassFlag is equal to 0 and ctxTable is not equal to 0 ), DecodeDecision( ctxSet, ctxTable, ctxIdx ) as specified in clause 9.5.4.3.2 is invoked where ctxSet is from the descriptor ae(ctxSet) of the requested syntax element.

NOTE – Arithmetic coding is based on the principle of recursive interval subdivision. Given a probability estimation p( 0 ) and p( 1 ) = 1 − p( 0 ) of a binary decision ( 0, 1 ), an initially given code sub-interval with the range ivlCurrRange would be subdivided into two sub-intervals having range p( 0 ) * ivlCurrRange and ivlCurrRange − p( 0 ) * ivlCurrRange, respectively. Depending on the decision, which has been observed, the corresponding sub-interval would be chosen as the new code interval, and a binary code string pointing into that interval would represent the sequence of observed binary decisions. It is useful to distinguish between the most probable symbol ( MPS ) and the least probable symbol ( LPS ), so that the binary decisions have to be identified as either MPS or LPS, rather than 0 or 1. Given this terminology, each context is specified by the probability pLPS of the LPS and the value of MPS ( valMps ), which is either 0 or 1. The arithmetic core engine in this Specification has the following two distinct properties:

— The range ivlCurrRange representing the state of the coding engine and the probability estimate are quantized to reduced-precision values to allow for a reduced-precision multiplication to determine the product ivlCurrRange and the probability estimate.

— For syntax elements or parts thereof for which an approximately uniform probability distribution is assumed to be given a separate simplified encoding and decoding bypass process is used.

Arithmetic decoding process for a binary decision
General

Inputs to this process are:

— the variables ctxSet, ctxTable, and ctxIdx,

— the variables ivlCurrRange and ivlOffset of the arithmetic decoding engine associated with the active channel group.

Outputs of this process are the decoded value binVal, and the updated variables ivlCurrRange and ivlOffset.

— The derivation process for ivlLpsRange and valMps as specified in clause 9.5.4.3.2.2 is invoked with ctxSet, ctxTable, and ctxIdx as input and ivlCurrRange and valMps as outputs.

— The variable ivlCurrRange is set equal to ivlCurrRange − ivlLpsRange and the following applies:

— If ivlOffset is greater than or equal to ivlCurrRange, the variable binVal is set equal to 1 − valMps, ivlOffset is decremented by ivlCurrRange, and ivlCurrRange is set equal to ivlLpsRange.

— Otherwise, the variable binVal is set equal to valMps.

The state transition process as specified in clause 9.5.4.3.2.2 is invoked with binVal and the context variable associated with ctxSet, ctxTable, and ctxIdx as input. Depending on the current value of ivlCurrRange, renormalization is performed as specified in clause 9.5.4.3.3.

Derivation process for ivlLpsRange and valMps

Inputs to this process are:

— the variables ctxSet, ctxTable, and ctxIdx,

— the variable ivlCurrRange of the arithmetic coding engine associated with the active channel group.

Outputs of this process are the variables ivlLpsRange and valMps.

The values of the variables ivlLpsRange and valMps are derived as follows:

— Given the current value of ivlCurrRange, the variable qRangeIdx is derived as follows:

qRangeIdx = ( ivlCurrRange − 256 ) >> 5

— Given qRangeIdx, and the variables pStateIdx0 and pStateIdx1 associated with ctxSet, ctxTable and ctxIdx, the variables valMps and ivlLpsRange are derived as follows:

rangeTabLps[ ][ ] =

{

{ 128, 142, 156, 171, 185, 199, 213, 228 }, { 112, 125, 137, 150, 162, 175, 187, 200 },

{ 97, 108, 119, 130, 141, 152, 163, 174 }, { 84, 93, 103, 112, 121, 131, 140, 150 },

{ 74, 82, 90, 99, 107, 115, 123, 132 }, { 65, 72, 79, 87, 94, 101, 108, 116 },

{ 57, 63, 70, 76, 82, 89, 95, 102 }, { 50, 56, 61, 67, 73, 78, 84, 90 },

{ 45, 50, 55, 60, 65, 70, 75, 80 }, { 39, 43, 48, 52, 56, 61, 65, 70 },

{ 34, 38, 42, 46, 50, 54, 58, 62 }, { 30, 33, 37, 40, 43, 47, 50, 54 },

{ 27, 30, 33, 36, 39, 42, 45, 48 }, { 23, 26, 28, 31, 34, 36, 39, 42 },

{ 20, 22, 24, 27, 29, 31, 33, 36 }, { 18, 20, 22, 24, 26, 28, 30, 32 },

{ 15, 17, 19, 21, 22, 24, 26, 28 }, { 14, 16, 17, 19, 21, 22, 24, 26 },

{ 12, 13, 15, 16, 17, 19, 20, 22 }, { 11, 12, 13, 15, 16, 17, 18, 20 },

{ 10, 11, 12, 13, 14, 15, 16, 18 }, { 9, 10, 11, 12, 13, 14, 15, 16 },

{ 7, 8, 9, 10, 11, 12, 13, 14 }, { 7, 8, 9, 10, 11, 12, 13, 14 },

{ 5, 6, 6, 7, 8, 8, 9, 10 }, { 5, 6, 6, 7, 8, 8, 9, 10 },

{ 4, 5, 5, 6, 6, 7, 7, 8 }, { 4, 5, 5, 6, 6, 7, 7, 8 },

{ 3, 3, 4, 4, 4, 5, 5, 6 }, { 3, 3, 4, 4, 4, 5, 5, 6 },

{ 2, 2, 2, 3, 3, 3, 3, 4 }, { 2, 2, 2, 3, 3, 3, 3, 4 }

}

pState = ( pStateIdx1 + 8 * pStateIdx0 ) >> 8

valMps = pState >= 0 ? 1 : 0

ivlLpsRange = rangeTabLps[ Abs( pState ) ][ qRangeIdx ]

State transition process

Inputs to this process are the decoded value binVal and the current context variable.

Outputs of this process are the updated pBinCount , pStateIdx0, and pStateIdx1 associated with the current context variable.

Depending on the decoded value binVal, the update of the three variables pBinCount, pStateIdx0, and pStateIdx1 associated with the current context variable is derived as follows:

transitionTable[ ] =

{

157, 143, 129, 115, 101, 87, 73, 59, 45, 35, 29, 23, 17, 13, 9, 5,

4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0

}

signVal = 2 * binVal − 1

if( pBinCount > 0) {

pStateIdx0 += signVal * ( transitionTable[ 16 + ( ( signVal * pStateIdx0 ) >> 5 ) ] << 1 )

pStateIdx1 = pStateIdx0 << 3

pBinCount− −

} else {

 

pStateIdx0 += signVal * transitionTable[ 16 + ( ( signVal * pStateIdx0 ) >> 5 ) ]

pStateIdx1 += signVal * transitionTable[ 16 + ( ( signVal * pStateIdx1 ) >> 8 ) ]

}

Renormalization process in the arithmetic decoding engine

Inputs to this process are bits from the stream packet associated with the current frame data syntax structure of clause 7.3.3 and the variables ivlCurrRange and ivlOffset of the decoding engine associated with the active channel group.

Outputs of this process are the updated variables ivlCurrRange and ivlOffset.

A flowchart of the renormalization is shown in Figure 1. The current value of ivlCurrRange is first compared to 256 and further steps are specified as follows:

— If ivlCurrRange is greater than or equal to 256, no renormalization is needed and the RenormD process is finished;

— Otherwise ( ivlCurrRange is less than 256 ), the renormalization loop is entered. Within this loop, the value of ivlCurrRange is doubled, i.e., left-shifted by 1 and a single bit is shifted into ivlOffset by using read_bits( 1 ).

The bitstream shall not contain data that result in a value of ivlOffset being greater than or equal to ivlCurrRange upon completion of this process.

Figure 1 — Flowchart of renormalization

Bypass decoding process for binary decisions

Inputs to this process are bits from the stream packet associated with the current frame data syntax structure of clause 7.3.3 and the variables ivlCurrRange and ivlOffset of the decoding engine associated with the active channel group.

Outputs of this process are the updated variable ivlOffset and the decoded value binVal.

The bypass decoding process is invoked when bypassFlag is equal to 1. Figure 2 shows a flowchart of the corresponding process.

First, the value of ivlOffset is doubled, i.e., left-shifted by 1 and a single bit is shifted into ivlOffset by using read_bits( 1 ). Then, the value of ivlOffset is compared to the value of ivlCurrRange and further steps are specified as follows:

— If ivlOffset is greater than or equal to ivlCurrRange, the variable binVal is set equal to 1 and ivlOffset is decremented by ivlCurrRange.

— Otherwise ( ivlOffset is less than ivlCurrRange ), the variable binVal is set equal to 0.

The bitstream shall not contain data that result in a value of ivlOffset being greater than or equal to ivlCurrRange upon completion of this process.

Figure 2 — Flowchart of bypass decoding process

Decoding process for binary decisions before termination

Inputs to this process are bits from the stream packet associated with the current frame data syntax structure of clause 7.3.3 and the variables ivlCurrRange and ivlOffset of the decoding engine associated with the active channel group.

Outputs of this process are the updated variables ivlCurrRange and ivlOffset, and the decoded value binVal.

This decoding process applies to decoding of end_of_frame_sequence_flag, end_of_truncated_frame_sequence_flag, and end_of_frame_one_bit corresponding to ctxTable equal to 0 and ctxIdx equal to 0. Figure 3 shows the flowchart of the corresponding decoding process, which is specified as follows:

First, the value of ivlCurrRange is decremented by 2. Then, the value of ivlOffset is compared to the value of ivlCurrRange and further steps are specified as follows:

— If ivlOffset is greater than or equal to ivlCurrRange, the variable binVal is set equal to 1, no renormalization is carried out, and CABAC decoding is terminated. The last bit inserted in register ivlOffset is equal to 1. When decoding end_of_slice_one_bit, this last bit inserted in register ivlOffset is interpreted as stop_one_bit. When decoding end_of_tile_one_bit or end_of_subset_one_bit, this last bit inserted in register ivlOffset is interpreted as byte_alignment_bit_equal_to_one.

— Otherwise ( ivlOffset is less than ivlCurrRange ), the variable binVal is set equal to 0 and renormalization is performed as specified in clause 9.5.4.3.3.

NOTE – This procedure could also be implemented using DecodeDecision( ctxTable, ctxIdx, bypassFlag ) with ctxTable = 0, ctxIdx = 0 and bypassFlag = 0. In the case where the decoded value is equal to 1, 7 more bits would be read by DecodeDecision( ctxTable, ctxIdx, bypassFlag ) and a decoding process would have to adjust its bitstream pointer accordingly to properly decode following syntax elements.

Figure 3 — Flowchart of decoding a decision before termination

10.0 Encoder processes

10.1 General

An encoder that conforms to this Specification shall produce bitstreams that conform to the syntax and semantics and associated constraints specified clauses 6 to 9 and, for each of the encoding modes that the encoder selects in the bitstream, shall produce results that are the same as those produced using the operations specified for this mode in clauses 10.2 to 10.5. The decision on which coding modes are selected and the way search processes are performed (e.g. for block matching to select offset vectors) is left to the implementer. Additionally, an encoder that conforms to this Specification shall not exceed the quantization rounding error constraint specified in clause 10.6 and shall conform to the high-level syntax packet handling constraints specified in clause 10.7.

10.1.1 Backward adaptive prediction in the encoder

The backward adaptive prediction in the encoder is very similar to the decoder backward adaptive predictive structure found in clause 8.5. While the core normalized least-mean squares ( NLMS ) algorithm is normatively specified, the selection of the values of the control parameters (lms_split_flag, enable_ar_lms[ 0 ], enable_cc_lms[ 0 ], enable_ar_lms[ 1 ], enable_cc_lms[ 1 ]), and the quantization process are up to the encoder implementation and not normatively specified.

Inputs to this process:

— A flag specifying if the LMS prediction is split ( lms_split_flag ) ( see clause 7.4.3.2.7 )

— An array of 2 flags enabling the LMS across frequency ( enable_ar_lms[ 0 ] and enable_ar_lms[ 1 ] ) ( see clause 7.4.3.2.7 )

— An array of 2 flags enabling the LMS across channels ( enable_cc_lms[ 0 ] and enable_cc_lms[ 1 ] ) ( see clause 7.4.3.2.7 )

— A variable specifying the length of the transform ( blockLength )

— A variable specifying the bit depth of the transform data ( signalBitDepth ) ( see clause 8.4.1 )

— A variable specifying the quantizer parameter for the current channel ( CurrBlockQP[ ch ] ) ( see clause 8.4.1 )

— An array of transform data for the previous channels and the current channel (signal[ c ][ n ], with c = 0…Ch and n = 0...blockLength − 1)

Outputs to this process:

An array of transform domain residual data ( res[ n ], with n = 0.. blockLength − 1)

if( lms_split_flag = = 1 )

numSplits = 2;

else

numSplits = 1;

 

for( ns = 0; ns = numSplits; ns++ ) {

if( numSplits =  = 1 ) {

startIndex = blockLength − 1;

stopIndex = −1;

} else if( ns = = 0 ) {

startIndex = blockLength − 1;

stopIndex = (blockLength >> 1) − 1;

}

else {

startIndex = (blockLength >> 1);

stopIndex = −1;

}

 

if( enable_cc_lms[ ns ] = = 1 ) {

/* see clause 7.4.2.2 */

LMSMaxCCOrder = GetMaxLmsCcOrder(

cgps_max_order_cc_lms_minus_one, cgps_lms_ar_order_over_four, Log2MaxBlockSize );

startCh = Ch − 32;

startCh =( startCh > 0 ) ? startCh : 0;

stopCh = Ch;

} else {

startCh = 0;

stopCh = 0;

}

 

if( enable_ar_lms[ ns ] = = 1 ) {

/* Set LMSOrder based on cgps_lms_ar_order_over_four see clause 7.4.2.2 */

LMSOrder = GetLmsArOrder( cgps_lms_ar_order_over_four, log2_block_length );

}

else{

LMSOrder = 0;

}

 

for( n = 0; n < 64; n ++ ) {

predARCoeff[ n ] = 0;

predBuffer[ n ] = 0;

}

for( n = 0; n < 32; n ++ )

predICCoeff[ n ] = 0;

 

bufferPointer = 0;

bufferMask = 63;

energyShift = signalBitDepth − 24;

energyShift = ( energyShift > 0 ) ? energyShift : 0;

bufferEnergy = 0;

for( n = startIndex; n > stopIndex; n −− ) {

coeffMax = ( 1 << ( 19 + 5 ) ) − 1;

coeffMin = 1 − ( 1 << ( 19 + 5 ) );

energyNorm = 0;

accum = 0;

/* Compute inter-channel prediction */

for( k = startCh; k < stopCh; k++ ) {

accum += signal[ k ][ n ] * predICCoeff [ k ];

normEnergy += ( signal[ k ][ n ] >> energyShift );

}

/* compute intra-channel predition */

index = bufferPointer − 1;

index &= BufferMask;

for( k = 0; k < lms_order; k++ ) {

accum += predARCoeff[ k ] * predBuffer[ index ];

index −−;

index &= bufferMask;

}

normEnergy += bufferEnergy;

accum = ( accum + (1 << ( 19 − 1 ) ) ) >> 19;

accum = ( accum < INT32_MAX ) ? accum : INT32_MAX;

accum = ( accum > INT32_MIN ) ? accum : INT32_MIN;

pred = accum;

 

/* Don’t predict DC value lms_split_flag == 0 */

if( n == 0 && lms_split_flag = = 0) {

signal[ Ch ][ n ] = signal[ Ch ][ n ];

}

else{

signal[ Ch ][ n ] = signal [ Ch ][ n ] − pred;

}

/* Quantize */

if( CurrBlockQP[ Ch ] > 0 ) {

res [ ch ][ n ] = Quantize( residual[ Ch ][ n ], CurrBlockQP[ Ch ] );

invQRes = InverseQuantize ( res[ Ch ][ n ], CurrBlockQP[ Ch ] );

if( n == 0 ) {

signal[ Ch ][ n ] = invQRes;

} else {

signal[ Ch ][ n ] = invQRes + pred;

}

}

/* compute update gain */

for( accum = normEnergy, log2Energy = 0; accum > 0; accum >>= 1, log2Energy ++ );

log2Energy += ( energyShift << 1);

log2Energy >>= 1;

roundOffset = ( log2Energy > 0 ) ? ( 1 << ( log2Energy − 1 ) ) : 0;

gain = ( ( ( ( residual << 19 ) >> log2Energy ) + 2 ) >> 2 );

gain = ( gain > −( 1 << 17 ) ) ? gain : −( 1 << 17 );

gain = ( gain < ( 1 << 17)) ? gain : ( 1 << 17 );

/* update inter-channel prediction coeff */

for( k = startCh; k < stopCh; k++ ) {

accum = gain * signal[ k ][ n ];

accum += roundOffset;

accum >> log2Energy;

predICCoeff[ k ] += accum;

predICCoeff[ k ] = ( predICCoeff[ k ] > coeffMin) ? predICCoeff[ k ] : coeffMin;

predICCoeff[ k ] = ( predICCoeff[ k ] < coeffMax) ? predICCoeff[ k ]: coeffMax;

}

/* update intra-channel prediction coeff */

index = bufferPointer − 1;

index &= bufferMask;

for( k = 0; k < LMSOrder; k++ ) {

accum += gain * predBuffer[ index ];

accum += roundOffset;

accum >> log2Energy;

predARCoeff [ k ] += accum;

predARCoeff[ k ] = ( predARCoeff[ k ] > coeffMin ) ? predARCoeff[ k ]: coeffMin;

predARCoeff[ k ] = ( predARCoeff[ k ] < Coeff_max ) ? predARCoeff[ k ]:Coeff_max;

index −− ;

pointer &= bufferMask;

}

/* update buffer energy */

index = bufferPointer − LMSOrder;

index &= bufferMask;

bufferEnergy −= ( predBuffer[ index ] * predBuffer[ index ]) >> energyShift;

bufferEnergy += signal[ ch ][ n ] * signal[ ch ][ n ] >> energyShift;

/* update buffer */

predBuffer[ bufferPointer ] = signal[ ch ][ n ];

bufferPointer ++;

bufferPointer &= bufferMask;

}

}

10.1.2 Integer reversible discrete cosine transform (IntDCT)

10.1.3 Integer reversible DCT for two signals (IntDualDCT)

Inputs to the process are:

— a variable that specifies the base-2 logarithm of the length of the transform

— an array of input signal for the first channel; sigData0[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

— an array of input signal for the second channel; sigData2[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

Outputs of the process are ( this process is in-place ):

— a modified array containing the output signal for the first channel; sigData0[ n ], for n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing the output signal for the second channel; sigData2[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength and halfDataLength are set as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

The arrays of rotation scales; rotScaleA and rotScaleB are initialized:

— If log2Length is equal to 4, the following applies:

rotScaleA = A4_16 /* specified in Annex B */

rotScaleB = B4_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA = A4_32 /* specified in Annex B */

rotScaleB = B4_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA = A4_64 /* specified in Annex B */

rotScaleB = B4_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA = A4_128 /* specified in Annex B */

rotScaleB = B4_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA = A4_256 /* specified in Annex B */

rotScaleB = B4_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA = A4_512 /* specified in Annex B */

rotScaleB = B4_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA = A4_1024 /* specified in Annex B */

rotScaleB = B4_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA = A4_2048 /* specified in Annex B */

rotScaleB = B4_2048 /* specified in Annex B */

The following internal scratch arrays for this process are assumed to be available: realVal0[ n ], imagVal0[ n ], realVal1[ n ], and imagVal1[ n ] with n = 0..( ( 1 << log2Length) − 1 )

The process for the two-channel integer reversible DCT is as follows:

for( n = 0; n < halfDataLength; n++ ) {

realVals0[ n ] = sigData0[ 2 * n ];

imagVals0[ n ] = 0;

realVals0[ halfDataLength + n ] = sigData0[ dataLength − 2 * n − 1 ];

imagVals0[ halfDataLength + n ] = 0;

realVals1[ n ] = sigData1[ 2 * n ];

imagVals1[ n ] = 0;

realVals1[ halfDataLength + n ] = sigData1[ dataLength − 2 * n − 1 ];

imagVals1[ halDatafLength + n ] = 0;

}

 

LiftDualRealFFT( log2Length, realVals0, imagVals0, realVals1, imagVals1 ); /* see clause 10.3.6 */

 

for( n = 1; n < HalfLength; n ++ ) {

RotateLift( rotScaleA[ n ], rotScaleB[ n ], realVals0[ n ], imagVals0[ n ] ); /* see clause 10.3.3 */

RotateLift( rotScaleA[ n ], rotScaleB[ n ], realVals1[ n ], imagVals1[ n ] ); /* see clause 10.3.3 */

}

 

for( n = 0; n < halfDataLength + 1; n ++ ) {

sigData0[ n ] = realVals0[ n ];

sigData0[ n ] = realVals1[ n ];

}

for( n = halfDataLength + 1; n < dataLength; n ++ ) {

sigData0[ n ] = −imagVals0[ dataLength − n ];

sigData1[ n ] = −imagVals1[ dataLength − n ];

}

10.1.4 Integer reversible DCT for one signal (IntDCT)

Inputs to the process are:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array of input signal; sigData[ n ], with n = 0,…,( ( 1 << log2Length ) − 1)

Outputs of the process are ( this process is in-place ):

— a modified array of signal; sigData[ n ], with n = 0,…,( ( 1 << log2Length ) − 1)

The variables dataLength and halfDataLength are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

The following internal scratch arrays for this process are assumed to be available: realVals[  n ] and imagVal[  s n ] with n = 0,…,( ( 1 << log2Length ) − 1)

 

The arrays of rotation scales; rotScaleA and rotScaleB are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA = A4_16 /* specified in Annex B */

rotScaleB = B4_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA = A4_32 /* specified in Annex B */

rotScaleB = B4_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA = A4_64 /* specified in Annex B */

rotScaleB = B4_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA = A4_128 /* specified in Annex B */

rotScaleB = B4_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA = A4_256 /* specified in Annex B */

rotScaleB = B4_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA = A4_512 /* specified in Annex B */

rotScaleB = B4_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA = A4_1024 /* specified in Annex B */

rotScaleB = B4_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA = A4_2048 /* specified in Annex B */

rotScaleB = B4_2048 /* specified in Annex B */

 

The process for the single-channel integer reversible DCT is as follows:

 

for( n = 0; n < halfDataLength; n++ ) {

realVals[  n ] = sigData[  2 * n ];

imagVals[  n ] = 0;

realVals[  halfDataLength + n ] = sigData[ dataLength − 2 * n − 1 ];

imagVals[ halfDataLength + n ] = 0;

}

 

LiftRealFFT( log2Length, realVals, imagVals ); /* see clause 10.3.7 */

 

for( n = 1; n < halfDataLength; n++ ) {

RotateLift( rotScaleA[ n ], rotScaleB[  n ], realVals[  n ], imagVals[ n ]); /* see clause 10.3.3 */

}

 

for( n = 0; n < halfDataLength + 1; n++ ) {

sigData[ n ] = realVals[ n ];

}

for( n = halfDataLength + 1; n < dataLength; n++ ) {

sigData[ n ] = −imagVals[ dataLength − n ];

}

10.1.5 Lifting factorization for Givens rotations - ( RotateLift )

Inputs to the process are:

— a variable A that is the first rotation scale

— a variable B that is the second rotation scale

— a variable x0 that is the first value to be rotated

— a variable x1 that is the second value to be rotated

Outputs to the process are ( this process is in-place ):

— a modified variable x0 that is the first value after rotation

— a modified variable x1 that is the second value after rotation

The lifting based inverse rotation is specified as follows:

 

t = A * x1; /* the computation of t, as written, may require at least 64bit precision */

x0 += ( t + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

t = B * x0; /* the computation of t, as written, may require at least 64bit precision */

x1 += ( ( t + INT_DCT2_ROUND_OFFSET ) >> INT_DCT2_MAX_BITS );

t = A * x1; /* the computation of t, as written, may require at least 64bit precision */

10.1.6 Integer reversible DFT for two complex sequences ( FFTLift )

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing real values realVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

Outputs to this process ( this process is in-place ):

— a modified array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing real values realVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variable dataLength is initialized as follows:

— dataLength = 1 << log2Length

The following internal scratch arrays for this process are assumed to be available: scratchReal[ n ] and scratchImag[ n ] with n = 0..( ( 1 << log2Length ) − 1 )

 

The process for the integer reversible DFT for two complex sequences is as follows:

 

for( n = 0; n < dataLength; n++ ) {

imagVals1[ n ] = -imagVals1[ n ];

}

 

for( n = 0; n < dataLength; n++ ) {

swapVal = realVals0[ n ];

realVals0[ n ] = realVals1[ n ];

realVals1[ n ] = swapVal;

swapVal = imagVals0[ n ];

imagVals0[ n ] = imagVals1[ n ];

imagVals1[ n ] = swapVal;

scratchReal[ n ] = realVals0[ n ];

scratchImag[ n ] = -imagVals0[ n ];

}

FPRadix2FFT( log2Length, scratchReal, scratchImag ); /* see clause 8.6.7 */

for( n = 0; n < dataLength; n++ ) {

realVals1[ n ] += scratchReal[ n ];

imagVals2[ n ] −= scratchImag[ n ]; //conj inv(A)

scratchReal[ n ] = realVals1[ n ];

scratchImag[ n ] = imagVals1[ n ];

}

FPRadix2FFT( log2Length, scratchReal, scratchImag ); /* see clause 8.6.7 */

for( n = 0; n < dataLength; n++ ) {

realVals0[ n ] −= scratchReal[ n ];

imagVals0[ n ] −= scratchImag[ n ];

scratchReal[ n ] = realVal0[ n ];

scratchImag[ n ] = -imagVals0[ n ];

}

FPRadix2FFT( log2Length, scratchReal, scratchImag ); /* see clause 8.6.7 */

for( n = 0; n < dataLength; n++ ) {

realVals1[ n ] += scratchReal[ n ];

imagVals1[ n ] −= scratchImag[ n ];

realVals0[ n ] = -realVals0[ n ];

imagVals0[ n ] = −imagVals0[ n ];

}

for( n = 0; n < dataLength; n++ ) {

imagVals1[ n ] = −imagVals1[ n ];

}

10.1.7 Integer reversible DFT for a single complex sequence ( FFTLiftSplit )

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

Outputs of this process ( the process is in-place ):

— a modified array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength, halfDataLength, rotScaleA1, and rotScaleB1 are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

— rotScaleA1 = −889516852

— rotScaleB1 = 1518500249

The arrays of rotation scales; rotScaleA0 and rotScaleB0 are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA0 = A1_16 /* specified in Annex B */

rotScaleB0 = B1_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA0 = A1_32 /* specified in Annex B */

rotScaleB0 = B1_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA0 = A1_64 /* specified in Annex B */

rotScaleB0 = B1_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA0 = A1_128 /* specified in Annex B */

rotScaleB0 = B1_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA0 = A1_256 /* specified in Annex B */

rotScaleB0 = B1_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA0 = A1_512 /* specified in Annex B */

rotScaleB0 = B1_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA0 = A1_1024 /* specified in Annex B */

rotScaleB0 = B1_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA0 = A1_2048 /* specified in Annex B */

rotScaleB0 = B1_2048 /* specified in Annex B */

 

The following internal scratch arrays for this process are assumed to be available: scratchReal[ n ] and scratchImag[ n ] with n = 0,…,( ( 1 << log2Length ) − 1 )

The process for the integer reversible DFT for a single complex sequence is as follows:

for( n = 0, k = 0; n < halfDataLength; n++, k += 2 ) {

scratchReal[ n ] = realVals[ k ];

scratchImag[ n ] = imagVals[ k ];

scratchReal[ n + halfDataLength ] = realVals[ k + 1 ];

scratchImag[ n + halfDataLength ] = imagVals[ k + 1 ];

}

/* Note: scratchReal[ halfDataLength ] and scratchImag[ halfDataLength ] are arrays starting at halfDataLength */

FFTLift( log2Length − 1, scratchReal, scratchImag, scratchReal[ halfDataLength ], scratchImag[ halfDataLength ] ); /* see clause 10.3.4 */

for( n = 0; n < halfDataLength; n++ ) {

realVal1 = -scratchImag[ n + halfDataLength ];

imagVal1 = scratchReal[ n + halfDataLength ];

RotateLift( rotScaleA0[ n ], rotScaleB0[ n ], realVal1, imagVal1 ); /* see clause 10.3.3 */

 

realVal0 = scratchReal[ n ];

imagVal0 = scratchImag[ n ];

 

RotateLift( rotScaleA1, rotScaleB1, realVal0, realVal1 ); /* see clause 10.3.3 */

RotateLift( rotScaleA1, rotScaleB1, imagVal0, imagVal1 ); /* see clause 10.3.3 */

realVals[ n ] = realVal0;

imagVals[ n ] = imagVal0;

realVals[ halfDataLength + n ] = realVal1;

imagVals[ halfDataLength + n ] = imagVal2;

}

10.1.8 Integer reversible DFT for two real sequences ( LiftDualRealFFT )

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing real values realVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals1[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

Outputs of this process (the process is in-place):

— a modified array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing real values realVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals0[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength, halfDataLength, quartDataLength, rotScaleA0, and rotScaleB0 are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

— quartDataLength = halfDataLength >> 1

— rotScaleA0 = −889516852

— rotScaleB0 = 1518500249

The arrays of rotation scales; rotScaleA1 and rotScaleB1 are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA1 = A3_16 /* specified in Annex B */

rotScaleB1 = B3_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA1 = A3_32 /* specified in Annex B */

rotScaleB1 = B3_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA1 = A3_64 /* specified in Annex B */

rotScaleB1 = B3_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA1 = A3_128 /* specified in Annex B */

rotScaleB1 = B3_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA1 = A3_256 /* specified in Annex B */

rotScaleB1 = B3_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA1 = A3_512 /* specified in Annex B */

rotScaleB1 = B3_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA1 = A3_1024 /* specified in Annex B */

rotScaleB1 = B3_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA1 = A3_2048 /* specified in Annex B */

rotScaleB1 = B3_2048 /* specified in Annex B */

 

The process for the integer invertible DFT for two real sequences is as follows:

 

for( n = 0, k = 0; n < halfDataLength; n++, k += 2 ) {

realVals0[ n ] = realVals0[ k ];

imagVals0[ n ] = realVals0[ k + 1 ];

realVals1[ n ] = realVals1[ k ];

imagVals1[ n ] = realVals1[ k + 1 ];

}

FFTLift( log2Length − 1, realVals0, imagVals0, realVals1, imagVals1 ); /* see clause 10.3.4 */

for( n = 1; n < quartDataLength; n++ ) {

realVal0 = realVals0[ n ];

imagVal0 = imagVals0[ n ];

realVal1 = realVals0[ halfDataLength − n ];

imagVal1 = −imagVals0[ halfLength − n ];

RotateLift( −rotScaleA0, -rotScaleB0, realVal0, realVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, -rotScaleB0, imagVal0, imagVal1 ); /* see clause 10.3.3 */

RotateLift( rotScaleA1[ n ], rotScaleB1[ n ], realVal1, imagVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, -rotScaleB0, realVal0, realVal1); /* see clause 10.3.3 */

RotateLift(−rotScaleA0, -rotScaleB0, imagVal0, imagVal1 ); /* see clause 10.3.3 */

realVals0[ n ] = realVal0;

imagVal0[ n ] = imagVal0;

realVals0[ halfDataLength − n ] = -realVal1;

imagVals0[ halfDataLength − n ] = imagVal1;

 

realVal0 = realVals1[ n ];

imagVal0 = imagVals1[ n ];

realVal1 = realVals1[ halfDataLength − n ];

imagVal1 = −imagVals1[ halfLength − n ];

RotateLift( −rotScaleA0, −rotScaleB0, realVal0, realVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, −rotScaleB0, imagVal0, imagVal1 ); /* see clause 10.3.3 */

RotateLift( rotScaleA1[ n ], rotScaleB1[ n ], realVal1, imagVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, −rotScaleB0, realVal0, realVal1 ); /* see clause 10.3.3 */

RotateLift(−rotScaleA0, −rotScaleB0, imagVal0, imagVal1 ); /* see clause 10.3.3 */

realVals1[ n ] = realVal0;

imagVal1[ n ] = imagVal0;

realVals1[ halfDataLength − n ] = −realVal1;

imagVals1[ halfDataLength − n ] = imagVal1;

}

imagVals0[ quartDataLength ] = −imagVals0[ quartDataLength ];

imagVals1[ quartDataLength ] = −imagVals1[ quartDataLength ];

imagVals0[ 0 ] = −imagVals0[ 0 ];

RotateLift( rotScaleA0, rotSacleB0, realVals0[ 0 ], imagVals0[ 0 ] ); /* see clause 10.3.3 */

imagVals1[ 0 ] = −imagVals1[ 0 ];

RotateLift( rotScaleA0, rotSacleB0, realVals1[ 0 ], imagVals1[ 0 ] ); /* see clause 10.3.3 */

realVasl0[ halfDataLength ] = imagVals0[ 0 ];

imagVals0[ halfDataLength ] = 0;

imagVals0[ 0 ] = 0;

realVals1[ halfDataLength ] = imagVals1[ 0 ];

imagVals1[ halfDataLength ] = 0;

imagVals1[ 0 ] = 0;

10.1.9 Integer invertible DFT for one real sequence ( LiftReaFFT )

Inputs to this process:

— a variable that specifies the length of the transform in log base 2 ( log2Length )

— an array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— an array containing imaginary values imagVals[ n ], with n = 0…( ( 1 << log2Length ) − 1 )

Outputs of this process ( the process is in-place ):

— a modified array containing real values realVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

— a modified array containing imaginary values imagVals[ n ], with n = 0..( ( 1 << log2Length ) − 1 )

The variables dataLength, halfDataLength, quartDataLength, rotScaleA0, and rotScaleB0 are initialized as follows:

— dataLength = 1 << log2Length

— halfDataLength = dataLength >> 1

— quartDataLength = halfDataLength >> 1

— rotScaleA0 = −889516852

— rotScaleB0 = 1518500249

The arrays of rotation scales; rotScaleA1 and rotScaleB1 are initialized depending on the length of the transform as follows:

— If log2Length is equal to 4, the following applies:

rotScaleA1 = A3_16 /* specified in Annex B */

rotScaleB1 = B3_16 /* specified in Annex B */

— Otherwise, if log2Length is equal to 5, the following applies:

rotScaleA1 = A3_32 /* specified in Annex B */

rotScaleB1 = B3_32 /* specified in Annex B */

— Otherwise, if log2Length is equal to 6, the following applies:

rotScaleA1 = A3_64 /* specified in Annex B */

rotScaleB1 = B3_64 /* specified in Annex B */

— Otherwise, if log2Length is equal to 7, the following applies:

rotScaleA1 = A3_128 /* specified in Annex B */

rotScaleB1 = B3_128 /* specified in Annex B */

— Otherwise, if log2Length is equal to 8, the following applies:

rotScaleA1 = A3_256 /* specified in Annex B */

rotScaleB1 = B3_256 /* specified in Annex B */

— Otherwise, if log2Length is equal to 9, the following applies:

rotScaleA1 = A3_512 /* specified in Annex B */

rotScaleB1 = B3_512 /* specified in Annex B */

— Otherwise, if log2Length is equal to 10, the following applies:

rotScaleA1 = A3_1024 /* specified in Annex B */

rotScaleB1 = B3_1024 /* specified in Annex B */

— Otherwise, the following applies:

rotScaleA1 = A3_2048 /* specified in Annex B */

rotScaleB1 = B3_2048 /* specified in Annex B */

 

The process for the integer invertible DFT for one real sequence is as follows:

for( n = 0, k = 0; n < halfDataLength; n++, k += 2 ) {

realVals[ n ] = realVals[ k ];

imagVals[ n ] = realVals[ k + 1 ];

}

LiftSplitFFT( log2Length −1, realVals, imagVals ); /* see clause 10.3.5*/

for( n = 1; n < quarterDataLength; n++ ) {

realVal0 = realVals[ n ];

imagVal0 = imagVals[ n ];

realVal1 = realVals[ halfDataLength − n ];

imagVal1 = −imagVals[ halfDataLength − n ];

RotateLift( −rotScaleA0, −rotScaleB0, realVal0, realVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, −rotScaleB0, imagVal0, imagVal1 ); /* see clause 10.3.3 */

RotateLift( rotScaleA1[ n ], rotScaleB1[ n ], realVal1, imagVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, −rotScaleB0, realVal0, realVal1 ); /* see clause 10.3.3 */

RotateLift( −rotScaleA0, −rotScaleB0, imagVal0, imagVal1 ); /* see clause 10.3.3 */

realVals[ n ] = realVal0;

imagVals[ n ] = imagVal0;

realValsl[ halfDataLength − n ] = −realVal1;

imagVals[ halfLength − n ] = imagVal1;

}

imagVals[ quartDataLength ] = −imagVals[ quartDataLength ];

imagVals[ 0 ] = −imagVals[ 0 ];

RotateLift( rotScaleA0, rotScaleB0, realVals[ 0 ], imagVals[ 0 ] ); /* see clause 10.3.3 */

realVals[ halfDataLength ] = imagVals[ 0 ];

imagVals[ halfDataLength ] = 0;

imagVals[ 0 ] = 0;

10.2 Arithmetic encoding process

10.2.1 General

Inputs to this process are decisions that are to be encoded and written.

Outputs of this process are bits that are written to the stream packet associated with the current frame data syntax structure of clause 7.3.3.1

This clause describes an arithmetic encoding engine that matches the arithmetic decoding engine described in clause 9.5.4.3. The encoding engine is essentially symmetric with the decoding engine, i.e., procedures are called in the same order. Each channel group maintains a state of the arithmetic encoding engine. The state of the arithmetic encoding engine of a channel group is represented by a value of the variable ivlLow pointing to the lower end of a sub-interval and a value of the variable ivlCurrRange specifying the corresponding range of that sub-interval.

10.2.2 Initialization process for the arithmetic encoding engine

This process is invoked before encoding a general frame data syntax structure as specified in clause 7.3.3.1.

Outputs of this process are the values ivlLow, ivlCurrRange, firstBitFlag, and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

In the initialization procedure of the encoder, ivlLow is set equal to 0 and ivlCurrRange is set equal to 510. Furthermore, firstBitFlag is set equal to 1 and the counter bitsOutstanding is set equal to 0.

NOTE – The minimum register precision required for storing the values of the variables ivlLow and ivlCurrRange after invocation of any of the arithmetic encoding processes specified in clauses 10.4.3, 10.4.5‎, and 10.4.6 is 10 bits and 9 bits, respectively. The encoding process for a binary decision as specified in clause 10.4.3 and the encoding process for a binary decision before termination as specified in clause 10.4.6 require a minimum register precision of 10 bits for the variable ivlLow and a minimum register precision of 9 bits for the variable ivlCurrRange. The bypass encoding process for binary decisions as specified in clause 10.4.5 requires a minimum register precision of 11 bits for the variable ivlLow and a minimum register precision of 9 bits for the variable ivlCurrRange. The precision required for the counter bitsOutstanding is expected to be sufficiently large to prevent overflow of the related register.

10.2.3 Encoding process for a binary decision

Inputs to this process are:

— the context index ctxIdx, the variables ctxSet and ctxTable, and the value of binVal to be encoded,

— the variables ivlCurrRange and ivlLow of the arithmetic encoding engine associated with the active channel group.

Outputs of this process are the variables ivlCurrRange and ivlLow.

The derivation process for ivlLpsRange and valMps as specified in clause 9.5.4.3.2.2 is invoked with ctxSet, ctxTable, and ctxIdx as input and ivlCurrRange and valMps as outputs.

The value of binVal is compared to valMps. When binVal is different from valMps, ivlCurrRange is added to ivlLow and ivlCurrRange is set equal to the value ivlLpsRange.

The state transition as specified in clause 9.5.4.3.2.2 is invoked with binVal and the context variable associated with ctxSet, ctxTable, and ctxIdx as input.

Depending on the current value of ivlCurrRange, renormalization is performed as specified in clause 10.4.4‎.

10.2.4 Renormalization process in the arithmetic encoding engine

Inputs to this process are the variables ivlCurrRange, ivlLow, firstBitFlag and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

Outputs of this process are_

— zero or more bits written to the stream packet associated with the current frame data syntax structure of clause 7.3.3.1,

— the updated variables ivlCurrRange, ivlLow, firstBitFlag and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

Renormalization in the encoder is illustrated in Figure 10‑1.

Figure 10‑1 — Flowchart of renormalization in the encoder

The PutBit( ) procedure described in Figure 10‑2 provides carry over control. It uses the function WriteBits( B, N ) that writes N bits with value B to the bitstream and advances the bitstream pointer by N bit positions. This function assumes the existence of a bitstream pointer with an indication of the position of the next bit to be written to the bitstream by the encoding process.

Figure 10‑2 — Flowchart of PutBit(B)

10.2.5 Bypass encoding process for binary decisions

Inputs to this process are the variables binVal, ivlLow, ivlCurrRange, and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

Output of this process are:

— a bit written to the stream packet associated with the current frame data syntax structure of clause 7.3.3.1,

— the updated variables ivlLow and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

This encoding process applies to all binary decisions with bypassFlag equal to 1.

Renormalization is included in the specification of this bypass encoding process as given in Figure 10‑3.

Figure 10‑3 — Flowchart of encoding bypass

10.2.6 Encoding process for a binary decision before termination

Inputs to this process are the variables binVal, ivlCurrRange, ivlLow and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

Outputs of this process are:

— zero or more bits written to the stream packet associated with the current frame data syntax structure of clause 7.3.3.1,

— the updated variables ivlLow, ivlCurrRange and bitsOutstanding of the arithmetic encoding engine associated with the active channel group.

This encoding routine shown in Figure 10‑4 applies to encoding of syntax elements end_of_frame_sequence_flag, end_of_truncated_frame_sequence_flag, and end_of_frame_one_bit.

Figure 10‑4 — Flowchart of encoding a decision before termination

When the value of binVal to encode is equal to 1, CABAC encoding is terminated and the flushing procedure shown in Figure 10‑5 is applied. In this flushing procedure, the last bit written by WriteBits( B, N ) is equal to 1. This last bit is interpreted as stop_one_bit.

Figure 10‑5 — Flowchart of flushing at termination

10.3 Prediction

The encoder shall calculate block-wise predictions as specified in clause 8.3.

The encoder shall calculate sample-wise predictions as specified in clause 8.9.

10.3.1 Quantization rounding error

Depending on whether quantization is done in the transform or sample domain, an encoder is required to limit the maximum absolute error in the transform domain or sample domain, respectively.

Let blockSize be a variable that is set equal to 1 << Log2BlockSize.

Let orgSamples[ k ], with 0 <= k < blockSize, be the original samples of a block of samples and let qntIndices[ k ], with 0 <= k < blockSize, be the quantization indexes that an encoder writes into the bitstream for the block of samples.

The variable maxAllowedQuantError is derived by invoking the derivation process for the maximum allowed quantization error with the current channel ch as input as specified in clause 10.6.1.

The variable maxQuantError is derived by invoking the derivation process for the maximum quantization error as specified in clause 10.6.2 with orgSamples and qntIndices as input.

It is a requirement of encoder conformance that the encoder selects quantization indices qntIndices in a way that the obtained value of maxQuantError shall be less than or equal to maxAllowedQuantError.

NOTE – The conformance of an encoder with this constraint can be tested by encoding a series of sample values with the encoder under test and then partially decoding it as specified using a verified conforming reference decoder, then subtracting the reference decoder’s prediction signal from the original sample values, processing the difference with the specified forward transform process when so indicated, and measuring the difference between the true residual signal and the reconstructed approximation that has been signalled by the encoder under test to determine whether this difference is within the specified tolerance.

10.3.2 Derivation process for the maximum allowed quantization error

Input to the process is:

— a variable ch specifying the current channel.

Output of this process is:

— a variable maxAllowedQuantError specifying the maximum allowed quantization error.

The variable maxAllowedQuantError is derived as follows:

— If CurrBlockQP[ch] is equal to 0. maxAllowedQuantError is set to 0.

— Otherwise, the following applies:

— Let qScale and qShift be the variables that are derived in the scaling process for transform coefficient levels as specified in clause 8.4.1.

— When TransformMode is equal to TM_DCT, the variable qShift is modified to qShift = qShift − 1.

— The variable maxAllowedQuantError is set equal to maxAllowedQuantError = ( 12 * qScale ) >> ( qShift + 3 ).

10.3.3 Derivation process for the maximum quantization error

Inputs to the process are:

— a variable blockSize specifying the size of the current block of samples,

— an array orgSamples of size blockSize specifying the original samples for a block,

— an array qntIndices of size blockSize specifying the quantization indexes for a block.

Output of this process is:

— a variable maxQuantError specifying the maximum absolute quantization error.

The variable maxQuantError is derived as follows:

— The derivation process for original coefficients as specified in clause 10.6.2.1 is invoked with blockSize and orgSamples as input and the output is assigned to the array orgCoeffs.

— The derivation process for reconstructed coefficients as specified in clause 10.6.2.2 is invoked with blockSize and qntIndices as input and the output is assigned to the array recCoeffs.

— The variable maxQuantError is derived as specified by the following pseudo-code:

maxQuantError = 0
for( k = 0; k < blockSize; k ++ ) {
quantError = abs( orgCoeffs[ k ] − recCoeffs[ k ] )
maxQuantError = Max( maxQuantError, quantError )
}

Derivation process for original coefficients

Inputs to the process are:

— a variable blockSize specifying the size of the current block of samples,

— an array orgSamples of size blockSize specifying the original samples.

Output of this process is:

— an array orgCoeffs of size blockSize specifying original coefficients.

The array orgCoeffs is derived as follows:

— The array prdSamples[ k ], with 0 <= k < blockSize, is derived by invoking the block-wise prediction process as specified in clause 8.5 and the output is assigned to prdSamples.

— The array resSamples[ k ], with 0 <= k < blockSize, is derived by setting each sample resSamples[ k ], with 0 <= k < blockSize, equal to orgSamples[ k ] − prdSamples[ k ].

— Depending on TransformMode, the array orgCoeffs is derived as follows:

— If TransformMode is equal to TM_OFF, each sample orgCoeffs[ k ], with 0 <= k < blockSize, is set equal to resSamples[ k ].

— Otherwise ( TransformMode is not equal to TM_OFF ), the forward transform process as specified in clause X.X is invoked with resSamples as input and the output is assigned to orgCoeffs.

Derivation process for reconstructed coefficients

Inputs to the process are:

— a variable blockSize specifying the size of the current block of samples,

— an array qntIndexes of size blockSize specifying the quantization indices,

— syntax elements specifying the prediction and transform parameters.

Output of this process is:

— an array recCoeffs of size blockSize specifying reconstructed coefficients.

The array recCoeffs is derived as follows:

— The array tCoeffs[ k ], with 0 <= k < blockSize, is derived by invoking the scaling process for transform coefficient levels as specified in clause 8.4.1 with QuantIndices being set equal to qntIndices and the output is assigned to tCoeffs.

— Depending on TransformMode and lms_flag, the array recCoeffs is derived as follows:

— If lms_flag is equal to 1, the backward adaptive ( LMS prediction ) process of clause 8.5 is applied and the output is assigned to recCoeffs.

— Otherwise, if TransformMode is equal to TM_OFF, the sample-wise prediction process as specified in clause 8.9 is invoked and the output is assigned to recCoeffs.

— Otherwise (TransformMode is not equal to TM_OFF and lms_flag is equal to 0), each value recCoeffs[ k ], with 0 <= k < blockSize, is set equal to tCoeff[ k ].

10.4 Handling of high level syntax packets at the encoder

An encoder generating a single CWS shall have all the packets specified with the same non-zero stream_packet_label as the WPS packet. However, certain HLS packets may not necessarily be referencing to a particular wps_waveform_parameter_set_id and therefore, may have zero valued stream_packet_label. For example, an encoding TIMESTAMP may choose to have a zero valued stream_packet_label, indicating that the packet is valid for all sub-streams. For a single CWS, this is a valid assignment and will not have a differentiating effect.

Generating a multiplexed bitstream consisting of more than one CWS shall

— fulfil at least one of the following options:

— A unique non-zero stream_packet_label is assigned to each CWS, or

— A single non-zero stream_packet_label is assigned to all CWSs but ensuring unique values of wps_waveform_parameter_set_ids in WPS packets

— provide the mapping of value zero to a unique non-zero value of stream_packet_label. Such cases may occur when, e.g., existing bitstreams are being multiplexed.

Generating the following HLS packets to be added into the bitstream can be done while processing an input signal (e.g., during the encoding) or by processing an existing conformance bitstream.

TIMESTAMP packets handle the timing information and the usage at the encoder shall conform to the specified syntax and semantics in clause 7.3.2.6 and 7.4.2.6, respectively.

SEGMENT payload packets handle the carriage of segment payload and the corresponding metadata such as specific features within a segment and distortion measures. The usage at the encoder shall conform to the specified syntax and semantics in clause 7.3.2.7, 7.3.2.8, 7.3.2.9 and 7.4.2.7, 7.4.2.8, 7.4.2.9, respectively.

FEATURE set packets maintain the list of identified features of a waveform and the usage at the encoder shall conform to the specified syntax and semantics in clause 7.3.2.10 and 7.4.2.10, respectively.

CONFIG set packets provide various parameters to facilitate easier, proper interpretation and interaction with the signal and bitstream. The usage at the encoder shall conform to the specified syntax and semantics in clause 7.3.2.11, 7.3.2.12 and 7.4.2.11, 7.4.2.12, respectively.

UUID_U and UUID_S packets handle the user and stream identification, respectively. The usage at the encoder shall conform to the specified syntax and semantics in clause 7.3.2.14, 7.3.2.15, 7.3.2.16 and 7.4.2.14, 7.4.2.15, 7.4.2.16, respectively.

AUTH_START and AUTH_SIG packets handle the authentication mechanism and the usage at the encoder shall conform to the specified syntax and semantics in clause 7.3.2.17, 7.3.2.18 and 7.4.2.17, 7.4.2.18, respectively.


  1. (informative)

    Inverse quantization tables

Table A.1 — Inverse quantization scale and shift parameters

i

InvQuantScale[ i ]

InvQuantShift [ i ]

i

InvQuantScale[ i ]

InvQuantShift[ i ]

0

0x40000000

30

512

0x40000000

14

1

0x20B361A6

29

513

0x20B361A6

13

2

0x216AB0DA

29

514

0x216AB0DA

13

3

0x222603A0

29

515

0x222603A0

13

4

0x22E57079

29

516

0x22E57079

13

5

0x23A90E63

29

517

0x23A90E63

13

6

0x2470F4DD

29

518

0x2470F4DD

13

7

0x253D3BEA

29

519

0x253D3BEA

13

8

0x260DFC14

29

520

0x260DFC14

13

9

0x26E34E6E

29

521

0x26E34E6E

13

10

0x27BD4C98

29

522

0x27BD4C98

13

11

0x289C10C1

29

523

0x289C10C1

13

12

0x297FB5AA

29

524

0x297FB5AA

13

13

0x2A6856AD

29

525

0x2A6856AD

13

14

0x2B560FBB

29

526

0x2B560FBB

13

15

0x2C48FD60

29

527

0x2C48FD60

13

16

0x2D413CCD

29

528

0x2D413CCD

13

17

0x2E3EEBD2

29

529

0x2E3EEBD2

13

18

0x2F4228E8

29

530

0x2F4228E8

13

19

0x304B1333

29

531

0x304B1333

13

20

0x3159CA84

29

532

0x3159CA84

13

21

0x326E6F62

29

533

0x326E6F62

13

22

0x33892305

29

534

0x33892305

13

23

0x34AA0764

29

535

0x34AA0764

13

24

0x35D13F33

29

536

0x35D13F33

13

25

0x36FEEDE6

29

537

0x36FEEDE6

13

26

0x383337BB

29

538

0x383337BB

13

27

0x396E41BA

29

539

0x396E41BA

13

28

0x3AB031BA

29

540

0x3AB031BA

13

29

0x3BF92E67

29

541

0x3BF92E67

13

30

0x3D495F45

29

542

0x3D495F45

13

31

0x3EA0ECB7

29

543

0x3EA0ECB7

13

32

0x40000000

29

544

0x40000000

13

33

0x20B361A6

28

545

0x20B361A6

12

34

0x216AB0DA

28

546

0x216AB0DA

12

35

0x222603A0

28

547

0x222603A0

12

36

0x22E57079

28

548

0x22E57079

12

37

0x23A90E63

28

549

0x23A90E63

12

38

0x2470F4DD

28

550

0x2470F4DD

12

39

0x253D3BEA

28

551

0x253D3BEA

12

40

0x260DFC14

28

552

0x260DFC14

12

41

0x26E34E6E

28

553

0x26E34E6E

12

42

0x27BD4C98

28

554

0x27BD4C98

12

43

0x289C10C1

28

555

0x289C10C1

12

44

0x297FB5AA

28

556

0x297FB5AA

12

45

0x2A6856AD

28

557

0x2A6856AD

12

46

0x2B560FBB

28

558

0x2B560FBB

12

47

0x2C48FD60

28

559

0x2C48FD60

12

48

0x2D413CCD

28

560

0x2D413CCD

12

49

0x2E3EEBD2

28

561

0x2E3EEBD2

12

50

0x2F4228E8

28

562

0x2F4228E8

12

51

0x304B1333

28

563

0x304B1333

12

52

0x3159CA84

28

564

0x3159CA84

12

53

0x326E6F62

28

565

0x326E6F62

12

54

0x33892305

28

566

0x33892305

12

55

0x34AA0764

28

567

0x34AA0764

12

56

0x35D13F33

28

568

0x35D13F33

12

57

0x36FEEDE6

28

569

0x36FEEDE6

12

58

0x383337BB

28

570

0x383337BB

12

59

0x396E41BA

28

571

0x396E41BA

12

60

0x3AB031BA

28

572

0x3AB031BA

12

61

0x3BF92E67

28

573

0x3BF92E67

12

62

0x3D495F45

28

574

0x3D495F45

12

63

0x3EA0ECB7

28

575

0x3EA0ECB7

12

64

0x40000000

28

576

0x40000000

12

65

0x20B361A6

27

577

0x20B361A6

11

66

0x216AB0DA

27

578

0x216AB0DA

11

67

0x222603A0

27

579

0x222603A0

11

68

0x22E57079

27

580

0x22E57079

11

69

0x23A90E63

27

581

0x23A90E63

11

70

0x2470F4DD

27

582

0x2470F4DD

11

71

0x253D3BEA

27

583

0x253D3BEA

11

72

0x260DFC14

27

584

0x260DFC14

11

73

0x26E34E6E

27

585

0x26E34E6E

11

74

0x27BD4C98

27

586

0x27BD4C98

11

75

0x289C10C1

27

587

0x289C10C1

11

76

0x297FB5AA

27

588

0x297FB5AA

11

77

0x2A6856AD

27

589

0x2A6856AD

11

78

0x2B560FBB

27

590

0x2B560FBB

11

79

0x2C48FD60

27

591

0x2C48FD60

11

80

0x2D413CCD

27

592

0x2D413CCD

11

81

0x2E3EEBD2

27

593

0x2E3EEBD2

11

82

0x2F4228E8

27

594

0x2F4228E8

11

83

0x304B1333

27

595

0x304B1333

11

84

0x3159CA84

27

596

0x3159CA84

11

85

0x326E6F62

27

597

0x326E6F62

11

86

0x33892305

27

598

0x33892305

11

87

0x34AA0764

27

599

0x34AA0764

11

88

0x35D13F33

27

600

0x35D13F33

11

89

0x36FEEDE6

27

601

0x36FEEDE6

11

90

0x383337BB

27

602

0x383337BB

11

91

0x396E41BA

27

603

0x396E41BA

11

92

0x3AB031BA

27

604

0x3AB031BA

11

93

0x3BF92E67

27

605

0x3BF92E67

11

94

0x3D495F45

27

606

0x3D495F45

11

95

0x3EA0ECB7

27

607

0x3EA0ECB7

11

96

0x40000000

27

608

0x40000000

11

97

0x20B361A6

26

609

0x20B361A6

10

98

0x216AB0DA

26

610

0x216AB0DA

10

99

0x222603A0

26

611

0x222603A0

10

100

0x22E57079

26

612

0x22E57079

10

101

0x23A90E63

26

613

0x23A90E63

10

102

0x2470F4DD

26

614

0x2470F4DD

10

103

0x253D3BEA

26

615

0x253D3BEA

10

104

0x260DFC14

26

616

0x260DFC14

10

105

0x26E34E6E

26

617

0x26E34E6E

10

106

0x27BD4C98

26

618

0x27BD4C98

10

107

0x289C10C1

26

619

0x289C10C1

10

108

0x297FB5AA

26

620

0x297FB5AA

10

109

0x2A6856AD

26

621

0x2A6856AD

10

110

0x2B560FBB

26

622

0x2B560FBB

10

111

0x2C48FD60

26

623

0x2C48FD60

10

112

0x2D413CCD

26

624

0x2D413CCD

10

113

0x2E3EEBD2

26

625

0x2E3EEBD2

10

114

0x2F4228E8

26

626

0x2F4228E8

10

115

0x304B1333

26

627

0x304B1333

10

116

0x3159CA84

26

628

0x3159CA84

10

117

0x326E6F62

26

629

0x326E6F62

10

118

0x33892305

26

630

0x33892305

10

119

0x34AA0764

26

631

0x34AA0764

10

120

0x35D13F33

26

632

0x35D13F33

10

121

0x36FEEDE6

26

633

0x36FEEDE6

10

122

0x383337BB

26

634

0x383337BB

10

123

0x396E41BA

26

635

0x396E41BA

10

124

0x3AB031BA

26

636

0x3AB031BA

10

125

0x3BF92E67

26

637

0x3BF92E67

10

126

0x3D495F45

26

638

0x3D495F45

10

127

0x3EA0ECB7

26

639

0x3EA0ECB7

10

128

0x40000000

26

640

0x40000000

10

129

0x20B361A6

25

641

0x20B361A6

9

130

0x216AB0DA

25

642

0x216AB0DA

9

131

0x222603A0

25

643

0x222603A0

9

132

0x22E57079

25

644

0x22E57079

9

133

0x23A90E63

25

645

0x23A90E63

9

134

0x2470F4DD

25

646

0x2470F4DD

9

135

0x253D3BEA

25

647

0x253D3BEA

9

136

0x260DFC14

25

648

0x260DFC14

9

137

0x26E34E6E

25

649

0x26E34E6E

9

138

0x27BD4C98

25

650

0x27BD4C98

9

139

0x289C10C1

25

651

0x289C10C1

9

140

0x297FB5AA

25

652

0x297FB5AA

9

141

0x2A6856AD

25

653

0x2A6856AD

9

142

0x2B560FBB

25

654

0x2B560FBB

9

143

0x2C48FD60

25

655

0x2C48FD60

9

144

0x2D413CCD

25

656

0x2D413CCD

9

145

0x2E3EEBD2

25

657

0x2E3EEBD2

9

146

0x2F4228E8

25

658

0x2F4228E8

9

147

0x304B1333

25

659

0x304B1333

9

148

0x3159CA84

25

660

0x3159CA84

9

149

0x326E6F62

25

661

0x326E6F62

9

150

0x33892305

25

662

0x33892305

9

151

0x34AA0764

25

663

0x34AA0764

9

152

0x35D13F33

25

664

0x35D13F33

9

153

0x36FEEDE6

25

665

0x36FEEDE6

9

154

0x383337BB

25

666

0x383337BB

9

155

0x396E41BA

25

667

0x396E41BA

9

156

0x3AB031BA

25

668

0x3AB031BA

9

157

0x3BF92E67

25

669

0x3BF92E67

9

158

0x3D495F45

25

670

0x3D495F45

9

159

0x3EA0ECB7

25

671

0x3EA0ECB7

9

160

0x40000000

25

672

0x40000000

9

161

0x20B361A6

24

673

0x20B361A6

8

162

0x216AB0DA

24

674

0x216AB0DA

8

163

0x222603A0

24

675

0x222603A0

8

164

0x22E57079

24

676

0x22E57079

8

165

0x23A90E63

24

677

0x23A90E63

8

166

0x2470F4DD

24

678

0x2470F4DD

8

167

0x253D3BEA

24

679

0x253D3BEA

8

168

0x260DFC14

24

680

0x260DFC14

8

169

0x26E34E6E

24

681

0x26E34E6E

8

170

0x27BD4C98

24

682

0x27BD4C98

8

171

0x289C10C1

24

683

0x289C10C1

8

172

0x297FB5AA

24

684

0x297FB5AA

8

173

0x2A6856AD

24

685

0x2A6856AD

8

174

0x2B560FBB

24

686

0x2B560FBB

8

175

0x2C48FD60

24

687

0x2C48FD60

8

176

0x2D413CCD

24

688

0x2D413CCD

8

177

0x2E3EEBD2

24

689

0x2E3EEBD2

8

178

0x2F4228E8

24

690

0x2F4228E8

8

179

0x304B1333

24

691

0x304B1333

8

180

0x3159CA84

24

692

0x3159CA84

8

181

0x326E6F62

24

693

0x326E6F62

8

182

0x33892305

24

694

0x33892305

8

183

0x34AA0764

24

695

0x34AA0764

8

184

0x35D13F33

24

696

0x35D13F33

8

185

0x36FEEDE6

24

697

0x36FEEDE6

8

186

0x383337BB

24

698

0x383337BB

8

187

0x396E41BA

24

699

0x396E41BA

8

188

0x3AB031BA

24

700

0x3AB031BA

8

189

0x3BF92E67

24

701

0x3BF92E67

8

190

0x3D495F45

24

702

0x3D495F45

8

191

0x3EA0ECB7

24

703

0x3EA0ECB7

8

192

0x40000000

24

704

0x40000000

8

193

0x20B361A6

23

705

0x20B361A6

7

194

0x216AB0DA

23

706

0x216AB0DA

7

195

0x222603A0

23

707

0x222603A0

7

196

0x22E57079

23

708

0x22E57079

7

197

0x23A90E63

23

709

0x23A90E63

7

198

0x2470F4DD

23

710

0x2470F4DD

7

199

0x253D3BEA

23

711

0x253D3BEA

7

200

0x260DFC14

23

712

0x260DFC14

7

201

0x26E34E6E

23

713

0x26E34E6E

7

202

0x27BD4C98

23

714

0x27BD4C98

7

203

0x289C10C1

23

715

0x289C10C1

7

204

0x297FB5AA

23

716

0x297FB5AA

7

205

0x2A6856AD

23

717

0x2A6856AD

7

206

0x2B560FBB

23

718

0x2B560FBB

7

207

0x2C48FD60

23

719

0x2C48FD60

7

208

0x2D413CCD

23

720

0x2D413CCD

7

209

0x2E3EEBD2

23

721

0x2E3EEBD2

7

210

0x2F4228E8

23

722

0x2F4228E8

7

211

0x304B1333

23

723

0x304B1333

7

212

0x3159CA84

23

724

0x3159CA84

7

213

0x326E6F62

23

725

0x326E6F62

7

214

0x33892305

23

726

0x33892305

7

215

0x34AA0764

23

727

0x34AA0764

7

216

0x35D13F33

23

728

0x35D13F33

7

217

0x36FEEDE6

23

729

0x36FEEDE6

7

218

0x383337BB

23

730

0x383337BB

7

219

0x396E41BA

23

731

0x396E41BA

7

220

0x3AB031BA

23

732

0x3AB031BA

7

221

0x3BF92E67

23

733

0x3BF92E67

7

222

0x3D495F45

23

734

0x3D495F45

7

223

0x3EA0ECB7

23

735

0x3EA0ECB7

7

224

0x40000000

23

736

0x40000000

7

225

0x20B361A6

22

737

0x20B361A6

6

226

0x216AB0DA

22

738

0x216AB0DA

6

227

0x222603A0

22

739

0x222603A0

6

228

0x22E57079

22

740

0x22E57079

6

229

0x23A90E63

22

741

0x23A90E63

6

230

0x2470F4DD

22

742

0x2470F4DD

6

231

0x253D3BEA

22

743

0x253D3BEA

6

232

0x260DFC14

22

744

0x260DFC14

6

233

0x26E34E6E

22

745

0x26E34E6E

6

234

0x27BD4C98

22

746

0x27BD4C98

6

235

0x289C10C1

22

747

0x289C10C1

6

236

0x297FB5AA

22

748

0x297FB5AA

6

237

0x2A6856AD

22

749

0x2A6856AD

6

238

0x2B560FBB

22

750

0x2B560FBB

6

239

0x2C48FD60

22

751

0x2C48FD60

6

240

0x2D413CCD

22

752

0x2D413CCD

6

241

0x2E3EEBD2

22

753

0x2E3EEBD2

6

242

0x2F4228E8

22

754

0x2F4228E8

6

243

0x304B1333

22

755

0x304B1333

6

244

0x3159CA84

22

756

0x3159CA84

6

245

0x326E6F62

22

757

0x326E6F62

6

246

0x33892305

22

758

0x33892305

6

247

0x34AA0764

22

759

0x34AA0764

6

248

0x35D13F33

22

760

0x35D13F33

6

249

0x36FEEDE6

22

761

0x36FEEDE6

6

250

0x383337BB

22

762

0x383337BB

6

251

0x396E41BA

22

763

0x396E41BA

6

252

0x3AB031BA

22

764

0x3AB031BA

6

253

0x3BF92E67

22

765

0x3BF92E67

6

254

0x3D495F45

22

766

0x3D495F45

6

255

0x3EA0ECB7

22

767

0x3EA0ECB7

6

256

0x40000000

22

768

0x40000000

6

257

0x20B361A6

21

769

0x20B361A6

5

258

0x216AB0DA

21

770

0x216AB0DA

5

259

0x222603A0

21

771

0x222603A0

5

260

0x22E57079

21

772

0x22E57079

5

261

0x23A90E63

21

773

0x23A90E63

5

262

0x2470F4DD

21

774

0x2470F4DD

5

263

0x253D3BEA

21

775

0x253D3BEA

5

264

0x260DFC14

21

776

0x260DFC14

5

265

0x26E34E6E

21

777

0x26E34E6E

5

266

0x27BD4C98

21

778

0x27BD4C98

5

267

0x289C10C1

21

779

0x289C10C1

5

268

0x297FB5AA

21

780

0x297FB5AA

5

269

0x2A6856AD

21

781

0x2A6856AD

5

270

0x2B560FBB

21

782

0x2B560FBB

5

271

0x2C48FD60

21

783

0x2C48FD60

5

272

0x2D413CCD

21

784

0x2D413CCD

5

273

0x2E3EEBD2

21

785

0x2E3EEBD2

5

274

0x2F4228E8

21

786

0x2F4228E8

5

275

0x304B1333

21

787

0x304B1333

5

276

0x3159CA84

21

788

0x3159CA84

5

277

0x326E6F62

21

789

0x326E6F62

5

278

0x33892305

21

790

0x33892305

5

279

0x34AA0764

21

791

0x34AA0764

5

280

0x35D13F33

21

792

0x35D13F33

5

281

0x36FEEDE6

21

793

0x36FEEDE6

5

282

0x383337BB

21

794

0x383337BB

5

283

0x396E41BA

21

795

0x396E41BA

5

284

0x3AB031BA

21

796

0x3AB031BA

5

285

0x3BF92E67

21

797

0x3BF92E67

5

286

0x3D495F45

21

798

0x3D495F45

5

287

0x3EA0ECB7

21

799

0x3EA0ECB7

5

288

0x40000000

21

800

0x40000000

5

289

0x20B361A6

20

801

0x20B361A6

4

290

0x216AB0DA

20

802

0x216AB0DA

4

291

0x222603A0

20

803

0x222603A0

4

292

0x22E57079

20

804

0x22E57079

4

293

0x23A90E63

20

805

0x23A90E63

4

294

0x2470F4DD

20

806

0x2470F4DD

4

295

0x253D3BEA

20

807

0x253D3BEA

4

296

0x260DFC14

20

808

0x260DFC14

4

297

0x26E34E6E

20

809

0x26E34E6E

4

298

0x27BD4C98

20

810

0x27BD4C98

4

299

0x289C10C1

20

811

0x289C10C1

4

300

0x297FB5AA

20

812

0x297FB5AA

4

301

0x2A6856AD

20

813

0x2A6856AD

4

302

0x2B560FBB

20

814

0x2B560FBB

4

303

0x2C48FD60

20

815

0x2C48FD60

4

304

0x2D413CCD

20

816

0x2D413CCD

4

305

0x2E3EEBD2

20

817

0x2E3EEBD2

4

306

0x2F4228E8

20

818

0x2F4228E8

4

307

0x304B1333

20

819

0x304B1333

4

308

0x3159CA84

20

820

0x3159CA84

4

309

0x326E6F62

20

821

0x326E6F62

4

310

0x33892305

20

822

0x33892305

4

311

0x34AA0764

20

823

0x34AA0764

4

312

0x35D13F33

20

824

0x35D13F33

4

313

0x36FEEDE6

20

825

0x36FEEDE6

4

314

0x383337BB

20

826

0x383337BB

4

315

0x396E41BA

20

827

0x396E41BA

4

316

0x3AB031BA

20

828

0x3AB031BA

4

317

0x3BF92E67

20

829

0x3BF92E67

4

318

0x3D495F45

20

830

0x3D495F45

4

319

0x3EA0ECB7

20

831

0x3EA0ECB7

4

320

0x40000000

20

832

0x40000000

4

321

0x20B361A6

19

833

0x20B361A6

3

322

0x216AB0DA

19

834

0x216AB0DA

3

323

0x222603A0

19

835

0x222603A0

3

324

0x22E57079

19

836

0x22E57079

3

325

0x23A90E63

19

837

0x23A90E63

3

326

0x2470F4DD

19

838

0x2470F4DD

3

327

0x253D3BEA

19

839

0x253D3BEA

3

328

0x260DFC14

19

840

0x260DFC14

3

329

0x26E34E6E

19

841

0x26E34E6E

3

330

0x27BD4C98

19

842

0x27BD4C98

3

331

0x289C10C1

19

843

0x289C10C1

3

332

0x297FB5AA

19

844

0x297FB5AA

3

333

0x2A6856AD

19

845

0x2A6856AD

3

334

0x2B560FBB

19

846

0x2B560FBB

3

335

0x2C48FD60

19

847

0x2C48FD60

3

336

0x2D413CCD

19

848

0x2D413CCD

3

337

0x2E3EEBD2

19

849

0x2E3EEBD2

3

338

0x2F4228E8

19

850

0x2F4228E8

3

339

0x304B1333

19

851

0x304B1333

3

340

0x3159CA84

19

852

0x3159CA84

3

341

0x326E6F62

19

853

0x326E6F62

3

342

0x33892305

19

854

0x33892305

3

343

0x34AA0764

19

855

0x34AA0764

3

344

0x35D13F33

19

856

0x35D13F33

3

345

0x36FEEDE6

19

857

0x36FEEDE6

3

346

0x383337BB

19

858

0x383337BB

3

347

0x396E41BA

19

859

0x396E41BA

3

348

0x3AB031BA

19

860

0x3AB031BA

3

349

0x3BF92E67

19

861

0x3BF92E67

3

350

0x3D495F45

19

862

0x3D495F45

3

351

0x3EA0ECB7

19

863

0x3EA0ECB7

3

352

0x40000000

19

864

0x40000000

3

353

0x20B361A6

18

865

0x20B361A6

2

354

0x216AB0DA

18

866

0x216AB0DA

2

355

0x222603A0

18

867

0x222603A0

2

356

0x22E57079

18

868

0x22E57079

2

357

0x23A90E63

18

869

0x23A90E63

2

358

0x2470F4DD

18

870

0x2470F4DD

2

359

0x253D3BEA

18

871

0x253D3BEA

2

360

0x260DFC14

18

872

0x260DFC14

2

361

0x26E34E6E

18

873

0x26E34E6E

2

362

0x27BD4C98

18

874

0x27BD4C98

2

363

0x289C10C1

18

875

0x289C10C1

2

364

0x297FB5AA

18

876

0x297FB5AA

2

365

0x2A6856AD

18

877

0x2A6856AD

2

366

0x2B560FBB

18

878

0x2B560FBB

2

367

0x2C48FD60

18

879

0x2C48FD60

2

368

0x2D413CCD

18

880

0x2D413CCD

2

369

0x2E3EEBD2

18

881

0x2E3EEBD2

2

370

0x2F4228E8

18

882

0x2F4228E8

2

371

0x304B1333

18

883

0x304B1333

2

372

0x3159CA84

18

884

0x3159CA84

2

373

0x326E6F62

18

885

0x326E6F62

2

374

0x33892305

18

886

0x33892305

2

375

0x34AA0764

18

887

0x34AA0764

2

376

0x35D13F33

18

888

0x35D13F33

2

377

0x36FEEDE6

18

889

0x36FEEDE6

2

378

0x383337BB

18

890

0x383337BB

2

379

0x396E41BA

18

891

0x396E41BA

2

380

0x3AB031BA

18

892

0x3AB031BA

2

381

0x3BF92E67

18

893

0x3BF92E67

2

382

0x3D495F45

18

894

0x3D495F45

2

383

0x3EA0ECB7

18

895

0x3EA0ECB7

2

384

0x40000000

18

896

0x40000000

2

385

0x20B361A6

17

897

0x20B361A6

1

386

0x216AB0DA

17

898

0x216AB0DA

1

387

0x222603A0

17

899

0x222603A0

1

388

0x22E57079

17

900

0x22E57079

1

389

0x23A90E63

17

901

0x23A90E63

1

390

0x2470F4DD

17

902

0x2470F4DD

1

391

0x253D3BEA

17

903

0x253D3BEA

1

392

0x260DFC14

17

904

0x260DFC14

1

393

0x26E34E6E

17

905

0x26E34E6E

1

394

0x27BD4C98

17

906

0x27BD4C98

1

395

0x289C10C1

17

907

0x289C10C1

1

396

0x297FB5AA

17

908

0x297FB5AA

1

397

0x2A6856AD

17

909

0x2A6856AD

1

398

0x2B560FBB

17

910

0x2B560FBB

1

399

0x2C48FD60

17

911

0x2C48FD60

1

400

0x2D413CCD

17

912

0x2D413CCD

1

401

0x2E3EEBD2

17

913

0x2E3EEBD2

1

402

0x2F4228E8

17

914

0x2F4228E8

1

403

0x304B1333

17

915

0x304B1333

1

404

0x3159CA84

17

916

0x3159CA84

1

405

0x326E6F62

17

917

0x326E6F62

1

406

0x33892305

17

918

0x33892305

1

407

0x34AA0764

17

919

0x34AA0764

1

408

0x35D13F33

17

920

0x35D13F33

1

409

0x36FEEDE6

17

921

0x36FEEDE6

1

410

0x383337BB

17

922

0x383337BB

1

411

0x396E41BA

17

923

0x396E41BA

1

412

0x3AB031BA

17

924

0x3AB031BA

1

413

0x3BF92E67

17

925

0x3BF92E67

1

414

0x3D495F45

17

926

0x3D495F45

1

415

0x3EA0ECB7

17

927

0x3EA0ECB7

1

416

0x40000000

17

928

0x40000000

1

417

0x20B361A6

16

929

0x20B361A6

0

418

0x216AB0DA

16

930

0x216AB0DA

0

419

0x222603A0

16

931

0x222603A0

0

420

0x22E57079

16

932

0x22E57079

0

421

0x23A90E63

16

933

0x23A90E63

0

422

0x2470F4DD

16

934

0x2470F4DD

0

423

0x253D3BEA

16

935

0x253D3BEA

0

424

0x260DFC14

16

936

0x260DFC14

0

425

0x26E34E6E

16

937

0x26E34E6E

0

426

0x27BD4C98

16

938

0x27BD4C98

0

427

0x289C10C1

16

939

0x289C10C1

0

428

0x297FB5AA

16

940

0x297FB5AA

0

429

0x2A6856AD

16

941

0x2A6856AD

0

430

0x2B560FBB

16

942

0x2B560FBB

0

431

0x2C48FD60

16

943

0x2C48FD60

0

432

0x2D413CCD

16

944

0x2D413CCD

0

433

0x2E3EEBD2

16

945

0x2E3EEBD2

0

434

0x2F4228E8

16

946

0x2F4228E8

0

435

0x304B1333

16

947

0x304B1333

0

436

0x3159CA84

16

948

0x3159CA84

0

437

0x326E6F62

16

949

0x326E6F62

0

438

0x33892305

16

950

0x33892305

0

439

0x34AA0764

16

951

0x34AA0764

0

440

0x35D13F33

16

952

0x35D13F33

0

441

0x36FEEDE6

16

953

0x36FEEDE6

0

442

0x383337BB

16

954

0x383337BB

0

443

0x396E41BA

16

955

0x396E41BA

0

444

0x3AB031BA

16

956

0x3AB031BA

0

445

0x3BF92E67

16

957

0x3BF92E67

0

446

0x3D495F45

16

958

0x3D495F45

0

447

0x3EA0ECB7

16

959

0x3EA0ECB7

0

448

0x40000000

16

960

0x40000000

0

449

0x20B361A6

15

961

0x4166C34C

0

450

0x216AB0DA

15

962

0x42D561B4

0

451

0x222603A0

15

963

0x444C0740

0

452

0x22E57079

15

964

0x45CAE0F2

0

453

0x23A90E63

15

965

0x47521CC6

0

454

0x2470F4DD

15

966

0x48E1E9BA

0

455

0x253D3BEA

15

967

0x4A7A77D4

0

456

0x260DFC14

15

968

0x4C1BF829

0

457

0x26E34E6E

15

969

0x4DC69CDD

0

458

0x27BD4C98

15

970

0x4F7A9930

0

459

0x289C10C1

15

971

0x51382182

0

460

0x297FB5AA

15

972

0x52FF6B55

0

461

0x2A6856AD

15

973

0x54D0AD5A

0

462

0x2B560FBB

15

974

0x56AC1F75

0

463

0x2C48FD60

15

975

0x5891FAC1

0

464

0x2D413CCD

15

976

0x5A82799A

0

465

0x2E3EEBD2

15

977

0x5C7DD7A4

0

466

0x2F4228E8

15

978

0x5E8451D0

0

467

0x304B1333

15

979

0x60962665

0

468

0x3159CA84

15

980

0x62B39509

0

469

0x326E6F62

15

981

0x64DCDEC3

0

470

0x33892305

15

982

0x6712460B

0

471

0x34AA0764

15

983

0x69540EC9

0

472

0x35D13F33

15

984

0x6BA27E65

0

473

0x36FEEDE6

15

985

0x6DFDDBCC

0

474

0x383337BB

15

986

0x70666F76

0

475

0x396E41BA

15

987

0x72DC8374

0

476

0x3AB031BA

15

988

0x75606374

0

477

0x3BF92E67

15

989

0x77F25CCE

0

478

0x3D495F45

15

990

0x7A92BE8B

0

479

0x3EA0ECB7

15

991

0x7D41D96E

0

480

0x40000000

15

992

0x7FFFFFFF

0

481

0x20B361A6

14

993

0x7FFFFFFF

0

482

0x216AB0DA

14

994

0x7FFFFFFF

0

483

0x222603A0

14

995

0x7FFFFFFF

0

484

0x22E57079

14

996

0x7FFFFFFF

0

485

0x23A90E63

14

997

0x7FFFFFFF

0

486

0x2470F4DD

14

998

0x7FFFFFFF

0

487

0x253D3BEA

14

999

0x7FFFFFFF

0

488

0x260DFC14

14

1000

0x7FFFFFFF

0

489

0x26E34E6E

14

1001

0x7FFFFFFF

0

490

0x27BD4C98

14

1002

0x7FFFFFFF

0

491

0x289C10C1

14

1003

0x7FFFFFFF

0

492

0x297FB5AA

14

1004

0x7FFFFFFF

0

493

0x2A6856AD

14

1005

0x7FFFFFFF

0

494

0x2B560FBB

14

1006

0x7FFFFFFF

0

495

0x2C48FD60

14

1007

0x7FFFFFFF

0

496

0x2D413CCD

14

1008

0x7FFFFFFF

0

497

0x2E3EEBD2

14

1009

0x7FFFFFFF

0

498

0x2F4228E8

14

1010

0x7FFFFFFF

0

499

0x304B1333

14

1011

0x7FFFFFFF

0

500

0x3159CA84

14

1012

0x7FFFFFFF

0

501

0x326E6F62

14

1013

0x7FFFFFFF

0

502

0x33892305

14

1014

0x7FFFFFFF

0

503

0x34AA0764

14

1015

0x7FFFFFFF

0

504

0x35D13F33

14

1016

0x7FFFFFFF

0

505

0x36FEEDE6

14

1017

0x7FFFFFFF

0

506

0x383337BB

14

1018

0x7FFFFFFF

0

507

0x396E41BA

14

1019

0x7FFFFFFF

0

508

0x3AB031BA

14

1020

0x7FFFFFFF

0

509

0x3BF92E67

14

1021

0x7FFFFFFF

0

510

0x3D495F45

14

1022

0x7FFFFFFF

0

511

0x3EA0ECB7

14

1023

0x7FFFFFFF

0


  1. (informative)

    Predefined coefficients for integer invertible DCT / IDCT

A1_16[ 4 ] = {

      -2147483647, −889516852, 0, 889516852,

};

 

B1_16[ 4 ] = {

      2147483647, 1518500249, 0, −1518500249,

};

 

A3_16[ 4 ] = {

      −2147483647, −1434902698, −889516852, −427161056,

};

 

B3_16[ 4 ] = {

      2147483647, 1984016188, 1518500249, 821806413,

};

 

A4_16[ 8 ] = {

      0, 105499107, 211508678, 318549108, 427161056, 537916651, 651432042, 768381935,

};

 

B4_16[ 8 ] = {

      0, −210490206, −418953276, −623381597, −821806413, −1012316784, −1193077990, −1362349204,

};

 

A1_32[ 8 ] = {

      −2147483647, −1434902698, −889516852, −427161056, 0, 427161056, 889516852, 1434902698,

};

 

B1_32[ 8 ] = {

      2147483647, 1984016188, 1518500249, 821806413, 0, −821806413, −1518500249, −1984016188,

};

 

A3_32[ 8 ] = {

      −2147483647, −1762394283, −1434902698, −1147853924, −889516852, −651432042, −427161056, −211508678,

};

 

B3_32[ 8 ] = {

      2147483647, 2106220351, 1984016188, 1785567395, 1518500249, 1193077990, 821806413, 418953276,

};

 

A4_32[ 16 ] = {

      0, 52717765, 105499107, 158407910, 211508678, 264866845, 318549108, 372623761,

      427161056, 482233579, 537916651, 594288762, 651432042, 709432771, 768381935, 828375853,

};

 

B4_32[ 16 ] = {

      0, −105372028, −210490206, −315101294, −418953276, −521795963, −623381597, −723465451,

      −821806413, −918167571, −1012316784, −1104027236, −1193077990, −1279254515, −1362349204, −1442161874,

};

 

A1_64[ 16 ] = {

      −2147483647, −1762394283, −1434902698, −1147853924, −889516852, −651432042, −427161056, −211508678,

      0, 211508678, 427161056, 651432042, 889516852, 1147853924, 1434902698, 1762394283,

};

 

B1_64[ 16 ] = {

      2147483647, 2106220351, 1984016188, 1785567395, 1518500249, 1193077990, 821806413, 418953276,

      0, −418953276, −821806413, −1193077990, −1518500249, −1785567395, −1984016188, −2106220351,

};

 

A3_64[ 16 ] = {

      −2147483647, −1946365724, −1762394283, −1592682420, −1434902698, −1287152163, −1147853924, −1015684122,

      −889516852, −768381935, −651432042, −537916651, −427161056, −318549108, −211508678, −105499107,

};

 

B3_64[ 16 ] = {

      2147483647, 2137142926, 2106220351, 2055013722, 1984016188, 1893911493, 1785567395, 1660027308,

      1518500249, 1362349204, 1193077990, 1012316784, 821806413, 623381597, 418953276, 210490206,

};

 

A4_64[ 32 ] = {

      0, 26354912, 52717765, 79096506, 105499107, 131933563, 158407910, 184930235,

      211508678, 238151452, 264866845, 291663238, 318549108, 345533045, 372623761, 399830101,

      427161056, 454625776, 482233579, 509993970, 537916651, 566011534, 594288762, 622758717,

      651432042, 680319656, 709432771, 738782911, 768381935, 798242054, 828375853, 858796317,

};

 

B4_64[ 32 ] = {

      0, −52701887, −105372028, −157978697, −210490206, −262874923, −315101294, −367137860,

      −418953276, −470516330, −521795963, −572761285, −623381597, −673626408, −723465451, −772868706,

      −821806413, −870249095, −918167571, −965532978, −1012316784, −1058490807, −1104027236, −1148898640,

      −1193077990, −1236538675, −1279254515, −1321199780, −1362349204, −1402677999, −1442161874, −1480777044,

};

 

A1_128[ 32 ] = {

      −2147483647, −1946365724, −1762394283, −1592682420, −1434902698, −1287152163, −1147853924, −1015684122,

      −889516852, −768381935, −651432042, −537916651, −427161056, −318549108, −211508678, −105499107,

      0, 105499107, 211508678, 318549108, 427161056, 537916651, 651432042, 768381935,

      889516852, 1015684122, 1147853924, 1287152163, 1434902698, 1592682420, 1762394283, 1946365724,

};

 

B1_128[ 32 ] = {

      2147483647, 2137142926, 2106220351, 2055013722, 1984016188, 1893911493, 1785567395, 1660027308,

      1518500249, 1362349204, 1193077990, 1012316784, 821806413, 623381597, 418953276, 210490206,

      0, −210490206, −418953276, −623381597, −821806413, −1012316784, −1193077990, −1362349204,

      −1518500249, −1660027308, −1785567395, −1893911493, −1984016188, −2055013722, −2106220351, −2137142926,

};

 

A3_128[ 32 ] = {

      −2147483647, −2044574398, −1946365724, −1852432133, −1762394283, −1675912687, −1592682420, −1512428625,

      −1434902698, −1359879022, −1287152163, −1216534460, −1147853924, −1080952429, −1015684122, −951914032,

      −889516852, −828375853, −768381935, −709432771, −651432042, −594288762, −537916651, −482233579,

      −427161056, −372623761, −318549108, −264866845, −211508678, −158407910, −105499107, −52717765,

};

 

B3_128[ 32 ] = {

      2147483647, 2144896909, 2137142926, 2124240379, 2106220351, 2083126253, 2055013722, 2021950483,

      1984016188, 1941302224, 1893911493, 1841958164, 1785567395, 1724875039, 1660027308, 1591180425,

      1518500249, 1442161874, 1362349204, 1279254515, 1193077990, 1104027236, 1012316784, 918167571,

      821806413, 723465451, 623381597, 521795963, 418953276, 315101294, 210490206, 105372028,

};

 

A4_128[ 64 ] = {

      0, 13176960, 26354912, 39534849, 52717765, 65904652, 79096506, 92294325,

      105499107, 118711851, 131933563, 145165246, 158407910, 171662568, 184930235, 198211930,

      211508678, 224821507, 238151452, 251499549, 264866845, 278254389, 291663238, 305094454,

      318549108, 332028276, 345533045, 359064506, 372623761, 386211919, 399830101, 413479434,

      427161056, 440876117, 454625776, 468411202, 482233579, 496094100, 509993970, 523934410,

      537916651, 551941939, 566011534, 580126712, 594288762, 608498990, 622758717, 637069283,

      651432042, 665848369, 680319656, 694847313, 709432771, 724077480, 738782911, 753550558,

      768381935, 783278580, 798242054, 813273942, 828375853, 843549424, 858796317, 874118220,

};

 

B4_128[ 64 ] = {

      0, −26352928, −52701887, −79042909, −105372028, −131685278, −157978697, −184248325,

      −210490206, −236700388, −262874923, −289009871, −315101294, −341145265, −367137860, −393075166,

      −418953276, −444768293, −470516330, −496193509, −521795963, −547319836, −572761285, −598116478,

      −623381597, −648552837, −673626408, −698598533, −723465451, −748223418, −772868706, −797397602,

      −821806413, −846091463, −870249095, −894275670, −918167571, −941921200, −965532978, −988999351,

      −1012316784, −1035481765, −1058490807, −1081340445, −1104027236, −1126547765, −1148898640, −1171076495,

      −1193077990, −1214899812, −1236538675, −1257991319, −1279254515, −1300325059, −1321199780, −1341875532,

      −1362349204, −1382617710, −1402677999, −1422527050, −1442161874, −1461579513, −1480777044, −1499751575,

};

 

A1_256[ 64 ] = {

      −2147483647, −2044574398, −1946365724, −1852432133, −1762394283, −1675912687, −1592682420, −1512428625,

      −1434902698, −1359879022, −1287152163, −1216534460, −1147853924, −1080952429, −1015684122, −951914032,

      −889516852, −828375853, −768381935, −709432771, −651432042, −594288762, −537916651, −482233579,

      −427161056, −372623761, −318549108, −264866845, −211508678, −158407910, −105499107, −52717765,

      0, 52717765, 105499107, 158407910, 211508678, 264866845, 318549108, 372623761,

      427161056, 482233579, 537916651, 594288762, 651432042, 709432771, 768381935, 828375853,

      889516852, 951914032, 1015684122, 1080952429, 1147853924, 1216534460, 1287152163, 1359879022,

      1434902698, 1512428625, 1592682420, 1675912687, 1762394283, 1852432133, 1946365724, 2044574398,

};

 

B1_256[ 64 ] = {

      2147483647, 2144896909, 2137142926, 2124240379, 2106220351, 2083126253, 2055013722, 2021950483,

      1984016188, 1941302224, 1893911493, 1841958164, 1785567395, 1724875039, 1660027308, 1591180425,

      1518500249, 1442161874, 1362349204, 1279254515, 1193077990, 1104027236, 1012316784, 918167571,

      821806413, 723465451, 623381597, 521795963, 418953276, 315101294, 210490206, 105372028,

      0, −105372028, −210490206, −315101294, −418953276, −521795963, −623381597, −723465451,

      −821806413, −918167571, −1012316784, −1104027236, −1193077990, −1279254515, −1362349204, −1442161874,

      −1518500249, −1591180425, −1660027308, −1724875039, −1785567395, −1841958164, −1893911493, −1941302224,

      −1984016188, −2021950483, −2055013722, −2083126253, −2106220351, −2124240379, −2137142926, −2144896909,

};

 

A3_256[ 64 ] = {

      −2147483647, −2095412859, −2044574398, −1994910245, −1946365724, −1898889255, −1852432133, −1806948326,

      −1762394283, −1718728765, −1675912687, −1633908973, −1592682420, −1552199576, −1512428625, −1473339283,

      −1434902698, −1397091361, −1359879022, −1323240610, −1287152163, −1251590761, −1216534460, −1181962234,

      −1147853924, −1114190182, −1080952429, −1048122803, −1015684122, −983619845, −951914032, −920551313,

      −889516852, −858796317, −828375853, −798242054, −768381935, −738782911, −709432771, −680319656,

      −651432042, −622758717, −594288762, −566011534, −537916651, −509993970, −482233579, −454625776,

      −427161056, −399830101, −372623761, −345533045, −318549108, −291663238, −264866845, −238151452,

      −211508678, −184930235, −158407910, −131933563, −105499107, −79096506, −52717765, −26354912,

};

 

B3_256[ 64 ] = {

      2147483647, 2146836865, 2144896909, 2141664947, 2137142926, 2131333571, 2124240379, 2115867625,

      2106220351, 2095304369, 2083126253, 2069693341, 2055013722, 2039096240, 2021950483, 2003586778,

      1984016188, 1963250500, 1941302224, 1918184580, 1893911493, 1868497585, 1841958164, 1814309215,

      1785567395, 1755750016, 1724875039, 1692961061, 1660027308, 1626093615, 1591180425, 1555308767,

      1518500249, 1480777044, 1442161874, 1402677999, 1362349204, 1321199780, 1279254515, 1236538675,

      1193077990, 1148898640, 1104027236, 1058490807, 1012316784, 965532978, 918167571, 870249095,

      821806413, 772868706, 723465451, 673626408, 623381597, 572761285, 521795963, 470516330,

      418953276, 367137860, 315101294, 262874923, 210490206, 157978697, 105372028, 52701887,

};

 

A4_256[ 128 ] = {

      0, 6588418, 13176960, 19765750, 26354912, 32944571, 39534849, 46125873,

      52717765, 59310649, 65904652, 72499896, 79096506, 85694608, 92294325, 98895783,

      105499107, 112104421, 118711851, 125321523, 131933563, 138548095, 145165246, 151785142,

      158407910, 165033677, 171662568, 178294712, 184930235, 191569265, 198211930, 204858358,

      211508678, 218163018, 224821507, 231484275, 238151452, 244823166, 251499549, 258180732,

      264866845, 271558020, 278254389, 284956084, 291663238, 298375983, 305094454, 311818784,

      318549108, 325285560, 332028276, 338777392, 345533045, 352295370, 359064506, 365840590,

      372623761, 379414157, 386211919, 393017187, 399830101, 406650802, 413479434, 420316137,

      427161056, 434014335, 440876117, 447746549, 454625776, 461513944, 468411202, 475317698,

      482233579, 489158996, 496094100, 503039040, 509993970, 516959042, 523934410, 530920228,

      537916651, 544923836, 551941939, 558971119, 566011534, 573063345, 580126712, 587201797,

      594288762, 601387772, 608498990, 615622583, 622758717, 629907561, 637069283, 644244053,

      651432042, 658633423, 665848369, 673077055, 680319656, 687576349, 694847313, 702132726,

      709432771, 716747627, 724077480, 731422512, 738782911, 746158864, 753550558, 760958185,

      768381935, 775822002, 783278580, 790751865, 798242054, 805749346, 813273942, 820816043,

      828375853, 835953578, 843549424, 851163600, 858796317, 866447785, 874118220, 881807836,

};

 

B4_256[ 128 ] = {

      0, −13176712, −26352928, −39528151, −52701887, −65873638, −79042909, −92209205,

      −105372028, −118530885, −131685278, −144834714, −157978697, −171116732, −184248325, −197372981,

      −210490206, −223599506, −236700388, −249792358, −262874923, −275947592, −289009871, −302061269,

      −315101294, −328129457, −341145265, −354148229, −367137860, −380113669, −393075166, −406021864,

      −418953276, −431868915, −444768293, −457650927, −470516330, −483364019, −496193509, −509004318,

      −521795963, −534567963, −547319836, −560051103, −572761285, −585449903, −598116478, −610760535,

      −623381597, −635979190, −648552837, −661102068, −673626408, −686125386, −698598533, −711045377,

      −723465451, −735858287, −748223418, −760560379, −772868706, −785147934, −797397602, −809617248,

      −821806413, −833964637, −846091463, −858186434, −870249095, −882278991, −894275670, −906238681,

      −918167571, −930061894, −941921200, −953745043, −965532978, −977284561, −988999351, −1000676905,

      −1012316784, −1023918549, −1035481765, −1047005996, −1058490807, −1069935767, −1081340445, −1092704410,

      −1104027236, −1115308496, −1126547765, −1137744620, −1148898640, −1160009404, −1171076495, −1182099495,

      −1193077990, −1204011566, −1214899812, −1225742318, −1236538675, −1247288477, −1257991319, −1268646799,

      −1279254515, −1289814068, −1300325059, −1310787095, −1321199780, −1331562722, −1341875532, −1352137822,

      −1362349204, −1372509294, −1382617710, −1392674071, −1402677999, −1412629117, −1422527050, −1432371426,

      −1442161874, −1451898025, −1461579513, −1471205973, −1480777044, −1490292364, −1499751575, −1509154322,

};

 

A1_512[ 128 ] = {

      −2147483647, −2095412859, −2044574398, −1994910245, −1946365724, −1898889255, −1852432133, −1806948326,

      −1762394283, −1718728765, −1675912687, −1633908973, −1592682420, −1552199576, −1512428625, −1473339283,

      −1434902698, −1397091361, −1359879022, −1323240610, −1287152163, −1251590761, −1216534460, −1181962234,

      −1147853924, −1114190182, −1080952429, −1048122803, −1015684122, −983619845, −951914032, −920551313,

      −889516852, −858796317, −828375853, −798242054, −768381935, −738782911, −709432771, −680319656,

      −651432042, −622758717, −594288762, −566011534, −537916651, −509993970, −482233579, −454625776,

      −427161056, −399830101, −372623761, −345533045, −318549108, −291663238, −264866845, −238151452,

      −211508678, −184930235, −158407910, −131933563, −105499107, −79096506, −52717765, −26354912,

      0, 26354912, 52717765, 79096506, 105499107, 131933563, 158407910, 184930235,

      211508678, 238151452, 264866845, 291663238, 318549108, 345533045, 372623761, 399830101,

      427161056, 454625776, 482233579, 509993970, 537916651, 566011534, 594288762, 622758717,

      651432042, 680319656, 709432771, 738782911, 768381935, 798242054, 828375853, 858796317,

      889516852, 920551313, 951914032, 983619845, 1015684122, 1048122803, 1080952429, 1114190182,

      1147853924, 1181962234, 1216534460, 1251590761, 1287152163, 1323240610, 1359879022, 1397091361,

      1434902698, 1473339283, 1512428625, 1552199576, 1592682420, 1633908973, 1675912687, 1718728765,

      1762394283, 1806948326, 1852432133, 1898889255, 1946365724, 1994910245, 2044574398, 2095412859,

};

 

B1_512[ 128 ] = {

      2147483647, 2146836865, 2144896909, 2141664947, 2137142926, 2131333571, 2124240379, 2115867625,

      2106220351, 2095304369, 2083126253, 2069693341, 2055013722, 2039096240, 2021950483, 2003586778,

      1984016188, 1963250500, 1941302224, 1918184580, 1893911493, 1868497585, 1841958164, 1814309215,

      1785567395, 1755750016, 1724875039, 1692961061, 1660027308, 1626093615, 1591180425, 1555308767,

      1518500249, 1480777044, 1442161874, 1402677999, 1362349204, 1321199780, 1279254515, 1236538675,

      1193077990, 1148898640, 1104027236, 1058490807, 1012316784, 965532978, 918167571, 870249095,

      821806413, 772868706, 723465451, 673626408, 623381597, 572761285, 521795963, 470516330,

      418953276, 367137860, 315101294, 262874923, 210490206, 157978697, 105372028, 52701887,

      0, −52701887, −105372028, −157978697, −210490206, −262874923, −315101294, −367137860,

      −418953276, −470516330, −521795963, −572761285, −623381597, −673626408, −723465451, −772868706,

      −821806413, −870249095, −918167571, −965532978, −1012316784, −1058490807, −1104027236, −1148898640,

      −1193077990, −1236538675, −1279254515, −1321199780, −1362349204, −1402677999, −1442161874, −1480777044,

      −1518500249, −1555308767, −1591180425, −1626093615, −1660027308, −1692961061, −1724875039, −1755750016,

      −1785567395, −1814309215, −1841958164, −1868497585, −1893911493, −1918184580, −1941302224, −1963250500,

      −1984016188, −2003586778, −2021950483, −2039096240, −2055013722, −2069693341, −2083126253, −2095304369,

      −2106220351, −2115867625, −2124240379, −2131333571, −2137142926, −2141664947, −2144896909, −2146836865,

};

 

A3_512[ 128 ] = {

      −2147483647, −2121290448, −2095412859, −2069843295, −2044574398, −2019599026, −1994910245, −1970501324,

      −1946365724, −1922497092, −1898889255, −1875536213, −1852432133, −1829571343, −1806948326, −1784557714,

      −1762394283, −1740452950, −1718728765, −1697216909, −1675912687, −1654811527, −1633908973, −1613200682,

      −1592682420, −1572350060, −1552199576, −1532227041, −1512428625, −1492800589, −1473339283, −1454041146,

      −1434902698, −1415920543, −1397091361, −1378411911, −1359879022, −1341489598, −1323240610, −1305129097,

      −1287152163, −1269306976, −1251590761, −1234000808, −1216534460, −1199189117, −1181962234, −1164851317,

      −1147853924, −1130967661, −1114190182, −1097519190, −1080952429, −1064487689, −1048122803, −1031855642,

      −1015684122, −999606193, −983619845, −967723104, −951914032, −936190725, −920551313, −904993957,

      −889516852, −874118220, −858796317, −843549424, −828375853, −813273942, −798242054, −783278580,

      −768381935, −753550558, −738782911, −724077480, −709432771, −694847313, −680319656, −665848369,

      −651432042, −637069283, −622758717, −608498990, −594288762, −580126712, −566011534, −551941939,

      −537916651, −523934410, −509993970, −496094100, −482233579, −468411202, −454625776, −440876117,

      −427161056, −413479434, −399830101, −386211919, −372623761, −359064506, −345533045, −332028276,

      −318549108, −305094454, −291663238, −278254389, −264866845, −251499549, −238151452, −224821507,

      −211508678, −198211930, −184930235, −171662568, −158407910, −145165246, −131933563, −118711851,

      −105499107, −92294325, −79096506, −65904652, −52717765, −39534849, −26354912, −13176960,

};

 

B3_512[ 128 ] = {

      2147483647, 2147321945, 2146836865, 2146028479, 2144896909, 2143442325, 2141664947, 2139565042,

      2137142926, 2134398965, 2131333571, 2127947205, 2124240379, 2120213650, 2115867625, 2111202958,

      2106220351, 2100920555, 2095304369, 2089372637, 2083126253, 2076566159, 2069693341, 2062508835,

      2055013722, 2047209132, 2039096240, 2030676268, 2021950483, 2012920200, 2003586778, 1993951624,

      1984016188, 1973781966, 1963250500, 1952423376, 1941302224, 1929888719, 1918184580, 1906191569,

      1893911493, 1881346201, 1868497585, 1855367580, 1841958164, 1828271355, 1814309215, 1800073848,

      1785567395, 1770792043, 1755750016, 1740443580, 1724875039, 1709046738, 1692961061, 1676620431,

      1660027308, 1643184190, 1626093615, 1608758157, 1591180425, 1573363067, 1555308767, 1537020243,

      1518500249, 1499751575, 1480777044, 1461579513, 1442161874, 1422527050, 1402677999, 1382617710,

      1362349204, 1341875532, 1321199780, 1300325059, 1279254515, 1257991319, 1236538675, 1214899812,

      1193077990, 1171076495, 1148898640, 1126547765, 1104027236, 1081340445, 1058490807, 1035481765,

      1012316784, 988999351, 965532978, 941921200, 918167571, 894275670, 870249095, 846091463,

      821806413, 797397602, 772868706, 748223418, 723465451, 698598533, 673626408, 648552837,

      623381597, 598116478, 572761285, 547319836, 521795963, 496193509, 470516330, 444768293,

      418953276, 393075166, 367137860, 341145265, 315101294, 289009871, 262874923, 236700388,

      210490206, 184248325, 157978697, 131685278, 105372028, 79042909, 52701887, 26352928,

};

 

A4_512[ 256 ] = {

      0, 3294201, 6588418, 9882666, 13176960, 16471316, 19765750, 23060277,

      26354912, 29649672, 32944571, 36239625, 39534849, 42830260, 46125873, 49421702,

      52717765, 56014075, 59310649, 62607503, 65904652, 69202111, 72499896, 75798023,

      79096506, 82395363, 85694608, 88994257, 92294325, 95594829, 98895783, 102197204,

      105499107, 108801507, 112104421, 115407864, 118711851, 122016399, 125321523, 128627239,

      131933563, 135240509, 138548095, 141856335, 145165246, 148474843, 151785142, 155096160,

      158407910, 161720411, 165033677, 168347724, 171662568, 174978225, 178294712, 181612043,

      184930235, 188249303, 191569265, 194890135, 198211930, 201534666, 204858358, 208183024,

      211508678, 214835338, 218163018, 221491736, 224821507, 228152348, 231484275, 234817304,

      238151452, 241486733, 244823166, 248160766, 251499549, 254839533, 258180732, 261523164,

      264866845, 268211792, 271558020, 274905547, 278254389, 281604562, 284956084, 288308970,

      291663238, 295018903, 298375983, 301734494, 305094454, 308455878, 311818784, 315183188,

      318549108, 321916559, 325285560, 328656127, 332028276, 335402026, 338777392, 342154393,

      345533045, 348913365, 352295370, 355679078, 359064506, 362451671, 365840590, 369231281,

      372623761, 376018047, 379414157, 382812109, 386211919, 389613606, 393017187, 396422679,

      399830101, 403239469, 406650802, 410064118, 413479434, 416896767, 420316137, 423737561,

      427161056, 430586641, 434014335, 437444154, 440876117, 444310243, 447746549, 451185054,

      454625776, 458068733, 461513944, 464961428, 468411202, 471863286, 475317698, 478774456,

      482233579, 485695086, 489158996, 492625328, 496094100, 499565331, 503039040, 506515247,

      509993970, 513475229, 516959042, 520445429, 523934410, 527426003, 530920228, 534417104,

      537916651, 541418888, 544923836, 548431513, 551941939, 555455134, 558971119, 562489912,

      566011534, 569536005, 573063345, 576593574, 580126712, 583662780, 587201797, 590743784,

      594288762, 597836751, 601387772, 604941844, 608498990, 612059229, 615622583, 619189072,

      622758717, 626331540, 629907561, 633486802, 637069283, 640655026, 644244053, 647836385,

      651432042, 655031048, 658633423, 662239190, 665848369, 669460984, 673077055, 676696605,

      680319656, 683946230, 687576349, 691210036, 694847313, 698488202, 702132726, 705780908,

      709432771, 713088336, 716747627, 720410667, 724077480, 727748087, 731422512, 735100779,

      738782911, 742468931, 746158864, 749852731, 753550558, 757252368, 760958185, 764668033,

      768381935, 772099917, 775822002, 779548215, 783278580, 787013122, 790751865, 794494834,

      798242054, 801993550, 805749346, 809509468, 813273942, 817042791, 820816043, 824593721,

      828375853, 832162463, 835953578, 839749223, 843549424, 847354208, 851163600, 854977628,

      858796317, 862619694, 866447785, 870280618, 874118220, 877960617, 881807836, 885659905,

};

 

B4_512[ 256 ] = {

      0, −6588387, −13176712, −19764913, −26352928, −32940695, −39528151, −46115236,

      −52701887, −59288042, −65873638, −72458615, −79042909, −85626460, −92209205, −98791081,

      −105372028, −111951983, −118530885, −125108670, −131685278, −138260647, −144834714, −151407418,

      −157978697, −164548489, −171116732, −177683365, −184248325, −190811551, −197372981, −203932553,

      −210490206, −217045877, −223599506, −230151030, −236700388, −243247517, −249792358, −256334847,

      −262874923, −269412525, −275947592, −282480061, −289009871, −295536961, −302061269, −308582734,

      −315101294, −321616889, −328129457, −334638936, −341145265, −347648383, −354148229, −360644742,

      −367137860, −373627523, −380113669, −386596237, −393075166, −399550396, −406021864, −412489512,

      −418953276, −425413098, −431868915, −438320667, −444768293, −451211734, −457650927, −464085813,

      −470516330, −476942419, −483364019, −489781069, −496193509, −502601279, −509004318, −515402566,

      −521795963, −528184448, −534567963, −540946445, −547319836, −553688076, −560051103, −566408860,

      −572761285, −579108319, −585449903, −591785976, −598116478, −604441351, −610760535, −617073970,

      −623381597, −629683357, −635979190, −642269036, −648552837, −654830534, −661102068, −667367379,

      −673626408, −679879097, −686125386, −692365218, −698598533, −704825272, −711045377, −717258790,

      −723465451, −729665303, −735858287, −742044345, −748223418, −754395449, −760560379, −766718151,

      −772868706, −779011986, −785147934, −791276492, −797397602, −803511207, −809617248, −815715670,

      −821806413, −827889421, −833964637, −840032003, −846091463, −852142959, −858186434, −864221832,

      −870249095, −876268167, −882278991, −888281511, −894275670, −900261412, −906238681, −912207419,

      −918167571, −924119082, −930061894, −935995952, −941921200, −947837582, −953745043, −959643527,

      −965532978, −971413341, −977284561, −983146583, −988999351, −994842809, −1000676905, −1006501581,

      −1012316784, −1018122458, −1023918549, −1029705003, −1035481765, −1041248781, −1047005996, −1052753356,

      −1058490807, −1064218296, −1069935767, −1075643168, −1081340445, −1087027543, −1092704410, −1098370992,

      −1104027236, −1109673088, −1115308496, −1120933406, −1126547765, −1132151521, −1137744620, −1143327011,

      −1148898640, −1154459455, −1160009404, −1165548435, −1171076495, −1176593532, −1182099495, −1187594332,

      −1193077990, −1198550419, −1204011566, −1209461381, −1214899812, −1220326808, −1225742318, −1231146290,

      −1236538675, −1241919421, −1247288477, −1252645793, −1257991319, −1263325005, −1268646799, −1273956652,

      −1279254515, −1284540337, −1289814068, −1295075658, −1300325059, −1305562221, −1310787095, −1315999631,

      −1321199780, −1326387493, −1331562722, −1336725418, −1341875532, −1347013016, −1352137822, −1357249900,

      −1362349204, −1367435684, −1372509294, −1377569985, −1382617710, −1387652421, −1392674071, −1397682613,

      −1402677999, −1407660183, −1412629117, −1417584755, −1422527050, −1427455956, −1432371426, −1437273414,

      −1442161874, −1447036759, −1451898025, −1456745625, −1461579513, −1466399644, −1471205973, −1475998455,

      −1480777044, −1485541695, −1490292364, −1495029005, −1499751575, −1504460029, −1509154322, −1513834410,

};

 

A1_1024[ 256 ] = {

      −2147483647, −2121290448, −2095412859, −2069843295, −2044574398, −2019599026, −1994910245, −1970501324,

      −1946365724, −1922497092, −1898889255, −1875536213, −1852432133, −1829571343, −1806948326, −1784557714,

      −1762394283, −1740452950, −1718728765, −1697216909, −1675912687, −1654811527, −1633908973, −1613200682,

      −1592682420, −1572350060, −1552199576, −1532227041, −1512428625, −1492800589, −1473339283, −1454041146,

      −1434902698, −1415920543, −1397091361, −1378411911, −1359879022, −1341489598, −1323240610, −1305129097,

      −1287152163, −1269306976, −1251590761, −1234000808, −1216534460, −1199189117, −1181962234, −1164851317,

      −1147853924, −1130967661, −1114190182, −1097519190, −1080952429, −1064487689, −1048122803, −1031855642,

      −1015684122, −999606193, −983619845, −967723104, −951914032, −936190725, −920551313, −904993957,

      −889516852, −874118220, −858796317, −843549424, −828375853, −813273942, −798242054, −783278580,

      −768381935, −753550558, −738782911, −724077480, −709432771, −694847313, −680319656, −665848369,

      −651432042, −637069283, −622758717, −608498990, −594288762, −580126712, −566011534, −551941939,

      −537916651, −523934410, −509993970, −496094100, −482233579, −468411202, −454625776, −440876117,

      −427161056, −413479434, −399830101, −386211919, −372623761, −359064506, −345533045, −332028276,

      −318549108, −305094454, −291663238, −278254389, −264866845, −251499549, −238151452, −224821507,

      −211508678, −198211930, −184930235, −171662568, −158407910, −145165246, −131933563, −118711851,

      −105499107, −92294325, −79096506, −65904652, −52717765, −39534849, −26354912, −13176960,

      0, 13176960, 26354912, 39534849, 52717765, 65904652, 79096506, 92294325,

      105499107, 118711851, 131933563, 145165246, 158407910, 171662568, 184930235, 198211930,

      211508678, 224821507, 238151452, 251499549, 264866845, 278254389, 291663238, 305094454,

      318549108, 332028276, 345533045, 359064506, 372623761, 386211919, 399830101, 413479434,

      427161056, 440876117, 454625776, 468411202, 482233579, 496094100, 509993970, 523934410,

      537916651, 551941939, 566011534, 580126712, 594288762, 608498990, 622758717, 637069283,

      651432042, 665848369, 680319656, 694847313, 709432771, 724077480, 738782911, 753550558,

      768381935, 783278580, 798242054, 813273942, 828375853, 843549424, 858796317, 874118220,

      889516852, 904993957, 920551313, 936190725, 951914032, 967723104, 983619845, 999606193,

      1015684122, 1031855642, 1048122803, 1064487689, 1080952429, 1097519190, 1114190182, 1130967661,

      1147853924, 1164851317, 1181962234, 1199189117, 1216534460, 1234000808, 1251590761, 1269306976,

      1287152163, 1305129097, 1323240610, 1341489598, 1359879022, 1378411911, 1397091361, 1415920543,

      1434902698, 1454041146, 1473339283, 1492800589, 1512428625, 1532227041, 1552199576, 1572350060,

      1592682420, 1613200682, 1633908973, 1654811527, 1675912687, 1697216909, 1718728765, 1740452950,

      1762394283, 1784557714, 1806948326, 1829571343, 1852432133, 1875536213, 1898889255, 1922497092,

      1946365724, 1970501324, 1994910245, 2019599026, 2044574398, 2069843295, 2095412859, 2121290448,

};

 

B1_1024[ 256 ] = {

      2147483647, 2147321945, 2146836865, 2146028479, 2144896909, 2143442325, 2141664947, 2139565042,

      2137142926, 2134398965, 2131333571, 2127947205, 2124240379, 2120213650, 2115867625, 2111202958,

      2106220351, 2100920555, 2095304369, 2089372637, 2083126253, 2076566159, 2069693341, 2062508835,

      2055013722, 2047209132, 2039096240, 2030676268, 2021950483, 2012920200, 2003586778, 1993951624,

      1984016188, 1973781966, 1963250500, 1952423376, 1941302224, 1929888719, 1918184580, 1906191569,

      1893911493, 1881346201, 1868497585, 1855367580, 1841958164, 1828271355, 1814309215, 1800073848,

      1785567395, 1770792043, 1755750016, 1740443580, 1724875039, 1709046738, 1692961061, 1676620431,

      1660027308, 1643184190, 1626093615, 1608758157, 1591180425, 1573363067, 1555308767, 1537020243,

      1518500249, 1499751575, 1480777044, 1461579513, 1442161874, 1422527050, 1402677999, 1382617710,

      1362349204, 1341875532, 1321199780, 1300325059, 1279254515, 1257991319, 1236538675, 1214899812,

      1193077990, 1171076495, 1148898640, 1126547765, 1104027236, 1081340445, 1058490807, 1035481765,

      1012316784, 988999351, 965532978, 941921200, 918167571, 894275670, 870249095, 846091463,

      821806413, 797397602, 772868706, 748223418, 723465451, 698598533, 673626408, 648552837,

      623381597, 598116478, 572761285, 547319836, 521795963, 496193509, 470516330, 444768293,

      418953276, 393075166, 367137860, 341145265, 315101294, 289009871, 262874923, 236700388,

      210490206, 184248325, 157978697, 131685278, 105372028, 79042909, 52701887, 26352928,

      0, −26352928, −52701887, −79042909, −105372028, −131685278, −157978697, −184248325,

      −210490206, −236700388, −262874923, −289009871, −315101294, −341145265, −367137860, −393075166,

      −418953276, −444768293, −470516330, −496193509, −521795963, −547319836, −572761285, −598116478,

      −623381597, −648552837, −673626408, −698598533, −723465451, −748223418, −772868706, −797397602,

      −821806413, −846091463, −870249095, −894275670, −918167571, −941921200, −965532978, −988999351,

      −1012316784, −1035481765, −1058490807, −1081340445, −1104027236, −1126547765, −1148898640, −1171076495,

      −1193077990, −1214899812, −1236538675, −1257991319, −1279254515, −1300325059, −1321199780, −1341875532,

      −1362349204, −1382617710, −1402677999, −1422527050, −1442161874, −1461579513, −1480777044, −1499751575,

      −1518500249, −1537020243, −1555308767, −1573363067, −1591180425, −1608758157, −1626093615, −1643184190,

      −1660027308, −1676620431, −1692961061, −1709046738, −1724875039, −1740443580, −1755750016, −1770792043,

      −1785567395, −1800073848, −1814309215, −1828271355, −1841958164, −1855367580, −1868497585, −1881346201,

      −1893911493, −1906191569, −1918184580, −1929888719, −1941302224, −1952423376, −1963250500, −1973781966,

      −1984016188, −1993951624, −2003586778, −2012920200, −2021950483, −2030676268, −2039096240, −2047209132,

      −2055013722, −2062508835, −2069693341, −2076566159, −2083126253, −2089372637, −2095304369, −2100920555,

      −2106220351, −2111202958, −2115867625, −2120213650, −2124240379, −2127947205, −2131333571, −2134398965,

      −2137142926, −2139565042, −2141664947, −2143442325, −2144896909, −2146028479, −2146836865, −2147321945,

};

 

A3_1024[ 256 ] = {

      −2147483647, −2134347114, −2121290448, −2108312682, −2095412859, −2082590039, −2069843295, −2057171715,

      −2044574398, −2032050460, −2019599026, −2007219237, −1994910245, −1982671216, −1970501324, −1958399760,

      −1946365724, −1934398427, −1922497092, −1910660953, −1898889255, −1887181253, −1875536213, −1863953411,

      −1852432133, −1840971676, −1829571343, −1818230452, −1806948326, −1795724299, −1784557714, −1773447921,

      −1762394283, −1751396166, −1740452950, −1729564018, −1718728765, −1707946592, −1697216909, −1686539132,

      −1675912687, −1665337006, −1654811527, −1644335698, −1633908973, −1623530812, −1613200682, −1602918058,

      −1592682420, −1582493256, −1572350060, −1562252331, −1552199576, −1542191307, −1532227041, −1522306304,

      −1512428625, −1502593540, −1492800589, −1483049319, −1473339283, −1463670038, −1454041146, −1444452175,

      −1434902698, −1425392293, −1415920543, −1406487035, −1397091361, −1387733119, −1378411911, −1369127341,

      −1359879022, −1350666568, −1341489598, −1332347736, −1323240610, −1314167852, −1305129097, −1296123986,

      −1287152163, −1278213276, −1269306976, −1260432918, −1251590761, −1242780169, −1234000808, −1225252347,

      −1216534460, −1207846823, −1199189117, −1190561025, −1181962234, −1173392433, −1164851317, −1156338580,

      −1147853924, −1139397049, −1130967661, −1122565468, −1114190182, −1105841517, −1097519190, −1089222920,

      −1080952429, −1072707443, −1064487689, −1056292898, −1048122803, −1039977138, −1031855642, −1023758056,

      −1015684122, −1007633585, −999606193, −991601695, −983619845, −975660396, −967723104, −959807729,

      −951914032, −944041776, −936190725, −928360648, −920551313, −912762492, −904993957, −897245485,

      −889516852, −881807836, −874118220, −866447785, −858796317, −851163600, −843549424, −835953578,

      −828375853, −820816043, −813273942, −805749346, −798242054, −790751865, −783278580, −775822002,

      −768381935, −760958185, −753550558, −746158864, −738782911, −731422512, −724077480, −716747627,

      −709432771, −702132726, −694847313, −687576349, −680319656, −673077055, −665848369, −658633423,

      −651432042, −644244053, −637069283, −629907561, −622758717, −615622583, −608498990, −601387772,

      −594288762, −587201797, −580126712, −573063345, −566011534, −558971119, −551941939, −544923836,

      −537916651, −530920228, −523934410, −516959042, −509993970, −503039040, −496094100, −489158996,

      −482233579, −475317698, −468411202, −461513944, −454625776, −447746549, −440876117, −434014335,

      −427161056, −420316137, −413479434, −406650802, −399830101, −393017187, −386211919, −379414157,

      −372623761, −365840590, −359064506, −352295370, −345533045, −338777392, −332028276, −325285560,

      −318549108, −311818784, −305094454, −298375983, −291663238, −284956084, −278254389, −271558020,

      −264866845, −258180732, −251499549, −244823166, −238151452, −231484275, −224821507, −218163018,

      −211508678, −204858358, −198211930, −191569265, −184930235, −178294712, −171662568, −165033677,

      −158407910, −151785142, −145165246, −138548095, −131933563, −125321523, −118711851, −112104421,

      −105499107, −98895783, −92294325, −85694608, −79096506, −72499896, −65904652, −59310649,

      −52717765, −46125873, −39534849, −32944571, −26354912, −19765750, −13176960, −6588418,

};

 

B3_1024[ 256 ] = {

      2147483647, 2147443221, 2147321945, 2147119824, 2146836865, 2146473079, 2146028479, 2145503082,

      2144896909, 2144209981, 2143442325, 2142593970, 2141664947, 2140655292, 2139565042, 2138394239,

      2137142926, 2135811152, 2134398965, 2132906419, 2131333571, 2129680479, 2127947205, 2126133816,

      2124240379, 2122266966, 2120213650, 2118080510, 2115867625, 2113575079, 2111202958, 2108751351,

      2106220351, 2103610053, 2100920555, 2098151959, 2095304369, 2092377891, 2089372637, 2086288719,

      2083126253, 2079885359, 2076566159, 2073168776, 2069693341, 2066139982, 2062508835, 2058800035,

      2055013722, 2051150040, 2047209132, 2043191149, 2039096240, 2034924561, 2030676268, 2026351521,

      2021950483, 2017473320, 2012920200, 2008291295, 2003586778, 1998806828, 1993951624, 1989021349,

      1984016188, 1978936330, 1973781966, 1968553291, 1963250500, 1957873795, 1952423376, 1946899450,

      1941302224, 1935631909, 1929888719, 1924072870, 1918184580, 1912224072, 1906191569, 1900087300,

      1893911493, 1887664382, 1881346201, 1874957188, 1868497585, 1861967633, 1855367580, 1848697673,

      1841958164, 1835149305, 1828271355, 1821324571, 1814309215, 1807225552, 1800073848, 1792854372,

      1785567395, 1778213194, 1770792043, 1763304223, 1755750016, 1748129706, 1740443580, 1732691927,

      1724875039, 1716993211, 1709046738, 1701035921, 1692961061, 1684822463, 1676620431, 1668355276,

      1660027308, 1651636840, 1643184190, 1634669675, 1626093615, 1617456334, 1608758157, 1599999410,

      1591180425, 1582301533, 1573363067, 1564365366, 1555308767, 1546193612, 1537020243, 1527789006,

      1518500249, 1509154322, 1499751575, 1490292364, 1480777044, 1471205973, 1461579513, 1451898025,

      1442161874, 1432371426, 1422527050, 1412629117, 1402677999, 1392674071, 1382617710, 1372509294,

      1362349204, 1352137822, 1341875532, 1331562722, 1321199780, 1310787095, 1300325059, 1289814068,

      1279254515, 1268646799, 1257991319, 1247288477, 1236538675, 1225742318, 1214899812, 1204011566,

      1193077990, 1182099495, 1171076495, 1160009404, 1148898640, 1137744620, 1126547765, 1115308496,

      1104027236, 1092704410, 1081340445, 1069935767, 1058490807, 1047005996, 1035481765, 1023918549,

      1012316784, 1000676905, 988999351, 977284561, 965532978, 953745043, 941921200, 930061894,

      918167571, 906238681, 894275670, 882278991, 870249095, 858186434, 846091463, 833964637,

      821806413, 809617248, 797397602, 785147934, 772868706, 760560379, 748223418, 735858287,

      723465451, 711045377, 698598533, 686125386, 673626408, 661102068, 648552837, 635979190,

      623381597, 610760535, 598116478, 585449903, 572761285, 560051103, 547319836, 534567963,

      521795963, 509004318, 496193509, 483364019, 470516330, 457650927, 444768293, 431868915,

      418953276, 406021864, 393075166, 380113669, 367137860, 354148229, 341145265, 328129457,

      315101294, 302061269, 289009871, 275947592, 262874923, 249792358, 236700388, 223599506,

      210490206, 197372981, 184248325, 171116732, 157978697, 144834714, 131685278, 118530885,

      105372028, 92209205, 79042909, 65873638, 52701887, 39528151, 26352928, 13176712,

};

 

A4_1024[ 512 ] = {

      0, 1647100, 3294201, 4941307, 6588418, 8235537, 9882666, 11529806,

      13176960, 14824129, 16471316, 18118523, 19765750, 21413001, 23060277, 24707580,

      26354912, 28002276, 29649672, 31297103, 32944571, 34592077, 36239625, 37887215,

      39534849, 41182531, 42830260, 44478040, 46125873, 47773759, 49421702, 51069703,

      52717765, 54365888, 56014075, 57662328, 59310649, 60959040, 62607503, 64256040,

      65904652, 67553342, 69202111, 70850962, 72499896, 74148916, 75798023, 77447219,

      79096506, 80745887, 82395363, 84044936, 85694608, 87344381, 88994257, 90644237,

      92294325, 93944521, 95594829, 97245248, 98895783, 100546434, 102197204, 103848094,

      105499107, 107150244, 108801507, 110452899, 112104421, 113756075, 115407864, 117059788,

      118711851, 120364054, 122016399, 123668888, 125321523, 126974306, 128627239, 130280324,

      131933563, 133586957, 135240509, 136894221, 138548095, 140202132, 141856335, 143510706,

      145165246, 146819958, 148474843, 150129904, 151785142, 153440560, 155096160, 156751942,

      158407910, 160064066, 161720411, 163376947, 165033677, 166690602, 168347724, 170005045,

      171662568, 173320294, 174978225, 176636364, 178294712, 179953271, 181612043, 183271030,

      184930235, 186589658, 188249303, 189909172, 191569265, 193229585, 194890135, 196550916,

      198211930, 199873179, 201534666, 203196391, 204858358, 206520568, 208183024, 209845726,

      211508678, 213171881, 214835338, 216499049, 218163018, 219827246, 221491736, 223156489,

      224821507, 226486793, 228152348, 229818175, 231484275, 233150651, 234817304, 236484237,

      238151452, 239818950, 241486733, 243154805, 244823166, 246491819, 248160766, 249830009,

      251499549, 253169390, 254839533, 256509979, 258180732, 259851793, 261523164, 263194847,

      264866845, 266539159, 268211792, 269884745, 271558020, 273231620, 274905547, 276579803,

      278254389, 279929308, 281604562, 283280154, 284956084, 286632355, 288308970, 289985930,

      291663238, 293340894, 295018903, 296697265, 298375983, 300055059, 301734494, 303414292,

      305094454, 306774982, 308455878, 310137145, 311818784, 313500798, 315183188, 316865957,

      318549108, 320232641, 321916559, 323600865, 325285560, 326970646, 328656127, 330342002,

      332028276, 333714950, 335402026, 337089506, 338777392, 340465687, 342154393, 343843511,

      345533045, 347222995, 348913365, 350604156, 352295370, 353987010, 355679078, 357371576,

      359064506, 360757870, 362451671, 364145910, 365840590, 367535713, 369231281, 370927296,

      372623761, 374320677, 376018047, 377715873, 379414157, 381112902, 382812109, 384511781,

      386211919, 387912527, 389613606, 391315159, 393017187, 394719693, 396422679, 398126148,

      399830101, 401534541, 403239469, 404944889, 406650802, 408357211, 410064118, 411771525,

      413479434, 415187847, 416896767, 418606197, 420316137, 422026591, 423737561, 425449048,

      427161056, 428873586, 430586641, 432300223, 434014335, 435728977, 437444154, 439159866,

      440876117, 442592908, 444310243, 446028122, 447746549, 449465525, 451185054, 452905136,

      454625776, 456346974, 458068733, 459791056, 461513944, 463237401, 464961428, 466686028,

      468411202, 470136954, 471863286, 473590200, 475317698, 477045782, 478774456, 480503721,

      482233579, 483964034, 485695086, 487426740, 489158996, 490891858, 492625328, 494359407,

      496094100, 497829407, 499565331, 501301875, 503039040, 504776830, 506515247, 508254293,

      509993970, 511734281, 513475229, 515216815, 516959042, 518701913, 520445429, 522189594,

      523934410, 525679879, 527426003, 529172785, 530920228, 532668333, 534417104, 536166542,

      537916651, 539667432, 541418888, 543171022, 544923836, 546677332, 548431513, 550186381,

      551941939, 553698189, 555455134, 557212777, 558971119, 560730163, 562489912, 564250369,

      566011534, 567773413, 569536005, 571299316, 573063345, 574828097, 576593574, 578359778,

      580126712, 581894379, 583662780, 585431918, 587201797, 588972418, 590743784, 592515898,

      594288762, 596062379, 597836751, 599611881, 601387772, 603164425, 604941844, 606720032,

      608498990, 610278722, 612059229, 613840515, 615622583, 617405434, 619189072, 620973499,

      622758717, 624544730, 626331540, 628119149, 629907561, 631696778, 633486802, 635277636,

      637069283, 638861745, 640655026, 642449128, 644244053, 646039804, 647836385, 649633796,

      651432042, 653231125, 655031048, 656831813, 658633423, 660435881, 662239190, 664043352,

      665848369, 667654246, 669460984, 671268586, 673077055, 674886394, 676696605, 678507692,

      680319656, 682132501, 683946230, 685760845, 687576349, 689392745, 691210036, 693028224,

      694847313, 696667305, 698488202, 700310009, 702132726, 703956359, 705780908, 707606378,

      709432771, 711260089, 713088336, 714917514, 716747627, 718578677, 720410667, 722243600,

      724077480, 725912307, 727748087, 729584821, 731422512, 733261164, 735100779, 736941361,

      738782911, 740625434, 742468931, 744313407, 746158864, 748005304, 749852731, 751701148,

      753550558, 755400964, 757252368, 759104774, 760958185, 762812603, 764668033, 766524476,

      768381935, 770240415, 772099917, 773960445, 775822002, 777684591, 779548215, 781412877,

      783278580, 785145328, 787013122, 788881967, 790751865, 792622820, 794494834, 796367911,

      798242054, 800117266, 801993550, 803870909, 805749346, 807628865, 809509468, 811391159,

      813273942, 815157818, 817042791, 818928865, 820816043, 822704327, 824593721, 826484229,

      828375853, 830268597, 832162463, 834057456, 835953578, 837850832, 839749223, 841648752,

      843549424, 845451241, 847354208, 849258326, 851163600, 853070033, 854977628, 856886388,

      858796317, 860707417, 862619694, 864533148, 866447785, 868363608, 870280618, 872198822,

      874118220, 876038817, 877960617, 879883622, 881807836, 883733263, 885659905, 887587767,

};

 

B4_1024[ 512 ] = {

      0, −3294197, −6588387, −9882561, −13176712, −16470832, −19764913, −23058947,

      −26352928, −29646846, −32940695, −36234466, −39528151, −42821744, −46115236, −49408620,

      −52701887, −55995030, −59288042, −62580914, −65873638, −69166208, −72458615, −75750851,

      −79042909, −82334782, −85626460, −88917937, −92209205, −95500255, −98791081, −102081675,

      −105372028, −108662134, −111951983, −115241570, −118530885, −121819921, −125108670, −128397125,

      −131685278, −134973122, −138260647, −141547847, −144834714, −148121241, −151407418, −154693240,

      −157978697, −161263783, −164548489, −167832808, −171116732, −174400254, −177683365, −180966058,

      −184248325, −187530159, −190811551, −194092494, −197372981, −200653003, −203932553, −207211623,

      −210490206, −213768293, −217045877, −220322951, −223599506, −226875535, −230151030, −233425983,

      −236700388, −239974235, −243247517, −246520228, −249792358, −253063900, −256334847, −259605190,

      −262874923, −266144037, −269412525, −272680379, −275947592, −279214155, −282480061, −285745302,

      −289009871, −292273760, −295536961, −298799466, −302061269, −305322361, −308582734, −311842381,

      −315101294, −318359466, −321616889, −324873555, −328129457, −331384586, −334638936, −337892498,

      −341145265, −344397229, −347648383, −350898719, −354148229, −357396906, −360644742, −363891729,

      −367137860, −370383127, −373627523, −376871039, −380113669, −383355404, −386596237, −389836160,

      −393075166, −396313247, −399550396, −402786604, −406021864, −409256170, −412489512, −415721883,

      −418953276, −422183684, −425413098, −428641510, −431868915, −435095303, −438320667, −441545000,

      −444768293, −447990541, −451211734, −454431865, −457650927, −460868912, −464085813, −467301621,

      −470516330, −473729932, −476942419, −480153784, −483364019, −486573116, −489781069, −492987869,

      −496193509, −499397981, −502601279, −505803393, −509004318, −512204045, −515402566, −518599875,

      −521795963, −524990823, −528184448, −531376831, −534567963, −537757837, −540946445, −544133781,

      −547319836, −550504604, −553688076, −556870245, −560051103, −563230644, −566408860, −569585743,

      −572761285, −575935480, −579108319, −582279796, −585449903, −588618632, −591785976, −594951927,

      −598116478, −601279622, −604441351, −607601658, −610760535, −613917975, −617073970, −620228514,

      −623381597, −626533214, −629683357, −632832018, −635979190, −639124865, −642269036, −645411696,

      −648552837, −651692453, −654830534, −657967075, −661102068, −664235505, −667367379, −670497682,

      −673626408, −676753549, −679879097, −683003045, −686125386, −689246113, −692365218, −695482694,

      −698598533, −701712728, −704825272, −707936157, −711045377, −714152924, −717258790, −720362968,

      −723465451, −726566232, −729665303, −732762657, −735858287, −738952185, −742044345, −745134758,

      −748223418, −751310318, −754395449, −757478805, −760560379, −763640163, −766718151, −769794334,

      −772868706, −775941259, −779011986, −782080880, −785147934, −788213140, −791276492, −794337981,

      −797397602, −800455346, −803511207, −806565176, −809617248, −812667415, −815715670, −818762005,

      −821806413, −824848888, −827889421, −830928007, −833964637, −836999305, −840032003, −843062725,

      −846091463, −849118210, −852142959, −855165703, −858186434, −861205146, −864221832, −867236484,

      −870249095, −873259658, −876268167, −879274614, −882278991, −885281293, −888281511, −891279640,

      −894275670, −897269597, −900261412, −903251109, −906238681, −909224120, −912207419, −915188572,

      −918167571, −921144410, −924119082, −927091578, −930061894, −933030020, −935995952, −938959680,

      −941921200, −944880502, −947837582, −950792431, −953745043, −956695410, −959643527, −962589385,

      −965532978, −968474299, −971413341, −974350098, −977284561, −980216725, −983146583, −986074127,

      −988999351, −991922247, −994842809, −997761031, −1000676905, −1003590423, −1006501581, −1009410370,

      −1012316784, −1015220815, −1018122458, −1021021705, −1023918549, −1026812985, −1029705003, −1032594599,

      −1035481765, −1038366495, −1041248781, −1044128617, −1047005996, −1049880911, −1052753356, −1055623324,

      −1058490807, −1061355800, −1064218296, −1067078287, −1069935767, −1072790730, −1075643168, −1078493075,

      −1081340445, −1084185270, −1087027543, −1089867259, −1092704410, −1095538990, −1098370992, −1101200410,

      −1104027236, −1106851464, −1109673088, −1112492101, −1115308496, −1118122266, −1120933406, −1123741907,

      −1126547765, −1129350972, −1132151521, −1134949406, −1137744620, −1140537157, −1143327011, −1146114174,

      −1148898640, −1151680403, −1154459455, −1157235791, −1160009404, −1162780288, −1165548435, −1168313839,

      −1171076495, −1173836395, −1176593532, −1179347901, −1182099495, −1184848308, −1187594332, −1190337561,

      −1193077990, −1195815611, −1198550419, −1201282406, −1204011566, −1206737894, −1209461381, −1212182023,

      −1214899812, −1217614743, −1220326808, −1223036002, −1225742318, −1228445749, −1231146290, −1233843934,

      −1236538675, −1239230506, −1241919421, −1244605413, −1247288477, −1249968606, −1252645793, −1255320033,

      −1257991319, −1260659645, −1263325005, −1265987391, −1268646799, −1271303222, −1273956652, −1276607086,

      −1279254515, −1281898934, −1284540337, −1287178717, −1289814068, −1292446384, −1295075658, −1297701886,

      −1300325059, −1302945173, −1305562221, −1308176197, −1310787095, −1313394908, −1315999631, −1318601257,

      −1321199780, −1323795194, −1326387493, −1328976672, −1331562722, −1334145640, −1336725418, −1339302051,

      −1341875532, −1344445856, −1347013016, −1349577007, −1352137822, −1354695455, −1357249900, −1359801152,

      −1362349204, −1364894050, −1367435684, −1369974101, −1372509294, −1375041257, −1377569985, −1380095471,

      −1382617710, −1385136695, −1387652421, −1390164882, −1392674071, −1395179983, −1397682613, −1400181953,

      −1402677999, −1405170744, −1407660183, −1410146309, −1412629117, −1415108601, −1417584755, −1420057573,

      −1422527050, −1424993179, −1427455956, −1429915373, −1432371426, −1434824108, −1437273414, −1439719338,

      −1442161874, −1444601016, −1447036759, −1449469097, −1451898025, −1454323536, −1456745625, −1459164286,

      −1461579513, −1463991301, −1466399644, −1468804537, −1471205973, −1473603948, −1475998455, −1478389489,

      −1480777044, −1483161114, −1485541695, −1487918780, −1490292364, −1492662441, −1495029005, −1497392052,

      −1499751575, −1502107569, −1504460029, −1506808948, −1509154322, −1511496144, −1513834410, −1516169113,

};

 

A1_2048[ 512 ] = {

      −2147483647, −2134347114, −2121290448, −2108312682, −2095412859, −2082590039, −2069843295, −2057171715,

      −2044574398, −2032050460, −2019599026, −2007219237, −1994910245, −1982671216, −1970501324, −1958399760,

      −1946365724, −1934398427, −1922497092, −1910660953, −1898889255, −1887181253, −1875536213, −1863953411,

      −1852432133, −1840971676, −1829571343, −1818230452, −1806948326, −1795724299, −1784557714, −1773447921,

      −1762394283, −1751396166, −1740452950, −1729564018, −1718728765, −1707946592, −1697216909, −1686539132,

      −1675912687, −1665337006, −1654811527, −1644335698, −1633908973, −1623530812, −1613200682, −1602918058,

      −1592682420, −1582493256, −1572350060, −1562252331, −1552199576, −1542191307, −1532227041, −1522306304,

      −1512428625, −1502593540, −1492800589, −1483049319, −1473339283, −1463670038, −1454041146, −1444452175,

      −1434902698, −1425392293, −1415920543, −1406487035, −1397091361, −1387733119, −1378411911, −1369127341,

      −1359879022, −1350666568, −1341489598, −1332347736, −1323240610, −1314167852, −1305129097, −1296123986,

      −1287152163, −1278213276, −1269306976, −1260432918, −1251590761, −1242780169, −1234000808, −1225252347,

      −1216534460, −1207846823, −1199189117, −1190561025, −1181962234, −1173392433, −1164851317, −1156338580,

      −1147853924, −1139397049, −1130967661, −1122565468, −1114190182, −1105841517, −1097519190, −1089222920,

      −1080952429, −1072707443, −1064487689, −1056292898, −1048122803, −1039977138, −1031855642, −1023758056,

      −1015684122, −1007633585, −999606193, −991601695, −983619845, −975660396, −967723104, −959807729,

      −951914032, −944041776, −936190725, −928360648, −920551313, −912762492, −904993957, −897245485,

      −889516852, −881807836, −874118220, −866447785, −858796317, −851163600, −843549424, −835953578,

      −828375853, −820816043, −813273942, −805749346, −798242054, −790751865, −783278580, −775822002,

      −768381935, −760958185, −753550558, −746158864, −738782911, −731422512, −724077480, −716747627,

      −709432771, −702132726, −694847313, −687576349, −680319656, −673077055, −665848369, −658633423,

      −651432042, −644244053, −637069283, −629907561, −622758717, −615622583, −608498990, −601387772,

      −594288762, −587201797, −580126712, −573063345, −566011534, −558971119, −551941939, −544923836,

      −537916651, −530920228, −523934410, −516959042, −509993970, −503039040, −496094100, −489158996,

      −482233579, −475317698, −468411202, −461513944, −454625776, −447746549, −440876117, −434014335,

      −427161056, −420316137, −413479434, −406650802, −399830101, −393017187, −386211919, −379414157,

      −372623761, −365840590, −359064506, −352295370, −345533045, −338777392, −332028276, −325285560,

      −318549108, −311818784, −305094454, −298375983, −291663238, −284956084, −278254389, −271558020,

      −264866845, −258180732, −251499549, −244823166, −238151452, −231484275, −224821507, −218163018,

      −211508678, −204858358, −198211930, −191569265, −184930235, −178294712, −171662568, −165033677,

      −158407910, −151785142, −145165246, −138548095, −131933563, −125321523, −118711851, −112104421,

      −105499107, −98895783, −92294325, −85694608, −79096506, −72499896, −65904652, −59310649,

      −52717765, −46125873, −39534849, −32944571, −26354912, −19765750, −13176960, −6588418,

      0, 6588418, 13176960, 19765750, 26354912, 32944571, 39534849, 46125873,

      52717765, 59310649, 65904652, 72499896, 79096506, 85694608, 92294325, 98895783,

      105499107, 112104421, 118711851, 125321523, 131933563, 138548095, 145165246, 151785142,

      158407910, 165033677, 171662568, 178294712, 184930235, 191569265, 198211930, 204858358,

      211508678, 218163018, 224821507, 231484275, 238151452, 244823166, 251499549, 258180732,

      264866845, 271558020, 278254389, 284956084, 291663238, 298375983, 305094454, 311818784,

      318549108, 325285560, 332028276, 338777392, 345533045, 352295370, 359064506, 365840590,

      372623761, 379414157, 386211919, 393017187, 399830101, 406650802, 413479434, 420316137,

      427161056, 434014335, 440876117, 447746549, 454625776, 461513944, 468411202, 475317698,

      482233579, 489158996, 496094100, 503039040, 509993970, 516959042, 523934410, 530920228,

      537916651, 544923836, 551941939, 558971119, 566011534, 573063345, 580126712, 587201797,

      594288762, 601387772, 608498990, 615622583, 622758717, 629907561, 637069283, 644244053,

      651432042, 658633423, 665848369, 673077055, 680319656, 687576349, 694847313, 702132726,

      709432771, 716747627, 724077480, 731422512, 738782911, 746158864, 753550558, 760958185,

      768381935, 775822002, 783278580, 790751865, 798242054, 805749346, 813273942, 820816043,

      828375853, 835953578, 843549424, 851163600, 858796317, 866447785, 874118220, 881807836,

      889516852, 897245485, 904993957, 912762492, 920551313, 928360648, 936190725, 944041776,

      951914032, 959807729, 967723104, 975660396, 983619845, 991601695, 999606193, 1007633585,

      1015684122, 1023758056, 1031855642, 1039977138, 1048122803, 1056292898, 1064487689, 1072707443,

      1080952429, 1089222920, 1097519190, 1105841517, 1114190182, 1122565468, 1130967661, 1139397049,

      1147853924, 1156338580, 1164851317, 1173392433, 1181962234, 1190561025, 1199189117, 1207846823,

      1216534460, 1225252347, 1234000808, 1242780169, 1251590761, 1260432918, 1269306976, 1278213276,

      1287152163, 1296123986, 1305129097, 1314167852, 1323240610, 1332347736, 1341489598, 1350666568,

      1359879022, 1369127341, 1378411911, 1387733119, 1397091361, 1406487035, 1415920543, 1425392293,

      1434902698, 1444452175, 1454041146, 1463670038, 1473339283, 1483049319, 1492800589, 1502593540,

      1512428625, 1522306304, 1532227041, 1542191307, 1552199576, 1562252331, 1572350060, 1582493256,

      1592682420, 1602918058, 1613200682, 1623530812, 1633908973, 1644335698, 1654811527, 1665337006,

      1675912687, 1686539132, 1697216909, 1707946592, 1718728765, 1729564018, 1740452950, 1751396166,

      1762394283, 1773447921, 1784557714, 1795724299, 1806948326, 1818230452, 1829571343, 1840971676,

      1852432133, 1863953411, 1875536213, 1887181253, 1898889255, 1910660953, 1922497092, 1934398427,

      1946365724, 1958399760, 1970501324, 1982671216, 1994910245, 2007219237, 2019599026, 2032050460,

      2044574398, 2057171715, 2069843295, 2082590039, 2095412859, 2108312682, 2121290448, 2134347114,

};

 

B1_2048[ 512 ] = {

      2147483647, 2147443221, 2147321945, 2147119824, 2146836865, 2146473079, 2146028479, 2145503082,

      2144896909, 2144209981, 2143442325, 2142593970, 2141664947, 2140655292, 2139565042, 2138394239,

      2137142926, 2135811152, 2134398965, 2132906419, 2131333571, 2129680479, 2127947205, 2126133816,

      2124240379, 2122266966, 2120213650, 2118080510, 2115867625, 2113575079, 2111202958, 2108751351,

      2106220351, 2103610053, 2100920555, 2098151959, 2095304369, 2092377891, 2089372637, 2086288719,

      2083126253, 2079885359, 2076566159, 2073168776, 2069693341, 2066139982, 2062508835, 2058800035,

      2055013722, 2051150040, 2047209132, 2043191149, 2039096240, 2034924561, 2030676268, 2026351521,

      2021950483, 2017473320, 2012920200, 2008291295, 2003586778, 1998806828, 1993951624, 1989021349,

      1984016188, 1978936330, 1973781966, 1968553291, 1963250500, 1957873795, 1952423376, 1946899450,

      1941302224, 1935631909, 1929888719, 1924072870, 1918184580, 1912224072, 1906191569, 1900087300,

      1893911493, 1887664382, 1881346201, 1874957188, 1868497585, 1861967633, 1855367580, 1848697673,

      1841958164, 1835149305, 1828271355, 1821324571, 1814309215, 1807225552, 1800073848, 1792854372,

      1785567395, 1778213194, 1770792043, 1763304223, 1755750016, 1748129706, 1740443580, 1732691927,

      1724875039, 1716993211, 1709046738, 1701035921, 1692961061, 1684822463, 1676620431, 1668355276,

      1660027308, 1651636840, 1643184190, 1634669675, 1626093615, 1617456334, 1608758157, 1599999410,

      1591180425, 1582301533, 1573363067, 1564365366, 1555308767, 1546193612, 1537020243, 1527789006,

      1518500249, 1509154322, 1499751575, 1490292364, 1480777044, 1471205973, 1461579513, 1451898025,

      1442161874, 1432371426, 1422527050, 1412629117, 1402677999, 1392674071, 1382617710, 1372509294,

      1362349204, 1352137822, 1341875532, 1331562722, 1321199780, 1310787095, 1300325059, 1289814068,

      1279254515, 1268646799, 1257991319, 1247288477, 1236538675, 1225742318, 1214899812, 1204011566,

      1193077990, 1182099495, 1171076495, 1160009404, 1148898640, 1137744620, 1126547765, 1115308496,

      1104027236, 1092704410, 1081340445, 1069935767, 1058490807, 1047005996, 1035481765, 1023918549,

      1012316784, 1000676905, 988999351, 977284561, 965532978, 953745043, 941921200, 930061894,

      918167571, 906238681, 894275670, 882278991, 870249095, 858186434, 846091463, 833964637,

      821806413, 809617248, 797397602, 785147934, 772868706, 760560379, 748223418, 735858287,

      723465451, 711045377, 698598533, 686125386, 673626408, 661102068, 648552837, 635979190,

      623381597, 610760535, 598116478, 585449903, 572761285, 560051103, 547319836, 534567963,

      521795963, 509004318, 496193509, 483364019, 470516330, 457650927, 444768293, 431868915,

      418953276, 406021864, 393075166, 380113669, 367137860, 354148229, 341145265, 328129457,

      315101294, 302061269, 289009871, 275947592, 262874923, 249792358, 236700388, 223599506,

      210490206, 197372981, 184248325, 171116732, 157978697, 144834714, 131685278, 118530885,

      105372028, 92209205, 79042909, 65873638, 52701887, 39528151, 26352928, 13176712,

      0, −13176712, −26352928, −39528151, −52701887, −65873638, −79042909, −92209205,

      −105372028, −118530885, −131685278, −144834714, −157978697, −171116732, −184248325, −197372981,

      −210490206, −223599506, −236700388, −249792358, −262874923, −275947592, −289009871, −302061269,

      −315101294, −328129457, −341145265, −354148229, −367137860, −380113669, −393075166, −406021864,

      −418953276, −431868915, −444768293, −457650927, −470516330, −483364019, −496193509, −509004318,

      −521795963, −534567963, −547319836, −560051103, −572761285, −585449903, −598116478, −610760535,

      −623381597, −635979190, −648552837, −661102068, −673626408, −686125386, −698598533, −711045377,

      −723465451, −735858287, −748223418, −760560379, −772868706, −785147934, −797397602, −809617248,

      −821806413, −833964637, −846091463, −858186434, −870249095, −882278991, −894275670, −906238681,

      −918167571, −930061894, −941921200, −953745043, −965532978, −977284561, −988999351, −1000676905,

      −1012316784, −1023918549, −1035481765, −1047005996, −1058490807, −1069935767, −1081340445, −1092704410,

      −1104027236, −1115308496, −1126547765, −1137744620, −1148898640, −1160009404, −1171076495, −1182099495,

      −1193077990, −1204011566, −1214899812, −1225742318, −1236538675, −1247288477, −1257991319, −1268646799,

      −1279254515, −1289814068, −1300325059, −1310787095, −1321199780, −1331562722, −1341875532, −1352137822,

      −1362349204, −1372509294, −1382617710, −1392674071, −1402677999, −1412629117, −1422527050, −1432371426,

      −1442161874, −1451898025, −1461579513, −1471205973, −1480777044, −1490292364, −1499751575, −1509154322,

      −1518500249, −1527789006, −1537020243, −1546193612, −1555308767, −1564365366, −1573363067, −1582301533,

      −1591180425, −1599999410, −1608758157, −1617456334, −1626093615, −1634669675, −1643184190, −1651636840,

      −1660027308, −1668355276, −1676620431, −1684822463, −1692961061, −1701035921, −1709046738, −1716993211,

      −1724875039, −1732691927, −1740443580, −1748129706, −1755750016, −1763304223, −1770792043, −1778213194,

      −1785567395, −1792854372, −1800073848, −1807225552, −1814309215, −1821324571, −1828271355, −1835149305,

      −1841958164, −1848697673, −1855367580, −1861967633, −1868497585, −1874957188, −1881346201, −1887664382,

      −1893911493, −1900087300, −1906191569, −1912224072, −1918184580, −1924072870, −1929888719, −1935631909,

      −1941302224, −1946899450, −1952423376, −1957873795, −1963250500, −1968553291, −1973781966, −1978936330,

      −1984016188, −1989021349, −1993951624, −1998806828, −2003586778, −2008291295, −2012920200, −2017473320,

      −2021950483, −2026351521, −2030676268, −2034924561, −2039096240, −2043191149, −2047209132, −2051150040,

      −2055013722, −2058800035, −2062508835, −2066139982, −2069693341, −2073168776, −2076566159, −2079885359,

      −2083126253, −2086288719, −2089372637, −2092377891, −2095304369, −2098151959, −2100920555, −2103610053,

      −2106220351, −2108751351, −2111202958, −2113575079, −2115867625, −2118080510, −2120213650, −2122266966,

      −2124240379, −2126133816, −2127947205, −2129680479, −2131333571, −2132906419, −2134398965, −2135811152,

      −2137142926, −2138394239, −2139565042, −2140655292, −2141664947, −2142593970, −2143442325, −2144209981,

      −2144896909, −2145503082, −2146028479, −2146473079, −2146836865, −2147119824, −2147321945, −2147443221,

};

 

A3_2048[ 512 ] = {

      −2147483647, −2140905336, −2134347114, −2127808858, −2121290448, −2114791763, −2108312682, −2101853087,

      −2095412859, −2088991882, −2082590039, −2076207215, −2069843295, −2063498166, −2057171715, −2050863829,

      −2044574398, −2038303311, −2032050460, −2025815734, −2019599026, −2013400229, −2007219237, −2001055944,

      −1994910245, −1988782037, −1982671216, −1976577679, −1970501324, −1964442052, −1958399760, −1952374351,

      −1946365724, −1940373782, −1934398427, −1928439562, −1922497092, −1916570920, −1910660953, −1904767095,

      −1898889255, −1893027338, −1887181253, −1881350908, −1875536213, −1869737077, −1863953411, −1858185126,

      −1852432133, −1846694346, −1840971676, −1835264037, −1829571343, −1823893510, −1818230452, −1812582085,

      −1806948326, −1801329091, −1795724299, −1790133867, −1784557714, −1778995759, −1773447921, −1767914123,

      −1762394283, −1756888323, −1751396166, −1745917734, −1740452950, −1735001736, −1729564018, −1724139719,

      −1718728765, −1713331080, −1707946592, −1702575226, −1697216909, −1691871568, −1686539132, −1681219529,

      −1675912687, −1670618536, −1665337006, −1660068026, −1654811527, −1649567441, −1644335698, −1639116232,

      −1633908973, −1628713855, −1623530812, −1618359776, −1613200682, −1608053464, −1602918058, −1597794398,

      −1592682420, −1587582061, −1582493256, −1577415943, −1572350060, −1567295543, −1562252331, −1557220362,

      −1552199576, −1547189911, −1542191307, −1537203703, −1532227041, −1527261261, −1522306304, −1517362112,

      −1512428625, −1507505787, −1502593540, −1497691826, −1492800589, −1487919772, −1483049319, −1478189175,

      −1473339283, −1468499589, −1463670038, −1458850575, −1454041146, −1449241697, −1444452175, −1439672526,

      −1434902698, −1430142638, −1425392293, −1420651612, −1415920543, −1411199034, −1406487035, −1401784494,

      −1397091361, −1392407586, −1387733119, −1383067910, −1378411911, −1373765070, −1369127341, −1364498674,

      −1359879022, −1355268335, −1350666568, −1346073671, −1341489598, −1336914302, −1332347736, −1327789854,

      −1323240610, −1318699958, −1314167852, −1309644247, −1305129097, −1300622359, −1296123986, −1291633936,

      −1287152163, −1282678625, −1278213276, −1273756074, −1269306976, −1264865938, −1260432918, −1256007873,

      −1251590761, −1247181541, −1242780169, −1238386605, −1234000808, −1229622735, −1225252347, −1220889602,

      −1216534460, −1212186880, −1207846823, −1203514248, −1199189117, −1194871389, −1190561025, −1186257986,

      −1181962234, −1177673729, −1173392433, −1169118309, −1164851317, −1160591420, −1156338580, −1152092761,

      −1147853924, −1143622032, −1139397049, −1135178937, −1130967661, −1126763183, −1122565468, −1118374480,

      −1114190182, −1110012540, −1105841517, −1101677079, −1097519190, −1093367815, −1089222920, −1085084469,

      −1080952429, −1076826765, −1072707443, −1068594429, −1064487689, −1060387190, −1056292898, −1052204780,

      −1048122803, −1044046933, −1039977138, −1035913385, −1031855642, −1027803877, −1023758056, −1019718148,

      −1015684122, −1011655945, −1007633585, −1003617011, −999606193, −995601098, −991601695, −987607955,

      −983619845, −979637335, −975660396, −971688995, −967723104, −963762692, −959807729, −955858186,

      −951914032, −947975239, −944041776, −940113615, −936190725, −932273080, −928360648, −924453402,

      −920551313, −916654352, −912762492, −908875703, −904993957, −901117227, −897245485, −893378702,

      −889516852, −885659905, −881807836, −877960617, −874118220, −870280618, −866447785, −862619694,

      −858796317, −854977628, −851163600, −847354208, −843549424, −839749223, −835953578, −832162463,

      −828375853, −824593721, −820816043, −817042791, −813273942, −809509468, −805749346, −801993550,

      −798242054, −794494834, −790751865, −787013122, −783278580, −779548215, −775822002, −772099917,

      −768381935, −764668033, −760958185, −757252368, −753550558, −749852731, −746158864, −742468931,

      −738782911, −735100779, −731422512, −727748087, −724077480, −720410667, −716747627, −713088336,

      −709432771, −705780908, −702132726, −698488202, −694847313, −691210036, −687576349, −683946230,

      −680319656, −676696605, −673077055, −669460984, −665848369, −662239190, −658633423, −655031048,

      −651432042, −647836385, −644244053, −640655026, −637069283, −633486802, −629907561, −626331540,

      −622758717, −619189072, −615622583, −612059229, −608498990, −604941844, −601387772, −597836751,

      −594288762, −590743784, −587201797, −583662780, −580126712, −576593574, −573063345, −569536005,

      −566011534, −562489912, −558971119, −555455134, −551941939, −548431513, −544923836, −541418888,

      −537916651, −534417104, −530920228, −527426003, −523934410, −520445429, −516959042, −513475229,

      −509993970, −506515247, −503039040, −499565331, −496094100, −492625328, −489158996, −485695086,

      −482233579, −478774456, −475317698, −471863286, −468411202, −464961428, −461513944, −458068733,

      −454625776, −451185054, −447746549, −444310243, −440876117, −437444154, −434014335, −430586641,

      −427161056, −423737561, −420316137, −416896767, −413479434, −410064118, −406650802, −403239469,

      −399830101, −396422679, −393017187, −389613606, −386211919, −382812109, −379414157, −376018047,

      −372623761, −369231281, −365840590, −362451671, −359064506, −355679078, −352295370, −348913365,

      −345533045, −342154393, −338777392, −335402026, −332028276, −328656127, −325285560, −321916559,

      −318549108, −315183188, −311818784, −308455878, −305094454, −301734494, −298375983, −295018903,

      −291663238, −288308970, −284956084, −281604562, −278254389, −274905547, −271558020, −268211792,

      −264866845, −261523164, −258180732, −254839533, −251499549, −248160766, −244823166, −241486733,

      −238151452, −234817304, −231484275, −228152348, −224821507, −221491736, −218163018, −214835338,

      −211508678, −208183024, −204858358, −201534666, −198211930, −194890135, −191569265, −188249303,

      −184930235, −181612043, −178294712, −174978225, −171662568, −168347724, −165033677, −161720411,

      −158407910, −155096160, −151785142, −148474843, −145165246, −141856335, −138548095, −135240509,

      −131933563, −128627239, −125321523, −122016399, −118711851, −115407864, −112104421, −108801507,

      −105499107, −102197204, −98895783, −95594829, −92294325, −88994257, −85694608, −82395363,

      −79096506, −75798023, −72499896, −69202111, −65904652, −62607503, −59310649, −56014075,

      −52717765, −49421702, −46125873, −42830260, −39534849, −36239625, −32944571, −29649672,

      −26354912, −23060277, −19765750, −16471316, −13176960, −9882666, −6588418, −3294201,

};

 

B3_2048[ 512 ] = {

      2147483647, 2147473541, 2147443221, 2147392689, 2147321945, 2147230990, 2147119824, 2146988449,

      2146836865, 2146665075, 2146473079, 2146260880, 2146028479, 2145775879, 2145503082, 2145210091,

      2144896909, 2144563538, 2144209981, 2143836243, 2143442325, 2143028233, 2142593970, 2142139540,

      2141664947, 2141170196, 2140655292, 2140120239, 2139565042, 2138989707, 2138394239, 2137778643,

      2137142926, 2136487094, 2135811152, 2135115106, 2134398965, 2133662733, 2132906419, 2132130029,

      2131333571, 2130517051, 2129680479, 2128823861, 2127947205, 2127050521, 2126133816, 2125197099,

      2124240379, 2123263665, 2122266966, 2121250291, 2120213650, 2119157053, 2118080510, 2116984030,

      2115867625, 2114731304, 2113575079, 2112398959, 2111202958, 2109987084, 2108751351, 2107495769,

      2106220351, 2104925108, 2103610053, 2102275198, 2100920555, 2099546138, 2098151959, 2096738031,

      2095304369, 2093850984, 2092377891, 2090885104, 2089372637, 2087840504, 2086288719, 2084717297,

      2083126253, 2081515602, 2079885359, 2078235539, 2076566159, 2074877232, 2073168776, 2071440807,

      2069693341, 2067926393, 2066139982, 2064334123, 2062508835, 2060664132, 2058800035, 2056916559,

      2055013722, 2053091543, 2051150040, 2049189230, 2047209132, 2045209766, 2043191149, 2041153301,

      2039096240, 2037019987, 2034924561, 2032809981, 2030676268, 2028523441, 2026351521, 2024160528,

      2021950483, 2019721407, 2017473320, 2015206244, 2012920200, 2010615209, 2008291295, 2005948477,

      2003586778, 2001206221, 1998806828, 1996388621, 1993951624, 1991495859, 1989021349, 1986528117,

      1984016188, 1981485584, 1978936330, 1976368449, 1973781966, 1971176905, 1968553291, 1965911147,

      1963250500, 1960571374, 1957873795, 1955157787, 1952423376, 1949670588, 1946899450, 1944109986,

      1941302224, 1938476189, 1935631909, 1932769410, 1929888719, 1926989863, 1924072870, 1921137766,

      1918184580, 1915213339, 1912224072, 1909216806, 1906191569, 1903148391, 1900087300, 1897008324,

      1893911493, 1890796836, 1887664382, 1884514160, 1881346201, 1878160534, 1874957188, 1871736195,

      1868497585, 1865241387, 1861967633, 1858676354, 1855367580, 1852041343, 1848697673, 1845336603,

      1841958164, 1838562387, 1835149305, 1831718951, 1828271355, 1824806551, 1821324571, 1817825448,

      1814309215, 1810775906, 1807225552, 1803658188, 1800073848, 1796472564, 1792854372, 1789219304,

      1785567395, 1781898680, 1778213194, 1774510970, 1770792043, 1767056449, 1763304223, 1759535401,

      1755750016, 1751948106, 1748129706, 1744294852, 1740443580, 1736575926, 1732691927, 1728791619,

      1724875039, 1720942224, 1716993211, 1713028036, 1709046738, 1705049354, 1701035921, 1697006478,

      1692961061, 1688899710, 1684822463, 1680729357, 1676620431, 1672495724, 1668355276, 1664199124,

      1660027308, 1655839867, 1651636840, 1647418268, 1643184190, 1638934646, 1634669675, 1630389318,

      1626093615, 1621782607, 1617456334, 1613114837, 1608758157, 1604386334, 1599999410, 1595597427,

      1591180425, 1586748446, 1582301533, 1577839726, 1573363067, 1568871600, 1564365366, 1559844407,

      1555308767, 1550758488, 1546193612, 1541614182, 1537020243, 1532411836, 1527789006, 1523151796,

      1518500249, 1513834410, 1509154322, 1504460029, 1499751575, 1495029005, 1490292364, 1485541695,

      1480777044, 1475998455, 1471205973, 1466399644, 1461579513, 1456745625, 1451898025, 1447036759,

      1442161874, 1437273414, 1432371426, 1427455956, 1422527050, 1417584755, 1412629117, 1407660183,

      1402677999, 1397682613, 1392674071, 1387652421, 1382617710, 1377569985, 1372509294, 1367435684,

      1362349204, 1357249900, 1352137822, 1347013016, 1341875532, 1336725418, 1331562722, 1326387493,

      1321199780, 1315999631, 1310787095, 1305562221, 1300325059, 1295075658, 1289814068, 1284540337,

      1279254515, 1273956652, 1268646799, 1263325005, 1257991319, 1252645793, 1247288477, 1241919421,

      1236538675, 1231146290, 1225742318, 1220326808, 1214899812, 1209461381, 1204011566, 1198550419,

      1193077990, 1187594332, 1182099495, 1176593532, 1171076495, 1165548435, 1160009404, 1154459455,

      1148898640, 1143327011, 1137744620, 1132151521, 1126547765, 1120933406, 1115308496, 1109673088,

      1104027236, 1098370992, 1092704410, 1087027543, 1081340445, 1075643168, 1069935767, 1064218296,

      1058490807, 1052753356, 1047005996, 1041248781, 1035481765, 1029705003, 1023918549, 1018122458,

      1012316784, 1006501581, 1000676905, 994842809, 988999351, 983146583, 977284561, 971413341,

      965532978, 959643527, 953745043, 947837582, 941921200, 935995952, 930061894, 924119082,

      918167571, 912207419, 906238681, 900261412, 894275670, 888281511, 882278991, 876268167,

      870249095, 864221832, 858186434, 852142959, 846091463, 840032003, 833964637, 827889421,

      821806413, 815715670, 809617248, 803511207, 797397602, 791276492, 785147934, 779011986,

      772868706, 766718151, 760560379, 754395449, 748223418, 742044345, 735858287, 729665303,

      723465451, 717258790, 711045377, 704825272, 698598533, 692365218, 686125386, 679879097,

      673626408, 667367379, 661102068, 654830534, 648552837, 642269036, 635979190, 629683357,

      623381597, 617073970, 610760535, 604441351, 598116478, 591785976, 585449903, 579108319,

      572761285, 566408860, 560051103, 553688076, 547319836, 540946445, 534567963, 528184448,

      521795963, 515402566, 509004318, 502601279, 496193509, 489781069, 483364019, 476942419,

      470516330, 464085813, 457650927, 451211734, 444768293, 438320667, 431868915, 425413098,

      418953276, 412489512, 406021864, 399550396, 393075166, 386596237, 380113669, 373627523,

      367137860, 360644742, 354148229, 347648383, 341145265, 334638936, 328129457, 321616889,

      315101294, 308582734, 302061269, 295536961, 289009871, 282480061, 275947592, 269412525,

      262874923, 256334847, 249792358, 243247517, 236700388, 230151030, 223599506, 217045877,

      210490206, 203932553, 197372981, 190811551, 184248325, 177683365, 171116732, 164548489,

      157978697, 151407418, 144834714, 138260647, 131685278, 125108670, 118530885, 111951983,

      105372028, 98791081, 92209205, 85626460, 79042909, 72458615, 65873638, 59288042,

      52701887, 46115236, 39528151, 32940695, 26352928, 19764913, 13176712, 6588387,

};

 

A4_2048[ 1024 ] = {

      0, 823550, 1647100, 2470650, 3294201, 4117753, 4941307, 5764861,

      6588418, 7411976, 8235537, 9059100, 9882666, 10706234, 11529806, 12353381,

      13176960, 14000543, 14824129, 15647721, 16471316, 17294917, 18118523, 18942134,

      19765750, 20589372, 21413001, 22236636, 23060277, 23883925, 24707580, 25531242,

      26354912, 27178590, 28002276, 28825969, 29649672, 30473383, 31297103, 32120832,

      32944571, 33768319, 34592077, 35415846, 36239625, 37063414, 37887215, 38711026,

      39534849, 40358684, 41182531, 42006389, 42830260, 43654144, 44478040, 45301950,

      46125873, 46949809, 47773759, 48597724, 49421702, 50245695, 51069703, 51893726,

      52717765, 53541818, 54365888, 55189973, 56014075, 56838193, 57662328, 58486480,

      59310649, 60134836, 60959040, 61783263, 62607503, 63431762, 64256040, 65080336,

      65904652, 66728987, 67553342, 68377716, 69202111, 70026526, 70850962, 71675418,

      72499896, 73324395, 74148916, 74973458, 75798023, 76622609, 77447219, 78271851,

      79096506, 79921185, 80745887, 81570613, 82395363, 83220137, 84044936, 84869759,

      85694608, 86519482, 87344381, 88169306, 88994257, 89819234, 90644237, 91469268,

      92294325, 93119410, 93944521, 94769661, 95594829, 96420024, 97245248, 98070501,

      98895783, 99721094, 100546434, 101371804, 102197204, 103022634, 103848094, 104673585,

      105499107, 106324659, 107150244, 107975859, 108801507, 109627187, 110452899, 111278643,

      112104421, 112930231, 113756075, 114581953, 115407864, 116233809, 117059788, 117885802,

      118711851, 119537935, 120364054, 121190209, 122016399, 122842626, 123668888, 124495187,

      125321523, 126147896, 126974306, 127800754, 128627239, 129453762, 130280324, 131106924,

      131933563, 132760240, 133586957, 134413713, 135240509, 136067345, 136894221, 137721138,

      138548095, 139375093, 140202132, 141029213, 141856335, 142683499, 143510706, 144337955,

      145165246, 145992580, 146819958, 147647379, 148474843, 149302351, 150129904, 150957501,

      151785142, 152612829, 153440560, 154268337, 155096160, 155924028, 156751942, 157579903,

      158407910, 159235965, 160064066, 160892215, 161720411, 162548655, 163376947, 164205288,

      165033677, 165862115, 166690602, 167519138, 168347724, 169176360, 170005045, 170833781,

      171662568, 172491406, 173320294, 174149234, 174978225, 175807269, 176636364, 177465511,

      178294712, 179123965, 179953271, 180782630, 181612043, 182441509, 183271030, 184100605,

      184930235, 185759919, 186589658, 187419453, 188249303, 189079209, 189909172, 190739190,

      191569265, 192399397, 193229585, 194059831, 194890135, 195720497, 196550916, 197381394,

      198211930, 199042525, 199873179, 200703893, 201534666, 202365499, 203196391, 204027345,

      204858358, 205689433, 206520568, 207351765, 208183024, 209014344, 209845726, 210677171,

      211508678, 212340248, 213171881, 214003578, 214835338, 215667161, 216499049, 217331001,

      218163018, 218995100, 219827246, 220659458, 221491736, 222324079, 223156489, 223988965,

      224821507, 225654117, 226486793, 227319537, 228152348, 228985228, 229818175, 230651191,

      231484275, 232317429, 233150651, 233983943, 234817304, 235650736, 236484237, 237317809,

      238151452, 238985165, 239818950, 240652806, 241486733, 242320733, 243154805, 243988949,

      244823166, 245657456, 246491819, 247326256, 248160766, 248995350, 249830009, 250664742,

      251499549, 252334432, 253169390, 254004423, 254839533, 255674718, 256509979, 257345317,

      258180732, 259016224, 259851793, 260687440, 261523164, 262358967, 263194847, 264030807,

      264866845, 265702963, 266539159, 267375436, 268211792, 269048228, 269884745, 270721342,

      271558020, 272394780, 273231620, 274068543, 274905547, 275742634, 276579803, 277417054,

      278254389, 279091807, 279929308, 280766893, 281604562, 282442316, 283280154, 284118076,

      284956084, 285794177, 286632355, 287470620, 288308970, 289147407, 289985930, 290824540,

      291663238, 292502022, 293340894, 294179855, 295018903, 295858040, 296697265, 297536579,

      298375983, 299215476, 300055059, 300894731, 301734494, 302574348, 303414292, 304254327,

      305094454, 305934672, 306774982, 307615384, 308455878, 309296465, 310137145, 310977917,

      311818784, 312659744, 313500798, 314341946, 315183188, 316024525, 316865957, 317707485,

      318549108, 319390826, 320232641, 321074552, 321916559, 322758663, 323600865, 324443164,

      325285560, 326128054, 326970646, 327813337, 328656127, 329499015, 330342002, 331185089,

      332028276, 332871563, 333714950, 334558437, 335402026, 336245715, 337089506, 337933398,

      338777392, 339621489, 340465687, 341309989, 342154393, 342998900, 343843511, 344688226,

      345533045, 346377968, 347222995, 348068127, 348913365, 349758707, 350604156, 351449710,

      352295370, 353141137, 353987010, 354832990, 355679078, 356525273, 357371576, 358217987,

      359064506, 359911133, 360757870, 361604716, 362451671, 363298735, 364145910, 364993195,

      365840590, 366688096, 367535713, 368383441, 369231281, 370079232, 370927296, 371775472,

      372623761, 373472162, 374320677, 375169305, 376018047, 376866903, 377715873, 378564958,

      379414157, 380263472, 381112902, 381962447, 382812109, 383661887, 384511781, 385361791,

      386211919, 387062164, 387912527, 388763008, 389613606, 390464323, 391315159, 392166113,

      393017187, 393868380, 394719693, 395571126, 396422679, 397274353, 398126148, 398978064,

      399830101, 400682260, 401534541, 402386944, 403239469, 404092118, 404944889, 405797784,

      406650802, 407503945, 408357211, 409210602, 410064118, 410917759, 411771525, 412625416,

      413479434, 414333577, 415187847, 416042244, 416896767, 417751418, 418606197, 419461103,

      420316137, 421171300, 422026591, 422882011, 423737561, 424593240, 425449048, 426304987,

      427161056, 428017256, 428873586, 429730048, 430586641, 431443366, 432300223, 433157213,

      434014335, 434871589, 435728977, 436586499, 437444154, 438301943, 439159866, 440017924,

      440876117, 441734445, 442592908, 443451508, 444310243, 445169114, 446028122, 446887267,

      447746549, 448605968, 449465525, 450325220, 451185054, 452045026, 452905136, 453765386,

      454625776, 455486305, 456346974, 457207783, 458068733, 458929824, 459791056, 460652429,

      461513944, 462375602, 463237401, 464099343, 464961428, 465823656, 466686028, 467548543,

      468411202, 469274006, 470136954, 471000048, 471863286, 472726670, 473590200, 474453875,

      475317698, 476181666, 477045782, 477910045, 478774456, 479639014, 480503721, 481368575,

      482233579, 483098732, 483964034, 484829485, 485695086, 486560838, 487426740, 488292793,

      489158996, 490025351, 490891858, 491758517, 492625328, 493492291, 494359407, 495226677,

      496094100, 496961676, 497829407, 498697291, 499565331, 500433525, 501301875, 502170380,

      503039040, 503907857, 504776830, 505645960, 506515247, 507384691, 508254293, 509124053,

      509993970, 510864046, 511734281, 512604675, 513475229, 514345942, 515216815, 516087848,

      516959042, 517830397, 518701913, 519573590, 520445429, 521317431, 522189594, 523061921,

      523934410, 524807062, 525679879, 526552859, 527426003, 528299312, 529172785, 530046424,

      530920228, 531794197, 532668333, 533542635, 534417104, 535291739, 536166542, 537041513,

      537916651, 538791957, 539667432, 540543076, 541418888, 542294870, 543171022, 544047344,

      544923836, 545800498, 546677332, 547554336, 548431513, 549308861, 550186381, 551064074,

      551941939, 552819977, 553698189, 554576575, 555455134, 556333868, 557212777, 558091860,

      558971119, 559850553, 560730163, 561609950, 562489912, 563370052, 564250369, 565130863,

      566011534, 566892384, 567773413, 568654620, 569536005, 570417571, 571299316, 572181240,

      573063345, 573945631, 574828097, 575710745, 576593574, 577476585, 578359778, 579243154,

      580126712, 581010454, 581894379, 582778487, 583662780, 584547257, 585431918, 586316765,

      587201797, 588087015, 588972418, 589858008, 590743784, 591629748, 592515898, 593402236,

      594288762, 595175476, 596062379, 596949470, 597836751, 598724221, 599611881, 600499731,

      601387772, 602276003, 603164425, 604053039, 604941844, 605830842, 606720032, 607609414,

      608498990, 609388759, 610278722, 611168878, 612059229, 612949775, 613840515, 614731451,

      615622583, 616513910, 617405434, 618297155, 619189072, 620081187, 620973499, 621866009,

      622758717, 623651624, 624544730, 625438035, 626331540, 627225245, 628119149, 629013255,

      629907561, 630802068, 631696778, 632591688, 633486802, 634382117, 635277636, 636173358,

      637069283, 637965412, 638861745, 639758283, 640655026, 641551974, 642449128, 643346487,

      644244053, 645141825, 646039804, 646937991, 647836385, 648734986, 649633796, 650532815,

      651432042, 652331479, 653231125, 654130982, 655031048, 655931325, 656831813, 657732513,

      658633423, 659534546, 660435881, 661337429, 662239190, 663141164, 664043352, 664945753,

      665848369, 666751200, 667654246, 668557507, 669460984, 670364677, 671268586, 672172712,

      673077055, 673981616, 674886394, 675791390, 676696605, 677602039, 678507692, 679413564,

      680319656, 681225968, 682132501, 683039255, 683946230, 684853427, 685760845, 686668486,

      687576349, 688484436, 689392745, 690301279, 691210036, 692119018, 693028224, 693937656,

      694847313, 695757196, 696667305, 697577640, 698488202, 699398992, 700310009, 701221253,

      702132726, 703044428, 703956359, 704868519, 705780908, 706693528, 707606378, 708519459,

      709432771, 710346314, 711260089, 712174096, 713088336, 714002808, 714917514, 715832454,

      716747627, 717663035, 718578677, 719494555, 720410667, 721327016, 722243600, 723160422,

      724077480, 724994775, 725912307, 726830078, 727748087, 728666334, 729584821, 730503547,

      731422512, 732341718, 733261164, 734180851, 735100779, 736020949, 736941361, 737862015,

      738782911, 739704051, 740625434, 741547061, 742468931, 743391047, 744313407, 745236012,

      746158864, 747081961, 748005304, 748928894, 749852731, 750776816, 751701148, 752625729,

      753550558, 754475636, 755400964, 756326541, 757252368, 758178446, 759104774, 760031354,

      760958185, 761885268, 762812603, 763740191, 764668033, 765596127, 766524476, 767453078,

      768381935, 769311047, 770240415, 771170038, 772099917, 773030053, 773960445, 774891095,

      775822002, 776753168, 777684591, 778616274, 779548215, 780480416, 781412877, 782345598,

      783278580, 784211823, 785145328, 786079094, 787013122, 787947413, 788881967, 789816784,

      790751865, 791687210, 792622820, 793558694, 794494834, 795431240, 796367911, 797304849,

      798242054, 799179526, 800117266, 801055273, 801993550, 802932095, 803870909, 804809992,

      805749346, 806688970, 807628865, 808569031, 809509468, 810450178, 811391159, 812332414,

      813273942, 814215743, 815157818, 816100167, 817042791, 817985690, 818928865, 819872316,

      820816043, 821760046, 822704327, 823648885, 824593721, 825538836, 826484229, 827429901,

      828375853, 829322085, 830268597, 831215389, 832162463, 833109819, 834057456, 835005375,

      835953578, 836902063, 837850832, 838799885, 839749223, 840698845, 841648752, 842598945,

      843549424, 844500189, 845451241, 846402581, 847354208, 848306123, 849258326, 850210819,

      851163600, 852116671, 853070033, 854023685, 854977628, 855931862, 856886388, 857841206,

      858796317, 859751720, 860707417, 861663408, 862619694, 863576273, 864533148, 865490319,

      866447785, 867405548, 868363608, 869321964, 870280618, 871239571, 872198822, 873158371,

      874118220, 875078369, 876038817, 876999567, 877960617, 878921969, 879883622, 880845578,

      881807836, 882770398, 883733263, 884696432, 885659905, 886623684, 887587767, 888552156,

};

 

B4_2048[ 1024 ] = {

      0, −1647099, −3294197, −4941294, −6588387, −8235476, −9882561, −11529640,

      −13176712, −14823776, −16470832, −18117878, −19764913, −21411936, −23058947, −24705945,

      −26352928, −27999895, −29646846, −31293780, −32940695, −34587590, −36234466, −37881320,

      −39528151, −41174960, −42821744, −44468503, −46115236, −47761942, −49408620, −51055268,

      −52701887, −54348475, −55995030, −57641553, −59288042, −60934495, −62580914, −64227295,

      −65873638, −67519943, −69166208, −70812432, −72458615, −74104755, −75750851, −77396903,

      −79042909, −80688869, −82334782, −83980645, −85626460, −87272224, −88917937, −90563597,

      −92209205, −93854758, −95500255, −97145697, −98791081, −100436408, −102081675, −103726882,

      −105372028, −107017112, −108662134, −110307091, −111951983, −113596810, −115241570, −116886261,

      −118530885, −120175438, −121819921, −123464332, −125108670, −126752935, −128397125, −130041240,

      −131685278, −133329239, −134973122, −136616924, −138260647, −139904288, −141547847, −143191323,

      −144834714, −146478021, −148121241, −149764374, −151407418, −153050374, −154693240, −156336015,

      −157978697, −159621287, −161263783, −162906184, −164548489, −166190698, −167832808, −169474820,

      −171116732, −172758544, −174400254, −176041861, −177683365, −179324764, −180966058, −182607245,

      −184248325, −185889297, −187530159, −189170911, −190811551, −192452079, −194092494, −195732795,

      −197372981, −199013051, −200653003, −202292838, −203932553, −205572149, −207211623, −208850976,

      −210490206, −212129312, −213768293, −215407149, −217045877, −218684479, −220322951, −221961294,

      −223599506, −225237587, −226875535, −228513350, −230151030, −231788575, −233425983, −235063255,

      −236700388, −238337381, −239974235, −241610947, −243247517, −244883945, −246520228, −248156366,

      −249792358, −251428203, −253063900, −254699448, −256334847, −257970095, −259605190, −261240134,

      −262874923, −264509558, −266144037, −267778360, −269412525, −271046532, −272680379, −274314066,

      −275947592, −277580955, −279214155, −280847190, −282480061, −284112765, −285745302, −287377671,

      −289009871, −290641901, −292273760, −293905447, −295536961, −297168301, −298799466, −300430456,

      −302061269, −303691904, −305322361, −306952637, −308582734, −310212649, −311842381, −313471930,

      −315101294, −316730474, −318359466, −319988272, −321616889, −323245317, −324873555, −326501602,

      −328129457, −329757118, −331384586, −333011859, −334638936, −336265816, −337892498, −339518981,

      −341145265, −342771348, −344397229, −346022908, −347648383, −349273654, −350898719, −352523578,

      −354148229, −355772673, −357396906, −359020930, −360644742, −362268342, −363891729, −365514902,

      −367137860, −368760602, −370383127, −372005435, −373627523, −375249391, −376871039, −378492465,

      −380113669, −381734649, −383355404, −384975934, −386596237, −388216313, −389836160, −391455778,

      −393075166, −394694323, −396313247, −397931938, −399550396, −401168618, −402786604, −404404353,

      −406021864, −407639137, −409256170, −410872961, −412489512, −414105819, −415721883, −417337702,

      −418953276, −420568604, −422183684, −423798515, −425413098, −427027430, −428641510, −430255339,

      −431868915, −433482236, −435095303, −436708113, −438320667, −439932963, −441545000, −443156777,

      −444768293, −446379548, −447990541, −449601269, −451211734, −452821933, −454431865, −456041530,

      −457650927, −459260055, −460868912, −462477498, −464085813, −465693854, −467301621, −468909114,

      −470516330, −472123270, −473729932, −475336315, −476942419, −478548242, −480153784, −481759043,

      −483364019, −484968710, −486573116, −488177236, −489781069, −491384614, −492987869, −494590835,

      −496193509, −497795892, −499397981, −500999777, −502601279, −504202484, −505803393, −507404005,

      −509004318, −510604331, −512204045, −513803456, −515402566, −517001372, −518599875, −520198072,

      −521795963, −523393547, −524990823, −526587791, −528184448, −529780795, −531376831, −532972553,

      −534567963, −536163057, −537757837, −539352300, −540946445, −542540273, −544133781, −545726969,

      −547319836, −548912381, −550504604, −552096502, −553688076, −555279323, −556870245, −558460838,

      −560051103, −561641039, −563230644, −564819918, −566408860, −567997468, −569585743, −571173682,

      −572761285, −574348551, −575935480, −577522069, −579108319, −580694228, −582279796, −583865021,

      −585449903, −587034440, −588618632, −590202477, −591785976, −593369126, −594951927, −596534378,

      −598116478, −599698227, −601279622, −602860664, −604441351, −606021683, −607601658, −609181276,

      −610760535, −612339435, −613917975, −615496154, −617073970, −618651424, −620228514, −621805238,

      −623381597, −624957590, −626533214, −628108470, −629683357, −631257873, −632832018, −634405790,

      −635979190, −637552215, −639124865, −640697139, −642269036, −643840556, −645411696, −646982457,

      −648552837, −650122836, −651692453, −653261686, −654830534, −656398998, −657967075, −659534765,

      −661102068, −662668981, −664235505, −665801637, −667367379, −668932727, −670497682, −672062243,

      −673626408, −675190177, −676753549, −678316522, −679879097, −681441271, −683003045, −684564417,

      −686125386, −687685952, −689246113, −690805869, −692365218, −693924160, −695482694, −697040818,

      −698598533, −700155836, −701712728, −703269207, −704825272, −706380922, −707936157, −709490976,

      −711045377, −712599360, −714152924, −715706067, −717258790, −718811090, −720362968, −721914422,

      −723465451, −725016055, −726566232, −728115982, −729665303, −731214195, −732762657, −734310688,

      −735858287, −737405453, −738952185, −740498483, −742044345, −743589770, −745134758, −746679308,

      −748223418, −749767088, −751310318, −752853105, −754395449, −755937350, −757478805, −759019816,

      −760560379, −762100495, −763640163, −765179382, −766718151, −768256468, −769794334, −771331747,

      −772868706, −774405210, −775941259, −777476851, −779011986, −780546663, −782080880, −783614637,

      −785147934, −786680768, −788213140, −789745048, −791276492, −792807470, −794337981, −795868026,

      −797397602, −798926709, −800455346, −801983512, −803511207, −805038428, −806565176, −808091450,

      −809617248, −811142570, −812667415, −814191782, −815715670, −817239077, −818762005, −820284450,

      −821806413, −823327892, −824848888, −826369398, −827889421, −829408958, −830928007, −832446567,

      −833964637, −835482217, −836999305, −838515901, −840032003, −841547612, −843062725, −844577343,

      −846091463, −847605086, −849118210, −850630835, −852142959, −853654582, −855165703, −856676320,

      −858186434, −859696043, −861205146, −862713743, −864221832, −865729412, −867236484, −868743045,

      −870249095, −871754633, −873259658, −874764170, −876268167, −877771649, −879274614, −880777062,

      −882278991, −883780402, −885281293, −886781663, −888281511, −889780837, −891279640, −892777918,

      −894275670, −895772897, −897269597, −898765769, −900261412, −901756526, −903251109, −904745161,

      −906238681, −907731667, −909224120, −910716037, −912207419, −913698264, −915188572, −916678341,

      −918167571, −919656261, −921144410, −922632017, −924119082, −925605602, −927091578, −928577009,

      −930061894, −931546231, −933030020, −934513261, −935995952, −937478092, −938959680, −940440717,

      −941921200, −943401128, −944880502, −946359320, −947837582, −949315286, −950792431, −952269017,

      −953745043, −955220507, −956695410, −958169750, −959643527, −961116738, −962589385, −964061465,

      −965532978, −967003923, −968474299, −969944105, −971413341, −972882006, −974350098, −975817617,

      −977284561, −978750931, −980216725, −981681943, −983146583, −984610644, −986074127, −987537029,

      −988999351, −990461090, −991922247, −993382820, −994842809, −996302213, −997761031, −999219262,

      −1000676905, −1002133959, −1003590423, −1005046298, −1006501581, −1007956272, −1009410370, −1010863874,

      −1012316784, −1013769098, −1015220815, −1016671936, −1018122458, −1019572381, −1021021705, −1022470428,

      −1023918549, −1025366069, −1026812985, −1028259296, −1029705003, −1031150105, −1032594599, −1034038486,

      −1035481765, −1036924435, −1038366495, −1039807944, −1041248781, −1042689006, −1044128617, −1045567614,

      −1047005996, −1048443762, −1049880911, −1051317443, −1052753356, −1054188650, −1055623324, −1057057377,

      −1058490807, −1059923616, −1061355800, −1062787361, −1064218296, −1065648605, −1067078287, −1068507341,

      −1069935767, −1071363564, −1072790730, −1074217265, −1075643168, −1077068439, −1078493075, −1079917078,

      −1081340445, −1082763176, −1084185270, −1085606726, −1087027543, −1088447721, −1089867259, −1091286156,

      −1092704410, −1094122022, −1095538990, −1096955314, −1098370992, −1099786025, −1101200410, −1102614147,

      −1104027236, −1105439675, −1106851464, −1108262602, −1109673088, −1111082921, −1112492101, −1113900626,

      −1115308496, −1116715710, −1118122266, −1119528165, −1120933406, −1122337987, −1123741907, −1125145167,

      −1126547765, −1127949700, −1129350972, −1130751579, −1132151521, −1133550797, −1134949406, −1136347347,

      −1137744620, −1139141224, −1140537157, −1141932420, −1143327011, −1144720929, −1146114174, −1147506744,

      −1148898640, −1150289860, −1151680403, −1153070268, −1154459455, −1155847963, −1157235791, −1158622939,

      −1160009404, −1161395188, −1162780288, −1164164704, −1165548435, −1166931480, −1168313839, −1169695511,

      −1171076495, −1172456790, −1173836395, −1175215309, −1176593532, −1177971063, −1179347901, −1180724046,

      −1182099495, −1183474249, −1184848308, −1186221669, −1187594332, −1188966296, −1190337561, −1191708126,

      −1193077990, −1194447152, −1195815611, −1197183367, −1198550419, −1199916765, −1201282406, −1202647340,

      −1204011566, −1205375085, −1206737894, −1208099993, −1209461381, −1210822058, −1212182023, −1213541275,

      −1214899812, −1216257635, −1217614743, −1218971134, −1220326808, −1221681764, −1223036002, −1224389520,

      −1225742318, −1227094395, −1228445749, −1229796382, −1231146290, −1232495475, −1233843934, −1235191668,

      −1236538675, −1237884954, −1239230506, −1240575328, −1241919421, −1243262783, −1244605413, −1245947312,

      −1247288477, −1248628909, −1249968606, −1251307568, −1252645793, −1253983282, −1255320033, −1256656046,

      −1257991319, −1259325853, −1260659645, −1261992696, −1263325005, −1264656570, −1265987391, −1267317468,

      −1268646799, −1269975384, −1271303222, −1272630311, −1273956652, −1275282244, −1276607086, −1277931176,

      −1279254515, −1280577101, −1281898934, −1283220013, −1284540337, −1285859905, −1287178717, −1288496771,

      −1289814068, −1291130605, −1292446384, −1293761402, −1295075658, −1296389153, −1297701886, −1299013855,

      −1300325059, −1301635499, −1302945173, −1304254081, −1305562221, −1306869594, −1308176197, −1309482031,

      −1310787095, −1312091387, −1313394908, −1314697656, −1315999631, −1317300831, −1318601257, −1319900907,

      −1321199780, −1322497876, −1323795194, −1325091734, −1326387493, −1327682473, −1328976672, −1330270088,

      −1331562722, −1332854573, −1334145640, −1335435922, −1336725418, −1338014128, −1339302051, −1340589186,

      −1341875532, −1343161089, −1344445856, −1345729832, −1347013016, −1348295408, −1349577007, −1350857812,

      −1352137822, −1353417036, −1354695455, −1355973076, −1357249900, −1358525925, −1359801152, −1361075578,

      −1362349204, −1363622028, −1364894050, −1366165269, −1367435684, −1368705295, −1369974101, −1371242101,

      −1372509294, −1373775680, −1375041257, −1376306026, −1377569985, −1378833134, −1380095471, −1381356997,

      −1382617710, −1383877609, −1385136695, −1386394966, −1387652421, −1388909060, −1390164882, −1391419886,

      −1392674071, −1393927437, −1395179983, −1396431709, −1397682613, −1398932694, −1400181953, −1401430388,

      −1402677999, −1403924784, −1405170744, −1406415877, −1407660183, −1408903660, −1410146309, −1411388128,

      −1412629117, −1413869275, −1415108601, −1416347094, −1417584755, −1418821581, −1420057573, −1421292730,

      −1422527050, −1423760533, −1424993179, −1426224987, −1427455956, −1428686085, −1429915373, −1431143820,

      −1432371426, −1433598188, −1434824108, −1436049183, −1437273414, −1438496799, −1439719338, −1440941029,

      −1442161874, −1443381869, −1444601016, −1445819313, −1447036759, −1448253354, −1449469097, −1450683988,

      −1451898025, −1453111208, −1454323536, −1455535008, −1456745625, −1457955384, −1459164286, −1460372329,

      −1461579513, −1462785837, −1463991301, −1465195904, −1466399644, −1467602522, −1468804537, −1470005688,

      −1471205973, −1472405394, −1473603948, −1474801635, −1475998455, −1477194406, −1478389489, −1479583701,

      −1480777044, −1481969515, −1483161114, −1484351841, −1485541695, −1486730675, −1487918780, −1489106010,

      −1490292364, −1491477841, −1492662441, −1493846162, −1495029005, −1496210969, −1497392052, −1498572254,

      −1499751575, −1500930014, −1502107569, −1503284241, −1504460029, −1505634931, −1506808948, −1507982078,

      −1509154322, −1510325677, −1511496144, −1512665722, −1513834410, −1515002207, −1516169113, −1517335128,

};

 

TwiddleReal_4[ 2 ] = {

      2147483647, 0,

};

 

TwiddleImag_4[ 2 ] = {

      0, −2147483647,

};

 

TwiddleReal_8[ 4 ] = {

      2147483647, 1518500249, 0, −1518500249,

};

 

TwiddleImag_8[ 4 ] = {

      0, −1518500249, −2147483647, −1518500249,

};

 

TwiddleReal_16[ 8 ] = {

      2147483647, 1984016188, 1518500249, 821806413, 0, −821806413, −1518500249, −1984016188,

};

 

TwiddleImag_16[ 8 ] = {

      0, −821806413, −1518500249, −1984016188, −2147483647, −1984016188, −1518500249, −821806413,

};

 

TwiddleReal_32[ 16 ] = {

      2147483647, 2106220351, 1984016188, 1785567395, 1518500249, 1193077990, 821806413, 418953276,

      0, −418953276, −821806413, −1193077990, −1518500249, −1785567395, −1984016188, −2106220351,

};

 

TwiddleImag_32[ 16 ] = {

      0, −418953276, −821806413, −1193077990, −1518500249, −1785567395, −1984016188, −2106220351,

      −2147483647, −2106220351, −1984016188, −1785567395, −1518500249, −1193077990, −821806413, −418953276,

};

 

TwiddleReal_64[ 32 ] = {

      2147483647, 2137142926, 2106220351, 2055013722, 1984016188, 1893911493, 1785567395, 1660027308,

      1518500249, 1362349204, 1193077990, 1012316784, 821806413, 623381597, 418953276, 210490206,

      0, −210490206, −418953276, −623381597, −821806413, −1012316784, −1193077990, −1362349204,

      −1518500249, −1660027308, −1785567395, −1893911493, −1984016188, −2055013722, −2106220351, −2137142926,

};

 

TwiddleImag_64[ 32 ] = {

      0, −210490206, −418953276, −623381597, −821806413, −1012316784, −1193077990, −1362349204,

      −1518500249, −1660027308, −1785567395, −1893911493, −1984016188, −2055013722, −2106220351, −2137142926,

      −2147483647, −2137142926, −2106220351, −2055013722, −1984016188, −1893911493, −1785567395, −1660027308,

      −1518500249, −1362349204, −1193077990, −1012316784, −821806413, −623381597, −418953276, −210490206,

};

 

TwiddleReal_128[ 64 ] = {

      2147483647, 2144896909, 2137142926, 2124240379, 2106220351, 2083126253, 2055013722, 2021950483,

      1984016188, 1941302224, 1893911493, 1841958164, 1785567395, 1724875039, 1660027308, 1591180425,

      1518500249, 1442161874, 1362349204, 1279254515, 1193077990, 1104027236, 1012316784, 918167571,

      821806413, 723465451, 623381597, 521795963, 418953276, 315101294, 210490206, 105372028,

      0, −105372028, −210490206, −315101294, −418953276, −521795963, −623381597, −723465451,

      −821806413, −918167571, −1012316784, −1104027236, −1193077990, −1279254515, −1362349204, −1442161874,

      −1518500249, −1591180425, −1660027308, −1724875039, −1785567395, −1841958164, −1893911493, −1941302224,

      −1984016188, −2021950483, −2055013722, −2083126253, −2106220351, −2124240379, −2137142926, −2144896909,

};

 

TwiddleImag_128[ 64 ] = {

      0, −105372028, −210490206, −315101294, −418953276, −521795963, −623381597, −723465451,

      −821806413, −918167571, −1012316784, −1104027236, −1193077990, −1279254515, −1362349204, −1442161874,

      −1518500249, −1591180425, −1660027308, −1724875039, −1785567395, −1841958164, −1893911493, −1941302224,

      −1984016188, −2021950483, −2055013722, −2083126253, −2106220351, −2124240379, −2137142926, −2144896909,

      −2147483647, −2144896909, −2137142926, −2124240379, −2106220351, −2083126253, −2055013722, −2021950483,

      −1984016188, −1941302224, −1893911493, −1841958164, −1785567395, −1724875039, −1660027308, −1591180425,

      −1518500249, −1442161874, −1362349204, −1279254515, −1193077990, −1104027236, −1012316784, −918167571,

      −821806413, −723465451, −623381597, −521795963, −418953276, −315101294, −210490206, −105372028,

};

 

TwiddleReal_256[ 128 ] = {

      2147483647, 2146836865, 2144896909, 2141664947, 2137142926, 2131333571, 2124240379, 2115867625,

      2106220351, 2095304369, 2083126253, 2069693341, 2055013722, 2039096240, 2021950483, 2003586778,

      1984016188, 1963250500, 1941302224, 1918184580, 1893911493, 1868497585, 1841958164, 1814309215,

      1785567395, 1755750016, 1724875039, 1692961061, 1660027308, 1626093615, 1591180425, 1555308767,

      1518500249, 1480777044, 1442161874, 1402677999, 1362349204, 1321199780, 1279254515, 1236538675,

      1193077990, 1148898640, 1104027236, 1058490807, 1012316784, 965532978, 918167571, 870249095,

      821806413, 772868706, 723465451, 673626408, 623381597, 572761285, 521795963, 470516330,

      418953276, 367137860, 315101294, 262874923, 210490206, 157978697, 105372028, 52701887,

      0, −52701887, −105372028, −157978697, −210490206, −262874923, −315101294, −367137860,

      −418953276, −470516330, −521795963, −572761285, −623381597, −673626408, −723465451, −772868706,

      −821806413, −870249095, −918167571, −965532978, −1012316784, −1058490807, −1104027236, −1148898640,

      −1193077990, −1236538675, −1279254515, −1321199780, −1362349204, −1402677999, −1442161874, −1480777044,

      −1518500249, −1555308767, −1591180425, −1626093615, −1660027308, −1692961061, −1724875039, −1755750016,

      −1785567395, −1814309215, −1841958164, −1868497585, −1893911493, −1918184580, −1941302224, −1963250500,

      −1984016188, −2003586778, −2021950483, −2039096240, −2055013722, −2069693341, −2083126253, −2095304369,

      −2106220351, −2115867625, −2124240379, −2131333571, −2137142926, −2141664947, −2144896909, −2146836865,

};

 

TwiddleImag_256[ 128 ] = {

      0, −52701887, −105372028, −157978697, −210490206, −262874923, −315101294, −367137860,

      −418953276, −470516330, −521795963, −572761285, −623381597, −673626408, −723465451, −772868706,

      −821806413, −870249095, −918167571, −965532978, −1012316784, −1058490807, −1104027236, −1148898640,

      −1193077990, −1236538675, −1279254515, −1321199780, −1362349204, −1402677999, −1442161874, −1480777044,

      −1518500249, −1555308767, −1591180425, −1626093615, −1660027308, −1692961061, −1724875039, −1755750016,

      −1785567395, −1814309215, −1841958164, −1868497585, −1893911493, −1918184580, −1941302224, −1963250500,

      −1984016188, −2003586778, −2021950483, −2039096240, −2055013722, −2069693341, −2083126253, −2095304369,

      −2106220351, −2115867625, −2124240379, −2131333571, −2137142926, −2141664947, −2144896909, −2146836865,

      −2147483647, −2146836865, −2144896909, −2141664947, −2137142926, −2131333571, −2124240379, −2115867625,

      −2106220351, −2095304369, −2083126253, −2069693341, −2055013722, −2039096240, −2021950483, −2003586778,

      −1984016188, −1963250500, −1941302224, −1918184580, −1893911493, −1868497585, −1841958164, −1814309215,

      −1785567395, −1755750016, −1724875039, −1692961061, −1660027308, −1626093615, −1591180425, −1555308767,

      −1518500249, −1480777044, −1442161874, −1402677999, −1362349204, −1321199780, −1279254515, −1236538675,

      −1193077990, −1148898640, −1104027236, −1058490807, −1012316784, −965532978, −918167571, −870249095,

      −821806413, −772868706, −723465451, −673626408, −623381597, −572761285, −521795963, −470516330,

      −418953276, −367137860, −315101294, −262874923, −210490206, −157978697, −105372028, −52701887,

};

 

TwiddleReal_512[ 256 ] = {

      2147483647, 2147321945, 2146836865, 2146028479, 2144896909, 2143442325, 2141664947, 2139565042,

      2137142926, 2134398965, 2131333571, 2127947205, 2124240379, 2120213650, 2115867625, 2111202958,

      2106220351, 2100920555, 2095304369, 2089372637, 2083126253, 2076566159, 2069693341, 2062508835,

      2055013722, 2047209132, 2039096240, 2030676268, 2021950483, 2012920200, 2003586778, 1993951624,

      1984016188, 1973781966, 1963250500, 1952423376, 1941302224, 1929888719, 1918184580, 1906191569,

      1893911493, 1881346201, 1868497585, 1855367580, 1841958164, 1828271355, 1814309215, 1800073848,

      1785567395, 1770792043, 1755750016, 1740443580, 1724875039, 1709046738, 1692961061, 1676620431,

      1660027308, 1643184190, 1626093615, 1608758157, 1591180425, 1573363067, 1555308767, 1537020243,

      1518500249, 1499751575, 1480777044, 1461579513, 1442161874, 1422527050, 1402677999, 1382617710,

      1362349204, 1341875532, 1321199780, 1300325059, 1279254515, 1257991319, 1236538675, 1214899812,

      1193077990, 1171076495, 1148898640, 1126547765, 1104027236, 1081340445, 1058490807, 1035481765,

      1012316784, 988999351, 965532978, 941921200, 918167571, 894275670, 870249095, 846091463,

      821806413, 797397602, 772868706, 748223418, 723465451, 698598533, 673626408, 648552837,

      623381597, 598116478, 572761285, 547319836, 521795963, 496193509, 470516330, 444768293,

      418953276, 393075166, 367137860, 341145265, 315101294, 289009871, 262874923, 236700388,

      210490206, 184248325, 157978697, 131685278, 105372028, 79042909, 52701887, 26352928,

      0, −26352928, −52701887, −79042909, −105372028, −131685278, −157978697, −184248325,

      −210490206, −236700388, −262874923, −289009871, −315101294, −341145265, −367137860, −393075166,

      −418953276, −444768293, −470516330, −496193509, −521795963, −547319836, −572761285, −598116478,

      −623381597, −648552837, −673626408, −698598533, −723465451, −748223418, −772868706, −797397602,

      −821806413, −846091463, −870249095, −894275670, −918167571, −941921200, −965532978, −988999351,

      −1012316784, −1035481765, −1058490807, −1081340445, −1104027236, −1126547765, −1148898640, −1171076495,

      −1193077990, −1214899812, −1236538675, −1257991319, −1279254515, −1300325059, −1321199780, −1341875532,

      −1362349204, −1382617710, −1402677999, −1422527050, −1442161874, −1461579513, −1480777044, −1499751575,

      −1518500249, −1537020243, −1555308767, −1573363067, −1591180425, −1608758157, −1626093615, −1643184190,

      −1660027308, −1676620431, −1692961061, −1709046738, −1724875039, −1740443580, −1755750016, −1770792043,

      −1785567395, −1800073848, −1814309215, −1828271355, −1841958164, −1855367580, −1868497585, −1881346201,

      −1893911493, −1906191569, −1918184580, −1929888719, −1941302224, −1952423376, −1963250500, −1973781966,

      −1984016188, −1993951624, −2003586778, −2012920200, −2021950483, −2030676268, −2039096240, −2047209132,

      −2055013722, −2062508835, −2069693341, −2076566159, −2083126253, −2089372637, −2095304369, −2100920555,

      −2106220351, −2111202958, −2115867625, −2120213650, −2124240379, −2127947205, −2131333571, −2134398965,

      −2137142926, −2139565042, −2141664947, −2143442325, −2144896909, −2146028479, −2146836865, −2147321945,

};

 

TwiddleImag_512[ 256 ] = {

      0, −26352928, −52701887, −79042909, −105372028, −131685278, −157978697, −184248325,

      −210490206, −236700388, −262874923, −289009871, −315101294, −341145265, −367137860, −393075166,

      −418953276, −444768293, −470516330, −496193509, −521795963, −547319836, −572761285, −598116478,

      −623381597, −648552837, −673626408, −698598533, −723465451, −748223418, −772868706, −797397602,

      −821806413, −846091463, −870249095, −894275670, −918167571, −941921200, −965532978, −988999351,

      −1012316784, −1035481765, −1058490807, −1081340445, −1104027236, −1126547765, −1148898640, −1171076495,

      −1193077990, −1214899812, −1236538675, −1257991319, −1279254515, −1300325059, −1321199780, −1341875532,

      −1362349204, −1382617710, −1402677999, −1422527050, −1442161874, −1461579513, −1480777044, −1499751575,

      −1518500249, −1537020243, −1555308767, −1573363067, −1591180425, −1608758157, −1626093615, −1643184190,

      −1660027308, −1676620431, −1692961061, −1709046738, −1724875039, −1740443580, −1755750016, −1770792043,

      −1785567395, −1800073848, −1814309215, −1828271355, −1841958164, −1855367580, −1868497585, −1881346201,

      −1893911493, −1906191569, −1918184580, −1929888719, −1941302224, −1952423376, −1963250500, −1973781966,

      −1984016188, −1993951624, −2003586778, −2012920200, −2021950483, −2030676268, −2039096240, −2047209132,

      −2055013722, −2062508835, −2069693341, −2076566159, −2083126253, −2089372637, −2095304369, −2100920555,

      −2106220351, −2111202958, −2115867625, −2120213650, −2124240379, −2127947205, −2131333571, −2134398965,

      −2137142926, −2139565042, −2141664947, −2143442325, −2144896909, −2146028479, −2146836865, −2147321945,

      −2147483647, −2147321945, −2146836865, −2146028479, −2144896909, −2143442325, −2141664947, −2139565042,

      −2137142926, −2134398965, −2131333571, −2127947205, −2124240379, −2120213650, −2115867625, −2111202958,

      −2106220351, −2100920555, −2095304369, −2089372637, −2083126253, −2076566159, −2069693341, −2062508835,

      −2055013722, −2047209132, −2039096240, −2030676268, −2021950483, −2012920200, −2003586778, −1993951624,

      −1984016188, −1973781966, −1963250500, −1952423376, −1941302224, −1929888719, −1918184580, −1906191569,

      −1893911493, −1881346201, −1868497585, −1855367580, −1841958164, −1828271355, −1814309215, −1800073848,

      −1785567395, −1770792043, −1755750016, −1740443580, −1724875039, −1709046738, −1692961061, −1676620431,

      −1660027308, −1643184190, −1626093615, −1608758157, −1591180425, −1573363067, −1555308767, −1537020243,

      −1518500249, −1499751575, −1480777044, −1461579513, −1442161874, −1422527050, −1402677999, −1382617710,

      −1362349204, −1341875532, −1321199780, −1300325059, −1279254515, −1257991319, −1236538675, −1214899812,

      −1193077990, −1171076495, −1148898640, −1126547765, −1104027236, −1081340445, −1058490807, −1035481765,

      −1012316784, −988999351, −965532978, −941921200, −918167571, −894275670, −870249095, −846091463,

      −821806413, −797397602, −772868706, −748223418, −723465451, −698598533, −673626408, −648552837,

      −623381597, −598116478, −572761285, −547319836, −521795963, −496193509, −470516330, −444768293,

      −418953276, −393075166, −367137860, −341145265, −315101294, −289009871, −262874923, −236700388,

      −210490206, −184248325, −157978697, −131685278, −105372028, −79042909, −52701887, −26352928,

};

 

TwiddleReal_1024[ 512 ] = {

      2147483647, 2147443221, 2147321945, 2147119824, 2146836865, 2146473079, 2146028479, 2145503082,

      2144896909, 2144209981, 2143442325, 2142593970, 2141664947, 2140655292, 2139565042, 2138394239,

      2137142926, 2135811152, 2134398965, 2132906419, 2131333571, 2129680479, 2127947205, 2126133816,

      2124240379, 2122266966, 2120213650, 2118080510, 2115867625, 2113575079, 2111202958, 2108751351,

      2106220351, 2103610053, 2100920555, 2098151959, 2095304369, 2092377891, 2089372637, 2086288719,

      2083126253, 2079885359, 2076566159, 2073168776, 2069693341, 2066139982, 2062508835, 2058800035,

      2055013722, 2051150040, 2047209132, 2043191149, 2039096240, 2034924561, 2030676268, 2026351521,

      2021950483, 2017473320, 2012920200, 2008291295, 2003586778, 1998806828, 1993951624, 1989021349,

      1984016188, 1978936330, 1973781966, 1968553291, 1963250500, 1957873795, 1952423376, 1946899450,

      1941302224, 1935631909, 1929888719, 1924072870, 1918184580, 1912224072, 1906191569, 1900087300,

      1893911493, 1887664382, 1881346201, 1874957188, 1868497585, 1861967633, 1855367580, 1848697673,

      1841958164, 1835149305, 1828271355, 1821324571, 1814309215, 1807225552, 1800073848, 1792854372,

      1785567395, 1778213194, 1770792043, 1763304223, 1755750016, 1748129706, 1740443580, 1732691927,

      1724875039, 1716993211, 1709046738, 1701035921, 1692961061, 1684822463, 1676620431, 1668355276,

      1660027308, 1651636840, 1643184190, 1634669675, 1626093615, 1617456334, 1608758157, 1599999410,

      1591180425, 1582301533, 1573363067, 1564365366, 1555308767, 1546193612, 1537020243, 1527789006,

      1518500249, 1509154322, 1499751575, 1490292364, 1480777044, 1471205973, 1461579513, 1451898025,

      1442161874, 1432371426, 1422527050, 1412629117, 1402677999, 1392674071, 1382617710, 1372509294,

      1362349204, 1352137822, 1341875532, 1331562722, 1321199780, 1310787095, 1300325059, 1289814068,

      1279254515, 1268646799, 1257991319, 1247288477, 1236538675, 1225742318, 1214899812, 1204011566,

      1193077990, 1182099495, 1171076495, 1160009404, 1148898640, 1137744620, 1126547765, 1115308496,

      1104027236, 1092704410, 1081340445, 1069935767, 1058490807, 1047005996, 1035481765, 1023918549,

      1012316784, 1000676905, 988999351, 977284561, 965532978, 953745043, 941921200, 930061894,

      918167571, 906238681, 894275670, 882278991, 870249095, 858186434, 846091463, 833964637,

      821806413, 809617248, 797397602, 785147934, 772868706, 760560379, 748223418, 735858287,

      723465451, 711045377, 698598533, 686125386, 673626408, 661102068, 648552837, 635979190,

      623381597, 610760535, 598116478, 585449903, 572761285, 560051103, 547319836, 534567963,

      521795963, 509004318, 496193509, 483364019, 470516330, 457650927, 444768293, 431868915,

      418953276, 406021864, 393075166, 380113669, 367137860, 354148229, 341145265, 328129457,

      315101294, 302061269, 289009871, 275947592, 262874923, 249792358, 236700388, 223599506,

      210490206, 197372981, 184248325, 171116732, 157978697, 144834714, 131685278, 118530885,

      105372028, 92209205, 79042909, 65873638, 52701887, 39528151, 26352928, 13176712,

      0, −13176712, −26352928, −39528151, −52701887, −65873638, −79042909, −92209205,

      −105372028, −118530885, −131685278, −144834714, −157978697, −171116732, −184248325, −197372981,

      −210490206, −223599506, −236700388, −249792358, −262874923, −275947592, −289009871, −302061269,

      −315101294, −328129457, −341145265, −354148229, −367137860, −380113669, −393075166, −406021864,

      −418953276, −431868915, −444768293, −457650927, −470516330, −483364019, −496193509, −509004318,

      −521795963, −534567963, −547319836, −560051103, −572761285, −585449903, −598116478, −610760535,

      −623381597, −635979190, −648552837, −661102068, −673626408, −686125386, −698598533, −711045377,

      −723465451, −735858287, −748223418, −760560379, −772868706, −785147934, −797397602, −809617248,

      −821806413, −833964637, −846091463, −858186434, −870249095, −882278991, −894275670, −906238681,

      −918167571, −930061894, −941921200, −953745043, −965532978, −977284561, −988999351, −1000676905,

      −1012316784, −1023918549, −1035481765, −1047005996, −1058490807, −1069935767, −1081340445, −1092704410,

      −1104027236, −1115308496, −1126547765, −1137744620, −1148898640, −1160009404, −1171076495, −1182099495,

      −1193077990, −1204011566, −1214899812, −1225742318, −1236538675, −1247288477, −1257991319, −1268646799,

      −1279254515, −1289814068, −1300325059, −1310787095, −1321199780, −1331562722, −1341875532, −1352137822,

      −1362349204, −1372509294, −1382617710, −1392674071, −1402677999, −1412629117, −1422527050, −1432371426,

      −1442161874, −1451898025, −1461579513, −1471205973, −1480777044, −1490292364, −1499751575, −1509154322,

      −1518500249, −1527789006, −1537020243, −1546193612, −1555308767, −1564365366, −1573363067, −1582301533,

      −1591180425, −1599999410, −1608758157, −1617456334, −1626093615, −1634669675, −1643184190, −1651636840,

      −1660027308, −1668355276, −1676620431, −1684822463, −1692961061, −1701035921, −1709046738, −1716993211,

      −1724875039, −1732691927, −1740443580, −1748129706, −1755750016, −1763304223, −1770792043, −1778213194,

      −1785567395, −1792854372, −1800073848, −1807225552, −1814309215, −1821324571, −1828271355, −1835149305,

      −1841958164, −1848697673, −1855367580, −1861967633, −1868497585, −1874957188, −1881346201, −1887664382,

      −1893911493, −1900087300, −1906191569, −1912224072, −1918184580, −1924072870, −1929888719, −1935631909,

      −1941302224, −1946899450, −1952423376, −1957873795, −1963250500, −1968553291, −1973781966, −1978936330,

      −1984016188, −1989021349, −1993951624, −1998806828, −2003586778, −2008291295, −2012920200, −2017473320,

      −2021950483, −2026351521, −2030676268, −2034924561, −2039096240, −2043191149, −2047209132, −2051150040,

      −2055013722, −2058800035, −2062508835, −2066139982, −2069693341, −2073168776, −2076566159, −2079885359,

      −2083126253, −2086288719, −2089372637, −2092377891, −2095304369, −2098151959, −2100920555, −2103610053,

      −2106220351, −2108751351, −2111202958, −2113575079, −2115867625, −2118080510, −2120213650, −2122266966,

      −2124240379, −2126133816, −2127947205, −2129680479, −2131333571, −2132906419, −2134398965, −2135811152,

      −2137142926, −2138394239, −2139565042, −2140655292, −2141664947, −2142593970, −2143442325, −2144209981,

      −2144896909, −2145503082, −2146028479, −2146473079, −2146836865, −2147119824, −2147321945, −2147443221,

};

 

TwiddleImag_1024[ 512 ] = {

      0, −13176712, −26352928, −39528151, −52701887, −65873638, −79042909, −92209205,

      −105372028, −118530885, −131685278, −144834714, −157978697, −171116732, −184248325, −197372981,

      −210490206, −223599506, −236700388, −249792358, −262874923, −275947592, −289009871, −302061269,

      −315101294, −328129457, −341145265, −354148229, −367137860, −380113669, −393075166, −406021864,

      −418953276, −431868915, −444768293, −457650927, −470516330, −483364019, −496193509, −509004318,

      −521795963, −534567963, −547319836, −560051103, −572761285, −585449903, −598116478, −610760535,

      −623381597, −635979190, −648552837, −661102068, −673626408, −686125386, −698598533, −711045377,

      −723465451, −735858287, −748223418, −760560379, −772868706, −785147934, −797397602, −809617248,

      −821806413, −833964637, −846091463, −858186434, −870249095, −882278991, −894275670, −906238681,

      −918167571, −930061894, −941921200, −953745043, −965532978, −977284561, −988999351, −1000676905,

      −1012316784, −1023918549, −1035481765, −1047005996, −1058490807, −1069935767, −1081340445, −1092704410,

      −1104027236, −1115308496, −1126547765, −1137744620, −1148898640, −1160009404, −1171076495, −1182099495,

      −1193077990, −1204011566, −1214899812, −1225742318, −1236538675, −1247288477, −1257991319, −1268646799,

      −1279254515, −1289814068, −1300325059, −1310787095, −1321199780, −1331562722, −1341875532, −1352137822,

      −1362349204, −1372509294, −1382617710, −1392674071, −1402677999, −1412629117, −1422527050, −1432371426,

      −1442161874, −1451898025, −1461579513, −1471205973, −1480777044, −1490292364, −1499751575, −1509154322,

      −1518500249, −1527789006, −1537020243, −1546193612, −1555308767, −1564365366, −1573363067, −1582301533,

      −1591180425, −1599999410, −1608758157, −1617456334, −1626093615, −1634669675, −1643184190, −1651636840,

      −1660027308, −1668355276, −1676620431, −1684822463, −1692961061, −1701035921, −1709046738, −1716993211,

      −1724875039, −1732691927, −1740443580, −1748129706, −1755750016, −1763304223, −1770792043, −1778213194,

      −1785567395, −1792854372, −1800073848, −1807225552, −1814309215, −1821324571, −1828271355, −1835149305,

      −1841958164, −1848697673, −1855367580, −1861967633, −1868497585, −1874957188, −1881346201, −1887664382,

      −1893911493, −1900087300, −1906191569, −1912224072, −1918184580, −1924072870, −1929888719, −1935631909,

      −1941302224, −1946899450, −1952423376, −1957873795, −1963250500, −1968553291, −1973781966, −1978936330,

      −1984016188, −1989021349, −1993951624, −1998806828, −2003586778, −2008291295, −2012920200, −2017473320,

      −2021950483, −2026351521, −2030676268, −2034924561, −2039096240, −2043191149, −2047209132, −2051150040,

      −2055013722, −2058800035, −2062508835, −2066139982, −2069693341, −2073168776, −2076566159, −2079885359,

      −2083126253, −2086288719, −2089372637, −2092377891, −2095304369, −2098151959, −2100920555, −2103610053,

      −2106220351, −2108751351, −2111202958, −2113575079, −2115867625, −2118080510, −2120213650, −2122266966,

      −2124240379, −2126133816, −2127947205, −2129680479, −2131333571, −2132906419, −2134398965, −2135811152,

      −2137142926, −2138394239, −2139565042, −2140655292, −2141664947, −2142593970, −2143442325, −2144209981,

      −2144896909, −2145503082, −2146028479, −2146473079, −2146836865, −2147119824, −2147321945, −2147443221,

      −2147483647, −2147443221, −2147321945, −2147119824, −2146836865, −2146473079, −2146028479, −2145503082,

      −2144896909, −2144209981, −2143442325, −2142593970, −2141664947, −2140655292, −2139565042, −2138394239,

      −2137142926, −2135811152, −2134398965, −2132906419, −2131333571, −2129680479, −2127947205, −2126133816,

      −2124240379, −2122266966, −2120213650, −2118080510, −2115867625, −2113575079, −2111202958, −2108751351,

      −2106220351, −2103610053, −2100920555, −2098151959, −2095304369, −2092377891, −2089372637, −2086288719,

      −2083126253, −2079885359, −2076566159, −2073168776, −2069693341, −2066139982, −2062508835, −2058800035,

      −2055013722, −2051150040, −2047209132, −2043191149, −2039096240, −2034924561, −2030676268, −2026351521,

      −2021950483, −2017473320, −2012920200, −2008291295, −2003586778, −1998806828, −1993951624, −1989021349,

      −1984016188, −1978936330, −1973781966, −1968553291, −1963250500, −1957873795, −1952423376, −1946899450,

      −1941302224, −1935631909, −1929888719, −1924072870, −1918184580, −1912224072, −1906191569, −1900087300,

      −1893911493, −1887664382, −1881346201, −1874957188, −1868497585, −1861967633, −1855367580, −1848697673,

      −1841958164, −1835149305, −1828271355, −1821324571, −1814309215, −1807225552, −1800073848, −1792854372,

      −1785567395, −1778213194, −1770792043, −1763304223, −1755750016, −1748129706, −1740443580, −1732691927,

      −1724875039, −1716993211, −1709046738, −1701035921, −1692961061, −1684822463, −1676620431, −1668355276,

      −1660027308, −1651636840, −1643184190, −1634669675, −1626093615, −1617456334, −1608758157, −1599999410,

      −1591180425, −1582301533, −1573363067, −1564365366, −1555308767, −1546193612, −1537020243, −1527789006,

      −1518500249, −1509154322, −1499751575, −1490292364, −1480777044, −1471205973, −1461579513, −1451898025,

      −1442161874, −1432371426, −1422527050, −1412629117, −1402677999, −1392674071, −1382617710, −1372509294,

      −1362349204, −1352137822, −1341875532, −1331562722, −1321199780, −1310787095, −1300325059, −1289814068,

      −1279254515, −1268646799, −1257991319, −1247288477, −1236538675, −1225742318, −1214899812, −1204011566,

      −1193077990, −1182099495, −1171076495, −1160009404, −1148898640, −1137744620, −1126547765, −1115308496,

      −1104027236, −1092704410, −1081340445, −1069935767, −1058490807, −1047005996, −1035481765, −1023918549,

      −1012316784, −1000676905, −988999351, −977284561, −965532978, −953745043, −941921200, −930061894,

      −918167571, −906238681, −894275670, −882278991, −870249095, −858186434, −846091463, −833964637,

      −821806413, −809617248, −797397602, −785147934, −772868706, −760560379, −748223418, −735858287,

      −723465451, −711045377, −698598533, −686125386, −673626408, −661102068, −648552837, −635979190,

      −623381597, −610760535, −598116478, −585449903, −572761285, −560051103, −547319836, −534567963,

      −521795963, −509004318, −496193509, −483364019, −470516330, −457650927, −444768293, −431868915,

      −418953276, −406021864, −393075166, −380113669, −367137860, −354148229, −341145265, −328129457,

      −315101294, −302061269, −289009871, −275947592, −262874923, −249792358, −236700388, −223599506,

      −210490206, −197372981, −184248325, −171116732, −157978697, −144834714, −131685278, −118530885,

      −105372028, −92209205, −79042909, −65873638, −52701887, −39528151, −26352928, −13176712,

};

 

Bibliography

[Makhoul1980] J. Makhoul, "A fast cosine transform in one and two dimensions," in IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 28, no. 1, pp. 27–34, February 1980, doi: 10.1109/TASSP.1980.1163351.

[Geiger2003] Geiger R., Yokotani Y., Schuller G. "Improved integer transforms for lossless audio coding, "The Thirty-Seventh Asilomar Conference on Signals, Systems & Computers, 2003, Pacific Grove, CA, USA, 2003, pp. 2119–2123 Vol. 2, doi: 10.1109/ACSSC.2003.1292354.

espa-banner