Internet Engineering Task Force (IETF)                         JM. Valin
Request for Comments: 6716                           Mozilla Corporation
Category: Standards Track                                         K. Vos
ISSN: 2070-1721                                  Skype Technologies S.A.
                                                           T. Terriberry
                                                     Mozilla Corporation
                                                          September 2012
        
Internet Engineering Task Force (IETF)                         JM. Valin
Request for Comments: 6716                           Mozilla Corporation
Category: Standards Track                                         K. Vos
ISSN: 2070-1721                                  Skype Technologies S.A.
                                                           T. Terriberry
                                                     Mozilla Corporation
                                                          September 2012
        

Definition of the Opus Audio Codec

Opus音频编解码器的定义

Abstract

摘要

This document defines the Opus interactive speech and audio codec. Opus is designed to handle a wide range of interactive audio applications, including Voice over IP, videoconferencing, in-game chat, and even live, distributed music performances. It scales from low bitrate narrowband speech at 6 kbit/s to very high quality stereo music at 510 kbit/s. Opus uses both Linear Prediction (LP) and the Modified Discrete Cosine Transform (MDCT) to achieve good compression of both speech and music.

本文档定义了Opus交互式语音和音频编解码器。Opus设计用于处理广泛的交互式音频应用,包括IP语音、视频会议、游戏内聊天,甚至现场分布式音乐表演。它可以从6 kbit/s的低比特率窄带语音扩展到510 kbit/s的高质量立体声音乐。Opus使用线性预测(LP)和改进的离散余弦变换(MDCT)来实现语音和音乐的良好压缩。

Status of This Memo

关于下段备忘

This is an Internet Standards Track document.

这是一份互联网标准跟踪文件。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6716.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc6716.

Copyright Notice

版权公告

Copyright (c) 2012 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2012 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

The licenses granted by the IETF Trust to this RFC under Section 3.c of the Trust Legal Provisions shall also include the right to extract text from Sections 1 through 8 and Appendix A and Appendix B of this RFC and create derivative works from these extracts, and to copy, publish, display and distribute such derivative works in any medium and for any purpose, provided that no such derivative work shall be presented, displayed or published in a manner that states or implies that it is part of this RFC or any other IETF Document.

IETF信托根据信托法律条款第3.c节授予本RFC的许可证还应包括摘录本RFC第1节至第8节以及附录A和附录B中的文本,并根据这些摘录创作衍生作品,以及复制、出版、,以任何媒介和目的展示和分发此类衍生作品,前提是不得以声明或暗示其为本RFC或任何其他IETF文件一部分的方式展示、展示或发布此类衍生作品。

Table of Contents

目录

   1. Introduction ....................................................5
      1.1. Notation and Conventions ...................................6
   2. Opus Codec Overview .............................................8
      2.1. Control Parameters ........................................10
           2.1.1. Bitrate ............................................10
           2.1.2. Number of Channels (Mono/Stereo) ...................11
           2.1.3. Audio Bandwidth ....................................11
           2.1.4. Frame Duration .....................................11
           2.1.5. Complexity .........................................11
           2.1.6. Packet Loss Resilience .............................12
           2.1.7. Forward Error Correction (FEC) .....................12
           2.1.8. Constant/Variable Bitrate ..........................12
           2.1.9. Discontinuous Transmission (DTX) ...................13
   3. Internal Framing ...............................................13
      3.1. The TOC Byte ..............................................13
      3.2. Frame Packing .............................................16
           3.2.1. Frame Length Coding ................................16
           3.2.2. Code 0: One Frame in the Packet ....................16
           3.2.3. Code 1: Two Frames in the Packet, Each with
                  Equal Compressed Size ..............................17
           3.2.4. Code 2: Two Frames in the Packet, with
                  Different Compressed Sizes .........................17
        
   1. Introduction ....................................................5
      1.1. Notation and Conventions ...................................6
   2. Opus Codec Overview .............................................8
      2.1. Control Parameters ........................................10
           2.1.1. Bitrate ............................................10
           2.1.2. Number of Channels (Mono/Stereo) ...................11
           2.1.3. Audio Bandwidth ....................................11
           2.1.4. Frame Duration .....................................11
           2.1.5. Complexity .........................................11
           2.1.6. Packet Loss Resilience .............................12
           2.1.7. Forward Error Correction (FEC) .....................12
           2.1.8. Constant/Variable Bitrate ..........................12
           2.1.9. Discontinuous Transmission (DTX) ...................13
   3. Internal Framing ...............................................13
      3.1. The TOC Byte ..............................................13
      3.2. Frame Packing .............................................16
           3.2.1. Frame Length Coding ................................16
           3.2.2. Code 0: One Frame in the Packet ....................16
           3.2.3. Code 1: Two Frames in the Packet, Each with
                  Equal Compressed Size ..............................17
           3.2.4. Code 2: Two Frames in the Packet, with
                  Different Compressed Sizes .........................17
        
           3.2.5. Code 3: A Signaled Number of Frames in the Packet ..18
      3.3. Examples ..................................................21
      3.4. Receiving Malformed Packets ...............................22
   4. Opus Decoder ...................................................23
      4.1. Range Decoder .............................................23
           4.1.1. Range Decoder Initialization .......................25
           4.1.2. Decoding Symbols ...................................25
           4.1.3. Alternate Decoding Methods .........................27
           4.1.4. Decoding Raw Bits ..................................29
           4.1.5. Decoding Uniformly Distributed Integers ............29
           4.1.6. Current Bit Usage ..................................30
      4.2. SILK Decoder ..............................................32
           4.2.1. SILK Decoder Modules ...............................32
           4.2.2. LP Layer Organization ..............................33
           4.2.3. Header Bits ........................................35
           4.2.4. Per-Frame LBRR Flags ...............................36
           4.2.5. LBRR Frames ........................................36
           4.2.6. Regular SILK Frames ................................37
           4.2.7. SILK Frame Contents ................................37
                  4.2.7.1. Stereo Prediction Weights .................40
                  4.2.7.2. Mid-Only Flag .............................42
                  4.2.7.3. Frame Type ................................43
                  4.2.7.4. Subframe Gains ............................44
                  4.2.7.5. Normalized Line Spectral Frequency
                           (LSF) and Linear Predictive Coding (LPC)
                           Coeffieients ..............................46
                  4.2.7.6. Long-Term Prediction (LTP) Parameters .....74
                  4.2.7.7. Linear Congruential Generator (LCG) Seed ..86
                  4.2.7.8. Excitation ................................86
                  4.2.7.9. SILK Frame Reconstruction .................98
           4.2.8. Stereo Unmixing ...................................102
           4.2.9. Resampling ........................................103
      4.3. CELT Decoder .............................................104
           4.3.1. Transient Decoding ................................108
           4.3.2. Energy Envelope Decoding ..........................108
           4.3.3. Bit Allocation ....................................110
           4.3.4. Shape Decoding ....................................116
           4.3.5. Anti-collapse Processing ..........................120
           4.3.6. Denormalization ...................................121
           4.3.7. Inverse MDCT ......................................121
      4.4. Packet Loss Concealment (PLC) ............................122
           4.4.1. Clock Drift Compensation ..........................122
      4.5. Configuration Switching ..................................123
           4.5.1. Transition Side Information (Redundancy) ..........124
           4.5.2. State Reset .......................................127
           4.5.3. Summary of Transitions ............................128
   5. Opus Encoder ..................................................131
      5.1. Range Encoder ............................................132
        
           3.2.5. Code 3: A Signaled Number of Frames in the Packet ..18
      3.3. Examples ..................................................21
      3.4. Receiving Malformed Packets ...............................22
   4. Opus Decoder ...................................................23
      4.1. Range Decoder .............................................23
           4.1.1. Range Decoder Initialization .......................25
           4.1.2. Decoding Symbols ...................................25
           4.1.3. Alternate Decoding Methods .........................27
           4.1.4. Decoding Raw Bits ..................................29
           4.1.5. Decoding Uniformly Distributed Integers ............29
           4.1.6. Current Bit Usage ..................................30
      4.2. SILK Decoder ..............................................32
           4.2.1. SILK Decoder Modules ...............................32
           4.2.2. LP Layer Organization ..............................33
           4.2.3. Header Bits ........................................35
           4.2.4. Per-Frame LBRR Flags ...............................36
           4.2.5. LBRR Frames ........................................36
           4.2.6. Regular SILK Frames ................................37
           4.2.7. SILK Frame Contents ................................37
                  4.2.7.1. Stereo Prediction Weights .................40
                  4.2.7.2. Mid-Only Flag .............................42
                  4.2.7.3. Frame Type ................................43
                  4.2.7.4. Subframe Gains ............................44
                  4.2.7.5. Normalized Line Spectral Frequency
                           (LSF) and Linear Predictive Coding (LPC)
                           Coeffieients ..............................46
                  4.2.7.6. Long-Term Prediction (LTP) Parameters .....74
                  4.2.7.7. Linear Congruential Generator (LCG) Seed ..86
                  4.2.7.8. Excitation ................................86
                  4.2.7.9. SILK Frame Reconstruction .................98
           4.2.8. Stereo Unmixing ...................................102
           4.2.9. Resampling ........................................103
      4.3. CELT Decoder .............................................104
           4.3.1. Transient Decoding ................................108
           4.3.2. Energy Envelope Decoding ..........................108
           4.3.3. Bit Allocation ....................................110
           4.3.4. Shape Decoding ....................................116
           4.3.5. Anti-collapse Processing ..........................120
           4.3.6. Denormalization ...................................121
           4.3.7. Inverse MDCT ......................................121
      4.4. Packet Loss Concealment (PLC) ............................122
           4.4.1. Clock Drift Compensation ..........................122
      4.5. Configuration Switching ..................................123
           4.5.1. Transition Side Information (Redundancy) ..........124
           4.5.2. State Reset .......................................127
           4.5.3. Summary of Transitions ............................128
   5. Opus Encoder ..................................................131
      5.1. Range Encoder ............................................132
        
           5.1.1. Encoding Symbols ..................................133
           5.1.2. Alternate Encoding Methods ........................134
           5.1.3. Encoding Raw Bits .................................135
           5.1.4. Encoding Uniformly Distributed Integers ...........135
           5.1.5. Finalizing the Stream .............................135
           5.1.6. Current Bit Usage .................................136
      5.2. SILK Encoder .............................................136
           5.2.1. Sample Rate Conversion ............................137
           5.2.2. Stereo Mixing .....................................137
           5.2.3. SILK Core Encoder .................................138
      5.3. CELT Encoder .............................................150
           5.3.1. Pitch Pre-filter ..................................150
           5.3.2. Bands and Normalization ...........................151
           5.3.3. Energy Envelope Quantization ......................151
           5.3.4. Bit Allocation ....................................151
           5.3.5. Stereo Decisions ..................................152
           5.3.6. Time-Frequency Decision ...........................153
           5.3.7. Spreading Values Decision .........................153
           5.3.8. Spherical Vector Quantization .....................154
   6. Conformance ...................................................155
      6.1. Testing ..................................................155
      6.2. Opus Custom ..............................................156
   7. Security Considerations .......................................157
   8. Acknowledgements ..............................................158
   9. References ....................................................159
      9.1. Normative References .....................................159
      9.2. Informative References ...................................159
   Appendix A. Reference Implementation .............................163
      A.1. Extracting the Source ....................................164
      A.2. Up-to-Date Implementation ................................164
      A.3. Base64-Encoded Source Code ...............................164
      A.4. Test Vectors .............................................321
   Appendix B. Self-Delimiting Framing ..............................321
        
           5.1.1. Encoding Symbols ..................................133
           5.1.2. Alternate Encoding Methods ........................134
           5.1.3. Encoding Raw Bits .................................135
           5.1.4. Encoding Uniformly Distributed Integers ...........135
           5.1.5. Finalizing the Stream .............................135
           5.1.6. Current Bit Usage .................................136
      5.2. SILK Encoder .............................................136
           5.2.1. Sample Rate Conversion ............................137
           5.2.2. Stereo Mixing .....................................137
           5.2.3. SILK Core Encoder .................................138
      5.3. CELT Encoder .............................................150
           5.3.1. Pitch Pre-filter ..................................150
           5.3.2. Bands and Normalization ...........................151
           5.3.3. Energy Envelope Quantization ......................151
           5.3.4. Bit Allocation ....................................151
           5.3.5. Stereo Decisions ..................................152
           5.3.6. Time-Frequency Decision ...........................153
           5.3.7. Spreading Values Decision .........................153
           5.3.8. Spherical Vector Quantization .....................154
   6. Conformance ...................................................155
      6.1. Testing ..................................................155
      6.2. Opus Custom ..............................................156
   7. Security Considerations .......................................157
   8. Acknowledgements ..............................................158
   9. References ....................................................159
      9.1. Normative References .....................................159
      9.2. Informative References ...................................159
   Appendix A. Reference Implementation .............................163
      A.1. Extracting the Source ....................................164
      A.2. Up-to-Date Implementation ................................164
      A.3. Base64-Encoded Source Code ...............................164
      A.4. Test Vectors .............................................321
   Appendix B. Self-Delimiting Framing ..............................321
        
1. Introduction
1. 介绍

The Opus codec is a real-time interactive audio codec designed to meet the requirements described in [REQUIREMENTS]. It is composed of a layer based on Linear Prediction (LP) [LPC] and a layer based on the Modified Discrete Cosine Transform (MDCT) [MDCT]. The main idea behind using two layers is as follows: in speech, linear prediction techniques (such as Code-Excited Linear Prediction, or CELP) code low frequencies more efficiently than transform (e.g., MDCT) domain techniques, while the situation is reversed for music and higher speech frequencies. Thus, a codec with both layers available can operate over a wider range than either one alone and can achieve better quality by combining them than by using either one individually.

Opus编解码器是一种实时交互式音频编解码器,旨在满足[要求]中所述的要求。它由一个基于线性预测(LP)[LPC]的层和一个基于改进的离散余弦变换(MDCT)[MDCT]的层组成。使用两层的主要思想如下:在语音中,线性预测技术(如码激励线性预测,或CELP)比变换(如MDCT)域技术更有效地编码低频,而音乐和更高的语音频率则相反。因此,具有两个可用层的编解码器可以在比单独使用其中一个更宽的范围内运行,并且通过组合它们可以实现比单独使用其中一个更好的质量。

The primary normative part of this specification is provided by the source code in Appendix A. Only the decoder portion of this software is normative, though a significant amount of code is shared by both the encoder and decoder. Section 6 provides a decoder conformance test. The decoder contains a great deal of integer and fixed-point arithmetic that needs to be performed exactly, including all rounding considerations, so any useful specification requires domain-specific symbolic language to adequately define these operations. Additionally, any conflict between the symbolic representation and the included reference implementation must be resolved. For the practical reasons of compatibility and testability, it would be advantageous to give the reference implementation priority in any disagreement. The C language is also one of the most widely understood, human-readable symbolic representations for machine behavior. For these reasons, this RFC uses the reference implementation as the sole symbolic representation of the codec.

本规范的主要规范性部分由附录A中的源代码提供。尽管编码器和解码器共享大量代码,但本软件的解码器部分是规范性的。第6节提供了解码器一致性测试。解码器包含大量需要精确执行的整数和定点算法,包括所有舍入考虑,因此任何有用的规范都需要特定于域的符号语言来充分定义这些操作。此外,必须解决符号表示和包含的引用实现之间的任何冲突。出于兼容性和可测试性的实际原因,在任何不一致的情况下,给予参考实现优先权都是有利的。C语言也是最广泛理解的、人类可读的机器行为符号表示之一。由于这些原因,此RFC使用参考实现作为编解码器的唯一符号表示。

While the symbolic representation is unambiguous and complete, it is not always the easiest way to understand the codec's operation. For this reason, this document also describes significant parts of the codec in prose and takes the opportunity to explain the rationale behind many of the more surprising elements of the design. These descriptions are intended to be accurate and informative, but the limitations of common English sometimes result in ambiguity, so it is expected that the reader will always read them alongside the symbolic representation. Numerous references to the implementation are provided for this purpose. The descriptions sometimes differ from the reference in ordering or through mathematical simplification wherever such deviation makes an explanation easier to understand. For example, the right shift and left shift operations in the reference implementation are often described using division and

虽然符号表示是明确和完整的,但它并不总是理解编解码器操作的最简单方法。因此,本文档还以散文的形式描述了编解码器的重要部分,并借此机会解释了设计中许多更令人惊讶的元素背后的基本原理。这些描述旨在准确且信息丰富,但普通英语的局限性有时会导致歧义,因此预计读者将始终在阅读符号表示的同时阅读这些描述。为此目的,提供了大量实施参考。这些描述有时在顺序上或通过数学简化与参考不同,因为这种偏差使得解释更容易理解。例如,参考实现中的右移和左移操作通常使用除法和除法来描述

multiplication in the text. In general, the text is focused on the "what" and "why" while the symbolic representation most clearly provides the "how".

文本中的乘法。一般来说,文本集中在“什么”和“为什么”上,而符号表示最清楚地提供了“如何”。

1.1. Notation and Conventions
1.1. 符号和约定

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].

本文件中的关键词“必须”、“不得”、“要求”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照RFC 2119[RFC2119]中所述进行解释。

Various operations in the codec require bit-exact fixed-point behavior, even when writing a floating point implementation. The notation "Q<n>", where n is an integer, denotes the number of binary digits to the right of the decimal point in a fixed-point number. For example, a signed Q14 value in a 16-bit word can represent values from -2.0 to 1.99993896484375, inclusive. This notation is for informational purposes only. Arithmetic, when described, always operates on the underlying integer. For example, the text will explicitly indicate any shifts required after a multiplication.

编解码器中的各种操作需要位精确的定点行为,即使在编写浮点实现时也是如此。符号“Q<n>”,其中n是整数,表示定点数字中小数点右侧的二进制位数。例如,16位字中的有符号Q14值可以表示从-2.0到1.999938964875(包括-2.0)的值。此符号仅供参考。当描述算术时,总是对基础整数进行运算。例如,文本将明确指示乘法后所需的任何移位。

Expressions, where included in the text, follow C operator rules and precedence, with the exception that the syntax "x**y" indicates x raised to the power y. The text also makes use of the following functions.

文本中包含的表达式遵循C运算符规则和优先级,但语法“x**y”表示x升为y的幂。本文还使用了以下功能。

1.1.1. min(x,y)
1.1.1. 最小(x,y)

The smallest of two values x and y.

两个值x和y中最小的一个。

1.1.2. max(x,y)
1.1.2. 最大值(x,y)

The largest of two values x and y.

两个值x和y中的最大值。

1.1.3. clamp(lo,x,hi)
1.1.3. 夹钳(低、x、高)
                     clamp(lo,x,hi) = max(lo,min(x,hi))
        
                     clamp(lo,x,hi) = max(lo,min(x,hi))
        

With this definition, if lo > hi, then lo is returned.

根据此定义,如果lo>hi,则返回lo。

1.1.4. sign(x)
1.1.4. 符号(x)

The sign of x, i.e.,

x的符号,即。,

                                    ( -1,  x < 0
                          sign(x) = <  0,  x == 0
                                    (  1,  x > 0
        
                                    ( -1,  x < 0
                          sign(x) = <  0,  x == 0
                                    (  1,  x > 0
        
1.1.5. abs(x)
1.1.5. abs(x)

The absolute value of x, i.e.,

x的绝对值,即:。,

                             abs(x) = sign(x)*x
        
                             abs(x) = sign(x)*x
        
1.1.6. floor(f)
1.1.6. 楼层(f)

The largest integer z such that z <= f.

最大整数z,使得z<=f。

1.1.7. ceil(f)
1.1.7. ceil(f)

The smallest integer z such that z >= f.

最小的整数z,使得z>=f。

1.1.8. round(f)
1.1.8. 第四轮(f)

The integer z nearest to f, with ties rounded towards negative infinity, i.e.,

最接近f的整数z,其结向负无穷大舍入,即。,

                           round(f) = ceil(f - 0.5)
        
                           round(f) = ceil(f - 0.5)
        
1.1.9. log2(f)
1.1.9. 日志2(f)

The base-two logarithm of f.

f的底对数。

1.1.10. ilog(n)
1.1.10. 伊洛格(北)

The minimum number of bits required to store a positive integer n in binary, or 0 for a non-positive integer n.

二进制存储正整数n所需的最小位数,非正整数n为0。

                              ( 0,                 n <= 0
                    ilog(n) = <
                              ( floor(log2(n))+1,  n > 0
        
                              ( 0,                 n <= 0
                    ilog(n) = <
                              ( floor(log2(n))+1,  n > 0
        

Examples:

示例:

o ilog(-1) = 0

o ilog(-1)=0

o ilog(0) = 0

o ilog(0)=0

o ilog(1) = 1

o ilog(1)=1

o ilog(2) = 2

o ilog(2)=2

o ilog(3) = 2

o ilog(3)=2

o ilog(4) = 3

o ilog(4)=3

o ilog(7) = 3

o ilog(7)=3

2. Opus Codec Overview
2. Opus编解码器概述

The Opus codec scales from 6 kbit/s narrowband mono speech to 510 kbit/s fullband stereo music, with algorithmic delays ranging from 5 ms to 65.2 ms. At any given time, either the LP layer, the MDCT layer, or both, may be active. It can seamlessly switch between all of its various operating modes, giving it a great deal of flexibility to adapt to varying content and network conditions without renegotiating the current session. The codec allows input and output of various audio bandwidths, defined as follows:

Opus编解码器从6 kbit/s窄带单声道语音扩展到510 kbit/s全波段立体声音乐,算法延迟从5 ms到65.2 ms。在任何给定时间,LP层、MDCT层或两者都可能处于活动状态。它可以在所有不同的操作模式之间无缝切换,使其具有很大的灵活性以适应不同的内容和网络条件,而无需重新协商当前会话。编解码器允许输入和输出各种音频带宽,定义如下:

   +----------------------+-----------------+-------------------------+
   | Abbreviation         | Audio Bandwidth | Sample Rate (Effective) |
   +----------------------+-----------------+-------------------------+
   | NB (narrowband)      |           4 kHz |                   8 kHz |
   |                      |                 |                         |
   | MB (medium-band)     |           6 kHz |                  12 kHz |
   |                      |                 |                         |
   | WB (wideband)        |           8 kHz |                  16 kHz |
   |                      |                 |                         |
   | SWB (super-wideband) |          12 kHz |                  24 kHz |
   |                      |                 |                         |
   | FB (fullband)        |      20 kHz (*) |                  48 kHz |
   +----------------------+-----------------+-------------------------+
        
   +----------------------+-----------------+-------------------------+
   | Abbreviation         | Audio Bandwidth | Sample Rate (Effective) |
   +----------------------+-----------------+-------------------------+
   | NB (narrowband)      |           4 kHz |                   8 kHz |
   |                      |                 |                         |
   | MB (medium-band)     |           6 kHz |                  12 kHz |
   |                      |                 |                         |
   | WB (wideband)        |           8 kHz |                  16 kHz |
   |                      |                 |                         |
   | SWB (super-wideband) |          12 kHz |                  24 kHz |
   |                      |                 |                         |
   | FB (fullband)        |      20 kHz (*) |                  48 kHz |
   +----------------------+-----------------+-------------------------+
        

Table 1

表1

(*) Although the sampling theorem allows a bandwidth as large as half the sampling rate, Opus never codes audio above 20 kHz, as that is the generally accepted upper limit of human hearing.

(*)尽管采样定理允许带宽高达采样率的一半,但Opus从未对20 kHz以上的音频进行编码,因为这是公认的人类听力上限。

Opus defines super-wideband (SWB) with an effective sample rate of 24 kHz, unlike some other audio coding standards that use 32 kHz. This was chosen for a number of reasons. The band layout in the MDCT layer naturally allows skipping coefficients for frequencies over 12 kHz, but does not allow cleanly dropping just those frequencies over 16 kHz. A sample rate of 24 kHz also makes resampling in the MDCT layer easier, as 24 evenly divides 48, and when 24 kHz is sufficient, it can save computation in other processing, such as Acoustic Echo Cancellation (AEC). Experimental changes to the band layout to allow a 16 kHz cutoff (32 kHz effective sample rate) showed potential quality degradations at other sample rates, and, at typical bitrates, the number of bits saved by using such a cutoff instead of coding in fullband (FB) mode is very small. Therefore, if an application wishes to process a signal sampled at 32 kHz, it should just use FB.

Opus定义了有效采样率为24 kHz的超宽带(SWB),与其他一些使用32 kHz的音频编码标准不同。选择这一点有很多原因。MDCT层中的频带布局自然允许跳过12 kHz以上频率的系数,但不允许仅将那些超过16 kHz的频率完全丢弃。24 kHz的采样率也使得MDCT层中的重采样更容易,因为24均匀地除以48,并且当24 kHz足够时,它可以节省其他处理中的计算,例如声学回波消除(AEC)。对频带布局进行实验性更改,以允许16 kHz截止(32 kHz有效采样率)显示在其他采样率下存在潜在的质量下降,并且在典型比特率下,使用这种截止而不是在全频带(FB)模式下编码所节省的比特数非常少。因此,如果应用程序希望处理以32 kHz采样的信号,则应仅使用FB。

The LP layer is based on the SILK codec [SILK]. It supports NB, MB, or WB audio and frame sizes from 10 ms to 60 ms, and requires an additional 5 ms look-ahead for noise shaping estimation. A small additional delay (up to 1.5 ms) may be required for sampling rate conversion. Like Vorbis [VORBIS-WEBSITE] and many other modern codecs, SILK is inherently designed for variable bitrate (VBR) coding, though the encoder can also produce constant bitrate (CBR) streams. The version of SILK used in Opus is substantially modified from, and not compatible with, the stand-alone SILK codec previously deployed by Skype. This document does not serve to define that format, but those interested in the original SILK codec should see [SILK] instead.

LP层基于丝绸编解码器[SILK]。它支持10毫秒到60毫秒的NB、MB或WB音频和帧大小,并且需要额外的5毫秒前瞻以进行噪声整形估计。采样率转换可能需要额外的小延迟(高达1.5 ms)。与Vorbis[Vorbis-WEBSITE]和许多其他现代编解码器一样,SILK天生就是为可变比特率(VBR)编码而设计的,尽管编码器也可以产生恒定比特率(CBR)流。Opus中使用的SILK版本实质上是从Skype先前部署的独立SILK编解码器修改而来的,与之不兼容。本文档不用于定义该格式,但对原始SILK编解码器感兴趣的人应该查看[SILK]。

The MDCT layer is based on the Constrained-Energy Lapped Transform (CELT) codec [CELT]. It supports NB, WB, SWB, or FB audio and frame sizes from 2.5 ms to 20 ms, and requires an additional 2.5 ms look-ahead due to the overlapping MDCT windows. The CELT codec is inherently designed for CBR coding, but unlike many CBR codecs, it is not limited to a set of predetermined rates. It internally allocates bits to exactly fill any given target budget, and an encoder can produce a VBR stream by varying the target on a per-frame basis. The MDCT layer is not used for speech when the audio bandwidth is WB or less, as it is not useful there. On the other hand, non-speech signals are not always adequately coded using linear prediction. Therefore, the MDCT layer should be used for music signals.

MDCT层基于受限能量重叠变换(CELT)编解码器[CELT]。它支持NB、WB、SWB或FB音频和帧大小从2.5 ms到20 ms,并且由于MDCT窗口重叠,需要额外的2.5 ms前瞻。CELT编解码器本质上是为CBR编码而设计的,但与许多CBR编解码器不同,它不限于一组预定速率。它在内部分配位来精确地填充任何给定的目标预算,编码器可以通过每帧改变目标来生成VBR流。当音频带宽为WB或更低时,MDCT层不用于语音,因为它在那里没有用处。另一方面,非语音信号并不总是使用线性预测进行充分编码。因此,MDCT层应用于音乐信号。

A "Hybrid" mode allows the use of both layers simultaneously with a frame size of 10 or 20 ms and an SWB or FB audio bandwidth. The LP layer codes the low frequencies by resampling the signal down to WB. The MDCT layer follows, coding the high frequency portion of the signal. The cutoff between the two lies at 8 kHz, the maximum WB audio bandwidth. In the MDCT layer, all bands below 8 kHz are discarded, so there is no coding redundancy between the two layers.

“混合”模式允许以10或20 ms的帧大小和SWB或FB音频带宽同时使用两层。LP层通过将信号重采样到WB来对低频进行编码。随后是MDCT层,对信号的高频部分进行编码。两者之间的截止频率为8 kHz,即最大WB音频带宽。在MDCT层中,所有低于8 kHz的频带都被丢弃,因此两层之间没有编码冗余。

The sample rate (in contrast to the actual audio bandwidth) can be chosen independently on the encoder and decoder side, e.g., a fullband signal can be decoded as wideband, or vice versa. This approach ensures a sender and receiver can always interoperate, regardless of the capabilities of their actual audio hardware. Internally, the LP layer always operates at a sample rate of twice the audio bandwidth, up to a maximum of 16 kHz, which it continues to use for SWB and FB. The decoder simply resamples its output to support different sample rates. The MDCT layer always operates internally at a sample rate of 48 kHz. Since all the supported sample rates evenly divide this rate, and since the decoder may easily zero out the high frequency portion of the spectrum in the frequency domain, it can simply decimate the MDCT layer output to achieve the other supported sample rates very cheaply.

采样率(与实际音频带宽相反)可在编码器和解码器侧独立选择,例如,全频带信号可解码为宽带,反之亦然。这种方法确保发送方和接收方始终可以互操作,而不管其实际音频硬件的功能如何。在内部,LP层始终以音频带宽两倍的采样率运行,最高可达16 kHz,它将继续用于SWB和FB。解码器只需重新采样其输出,以支持不同的采样率。MDCT层始终以48 kHz的采样率在内部运行。由于所有支持的采样率均匀地划分该速率,并且由于解码器可以容易地将频域中频谱的高频部分归零,因此它可以简单地抽取MDCT层输出,以非常便宜地实现其他支持的采样率。

After conversion to the common, desired output sample rate, the decoder simply adds the output from the two layers together. To compensate for the different look-ahead required by each layer, the CELT encoder input is delayed by an additional 2.7 ms. This ensures that low frequencies and high frequencies arrive at the same time. This extra delay may be reduced by an encoder by using less look-ahead for noise shaping or using a simpler resampler in the LP layer, but this will reduce quality. However, the base 2.5 ms look-ahead in the CELT layer cannot be reduced in the encoder because it is needed for the MDCT overlap, whose size is fixed by the decoder.

在转换到公共的、期望的输出采样率之后,解码器将两层的输出简单地相加。为了补偿各层所需的不同前瞻性,CELT编码器输入额外延迟2.7毫秒。这确保低频和高频同时到达。编码器可以通过使用较少的噪声整形前瞻或在LP层中使用更简单的重采样器来减少额外延迟,但这会降低质量。然而,在编码器中不能减少CELT层中的基本2.5 ms前瞻,因为MDCT重叠需要它,其大小由解码器固定。

Both layers use the same entropy coder, avoiding any waste from "padding bits" between them. The hybrid approach makes it easy to support both CBR and VBR coding. Although the LP layer is VBR, the bit allocation of the MDCT layer can produce a final stream that is CBR by using all the bits left unused by the LP layer.

这两层都使用相同的熵编码器,避免了它们之间“填充位”的浪费。这种混合方法使得CBR和VBR编码都可以很容易地支持。尽管LP层是VBR,但MDCT层的位分配可以通过使用LP层未使用的所有位来生成最终的CBR流。

2.1. Control Parameters
2.1. 控制参数

The Opus codec includes a number of control parameters that can be changed dynamically during regular operation of the codec, without interrupting the audio stream from the encoder to the decoder. These parameters only affect the encoder since any impact they have on the bitstream is signaled in-band such that a decoder can decode any Opus stream without any out-of-band signaling. Any Opus implementation can add or modify these control parameters without affecting interoperability. The most important encoder control parameters in the reference encoder are listed below.

Opus编解码器包括许多控制参数,这些参数可以在编解码器的常规操作期间动态更改,而不会中断从编码器到解码器的音频流。这些参数仅影响编码器,因为它们对比特流的任何影响都在带内发出信号,使得解码器可以在没有带外信号的情况下解码任何Opus流。任何Opus实现都可以添加或修改这些控制参数,而不会影响互操作性。参考编码器中最重要的编码器控制参数如下所示。

2.1.1. Bitrate
2.1.1. 比特率

Opus supports all bitrates from 6 kbit/s to 510 kbit/s. All other parameters being equal, higher bitrate results in higher quality. For a frame size of 20 ms, these are the bitrate "sweet spots" for Opus in various configurations:

Opus支持从6 kbit/s到510 kbit/s的所有比特率。所有其他参数相等时,比特率越高,质量越高。对于20 ms的帧大小,以下是各种配置中OPU的比特率“最佳点”:

o 8-12 kbit/s for NB speech,

o NB语音的8-12 kbit/s,

o 16-20 kbit/s for WB speech,

o 用于WB语音的16-20 kbit/s,

o 28-40 kbit/s for FB speech,

o 用于FB语音的28-40 kbit/s,

o 48-64 kbit/s for FB mono music, and

o 用于FB单声道音乐的48-64 kbit/s,以及

o 64-128 kbit/s for FB stereo music.

o 用于FB立体声音乐的64-128 kbit/s。

2.1.2. Number of Channels (Mono/Stereo)
2.1.2. 通道数(单声道/立体声)

Opus can transmit either mono or stereo frames within a single stream. When decoding a mono frame in a stereo decoder, the left and right channels are identical, and when decoding a stereo frame in a mono decoder, the mono output is the average of the left and right channels. In some cases, it is desirable to encode a stereo input stream in mono (e.g., because the bitrate is too low to encode stereo with sufficient quality). The number of channels encoded can be selected in real-time, but by default the reference encoder attempts to make the best decision possible given the current bitrate.

Opus可以在单个流中传输单声道或立体声帧。在立体声解码器中解码单声道帧时,左声道和右声道是相同的,在单声道解码器中解码立体声帧时,单声道输出是左声道和右声道的平均值。在某些情况下,希望以单声道编码立体声输入流(例如,因为比特率太低,无法以足够的质量编码立体声)。编码的通道数可以实时选择,但默认情况下,参考编码器会尝试在给定当前比特率的情况下做出最佳决策。

2.1.3. Audio Bandwidth
2.1.3. 音频带宽

The audio bandwidths supported by Opus are listed in Table 1. Just like for the number of channels, any decoder can decode audio that is encoded at any bandwidth. For example, any Opus decoder operating at 8 kHz can decode an FB Opus frame, and any Opus decoder operating at 48 kHz can decode an NB frame. Similarly, the reference encoder can take a 48 kHz input signal and encode it as NB. The higher the audio bandwidth, the higher the required bitrate to achieve acceptable quality. The audio bandwidth can be explicitly specified in real-time, but, by default, the reference encoder attempts to make the best bandwidth decision possible given the current bitrate.

Opus支持的音频带宽如表1所示。就像信道数量一样,任何解码器都可以对在任何带宽上编码的音频进行解码。例如,以8khz工作的任何Opus解码器可以解码FB Opus帧,并且以48khz工作的任何Opus解码器可以解码NB帧。类似地,参考编码器可以获取48 kHz输入信号并将其编码为NB。音频带宽越高,达到可接受质量所需的比特率越高。音频带宽可以实时明确指定,但默认情况下,参考编码器会尝试在给定当前比特率的情况下做出最佳带宽决策。

2.1.4. Frame Duration
2.1.4. 帧持续时间

Opus can encode frames of 2.5, 5, 10, 20, 40, or 60 ms. It can also combine multiple frames into packets of up to 120 ms. For real-time applications, sending fewer packets per second reduces the bitrate, since it reduces the overhead from IP, UDP, and RTP headers. However, it increases latency and sensitivity to packet losses, as losing one packet constitutes a loss of a bigger chunk of audio. Increasing the frame duration also slightly improves coding efficiency, but the gain becomes small for frame sizes above 20 ms. For this reason, 20 ms frames are a good choice for most applications.

Opus可以对2.5、5、10、20、40或60毫秒的帧进行编码。它还可以将多个帧组合成高达120毫秒的数据包。对于实时应用程序,每秒发送更少的数据包可以降低比特率,因为它减少了IP、UDP和RTP报头的开销。然而,它增加了延迟和对数据包丢失的敏感性,因为丢失一个数据包就意味着丢失更大的音频块。增加帧持续时间也会略微提高编码效率,但对于大于20 ms的帧大小,增益会变小。因此,对于大多数应用,20 ms帧是一个不错的选择。

2.1.5. Complexity
2.1.5. 复杂性

There are various aspects of the Opus encoding process where trade-offs can be made between CPU complexity and quality/bitrate. In the reference encoder, the complexity is selected using an integer from 0 to 10, where 0 is the lowest complexity and 10 is the highest. Examples of computations for which such trade-offs may occur are:

Opus编码过程的各个方面都可以在CPU复杂性和质量/比特率之间进行权衡。在参考编码器中,使用0到10之间的整数选择复杂度,其中0是最低复杂度,10是最高复杂度。可能出现此类权衡的计算示例如下:

o The order of the pitch analysis whitening filter [WHITENING],

o 基音分析白化滤波器的阶数[白化],

o The order of the short-term noise shaping filter,

o 短期噪声整形滤波器的阶数,

o The number of states in delayed decision quantization of the residual signal, and

o 剩余信号的延迟判决量化中的状态数,以及

o The use of certain bitstream features such as variable time-frequency resolution and the pitch post-filter.

o 某些比特流特性的使用,如可变时频分辨率和基音后置滤波器。

2.1.6. Packet Loss Resilience
2.1.6. 丢包恢复能力

Audio codecs often exploit inter-frame correlations to reduce the bitrate at a cost in error propagation: after losing one packet, several packets need to be received before the decoder is able to accurately reconstruct the speech signal. The extent to which Opus exploits inter-frame dependencies can be adjusted on the fly to choose a trade-off between bitrate and amount of error propagation.

音频编解码器通常利用帧间相关性来降低比特率,但要以错误传播为代价:丢失一个数据包后,需要接收多个数据包,解码器才能准确地重建语音信号。Opus利用帧间相关性的程度可以动态调整,以在比特率和错误传播量之间进行权衡。

2.1.7. Forward Error Correction (FEC)
2.1.7. 前向纠错(FEC)

Another mechanism providing robustness against packet loss is the in-band Forward Error Correction (FEC). Packets that are determined to contain perceptually important speech information, such as onsets or transients, are encoded again at a lower bitrate and this re-encoded information is added to a subsequent packet.

提供抗分组丢失鲁棒性的另一种机制是带内前向纠错(FEC)。被确定为包含感知上重要的语音信息(例如启动或瞬态)的分组以较低的比特率再次编码,并且该重新编码的信息被添加到后续分组中。

2.1.8. Constant/Variable Bitrate
2.1.8. 恒定/可变比特率

Opus is more efficient when operating with variable bitrate (VBR), which is the default. When low-latency transmission is required over a relatively slow connection, then constrained VBR can also be used. This uses VBR in a way that simulates a "bit reservoir" and is equivalent to what MP3 (MPEG 1, Layer 3) and AAC (Advanced Audio Coding) call CBR (i.e., not true CBR due to the bit reservoir). In some (rare) applications, constant bitrate (CBR) is required. There are two main reasons to operate in CBR mode:

Opus在使用默认的可变比特率(VBR)操作时效率更高。当需要通过相对较慢的连接进行低延迟传输时,也可以使用受限VBR。这以模拟“比特库”的方式使用VBR,相当于MP3(MPEG 1,第3层)和AAC(高级音频编码)所称的CBR(即,由于比特库而不是真正的CBR)。在某些(罕见)应用中,需要恒定比特率(CBR)。在CBR模式下运行有两个主要原因:

o When the transport only supports a fixed size for each compressed frame, or

o 当传输仅支持每个压缩帧的固定大小时,或

o When encryption is used for an audio stream that is either highly constrained (e.g., yes/no, recorded prompts) or highly sensitive [SRTP-VBR].

o 当加密用于高度受限(例如,是/否,录制的提示)或高度敏感[SRTP-VBR]的音频流时。

Bitrate may still be allowed to vary, even with sensitive data, as long as the variation is not driven by the input signal (for example, to match changing network conditions). To achieve this, an application should still run Opus in CBR mode, but change the target rate before each packet.

即使使用敏感数据,只要变化不是由输入信号驱动的(例如,为了匹配不断变化的网络条件),比特率仍然可以变化。要实现这一点,应用程序仍应在CBR模式下运行Opus,但在每个数据包之前更改目标速率。

2.1.9. Discontinuous Transmission (DTX)
2.1.9. 不连续传输(DTX)

Discontinuous Transmission (DTX) reduces the bitrate during silence or background noise. When DTX is enabled, only one frame is encoded every 400 milliseconds.

不连续传输(DTX)在静音或背景噪声期间降低比特率。启用DTX时,每400毫秒仅对一帧进行编码。

3. Internal Framing
3. 内部框架

The Opus encoder produces "packets", which are each a contiguous set of bytes meant to be transmitted as a single unit. The packets described here do not include such things as IP, UDP, or RTP headers, which are normally found in a transport-layer packet. A single packet may contain multiple audio frames, so long as they share a common set of parameters, including the operating mode, audio bandwidth, frame size, and channel count (mono vs. stereo). This section describes the possible combinations of these parameters and the internal framing used to pack multiple frames into a single packet. This framing is not self-delimiting. Instead, it assumes that a lower layer (such as UDP or RTP [RFC3550] or Ogg [RFC3533] or Matroska [MATROSKA-WEBSITE]) will communicate the length, in bytes, of the packet, and it uses this information to reduce the framing overhead in the packet itself. A decoder implementation MUST support the framing described in this section. An alternative, self-delimiting variant of the framing is described in Appendix B. Support for that variant is OPTIONAL.

Opus编码器产生“数据包”,每个数据包都是一组连续的字节,将作为单个单元传输。这里描述的数据包不包括诸如IP、UDP或RTP头之类的东西,它们通常在传输层数据包中找到。一个数据包可以包含多个音频帧,只要它们共享一组公共参数,包括操作模式、音频带宽、帧大小和通道计数(单声道与立体声)。本节描述了这些参数和用于将多个帧打包到单个数据包中的内部帧的可能组合。这种框架不是自我界定的。相反,它假设较低的层(例如UDP或RTP[RFC3550]或Ogg[RFC3533]或Matroska[Matroska-WEBSITE])将传输数据包的长度(以字节为单位),并使用此信息来减少数据包本身的帧开销。解码器实现必须支持本节中描述的帧。附录B中描述了框架的另一种自定界变体。该变体的支持是可选的。

All bit diagrams in this document number the bits so that bit 0 is the most significant bit of the first byte, and bit 7 is the least significant. Bit 8 is thus the most significant bit of the second byte, etc. Well-formed Opus packets obey certain requirements, marked [R1] through [R7] below. These are summarized in Section 3.4 along with appropriate means of handling malformed packets.

本文档中的所有位图都对位进行了编号,因此位0是第一个字节的最高有效位,位7是最低有效位。因此,第8位是第二字节的最高有效位,等等。格式良好的Opus数据包遵守某些要求,标记为下面的[R1]到[R7]。第3.4节总结了这些问题以及处理格式错误数据包的适当方法。

3.1. The TOC Byte
3.1. TOC字节

A well-formed Opus packet MUST contain at least one byte [R1]. This byte forms a table-of-contents (TOC) header that signals which of the various modes and configurations a given packet uses. It is composed of a configuration number, "config", a stereo flag, "s", and a frame count code, "c", arranged as illustrated in Figure 1. A description of each of these fields follows.

格式良好的Opus数据包必须至少包含一个字节[R1]。该字节形成一个目录(TOC)头,该头表示给定数据包使用的各种模式和配置中的哪一种。它由配置号“config”、立体声标志“s”和帧计数代码“c”组成,如图1所示。下面是对这些字段的描述。

                              0
                              0 1 2 3 4 5 6 7
                             +-+-+-+-+-+-+-+-+
                             | config  |s| c |
                             +-+-+-+-+-+-+-+-+
        
                              0
                              0 1 2 3 4 5 6 7
                             +-+-+-+-+-+-+-+-+
                             | config  |s| c |
                             +-+-+-+-+-+-+-+-+
        

Figure 1: The TOC Byte

图1:TOC字节

The top five bits of the TOC byte, labeled "config", encode one of 32 possible configurations of operating mode, audio bandwidth, and frame size. As described, the LP (SILK) layer and MDCT (CELT) layer can be combined in three possible operating modes:

TOC字节的前五位标记为“config”,对32种可能的操作模式、音频带宽和帧大小配置之一进行编码。如上所述,LP(丝)层和MDCT(CELT)层可在三种可能的操作模式下组合:

1. A SILK-only mode for use in low bitrate connections with an audio bandwidth of WB or less,

1. 用于音频带宽小于等于WB的低比特率连接中的纯丝绸模式,

2. A Hybrid (SILK+CELT) mode for SWB or FB speech at medium bitrates, and

2. 用于中等比特率的SWB或FB语音的混合(丝绸+凯尔特)模式,以及

3. A CELT-only mode for very low delay speech transmission as well as music transmission (NB to FB).

3. 仅用于极低延迟语音传输和音乐传输(NB至FB)的CELT模式。

The 32 possible configurations each identify which one of these operating modes the packet uses, as well as the audio bandwidth and the frame size. Table 2 lists the parameters for each configuration.

32种可能的配置分别标识数据包使用哪种操作模式,以及音频带宽和帧大小。表2列出了每个配置的参数。

   +-----------------------+-----------+-----------+-------------------+
   | Configuration         | Mode      | Bandwidth | Frame Sizes       |
   | Number(s)             |           |           |                   |
   +-----------------------+-----------+-----------+-------------------+
   | 0...3                 | SILK-only | NB        | 10, 20, 40, 60 ms |
   |                       |           |           |                   |
   | 4...7                 | SILK-only | MB        | 10, 20, 40, 60 ms |
   |                       |           |           |                   |
   | 8...11                | SILK-only | WB        | 10, 20, 40, 60 ms |
   |                       |           |           |                   |
   | 12...13               | Hybrid    | SWB       | 10, 20 ms         |
   |                       |           |           |                   |
   | 14...15               | Hybrid    | FB        | 10, 20 ms         |
   |                       |           |           |                   |
   | 16...19               | CELT-only | NB        | 2.5, 5, 10, 20 ms |
   |                       |           |           |                   |
   | 20...23               | CELT-only | WB        | 2.5, 5, 10, 20 ms |
   |                       |           |           |                   |
   | 24...27               | CELT-only | SWB       | 2.5, 5, 10, 20 ms |
   |                       |           |           |                   |
   | 28...31               | CELT-only | FB        | 2.5, 5, 10, 20 ms |
   +-----------------------+-----------+-----------+-------------------+
        
   +-----------------------+-----------+-----------+-------------------+
   | Configuration         | Mode      | Bandwidth | Frame Sizes       |
   | Number(s)             |           |           |                   |
   +-----------------------+-----------+-----------+-------------------+
   | 0...3                 | SILK-only | NB        | 10, 20, 40, 60 ms |
   |                       |           |           |                   |
   | 4...7                 | SILK-only | MB        | 10, 20, 40, 60 ms |
   |                       |           |           |                   |
   | 8...11                | SILK-only | WB        | 10, 20, 40, 60 ms |
   |                       |           |           |                   |
   | 12...13               | Hybrid    | SWB       | 10, 20 ms         |
   |                       |           |           |                   |
   | 14...15               | Hybrid    | FB        | 10, 20 ms         |
   |                       |           |           |                   |
   | 16...19               | CELT-only | NB        | 2.5, 5, 10, 20 ms |
   |                       |           |           |                   |
   | 20...23               | CELT-only | WB        | 2.5, 5, 10, 20 ms |
   |                       |           |           |                   |
   | 24...27               | CELT-only | SWB       | 2.5, 5, 10, 20 ms |
   |                       |           |           |                   |
   | 28...31               | CELT-only | FB        | 2.5, 5, 10, 20 ms |
   +-----------------------+-----------+-----------+-------------------+
        

Table 2: TOC Byte Configuration Parameters

表2:TOC字节配置参数

The configuration numbers in each range (e.g., 0...3 for NB SILK-only) correspond to the various choices of frame size, in the same order. For example, configuration 0 has a 10 ms frame size and configuration 3 has a 60 ms frame size.

每个范围内的配置编号(例如,仅NB丝绸的配置编号为0…3)以相同的顺序对应不同的框架尺寸选择。例如,配置0的帧大小为10毫秒,配置3的帧大小为60毫秒。

One additional bit, labeled "s", signals mono vs. stereo, with 0 indicating mono and 1 indicating stereo.

一个附加位标记为“s”,表示单声道与立体声,0表示单声道,1表示立体声。

The remaining two bits of the TOC byte, labeled "c", code the number of frames per packet (codes 0 to 3) as follows:

TOC字节的剩余两位标记为“c”,对每个数据包的帧数(代码0到3)进行编码,如下所示:

o 0: 1 frame in the packet

o 数据包中的0:1帧

o 1: 2 frames in the packet, each with equal compressed size

o 数据包中的1:2帧,每个帧具有相同的压缩大小

o 2: 2 frames in the packet, with different compressed sizes

o 数据包中的2:2帧,具有不同的压缩大小

o 3: an arbitrary number of frames in the packet

o 3:数据包中任意数量的帧

This document refers to a packet as a code 0 packet, code 1 packet, etc., based on the value of "c".

本文件根据“c”值将数据包称为代码0数据包、代码1数据包等。

3.2. Frame Packing
3.2. 框架包装

This section describes how frames are packed according to each possible value of "c" in the TOC byte.

本节描述如何根据TOC字节中每个可能的“c”值打包帧。

3.2.1. Frame Length Coding
3.2.1. 帧长编码

When a packet contains multiple VBR frames (i.e., code 2 or 3), the compressed length of one or more of these frames is indicated with a one- or two-byte sequence, with the meaning of the first byte as follows:

当数据包包含多个VBR帧(即代码2或3)时,这些帧中的一个或多个的压缩长度用一个或两个字节序列表示,第一个字节的含义如下:

o 0: No frame (Discontinuous Transmission (DTX) or lost packet)

o 0:无帧(不连续传输(DTX)或丢失数据包)

o 1...251: Length of the frame in bytes

o 1…251:帧的长度(字节)

o 252...255: A second byte is needed. The total length is (second_byte*4)+first_byte

o 252…255:需要第二个字节。总长度为(第二个字节*4)+第一个字节

The special length 0 indicates that no frame is available, either because it was dropped during transmission by some intermediary or because the encoder chose not to transmit it. Any Opus frame in any mode MAY have a length of 0.

特殊长度0表示没有可用的帧,这可能是因为它在传输过程中被某个中介丢弃,也可能是因为编码器选择不传输它。任何模式下的任何Opus帧的长度都可以为0。

The maximum representable length is 255*4+255=1275 bytes. For 20 ms frames, this represents a bitrate of 510 kbit/s, which is approximately the highest useful rate for lossily compressed fullband stereo music. Beyond this point, lossless codecs are more appropriate. It is also roughly the maximum useful rate of the MDCT layer as, shortly thereafter, quality no longer improves with additional bits due to limitations on the codebook sizes.

最大可表示长度为255*4+255=1275字节。对于20 ms帧,这表示510 kbit/s的比特率,这大约是无损压缩全波段立体声音乐的最高有用速率。除此之外,无损编解码器更合适。它也大致是MDCT层的最大可用速率,因为此后不久,由于码本大小的限制,质量不再随附加比特而提高。

No length is transmitted for the last frame in a VBR packet, or for any of the frames in a CBR packet, as it can be inferred from the total size of the packet and the size of all other data in the packet. However, the length of any individual frame MUST NOT exceed 1275 bytes [R2] to allow for repacketization by gateways, conference bridges, or other software.

对于VBR数据包中的最后一帧或CBR数据包中的任何帧,不传输长度,因为可以从数据包的总大小和数据包中所有其他数据的大小推断长度。但是,任何单个帧的长度不得超过1275字节[R2],以允许通过网关、会议网桥或其他软件重新打包。

3.2.2. Code 0: One Frame in the Packet
3.2.2. 代码0:数据包中的一帧

For code 0 packets, the TOC byte is immediately followed by N-1 bytes of compressed data for a single frame (where N is the size of the packet), as illustrated in Figure 2.

对于代码0数据包,TOC字节后面紧跟着单个帧的N-1字节压缩数据(其中N是数据包的大小),如图2所示。

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|0|0|                                               |
     +-+-+-+-+-+-+-+-+                                               |
     |                    Compressed frame 1 (N-1 bytes)...          :
     :                                                               |
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|0|0|                                               |
     +-+-+-+-+-+-+-+-+                                               |
     |                    Compressed frame 1 (N-1 bytes)...          :
     :                                                               |
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 2: A Code 0 Packet

图2:代码0数据包

3.2.3. Code 1: Two Frames in the Packet, Each with Equal Compressed Size

3.2.3. 代码1:数据包中的两个帧,每个帧具有相同的压缩大小

For code 1 packets, the TOC byte is immediately followed by the (N-1)/2 bytes of compressed data for the first frame, followed by (N-1)/2 bytes of compressed data for the second frame, as illustrated in Figure 3. The number of payload bytes available for compressed data, N-1, MUST be even for all code 1 packets [R3].

对于代码1数据包,TOC字节后面紧跟第一帧的(N-1)/2字节压缩数据,然后紧跟第二帧的(N-1)/2字节压缩数据,如图3所示。对于所有代码1数据包,可用于压缩数据的有效负载字节数N-1必须为偶数[R3]。

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|0|1|                                               |
     +-+-+-+-+-+-+-+-+                                               :
     |             Compressed frame 1 ((N-1)/2 bytes)...             |
     :                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                               |                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               :
     |             Compressed frame 2 ((N-1)/2 bytes)...             |
     :                                               +-+-+-+-+-+-+-+-+
     |                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|0|1|                                               |
     +-+-+-+-+-+-+-+-+                                               :
     |             Compressed frame 1 ((N-1)/2 bytes)...             |
     :                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                               |                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               :
     |             Compressed frame 2 ((N-1)/2 bytes)...             |
     :                                               +-+-+-+-+-+-+-+-+
     |                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 3: A Code 1 Packet

图3:代码1数据包

3.2.4. Code 2: Two Frames in the Packet, with Different Compressed Sizes

3.2.4. 代码2:数据包中有两个帧,压缩大小不同

For code 2 packets, the TOC byte is followed by a one- or two-byte sequence indicating the length of the first frame (marked N1 in Figure 4), followed by N1 bytes of compressed data for the first frame. The remaining N-N1-2 or N-N1-3 bytes are the compressed data for the second frame. This is illustrated in Figure 4. A code 2 packet MUST contain enough bytes to represent a valid length. For example, a 1-byte code 2 packet is always invalid, and a 2-byte code 2 packet whose second byte is in the range 252...255 is also invalid.

对于代码2数据包,TOC字节后面是一个单字节或双字节序列,指示第一帧的长度(图4中标记为N1),然后是第一帧的N1字节压缩数据。剩余的N-N1-2或N-N1-3字节是第二帧的压缩数据。这如图4所示。代码2数据包必须包含足够的字节来表示有效长度。例如,1字节代码2数据包始终无效,而第二个字节在252…255范围内的2字节代码2数据包也无效。

The length of the first frame, N1, MUST also be no larger than the size of the payload remaining after decoding that length for all code 2 packets [R4]. This makes, for example, a 2-byte code 2 packet with a second byte in the range 1...251 invalid as well (the only valid 2-byte code 2 packet is one where the length of both frames is zero).

第一帧的长度N1也必须不大于对所有代码2分组解码该长度后剩余有效载荷的大小[R4]。例如,这使得第二个字节在1…251范围内的2字节代码2数据包也无效(唯一有效的2字节代码2数据包是两个帧的长度均为零的数据包)。

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|1|0| N1 (1-2 bytes):                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               :
     |               Compressed frame 1 (N1 bytes)...                |
     :                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                               |                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
     |                     Compressed frame 2...                     :
     :                                                               |
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|1|0| N1 (1-2 bytes):                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               :
     |               Compressed frame 1 (N1 bytes)...                |
     :                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                               |                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
     |                     Compressed frame 2...                     :
     :                                                               |
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 4: A Code 2 Packet

图4:代码2数据包

3.2.5. Code 3: A Signaled Number of Frames in the Packet
3.2.5. 代码3:数据包中发出信号的帧数

Code 3 packets signal the number of frames, as well as additional padding, called "Opus padding" to indicate that this padding is added at the Opus layer rather than at the transport layer. Code 3 packets MUST have at least 2 bytes [R6,R7]. The TOC byte is followed by a byte encoding the number of frames in the packet in bits 2 to 7 (marked "M" in Figure 5), with bit 1 indicating whether or not Opus padding is inserted (marked "p" in Figure 5), and bit 0 indicating VBR (marked "v" in Figure 5). M MUST NOT be zero, and the audio duration contained within a packet MUST NOT exceed 120 ms [R5]. This limits the maximum frame count for any frame size to 48 (for 2.5 ms frames), with lower limits for longer frame sizes. Figure 5 illustrates the layout of the frame count byte.

代码3数据包表示帧数以及额外的填充,称为“Opus padding”,以指示此填充是在Opus层而不是在传输层添加的。代码3数据包必须至少有2个字节[R6,R7]。TOC字节后接一个字节,该字节编码数据包中的帧数,其位为2到7(图5中标记为“M”),位1表示是否插入了Opus填充(图5中标记为“p”),位0表示VBR(图5中标记为“v”)。M不得为零,且数据包中包含的音频持续时间不得超过120毫秒[R5]。这将任何帧大小的最大帧计数限制为48(对于2.5毫秒帧),对于较长的帧大小,限制为较低。图5显示了帧计数字节的布局。

                              0
                              0 1 2 3 4 5 6 7
                             +-+-+-+-+-+-+-+-+
                             |v|p|     M     |
                             +-+-+-+-+-+-+-+-+
        
                              0
                              0 1 2 3 4 5 6 7
                             +-+-+-+-+-+-+-+-+
                             |v|p|     M     |
                             +-+-+-+-+-+-+-+-+
        

Figure 5: The frame count byte

图5:帧计数字节

When Opus padding is used, the number of bytes of padding is encoded in the bytes following the frame count byte. Values from 0...254 indicate that 0...254 bytes of padding are included, in addition to

使用Opus填充时,填充的字节数以帧计数字节后的字节进行编码。0…254的值表示除了0…254字节之外,还包括0…254字节的填充

the byte(s) used to indicate the size of the padding. If the value is 255, then the size of the additional padding is 254 bytes, plus the padding value encoded in the next byte. There MUST be at least one more byte in the packet in this case [R6,R7]. The additional padding bytes appear at the end of the packet and MUST be set to zero by the encoder to avoid creating a covert channel. The decoder MUST accept any value for the padding bytes, however.

用于指示填充大小的字节。如果值为255,则附加填充的大小为254字节,加上下一个字节中编码的填充值。在这种情况下,数据包中必须至少还有一个字节[R6,R7]。额外的填充字节出现在数据包的末尾,编码器必须将其设置为零,以避免创建隐蔽通道。但是,解码器必须接受填充字节的任何值。

Although this encoding provides multiple ways to indicate a given number of padding bytes, each uses a different number of bytes to indicate the padding size and thus will increase the total packet size by a different amount. For example, to add 255 bytes to a packet, set the padding bit, p, to 1, insert a single byte after the frame count byte with a value of 254, and append 254 padding bytes with the value zero to the end of the packet. To add 256 bytes to a packet, set the padding bit to 1, insert two bytes after the frame count byte with the values 255 and 0, respectively, and append 254 padding bytes with the value zero to the end of the packet. By using the value 255 multiple times, it is possible to create a packet of any specific, desired size. Let P be the number of header bytes used to indicate the padding size plus the number of padding bytes themselves (i.e., P is the total number of bytes added to the packet). Then, P MUST be no more than N-2 [R6,R7].

尽管这种编码提供了多种方法来指示给定数量的填充字节,但每种方法都使用不同数量的字节来指示填充大小,因此将以不同的量增加总数据包大小。例如,要向数据包添加255个字节,请将填充位p设置为1,在帧计数字节后插入一个值为254的单字节,并将值为零的254个填充字节追加到数据包的末尾。要向数据包添加256个字节,请将填充位设置为1,在帧计数字节后插入两个字节,分别为255和0,并在数据包末尾追加254个填充字节,值为0。通过多次使用值255,可以创建任意特定、所需大小的数据包。设P为用于指示填充大小的报头字节数加上填充字节数(即,P为添加到数据包的总字节数)。那么,P必须不大于N-2[R6,R7]。

In the CBR case, let R=N-2-P be the number of bytes remaining in the packet after subtracting the (optional) padding. Then, the compressed length of each frame in bytes is equal to R/M. The value R MUST be a non-negative integer multiple of M [R6]. The compressed data for all M frames follows, each of size R/M bytes, as illustrated in Figure 6.

在CBR情况下,让R=N-2-P为减去(可选)填充后数据包中剩余的字节数。然后,每个帧的压缩长度(以字节为单位)等于R/M。值R必须是M[R6]的非负整数倍。所有M帧的压缩数据如下,每个大小为R/M字节,如图6所示。

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|1|1|0|p|     M     |  Padding length (Optional)    :
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 1 (R/M bytes)...               :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 2 (R/M bytes)...               :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :                              ...                              :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame M (R/M bytes)...               :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :                  Opus Padding (Optional)...                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|1|1|0|p|     M     |  Padding length (Optional)    :
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 1 (R/M bytes)...               :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 2 (R/M bytes)...               :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :                              ...                              :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame M (R/M bytes)...               :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :                  Opus Padding (Optional)...                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 6: A CBR Code 3 Packet

图6:CBR代码3数据包

In the VBR case, the (optional) padding length is followed by M-1 frame lengths (indicated by "N1" to "N[M-1]" in Figure 7), each encoded in a one- or two-byte sequence as described above. The packet MUST contain enough data for the M-1 lengths after removing the (optional) padding, and the sum of these lengths MUST be no larger than the number of bytes remaining in the packet after decoding them [R7]. The compressed data for all M frames follows, each frame consisting of the indicated number of bytes, with the final frame consuming any remaining bytes before the final padding, as illustrated in Figure 6. The number of header bytes (TOC byte, frame count byte, padding length bytes, and frame length bytes), plus the signaled length of the first M-1 frames themselves, plus the signaled length of the padding MUST be no larger than N, the total size of the packet.

在VBR的情况下,(可选)填充长度后面是M-1帧长度(在图7中由“N1”到“N[M-1]”表示),每个帧长度按照如上所述的一个或两个字节序列进行编码。删除(可选)填充后,数据包必须包含足够的M-1长度数据,并且这些长度的总和不得大于解码后数据包中剩余的字节数[R7]。所有M帧的压缩数据如下,每个帧由指定数量的字节组成,最终帧在最终填充之前消耗任何剩余字节,如图6所示。报头字节数(TOC字节、帧计数字节、填充长度字节和帧长度字节)加上前M-1帧本身的信号长度,再加上填充的信号长度不得大于数据包总大小N。

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|1|1|1|p|     M     | Padding length (Optional)     :
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     : N1 (1-2 bytes): N2 (1-2 bytes):     ...       :     N[M-1]    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 1 (N1 bytes)...                :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 2 (N2 bytes)...                :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :                              ...                              :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :                     Compressed frame M...                     :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :                  Opus Padding (Optional)...                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | config  |s|1|1|1|p|     M     | Padding length (Optional)     :
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     : N1 (1-2 bytes): N2 (1-2 bytes):     ...       :     N[M-1]    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 1 (N1 bytes)...                :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :               Compressed frame 2 (N2 bytes)...                :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :                              ...                              :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     :                     Compressed frame M...                     :
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :                  Opus Padding (Optional)...                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 7: A VBR Code 3 Packet

图7:VBR代码3数据包

3.3. Examples
3.3. 例子

Simplest case, one NB mono 20 ms SILK frame:

最简单的情况下,一个NB mono 20 ms丝绸框架:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |    1    |0|0|0|               compressed data...              :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |    1    |0|0|0|               compressed data...              :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 8

图8

Two FB mono 5 ms CELT frames of the same compressed size:

两个相同压缩尺寸的FB mono 5 ms CELT框架:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   29    |0|0|1|               compressed data...              :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   29    |0|0|1|               compressed data...              :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 9

图9

Two FB mono 20 ms Hybrid frames of different compressed size:

两个不同压缩尺寸的FB mono 20 ms混合帧:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   15    |0|1|1|1|0|     2     |      N1       |               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               |
   |                       compressed data...                      :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   15    |0|1|1|1|0|     2     |      N1       |               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               |
   |                       compressed data...                      :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 10

图10

Four FB stereo 20 ms CELT frames of the same compressed size:

四个相同压缩尺寸的FB立体声20 ms CELT帧:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   31    |1|1|1|0|0|     4     |      compressed data...       :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   31    |1|1|1|0|0|     4     |      compressed data...       :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Figure 11

图11

3.4. Receiving Malformed Packets
3.4. 接收格式错误的数据包

A receiver MUST NOT process packets that violate any of the rules above as normal Opus packets. They are reserved for future applications, such as in-band headers (containing metadata, etc.). Packets that violate these constraints may cause implementations of _this_ specification to treat them as malformed and discard them.

接收方不得将违反上述任何规则的数据包作为正常Opus数据包进行处理。它们是为将来的应用程序保留的,例如带内标头(包含元数据等)。违反这些约束的数据包可能会导致该规范的实现将其视为格式错误并丢弃。

These constraints are summarized here for reference:

此处总结了这些约束条件,以供参考:

[R1] Packets are at least one byte.

[R1]数据包至少有一个字节。

[R2] No implicit frame length is larger than 1275 bytes.

[R2]没有隐式帧长度大于1275字节。

[R3] Code 1 packets have an odd total length, N, so that (N-1)/2 is an integer.

[R3]代码1数据包的总长度为奇数N,因此(N-1)/2为整数。

[R4] Code 2 packets have enough bytes after the TOC for a valid frame length, and that length is no larger than the number of bytes remaining in the packet.

[R4]代码2数据包在TOC之后有足够的字节用于有效的帧长度,并且该长度不大于数据包中剩余的字节数。

[R5] Code 3 packets contain at least one frame, but no more than 120 ms of audio total.

[R5]代码3数据包至少包含一帧,但总音频不超过120毫秒。

[R6] The length of a CBR code 3 packet, N, is at least two bytes, the number of bytes added to indicate the padding size plus the trailing padding bytes themselves, P, is no more than N-2, and the frame count, M, satisfies the constraint that (N-2-P) is a non-negative integer multiple of M.

[R6]CBR代码3数据包的长度N至少为两个字节,为指示填充大小而添加的字节数加上尾部填充字节本身P不超过N-2,并且帧计数M满足(N-2-P)为M的非负整数倍的约束。

[R7] VBR code 3 packets are large enough to contain all the header bytes (TOC byte, frame count byte, any padding length bytes, and any frame length bytes), plus the length of the first M-1 frames, plus any trailing padding bytes.

[R7]VBR代码3数据包足够大,足以包含所有头字节(TOC字节、帧计数字节、任何填充长度字节和任何帧长度字节),加上前M-1帧的长度,再加上任何后续填充字节。

4. Opus Decoder
4. Opus解码器

The Opus decoder consists of two main blocks: the SILK decoder and the CELT decoder. At any given time, one or both of the SILK and CELT decoders may be active. The output of the Opus decode is the sum of the outputs from the SILK and CELT decoders with proper sample rate conversion and delay compensation on the SILK side, and optional decimation (when decoding to sample rates less than 48 kHz) on the CELT side, as illustrated in the block diagram below.

Opus解码器由两个主要模块组成:丝绸解码器和凯尔特解码器。在任何给定时间,一个或两个SILK和CELT解码器都可能处于活动状态。Opus解码的输出是来自SILK和CELT解码器的输出的总和,在SILK侧具有适当的采样率转换和延迟补偿,在CELT侧具有可选的抽取(当解码到采样率小于48 kHz时),如下图所示。

                            +---------+    +------------+
                            |  SILK   |    |   Sample   |
                         +->| Decoder |--->|    Rate    |----+
   Bit-    +---------+   |  |         |    | Conversion |    v
   stream  |  Range  |---+  +---------+    +------------+  /---\  Audio
   ------->| Decoder |                                     | + |------>
           |         |---+  +---------+    +------------+  \---/
           +---------+   |  |  CELT   |    | Decimation |    ^
                         +->| Decoder |--->| (Optional) |----+
                            |         |    |            |
                            +---------+    +------------+
        
                            +---------+    +------------+
                            |  SILK   |    |   Sample   |
                         +->| Decoder |--->|    Rate    |----+
   Bit-    +---------+   |  |         |    | Conversion |    v
   stream  |  Range  |---+  +---------+    +------------+  /---\  Audio
   ------->| Decoder |                                     | + |------>
           |         |---+  +---------+    +------------+  \---/
           +---------+   |  |  CELT   |    | Decimation |    ^
                         +->| Decoder |--->| (Optional) |----+
                            |         |    |            |
                            +---------+    +------------+
        
4.1. Range Decoder
4.1. 范围解码器

Opus uses an entropy coder based on range coding [RANGE-CODING] [MARTIN79], which is itself a rediscovery of the FIFO arithmetic code introduced by [CODING-THESIS]. It is very similar to arithmetic encoding, except that encoding is done with digits in any base

Opus使用基于范围编码的熵编码器[range-coding][MARTIN79],这本身就是对[coding-Desmation]引入的FIFO算术编码的重新发现。它与算术编码非常相似,只是编码是用任何基中的数字来完成的

instead of with bits, so it is faster when using larger bases (i.e., a byte). All of the calculations in the range coder must use bit-exact integer arithmetic.

而不是使用位,因此使用较大的基(即一个字节)时速度更快。范围编码器中的所有计算都必须使用位精确整数算法。

Symbols may also be coded as "raw bits" packed directly into the bitstream, bypassing the range coder. These are packed backwards starting at the end of the frame, as illustrated in Figure 12. This reduces complexity and makes the stream more resilient to bit errors, as corruption in the raw bits will not desynchronize the decoding process, unlike corruption in the input to the range decoder. Raw bits are only used in the CELT layer.

符号也可以被编码为直接打包到比特流中的“原始比特”,绕过范围编码器。如图12所示,从帧的末端开始向后打包。这降低了复杂性并使流对位错误更具弹性,因为原始位中的损坏不会使解码过程去同步,这与范围解码器输入中的损坏不同。原始比特仅用于凯尔特层。

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | Range coder data (packed MSB to LSB) ->                       :
     +                                                               +
     :                                                               :
     +     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :     | <- Boundary occurs at an arbitrary bit position         :
     +-+-+-+                                                         +
     :                          <- Raw bits data (packed LSB to MSB) |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | Range coder data (packed MSB to LSB) ->                       :
     +                                                               +
     :                                                               :
     +     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :     | <- Boundary occurs at an arbitrary bit position         :
     +-+-+-+                                                         +
     :                          <- Raw bits data (packed LSB to MSB) |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        

Legend:

图例:

LSB = Least Significant Bit MSB = Most Significant Bit

LSB=最低有效位MSB=最高有效位

Figure 12: Illustrative Example of Packing Range Coder and Raw Bits Data

图12:打包范围编码器和原始位数据的示例

Each symbol coded by the range coder is drawn from a finite alphabet and coded in a separate "context", which describes the size of the alphabet and the relative frequency of each symbol in that alphabet.

距离编码器编码的每个符号都是从有限的字母表中提取出来的,并在单独的“上下文”中编码,上下文描述了字母表的大小以及该字母表中每个符号的相对频率。

Suppose there is a context with n symbols, identified with an index that ranges from 0 to n-1. The parameters needed to encode or decode symbol k in this context are represented by a three-tuple (fl[k], fh[k], ft), all 16-bit unsigned integers, with 0 <= fl[k] < fh[k] <= ft <= 65535. The values of this tuple are derived from the probability model for the symbol, represented by traditional "frequency counts". Because Opus uses static contexts, those are not updated as symbols are decoded. Let f[i] be the frequency of symbol i. Then, the three-tuple corresponding to symbol k is given by the following:

假设有一个包含n个符号的上下文,由范围从0到n-1的索引标识。在此上下文中编码或解码符号k所需的参数由三元组(fl[k]、fh[k]、ft)表示,所有16位无符号整数均为0<=fl[k]<fh[k]<=ft<=65535。该元组的值源自符号的概率模型,由传统的“频率计数”表示。因为Opus使用静态上下文,所以在解码符号时不会更新这些上下文。设f[i]为符号i的频率。然后,对应于符号k的三元组由下式给出:

                   k-1                                   n-1
                   __                                    __
           fl[k] = \  f[i],  fh[k] = fl[k] + f[k],  ft = \  f[i]
                   /_                                    /_
                   i=0                                   i=0
        
                   k-1                                   n-1
                   __                                    __
           fl[k] = \  f[i],  fh[k] = fl[k] + f[k],  ft = \  f[i]
                   /_                                    /_
                   i=0                                   i=0
        

The range decoder extracts the symbols and integers encoded using the range encoder in Section 5.1. The range decoder maintains an internal state vector composed of the two-tuple (val, rng), where val represents the difference between the high end of the current range and the actual coded value, minus one, and rng represents the size of the current range. Both val and rng are 32-bit unsigned integer values.

范围解码器提取使用第5.1节中的范围编码器编码的符号和整数。范围解码器维护由两个元组(val,rng)组成的内部状态向量,其中val表示当前范围的高端与实际编码值之间的差减1,rng表示当前范围的大小。val和rng都是32位无符号整数值。

4.1.1. Range Decoder Initialization
4.1.1. 范围解码器初始化

Let b0 be an 8-bit unsigned integer containing first input byte (or containing zero if there are no bytes in this Opus frame). The decoder initializes rng to 128 and initializes val to (127 - (b0>>1)), where (b0>>1) is the top 7 bits of the first input byte. It saves the remaining bit, (b0&1), for use in the renormalization procedure described in Section 4.1.2.1, which the decoder invokes immediately after initialization to read additional bits and establish the invariant that rng > 2**23.

设b0为包含第一个输入字节的8位无符号整数(如果此Opus帧中没有字节,则包含零)。解码器将rng初始化为128,将val初始化为(127-(b0>>1)),其中(b0>>1)是第一个输入字节的前7位。它保存了剩余的位(b0&1),用于第4.1.2.1节中描述的重整化过程,解码器在初始化后立即调用该程序读取附加位,并建立rng>2**23的不变量。

4.1.2. Decoding Symbols
4.1.2. 解码符号

Decoding a symbol is a two-step process. The first step determines a 16-bit unsigned value fs, which lies within the range of some symbol in the current context. The second step updates the range decoder state with the three-tuple (fl[k], fh[k], ft) corresponding to that symbol.

解码符号是一个两步过程。第一步确定一个16位无符号值fs,它位于当前上下文中某个符号的范围内。第二步用对应于该符号的三元组(fl[k],fh[k],ft)更新范围解码器状态。

The first step is implemented by ec_decode() (entdec.c), which computes

第一步由ec_decode()实现(entdec.c),它计算

                                      val
                       fs = ft - min(------ + 1, ft)
                                     rng/ft
        
                                      val
                       fs = ft - min(------ + 1, ft)
                                     rng/ft
        

The divisions here are integer division.

这里的除法是整数除法。

The decoder then identifies the symbol in the current context corresponding to fs; i.e., the value of k whose three-tuple (fl[k], fh[k], ft) satisfies fl[k] <= fs < fh[k]. It uses this tuple to update val according to

解码器然后在与fs对应的当前上下文中识别符号;i、 例如,其三元组(fl[k],fh[k],ft)满足fl[k]<=fs<fh[k]的k的值。它使用此元组根据

                                   rng
                       val = val - --- * (ft - fh[k])
                                   ft
        
                                   rng
                       val = val - --- * (ft - fh[k])
                                   ft
        

If fl[k] is greater than zero, then the decoder updates rng using

如果fl[k]大于零,则解码器使用

                              rng
                        rng = --- * (fh[k] - fl[k])
                              ft
        
                              rng
                        rng = --- * (fh[k] - fl[k])
                              ft
        

Otherwise, it updates rng using

否则,它将使用

                                   rng
                       rng = rng - --- * (ft - fh[k])
                                   ft
        
                                   rng
                       rng = rng - --- * (ft - fh[k])
                                   ft
        

Using a special case for the first symbol (rather than the last symbol, as is commonly done in other arithmetic coders) ensures that all the truncation error from the finite precision arithmetic accumulates in symbol 0. This makes the cost of coding a 0 slightly smaller, on average, than its estimated probability indicates and makes the cost of coding any other symbol slightly larger. When contexts are designed so that 0 is the most probable symbol, which is often the case, this strategy minimizes the inefficiency introduced by the finite precision. It also makes some of the special-case decoding routines in Section 4.1.3 particularly simple.

对第一个符号(而不是最后一个符号,这在其他算术编码器中是常见的)使用特殊情况可确保有限精度算术的所有截断误差累积在符号0中。这使得编码0的成本平均比其估计概率指示的成本稍小,并且使得编码任何其他符号的成本稍大。当上下文设计为0是最可能的符号时(通常情况下),此策略将有限精度带来的低效最小化。它还使第4.1.3节中的一些特殊情况解码例程变得特别简单。

After the updates, implemented by ec_dec_update() (entdec.c), the decoder normalizes the range using the procedure in the next section, and returns the index k.

在更新之后,由ec_dec_update()实现(entdec.c),解码器使用下一节中的过程规范化范围,并返回索引k。

4.1.2.1. Renormalization
4.1.2.1. 重整化

To normalize the range, the decoder repeats the following process, implemented by ec_dec_normalize() (entdec.c), until rng > 2**23. If rng is already greater than 2**23, the entire process is skipped. First, it sets rng to (rng<<8). Then, it reads the next byte of the Opus frame and forms an 8-bit value sym, using the leftover bit buffered from the previous byte as the high bit and the top 7 bits of the byte just read as the other 7 bits of sym. The remaining bit in the byte just read is buffered for use in the next iteration. If no more input bytes remain, it uses zero bits instead. See Section 4.1.1 for the initialization used to process the first byte. Then, it sets

为了规范化范围,解码器重复以下过程,由ec_dec_normalize()(entdec.c)实现,直到rng>2**23。如果rng已经大于2**23,则跳过整个过程。首先,它将rng设置为(rng<<8)。然后,它读取Opus帧的下一个字节并形成一个8位值sym,将前一个字节缓冲的剩余位用作高位,将刚刚读取的字节的前7位用作sym的其他7位。刚刚读取的字节中的剩余位将被缓冲,以便在下一次迭代中使用。如果没有剩余的输入字节,它将使用零位。有关处理第一个字节所用的初始化,请参见第4.1.1节。然后,它就开始了

                 val = ((val<<8) + (255-sym)) & 0x7FFFFFFF
        
                 val = ((val<<8) + (255-sym)) & 0x7FFFFFFF
        

It is normal and expected that the range decoder will read several bytes into the data of the raw bits (if any) at the end of the frame by the time the frame is completely decoded, as illustrated in Figure 13. This same data MUST also be returned as raw bits when requested. The encoder is expected to terminate the stream in such a way that the range decoder will decode the intended values regardless of the data contained in the raw bits. Section 5.1.5 describes a procedure for doing this. If the range decoder consumes all of the bytes belonging to the current frame, it MUST continue to use zero when any further input bytes are required, even if there is additional data in the current packet from padding or other frames.

在帧被完全解码时,范围解码器将在帧结束时将几个字节读入原始比特(如果有的话)的数据,这是正常的,如图13所示。当请求时,同样的数据也必须作为原始位返回。编码器期望以这样的方式终止流,即范围解码器将解码预期值,而不管原始比特中包含的数据如何。第5.1.5节描述了执行此操作的程序。如果范围解码器消耗属于当前帧的所有字节,则当需要任何进一步的输入字节时,它必须继续使用零,即使当前数据包中有来自填充或其他帧的额外数据。

      n              n+1             n+2             n+3
      0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :     | <----------- Overlap region ------------> |             :
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           ^                                           ^
           |   End of data buffered by the range coder |
     ...-----------------------------------------------+
           |
           | End of data consumed by raw bits
           +-------------------------------------------------------...
        
      n              n+1             n+2             n+3
      0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     :     | <----------- Overlap region ------------> |             :
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           ^                                           ^
           |   End of data buffered by the range coder |
     ...-----------------------------------------------+
           |
           | End of data consumed by raw bits
           +-------------------------------------------------------...
        

Figure 13: Illustrative Example of Raw Bits Overlapping Range Coder Data

图13:原始比特与范围编码器数据重叠的示例

4.1.3. Alternate Decoding Methods
4.1.3. 交替解码方法

The reference implementation uses three additional decoding methods that are exactly equivalent to the above but make assumptions and simplifications that allow for a more efficient implementation.

参考实现使用了三种额外的解码方法,它们与上述方法完全相同,但进行了假设和简化,以实现更高效的实现。

4.1.3.1. ec_decode_bin()
4.1.3.1. ec_decode_bin()
   The first is ec_decode_bin() (entdec.c), defined using the parameter
   ftb instead of ft.  It is mathematically equivalent to calling
   ec_decode() with ft = (1<<ftb), but it avoids one of the divisions.
        
   The first is ec_decode_bin() (entdec.c), defined using the parameter
   ftb instead of ft.  It is mathematically equivalent to calling
   ec_decode() with ft = (1<<ftb), but it avoids one of the divisions.
        
4.1.3.2. ec_dec_bit_logp()
4.1.3.2. ec_dec_bit_logp()
   The next is ec_dec_bit_logp() (entdec.c), which decodes a single
   binary symbol, replacing both the ec_decode() and ec_dec_update()
   steps.  The context is described by a single parameter, logp, which
   is the absolute value of the base-2 logarithm of the probability of a
   "1".  It is mathematically equivalent to calling ec_decode() with
   ft = (1<<logp), followed by ec_dec_update() with the 3-tuple
   (fl[k] = 0, fh[k] = (1<<logp) - 1, ft = (1<<logp)) if the returned
        
   The next is ec_dec_bit_logp() (entdec.c), which decodes a single
   binary symbol, replacing both the ec_decode() and ec_dec_update()
   steps.  The context is described by a single parameter, logp, which
   is the absolute value of the base-2 logarithm of the probability of a
   "1".  It is mathematically equivalent to calling ec_decode() with
   ft = (1<<logp), followed by ec_dec_update() with the 3-tuple
   (fl[k] = 0, fh[k] = (1<<logp) - 1, ft = (1<<logp)) if the returned
        
   value of fs is less than (1<<logp) - 1 (a "0" was decoded), and with
   (fl[k] = (1<<logp) - 1, fh[k] = ft = (1<<logp)) otherwise (a "1" was
   decoded).  The implementation requires no multiplications or
   divisions.
        
   value of fs is less than (1<<logp) - 1 (a "0" was decoded), and with
   (fl[k] = (1<<logp) - 1, fh[k] = ft = (1<<logp)) otherwise (a "1" was
   decoded).  The implementation requires no multiplications or
   divisions.
        
4.1.3.3. ec_dec_icdf()
4.1.3.3. 欧共体成员国

The last is ec_dec_icdf() (entdec.c), which decodes a single symbol with a table-based context of up to 8 bits, also replacing both the ec_decode() and ec_dec_update() steps, as well as the search for the decoded symbol in between. The context is described by two parameters, an icdf ("inverse" cumulative distribution function) table and ftb. As with ec_decode_bin(), (1<<ftb) is equivalent to ft. idcf[k], on the other hand, stores (1<<ftb)-fh[k], which is equal to (1<<ftb) - fl[k+1]. fl[0] is assumed to be 0, and the table is terminated by a value of 0 (where fh[k] == ft).

最后一个是ec_dec_icdf()(entdec.c),它使用最多8位的基于表的上下文对单个符号进行解码,还替换了ec_decode()和ec_dec_update()步骤,以及在两者之间搜索解码符号。上下文由两个参数描述,icdf(“逆”累积分布函数)表和ftb。与ec_decode_bin()一样,(1<<ftb)相当于ft.idcf[k],另一方面,存储(1<<ftb)-fh[k],其等于(1<<ftb)-fl[k+1]。假设fl[0]为0,表以0的值终止(其中fh[k]==ft)。

   The function is mathematically equivalent to calling ec_decode() with
   ft = (1<<ftb), using the returned value fs to search the table for
   the first entry where fs < (1<<ftb)-icdf[k], and calling
   ec_dec_update() with fl[k] = (1<<ftb) - icdf[k-1] (or 0 if k == 0),
   fh[k] = (1<<ftb) - idcf[k], and ft = (1<<ftb).  Combining the search
   with the update allows the division to be replaced by a series of
   multiplications (which are usually much cheaper), and using an
   inverse CDF allows the use of an ftb as large as 8 in an 8-bit table
   without any special cases.  This is the primary interface with the
   range decoder in the SILK layer, though it is used in a few places in
   the CELT layer as well.
        
   The function is mathematically equivalent to calling ec_decode() with
   ft = (1<<ftb), using the returned value fs to search the table for
   the first entry where fs < (1<<ftb)-icdf[k], and calling
   ec_dec_update() with fl[k] = (1<<ftb) - icdf[k-1] (or 0 if k == 0),
   fh[k] = (1<<ftb) - idcf[k], and ft = (1<<ftb).  Combining the search
   with the update allows the division to be replaced by a series of
   multiplications (which are usually much cheaper), and using an
   inverse CDF allows the use of an ftb as large as 8 in an 8-bit table
   without any special cases.  This is the primary interface with the
   range decoder in the SILK layer, though it is used in a few places in
   the CELT layer as well.
        

Although icdf[k] is more convenient for the code, the frequency counts, f[k], are a more natural representation of the probability distribution function (PDF) for a given symbol. Therefore, this document lists the latter, not the former, when describing the context in which a symbol is coded as a list, e.g., {4, 4, 4, 4}/16 for a uniform context with four possible values and ft = 16. The value of ft after the slash is always the sum of the entries in the PDF, but is included for convenience. Contexts with identical probabilities, f[k]/ft, but different values of ft (or equivalently, ftb) are not the same, and cannot, in general, be used in place of one another. An icdf table is also not capable of representing a PDF where the first symbol has 0 probability. In such contexts, ec_dec_icdf() can decode the symbol by using a table that drops the entries for any initial zero-probability values and by adding the constant offset of the first value with a non-zero probability to its return value.

虽然icdf[k]对于代码更方便,但频率计数f[k]是给定符号的概率分布函数(PDF)的更自然的表示。因此,本文件在描述将符号编码为列表的上下文时,列出了后者,而不是前者,例如,对于具有四个可能值且ft=16的统一上下文,{4,4,4}/16。斜杠后的ft值始终是PDF中条目的总和,但为了方便起见,将其包括在内。具有相同概率f[k]/ft,但不同ft值(或等价地,ftb)的上下文是不相同的,通常不能相互替代。icdf表也不能表示第一个符号概率为0的PDF。在这种情况下,ec_dec_icdf()可以使用一个表来解码符号,该表删除任何初始零概率值的条目,并将第一个值的非零概率常量偏移量添加到其返回值。

4.1.4. Decoding Raw Bits
4.1.4. 解码原始比特

The raw bits used by the CELT layer are packed at the end of the frame, with the least significant bit of the first value packed in the least significant bit of the last byte, filling up to the most significant bit in the last byte, continuing on to the least significant bit of the penultimate byte, and so on. The reference implementation reads them using ec_dec_bits() (entdec.c). Because the range decoder must read several bytes ahead in the stream, as described in Section 4.1.2.1, the input consumed by the raw bits may overlap with the input consumed by the range coder, and a decoder MUST allow this. The format should render it impossible to attempt to read more raw bits than there are actual bits in the frame, though a decoder may wish to check for this and report an error.

CELT层使用的原始位在帧的末尾打包,第一个值的最低有效位打包在最后一个字节的最低有效位,填充到最后一个字节的最高有效位,继续填充到倒数第二个字节的最低有效位,依此类推。参考实现使用ec_dec_bits()读取它们(entdec.c)。由于如第4.1.2.1节所述,范围解码器必须读取流中的前几个字节,因此原始位消耗的输入可能与范围编码器消耗的输入重叠,解码器必须允许这一点。该格式应使尝试读取的原始比特数不可能超过帧中的实际比特数,尽管解码器可能希望对此进行检查并报告错误。

4.1.5. Decoding Uniformly Distributed Integers
4.1.5. 对均匀分布整数的解码

The function ec_dec_uint() (entdec.c) decodes one of ft equiprobable values in the range 0 to (ft - 1), inclusive, each with a frequency of 1, where ft may be as large as (2**32 - 1). Because ec_decode() is limited to a total frequency of (2**16 - 1), it splits up the value into a range coded symbol representing up to 8 of the high bits, and, if necessary, raw bits representing the remainder of the value. The limit of 8 bits in the range coded symbol is a trade-off between implementation complexity, modeling error (since the symbols no longer truly have equal coding cost), and rounding error introduced by the range coder itself (which gets larger as more bits are included). Using raw bits reduces the maximum number of divisions required in the worst case, but means that it may be possible to decode a value outside the range 0 to (ft - 1), inclusive.

函数ec_dec_uint()。由于ec_decode()的总频率限制为(2**16-1),因此它将该值拆分为一个范围编码符号,表示多达8个高位,如有必要,将原始位表示该值的其余部分。范围编码符号中8位的限制是实现复杂性、建模误差(因为符号不再真正具有相等的编码成本)和范围编码器本身引入的舍入误差(随着包含更多位而变得更大)之间的折衷。使用原始位可以减少最坏情况下所需的最大分割数,但意味着可以解码0到(ft-1)范围以外的值(包括0到(ft-1))。

ec_dec_uint() takes a single, positive parameter, ft, which is not necessarily a power of two, and returns an integer, t, whose value lies between 0 and (ft - 1), inclusive. Let ftb = ilog(ft - 1), i.e., the number of bits required to store (ft - 1) in two's complement notation. If ftb is 8 or less, then t is decoded with t = ec_decode(ft), and the range coder state is updated using the three-tuple (t, t + 1, ft).

ec_dec_uint()接受一个正参数ft,它不一定是二的幂,并返回一个整数t,其值介于0和(ft-1)之间,包括0和(ft-1)。设ftb=ilog(ft-1),即以2的补码表示法存储(ft-1)所需的位数。如果ftb为8或更小,则使用t=ec_decode(ft)对t进行解码,并且使用三元组(t,t+1,ft)更新范围编码器状态。

If ftb is greater than 8, then the top 8 bits of t are decoded using

如果ftb大于8,则使用

                 t = ec_decode(((ft - 1) >> (ftb - 8)) + 1)
        
                 t = ec_decode(((ft - 1) >> (ftb - 8)) + 1)
        
   the decoder state is updated using the three-tuple (t, t + 1, ((ft -
    1) >> (ftb - 8)) + 1), and the remaining bits are decoded as raw
   bits, setting
        
   the decoder state is updated using the three-tuple (t, t + 1, ((ft -
    1) >> (ftb - 8)) + 1), and the remaining bits are decoded as raw
   bits, setting
        
                t = (t << (ftb - 8)) | ec_dec_bits(ftb - 8)
        
                t = (t << (ftb - 8)) | ec_dec_bits(ftb - 8)
        

If, at this point, t >= ft, then the current frame is corrupt. In that case, the decoder should assume there has been an error in the coding, decoding, or transmission and SHOULD take measures to conceal the error (e.g., saturate to ft-1 or use the Packet Loss Concealment (PLC)) and/or report to the application that the error has occurred.

如果此时t>=ft,则当前帧已损坏。在这种情况下,解码器应假设编码、解码或传输中存在错误,并应采取措施隐藏错误(例如,饱和到ft-1或使用丢包隐藏(PLC))和/或向应用程序报告已发生错误。

4.1.6. Current Bit Usage
4.1.6. 当前位使用情况

The bit allocation routines in the CELT decoder need a conservative upper bound on the number of bits that have been used from the current frame thus far, including both range coder bits and raw bits. This drives allocation decisions that must match those made in the encoder. The upper bound is computed in the reference implementation to whole-bit precision by the function ec_tell() (entcode.h) and to fractional 1/8th bit precision by the function ec_tell_frac() (entcode.c). Like all operations in the range coder, it must be implemented in a bit-exact manner, and it must produce exactly the same value returned by the same functions in the encoder after encoding the same symbols.

CELT解码器中的比特分配例程需要保守的上界,即到目前为止从当前帧使用的比特数,包括范围编码器比特和原始比特。这将促使分配决策必须与编码器中做出的决策相匹配。在参考实现中,上界通过函数ec_tell()(entcode.h)计算为整位精度,通过函数ec_tell_frac()(entcode.c)计算为分数1/8位精度。与范围编码器中的所有操作一样,它必须以位精确的方式实现,并且在编码相同的符号后,它必须生成由编码器中的相同函数返回的完全相同的值。

ec_tell() is guaranteed to return ceil(ec_tell_frac()/8.0). In various places, the codec will check to ensure there is enough room to contain a symbol before attempting to decode it. In practice, although the number of bits used so far is an upper bound, decoding a symbol whose probability model suggests it has a worst-case cost of p 1/8th bits may actually advance the return value of ec_tell_frac() by p-1, p, or p+1 1/8th bits, due to approximation error in that upper bound, truncation error in the range coder, and for large values of ft, modeling error in ec_dec_uint().

ec_tell()保证返回ceil(ec_tell_frac()/8.0)。在不同的地方,编解码器会在尝试解码符号之前进行检查,以确保有足够的空间容纳符号。在实践中,尽管迄今为止使用的位数是一个上限,但对其概率模型表明其最坏情况成本为p 1/8位的符号进行解码实际上可能会将ec_tell_frac()的返回值提前p-1、p或p+1 1/8位,这是由于上限中的近似误差、范围编码器中的截断误差,对于较大的ft值,ec_dec_uint()中的建模错误。

However, this error is bounded, and periodic calls to ec_tell() or ec_tell_frac() at precisely defined points in the decoding process prevent it from accumulating. For a range coder symbol that requires a whole number of bits (i.e., for which ft/(fh[k] - fl[k]) is a power of two), where there are at least p 1/8th bits available, decoding the symbol will never cause ec_tell() or ec_tell_frac() to exceed the size of the frame ("bust the budget"). In this case, the return value of ec_tell_frac() will only advance by more than p 1/8th bits if there were an additional, fractional number of bits remaining, and it will never advance beyond the next whole-bit boundary, which is safe, since frames always contain a whole number of bits. However, when p is not a whole number of bits, an extra 1/8th bit is required to ensure that decoding the symbol will not bust the budget.

然而,这个错误是有界的,在解码过程中精确定义的点上定期调用ec_tell()或ec_tell_frac()会阻止它累积。对于需要整数位的范围编码器符号(即ft/(fh[k]-fl[k]是二的幂),其中至少有p 1/8位可用,解码该符号将永远不会导致ec_tell()或ec_tell_frac()超过帧的大小(“预算不足”)。在这种情况下,如果还有一个额外的小数位数,ec_tell_frac()的返回值只会前进超过p 1/8位,并且它永远不会超过下一个完整的位边界,这是安全的,因为帧总是包含完整的位。然而,当p不是整数位数时,需要额外的1/8位以确保解码符号不会超出预算。

The reference implementation keeps track of the total number of whole bits that have been processed by the decoder so far in the variable nbits_total, including the (possibly fractional) number of bits that are currently buffered, but not consumed, inside the range coder. nbits_total is initialized to 9 just before the initial range renormalization process completes (or equivalently, it can be initialized to 33 after the first renormalization). The extra two bits over the actual amount buffered by the range coder guarantees that it is an upper bound and that there is enough room for the encoder to terminate the stream. Each iteration through the range coder's renormalization loop increases nbits_total by 8. Reading raw bits increases nbits_total by the number of raw bits read.

参考实现跟踪到目前为止由解码器在变量nbits_total中处理的整数位数,包括当前在范围编码器内缓冲但未消耗的(可能是小数)位数。nbits_total在初始范围重整化过程完成之前初始化为9(或者等效地,在第一次重整化之后可以初始化为33)。距离编码器缓冲的实际量的额外两位保证它是一个上限,并且编码器有足够的空间终止流。通过距离编码器的重整化循环的每次迭代都会使nbits_总数增加8。读取原始位会将nbits_总数增加读取的原始位数。

4.1.6.1. ec_tell()
4.1.6.1. ec_tell()

The whole number of bits buffered in rng may be estimated via lg = ilog(rng). ec_tell() then becomes a simple matter of removing these bits from the total. It returns (nbits_total - lg).

可以通过lg=ilog(rng)来估计在rng中缓冲的比特的总数。然后,ec_tell()就变成了从总数中删除这些位的简单问题。它返回(nbits_total-lg)。

In a newly initialized decoder, before any symbols have been read, this reports that 1 bit has been used. This is the bit reserved for termination of the encoder.

在新初始化的解码器中,在读取任何符号之前,报告已使用1位。这是为编码器终端保留的位。

4.1.6.2. ec_tell_frac()
4.1.6.2. ec_tell_frac()

ec_tell_frac() estimates the number of bits buffered in rng to fractional precision. Since rng must be greater than 2**23 after renormalization, lg must be at least 24. Let

ec_tell_frac()将rng中缓冲的位数估计为分数精度。由于重整化后rng必须大于2**23,因此lg必须至少为24。允许

                           r_Q15 = rng >> (lg-16)
        
                           r_Q15 = rng >> (lg-16)
        

so that 32768 <= r_Q15 < 65536, an unsigned Q15 value representing the fractional part of rng. Then, the following procedure can be used to add one bit of precision to lg. First, update

因此,32768<=r_Q15<65536,一个无符号Q15值,表示rng的小数部分。然后,可以使用以下步骤为lg增加一位精度。首先,更新

                        r_Q15 = (r_Q15*r_Q15) >> 15
        
                        r_Q15 = (r_Q15*r_Q15) >> 15
        

Then, add the 16th bit of r_Q15 to lg via

然后,将r_Q15的第16位通过

                         lg = 2*lg + (r_Q15 >> 16)
        
                         lg = 2*lg + (r_Q15 >> 16)
        

Finally, if this bit was a 1, reduce r_Q15 by a factor of two via

最后,如果该位为1,则将r_Q15减少2倍

                             r_Q15 = r_Q15 >> 1
        
                             r_Q15 = r_Q15 >> 1
        

so that it once again lies in the range 32768 <= r_Q15 < 65536. This procedure is repeated three times to extend lg to 1/8th bit precision. ec_tell_frac() then returns (nbits_total*8 - lg).

因此,它再次位于32768<=r_Q15<65536的范围内。此过程重复三次,以将lg扩展到1/8位精度。ec_tell_frac()然后返回(nbits_total*8-lg)。

4.2. SILK Decoder
4.2. 丝绸解码器

The decoder's LP layer uses a modified version of the SILK codec (herein simply called "SILK"), which runs a decoded excitation signal through adaptive long-term and short-term prediction synthesis filters. It runs at NB, MB, and WB sample rates internally. When used in a SWB or FB Hybrid frame, the LP layer itself still only runs in WB.

解码器的LP层使用改进版的SILK编解码器(这里简称为“SILK”),该编解码器通过自适应长期和短期预测合成滤波器运行解码的激励信号。它在内部以NB、MB和WB采样率运行。在SWB或FB混合帧中使用时,LP层本身仍仅在WB中运行。

4.2.1. SILK Decoder Modules
4.2.1. 丝绸解码器模块

An overview of the decoder is given in Figure 14.

解码器的概述如图14所示。

        +---------+    +------------+
     -->| Range   |--->| Decode     |---------------------------+
      1 | Decoder | 2  | Parameters |----------+       5        |
        +---------+    +------------+     4    |                |
                            3 |                |                |
                             \/               \/               \/
                       +------------+   +------------+   +------------+
                       | Generate   |-->| LTP        |-->| LPC        |
                       | Excitation |   | Synthesis  |   | Synthesis  |
                       +------------+   +------------+   +------------+
                                               ^                |
                                               |                |
                           +-------------------+----------------+
                           |                                      6
                           |   +------------+   +-------------+
                           +-->| Stereo     |-->| Sample Rate |-->
                               | Unmixing   | 7 | Conversion  | 8
                               +------------+   +-------------+
        
        +---------+    +------------+
     -->| Range   |--->| Decode     |---------------------------+
      1 | Decoder | 2  | Parameters |----------+       5        |
        +---------+    +------------+     4    |                |
                            3 |                |                |
                             \/               \/               \/
                       +------------+   +------------+   +------------+
                       | Generate   |-->| LTP        |-->| LPC        |
                       | Excitation |   | Synthesis  |   | Synthesis  |
                       +------------+   +------------+   +------------+
                                               ^                |
                                               |                |
                           +-------------------+----------------+
                           |                                      6
                           |   +------------+   +-------------+
                           +-->| Stereo     |-->| Sample Rate |-->
                               | Unmixing   | 7 | Conversion  | 8
                               +------------+   +-------------+
        

1: Range encoded bitstream 2: Coded parameters 3: Pulses, LSBs, and signs 4: Pitch lags, Long-Term Prediction (LTP) coefficients 5: Linear Predictive Coding (LPC) coefficients and gains 6: Decoded signal (mono or mid-side stereo) 7: Unmixed signal (mono or left-right stereo) 8: Resampled signal

1:范围编码比特流2:编码参数3:脉冲、LSB和符号4:基音滞后、长期预测(LTP)系数5:线性预测编码(LPC)系数和增益6:解码信号(单声道或中间立体声)7:未混合信号(单声道或左右立体声)8:重采样信号

Figure 14: SILK Decoder

图14:丝绸解码器

The decoder feeds the bitstream (1) to the range decoder from Section 4.1 and then decodes the parameters in it (2) using the procedures detailed in Sections 4.2.3 through 4.2.7.8.5. These parameters (3, 4, 5) are used to generate an excitation signal (see Section 4.2.7.8.6), which is fed to an optional Long-Term Prediction (LTP) filter (voiced frames only, see Section 4.2.7.9.1) and then a short-term prediction filter (see Section 4.2.7.9.2), producing the decoded signal (6). For stereo streams, the mid-side representation is converted to separate left and right channels (7). The result is finally resampled to the desired output sample rate (e.g., 48 kHz) so that the resampled signal (8) can be mixed with the CELT layer.

解码器将比特流(1)从第4.1节馈送至范围解码器,然后使用第4.2.3节至第4.2.7.8.5节详述的程序对其中的参数(2)进行解码。这些参数(3、4、5)用于生成激励信号(见第4.2.7.8.6节),激励信号被馈送至可选的长期预测(LTP)滤波器(仅语音帧,见第4.2.7.9.1节),然后馈送至短期预测滤波器(见第4.2.7.9.2节),生成解码信号(6)。对于立体声流,中间侧表示转换为单独的左声道和右声道(7)。最终将结果重新采样到所需的输出采样率(例如,48 kHz),以便重新采样的信号(8)可以与CELT层混合。

4.2.2. LP Layer Organization
4.2.2. LP层组织

Internally, the LP layer of a single Opus frame is composed of either a single 10 ms regular SILK frame or between one and three 20 ms regular SILK frames. A stereo Opus frame may double the number of regular SILK frames (up to a total of six), since it includes separate frames for a mid channel and, optionally, a side channel. Optional Low Bit-Rate Redundancy (LBRR) frames, which are reduced-bitrate encodings of previous SILK frames, may be included to aid in recovery from packet loss. If present, these appear before the regular SILK frames. They are, in most respects, identical to regular, active SILK frames, except that they are usually encoded with a lower bitrate. This document uses "SILK frame" to refer to either one and "regular SILK frame" if it needs to draw a distinction between the two.

在内部,单个Opus框架的LP层由单个10ms常规丝绸框架或一到三个20ms常规丝绸框架组成。立体声Opus画框可能是常规真丝画框数量的两倍(最多六个),因为它包括中间通道的单独画框,以及可选的侧通道的单独画框。可选的低比特率冗余(LBRR)帧是先前丝帧的降低比特率编码,可被包括以帮助从分组丢失中恢复。如果有的话,它们会出现在普通的丝绸框架之前。在大多数方面,它们与常规的活动丝帧相同,只是它们通常以较低的比特率编码。如果需要区分两者,本文件使用“丝框”来表示其中一种和“普通丝框”。

Logically, each SILK frame is, in turn, composed of either two or four 5 ms subframes. Various parameters, such as the quantization gain of the excitation and the pitch lag and filter coefficients can vary on a subframe-by-subframe basis. Physically, the parameters for each subframe are interleaved in the bitstream, as described in the relevant sections for each parameter.

从逻辑上讲,每个丝框依次由两个或四个5ms子框组成。各种参数,例如激励的量化增益和基音周期滞后以及滤波器系数可以在子帧到子帧的基础上变化。物理上,每个子帧的参数在比特流中交错,如每个参数的相关部分中所述。

All of these frames and subframes are decoded from the same range coder, with no padding between them. Thus, packing multiple SILK frames in a single Opus frame saves, on average, half a byte per SILK frame. It also allows some parameters to be predicted from prior SILK frames in the same Opus frame, since this does not degrade packet loss robustness (beyond any penalty for merely using fewer, larger packets to store multiple frames).

所有这些帧和子帧都是从同一个范围编码器解码的,它们之间没有填充。因此,将多个真丝相框打包在一个Opus相框中,平均每个真丝相框可以节省半个字节。它还允许从同一Opus帧中的先前丝帧预测一些参数,因为这不会降低丢包鲁棒性(除了仅使用更少、更大的数据包来存储多个帧的任何惩罚)。

Stereo support in SILK uses a variant of mid-side coding, allowing a mono decoder to simply decode the mid channel. However, the data for the two channels is interleaved, so a mono decoder must still unpack

SILK中的立体声支持使用了中置编码的变体,允许单声道解码器简单地解码中置信道。但是,两个通道的数据是交错的,因此单声道解码器仍然必须解包

the data for the side channel. It would be required to do so anyway for Hybrid Opus frames or to support decoding individual 20 ms frames.

侧通道的数据。对于混合Opus帧或支持解码单个20ms帧,无论如何都需要这样做。

Table 3 summarizes the overall grouping of the contents of the LP layer. Figures 15 and 16 illustrate the ordering of the various SILK frames for a 60 ms Opus frame, for both mono and stereo, respectively.

表3总结了LP层内容的总体分组。图15和图16分别说明了单声道和立体声60毫秒Opus相框的各种真丝相框的顺序。

   +-----------------------------------+---------------+---------------+
   |             Symbol(s)             |     PDF(s)    |   Condition   |
   +-----------------------------------+---------------+---------------+
   |   Voice Activity Detection (VAD)  |    {1, 1}/2   |               |
   |               Flags               |               |               |
   |                                   |               |               |
   |             LBRR Flag             |    {1, 1}/2   |               |
   |                                   |               |               |
   |        Per-Frame LBRR Flags       |    Table 4    | Section 4.2.4 |
   |                                   |               |               |
   |           LBRR Frame(s)           | Section 4.2.7 | Section 4.2.4 |
   |                                   |               |               |
   |       Regular SILK Frame(s)       | Section 4.2.7 |               |
   +-----------------------------------+---------------+---------------+
        
   +-----------------------------------+---------------+---------------+
   |             Symbol(s)             |     PDF(s)    |   Condition   |
   +-----------------------------------+---------------+---------------+
   |   Voice Activity Detection (VAD)  |    {1, 1}/2   |               |
   |               Flags               |               |               |
   |                                   |               |               |
   |             LBRR Flag             |    {1, 1}/2   |               |
   |                                   |               |               |
   |        Per-Frame LBRR Flags       |    Table 4    | Section 4.2.4 |
   |                                   |               |               |
   |           LBRR Frame(s)           | Section 4.2.7 | Section 4.2.4 |
   |                                   |               |               |
   |       Regular SILK Frame(s)       | Section 4.2.7 |               |
   +-----------------------------------+---------------+---------------+
        

Table 3: Organization of the SILK layer of an Opus Frame

表3:Opus框架丝绸层的组织

                    +---------------------------------+
                    |            VAD Flags            |
                    +---------------------------------+
                    |            LBRR Flag            |
                    +---------------------------------+
                    | Per-Frame LBRR Flags (Optional) |
                    +---------------------------------+
                    |     LBRR Frame 1 (Optional)     |
                    +---------------------------------+
                    |     LBRR Frame 2 (Optional)     |
                    +---------------------------------+
                    |     LBRR Frame 3 (Optional)     |
                    +---------------------------------+
                    |      Regular SILK Frame 1       |
                    +---------------------------------+
                    |      Regular SILK Frame 2       |
                    +---------------------------------+
                    |      Regular SILK Frame 3       |
                    +---------------------------------+
        
                    +---------------------------------+
                    |            VAD Flags            |
                    +---------------------------------+
                    |            LBRR Flag            |
                    +---------------------------------+
                    | Per-Frame LBRR Flags (Optional) |
                    +---------------------------------+
                    |     LBRR Frame 1 (Optional)     |
                    +---------------------------------+
                    |     LBRR Frame 2 (Optional)     |
                    +---------------------------------+
                    |     LBRR Frame 3 (Optional)     |
                    +---------------------------------+
                    |      Regular SILK Frame 1       |
                    +---------------------------------+
                    |      Regular SILK Frame 2       |
                    +---------------------------------+
                    |      Regular SILK Frame 3       |
                    +---------------------------------+
        

Figure 15: A 60 ms Mono Frame

图15:60毫秒单帧

                 +---------------------------------------+
                 |             Mid VAD Flags             |
                 +---------------------------------------+
                 |             Mid LBRR Flag             |
                 +---------------------------------------+
                 |             Side VAD Flags            |
                 +---------------------------------------+
                 |             Side LBRR Flag            |
                 +---------------------------------------+
                 |  Mid Per-Frame LBRR Flags (Optional)  |
                 +---------------------------------------+
                 | Side Per-Frame LBRR Flags (Optional)  |
                 +---------------------------------------+
                 |     Mid LBRR Frame 1 (Optional)       |
                 +---------------------------------------+
                 |     Side LBRR Frame 1 (Optional)      |
                 +---------------------------------------+
                 |     Mid LBRR Frame 2 (Optional)       |
                 +---------------------------------------+
                 |     Side LBRR Frame 2 (Optional)      |
                 +---------------------------------------+
                 |     Mid LBRR Frame 3 (Optional)       |
                 +---------------------------------------+
                 |     Side LBRR Frame 3 (Optional)      |
                 +---------------------------------------+
                 |      Mid Regular SILK Frame 1         |
                 +---------------------------------------+
                 | Side Regular SILK Frame 1 (Optional)  |
                 +---------------------------------------+
                 |      Mid Regular SILK Frame 2         |
                 +---------------------------------------+
                 | Side Regular SILK Frame 2 (Optional)  |
                 +---------------------------------------+
                 |      Mid Regular SILK Frame 3         |
                 +---------------------------------------+
                 | Side Regular SILK Frame 3 (Optional)  |
                 +---------------------------------------+
        
                 +---------------------------------------+
                 |             Mid VAD Flags             |
                 +---------------------------------------+
                 |             Mid LBRR Flag             |
                 +---------------------------------------+
                 |             Side VAD Flags            |
                 +---------------------------------------+
                 |             Side LBRR Flag            |
                 +---------------------------------------+
                 |  Mid Per-Frame LBRR Flags (Optional)  |
                 +---------------------------------------+
                 | Side Per-Frame LBRR Flags (Optional)  |
                 +---------------------------------------+
                 |     Mid LBRR Frame 1 (Optional)       |
                 +---------------------------------------+
                 |     Side LBRR Frame 1 (Optional)      |
                 +---------------------------------------+
                 |     Mid LBRR Frame 2 (Optional)       |
                 +---------------------------------------+
                 |     Side LBRR Frame 2 (Optional)      |
                 +---------------------------------------+
                 |     Mid LBRR Frame 3 (Optional)       |
                 +---------------------------------------+
                 |     Side LBRR Frame 3 (Optional)      |
                 +---------------------------------------+
                 |      Mid Regular SILK Frame 1         |
                 +---------------------------------------+
                 | Side Regular SILK Frame 1 (Optional)  |
                 +---------------------------------------+
                 |      Mid Regular SILK Frame 2         |
                 +---------------------------------------+
                 | Side Regular SILK Frame 2 (Optional)  |
                 +---------------------------------------+
                 |      Mid Regular SILK Frame 3         |
                 +---------------------------------------+
                 | Side Regular SILK Frame 3 (Optional)  |
                 +---------------------------------------+
        

Figure 16: A 60 ms Stereo Frame

图16:60毫秒立体声帧

4.2.3. Header Bits
4.2.3. 头比特

The LP layer begins with two to eight header bits, decoded in silk_Decode() (dec_API.c). These consist of one Voice Activity Detection (VAD) bit per frame (up to 3), followed by a single flag indicating the presence of LBRR frames. For a stereo packet, these first flags correspond to the mid channel, and a second set of flags is included for the side channel.

LP层从两到八个头比特开始,在silk_Decode()中解码(dec_API.c)。这些包括每帧一个语音活动检测(VAD)位(最多3位),然后是一个指示LBRR帧存在的标志。对于立体声分组,这些第一标志对应于中间信道,并且包括用于侧信道的第二组标志。

Because these are the first symbols decoded by the range coder and because they are coded as binary values with uniform probability, they can be extracted directly from the most significant bits of the first byte of compressed data. Thus, a receiver can determine if an Opus frame contains any active SILK frames without the overhead of using the range decoder.

因为这些是由范围编码器解码的第一个符号,并且因为它们以统一的概率编码为二进制值,所以可以直接从压缩数据的第一字节的最高有效位提取它们。因此,接收机可以确定Opus帧是否包含任何活动的丝帧,而无需使用范围解码器的开销。

4.2.4. Per-Frame LBRR Flags
4.2.4. 每帧LBRR标志

For Opus frames longer than 20 ms, a set of LBRR flags is decoded for each channel that has its LBRR flag set. Each set contains one flag per 20 ms SILK frame. 40 ms Opus frames use the 2-frame LBRR flag PDF from Table 4, and 60 ms Opus frames use the 3-frame LBRR flag PDF. For each channel, the resulting 2- or 3-bit integer contains the corresponding LBRR flag for each frame, packed in order from the LSB to the MSB.

对于大于20 ms的Opus帧,将为每个设置了LBRR标志的通道解码一组LBRR标志。每套每20毫秒丝绸框架包含一面旗帜。40毫秒Opus帧使用表4中的2帧LBRR标志PDF,60毫秒Opus帧使用3帧LBRR标志PDF。对于每个通道,生成的2位或3位整数包含每个帧对应的LBRR标志,按从LSB到MSB的顺序打包。

           +------------+-------------------------------------+
           | Frame Size | PDF                                 |
           +------------+-------------------------------------+
           | 40 ms      | {0, 53, 53, 150}/256                |
           |            |                                     |
           | 60 ms      | {0, 41, 20, 29, 41, 15, 28, 82}/256 |
           +------------+-------------------------------------+
        
           +------------+-------------------------------------+
           | Frame Size | PDF                                 |
           +------------+-------------------------------------+
           | 40 ms      | {0, 53, 53, 150}/256                |
           |            |                                     |
           | 60 ms      | {0, 41, 20, 29, 41, 15, 28, 82}/256 |
           +------------+-------------------------------------+
        

Table 4: LBRR Flag PDFs

表4:LBRR标志PDF

A 10 or 20 ms Opus frame does not contain any per-frame LBRR flags, as there may be at most one LBRR frame per channel. The global LBRR flag in the header bits (see Section 4.2.3) is already sufficient to indicate the presence of that single LBRR frame.

10或20毫秒Opus帧不包含任何每帧LBRR标志,因为每个通道最多可能有一个LBRR帧。报头位中的全局LBRR标志(见第4.2.3节)已足以指示单个LBRR帧的存在。

4.2.5. LBRR Frames
4.2.5. LBRR帧

The LBRR frames, if present, contain an encoded representation of the signal immediately prior to the current Opus frame as if it were encoded with the current mode, frame size, audio bandwidth, and channel count, even if those differ from the prior Opus frame. When one of these parameters changes from one Opus frame to the next, this implies that the LBRR frames of the current Opus frame may not be simple drop-in replacements for the contents of the previous Opus frame.

LBRR帧(如果存在)包含紧接当前Opus帧之前的信号的编码表示,就好像它是用当前模式、帧大小、音频带宽和信道计数编码的一样,即使这些与先前的Opus帧不同。当这些参数之一从一个Opus帧更改到下一个Opus帧时,这意味着当前Opus帧的LBRR帧可能不是前一个Opus帧内容的简单插入式替换。

For example, when switching from 20 ms to 60 ms, the 60 ms Opus frame may contain LBRR frames covering up to three prior 20 ms Opus frames, even if those frames already contained LBRR frames covering some of the same time periods. When switching from 20 ms to 10 ms, the 10 ms Opus frame can contain an LBRR frame covering at most half the prior

例如,当从20ms切换到60ms时,60ms Opus帧可以包含覆盖多达三个先前20ms Opus帧的LBRR帧,即使那些帧已经包含覆盖一些相同时间段的LBRR帧。当从20ms切换到10ms时,10ms Opus帧可以包含一个LBRR帧,该LBRR帧最多覆盖前一帧的一半

20 ms Opus frame, potentially leaving a hole that needs to be concealed from even a single packet loss (see Section 4.4). When switching from mono to stereo, the LBRR frames in the first stereo Opus frame MAY contain a non-trivial side channel.

20毫秒Opus帧,可能会留下一个孔,即使是单个数据包丢失也需要隐藏(见第4.4节)。当从单声道切换到立体声时,第一立体声Opus帧中的LBRR帧可以包含非平凡侧信道。

In order to properly produce LBRR frames under all conditions, an encoder might need to buffer up to 60 ms of audio and re-encode it during these transitions. However, the reference implementation opts to disable LBRR frames at the transition point for simplicity. Since transitions are relatively infrequent in normal usage, this does not have a significant impact on packet loss robustness.

为了在所有条件下正确生成LBRR帧,编码器可能需要缓冲高达60 ms的音频,并在这些转换期间对其重新编码。然而,为了简单起见,参考实现选择在转换点禁用LBRR帧。由于转换在正常使用中相对较少,因此这对数据包丢失鲁棒性没有显著影响。

The LBRR frames immediately follow the LBRR flags, prior to any regular SILK frames. Section 4.2.7 describes their exact contents. LBRR frames do not include their own separate VAD flags. LBRR frames are only meant to be transmitted for active speech, thus all LBRR frames are treated as active.

LBRR框架立即跟随LBRR标志,在任何常规丝质框架之前。第4.2.7节描述了其确切内容。LBRR机架不包括其各自的VAD标志。LBRR帧仅用于传输活动语音,因此所有LBRR帧都被视为活动帧。

In a stereo Opus frame longer than 20 ms, although the per-frame LBRR flags for the mid channel are coded as a unit before the per-frame LBRR flags for the side channel, the LBRR frames themselves are interleaved. The decoder parses an LBRR frame for the mid channel of a given 20 ms interval (if present) and then immediately parses the corresponding LBRR frame for the side channel (if present), before proceeding to the next 20 ms interval.

在大于20ms的立体声Opus帧中,尽管中间信道的每帧LBRR标志在侧信道的每帧LBRR标志之前作为一个单元编码,但LBRR帧本身是交织的。解码器解析给定20ms间隔(如果存在)的中间信道的LBRR帧,然后立即解析侧信道(如果存在)的对应LBRR帧,然后继续下一个20ms间隔。

4.2.6. Regular SILK Frames
4.2.6. 普通丝框

The regular SILK frame(s) follow the LBRR frames (if any). Section 4.2.7 describes their contents, as well. Unlike the LBRR frames, a regular SILK frame is coded for each time interval in an Opus frame, even if the corresponding VAD flags are unset. For stereo Opus frames longer than 20 ms, the regular mid and side SILK frames for each 20 ms interval are interleaved, just as with the LBRR frames. The side frame may be skipped by coding an appropriate flag, as detailed in Section 4.2.7.2.

常规丝质框架遵循LBRR框架(如有)。第4.2.7节也描述了其内容。与LBRR帧不同,Opus帧中的每个时间间隔都对常规丝绸帧进行编码,即使相应的VAD标志未设置。对于长度超过20ms的立体声Opus帧,与LBRR帧一样,每隔20ms间隔的常规中间和侧面真丝帧是交错的。如第4.2.7.2节所述,可通过编码适当的标志跳过侧架。

4.2.7. SILK Frame Contents
4.2.7. 丝框内容物

Each SILK frame includes a set of side information that encodes

每个丝框包括一组编码的边信息

o The frame type and quantization type (Section 4.2.7.3),

o 帧类型和量化类型(第4.2.7.3节),

o Quantization gains (Section 4.2.7.4),

o 量化增益(第4.2.7.4节),

o Short-term prediction filter coefficients (Section 4.2.7.5),

o 短期预测滤波器系数(第4.2.7.5节),

o A Line Spectral Frequencies (LSFs) interpolation weight (Section 4.2.7.5.5),

o A谱线频率(LSF)插值权重(第4.2.7.5.5节),

o LTP filter lags and gains (Section 4.2.7.6), and

o LTP滤波器滞后和增益(第4.2.7.6节),以及

o A Linear Congruential Generator (LCG) seed (Section 4.2.7.7).

o 线性同余发生器(LCG)种子(第4.2.7.7节)。

The quantized excitation signal (see Section 4.2.7.8) follows these at the end of the frame. Table 5 details the overall organization of a SILK frame.

量化激励信号(见第4.2.7.8节)在机架末端跟随这些信号。表5详细说明了丝绸框架的整体结构。

   +---------------------------+-------------------+-------------------+
   |         Symbol(s)         |       PDF(s)      |     Condition     |
   +---------------------------+-------------------+-------------------+
   | Stereo Prediction Weights |      Table 6      |  Section 4.2.7.1  |
   |                           |                   |                   |
   |       Mid-only Flag       |      Table 8      |  Section 4.2.7.2  |
   |                           |                   |                   |
   |         Frame Type        |  Section 4.2.7.3  |                   |
   |                           |                   |                   |
   |       Subframe Gains      |  Section 4.2.7.4  |                   |
   |                           |                   |                   |
   |   Normalized LSF Stage-1  |      Table 14     |                   |
   |           Index           |                   |                   |
   |                           |                   |                   |
   |   Normalized LSF Stage-2  | Section 4.2.7.5.2 |                   |
   |          Residual         |                   |                   |
   |                           |                   |                   |
   |       Normalized LSF      |      Table 26     |    20 ms frame    |
   |    Interpolation Weight   |                   |                   |
   |                           |                   |                   |
   |     Primary Pitch Lag     | Section 4.2.7.6.1 |    Voiced frame   |
   |                           |                   |                   |
   |   Subframe Pitch Contour  |      Table 32     |    Voiced frame   |
   |                           |                   |                   |
   |     Periodicity Index     |      Table 37     |    Voiced frame   |
   |                           |                   |                   |
   |         LTP Filter        |      Table 38     |    Voiced frame   |
   |                           |                   |                   |
   |        LTP Scaling        |      Table 42     | Section 4.2.7.6.3 |
   |                           |                   |                   |
   |          LCG Seed         |      Table 43     |                   |
   |                           |                   |                   |
   |   Excitation Rate Level   |      Table 45     |                   |
   |                           |                   |                   |
   |  Excitation Pulse Counts  |      Table 46     |                   |
   |                           |                   |                   |
   |      Excitation Pulse     | Section 4.2.7.8.3 |   Non-zero pulse  |
   |         Locations         |                   |       count       |
   |                           |                   |                   |
   |      Excitation LSBs      |      Table 51     | Section 4.2.7.8.2 |
   |                           |                   |                   |
   |      Excitation Signs     |      Table 52     |                   |
   +---------------------------+-------------------+-------------------+
        
   +---------------------------+-------------------+-------------------+
   |         Symbol(s)         |       PDF(s)      |     Condition     |
   +---------------------------+-------------------+-------------------+
   | Stereo Prediction Weights |      Table 6      |  Section 4.2.7.1  |
   |                           |                   |                   |
   |       Mid-only Flag       |      Table 8      |  Section 4.2.7.2  |
   |                           |                   |                   |
   |         Frame Type        |  Section 4.2.7.3  |                   |
   |                           |                   |                   |
   |       Subframe Gains      |  Section 4.2.7.4  |                   |
   |                           |                   |                   |
   |   Normalized LSF Stage-1  |      Table 14     |                   |
   |           Index           |                   |                   |
   |                           |                   |                   |
   |   Normalized LSF Stage-2  | Section 4.2.7.5.2 |                   |
   |          Residual         |                   |                   |
   |                           |                   |                   |
   |       Normalized LSF      |      Table 26     |    20 ms frame    |
   |    Interpolation Weight   |                   |                   |
   |                           |                   |                   |
   |     Primary Pitch Lag     | Section 4.2.7.6.1 |    Voiced frame   |
   |                           |                   |                   |
   |   Subframe Pitch Contour  |      Table 32     |    Voiced frame   |
   |                           |                   |                   |
   |     Periodicity Index     |      Table 37     |    Voiced frame   |
   |                           |                   |                   |
   |         LTP Filter        |      Table 38     |    Voiced frame   |
   |                           |                   |                   |
   |        LTP Scaling        |      Table 42     | Section 4.2.7.6.3 |
   |                           |                   |                   |
   |          LCG Seed         |      Table 43     |                   |
   |                           |                   |                   |
   |   Excitation Rate Level   |      Table 45     |                   |
   |                           |                   |                   |
   |  Excitation Pulse Counts  |      Table 46     |                   |
   |                           |                   |                   |
   |      Excitation Pulse     | Section 4.2.7.8.3 |   Non-zero pulse  |
   |         Locations         |                   |       count       |
   |                           |                   |                   |
   |      Excitation LSBs      |      Table 51     | Section 4.2.7.8.2 |
   |                           |                   |                   |
   |      Excitation Signs     |      Table 52     |                   |
   +---------------------------+-------------------+-------------------+
        

Table 5: Order of the Symbols in an Individual SILK Frame

表5:单个丝绸框架中符号的顺序

4.2.7.1. Stereo Prediction Weights
4.2.7.1. 立体预测权重

A SILK frame corresponding to the mid channel of a stereo Opus frame begins with a pair of side channel prediction weights, designed such that zeros indicate normal mid-side coupling. Since these weights can change on every frame, the first portion of each frame linearly interpolates between the previous weights and the current ones, using zeros for the previous weights if none are available. These prediction weights are never included in a mono Opus frame, and the previous weights are reset to zeros on any transition from mono to stereo. They are also not included in an LBRR frame for the side channel, even if the LBRR flags indicate the corresponding mid channel was not coded. In that case, the previous weights are used, again substituting in zeros if no previous weights are available since the last decoder reset (see Section 4.5.2).

与立体声Opus帧的中间通道对应的丝绸帧以一对侧通道预测权重开始,其设计使得零表示正常的中间侧耦合。由于这些权重可以在每一帧上更改,因此每一帧的第一部分在以前的权重和当前权重之间线性插值,如果没有可用的权重,则对以前的权重使用零。这些预测权重永远不会包含在单声道Opus帧中,并且在从单声道到立体声的任何转换中,先前的权重都会重置为零。它们也不包括在侧信道的LBRR帧中,即使LBRR标志指示相应的中间信道未编码。在这种情况下,使用先前的权重,如果自上次解码器重置后没有可用的先前权重,则再次替换为零(参见第4.5.2节)。

To summarize, these weights are coded if and only if

总而言之,这些权重编码的条件是且仅当

o This is a stereo Opus frame (Section 3.1), and

o 这是一个立体作品框架(第3.1节),以及

o The current SILK frame corresponds to the mid channel.

o 当前的丝框对应于中间通道。

The prediction weights are coded in three separate pieces, which are decoded by silk_stereo_decode_pred() (stereo_decode_pred.c). The first piece jointly codes the high-order part of a table index for both weights. The second piece codes the low-order part of each table index. The third piece codes an offset used to linearly interpolate between table indices. The details are as follows.

预测权重被编码在三个单独的片段中,由silk_stereo_decode_pred()(stereo_decode_pred.c)解码。第一部分对两个权重的表索引的高阶部分进行联合编码。第二部分对每个表索引的低阶部分进行编码。第三段代码是用于在表索引之间进行线性插值的偏移量。详情如下。

Let n be an index decoded with the 25-element stage-1 PDF in Table 6. Then, let i0 and i1 be indices decoded with the stage-2 and stage-3 PDFs in Table 6, respectively, and let i2 and i3 be two more indices decoded with the stage-2 and stage-3 PDFs, all in that order.

设n为表6中25元素stage-1 PDF解码的索引。然后,让i0和i1分别用表6中的stage-2和stage-3 PDF解码索引,并让i2和i3是用stage-2和stage-3 PDF解码的另外两个索引,所有顺序都是这样的。

   +-------+-----------------------------------------------------------+
   | Stage | PDF                                                       |
   +-------+-----------------------------------------------------------+
   | Stage | {7, 2, 1, 1, 1, 10, 24, 8, 1, 1, 3, 23, 92, 23, 3, 1, 1,  |
   | 1     | 8, 24, 10, 1, 1, 1, 2, 7}/256                             |
   |       |                                                           |
   | Stage | {85, 86, 85}/256                                          |
   | 2     |                                                           |
   |       |                                                           |
   | Stage | {51, 51, 52, 51, 51}/256                                  |
   | 3     |                                                           |
   +-------+-----------------------------------------------------------+
        
   +-------+-----------------------------------------------------------+
   | Stage | PDF                                                       |
   +-------+-----------------------------------------------------------+
   | Stage | {7, 2, 1, 1, 1, 10, 24, 8, 1, 1, 3, 23, 92, 23, 3, 1, 1,  |
   | 1     | 8, 24, 10, 1, 1, 1, 2, 7}/256                             |
   |       |                                                           |
   | Stage | {85, 86, 85}/256                                          |
   | 2     |                                                           |
   |       |                                                           |
   | Stage | {51, 51, 52, 51, 51}/256                                  |
   | 3     |                                                           |
   +-------+-----------------------------------------------------------+
        

Table 6: Stereo Weight PDFs

表6:立体声重量PDF

Then, use n, i0, and i2 to form two table indices, wi0 and wi1, according to

然后,使用n、i0和i2形成两个表索引wi0和wi1,根据

                             wi0 = i0 + 3*(n/5)
                             wi1 = i2 + 3*(n%5)
        
                             wi0 = i0 + 3*(n/5)
                             wi1 = i2 + 3*(n%5)
        

where the division is integer division. The range of these indices is 0 to 14, inclusive. Let w_Q13[i] be the i'th weight from Table 7. Then, the two prediction weights, w0_Q13 and w1_Q13, are

其中除法为整数除法。这些指数的范围是0到14,包括在内。设w_Q13[i]为表7中的第i个权重。然后,计算两个预测权重w0_Q13和w1_Q13

      w1_Q13 = w_Q13[wi1]
               + (((w_Q13[wi1+1] - w_Q13[wi1])*6554) >> 16)*(2*i3 + 1)
        
      w1_Q13 = w_Q13[wi1]
               + (((w_Q13[wi1+1] - w_Q13[wi1])*6554) >> 16)*(2*i3 + 1)
        
      w0_Q13 = w_Q13[wi0]
               + (((w_Q13[wi0+1] - w_Q13[wi0])*6554) >> 16)*(2*i1 + 1)
               - w1_Q13
        
      w0_Q13 = w_Q13[wi0]
               + (((w_Q13[wi0+1] - w_Q13[wi0])*6554) >> 16)*(2*i1 + 1)
               - w1_Q13
        

N.B., w1_Q13 is computed first here, because w0_Q13 depends on it. The constant 6554 is approximately 0.1 in Q16. Although wi0 and wi1 only have 15 possible values, Table 7 contains 16 entries to allow interpolation between entry wi0 and (wi0 + 1) (and likewise for wi1).

注意,这里首先计算w1_Q13,因为w0_Q13依赖于它。Q16中的常数6554约为0.1。虽然wi0和wi1只有15个可能的值,但表7包含16个条目,以允许条目wi0和(wi0+1)之间的插值(同样,对于wi1也是如此)。

                         +-------+--------------+
                         | Index | Weight (Q13) |
                         +-------+--------------+
                         | 0     |       -13732 |
                         |       |              |
                         | 1     |       -10050 |
                         |       |              |
                         | 2     |        -8266 |
                         |       |              |
                         | 3     |        -7526 |
                         |       |              |
                         | 4     |        -6500 |
                         |       |              |
                         | 5     |        -5000 |
                         |       |              |
                         | 6     |        -2950 |
                         |       |              |
                         | 7     |         -820 |
                         |       |              |
                         | 8     |          820 |
                         |       |              |
                         | 9     |         2950 |
                         |       |              |
                         | 10    |         5000 |
                         |       |              |
                         | 11    |         6500 |
                         |       |              |
                         | 12    |         7526 |
                         |       |              |
                         | 13    |         8266 |
                         |       |              |
                         | 14    |        10050 |
                         |       |              |
                         | 15    |        13732 |
                         +-------+--------------+
        
                         +-------+--------------+
                         | Index | Weight (Q13) |
                         +-------+--------------+
                         | 0     |       -13732 |
                         |       |              |
                         | 1     |       -10050 |
                         |       |              |
                         | 2     |        -8266 |
                         |       |              |
                         | 3     |        -7526 |
                         |       |              |
                         | 4     |        -6500 |
                         |       |              |
                         | 5     |        -5000 |
                         |       |              |
                         | 6     |        -2950 |
                         |       |              |
                         | 7     |         -820 |
                         |       |              |
                         | 8     |          820 |
                         |       |              |
                         | 9     |         2950 |
                         |       |              |
                         | 10    |         5000 |
                         |       |              |
                         | 11    |         6500 |
                         |       |              |
                         | 12    |         7526 |
                         |       |              |
                         | 13    |         8266 |
                         |       |              |
                         | 14    |        10050 |
                         |       |              |
                         | 15    |        13732 |
                         +-------+--------------+
        

Table 7: Stereo Weight Table

表7:立体声重量表

4.2.7.2. Mid-Only Flag
4.2.7.2. 中旗

A flag appears after the stereo prediction weights that indicates if only the mid channel is coded for this time interval. It appears only when

立体声预测权重后会出现一个标志,指示是否仅针对该时间间隔对中间通道进行编码。只有当

o This is a stereo Opus frame (see Section 3.1),

o 这是一个立体作品框架(见第3.1节),

o The current SILK frame corresponds to the mid channel, and

o 当前的丝框对应于中间通道,并且

o Either

o 任何一个

* This is a regular SILK frame where the VAD flags (see Section 4.2.3) indicate that the corresponding side channel is not active.

* 这是一个常规的丝质框架,其中VAD标志(见第4.2.3节)指示相应的侧通道未激活。

* This is an LBRR frame where the LBRR flags (see Sections 4.2.3 and 4.2.4) indicate that the corresponding side channel is not coded.

* 这是一个LBRR帧,其中LBRR标志(见第4.2.3节和第4.2.4节)指示未对相应的侧信道进行编码。

It is omitted when there are no stereo weights, for all of the same reasons. It is also omitted for a regular SILK frame when the VAD flag of the corresponding side channel frame is set (indicating it is active). The side channel must be coded in this case, making the mid-only flag redundant. It is also omitted for an LBRR frame when the corresponding LBRR flags indicate the side channel is coded.

出于同样的原因,当没有立体声权重时,将省略该选项。当设置了相应侧信道帧的VAD标志(指示其处于活动状态)时,对于常规的丝绸帧也省略该标记。在这种情况下,必须对侧通道进行编码,使仅mid标志冗余。当对应的LBRR标志指示侧信道被编码时,对于LBRR帧也省略该标记。

When the flag is present, the decoder reads a single value using the PDF in Table 8, as implemented in silk_stereo_decode_mid_only() (stereo_decode_pred.c). If the flag is set, then there is no corresponding SILK frame for the side channel, the entire decoding process for the side channel is skipped, and zeros are fed to the stereo unmixing process (see Section 4.2.8) instead. As stated above, LBRR frames still include this flag when the LBRR flag indicates that the side channel is not coded. In that case, if this flag is zero (indicating that there should be a side channel), then Packet Loss Concealment (PLC, see Section 4.4) SHOULD be invoked to recover a side channel signal. Otherwise, the stereo image will collapse.

当标志存在时,解码器使用表8中的PDF读取单个值,如silk_stereo_decode_mid_only()(stereo_decode_pred.c)中实现的。如果设置了该标志,则侧通道没有对应的丝帧,跳过侧通道的整个解码过程,并将零馈送至立体声分解过程(参见第4.2.8节)。如上所述,当LBRR标志指示未编码侧信道时,LBRR帧仍然包括该标志。在这种情况下,如果该标志为零(指示应存在侧信道),则应调用丢包隐藏(PLC,参见第4.4节)以恢复侧信道信号。否则,立体图像将崩溃。

                             +---------------+
                             | PDF           |
                             +---------------+
                             | {192, 64}/256 |
                             +---------------+
        
                             +---------------+
                             | PDF           |
                             +---------------+
                             | {192, 64}/256 |
                             +---------------+
        

Table 8: Mid-only Flag PDF

表8:Mid only标志PDF

4.2.7.3. Frame Type
4.2.7.3. 框架类型

Each SILK frame contains a single "frame type" symbol that jointly codes the signal type and quantization offset type of the corresponding frame. If the current frame is a regular SILK frame whose VAD bit was not set (an "inactive" frame), then the frame type symbol takes on a value of either 0 or 1 and is decoded using the first PDF in Table 9. If the frame is an LBRR frame or a regular SILK frame whose VAD flag was set (an "active" frame), then the value of the symbol may range from 2 to 5, inclusive, and is decoded using

每个丝质帧包含单个“帧类型”符号,该符号共同编码对应帧的信号类型和量化偏移类型。如果当前帧是未设置VAD位的常规真丝帧(“非活动”帧),则帧类型符号的值为0或1,并使用表9中的第一个PDF进行解码。如果帧是设置了VAD标志的LBRR帧或常规丝绸帧(“活动”帧),则符号的值可能在2到5之间(包括2到5),并使用

the second PDF in Table 9. Table 10 translates between the value of the frame type symbol and the corresponding signal type and quantization offset type.

第二个PDF格式见表9。表10在帧类型符号的值与相应的信号类型和量化偏移类型之间转换。

                +----------+-----------------------------+
                | VAD Flag | PDF                         |
                +----------+-----------------------------+
                | Inactive | {26, 230, 0, 0, 0, 0}/256   |
                |          |                             |
                | Active   | {0, 0, 24, 74, 148, 10}/256 |
                +----------+-----------------------------+
        
                +----------+-----------------------------+
                | VAD Flag | PDF                         |
                +----------+-----------------------------+
                | Inactive | {26, 230, 0, 0, 0, 0}/256   |
                |          |                             |
                | Active   | {0, 0, 24, 74, 148, 10}/256 |
                +----------+-----------------------------+
        

Table 9: Frame Type PDFs

表9:帧型PDF

          +------------+-------------+--------------------------+
          | Frame Type | Signal Type | Quantization Offset Type |
          +------------+-------------+--------------------------+
          | 0          | Inactive    |                      Low |
          |            |             |                          |
          | 1          | Inactive    |                     High |
          |            |             |                          |
          | 2          | Unvoiced    |                      Low |
          |            |             |                          |
          | 3          | Unvoiced    |                     High |
          |            |             |                          |
          | 4          | Voiced      |                      Low |
          |            |             |                          |
          | 5          | Voiced      |                     High |
          +------------+-------------+--------------------------+
        
          +------------+-------------+--------------------------+
          | Frame Type | Signal Type | Quantization Offset Type |
          +------------+-------------+--------------------------+
          | 0          | Inactive    |                      Low |
          |            |             |                          |
          | 1          | Inactive    |                     High |
          |            |             |                          |
          | 2          | Unvoiced    |                      Low |
          |            |             |                          |
          | 3          | Unvoiced    |                     High |
          |            |             |                          |
          | 4          | Voiced      |                      Low |
          |            |             |                          |
          | 5          | Voiced      |                     High |
          +------------+-------------+--------------------------+
        

Table 10: Signal Type and Quantization Offset Type from Frame Type

表10:帧类型的信号类型和量化偏移类型

4.2.7.4. Subframe Gains
4.2.7.4. 子帧增益

A separate quantization gain is coded for each 5 ms subframe. These gains control the step size between quantization levels of the excitation signal and, therefore, the quality of the reconstruction. They are independent of and unrelated to the pitch contours coded for voiced frames. The quantization gains are themselves uniformly quantized to 6 bits on a log scale, giving them a resolution of approximately 1.369 dB and a range of approximately 1.94 dB to 88.21 dB.

为每个5ms子帧编码单独的量化增益。这些增益控制激励信号量化电平之间的步长,从而控制重建质量。它们独立于为浊音帧编码的音高轮廓,且与之无关。量化增益本身在对数尺度上均匀量化为6位,使其分辨率约为1.369 dB,范围约为1.94 dB至88.21 dB。

The subframe gains are either coded independently, or relative to the gain from the most recent coded subframe in the same channel. Independent coding is used if and only if

子帧增益或者独立编码,或者相对于来自同一信道中最近编码的子帧的增益。当且仅当

o This is the first subframe in the current SILK frame, and

o 这是当前丝绸帧中的第一个子帧,并且

o Either

o 任何一个

* This is the first SILK frame of its type (LBRR or regular) for this channel in the current Opus frame, or

* 这是当前Opus框架中该频道的第一个丝绸框架(LBRR或常规),或

* The previous SILK frame of the same type (LBRR or regular) for this channel in the same Opus frame was not coded.

* 同一Opus帧中该频道的相同类型(LBRR或常规)的前一个丝绸帧未编码。

In an independently coded subframe gain, the 3 most significant bits of the quantization gain are decoded using a PDF selected from Table 11 based on the decoded signal type (see Section 4.2.7.3).

在独立编码的子帧增益中,使用基于解码信号类型从表11中选择的PDF对量化增益的3个最高有效位进行解码(参见第4.2.7.3节)。

           +-------------+------------------------------------+
           | Signal Type | PDF                                |
           +-------------+------------------------------------+
           | Inactive    | {32, 112, 68, 29, 12, 1, 1, 1}/256 |
           |             |                                    |
           | Unvoiced    | {2, 17, 45, 60, 62, 47, 19, 4}/256 |
           |             |                                    |
           | Voiced      | {1, 3, 26, 71, 94, 50, 9, 2}/256   |
           +-------------+------------------------------------+
        
           +-------------+------------------------------------+
           | Signal Type | PDF                                |
           +-------------+------------------------------------+
           | Inactive    | {32, 112, 68, 29, 12, 1, 1, 1}/256 |
           |             |                                    |
           | Unvoiced    | {2, 17, 45, 60, 62, 47, 19, 4}/256 |
           |             |                                    |
           | Voiced      | {1, 3, 26, 71, 94, 50, 9, 2}/256   |
           +-------------+------------------------------------+
        

Table 11: PDFs for Independent Quantization Gain MSB Coding

表11:独立量化增益MSB编码的PDF

The 3 least significant bits are decoded using a uniform PDF:

使用统一的PDF对3个最低有效位进行解码:

                 +--------------------------------------+
                 | PDF                                  |
                 +--------------------------------------+
                 | {32, 32, 32, 32, 32, 32, 32, 32}/256 |
                 +--------------------------------------+
        
                 +--------------------------------------+
                 | PDF                                  |
                 +--------------------------------------+
                 | {32, 32, 32, 32, 32, 32, 32, 32}/256 |
                 +--------------------------------------+
        

Table 12: PDF for Independent Quantization Gain LSB Coding

表12:独立量化增益LSB编码的PDF

These 6 bits are combined to form a value, gain_index, between 0 and 63. When the gain for the previous subframe is available, then the current gain is limited as follows:

这6位组合在一起形成一个0到63之间的值,即增益指数。当前一子帧的增益可用时,当前增益限制如下:

             log_gain = max(gain_index, previous_log_gain - 16)
        
             log_gain = max(gain_index, previous_log_gain - 16)
        

This may help some implementations limit the change in precision of their internal LTP history. The indices to which this clamp applies cannot simply be removed from the codebook, because previous_log_gain will not be available after packet loss. The clamping is skipped after a decoder reset, and in the side channel if the previous frame

这可能有助于某些实现限制其内部LTP历史的精度变化。这种钳位所适用的索引不能简单地从码本中删除,因为在数据包丢失后,先前的日志增益将不可用。解码器复位后跳过箝位,如果前一帧

in the side channel was not coded, since there is no value for previous_log_gain available. It MAY also be skipped after packet loss.

在侧通道中未编码,因为之前的_log_增益没有可用值。在数据包丢失后,它也可能被跳过。

For subframes that do not have an independent gain (including the first subframe of frames not listed as using independent coding above), the quantization gain is coded relative to the gain from the previous subframe (in the same channel). The PDF in Table 13 yields a delta_gain_index value between 0 and 40, inclusive.

对于不具有独立增益的子帧(包括未在上面使用独立编码列出的帧的第一子帧),相对于来自前一子帧的增益(在相同信道中)对量化增益进行编码。表13中的PDF产生的delta_增益_索引值介于0和40之间,包括0和40。

   +-------------------------------------------------------------------+
   | PDF                                                               |
   +-------------------------------------------------------------------+
   | {6, 5, 11, 31, 132, 21, 8, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
   | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,       |
   | 1}/256                                                            |
   +-------------------------------------------------------------------+
        
   +-------------------------------------------------------------------+
   | PDF                                                               |
   +-------------------------------------------------------------------+
   | {6, 5, 11, 31, 132, 21, 8, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
   | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,       |
   | 1}/256                                                            |
   +-------------------------------------------------------------------+
        

Table 13: PDF for Delta Quantization Gain Coding

表13:增量量化增益编码的PDF

The following formula translates this index into a quantization gain for the current subframe using the gain from the previous subframe:

以下公式使用来自前一子帧的增益将该索引转换为当前子帧的量化增益:

     log_gain = clamp(0, max(2*delta_gain_index - 16,
                        previous_log_gain + delta_gain_index - 4), 63)
        
     log_gain = clamp(0, max(2*delta_gain_index - 16,
                        previous_log_gain + delta_gain_index - 4), 63)
        

silk_gains_dequant() (gain_quant.c) dequantizes log_gain for the k'th subframe and converts it into a linear Q16 scale factor via

silk_gains_dequant()

         gain_Q16[k] = silk_log2lin((0x1D1C71*log_gain>>16) + 2090)
        
         gain_Q16[k] = silk_log2lin((0x1D1C71*log_gain>>16) + 2090)
        

The function silk_log2lin() (log2lin.c) computes an approximation of 2**(inLog_Q7/128.0), where inLog_Q7 is its Q7 input. Let i = inLog_Q7>>7 be the integer part of inLogQ7 and f = inLog_Q7&127 be the fractional part. Then,

函数silk_log2lin()(log2lin.c)计算2**(inLog_Q7/128.0)的近似值,其中inLog_Q7是其Q7输入。设i=inLog_Q7>>7为inLogQ7的整数部分,f=inLog_Q7&127为小数部分。然后

               (1<<i) + ((-174*f*(128-f)>>16)+f)*((1<<i)>>7)
        
               (1<<i) + ((-174*f*(128-f)>>16)+f)*((1<<i)>>7)
        

yields the approximate exponential. The final Q16 gain values lies between 81920 and 1686110208, inclusive (representing scale factors of 1.25 to 25728, respectively).

产生近似指数。最终Q16增益值介于81920和1686110208之间(包括这两个值)(分别表示1.25到25728的比例因子)。

4.2.7.5. Normalized Line Spectral Frequency (LSF) and Linear Predictive Coding (LPC) Coefficients

4.2.7.5. 归一化线谱频率(LSF)和线性预测编码(LPC)系数

A set of normalized Line Spectral Frequency (LSF) coefficients follow the quantization gains in the bitstream and represent the Linear Predictive Coding (LPC) coefficients for the current SILK frame.

一组归一化线谱频率(LSF)系数跟随比特流中的量化增益,并表示当前帧的线性预测编码(LPC)系数。

Once decoded, the normalized LSFs form an increasing list of Q15 values between 0 and 1. These represent the interleaved zeros on the upper half of the unit circle (between 0 and pi, hence "normalized") in the standard decomposition [SPECTRAL-PAIRS] of the LPC filter into a symmetric part and an anti-symmetric part (P and Q in Section 4.2.7.5.6). Because of non-linear effects in the decoding process, an implementation SHOULD match the fixed-point arithmetic described in this section exactly. An encoder SHOULD also use the same process.

一旦解码,规范化的LSF形成0到1之间的Q15值的递增列表。这些表示LPC滤波器标准分解[谱对]为对称部分和反对称部分(第4.2.7.5.6节中的P和Q)时单位圆上半部分的交错零(介于0和pi之间,因此“归一化”)。由于解码过程中的非线性效应,实现应该与本节中描述的定点算法完全匹配。编码器也应该使用相同的过程。

The normalized LSFs are coded using a two-stage vector quantizer (VQ) (Sections 4.2.7.5.1 and 4.2.7.5.2). NB and MB frames use an order-10 predictor, while WB frames use an order-16 predictor. Thus, each of these two cases uses a different set of tables. After reconstructing the normalized LSFs (Section 4.2.7.5.3), the decoder runs them through a stabilization process (Section 4.2.7.5.4), interpolates them between frames (Section 4.2.7.5.5), converts them back into LPC coefficients (Section 4.2.7.5.6), and then runs them through further processes to limit the range of the coefficients (Section 4.2.7.5.7) and the gain of the filter (Section 4.2.7.5.8). All of this is necessary to ensure the reconstruction process is stable.

使用两级矢量量化器(VQ)对归一化LSF进行编码(第4.2.7.5.1节和第4.2.7.5.2节)。NB和MB帧使用10阶预测器,而WB帧使用16阶预测器。因此,这两种情况中的每一种都使用一组不同的表。重建归一化LSF(第4.2.7.5.3节)后,解码器通过稳定过程(第4.2.7.5.4节)运行它们,在帧之间插值(第4.2.7.5.5节),将它们转换回LPC系数(第4.2.7.5.6节),然后通过进一步的过程运行它们以限制系数的范围(第4.2.7.5.7节)和滤波器增益(第4.2.7.5.8节)。所有这些都是确保重建过程稳定所必需的。

4.2.7.5.1. Normalized LSF Stage 1 Decoding
4.2.7.5.1. 归一化LSF第一阶段解码

The first VQ stage uses a 32-element codebook, coded with one of the PDFs in Table 14, depending on the audio bandwidth and the signal type of the current SILK frame. This yields a single index, I1, for the entire frame, which

根据音频带宽和当前帧的信号类型,第一个VQ级使用32个元素的码本,用表14中的一个PDF编码。这将为整个帧生成一个索引I1,该索引

1. Indexes an element in a coarse codebook,

1. 索引粗码本中的元素,

2. Selects the PDFs for the second stage of the VQ, and

2. 选择VQ第二阶段的PDF,然后

3. Selects the prediction weights used to remove intra-frame redundancy from the second stage.

3. 选择用于从第二级移除帧内冗余的预测权重。

The actual codebook elements are listed in Tables 23 and 24, but they are not needed until the last stages of reconstructing the LSF coefficients.

表23和24中列出了实际的码本元素,但直到重构LSF系数的最后阶段才需要它们。

   +-----------+----------+--------------------------------------------+
   | Audio     | Signal   | PDF                                        |
   | Bandwidth | Type     |                                            |
   +-----------+----------+--------------------------------------------+
   | NB or MB  | Inactive | {44, 34, 30, 19, 21, 12, 11, 3, 3, 2, 16,  |
   |           | or       | 2, 2, 1, 5, 2, 1, 3, 3, 1, 1, 2, 2, 2, 3,  |
   |           | unvoiced | 1, 9, 9, 2, 7, 2, 1}/256                   |
   |           |          |                                            |
   | NB or MB  | Voiced   | {1, 10, 1, 8, 3, 8, 8, 14, 13, 14, 1, 14,  |
   |           |          | 12, 13, 11, 11, 12, 11, 10, 10, 11, 8, 9,  |
   |           |          | 8, 7, 8, 1, 1, 6, 1, 6, 5}/256             |
   |           |          |                                            |
   | WB        | Inactive | {31, 21, 3, 17, 1, 8, 17, 4, 1, 18, 16, 4, |
   |           | or       | 2, 3, 1, 10, 1, 3, 16, 11, 16, 2, 2, 3, 2, |
   |           | unvoiced | 11, 1, 4, 9, 8, 7, 3}/256                  |
   |           |          |                                            |
   | WB        | Voiced   | {1, 4, 16, 5, 18, 11, 5, 14, 15, 1, 3, 12, |
   |           |          | 13, 14, 14, 6, 14, 12, 2, 6, 1, 12, 12,    |
   |           |          | 11, 10, 3, 10, 5, 1, 1, 1, 3}/256          |
   +-----------+----------+--------------------------------------------+
        
   +-----------+----------+--------------------------------------------+
   | Audio     | Signal   | PDF                                        |
   | Bandwidth | Type     |                                            |
   +-----------+----------+--------------------------------------------+
   | NB or MB  | Inactive | {44, 34, 30, 19, 21, 12, 11, 3, 3, 2, 16,  |
   |           | or       | 2, 2, 1, 5, 2, 1, 3, 3, 1, 1, 2, 2, 2, 3,  |
   |           | unvoiced | 1, 9, 9, 2, 7, 2, 1}/256                   |
   |           |          |                                            |
   | NB or MB  | Voiced   | {1, 10, 1, 8, 3, 8, 8, 14, 13, 14, 1, 14,  |
   |           |          | 12, 13, 11, 11, 12, 11, 10, 10, 11, 8, 9,  |
   |           |          | 8, 7, 8, 1, 1, 6, 1, 6, 5}/256             |
   |           |          |                                            |
   | WB        | Inactive | {31, 21, 3, 17, 1, 8, 17, 4, 1, 18, 16, 4, |
   |           | or       | 2, 3, 1, 10, 1, 3, 16, 11, 16, 2, 2, 3, 2, |
   |           | unvoiced | 11, 1, 4, 9, 8, 7, 3}/256                  |
   |           |          |                                            |
   | WB        | Voiced   | {1, 4, 16, 5, 18, 11, 5, 14, 15, 1, 3, 12, |
   |           |          | 13, 14, 14, 6, 14, 12, 2, 6, 1, 12, 12,    |
   |           |          | 11, 10, 3, 10, 5, 1, 1, 1, 3}/256          |
   +-----------+----------+--------------------------------------------+
        

Table 14: PDFs for Normalized LSF Stage-1 Index Decoding

表14:规范化LSF阶段1索引解码的PDF

4.2.7.5.2. Normalized LSF Stage 2 Decoding
4.2.7.5.2. 归一化LSF第2级解码

A total of 16 PDFs are available for the LSF residual in the second stage: the 8 (a...h) for NB and MB frames given in Table 15, and the 8 (i...p) for WB frames given in Table 16. Which PDF is used for which coefficient is driven by the index, I1, decoded in the first stage. Table 17 lists the letter of the corresponding PDF for each normalized LSF coefficient for NB and MB, and Table 18 lists the same information for WB.

第二阶段的LSF残差共有16个PDF可用:表15中给出的NB和MB帧的8个PDF(A…h),以及表16中给出的WB帧的8个PDF(i…p)。哪个PDF用于哪个系数由索引I1驱动,在第一阶段解码。表17列出了NB和MB的每个标准化LSF系数对应PDF的字母,表18列出了WB的相同信息。

            +----------+--------------------------------------+
            | Codebook | PDF                                  |
            +----------+--------------------------------------+
            | a        | {1, 1, 1, 15, 224, 11, 1, 1, 1}/256  |
            |          |                                      |
            | b        | {1, 1, 2, 34, 183, 32, 1, 1, 1}/256  |
            |          |                                      |
            | c        | {1, 1, 4, 42, 149, 55, 2, 1, 1}/256  |
            |          |                                      |
            | d        | {1, 1, 8, 52, 123, 61, 8, 1, 1}/256  |
            |          |                                      |
            | e        | {1, 3, 16, 53, 101, 74, 6, 1, 1}/256 |
            |          |                                      |
            | f        | {1, 3, 17, 55, 90, 73, 15, 1, 1}/256 |
            |          |                                      |
            | g        | {1, 7, 24, 53, 74, 67, 26, 3, 1}/256 |
            |          |                                      |
            | h        | {1, 1, 18, 63, 78, 58, 30, 6, 1}/256 |
            +----------+--------------------------------------+
        
            +----------+--------------------------------------+
            | Codebook | PDF                                  |
            +----------+--------------------------------------+
            | a        | {1, 1, 1, 15, 224, 11, 1, 1, 1}/256  |
            |          |                                      |
            | b        | {1, 1, 2, 34, 183, 32, 1, 1, 1}/256  |
            |          |                                      |
            | c        | {1, 1, 4, 42, 149, 55, 2, 1, 1}/256  |
            |          |                                      |
            | d        | {1, 1, 8, 52, 123, 61, 8, 1, 1}/256  |
            |          |                                      |
            | e        | {1, 3, 16, 53, 101, 74, 6, 1, 1}/256 |
            |          |                                      |
            | f        | {1, 3, 17, 55, 90, 73, 15, 1, 1}/256 |
            |          |                                      |
            | g        | {1, 7, 24, 53, 74, 67, 26, 3, 1}/256 |
            |          |                                      |
            | h        | {1, 1, 18, 63, 78, 58, 30, 6, 1}/256 |
            +----------+--------------------------------------+
        

Table 15: PDFs for NB/MB Normalized LSF Stage-2 Index Decoding

表15:NB/MB归一化LSF阶段2索引解码的PDF

           +----------+---------------------------------------+
           | Codebook | PDF                                   |
           +----------+---------------------------------------+
           | i        | {1, 1, 1, 9, 232, 9, 1, 1, 1}/256     |
           |          |                                       |
           | j        | {1, 1, 2, 28, 186, 35, 1, 1, 1}/256   |
           |          |                                       |
           | k        | {1, 1, 3, 42, 152, 53, 2, 1, 1}/256   |
           |          |                                       |
           | l        | {1, 1, 10, 49, 126, 65, 2, 1, 1}/256  |
           |          |                                       |
           | m        | {1, 4, 19, 48, 100, 77, 5, 1, 1}/256  |
           |          |                                       |
           | n        | {1, 1, 14, 54, 100, 72, 12, 1, 1}/256 |
           |          |                                       |
           | o        | {1, 1, 15, 61, 87, 61, 25, 4, 1}/256  |
           |          |                                       |
           | p        | {1, 7, 21, 50, 77, 81, 17, 1, 1}/256  |
           +----------+---------------------------------------+
        
           +----------+---------------------------------------+
           | Codebook | PDF                                   |
           +----------+---------------------------------------+
           | i        | {1, 1, 1, 9, 232, 9, 1, 1, 1}/256     |
           |          |                                       |
           | j        | {1, 1, 2, 28, 186, 35, 1, 1, 1}/256   |
           |          |                                       |
           | k        | {1, 1, 3, 42, 152, 53, 2, 1, 1}/256   |
           |          |                                       |
           | l        | {1, 1, 10, 49, 126, 65, 2, 1, 1}/256  |
           |          |                                       |
           | m        | {1, 4, 19, 48, 100, 77, 5, 1, 1}/256  |
           |          |                                       |
           | n        | {1, 1, 14, 54, 100, 72, 12, 1, 1}/256 |
           |          |                                       |
           | o        | {1, 1, 15, 61, 87, 61, 25, 4, 1}/256  |
           |          |                                       |
           | p        | {1, 7, 21, 50, 77, 81, 17, 1, 1}/256  |
           +----------+---------------------------------------+
        

Table 16: PDFs for WB Normalized LSF Stage-2 Index Decoding

表16:WB归一化LSF阶段2索引解码的PDF

                       +----+---------------------+
                       | I1 | Coefficient         |
                       +----+---------------------+
                       |    | 0 1 2 3 4 5 6 7 8 9 |
                       | 0  | a a a a a a a a a a |
                       |    |                     |
                       | 1  | b d b c c b c b b b |
                       |    |                     |
                       | 2  | c b b b b b b b b b |
                       |    |                     |
                       | 3  | b c c c c b c b b b |
                       |    |                     |
                       | 4  | c d d d d c c c c c |
                       |    |                     |
                       | 5  | a f d d c c c c b b |
                       |    |                     |
                       | g  | a c c c c c c c c b |
                       |    |                     |
                       | 7  | c d g e e e f e f f |
                       |    |                     |
                       | 8  | c e f f e f e g e e |
                       |    |                     |
                       | 9  | c e e h e f e f f e |
                       |    |                     |
                       | 10 | e d d d c d c c c c |
                       |    |                     |
                       | 11 | b f f g e f e f f f |
                       |    |                     |
                       | 12 | c h e g f f f f f f |
                       |    |                     |
                       | 13 | c h f f f f f g f e |
                       |    |                     |
                       | 14 | d d f e e f e f e e |
                       |    |                     |
                       | 15 | c d d f f e e e e e |
                       |    |                     |
                       | 16 | c e e g e f e f f f |
                       |    |                     |
                       | 17 | c f e g f f f e f e |
                       |    |                     |
                       | 18 | c h e f e f e f f f |
                       |    |                     |
                       | 19 | c f e g h g f g f e |
                       |    |                     |
                       | 20 | d g h e g f f g e f |
                       |    |                     |
                       | 21 | c h g e e e f e f f |
                       |    |                     |
        
                       +----+---------------------+
                       | I1 | Coefficient         |
                       +----+---------------------+
                       |    | 0 1 2 3 4 5 6 7 8 9 |
                       | 0  | a a a a a a a a a a |
                       |    |                     |
                       | 1  | b d b c c b c b b b |
                       |    |                     |
                       | 2  | c b b b b b b b b b |
                       |    |                     |
                       | 3  | b c c c c b c b b b |
                       |    |                     |
                       | 4  | c d d d d c c c c c |
                       |    |                     |
                       | 5  | a f d d c c c c b b |
                       |    |                     |
                       | g  | a c c c c c c c c b |
                       |    |                     |
                       | 7  | c d g e e e f e f f |
                       |    |                     |
                       | 8  | c e f f e f e g e e |
                       |    |                     |
                       | 9  | c e e h e f e f f e |
                       |    |                     |
                       | 10 | e d d d c d c c c c |
                       |    |                     |
                       | 11 | b f f g e f e f f f |
                       |    |                     |
                       | 12 | c h e g f f f f f f |
                       |    |                     |
                       | 13 | c h f f f f f g f e |
                       |    |                     |
                       | 14 | d d f e e f e f e e |
                       |    |                     |
                       | 15 | c d d f f e e e e e |
                       |    |                     |
                       | 16 | c e e g e f e f f f |
                       |    |                     |
                       | 17 | c f e g f f f e f e |
                       |    |                     |
                       | 18 | c h e f e f e f f f |
                       |    |                     |
                       | 19 | c f e g h g f g f e |
                       |    |                     |
                       | 20 | d g h e g f f g e f |
                       |    |                     |
                       | 21 | c h g e e e f e f f |
                       |    |                     |
        
                       | 22 | e f f e g g f g f e |
                       |    |                     |
                       | 23 | c f f g f g e g e e |
                       |    |                     |
                       | 24 | e f f f d h e f f e |
                       |    |                     |
                       | 25 | c d e f f g e f f e |
                       |    |                     |
                       | 26 | c d c d d e c d d d |
                       |    |                     |
                       | 27 | b b c c c c c d c c |
                       |    |                     |
                       | 28 | e f f g g g f g e f |
                       |    |                     |
                       | 29 | d f f e e e e d d c |
                       |    |                     |
                       | 30 | c f d h f f e e f e |
                       |    |                     |
                       | 31 | e e f e f g f g f e |
                       +----+---------------------+
        
                       | 22 | e f f e g g f g f e |
                       |    |                     |
                       | 23 | c f f g f g e g e e |
                       |    |                     |
                       | 24 | e f f f d h e f f e |
                       |    |                     |
                       | 25 | c d e f f g e f f e |
                       |    |                     |
                       | 26 | c d c d d e c d d d |
                       |    |                     |
                       | 27 | b b c c c c c d c c |
                       |    |                     |
                       | 28 | e f f g g g f g e f |
                       |    |                     |
                       | 29 | d f f e e e e d d c |
                       |    |                     |
                       | 30 | c f d h f f e e f e |
                       |    |                     |
                       | 31 | e e f e f g f g f e |
                       +----+---------------------+
        

Table 17: Codebook Selection for NB/MB Normalized LSF Stage-2 Index Decoding

表17:NB/MB规范化LSF阶段2索引解码的码本选择

          +----+------------------------------------------------+
          | I1 | Coefficient                                    |
          +----+------------------------------------------------+
          |    | 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 |
          |    |                                                |
          | 0  | i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i |
          |    |                                                |
          | 1  | k  l  l  l  l  l  k  k  k  k  k  j  j  j  i  l |
          |    |                                                |
          | 2  | k  n  n  l  p  m  m  n  k  n  m  n  n  m  l  l |
          |    |                                                |
          | 3  | i  k  j  k  k  j  j  j  j  j  i  i  i  i  i  j |
          |    |                                                |
          | 4  | i  o  n  m  o  m  p  n  m  m  m  n  n  m  m  l |
          |    |                                                |
          | 5  | i  l  n  n  m  l  l  n  l  l  l  l  l  l  k  m |
          |    |                                                |
          | 6  | i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i |
          |    |                                                |
          | 7  | i  k  o  l  p  k  n  l  m  n  n  m  l  l  k  l |
          |    |                                                |
          | 8  | i  o  k  o  o  m  n  m  o  n  m  m  n  l  l  l |
          |    |                                                |
          | 9  | k  j  i  i  i  i  i  i  i  i  i  i  i  i  i  i |
        
          +----+------------------------------------------------+
          | I1 | Coefficient                                    |
          +----+------------------------------------------------+
          |    | 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 |
          |    |                                                |
          | 0  | i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i |
          |    |                                                |
          | 1  | k  l  l  l  l  l  k  k  k  k  k  j  j  j  i  l |
          |    |                                                |
          | 2  | k  n  n  l  p  m  m  n  k  n  m  n  n  m  l  l |
          |    |                                                |
          | 3  | i  k  j  k  k  j  j  j  j  j  i  i  i  i  i  j |
          |    |                                                |
          | 4  | i  o  n  m  o  m  p  n  m  m  m  n  n  m  m  l |
          |    |                                                |
          | 5  | i  l  n  n  m  l  l  n  l  l  l  l  l  l  k  m |
          |    |                                                |
          | 6  | i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i |
          |    |                                                |
          | 7  | i  k  o  l  p  k  n  l  m  n  n  m  l  l  k  l |
          |    |                                                |
          | 8  | i  o  k  o  o  m  n  m  o  n  m  m  n  l  l  l |
          |    |                                                |
          | 9  | k  j  i  i  i  i  i  i  i  i  i  i  i  i  i  i |
        
          |    |                                                |
          | 10 | i  j  i  i  i  i  i  i  i  i  i  i  i  i  i  j |
          |    |                                                |
          | 11 | k  k  l  m  n  l  l  l  l  l  l  l  k  k  j  l |
          |    |                                                |
          | 12 | k  k  l  l  m  l  l  l  l  l  l  l  l  k  j  l |
          |    |                                                |
          | 13 | l  m  m  m  o  m  m  n  l  n  m  m  n  m  l  m |
          |    |                                                |
          | 14 | i  o  m  n  m  p  n  k  o  n  p  m  m  l  n  l |
          |    |                                                |
          | 15 | i  j  i  j  j  j  j  j  j  j  i  i  i  i  j  i |
          |    |                                                |
          | 16 | j  o  n  p  n  m  n  l  m  n  m  m  m  l  l  m |
          |    |                                                |
          | 17 | j  l  l  m  m  l  l  n  k  l  l  n  n  n  l  m |
          |    |                                                |
          | 18 | k  l  l  k  k  k  l  k  j  k  j  k  j  j  j  m |
          |    |                                                |
          | 19 | i  k  l  n  l  l  k  k  k  j  j  i  i  i  i  i |
          |    |                                                |
          | 20 | l  m  l  n  l  l  k  k  j  j  j  j  j  k  k  m |
          |    |                                                |
          | 21 | k  o  l  p  p  m  n  m  n  l  n  l  l  k  l  l |
          |    |                                                |
          | 22 | k  l  n  o  o  l  n  l  m  m  l  l  l  l  k  m |
          |    |                                                |
          | 23 | j  l  l  m  m  m  m  l  n  n  n  l  j  j  j  j |
          |    |                                                |
          | 24 | k  n  l  o  o  m  p  m  m  n  l  m  m  l  l  l |
          |    |                                                |
          | 25 | i  o  j  j  i  i  i  i  i  i  i  i  i  i  i  i |
          |    |                                                |
          | 26 | i  o  o  l  n  k  n  n  l  m  m  p  p  m  m  m |
          |    |                                                |
          | 27 | l  l  p  l  n  m  l  l  l  k  k  l  l  l  k  l |
          |    |                                                |
          | 28 | i  i  j  i  i  i  k  j  k  j  j  k  k  k  j  j |
          |    |                                                |
          | 29 | i  l  k  n  l  l  k  l  k  j  i  i  j  i  i  j |
          |    |                                                |
          | 30 | l  n  n  m  p  n  l  l  k  l  k  k  j  i  j  i |
          |    |                                                |
          | 31 | k  l  n  l  m  l  l  l  k  j  k  o  m  i  i  i |
          +----+------------------------------------------------+
        
          |    |                                                |
          | 10 | i  j  i  i  i  i  i  i  i  i  i  i  i  i  i  j |
          |    |                                                |
          | 11 | k  k  l  m  n  l  l  l  l  l  l  l  k  k  j  l |
          |    |                                                |
          | 12 | k  k  l  l  m  l  l  l  l  l  l  l  l  k  j  l |
          |    |                                                |
          | 13 | l  m  m  m  o  m  m  n  l  n  m  m  n  m  l  m |
          |    |                                                |
          | 14 | i  o  m  n  m  p  n  k  o  n  p  m  m  l  n  l |
          |    |                                                |
          | 15 | i  j  i  j  j  j  j  j  j  j  i  i  i  i  j  i |
          |    |                                                |
          | 16 | j  o  n  p  n  m  n  l  m  n  m  m  m  l  l  m |
          |    |                                                |
          | 17 | j  l  l  m  m  l  l  n  k  l  l  n  n  n  l  m |
          |    |                                                |
          | 18 | k  l  l  k  k  k  l  k  j  k  j  k  j  j  j  m |
          |    |                                                |
          | 19 | i  k  l  n  l  l  k  k  k  j  j  i  i  i  i  i |
          |    |                                                |
          | 20 | l  m  l  n  l  l  k  k  j  j  j  j  j  k  k  m |
          |    |                                                |
          | 21 | k  o  l  p  p  m  n  m  n  l  n  l  l  k  l  l |
          |    |                                                |
          | 22 | k  l  n  o  o  l  n  l  m  m  l  l  l  l  k  m |
          |    |                                                |
          | 23 | j  l  l  m  m  m  m  l  n  n  n  l  j  j  j  j |
          |    |                                                |
          | 24 | k  n  l  o  o  m  p  m  m  n  l  m  m  l  l  l |
          |    |                                                |
          | 25 | i  o  j  j  i  i  i  i  i  i  i  i  i  i  i  i |
          |    |                                                |
          | 26 | i  o  o  l  n  k  n  n  l  m  m  p  p  m  m  m |
          |    |                                                |
          | 27 | l  l  p  l  n  m  l  l  l  k  k  l  l  l  k  l |
          |    |                                                |
          | 28 | i  i  j  i  i  i  k  j  k  j  j  k  k  k  j  j |
          |    |                                                |
          | 29 | i  l  k  n  l  l  k  l  k  j  i  i  j  i  i  j |
          |    |                                                |
          | 30 | l  n  n  m  p  n  l  l  k  l  k  k  j  i  j  i |
          |    |                                                |
          | 31 | k  l  n  l  m  l  l  l  k  j  k  o  m  i  i  i |
          +----+------------------------------------------------+
        

Table 18: Codebook Selection for WB Normalized LSF Stage-2 Index Decoding

表18:WB归一化LSF阶段2索引解码的码本选择

Decoding the second stage residual proceeds as follows. For each coefficient, the decoder reads a symbol using the PDF corresponding to I1 from either Table 17 or Table 18, and subtracts 4 from the result to give an index in the range -4 to 4, inclusive. If the index is either -4 or 4, it reads a second symbol using the PDF in Table 19, and adds the value of this second symbol to the index, using the same sign. This gives the index, I2[k], a total range of -10 to 10, inclusive.

解码第二级残余如下进行。对于每个系数,解码器使用表17或表18中对应于I1的PDF读取一个符号,并从结果中减去4,以给出范围为-4到4(包括4)的索引。如果索引为-4或4,它将使用表19中的PDF读取第二个符号,并使用相同的符号将第二个符号的值添加到索引中。这使得指数I2[k]的总范围为-10到10(含10)。

                     +-------------------------------+
                     | PDF                           |
                     +-------------------------------+
                     | {156, 60, 24, 9, 4, 2, 1}/256 |
                     +-------------------------------+
        
                     +-------------------------------+
                     | PDF                           |
                     +-------------------------------+
                     | {156, 60, 24, 9, 4, 2, 1}/256 |
                     +-------------------------------+
        

Table 19: PDF for Normalized LSF Index Extension Decoding

表19:规范化LSF索引扩展解码的PDF

The decoded indices from both stages are translated back into normalized LSF coefficients in silk_NLSF_decode() (NLSF_decode.c). The stage-2 indices represent residuals after both the first stage of the VQ and a separate backwards-prediction step. The backwards prediction process in the encoder subtracts a prediction from each residual formed by a multiple of the coefficient that follows it. The decoder must undo this process. Table 20 contains lists of prediction weights for each coefficient. There are two lists for NB and MB, and another two lists for WB, giving two possible prediction weights for each coefficient.

在silk_NLSF_decode()(NLSF_decode.c)中,来自两个阶段的解码索引被转换回归一化的LSF系数。第2阶段指数表示VQ第一阶段和单独向后预测步骤之后的残差。编码器中的向后预测过程从由随后的系数的倍数形成的每个残差中减去预测。解码器必须撤消此过程。表20包含每个系数的预测权重列表。NB和MB有两个列表,WB有另外两个列表,为每个系数提供了两个可能的预测权重。

                  +-------------+-----+-----+-----+-----+
                  | Coefficient |   A |   B |   C |   D |
                  +-------------+-----+-----+-----+-----+
                  | 0           | 179 | 116 | 175 |  68 |
                  |             |     |     |     |     |
                  | 1           | 138 |  67 | 148 |  62 |
                  |             |     |     |     |     |
                  | 2           | 140 |  82 | 160 |  66 |
                  |             |     |     |     |     |
                  | 3           | 148 |  59 | 176 |  60 |
                  |             |     |     |     |     |
                  | 4           | 151 |  92 | 178 |  72 |
                  |             |     |     |     |     |
                  | 5           | 149 |  72 | 173 | 117 |
                  |             |     |     |     |     |
                  | 6           | 153 | 100 | 174 |  85 |
                  |             |     |     |     |     |
                  | 7           | 151 |  89 | 164 |  90 |
                  |             |     |     |     |     |
                  | 8           | 163 |  92 | 177 | 118 |
                  |             |     |     |     |     |
                  | 9           |     |     | 174 | 136 |
                  |             |     |     |     |     |
                  | 10          |     |     | 196 | 151 |
                  |             |     |     |     |     |
                  | 11          |     |     | 182 | 142 |
                  |             |     |     |     |     |
                  | 12          |     |     | 198 | 160 |
                  |             |     |     |     |     |
                  | 13          |     |     | 192 | 142 |
                  |             |     |     |     |     |
                  | 14          |     |     | 182 | 155 |
                  +-------------+-----+-----+-----+-----+
        
                  +-------------+-----+-----+-----+-----+
                  | Coefficient |   A |   B |   C |   D |
                  +-------------+-----+-----+-----+-----+
                  | 0           | 179 | 116 | 175 |  68 |
                  |             |     |     |     |     |
                  | 1           | 138 |  67 | 148 |  62 |
                  |             |     |     |     |     |
                  | 2           | 140 |  82 | 160 |  66 |
                  |             |     |     |     |     |
                  | 3           | 148 |  59 | 176 |  60 |
                  |             |     |     |     |     |
                  | 4           | 151 |  92 | 178 |  72 |
                  |             |     |     |     |     |
                  | 5           | 149 |  72 | 173 | 117 |
                  |             |     |     |     |     |
                  | 6           | 153 | 100 | 174 |  85 |
                  |             |     |     |     |     |
                  | 7           | 151 |  89 | 164 |  90 |
                  |             |     |     |     |     |
                  | 8           | 163 |  92 | 177 | 118 |
                  |             |     |     |     |     |
                  | 9           |     |     | 174 | 136 |
                  |             |     |     |     |     |
                  | 10          |     |     | 196 | 151 |
                  |             |     |     |     |     |
                  | 11          |     |     | 182 | 142 |
                  |             |     |     |     |     |
                  | 12          |     |     | 198 | 160 |
                  |             |     |     |     |     |
                  | 13          |     |     | 192 | 142 |
                  |             |     |     |     |     |
                  | 14          |     |     | 182 | 155 |
                  +-------------+-----+-----+-----+-----+
        

Table 20: Prediction Weights for Normalized LSF Decoding

表20:归一化LSF解码的预测权重

The prediction is undone using the procedure implemented in silk_NLSF_residual_dequant() (NLSF_decode.c), which is as follows. Each coefficient selects its prediction weight from one of the two lists based on the stage-1 index, I1. Table 21 gives the selections for each coefficient for NB and MB, and Table 22 gives the selections for WB. Let d_LPC be the order of the codebook, i.e., 10 for NB and MB, and 16 for WB, and let pred_Q8[k] be the weight for the k'th coefficient selected by this process for 0 <= k < d_LPC-1. Then, the stage-2 residual for each coefficient is computed via

使用在silk_NLSF_resident_dequant()(NLSF_decode.c)中实现的过程撤销预测,如下所示。每个系数根据阶段1索引I1从两个列表中选择其预测权重。表21给出了NB和MB各系数的选择,表22给出了WB的选择。设d_LPC为码本的顺序,即10表示NB和MB,16表示WB,并设pred_Q8[k]为该过程为0<=k<d_LPC-1选择的第k个系数的权重。然后,通过以下公式计算每个系数的第2阶段残差:

       res_Q10[k] = (k+1 < d_LPC ? (res_Q10[k+1]*pred_Q8[k])>>8 : 0)
                    + ((((I2[k]<<10) - sign(I2[k])*102)*qstep)>>16) ,
        
       res_Q10[k] = (k+1 < d_LPC ? (res_Q10[k+1]*pred_Q8[k])>>8 : 0)
                    + ((((I2[k]<<10) - sign(I2[k])*102)*qstep)>>16) ,
        

where qstep is the Q16 quantization step size, which is 11796 for NB and MB and 9830 for WB (representing step sizes of approximately 0.18 and 0.15, respectively).

其中qstep是Q16量化步长,对于NB和MB为11796,对于WB为9830(分别表示约0.18和0.15的步长)。

                        +----+-------------------+
                        | I1 | Coefficient       |
                        +----+-------------------+
                        |    | 0 1 2 3 4 5 6 7 8 |
                        |    |                   |
                        | 0  | A B A A A A A A A |
                        |    |                   |
                        | 1  | B A A A A A A A A |
                        |    |                   |
                        | 2  | A A A A A A A A A |
                        |    |                   |
                        | 3  | B B B A A A A B A |
                        |    |                   |
                        | 4  | A B A A A A A A A |
                        |    |                   |
                        | 5  | A B A A A A A A A |
                        |    |                   |
                        | 6  | B A B B A A A B A |
                        |    |                   |
                        | 7  | A B B A A B B A A |
                        |    |                   |
                        | 8  | A A B B A B A B B |
                        |    |                   |
                        | 9  | A A B B A A B B B |
                        |    |                   |
                        | 10 | A A A A A A A A A |
                        |    |                   |
                        | 11 | A B A B B B B B A |
                        |    |                   |
                        | 12 | A B A B B B B B A |
                        |    |                   |
                        | 13 | A B B B B B B B A |
                        |    |                   |
                        | 14 | B A B B A B B B B |
                        |    |                   |
                        | 15 | A B B B B B A B A |
                        |    |                   |
                        | 16 | A A B B A B A B A |
                        |    |                   |
                        | 17 | A A B B B A B B B |
                        |    |                   |
                        | 18 | A B B A A B B B A |
                        |    |                   |
                        | 19 | A A A B B B A B A |
        
                        +----+-------------------+
                        | I1 | Coefficient       |
                        +----+-------------------+
                        |    | 0 1 2 3 4 5 6 7 8 |
                        |    |                   |
                        | 0  | A B A A A A A A A |
                        |    |                   |
                        | 1  | B A A A A A A A A |
                        |    |                   |
                        | 2  | A A A A A A A A A |
                        |    |                   |
                        | 3  | B B B A A A A B A |
                        |    |                   |
                        | 4  | A B A A A A A A A |
                        |    |                   |
                        | 5  | A B A A A A A A A |
                        |    |                   |
                        | 6  | B A B B A A A B A |
                        |    |                   |
                        | 7  | A B B A A B B A A |
                        |    |                   |
                        | 8  | A A B B A B A B B |
                        |    |                   |
                        | 9  | A A B B A A B B B |
                        |    |                   |
                        | 10 | A A A A A A A A A |
                        |    |                   |
                        | 11 | A B A B B B B B A |
                        |    |                   |
                        | 12 | A B A B B B B B A |
                        |    |                   |
                        | 13 | A B B B B B B B A |
                        |    |                   |
                        | 14 | B A B B A B B B B |
                        |    |                   |
                        | 15 | A B B B B B A B A |
                        |    |                   |
                        | 16 | A A B B A B A B A |
                        |    |                   |
                        | 17 | A A B B B A B B B |
                        |    |                   |
                        | 18 | A B B A A B B B A |
                        |    |                   |
                        | 19 | A A A B B B A B A |
        
                        |    |                   |
                        | 20 | A B B A A B A B A |
                        |    |                   |
                        | 21 | A B B A A A B B A |
                        |    |                   |
                        | 22 | A A A A A B B B B |
                        |    |                   |
                        | 23 | A A B B A A A B B |
                        |    |                   |
                        | 24 | A A A B A B B B B |
                        |    |                   |
                        | 25 | A B B B B B B B A |
                        |    |                   |
                        | 26 | A A A A A A A A A |
                        |    |                   |
                        | 27 | A A A A A A A A A |
                        |    |                   |
                        | 28 | A A B A B B A B A |
                        |    |                   |
                        | 29 | B A A B A A A A A |
                        |    |                   |
                        | 30 | A A A B B A B A B |
                        |    |                   |
                        | 31 | B A B B A B B B B |
                        +----+-------------------+
        
                        |    |                   |
                        | 20 | A B B A A B A B A |
                        |    |                   |
                        | 21 | A B B A A A B B A |
                        |    |                   |
                        | 22 | A A A A A B B B B |
                        |    |                   |
                        | 23 | A A B B A A A B B |
                        |    |                   |
                        | 24 | A A A B A B B B B |
                        |    |                   |
                        | 25 | A B B B B B B B A |
                        |    |                   |
                        | 26 | A A A A A A A A A |
                        |    |                   |
                        | 27 | A A A A A A A A A |
                        |    |                   |
                        | 28 | A A B A B B A B A |
                        |    |                   |
                        | 29 | B A A B A A A A A |
                        |    |                   |
                        | 30 | A A A B B A B A B |
                        |    |                   |
                        | 31 | B A B B A B B B B |
                        +----+-------------------+
        

Table 21: Prediction Weight Selection for NB/MB Normalized LSF Decoding

表21:NB/MB归一化LSF解码的预测权重选择

           +----+---------------------------------------------+
           | I1 | Coefficient                                 |
           +----+---------------------------------------------+
           |    | 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 |
           |    |                                             |
           | 0  | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 1  | C  C  C  C  C  C  C  C  C  C  C  C  C  C  C |
           |    |                                             |
           | 2  | C  C  D  C  C  D  D  D  C  D  D  D  D  C  C |
           |    |                                             |
           | 3  | C  C  C  C  C  C  C  C  C  C  C  C  D  C  C |
           |    |                                             |
           | 4  | C  D  D  C  D  C  D  D  C  D  D  D  D  D  C |
           |    |                                             |
           | 5  | C  C  D  C  C  C  C  C  C  C  C  C  C  C  C |
        
           +----+---------------------------------------------+
           | I1 | Coefficient                                 |
           +----+---------------------------------------------+
           |    | 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 |
           |    |                                             |
           | 0  | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 1  | C  C  C  C  C  C  C  C  C  C  C  C  C  C  C |
           |    |                                             |
           | 2  | C  C  D  C  C  D  D  D  C  D  D  D  D  C  C |
           |    |                                             |
           | 3  | C  C  C  C  C  C  C  C  C  C  C  C  D  C  C |
           |    |                                             |
           | 4  | C  D  D  C  D  C  D  D  C  D  D  D  D  D  C |
           |    |                                             |
           | 5  | C  C  D  C  C  C  C  C  C  C  C  C  C  C  C |
        
           |    |                                             |
           | 6  | D  C  C  C  C  C  C  C  C  C  C  D  C  D  C |
           |    |                                             |
           | 7  | C  D  D  C  C  C  D  C  D  D  D  C  D  C  D |
           |    |                                             |
           | 8  | C  D  C  D  D  C  D  C  D  C  D  D  D  D  D |
           |    |                                             |
           | 9  | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 10 | C  D  C  C  C  C  C  C  C  C  C  C  C  C  C |
           |    |                                             |
           | 11 | C  C  D  C  D  D  D  D  D  D  D  C  D  C  C |
           |    |                                             |
           | 12 | C  C  D  C  C  D  C  D  C  D  C  C  D  C  C |
           |    |                                             |
           | 13 | C  C  C  C  D  D  C  D  C  D  D  D  D  C  C |
           |    |                                             |
           | 14 | C  D  C  C  C  D  D  C  D  D  D  C  D  D  D |
           |    |                                             |
           | 15 | C  C  D  D  C  C  C  C  C  C  C  C  D  D  C |
           |    |                                             |
           | 16 | C  D  D  C  D  C  D  D  D  D  D  C  D  C  C |
           |    |                                             |
           | 17 | C  C  D  C  C  C  C  D  C  C  D  D  D  C  C |
           |    |                                             |
           | 18 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 19 | C  C  C  C  C  C  C  C  C  C  C  C  D  C  C |
           |    |                                             |
           | 20 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  C |
           |    |                                             |
           | 21 | C  D  C  D  C  D  D  C  D  C  D  C  D  D  C |
           |    |                                             |
           | 22 | C  C  D  D  D  D  C  D  D  C  C  D  D  C  C |
           |    |                                             |
           | 23 | C  D  D  C  D  C  D  C  D  C  C  C  C  D  C |
           |    |                                             |
           | 24 | C  C  C  D  D  C  D  C  D  D  D  D  D  D  D |
           |    |                                             |
           | 25 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 26 | C  D  D  C  C  C  D  D  C  C  D  D  D  D  D |
           |    |                                             |
           | 27 | C  C  C  C  C  D  C  D  D  D  D  C  D  D  D |
           |    |                                             |
           | 28 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 29 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
        
           |    |                                             |
           | 6  | D  C  C  C  C  C  C  C  C  C  C  D  C  D  C |
           |    |                                             |
           | 7  | C  D  D  C  C  C  D  C  D  D  D  C  D  C  D |
           |    |                                             |
           | 8  | C  D  C  D  D  C  D  C  D  C  D  D  D  D  D |
           |    |                                             |
           | 9  | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 10 | C  D  C  C  C  C  C  C  C  C  C  C  C  C  C |
           |    |                                             |
           | 11 | C  C  D  C  D  D  D  D  D  D  D  C  D  C  C |
           |    |                                             |
           | 12 | C  C  D  C  C  D  C  D  C  D  C  C  D  C  C |
           |    |                                             |
           | 13 | C  C  C  C  D  D  C  D  C  D  D  D  D  C  C |
           |    |                                             |
           | 14 | C  D  C  C  C  D  D  C  D  D  D  C  D  D  D |
           |    |                                             |
           | 15 | C  C  D  D  C  C  C  C  C  C  C  C  D  D  C |
           |    |                                             |
           | 16 | C  D  D  C  D  C  D  D  D  D  D  C  D  C  C |
           |    |                                             |
           | 17 | C  C  D  C  C  C  C  D  C  C  D  D  D  C  C |
           |    |                                             |
           | 18 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 19 | C  C  C  C  C  C  C  C  C  C  C  C  D  C  C |
           |    |                                             |
           | 20 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  C |
           |    |                                             |
           | 21 | C  D  C  D  C  D  D  C  D  C  D  C  D  D  C |
           |    |                                             |
           | 22 | C  C  D  D  D  D  C  D  D  C  C  D  D  C  C |
           |    |                                             |
           | 23 | C  D  D  C  D  C  D  C  D  C  C  C  C  D  C |
           |    |                                             |
           | 24 | C  C  C  D  D  C  D  C  D  D  D  D  D  D  D |
           |    |                                             |
           | 25 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 26 | C  D  D  C  C  C  D  D  C  C  D  D  D  D  D |
           |    |                                             |
           | 27 | C  C  C  C  C  D  C  D  D  D  D  C  D  D  D |
           |    |                                             |
           | 28 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
           |    |                                             |
           | 29 | C  C  C  C  C  C  C  C  C  C  C  C  C  C  D |
        
           |    |                                             |
           | 30 | D  C  C  C  C  C  C  C  C  C  C  D  C  C  C |
           |    |                                             |
           | 31 | C  C  D  C  C  D  D  D  C  C  D  C  C  D  C |
           +----+---------------------------------------------+
        
           |    |                                             |
           | 30 | D  C  C  C  C  C  C  C  C  C  C  D  C  C  C |
           |    |                                             |
           | 31 | C  C  D  C  C  D  D  D  C  C  D  C  C  D  C |
           +----+---------------------------------------------+
        

Table 22: Prediction Weight Selection for WB Normalized LSF Decoding

表22:WB归一化LSF解码的预测权重选择

4.2.7.5.3. Reconstructing the Normalized LSF Coefficients
4.2.7.5.3. 重构归一化LSF系数

Once the stage-1 index I1 and the stage-2 residual res_Q10[] have been decoded, the final normalized LSF coefficients can be reconstructed.

一旦第一阶段索引I1和第二阶段剩余res_Q10[]已经解码,就可以重构最终的归一化LSF系数。

The spectral distortion introduced by the quantization of each LSF coefficient varies, so the stage-2 residual is weighted accordingly, using the low-complexity Inverse Harmonic Mean Weighting (IHMW) function proposed in [LAROIA-ICASSP]. The weights are derived directly from the stage-1 codebook vector. Let cb1_Q8[k] be the k'th entry of the stage-1 codebook vector from Table 23 or Table 24. Then, for 0 <= k < d_LPC, the following expression computes the square of the weight as a Q18 value:

每个LSF系数的量化引入的频谱失真会发生变化,因此使用[LAROIA-ICASSP]中提出的低复杂度逆谐波平均加权(IHMW)函数对第2阶段残差进行相应加权。权重直接从stage-1码本向量导出。设cb1_Q8[k]为表23或表24中第1阶段码本向量的第k个条目。然后,对于0<=k<d_LPC,以下表达式计算权重的平方作为Q18值:

            w2_Q18[k] = (1024/(cb1_Q8[k] - cb1_Q8[k-1])
                         + 1024/(cb1_Q8[k+1] - cb1_Q8[k])) << 16
        
            w2_Q18[k] = (1024/(cb1_Q8[k] - cb1_Q8[k-1])
                         + 1024/(cb1_Q8[k+1] - cb1_Q8[k])) << 16
        

where cb1_Q8[-1] = 0 and cb1_Q8[d_LPC] = 256, and the division is integer division. This is reduced to an unsquared, Q9 value using the following square-root approximation:

其中,cb1_Q8[-1]=0且cb1_Q8[d_LPC]=256,且除法为整数除法。使用以下平方根近似值将其减小为非平方Q9值:

                 i = ilog(w2_Q18[k])
                 f = (w2_Q18[k]>>(i-8)) & 127
                 y = ((i&1) ? 32768 : 46214) >> ((32-i)>>1)
                 w_Q9[k] = y + ((213*f*y)>>16)
        
                 i = ilog(w2_Q18[k])
                 f = (w2_Q18[k]>>(i-8)) & 127
                 y = ((i&1) ? 32768 : 46214) >> ((32-i)>>1)
                 w_Q9[k] = y + ((213*f*y)>>16)
        

The constant 46214 here is approximately the square root of 2 in Q15. The cb1_Q8[] vector completely determines these weights, and they may be tabulated and stored as 13-bit unsigned values (with a range of 1819 to 5227, inclusive) to avoid computing them when decoding. The reference implementation already requires code to compute these weights on unquantized coefficients in the encoder, in silk_NLSF_VQ_weights_laroia() (NLSF_VQ_weights_laroia.c) and its callers, so it reuses that code in the decoder instead of using a pre-computed table to reduce the amount of ROM required.

这里的常数46214大约是Q15中2的平方根。cb1_Q8[]向量完全确定这些权重,并且可以将它们制成表格并存储为13位无符号值(范围为1819到5227,包括1819到5227),以避免在解码时计算它们。参考实现已经需要代码来计算编码器中未量化系数的这些权重,如silk_NLSF_VQ_weights_laroia()(NLSF_VQ_weights_laroia.c)及其调用者,因此它在解码器中重用该代码,而不是使用预先计算的表来减少所需的ROM量。

              +----+----------------------------------------+
              | I1 | Codebook (Q8)                          |
              +----+----------------------------------------+
              |    |  0   1   2   3   4   5   6   7   8   9 |
              |    |                                        |
              | 0  | 12  35  60  83 108 132 157 180 206 228 |
              |    |                                        |
              | 1  | 15  32  55  77 101 125 151 175 201 225 |
              |    |                                        |
              | 2  | 19  42  66  89 114 137 162 184 209 230 |
              |    |                                        |
              | 3  | 12  25  50  72  97 120 147 172 200 223 |
              |    |                                        |
              | 4  | 26  44  69  90 114 135 159 180 205 225 |
              |    |                                        |
              | 5  | 13  22  53  80 106 130 156 180 205 228 |
              |    |                                        |
              | 6  | 15  25  44  64  90 115 142 168 196 222 |
              |    |                                        |
              | 7  | 19  24  62  82 100 120 145 168 190 214 |
              |    |                                        |
              | 8  | 22  31  50  79 103 120 151 170 203 227 |
              |    |                                        |
              | 9  | 21  29  45  65 106 124 150 171 196 224 |
              |    |                                        |
              | 10 | 30  49  75  97 121 142 165 186 209 229 |
              |    |                                        |
              | 11 | 19  25  52  70  93 116 143 166 192 219 |
              |    |                                        |
              | 12 | 26  34  62  75  97 118 145 167 194 217 |
              |    |                                        |
              | 13 | 25  33  56  70  91 113 143 165 196 223 |
              |    |                                        |
              | 14 | 21  34  51  72  97 117 145 171 196 222 |
              |    |                                        |
              | 15 | 20  29  50  67  90 117 144 168 197 221 |
              |    |                                        |
              | 16 | 22  31  48  66  95 117 146 168 196 222 |
              |    |                                        |
              | 17 | 24  33  51  77 116 134 158 180 200 224 |
              |    |                                        |
              | 18 | 21  28  70  87 106 124 149 170 194 217 |
              |    |                                        |
              | 19 | 26  33  53  64  83 117 152 173 204 225 |
              |    |                                        |
              | 20 | 27  34  65  95 108 129 155 174 210 225 |
              |    |                                        |
              | 21 | 20  26  72  99 113 131 154 176 200 219 |
        
              +----+----------------------------------------+
              | I1 | Codebook (Q8)                          |
              +----+----------------------------------------+
              |    |  0   1   2   3   4   5   6   7   8   9 |
              |    |                                        |
              | 0  | 12  35  60  83 108 132 157 180 206 228 |
              |    |                                        |
              | 1  | 15  32  55  77 101 125 151 175 201 225 |
              |    |                                        |
              | 2  | 19  42  66  89 114 137 162 184 209 230 |
              |    |                                        |
              | 3  | 12  25  50  72  97 120 147 172 200 223 |
              |    |                                        |
              | 4  | 26  44  69  90 114 135 159 180 205 225 |
              |    |                                        |
              | 5  | 13  22  53  80 106 130 156 180 205 228 |
              |    |                                        |
              | 6  | 15  25  44  64  90 115 142 168 196 222 |
              |    |                                        |
              | 7  | 19  24  62  82 100 120 145 168 190 214 |
              |    |                                        |
              | 8  | 22  31  50  79 103 120 151 170 203 227 |
              |    |                                        |
              | 9  | 21  29  45  65 106 124 150 171 196 224 |
              |    |                                        |
              | 10 | 30  49  75  97 121 142 165 186 209 229 |
              |    |                                        |
              | 11 | 19  25  52  70  93 116 143 166 192 219 |
              |    |                                        |
              | 12 | 26  34  62  75  97 118 145 167 194 217 |
              |    |                                        |
              | 13 | 25  33  56  70  91 113 143 165 196 223 |
              |    |                                        |
              | 14 | 21  34  51  72  97 117 145 171 196 222 |
              |    |                                        |
              | 15 | 20  29  50  67  90 117 144 168 197 221 |
              |    |                                        |
              | 16 | 22  31  48  66  95 117 146 168 196 222 |
              |    |                                        |
              | 17 | 24  33  51  77 116 134 158 180 200 224 |
              |    |                                        |
              | 18 | 21  28  70  87 106 124 149 170 194 217 |
              |    |                                        |
              | 19 | 26  33  53  64  83 117 152 173 204 225 |
              |    |                                        |
              | 20 | 27  34  65  95 108 129 155 174 210 225 |
              |    |                                        |
              | 21 | 20  26  72  99 113 131 154 176 200 219 |
        
              |    |                                        |
              | 22 | 34  43  61  78  93 114 155 177 205 229 |
              |    |                                        |
              | 23 | 23  29  54  97 124 138 163 179 209 229 |
              |    |                                        |
              | 24 | 30  38  56  89 118 129 158 178 200 231 |
              |    |                                        |
              | 25 | 21  29  49  63  85 111 142 163 193 222 |
              |    |                                        |
              | 26 | 27  48  77 103 133 158 179 196 215 232 |
              |    |                                        |
              | 27 | 29  47  74  99 124 151 176 198 220 237 |
              |    |                                        |
              | 28 | 33  42  61  76  93 121 155 174 207 225 |
              |    |                                        |
              | 29 | 29  53  87 112 136 154 170 188 208 227 |
              |    |                                        |
              | 30 | 24  30  52  84 131 150 166 186 203 229 |
              |    |                                        |
              | 31 | 37  48  64  84 104 118 156 177 201 230 |
              +----+----------------------------------------+
        
              |    |                                        |
              | 22 | 34  43  61  78  93 114 155 177 205 229 |
              |    |                                        |
              | 23 | 23  29  54  97 124 138 163 179 209 229 |
              |    |                                        |
              | 24 | 30  38  56  89 118 129 158 178 200 231 |
              |    |                                        |
              | 25 | 21  29  49  63  85 111 142 163 193 222 |
              |    |                                        |
              | 26 | 27  48  77 103 133 158 179 196 215 232 |
              |    |                                        |
              | 27 | 29  47  74  99 124 151 176 198 220 237 |
              |    |                                        |
              | 28 | 33  42  61  76  93 121 155 174 207 225 |
              |    |                                        |
              | 29 | 29  53  87 112 136 154 170 188 208 227 |
              |    |                                        |
              | 30 | 24  30  52  84 131 150 166 186 203 229 |
              |    |                                        |
              | 31 | 37  48  64  84 104 118 156 177 201 230 |
              +----+----------------------------------------+
        

Table 23: NB/MB Normalized LSF Stage-1 Codebook Vectors

表23:NB/MB归一化LSF阶段1码本向量

    +----+------------------------------------------------------------+
    | I1 | Codebook (Q8)                                              |
    +----+------------------------------------------------------------+
    |    |  0  1  2  3  4   5   6   7   8   9  10  11  12  13  14  15 |
    |    |                                                            |
    | 0  |  7 23 38 54 69  85 100 116 131 147 162 178 193 208 223 239 |
    |    |                                                            |
    | 1  | 13 25 41 55 69  83  98 112 127 142 157 171 187 203 220 236 |
    |    |                                                            |
    | 2  | 15 21 34 51 61  78  92 106 126 136 152 167 185 205 225 240 |
    |    |                                                            |
    | 3  | 10 21 36 50 63  79  95 110 126 141 157 173 189 205 221 237 |
    |    |                                                            |
    | 4  | 17 20 37 51 59  78  89 107 123 134 150 164 184 205 224 240 |
    |    |                                                            |
    | 5  | 10 15 32 51 67  81  96 112 129 142 158 173 189 204 220 236 |
    |    |                                                            |
    | 6  |  8 21 37 51 65  79  98 113 126 138 155 168 179 192 209 218 |
    |    |                                                            |
    | 7  | 12 15 34 55 63  78  87 108 118 131 148 167 185 203 219 236 |
    |    |                                                            |
    | 8  | 16 19 32 36 56  79  91 108 118 136 154 171 186 204 220 237 |
    |    |                                                            |
    | 9  | 11 28 43 58 74  89 105 120 135 150 165 180 196 211 226 241 |
        
    +----+------------------------------------------------------------+
    | I1 | Codebook (Q8)                                              |
    +----+------------------------------------------------------------+
    |    |  0  1  2  3  4   5   6   7   8   9  10  11  12  13  14  15 |
    |    |                                                            |
    | 0  |  7 23 38 54 69  85 100 116 131 147 162 178 193 208 223 239 |
    |    |                                                            |
    | 1  | 13 25 41 55 69  83  98 112 127 142 157 171 187 203 220 236 |
    |    |                                                            |
    | 2  | 15 21 34 51 61  78  92 106 126 136 152 167 185 205 225 240 |
    |    |                                                            |
    | 3  | 10 21 36 50 63  79  95 110 126 141 157 173 189 205 221 237 |
    |    |                                                            |
    | 4  | 17 20 37 51 59  78  89 107 123 134 150 164 184 205 224 240 |
    |    |                                                            |
    | 5  | 10 15 32 51 67  81  96 112 129 142 158 173 189 204 220 236 |
    |    |                                                            |
    | 6  |  8 21 37 51 65  79  98 113 126 138 155 168 179 192 209 218 |
    |    |                                                            |
    | 7  | 12 15 34 55 63  78  87 108 118 131 148 167 185 203 219 236 |
    |    |                                                            |
    | 8  | 16 19 32 36 56  79  91 108 118 136 154 171 186 204 220 237 |
    |    |                                                            |
    | 9  | 11 28 43 58 74  89 105 120 135 150 165 180 196 211 226 241 |
        
    |    |                                                            |
    | 10 |  6 16 33 46 60  75  92 107 123 137 156 169 185 199 214 225 |
    |    |                                                            |
    | 11 | 11 19 30 44 57  74  89 105 121 135 152 169 186 202 218 234 |
    |    |                                                            |
    | 12 | 12 19 29 46 57  71  88 100 120 132 148 165 182 199 216 233 |
    |    |                                                            |
    | 13 | 17 23 35 46 56  77  92 106 123 134 152 167 185 204 222 237 |
    |    |                                                            |
    | 14 | 14 17 45 53 63  75  89 107 115 132 151 171 188 206 221 240 |
    |    |                                                            |
    | 15 |  9 16 29 40 56  71  88 103 119 137 154 171 189 205 222 237 |
    |    |                                                            |
    | 16 | 16 19 36 48 57  76  87 105 118 132 150 167 185 202 218 236 |
    |    |                                                            |
    | 17 | 12 17 29 54 71  81  94 104 126 136 149 164 182 201 221 237 |
    |    |                                                            |
    | 18 | 15 28 47 62 79  97 115 129 142 155 168 180 194 208 223 238 |
    |    |                                                            |
    | 19 |  8 14 30 45 62  78  94 111 127 143 159 175 192 207 223 239 |
    |    |                                                            |
    | 20 | 17 30 49 62 79  92 107 119 132 145 160 174 190 204 220 235 |
    |    |                                                            |
    | 21 | 14 19 36 45 61  76  91 108 121 138 154 172 189 205 222 238 |
    |    |                                                            |
    | 22 | 12 18 31 45 60  76  91 107 123 138 154 171 187 204 221 236 |
    |    |                                                            |
    | 23 | 13 17 31 43 53  70  83 103 114 131 149 167 185 203 220 237 |
    |    |                                                            |
    | 24 | 17 22 35 42 58  78  93 110 125 139 155 170 188 206 224 240 |
    |    |                                                            |
    | 25 |  8 15 34 50 67  83  99 115 131 146 162 178 193 209 224 239 |
    |    |                                                            |
    | 26 | 13 16 41 66 73  86  95 111 128 137 150 163 183 206 225 241 |
    |    |                                                            |
    | 27 | 17 25 37 52 63  75  92 102 119 132 144 160 175 191 212 231 |
    |    |                                                            |
    | 28 | 19 31 49 65 83 100 117 133 147 161 174 187 200 213 227 242 |
    |    |                                                            |
    | 29 | 18 31 52 68 88 103 117 126 138 149 163 177 192 207 223 239 |
    |    |                                                            |
    | 30 | 16 29 47 61 76  90 106 119 133 147 161 176 193 209 224 240 |
    |    |                                                            |
    | 31 | 15 21 35 50 61  73  86  97 110 119 129 141 175 198 218 237 |
    +----+------------------------------------------------------------+
        
    |    |                                                            |
    | 10 |  6 16 33 46 60  75  92 107 123 137 156 169 185 199 214 225 |
    |    |                                                            |
    | 11 | 11 19 30 44 57  74  89 105 121 135 152 169 186 202 218 234 |
    |    |                                                            |
    | 12 | 12 19 29 46 57  71  88 100 120 132 148 165 182 199 216 233 |
    |    |                                                            |
    | 13 | 17 23 35 46 56  77  92 106 123 134 152 167 185 204 222 237 |
    |    |                                                            |
    | 14 | 14 17 45 53 63  75  89 107 115 132 151 171 188 206 221 240 |
    |    |                                                            |
    | 15 |  9 16 29 40 56  71  88 103 119 137 154 171 189 205 222 237 |
    |    |                                                            |
    | 16 | 16 19 36 48 57  76  87 105 118 132 150 167 185 202 218 236 |
    |    |                                                            |
    | 17 | 12 17 29 54 71  81  94 104 126 136 149 164 182 201 221 237 |
    |    |                                                            |
    | 18 | 15 28 47 62 79  97 115 129 142 155 168 180 194 208 223 238 |
    |    |                                                            |
    | 19 |  8 14 30 45 62  78  94 111 127 143 159 175 192 207 223 239 |
    |    |                                                            |
    | 20 | 17 30 49 62 79  92 107 119 132 145 160 174 190 204 220 235 |
    |    |                                                            |
    | 21 | 14 19 36 45 61  76  91 108 121 138 154 172 189 205 222 238 |
    |    |                                                            |
    | 22 | 12 18 31 45 60  76  91 107 123 138 154 171 187 204 221 236 |
    |    |                                                            |
    | 23 | 13 17 31 43 53  70  83 103 114 131 149 167 185 203 220 237 |
    |    |                                                            |
    | 24 | 17 22 35 42 58  78  93 110 125 139 155 170 188 206 224 240 |
    |    |                                                            |
    | 25 |  8 15 34 50 67  83  99 115 131 146 162 178 193 209 224 239 |
    |    |                                                            |
    | 26 | 13 16 41 66 73  86  95 111 128 137 150 163 183 206 225 241 |
    |    |                                                            |
    | 27 | 17 25 37 52 63  75  92 102 119 132 144 160 175 191 212 231 |
    |    |                                                            |
    | 28 | 19 31 49 65 83 100 117 133 147 161 174 187 200 213 227 242 |
    |    |                                                            |
    | 29 | 18 31 52 68 88 103 117 126 138 149 163 177 192 207 223 239 |
    |    |                                                            |
    | 30 | 16 29 47 61 76  90 106 119 133 147 161 176 193 209 224 240 |
    |    |                                                            |
    | 31 | 15 21 35 50 61  73  86  97 110 119 129 141 175 198 218 237 |
    +----+------------------------------------------------------------+
        

Table 24: WB Normalized LSF Stage-1 Codebook Vectors

表24:WB归一化LSF阶段1码本向量

Given the stage-1 codebook entry cb1_Q8[], the stage-2 residual res_Q10[], and their corresponding weights, w_Q9[], the reconstructed normalized LSF coefficients are

给定第1阶段码本条目cb1_Q8[],第2阶段剩余res_Q10[],及其相应的权重w_Q9[],重构的归一化LSF系数如下:

      NLSF_Q15[k] = clamp(0,
                     (cb1_Q8[k]<<7) + (res_Q10[k]<<14)/w_Q9[k], 32767)
        
      NLSF_Q15[k] = clamp(0,
                     (cb1_Q8[k]<<7) + (res_Q10[k]<<14)/w_Q9[k], 32767)
        

where the division is integer division. However, nothing in either the reconstruction process or the quantization process in the encoder thus far guarantees that the coefficients are monotonically increasing and separated well enough to ensure a stable filter [KABAL86]. When using the reference encoder, roughly 2% of frames violate this constraint. The next section describes a stabilization procedure used to make these guarantees.

其中除法为整数除法。然而,到目前为止,编码器中的重建过程或量化过程都不能保证系数是单调增加的,并且分离得足够好,以确保稳定的滤波器[KABAL86]。使用参考编码器时,大约2%的帧违反此约束。下一节描述了用于进行这些保证的稳定程序。

4.2.7.5.4. Normalized LSF Stabilization
4.2.7.5.4. 归一化LSF稳定化

The normalized LSF stabilization procedure is implemented in silk_NLSF_stabilize() (NLSF_stabilize.c). This process ensures that consecutive values of the normalized LSF coefficients, NLSF_Q15[], are spaced some minimum distance apart (predetermined to be the 0.01 percentile of a large training set). Table 25 gives the minimum spacings for NB and MB and those for WB, where row k is the minimum allowed value of NLSF_Q15[k]-NLSF_Q15[k-1]. For the purposes of computing this spacing for the first and last coefficient, NLSF_Q15[-1] is taken to be 0 and NLSF_Q15[d_LPC] is taken to be 32768.

规范化LSF稳定程序在silk_NLSF_stabilize()(NLSF_stabilize.c)中实现。该过程确保归一化LSF系数的连续值NLSF_Q15[]间隔一定的最小距离(预定为大型训练集的0.01百分位)。表25给出了NB和MB以及WB的最小间距,其中k行是NLSF_Q15[k]-NLSF_Q15[k-1]的最小允许值。为了计算第一个和最后一个系数的间距,NLSF_Q15[-1]取为0,NLSF_Q15[d_LPC]取为32768。

                     +-------------+-----------+-----+
                     | Coefficient | NB and MB |  WB |
                     +-------------+-----------+-----+
                     | 0           |       250 | 100 |
                     |             |           |     |
                     | 1           |         3 |   3 |
                     |             |           |     |
                     | 2           |         6 |  40 |
                     |             |           |     |
                     | 3           |         3 |   3 |
                     |             |           |     |
                     | 4           |         3 |   3 |
                     |             |           |     |
                     | 5           |         3 |   3 |
                     |             |           |     |
                     | 6           |         4 |   5 |
                     |             |           |     |
                     | 7           |         3 |  14 |
                     |             |           |     |
                     | 8           |         3 |  14 |
                     |             |           |     |
                     | 9           |         3 |  10 |
                     |             |           |     |
                     | 10          |       461 |  11 |
                     |             |           |     |
                     | 11          |           |   3 |
                     |             |           |     |
                     | 12          |           |   8 |
                     |             |           |     |
                     | 13          |           |   9 |
                     |             |           |     |
                     | 14          |           |   7 |
                     |             |           |     |
                     | 15          |           |   3 |
                     |             |           |     |
                     | 16          |           | 347 |
                     +-------------+-----------+-----+
        
                     +-------------+-----------+-----+
                     | Coefficient | NB and MB |  WB |
                     +-------------+-----------+-----+
                     | 0           |       250 | 100 |
                     |             |           |     |
                     | 1           |         3 |   3 |
                     |             |           |     |
                     | 2           |         6 |  40 |
                     |             |           |     |
                     | 3           |         3 |   3 |
                     |             |           |     |
                     | 4           |         3 |   3 |
                     |             |           |     |
                     | 5           |         3 |   3 |
                     |             |           |     |
                     | 6           |         4 |   5 |
                     |             |           |     |
                     | 7           |         3 |  14 |
                     |             |           |     |
                     | 8           |         3 |  14 |
                     |             |           |     |
                     | 9           |         3 |  10 |
                     |             |           |     |
                     | 10          |       461 |  11 |
                     |             |           |     |
                     | 11          |           |   3 |
                     |             |           |     |
                     | 12          |           |   8 |
                     |             |           |     |
                     | 13          |           |   9 |
                     |             |           |     |
                     | 14          |           |   7 |
                     |             |           |     |
                     | 15          |           |   3 |
                     |             |           |     |
                     | 16          |           | 347 |
                     +-------------+-----------+-----+
        

Table 25: Minimum Spacing for Normalized LSF Coefficients

表25:归一化LSF系数的最小间距

The procedure starts off by trying to make small adjustments that attempt to minimize the amount of distortion introduced. After 20 such adjustments, it falls back to a more direct method that guarantees the constraints are enforced but may require large adjustments.

该程序首先尝试进行小的调整,以尽量减少引入的失真量。经过20次这样的调整后,它会退回到一种更直接的方法,这种方法可以确保约束得到实施,但可能需要进行大量调整。

Let NDeltaMin_Q15[k] be the minimum required spacing for the current audio bandwidth from Table 25. First, the procedure finds the index i where NLSF_Q15[i] - NLSF_Q15[i-1] - NDeltaMin_Q15[i] is the smallest, breaking ties by using the lower value of i. If this value is non-negative, then the stabilization stops; the coefficients satisfy all the constraints. Otherwise, if i == 0, it sets NLSF_Q15[0] to NDeltaMin_Q15[0], and if i == d_LPC, it sets NLSF_Q15[d_LPC-1] to (32768 - NDeltaMin_Q15[d_LPC]). For all other values of i, both NLSF_Q15[i-1] and NLSF_Q15[i] are updated as follows:

设NDeltaMin_Q15[k]为表25中当前音频带宽所需的最小间距。首先,该程序找到指数i,其中NLSF_Q15[i]-NLSF_Q15[i-1]-NDeltaMin_Q15[i]是最小的,通过使用较低的i值打破联系。如果该值为非负,则稳定停止;系数满足所有约束条件。否则,如果i==0,则将NLSF_Q15[0]设置为NDeltaMin_Q15[0],如果i==d_LPC,则将NLSF_Q15[d_LPC-1]设置为(32768-NDeltaMin_Q15[d_LPC])。对于i的所有其他值,NLSF_Q15[i-1]和NLSF_Q15[i]更新如下:

                                             i-1
                                             __
    min_center_Q15 = (NDeltaMin_Q15[i]>>1) + \  NDeltaMin_Q15[k]
                                             /_
                                             k=0
                                                    d_LPC
                                                     __
    max_center_Q15 = 32768 - (NDeltaMin_Q15[i]>>1) - \  NDeltaMin_Q15[k]
                                                     /_
                                                    k=i+1
   center_freq_Q15 = clamp(min_center_Q15[i],
                           (NLSF_Q15[i-1] + NLSF_Q15[i] + 1)>>1
                           max_center_Q15[i])
        
                                             i-1
                                             __
    min_center_Q15 = (NDeltaMin_Q15[i]>>1) + \  NDeltaMin_Q15[k]
                                             /_
                                             k=0
                                                    d_LPC
                                                     __
    max_center_Q15 = 32768 - (NDeltaMin_Q15[i]>>1) - \  NDeltaMin_Q15[k]
                                                     /_
                                                    k=i+1
   center_freq_Q15 = clamp(min_center_Q15[i],
                           (NLSF_Q15[i-1] + NLSF_Q15[i] + 1)>>1
                           max_center_Q15[i])
        
    NLSF_Q15[i-1] = center_freq_Q15 - (NDeltaMin_Q15[i]>>1)
        
    NLSF_Q15[i-1] = center_freq_Q15 - (NDeltaMin_Q15[i]>>1)
        

NLSF_Q15[i] = NLSF_Q15[i-1] + NDeltaMin_Q15[i]

NLSF_Q15[i]=NLSF_Q15[i-1]+NDeltaMin_Q15[i]

Then, the procedure repeats again, until it has either executed 20 times or stopped because the coefficients satisfy all the constraints.

然后,该过程再次重复,直到执行了20次,或者因为系数满足所有约束而停止。

After the 20th repetition of the above procedure, the following fallback procedure executes once. First, the values of NLSF_Q15[k] for 0 <= k < d_LPC are sorted in ascending order. Then, for each value of k from 0 to d_LPC-1, NLSF_Q15[k] is set to

重复上述过程20次后,将执行一次以下回退过程。首先,0<=k<d_LPC的NLSF_Q15[k]值按升序排序。然后,对于从0到d_LPC-1的k的每个值,将NLSF_Q15[k]设置为

max(NLSF_Q15[k], NLSF_Q15[k-1] + NDeltaMin_Q15[k])

最大值(NLSF_Q15[k],NLSF_Q15[k-1]+NDeltaMin_Q15[k])

Next, for each value of k from d_LPC-1 down to 0, NLSF_Q15[k] is set to

接下来,对于从d_LPC-1到0的k的每个值,NLSF_Q15[k]被设置为

            min(NLSF_Q15[k], NLSF_Q15[k+1] - NDeltaMin_Q15[k+1])
        
            min(NLSF_Q15[k], NLSF_Q15[k+1] - NDeltaMin_Q15[k+1])
        

There is no need to check if the coefficients satisfy all the constraints before applying this fallback procedure. If they do, then it will not change their values.

在应用此回退程序之前,无需检查系数是否满足所有约束。如果他们这样做,那么它不会改变他们的值。

4.2.7.5.5. Normalized LSF Interpolation
4.2.7.5.5. 归一化LSF插值

For 20 ms SILK frames, the first half of the frame (i.e., the first two subframes) may use normalized LSF coefficients that are interpolated between the decoded LSFs for the most recent coded frame (in the same channel) and the current frame. A Q2 interpolation factor follows the LSF coefficient indices in the bitstream, which is decoded using the PDF in Table 26. This happens in silk_decode_indices() (decode_indices.c). After either

对于20ms丝绸帧,帧的前半部分(即,前两个子帧)可以使用归一化LSF系数,该归一化LSF系数在最近编码帧(在同一信道中)的解码LSF和当前帧之间内插。Q2插值因子跟随比特流中的LSF系数索引,该系数索引使用表26中的PDF进行解码。这发生在silk_decode_index()中(decode_index.c)。之后

o An uncoded regular SILK frame in the side channel, or

o 侧槽中未编码的常规丝绸框架,或

o A decoder reset (see Section 4.5.2),

o 解码器复位(见第4.5.2节),

the decoder still decodes this factor, but ignores its value and always uses 4 instead. For 10 ms SILK frames, this factor is not stored at all.

解码器仍然解码该因子,但忽略其值,始终使用4代替。对于10毫秒的真丝框架,根本不存储该系数。

                       +---------------------------+
                       | PDF                       |
                       +---------------------------+
                       | {13, 22, 29, 11, 181}/256 |
                       +---------------------------+
        
                       +---------------------------+
                       | PDF                       |
                       +---------------------------+
                       | {13, 22, 29, 11, 181}/256 |
                       +---------------------------+
        

Table 26: PDF for Normalized LSF Interpolation Index

表26:规范化LSF插值指数的PDF

Let n2_Q15[k] be the normalized LSF coefficients decoded by the procedure in Section 4.2.7.5, n0_Q15[k] be the LSF coefficients decoded for the prior frame, and w_Q2 be the interpolation factor. Then, the normalized LSF coefficients used for the first half of a 20 ms frame, n1_Q15[k], are

设n2_Q15[k]为第4.2.7.5节中程序解码的归一化LSF系数,n0_Q15[k]为前一帧解码的LSF系数,w_Q2为插值因子。然后,计算用于20ms帧的前半部分的归一化LSF系数n1_Q15[k]

        n1_Q15[k] = n0_Q15[k] + (w_Q2*(n2_Q15[k] - n0_Q15[k]) >> 2)
        
        n1_Q15[k] = n0_Q15[k] + (w_Q2*(n2_Q15[k] - n0_Q15[k]) >> 2)
        

This interpolation is performed in silk_decode_parameters() (decode_parameters.c).

此插值在silk_decode_parameters()中执行(decode_parameters.c)。

4.2.7.5.6. Converting Normalized LSFs to LPC Coefficients
4.2.7.5.6. 将归一化LSF转换为LPC系数

Any LPC filter A(z) can be split into a symmetric part P(z) and an anti-symmetric part Q(z) such that

任何LPC滤波器A(z)都可以分为对称部分P(z)和反对称部分Q(z),以便

                          d_LPC
                           __         -k   1
                A(z) = 1 - \  a[k] * z   = - * (P(z) + Q(z))
                           /_              2
                           k=1
        
                          d_LPC
                           __         -k   1
                A(z) = 1 - \  a[k] * z   = - * (P(z) + Q(z))
                           /_              2
                           k=1
        

with

具有

                                     -d_LPC-1      -1
                      P(z) = A(z) + z         * A(z  )
        
                                     -d_LPC-1      -1
                      P(z) = A(z) + z         * A(z  )
        
                                     -d_LPC-1      -1
                      Q(z) = A(z) - z         * A(z  )
        
                                     -d_LPC-1      -1
                      Q(z) = A(z) - z         * A(z  )
        

The even normalized LSF coefficients correspond to a pair of conjugate roots of P(z), while the odd coefficients correspond to a pair of conjugate roots of Q(z), all of which lie on the unit circle. In addition, P(z) has a root at pi and Q(z) has a root at 0. Thus, they may be reconstructed mathematically from a set of normalized LSF coefficients, n[k], as

偶数归一化LSF系数对应于P(z)的一对共轭根,而奇数系数对应于Q(z)的一对共轭根,它们都位于单位圆上。此外,P(z)在pi处有根,Q(z)在0处有根。因此,它们可以从一组归一化LSF系数n[k]进行数学重构,如下所示:

                          d_LPC/2-1
                      -1     ___                        -1    -2
         P(z) = (1 + z  ) *  | |  (1 - 2*cos(pi*n[2*k])*z  + z  )
                             k=0
        
                          d_LPC/2-1
                      -1     ___                        -1    -2
         P(z) = (1 + z  ) *  | |  (1 - 2*cos(pi*n[2*k])*z  + z  )
                             k=0
        
                          d_LPC/2-1
                      -1     ___                          -1    -2
         Q(z) = (1 - z  ) *  | |  (1 - 2*cos(pi*n[2*k+1])*z  + z  )
                             k=0
        
                          d_LPC/2-1
                      -1     ___                          -1    -2
         Q(z) = (1 - z  ) *  | |  (1 - 2*cos(pi*n[2*k+1])*z  + z  )
                             k=0
        

However, SILK performs this reconstruction using a fixed-point approximation so that all decoders can reproduce it in a bit-exact manner to avoid prediction drift. The function silk_NLSF2A() (NLSF2A.c) implements this procedure.

然而,SILK使用定点近似来执行此重建,因此所有解码器都可以以位精确的方式再现它,以避免预测漂移。函数silk_NLSF2A()(NLSF2A.c)实现此过程。

To start, it approximates cos(pi*n[k]) using a table lookup with linear interpolation. The encoder SHOULD use the inverse of this piecewise linear approximation, rather than the true inverse of the cosine function, when deriving the normalized LSF coefficients. These values are also re-ordered to improve numerical accuracy when constructing the LPC polynomials.

首先,它使用带有线性插值的表格查找来近似cos(pi*n[k])。在推导归一化LSF系数时,编码器应使用此分段线性近似的逆,而不是余弦函数的真逆。在构造LPC多项式时,这些值也被重新排序以提高数值精度。

                     +-------------+-----------+----+
                     | Coefficient | NB and MB | WB |
                     +-------------+-----------+----+
                     | 0           |         0 |  0 |
                     |             |           |    |
                     | 1           |         9 | 15 |
                     |             |           |    |
                     | 2           |         6 |  8 |
                     |             |           |    |
                     | 3           |         3 |  7 |
                     |             |           |    |
                     | 4           |         4 |  4 |
                     |             |           |    |
                     | 5           |         5 | 11 |
                     |             |           |    |
                     | 6           |         8 | 12 |
                     |             |           |    |
                     | 7           |         1 |  3 |
                     |             |           |    |
                     | 8           |         2 |  2 |
                     |             |           |    |
                     | 9           |         7 | 13 |
                     |             |           |    |
                     | 10          |           | 10 |
                     |             |           |    |
                     | 11          |           |  5 |
                     |             |           |    |
                     | 12          |           |  6 |
                     |             |           |    |
                     | 13          |           |  9 |
                     |             |           |    |
                     | 14          |           | 14 |
                     |             |           |    |
                     | 15          |           |  1 |
                     +-------------+-----------+----+
        
                     +-------------+-----------+----+
                     | Coefficient | NB and MB | WB |
                     +-------------+-----------+----+
                     | 0           |         0 |  0 |
                     |             |           |    |
                     | 1           |         9 | 15 |
                     |             |           |    |
                     | 2           |         6 |  8 |
                     |             |           |    |
                     | 3           |         3 |  7 |
                     |             |           |    |
                     | 4           |         4 |  4 |
                     |             |           |    |
                     | 5           |         5 | 11 |
                     |             |           |    |
                     | 6           |         8 | 12 |
                     |             |           |    |
                     | 7           |         1 |  3 |
                     |             |           |    |
                     | 8           |         2 |  2 |
                     |             |           |    |
                     | 9           |         7 | 13 |
                     |             |           |    |
                     | 10          |           | 10 |
                     |             |           |    |
                     | 11          |           |  5 |
                     |             |           |    |
                     | 12          |           |  6 |
                     |             |           |    |
                     | 13          |           |  9 |
                     |             |           |    |
                     | 14          |           | 14 |
                     |             |           |    |
                     | 15          |           |  1 |
                     +-------------+-----------+----+
        

Table 27: LSF Ordering for Polynomial Evaluation

表27:多项式评估的LSF排序

   The top 7 bits of each normalized LSF coefficient index a value in
   the table, and the next 8 bits interpolate between it and the next
   value.  Let i = (n[k] >> 8) be the integer index and f = (n[k] & 255)
   be the fractional part of a given coefficient.  Then, the re-ordered,
   approximated cosine, c_Q17[ordering[k]], is
        
   The top 7 bits of each normalized LSF coefficient index a value in
   the table, and the next 8 bits interpolate between it and the next
   value.  Let i = (n[k] >> 8) be the integer index and f = (n[k] & 255)
   be the fractional part of a given coefficient.  Then, the re-ordered,
   approximated cosine, c_Q17[ordering[k]], is
        
       c_Q17[ordering[k]] = (cos_Q12[i]*256
                             + (cos_Q12[i+1]-cos_Q12[i])*f + 4) >> 3
        
       c_Q17[ordering[k]] = (cos_Q12[i]*256
                             + (cos_Q12[i+1]-cos_Q12[i])*f + 4) >> 3
        

where ordering[k] is the k'th entry of the column of Table 27 corresponding to the current audio bandwidth and cos_Q12[i] is the i'th entry of Table 28.

其中,ordering[k]是表27中对应于当前音频带宽的第k个条目,cos_Q12[i]是表28中的第i个条目。

                  +-----+-------+-------+-------+-------+
                  |   i |    +0 |    +1 |    +2 |    +3 |
                  +-----+-------+-------+-------+-------+
                  |   0 |  4096 |  4095 |  4091 |  4085 |
                  |     |       |       |       |       |
                  |   4 |  4076 |  4065 |  4052 |  4036 |
                  |     |       |       |       |       |
                  |   8 |  4017 |  3997 |  3973 |  3948 |
                  |     |       |       |       |       |
                  |  12 |  3920 |  3889 |  3857 |  3822 |
                  |     |       |       |       |       |
                  |  16 |  3784 |  3745 |  3703 |  3659 |
                  |     |       |       |       |       |
                  |  20 |  3613 |  3564 |  3513 |  3461 |
                  |     |       |       |       |       |
                  |  24 |  3406 |  3349 |  3290 |  3229 |
                  |     |       |       |       |       |
                  |  28 |  3166 |  3102 |  3035 |  2967 |
                  |     |       |       |       |       |
                  |  32 |  2896 |  2824 |  2751 |  2676 |
                  |     |       |       |       |       |
                  |  36 |  2599 |  2520 |  2440 |  2359 |
                  |     |       |       |       |       |
                  |  40 |  2276 |  2191 |  2106 |  2019 |
                  |     |       |       |       |       |
                  |  44 |  1931 |  1842 |  1751 |  1660 |
                  |     |       |       |       |       |
                  |  48 |  1568 |  1474 |  1380 |  1285 |
                  |     |       |       |       |       |
                  |  52 |  1189 |  1093 |   995 |   897 |
                  |     |       |       |       |       |
                  |  56 |   799 |   700 |   601 |   501 |
                  |     |       |       |       |       |
                  |  60 |   401 |   301 |   201 |   101 |
                  |     |       |       |       |       |
                  |  64 |     0 |  -101 |  -201 |  -301 |
                  |     |       |       |       |       |
                  |  68 |  -401 |  -501 |  -601 |  -700 |
                  |     |       |       |       |       |
                  |  72 |  -799 |  -897 |  -995 | -1093 |
                  |     |       |       |       |       |
                  |  76 | -1189 | -1285 | -1380 | -1474 |
                  |     |       |       |       |       |
                  |  80 | -1568 | -1660 | -1751 | -1842 |
        
                  +-----+-------+-------+-------+-------+
                  |   i |    +0 |    +1 |    +2 |    +3 |
                  +-----+-------+-------+-------+-------+
                  |   0 |  4096 |  4095 |  4091 |  4085 |
                  |     |       |       |       |       |
                  |   4 |  4076 |  4065 |  4052 |  4036 |
                  |     |       |       |       |       |
                  |   8 |  4017 |  3997 |  3973 |  3948 |
                  |     |       |       |       |       |
                  |  12 |  3920 |  3889 |  3857 |  3822 |
                  |     |       |       |       |       |
                  |  16 |  3784 |  3745 |  3703 |  3659 |
                  |     |       |       |       |       |
                  |  20 |  3613 |  3564 |  3513 |  3461 |
                  |     |       |       |       |       |
                  |  24 |  3406 |  3349 |  3290 |  3229 |
                  |     |       |       |       |       |
                  |  28 |  3166 |  3102 |  3035 |  2967 |
                  |     |       |       |       |       |
                  |  32 |  2896 |  2824 |  2751 |  2676 |
                  |     |       |       |       |       |
                  |  36 |  2599 |  2520 |  2440 |  2359 |
                  |     |       |       |       |       |
                  |  40 |  2276 |  2191 |  2106 |  2019 |
                  |     |       |       |       |       |
                  |  44 |  1931 |  1842 |  1751 |  1660 |
                  |     |       |       |       |       |
                  |  48 |  1568 |  1474 |  1380 |  1285 |
                  |     |       |       |       |       |
                  |  52 |  1189 |  1093 |   995 |   897 |
                  |     |       |       |       |       |
                  |  56 |   799 |   700 |   601 |   501 |
                  |     |       |       |       |       |
                  |  60 |   401 |   301 |   201 |   101 |
                  |     |       |       |       |       |
                  |  64 |     0 |  -101 |  -201 |  -301 |
                  |     |       |       |       |       |
                  |  68 |  -401 |  -501 |  -601 |  -700 |
                  |     |       |       |       |       |
                  |  72 |  -799 |  -897 |  -995 | -1093 |
                  |     |       |       |       |       |
                  |  76 | -1189 | -1285 | -1380 | -1474 |
                  |     |       |       |       |       |
                  |  80 | -1568 | -1660 | -1751 | -1842 |
        
                  |     |       |       |       |       |
                  |  84 | -1931 | -2019 | -2106 | -2191 |
                  |     |       |       |       |       |
                  |  88 | -2276 | -2359 | -2440 | -2520 |
                  |     |       |       |       |       |
                  |  92 | -2599 | -2676 | -2751 | -2824 |
                  |     |       |       |       |       |
                  |  96 | -2896 | -2967 | -3035 | -3102 |
                  |     |       |       |       |       |
                  | 100 | -3166 | -3229 | -3290 | -3349 |
                  |     |       |       |       |       |
                  | 104 | -3406 | -3461 | -3513 | -3564 |
                  |     |       |       |       |       |
                  | 108 | -3613 | -3659 | -3703 | -3745 |
                  |     |       |       |       |       |
                  | 112 | -3784 | -3822 | -3857 | -3889 |
                  |     |       |       |       |       |
                  | 116 | -3920 | -3948 | -3973 | -3997 |
                  |     |       |       |       |       |
                  | 120 | -4017 | -4036 | -4052 | -4065 |
                  |     |       |       |       |       |
                  | 124 | -4076 | -4085 | -4091 | -4095 |
                  |     |       |       |       |       |
                  | 128 | -4096 |       |       |       |
                  +-----+-------+-------+-------+-------+
        
                  |     |       |       |       |       |
                  |  84 | -1931 | -2019 | -2106 | -2191 |
                  |     |       |       |       |       |
                  |  88 | -2276 | -2359 | -2440 | -2520 |
                  |     |       |       |       |       |
                  |  92 | -2599 | -2676 | -2751 | -2824 |
                  |     |       |       |       |       |
                  |  96 | -2896 | -2967 | -3035 | -3102 |
                  |     |       |       |       |       |
                  | 100 | -3166 | -3229 | -3290 | -3349 |
                  |     |       |       |       |       |
                  | 104 | -3406 | -3461 | -3513 | -3564 |
                  |     |       |       |       |       |
                  | 108 | -3613 | -3659 | -3703 | -3745 |
                  |     |       |       |       |       |
                  | 112 | -3784 | -3822 | -3857 | -3889 |
                  |     |       |       |       |       |
                  | 116 | -3920 | -3948 | -3973 | -3997 |
                  |     |       |       |       |       |
                  | 120 | -4017 | -4036 | -4052 | -4065 |
                  |     |       |       |       |       |
                  | 124 | -4076 | -4085 | -4091 | -4095 |
                  |     |       |       |       |       |
                  | 128 | -4096 |       |       |       |
                  +-----+-------+-------+-------+-------+
        

Table 28: Q12 Cosine Table for LSF Conversion

表28:LSF转换的Q12余弦表

Given the list of cosine values, silk_NLSF2A_find_poly() (NLSF2A.c) computes the coefficients of P and Q, described here via a simple recurrence. Let p_Q16[k][j] and q_Q16[k][j] be the coefficients of the products of the first (k+1) root pairs for P and Q, with j indexing the coefficient number. Only the first (k+2) coefficients are needed, as the products are symmetric. Let p_Q16[0][0] = q_Q16[0][0] = 1<<16, p_Q16[0][1] = -c_Q17[0], q_Q16[0][1] = -c_Q17[1], and d2 = d_LPC/2. As boundary conditions, assume p_Q16[k][j] = q_Q16[k][j] = 0 for all j < 0. Also, assume p_Q16[k][k+2] = p_Q16[k][k] and q_Q16[k][k+2] = q_Q16[k][k] (because of the symmetry). Then, for 0 < k < d2 and 0 <= j <= k+1,

给定余弦值列表,silk_NLSF2A_find_poly()(NLSF2A.c)计算P和Q的系数,这里通过简单的递归进行描述。设p_Q16[k][j]和q_Q16[k][j]为p和q的第一(k+1)根对乘积的系数,j为系数数。因为乘积是对称的,所以只需要第一个(k+2)系数。设p_Q16[0][0]=q_Q16[0][0]=1<<16,p_Q16[0][1]=-c_Q17[0],q_Q16[0][1]=-c_Q17[1],d2=d_LPC/2。作为边界条件,假设所有j<0时p_Q16[k][j]=q_Q16[k][j]=0。另外,假设p_Q16[k][k+2]=p_Q16[k][k]和q_Q16[k][k+2]=q_Q16[k][k](因为对称性)。然后,对于0<k<d2和0<=j<=k+1,

        p_Q16[k][j] = p_Q16[k-1][j] + p_Q16[k-1][j-2]
                      - ((c_Q17[2*k]*p_Q16[k-1][j-1] + 32768)>>16)
        
        p_Q16[k][j] = p_Q16[k-1][j] + p_Q16[k-1][j-2]
                      - ((c_Q17[2*k]*p_Q16[k-1][j-1] + 32768)>>16)
        
        q_Q16[k][j] = q_Q16[k-1][j] + q_Q16[k-1][j-2]
                      - ((c_Q17[2*k+1]*q_Q16[k-1][j-1] + 32768)>>16)
        
        q_Q16[k][j] = q_Q16[k-1][j] + q_Q16[k-1][j-2]
                      - ((c_Q17[2*k+1]*q_Q16[k-1][j-1] + 32768)>>16)
        

The use of Q17 values for the cosine terms in an otherwise Q16 expression implicitly scales them by a factor of 2. The multiplications in this recurrence may require up to 48 bits of precision in the result to avoid overflow. In practice, each row of the recurrence only depends on the previous row, so an implementation does not need to store all of them.

在另一个Q16表达式中,对余弦项使用Q17值会隐式地将其缩放2倍。此循环中的乘法可能需要高达48位的结果精度,以避免溢出。实际上,递归的每一行仅依赖于前一行,因此实现不需要存储所有行。

silk_NLSF2A() uses the values from the last row of this recurrence to reconstruct a 32-bit version of the LPC filter (without the leading 1.0 coefficient), a32_Q17[k], 0 <= k < d2:

silk_NLSF2A()使用此递归的最后一行中的值来重构32位版本的LPC滤波器(无前导1.0系数),a32_Q17[k],0<=k<d2:

        a32_Q17[k]         = -(q_Q16[d2-1][k+1] - q_Q16[d2-1][k])
                             - (p_Q16[d2-1][k+1] + p_Q16[d2-1][k]))
        
        a32_Q17[k]         = -(q_Q16[d2-1][k+1] - q_Q16[d2-1][k])
                             - (p_Q16[d2-1][k+1] + p_Q16[d2-1][k]))
        
        a32_Q17[d_LPC-k-1] =  (q_Q16[d2-1][k+1] - q_Q16[d2-1][k])
                             - (p_Q16[d2-1][k+1] + p_Q16[d2-1][k]))
        
        a32_Q17[d_LPC-k-1] =  (q_Q16[d2-1][k+1] - q_Q16[d2-1][k])
                             - (p_Q16[d2-1][k+1] + p_Q16[d2-1][k]))
        

The sum and difference of two terms from each of the p_Q16 and q_Q16 coefficient lists reflect the (1 + z**-1) and (1 - z**-1) factors of P and Q, respectively. The promotion of the expression from Q16 to Q17 implicitly scales the result by 1/2.

p_Q16和q_Q16系数列表中两项的总和和差值分别反映了p和q的(1+z**-1)和(1-z**-1)因子。将表达式从Q16提升到Q17会隐式地将结果缩放1/2。

4.2.7.5.7. Limiting the Range of the LPC Coefficients
4.2.7.5.7. 限制LPC系数的范围

The a32_Q17[] coefficients are too large to fit in a 16-bit value, which significantly increases the cost of applying this filter in fixed-point decoders. Reducing them to Q12 precision doesn't incur any significant quality loss, but still does not guarantee they will fit. silk_NLSF2A() applies up to 10 rounds of bandwidth expansion to limit the dynamic range of these coefficients. Even floating-point decoders SHOULD perform these steps, to avoid mismatch.

a32_Q17[]系数太大,无法容纳16位值,这显著增加了在定点解码器中应用此滤波器的成本。将它们降低到Q12精度不会导致任何重大质量损失,但仍不能保证它们适合。silk_NLSF2A()应用最多10轮带宽扩展来限制这些系数的动态范围。即使是浮点解码器也应该执行这些步骤,以避免不匹配。

For each round, the process first finds the index k such that abs(a32_Q17[k]) is largest, breaking ties by choosing the lowest value of k. Then, it computes the corresponding Q12 precision value, maxabs_Q12, subject to an upper bound to avoid overflow in subsequent computations:

对于每一轮,该过程首先找到指数k,使得abs(a32_Q17[k])最大,通过选择最低的k值打破联系。然后,根据上限计算相应的Q12精度值maxabs_Q12,以避免在后续计算中溢出:

              maxabs_Q12 = min((maxabs_Q17 + 16) >> 5, 163838)
        
              maxabs_Q12 = min((maxabs_Q17 + 16) >> 5, 163838)
        

If this is larger than 32767, the procedure derives the chirp factor, sc_Q16[0], to use in the bandwidth expansion as

如果该值大于32767,则该程序导出啁啾因子sc_Q16[0],用于带宽扩展,如下所示:

                                   (maxabs_Q12 - 32767) << 14
               sc_Q16[0] = 65470 - --------------------------
                                   (maxabs_Q12 * (k+1)) >> 2
        
                                   (maxabs_Q12 - 32767) << 14
               sc_Q16[0] = 65470 - --------------------------
                                   (maxabs_Q12 * (k+1)) >> 2
        

where the division here is integer division. This is an approximation of the chirp factor needed to reduce the target coefficient to 32767, though it is both less than 0.999 and, for k > 0 when maxabs_Q12 is much greater than 32767, still slightly too large. The upper bound on maxabs_Q12, 163838, was chosen because it is equal to ((2**31 - 1) >> 14) + 32767, i.e., the largest value of maxabs_Q12 that would not overflow the numerator in the equation above when stored in a signed 32-bit integer.

这里的除法是整数除法。这是将目标系数降低到32767所需的啁啾因子的近似值,尽管它小于0.999,并且当maxabs_Q12远大于32767时,对于k>0,仍然稍微过大。选择maxabs_Q12(163838)的上界是因为它等于((2**31-1)>>14)+32767,即maxabs_Q12的最大值,当存储在有符号32位整数中时,它不会溢出上述等式中的分子。

silk_bwexpander_32() (bwexpander_32.c) performs the bandwidth expansion (again, only when maxabs_Q12 is greater than 32767) using the following recurrence:

silk_bwexpander_32()(bwexpander_32.c)使用以下循环执行带宽扩展(同样,仅当maxabs_Q12大于32767时):

              a32_Q17[k] = (a32_Q17[k]*sc_Q16[k]) >> 16
        
              a32_Q17[k] = (a32_Q17[k]*sc_Q16[k]) >> 16
        
             sc_Q16[k+1] = (sc_Q16[0]*sc_Q16[k] + 32768) >> 16
        
             sc_Q16[k+1] = (sc_Q16[0]*sc_Q16[k] + 32768) >> 16
        

The first multiply may require up to 48 bits of precision in the result to avoid overflow. The second multiply must be unsigned to avoid overflow with only 32 bits of precision. The reference implementation uses a slightly more complex formulation that avoids the 32-bit overflow using signed multiplication, but is otherwise equivalent.

第一次乘法可能需要高达48位的结果精度,以避免溢出。第二次乘法必须是无符号的,以避免精度仅为32位的溢出。参考实现使用了稍微复杂一些的公式,避免了使用有符号乘法的32位溢出,但在其他方面是等效的。

After 10 rounds of bandwidth expansion are performed, they are simply saturated to 16 bits:

在执行10轮带宽扩展后,它们简单地饱和到16位:

       a32_Q17[k] = clamp(-32768, (a32_Q17[k] + 16) >> 5, 32767) << 5
        
       a32_Q17[k] = clamp(-32768, (a32_Q17[k] + 16) >> 5, 32767) << 5
        

Because this performs the actual saturation in the Q12 domain, but converts the coefficients back to the Q17 domain for the purposes of prediction gain limiting, this step must be performed after the 10th round of bandwidth expansion, regardless of whether or not the Q12 version of any coefficient still overflows a 16-bit integer. This saturation is not performed if maxabs_Q12 drops to 32767 or less prior to the 10th round.

由于这在Q12域中执行实际饱和,但为了预测增益限制的目的将系数转换回Q17域,因此必须在第10轮带宽扩展后执行此步骤,无论任何系数的Q12版本是否仍然溢出16位整数。如果maxabs_Q12在第10轮之前降至32767或更低,则不执行此饱和。

4.2.7.5.8. Limiting the Prediction Gain of the LPC Filter
4.2.7.5.8. 限制LPC滤波器的预测增益

The prediction gain of an LPC synthesis filter is the square root of the output energy when the filter is excited by a unit-energy impulse. Even if the Q12 coefficients would fit, the resulting filter may still have a significant gain (especially for voiced sounds), making the filter unstable. silk_NLSF2A() applies up to 16 additional rounds of bandwidth expansion to limit the prediction gain. Instead of controlling the amount of bandwidth expansion using the prediction gain itself (which may diverge to infinity for an unstable filter), silk_NLSF2A() uses silk_LPC_inverse_pred_gain_QA()

LPC合成滤波器的预测增益是由单位能量脉冲激励滤波器时输出能量的平方根。即使Q12系数适合,结果滤波器仍可能具有显著增益(尤其是对于浊音),使滤波器不稳定。silk_NLSF2A()应用最多16轮额外的带宽扩展来限制预测增益。silk_NLSF2A()使用silk_LPC_inverse_pred_gain_QA()而不是使用预测增益本身(对于不稳定的滤波器可能发散到无穷大)来控制带宽扩展量

(LPC_inv_pred_gain.c) to compute the reflection coefficients associated with the filter. The filter is stable if and only if the magnitude of these coefficients is sufficiently less than one. The reflection coefficients, rc[k], can be computed using a simple Levinson recurrence, initialized with the LPC coefficients a[d_LPC-1][n] = a[n], and then updated via

(LPC_inv_pred_gain.c)来计算与滤波器相关联的反射系数。当且仅当这些系数的大小足够小于1时,滤波器才稳定。反射系数rc[k]可以使用简单的Levinson递归计算,用LPC系数a[d_LPC-1][n]=a[n]初始化,然后通过

rc[k] = -a[k][k] ,

rc[k]=-a[k][k],

                              a[k][n] - a[k][k-n-1]*rc[k]
                  a[k-1][n] = ---------------------------
                                               2
                                      1 - rc[k]
        
                              a[k][n] - a[k][k-n-1]*rc[k]
                  a[k-1][n] = ---------------------------
                                               2
                                      1 - rc[k]
        

However, silk_LPC_inverse_pred_gain_QA() approximates this using fixed-point arithmetic to guarantee reproducible results across platforms and implementations. Since small changes in the coefficients can make a stable filter unstable, it takes the real Q12 coefficients that will be used during reconstruction as input. Thus, let

然而,silk_LPC_inverse_pred_gain_QA()使用定点算法来近似这一点,以确保跨平台和实现的重复结果。由于系数的微小变化会使稳定滤波器不稳定,因此它将重建期间使用的真实Q12系数作为输入。因此,让我们

                    a32_Q12[n] = (a32_Q17[n] + 16) >> 5
        
                    a32_Q12[n] = (a32_Q17[n] + 16) >> 5
        

be the Q12 version of the LPC coefficients that will eventually be used. As a simple initial check, the decoder computes the DC response as

是最终将使用的LPC系数的Q12版本。作为一个简单的初始检查,解码器将DC响应计算为

                                  d_PLC-1
                                    __
                          DC_resp = \   a32_Q12[n]
                                    /_
                                    n=0
        
                                  d_PLC-1
                                    __
                          DC_resp = \   a32_Q12[n]
                                    /_
                                    n=0
        

and if DC_resp > 4096, the filter is unstable.

如果DC_resp>4096,则滤波器不稳定。

Increasing the precision of these Q12 coefficients to Q24 for intermediate computations allows more accurate computation of the reflection coefficients, so the decoder initializes the recurrence via

对于中间计算,将这些Q12系数的精度增加到Q24允许更精确地计算反射系数,因此解码器通过

                   inv_gain_Q30[d_LPC] = 1 << 30
        
                   inv_gain_Q30[d_LPC] = 1 << 30
        
                   a32_Q24[d_LPC-1][n] = a32_Q12[n] << 12
        
                   a32_Q24[d_LPC-1][n] = a32_Q12[n] << 12
        

Then, for each k from d_LPC-1 down to 0, if abs(a32_Q24[k][k]) > 16773022, the filter is unstable and the recurrence stops. The constant 16773022 here is approximately 0.99975 in Q24. Otherwise, the inverse of the prediction gain, inv_gain_Q30[k], is updated via

然后,对于从d_LPC-1到0的每个k,如果abs(a32_Q24[k][k])>16773022,则滤波器不稳定,循环停止。此处的常数16773022在Q24中约为0.99975。否则,预测增益的倒数inv_gain_Q30[k]通过

              rc_Q31[k] = -a32_Q24[k][k] << 7
        
              rc_Q31[k] = -a32_Q24[k][k] << 7
        
             div_Q30[k] = (1<<30) - (rc_Q31[k]*rc_Q31[k] >> 32)
        
             div_Q30[k] = (1<<30) - (rc_Q31[k]*rc_Q31[k] >> 32)
        
        inv_gain_Q30[k] = (inv_gain_Q30[k+1]*div_Q30[k] >> 32) << 2
        
        inv_gain_Q30[k] = (inv_gain_Q30[k+1]*div_Q30[k] >> 32) << 2
        

and if inv_gain_Q30[k] < 107374, the filter is unstable and the recurrence stops. The constant 107374 here is approximately 1/10000 in Q30. If neither of these checks determine that the filter is unstable and k > 0, row k-1 of a32_Q24 is computed from row k as

如果inv_gain_Q30[k]<107374,则滤波器不稳定,循环停止。此处的常数107374在Q30中约为1/10000。如果这两项检查均未确定过滤器不稳定且k>0,则根据行k计算a32_Q24的行k-1,如下所示:

b1[k] = ilog(div_Q30[k])

b1[k]=ilog(分区Q30[k])

b2[k] = b1[k] - 16

b2[k]=b1[k]-16

                            (1<<29) - 1
         inv_Qb2[k] = -----------------------
                      div_Q30[k] >> (b2[k]+1)
        
                            (1<<29) - 1
         inv_Qb2[k] = -----------------------
                      div_Q30[k] >> (b2[k]+1)
        
         err_Q29[k] = (1<<29)
                      - ((div_Q30[k]<<(15-b2[k]))*inv_Qb2[k] >> 16)
        
         err_Q29[k] = (1<<29)
                      - ((div_Q30[k]<<(15-b2[k]))*inv_Qb2[k] >> 16)
        
        gain_Qb1[k] = ((inv_Qb2[k] << 16)
                       + (err_Q29[k]*inv_Qb2[k] >> 13))
        
        gain_Qb1[k] = ((inv_Qb2[k] << 16)
                       + (err_Q29[k]*inv_Qb2[k] >> 13))
        
    num_Q24[k-1][n] = a32_Q24[k][n]
                      - ((a32_Q24[k][k-n-1]*rc_Q31[k] + (1<<30)) >> 31)
        
    num_Q24[k-1][n] = a32_Q24[k][n]
                      - ((a32_Q24[k][k-n-1]*rc_Q31[k] + (1<<30)) >> 31)
        
    a32_Q24[k-1][n] = (num_Q24[k-1][n]*gain_Qb1[k]
                       + (1<<(b1[k]-1))) >> b1[k]
        
    a32_Q24[k-1][n] = (num_Q24[k-1][n]*gain_Qb1[k]
                       + (1<<(b1[k]-1))) >> b1[k]
        

where 0 <= n < k. In the above, rc_Q31[k] are the reflection coefficients. div_Q30[k] is the denominator for each iteration, and gain_Qb1[k] is its multiplicative inverse (with b1[k] fractional bits, where b1[k] ranges from 20 to 31). inv_Qb2[k], which ranges from 16384 to 32767, is a low-precision version of that inverse (with b2[k] fractional bits). err_Q29[k] is the residual error, ranging from -32763 to 32392, which is used to improve the accuracy. The values t_Q24[k-1][n] for each n are the numerators for the next row of coefficients in the recursion, and a32_Q24[k-1][n] is the final version of that row. Every multiply in this procedure except the one used to compute gain_Qb1[k] requires more than 32 bits of precision,

其中0<=n<k。在上面,rc_Q31[k]是反射系数。div_Q30[k]是每次迭代的分母,而gain_Qb1[k]是其乘法逆(b1[k]分数位,其中b1[k]的范围为20到31)。inv_Qb2[k]的范围从16384到32767,是该倒数的低精度版本(带有b2[k]分数位)。err_Q29[k]是残差,范围为-32763到32392,用于提高精度。每个n的值t_Q24[k-1][n]是递归中下一行系数的分子,而a32_Q24[k-1][n]是该行的最终版本。除用于计算增益_Qb1[k]的乘法外,此过程中的每个乘法都需要超过32位的精度,

but otherwise all intermediate results fit in 32 bits or less. In practice, because each row only depends on the next one, an implementation does not need to store them all.

但除此之外,所有中间结果都适合32位或更少。实际上,因为每一行只依赖于下一行,所以实现不需要存储所有行。

If abs(a32_Q24[k][k]) <= 16773022 and inv_gain_Q30[k] >= 107374 for 0 <= k < d_LPC, then the filter is considered stable. However, the problem of determining stability is ill-conditioned when the filter contains several reflection coefficients whose magnitude is very close to one. This fixed-point algorithm is not mathematically guaranteed to correctly classify filters as stable or unstable in this case, though it does very well in practice.

如果0<=k<d\u LPC时的abs(a32_Q24[k][k])<=16773022和inv_增益_Q30[k]>=107374,则认为滤波器是稳定的。然而,当滤波器包含几个大小非常接近1的反射系数时,确定稳定性的问题是病态的。这种定点算法在数学上不能保证在这种情况下正确地将滤波器分类为稳定的或不稳定的,尽管它在实践中做得很好。

On round i, 0 <= i < 16, if the filter passes these stability checks, then this procedure stops, and the final LPC coefficients to use for reconstruction in Section 4.2.7.9.2 are

在第i轮,0<=i<16,如果滤波器通过了这些稳定性检查,则该程序停止,第4.2.7.9.2节中用于重建的最终LPC系数为

                     a_Q12[k] = (a32_Q17[k] + 16) >> 5
        
                     a_Q12[k] = (a32_Q17[k] + 16) >> 5
        

Otherwise, a round of bandwidth expansion is applied using the same procedure as in Section 4.2.7.5.7, with

否则,使用与第4.2.7.5.7节相同的程序进行一轮带宽扩展,包括

                         sc_Q16[0] = 65536 - (2<<i)
        
                         sc_Q16[0] = 65536 - (2<<i)
        

During round 15, sc_Q16[0] becomes 0 in the above equation, so a_Q12[k] is set to 0 for all k, guaranteeing a stable filter.

在第15轮期间,在上述等式中,sc_Q16[0]变为0,因此a_Q12[k]对于所有k被设置为0,从而保证稳定的滤波器。

4.2.7.6. Long-Term Prediction (LTP) Parameters
4.2.7.6. 长期预测(LTP)参数

After the normalized LSF indices and, for 20 ms frames, the LSF interpolation index, voiced frames (see Section 4.2.7.3) include additional LTP parameters. There is one primary lag index for each SILK frame, but this is refined to produce a separate lag index per subframe using a vector quantizer. Each subframe also gets its own prediction gain coefficient.

在归一化LSF索引之后,对于20ms帧,LSF插值索引、浊音帧(见第4.2.7.3节)包括额外的LTP参数。每个丝帧都有一个主要的滞后指数,但这是经过改进的,使用矢量量化器为每个子帧生成一个单独的滞后指数。每个子帧还获得其自己的预测增益系数。

4.2.7.6.1. Pitch Lags
4.2.7.6.1. 音高滞后

The primary lag index is coded either relative to the primary lag of the prior frame in the same channel or as an absolute index. Absolute coding is used if and only if

主滞后索引相对于同一信道中前一帧的主滞后进行编码,或者作为绝对索引进行编码。当且仅当

o This is the first SILK frame of its type (LBRR or regular) for this channel in the current Opus frame,

o 这是当前作品框架中该频道的第一个丝绸框架(LBRR或常规),

o The previous SILK frame of the same type (LBRR or regular) for this channel in the same Opus frame was not coded, or

o 同一Opus帧中该频道的相同类型(LBRR或常规)的前一丝绸帧未编码,或

o That previous SILK frame was coded, but was not voiced (see Section 4.2.7.3).

o 之前的丝绸框架已编码,但未发出浊音(见第4.2.7.3节)。

With absolute coding, the primary pitch lag may range from 2 ms (inclusive) up to 18 ms (exclusive), corresponding to pitches from 500 Hz down to 55.6 Hz, respectively. It is comprised of a high part and a low part, where the decoder first reads the high part using the 32-entry codebook in Table 29 and then the low part using the codebook corresponding to the current audio bandwidth from Table 30. The final primary pitch lag is then

使用绝对编码时,主音高滞后可能在2 ms(含)到18 ms(不含)之间,分别对应于从500 Hz到55.6 Hz的音高。它由高部分和低部分组成,其中解码器首先使用表29中的32项码本读取高部分,然后使用与表30中的当前音频带宽对应的码本读取低部分。最后的主变桨滞后是

                lag = lag_high*lag_scale + lag_low + lag_min
        
                lag = lag_high*lag_scale + lag_low + lag_min
        

where lag_high is the high part, lag_low is the low part, and lag_scale and lag_min are the values from the "Scale" and "Minimum Lag" columns of Table 30, respectively.

其中,lag_high为高部分,lag_low为低部分,lag_scale和lag_min分别为表30“scale”和“Minimum lag”列中的值。

   +-------------------------------------------------------------------+
   | PDF                                                               |
   +-------------------------------------------------------------------+
   | {3, 3, 6, 11, 21, 30, 32, 19, 11, 10, 12, 13, 13, 12, 11, 9, 8,   |
   | 7, 6, 4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1}/256                  |
   +-------------------------------------------------------------------+
        
   +-------------------------------------------------------------------+
   | PDF                                                               |
   +-------------------------------------------------------------------+
   | {3, 3, 6, 11, 21, 30, 32, 19, 11, 10, 12, 13, 13, 12, 11, 9, 8,   |
   | 7, 6, 4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1}/256                  |
   +-------------------------------------------------------------------+
        

Table 29: PDF for High Part of Primary Pitch Lag

表29:主节距滞后高部分PDF

   +------------+------------------------+-------+----------+----------+
   | Audio      | PDF                    | Scale | Minimum  | Maximum  |
   | Bandwidth  |                        |       | Lag      | Lag      |
   +------------+------------------------+-------+----------+----------+
   | NB         | {64, 64, 64, 64}/256   | 4     | 16       | 144      |
   |            |                        |       |          |          |
   | MB         | {43, 42, 43, 43, 42,   | 6     | 24       | 216      |
   |            | 43}/256                |       |          |          |
   |            |                        |       |          |          |
   | WB         | {32, 32, 32, 32, 32,   | 8     | 32       | 288      |
   |            | 32, 32, 32}/256        |       |          |          |
   +------------+------------------------+-------+----------+----------+
        
   +------------+------------------------+-------+----------+----------+
   | Audio      | PDF                    | Scale | Minimum  | Maximum  |
   | Bandwidth  |                        |       | Lag      | Lag      |
   +------------+------------------------+-------+----------+----------+
   | NB         | {64, 64, 64, 64}/256   | 4     | 16       | 144      |
   |            |                        |       |          |          |
   | MB         | {43, 42, 43, 43, 42,   | 6     | 24       | 216      |
   |            | 43}/256                |       |          |          |
   |            |                        |       |          |          |
   | WB         | {32, 32, 32, 32, 32,   | 8     | 32       | 288      |
   |            | 32, 32, 32}/256        |       |          |          |
   +------------+------------------------+-------+----------+----------+
        

Table 30: PDF for Low Part of Primary Pitch Lag

表30:主节距滞后低部分PDF

All frames that do not use absolute coding for the primary lag index use relative coding instead. The decoder reads a single delta value using the 21-entry PDF in Table 31. If the resulting value is zero, it falls back to the absolute coding procedure from the prior paragraph. Otherwise, the final primary pitch lag is then

对于主滞后索引,所有不使用绝对编码的帧都使用相对编码。解码器使用表31中的21项PDF读取单个增量值。如果结果值为零,则返回上一段的绝对编码过程。否则,最终主变桨滞后时间为

                 lag = previous_lag + (delta_lag_index - 9)
        
                 lag = previous_lag + (delta_lag_index - 9)
        

where previous_lag is the primary pitch lag from the most recent frame in the same channel and delta_lag_index is the value just decoded. This allows a per-frame change in the pitch lag of -8 to +11 samples. The decoder does no clamping at this point, so this value can fall outside the range of 2 ms to 18 ms, and the decoder must use this unclamped value when using relative coding in the next SILK frame (if any). However, because an Opus frame can use relative coding for at most two consecutive SILK frames, integer overflow should not be an issue.

其中,previous_lag是同一信道中最近帧的主基音周期延迟,delta_lag_index是刚刚解码的值。这允许每帧改变-8到+11个样本的俯仰延迟。解码器在这一点上没有箝位,因此该值可能超出2 ms到18 ms的范围,并且解码器在下一个丝帧(如果有)中使用相对编码时必须使用该未箝位值。然而,由于Opus帧最多可以对两个连续的丝绸帧使用相对编码,因此整数溢出不应成为问题。

   +-------------------------------------------------------------------+
   | PDF                                                               |
   +-------------------------------------------------------------------+
   | {46, 2, 2, 3, 4, 6, 10, 15, 26, 38, 30, 22, 15, 10, 7, 6, 4, 4,   |
   | 2, 2, 2}/256                                                      |
   +-------------------------------------------------------------------+
        
   +-------------------------------------------------------------------+
   | PDF                                                               |
   +-------------------------------------------------------------------+
   | {46, 2, 2, 3, 4, 6, 10, 15, 26, 38, 30, 22, 15, 10, 7, 6, 4, 4,   |
   | 2, 2, 2}/256                                                      |
   +-------------------------------------------------------------------+
        

Table 31: PDF for Primary Pitch Lag Change

表31:主节距滞后变化PDF

After the primary pitch lag, a "pitch contour", stored as a single entry from one of four small VQ codebooks, gives lag offsets for each subframe in the current SILK frame. The codebook index is decoded using one of the PDFs in Table 32 depending on the current frame size and audio bandwidth. Tables 33 through 36 give the corresponding offsets to apply to the primary pitch lag for each subframe given the decoded codebook index.

在主基音滞后之后,“基音轮廓”(pitch contour)作为来自四个小VQ码本之一的单个条目存储,为当前帧中的每个子帧提供滞后偏移。根据当前帧大小和音频带宽,使用表32中的一个PDF对码本索引进行解码。表33至36给出了在给定解码码本索引的每个子帧中应用于主基音周期滞后的相应偏移量。

   +-----------+--------+----------+-----------------------------------+
   | Audio     | SILK   | Codebook | PDF                               |
   | Bandwidth | Frame  |     Size |                                   |
   |           | Size   |          |                                   |
   +-----------+--------+----------+-----------------------------------+
   | NB        | 10 ms  |        3 | {143, 50, 63}/256                 |
   |           |        |          |                                   |
   | NB        | 20 ms  |       11 | {68, 12, 21, 17, 19, 22, 30, 24,  |
   |           |        |          | 17, 16, 10}/256                   |
   |           |        |          |                                   |
   | MB or WB  | 10 ms  |       12 | {91, 46, 39, 19, 14, 12, 8, 7, 6, |
   |           |        |          | 5, 5, 4}/256                      |
   |           |        |          |                                   |
   | MB or WB  | 20 ms  |       34 | {33, 22, 18, 16, 15, 14, 14, 13,  |
   |           |        |          | 13, 10, 9, 9, 8, 6, 6, 6, 5, 4,   |
   |           |        |          | 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2,  |
   |           |        |          | 2, 1, 1, 1, 1}/256                |
   +-----------+--------+----------+-----------------------------------+
        
   +-----------+--------+----------+-----------------------------------+
   | Audio     | SILK   | Codebook | PDF                               |
   | Bandwidth | Frame  |     Size |                                   |
   |           | Size   |          |                                   |
   +-----------+--------+----------+-----------------------------------+
   | NB        | 10 ms  |        3 | {143, 50, 63}/256                 |
   |           |        |          |                                   |
   | NB        | 20 ms  |       11 | {68, 12, 21, 17, 19, 22, 30, 24,  |
   |           |        |          | 17, 16, 10}/256                   |
   |           |        |          |                                   |
   | MB or WB  | 10 ms  |       12 | {91, 46, 39, 19, 14, 12, 8, 7, 6, |
   |           |        |          | 5, 5, 4}/256                      |
   |           |        |          |                                   |
   | MB or WB  | 20 ms  |       34 | {33, 22, 18, 16, 15, 14, 14, 13,  |
   |           |        |          | 13, 10, 9, 9, 8, 6, 6, 6, 5, 4,   |
   |           |        |          | 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2,  |
   |           |        |          | 2, 1, 1, 1, 1}/256                |
   +-----------+--------+----------+-----------------------------------+
        

Table 32: PDFs for Subframe Pitch Contour

表32:副帧俯仰轮廓的PDF

                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |             0  0 |
                       |       |                  |
                       | 1     |             1  0 |
                       |       |                  |
                       | 2     |             0  1 |
                       +-------+------------------+
        
                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |             0  0 |
                       |       |                  |
                       | 1     |             1  0 |
                       |       |                  |
                       | 2     |             0  1 |
                       +-------+------------------+
        

Table 33: Codebook Vectors for Subframe Pitch Contour: NB, 10 ms Frames

表33:子帧基音轮廓的码本矢量:NB,10毫秒帧

                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |       0  0  0  0 |
                       |       |                  |
                       | 1     |       2  1  0 -1 |
                       |       |                  |
                       | 2     |      -1  0  1  2 |
                       |       |                  |
                       | 3     |      -1  0  0  1 |
                       |       |                  |
                       | 4     |      -1  0  0  0 |
                       |       |                  |
                       | 5     |       0  0  0  1 |
                       |       |                  |
                       | 6     |       0  0  1  1 |
                       |       |                  |
                       | 7     |       1  1  0  0 |
                       |       |                  |
                       | 8     |       1  0  0  0 |
                       |       |                  |
                       | 9     |       0  0  0 -1 |
                       |       |                  |
                       | 10    |       1  0  0 -1 |
                       +-------+------------------+
        
                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |       0  0  0  0 |
                       |       |                  |
                       | 1     |       2  1  0 -1 |
                       |       |                  |
                       | 2     |      -1  0  1  2 |
                       |       |                  |
                       | 3     |      -1  0  0  1 |
                       |       |                  |
                       | 4     |      -1  0  0  0 |
                       |       |                  |
                       | 5     |       0  0  0  1 |
                       |       |                  |
                       | 6     |       0  0  1  1 |
                       |       |                  |
                       | 7     |       1  1  0  0 |
                       |       |                  |
                       | 8     |       1  0  0  0 |
                       |       |                  |
                       | 9     |       0  0  0 -1 |
                       |       |                  |
                       | 10    |       1  0  0 -1 |
                       +-------+------------------+
        

Table 34: Codebook Vectors for Subframe Pitch Contour: NB, 20 ms Frames

表34:子帧基音轮廓的码本矢量:NB,20毫秒帧

                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |             0  0 |
                       |       |                  |
                       | 1     |             0  1 |
                       |       |                  |
                       | 2     |             1  0 |
                       |       |                  |
                       | 3     |            -1  1 |
                       |       |                  |
                       | 4     |             1 -1 |
                       |       |                  |
                       | 5     |            -1  2 |
                       |       |                  |
                       | 6     |             2 -1 |
                       |       |                  |
                       | 7     |            -2  2 |
                       |       |                  |
                       | 8     |             2 -2 |
                       |       |                  |
                       | 9     |            -2  3 |
                       |       |                  |
                       | 10    |             3 -2 |
                       |       |                  |
                       | 11    |            -3  3 |
                       +-------+------------------+
        
                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |             0  0 |
                       |       |                  |
                       | 1     |             0  1 |
                       |       |                  |
                       | 2     |             1  0 |
                       |       |                  |
                       | 3     |            -1  1 |
                       |       |                  |
                       | 4     |             1 -1 |
                       |       |                  |
                       | 5     |            -1  2 |
                       |       |                  |
                       | 6     |             2 -1 |
                       |       |                  |
                       | 7     |            -2  2 |
                       |       |                  |
                       | 8     |             2 -2 |
                       |       |                  |
                       | 9     |            -2  3 |
                       |       |                  |
                       | 10    |             3 -2 |
                       |       |                  |
                       | 11    |            -3  3 |
                       +-------+------------------+
        

Table 35: Codebook Vectors for Subframe Pitch Contour: MB or WB, 10 ms Frames

表35:子帧基音轮廓的码本矢量:MB或WB,10毫秒帧

                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |       0  0  0  0 |
                       |       |                  |
                       | 1     |       0  0  1  1 |
                       |       |                  |
                       | 2     |       1  1  0  0 |
                       |       |                  |
                       | 3     |      -1  0  0  0 |
                       |       |                  |
                       | 4     |       0  0  0  1 |
                       |       |                  |
                       | 5     |       1  0  0  0 |
                       |       |                  |
                       | 6     |      -1  0  0  1 |
                       |       |                  |
        
                       +-------+------------------+
                       | Index | Subframe Offsets |
                       +-------+------------------+
                       | 0     |       0  0  0  0 |
                       |       |                  |
                       | 1     |       0  0  1  1 |
                       |       |                  |
                       | 2     |       1  1  0  0 |
                       |       |                  |
                       | 3     |      -1  0  0  0 |
                       |       |                  |
                       | 4     |       0  0  0  1 |
                       |       |                  |
                       | 5     |       1  0  0  0 |
                       |       |                  |
                       | 6     |      -1  0  0  1 |
                       |       |                  |
        
                       | 7     |       0  0  0 -1 |
                       |       |                  |
                       | 8     |      -1  0  1  2 |
                       |       |                  |
                       | 9     |       1  0  0 -1 |
                       |       |                  |
                       | 10    |      -2 -1  1  2 |
                       |       |                  |
                       | 11    |       2  1  0 -1 |
                       |       |                  |
                       | 12    |      -2  0  0  2 |
                       |       |                  |
                       | 13    |      -2  0  1  3 |
                       |       |                  |
                       | 14    |       2  1 -1 -2 |
                       |       |                  |
                       | 15    |      -3 -1  1  3 |
                       |       |                  |
                       | 16    |       2  0  0 -2 |
                       |       |                  |
                       | 17    |       3  1  0 -2 |
                       |       |                  |
                       | 18    |      -3 -1  2  4 |
                       |       |                  |
                       | 19    |      -4 -1  1  4 |
                       |       |                  |
                       | 20    |       3  1 -1 -3 |
                       |       |                  |
                       | 21    |      -4 -1  2  5 |
                       |       |                  |
                       | 22    |       4  2 -1 -3 |
                       |       |                  |
                       | 23    |       4  1 -1 -4 |
                       |       |                  |
                       | 24    |      -5 -1  2  6 |
                       |       |                  |
                       | 25    |       5  2 -1 -4 |
                       |       |                  |
                       | 26    |      -6 -2  2  6 |
                       |       |                  |
                       | 27    |      -5 -2  2  5 |
                       |       |                  |
                       | 28    |       6  2 -1 -5 |
                       |       |                  |
                       | 29    |      -7 -2  3  8 |
                       |       |                  |
                       | 30    |       6  2 -2 -6 |
                       |       |                  |
        
                       | 7     |       0  0  0 -1 |
                       |       |                  |
                       | 8     |      -1  0  1  2 |
                       |       |                  |
                       | 9     |       1  0  0 -1 |
                       |       |                  |
                       | 10    |      -2 -1  1  2 |
                       |       |                  |
                       | 11    |       2  1  0 -1 |
                       |       |                  |
                       | 12    |      -2  0  0  2 |
                       |       |                  |
                       | 13    |      -2  0  1  3 |
                       |       |                  |
                       | 14    |       2  1 -1 -2 |
                       |       |                  |
                       | 15    |      -3 -1  1  3 |
                       |       |                  |
                       | 16    |       2  0  0 -2 |
                       |       |                  |
                       | 17    |       3  1  0 -2 |
                       |       |                  |
                       | 18    |      -3 -1  2  4 |
                       |       |                  |
                       | 19    |      -4 -1  1  4 |
                       |       |                  |
                       | 20    |       3  1 -1 -3 |
                       |       |                  |
                       | 21    |      -4 -1  2  5 |
                       |       |                  |
                       | 22    |       4  2 -1 -3 |
                       |       |                  |
                       | 23    |       4  1 -1 -4 |
                       |       |                  |
                       | 24    |      -5 -1  2  6 |
                       |       |                  |
                       | 25    |       5  2 -1 -4 |
                       |       |                  |
                       | 26    |      -6 -2  2  6 |
                       |       |                  |
                       | 27    |      -5 -2  2  5 |
                       |       |                  |
                       | 28    |       6  2 -1 -5 |
                       |       |                  |
                       | 29    |      -7 -2  3  8 |
                       |       |                  |
                       | 30    |       6  2 -2 -6 |
                       |       |                  |
        
                       | 31    |       5  2 -2 -5 |
                       |       |                  |
                       | 32    |       8  3 -2 -7 |
                       |       |                  |
                       | 33    |      -9 -3  3  9 |
                       +-------+------------------+
        
                       | 31    |       5  2 -2 -5 |
                       |       |                  |
                       | 32    |       8  3 -2 -7 |
                       |       |                  |
                       | 33    |      -9 -3  3  9 |
                       +-------+------------------+
        

Table 36: Codebook Vectors for Subframe Pitch Contour: MB or WB, 20 ms Frames

表36:子帧基音轮廓的码本矢量:MB或WB,20毫秒帧

The final pitch lag for each subframe is assembled in silk_decode_pitch() (decode_pitch.c). Let lag be the primary pitch lag for the current SILK frame, contour_index be index of the VQ codebook, and lag_cb[contour_index][k] be the corresponding entry of the codebook from the appropriate table given above for the k'th subframe. Then the final pitch lag for that subframe is

每个子帧的最终基音滞后在silk_decode_pitch()(decode_pitch.c)中组装。设lag为当前丝帧的主基音滞后,CONTOURE_index为VQ码本的索引,lag_cb[CONTOURE_index][k]为上述第k个子帧的相应表中的码本的对应条目。然后,该子帧的最终俯仰滞后为

pitch_lags[k] = clamp(lag_min, lag + lag_cb[contour_index][k], lag_max)

节距滞后[k]=钳位(滞后最小,滞后+滞后cb[轮廓指数][k],滞后最大)

where lag_min and lag_max are the values from the "Minimum Lag" and "Maximum Lag" columns of Table 30, respectively.

其中,lag_min和lag_max分别是表30中“最小滞后”和“最大滞后”列的值。

4.2.7.6.2. LTP Filter Coefficients
4.2.7.6.2. LTP滤波器系数

SILK uses a separate 5-tap pitch filter for each subframe, selected from one of three codebooks. The three codebooks each represent different rate-distortion trade-offs, with average rates of 1.61 bits/subframe, 3.68 bits/subframe, and 4.85 bits/subframe, respectively.

SILK对每个子帧使用单独的5抽头基音滤波器,从三个码本中选择一个。三个码本各自代表不同的率失真权衡,平均速率分别为1.61比特/子帧、3.68比特/子帧和4.85比特/子帧。

The importance of the filter coefficients generally depends on two factors: the periodicity of the signal and relative energy between the current subframe and the signal from one period earlier. Greater periodicity and decaying energy both lead to more important filter coefficients. Thus, they should be coded with lower distortion and higher rate. These properties are relatively stable over the duration of a single SILK frame. Hence, all of the subframes in a SILK frame choose their filter from the same codebook. This is signaled with an explicitly-coded "periodicity index". This immediately follows the subframe pitch lags, and is coded using the 3-entry PDF from Table 37.

滤波器系数的重要性通常取决于两个因素:信号的周期性和当前子帧与前一个周期的信号之间的相对能量。较大的周期性和衰减能量都会导致更重要的滤波系数。因此,它们应该以更低的失真和更高的速率进行编码。这些性能在单个丝绸框架的持续时间内相对稳定。因此,丝帧中的所有子帧都从同一码本中选择其滤波器。这用一个明确编码的“周期性指数”来表示。这紧跟在子帧俯仰滞后之后,并使用表37中的3条目PDF进行编码。

                           +------------------+
                           | PDF              |
                           +------------------+
                           | {77, 80, 99}/256 |
                           +------------------+
        
                           +------------------+
                           | PDF              |
                           +------------------+
                           | {77, 80, 99}/256 |
                           +------------------+
        

Table 37: Periodicity Index PDF

表37:周期性指数PDF

The indices of the filters for each subframe follow. They are all coded using the PDF from Table 38 corresponding to the periodicity index. Tables 39 through 41 contain the corresponding filter taps as signed Q7 integers.

每个子帧的过滤器索引如下。它们都使用表38中对应于周期性指数的PDF进行编码。表39至表41包含作为有符号Q7整数的相应滤波器抽头。

   +-------------+----------+------------------------------------------+
   | Periodicity | Codebook | PDF                                      |
   | Index       |     Size |                                          |
   +-------------+----------+------------------------------------------+
   | 0           |        8 | {185, 15, 13, 13, 9, 9, 6, 6}/256        |
   |             |          |                                          |
   | 1           |       16 | {57, 34, 21, 20, 15, 13, 12, 13, 10, 10, |
   |             |          | 9, 10, 9, 8, 7, 8}/256                   |
   |             |          |                                          |
   | 2           |       32 | {15, 16, 14, 12, 12, 12, 11, 11, 11, 10, |
   |             |          | 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 5,   |
   |             |          | 4, 5, 4, 4, 4, 3, 4, 3, 2}/256           |
   +-------------+----------+------------------------------------------+
        
   +-------------+----------+------------------------------------------+
   | Periodicity | Codebook | PDF                                      |
   | Index       |     Size |                                          |
   +-------------+----------+------------------------------------------+
   | 0           |        8 | {185, 15, 13, 13, 9, 9, 6, 6}/256        |
   |             |          |                                          |
   | 1           |       16 | {57, 34, 21, 20, 15, 13, 12, 13, 10, 10, |
   |             |          | 9, 10, 9, 8, 7, 8}/256                   |
   |             |          |                                          |
   | 2           |       32 | {15, 16, 14, 12, 12, 12, 11, 11, 11, 10, |
   |             |          | 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 5,   |
   |             |          | 4, 5, 4, 4, 4, 3, 4, 3, 2}/256           |
   +-------------+----------+------------------------------------------+
        

Table 38: LTP Filter PDFs

表38:LTP过滤器PDF

                      +-------+---------------------+
                      | Index |    Filter Taps (Q7) |
                      +-------+---------------------+
                      | 0     |   4   6  24   7   5 |
                      |       |                     |
                      | 1     |   0   0   2   0   0 |
                      |       |                     |
                      | 2     |  12  28  41  13  -4 |
                      |       |                     |
                      | 3     |  -9  15  42  25  14 |
                      |       |                     |
                      | 4     |   1  -2  62  41  -9 |
                      |       |                     |
                      | 5     | -10  37  65  -4   3 |
                      |       |                     |
                      | 6     |  -6   4  66   7  -8 |
                      |       |                     |
                      | 7     |  16  14  38  -3  33 |
                      +-------+---------------------+
        
                      +-------+---------------------+
                      | Index |    Filter Taps (Q7) |
                      +-------+---------------------+
                      | 0     |   4   6  24   7   5 |
                      |       |                     |
                      | 1     |   0   0   2   0   0 |
                      |       |                     |
                      | 2     |  12  28  41  13  -4 |
                      |       |                     |
                      | 3     |  -9  15  42  25  14 |
                      |       |                     |
                      | 4     |   1  -2  62  41  -9 |
                      |       |                     |
                      | 5     | -10  37  65  -4   3 |
                      |       |                     |
                      | 6     |  -6   4  66   7  -8 |
                      |       |                     |
                      | 7     |  16  14  38  -3  33 |
                      +-------+---------------------+
        

Table 39: Codebook Vectors for LTP Filter, Periodicity Index 0

表39:LTP滤波器的码本向量,周期性指数0

                      +-------+---------------------+
                      | Index |    Filter Taps (Q7) |
                      +-------+---------------------+
                      | 0     |  13  22  39  23  12 |
                      |       |                     |
                      | 1     |  -1  36  64  27  -6 |
                      |       |                     |
                      | 2     |  -7  10  55  43  17 |
                      |       |                     |
                      | 3     |   1   1   8   1   1 |
                      |       |                     |
                      | 4     |   6 -11  74  53  -9 |
                      |       |                     |
                      | 5     | -12  55  76 -12   8 |
                      |       |                     |
                      | 6     |  -3   3  93  27  -4 |
                      |       |                     |
                      | 7     |  26  39  59   3  -8 |
                      |       |                     |
                      | 8     |   2   0  77  11   9 |
                      |       |                     |
                      | 9     |  -8  22  44  -6   7 |
                      |       |                     |
                      | 10    |  40   9  26   3   9 |
                      |       |                     |
                      | 11    |  -7  20 101  -7   4 |
                      |       |                     |
                      | 12    |   3  -8  42  26   0 |
                      |       |                     |
                      | 13    | -15  33  68   2  23 |
                      |       |                     |
                      | 14    |  -2  55  46  -2  15 |
                      |       |                     |
                      | 15    |   3  -1  21  16  41 |
                      +-------+---------------------+
        
                      +-------+---------------------+
                      | Index |    Filter Taps (Q7) |
                      +-------+---------------------+
                      | 0     |  13  22  39  23  12 |
                      |       |                     |
                      | 1     |  -1  36  64  27  -6 |
                      |       |                     |
                      | 2     |  -7  10  55  43  17 |
                      |       |                     |
                      | 3     |   1   1   8   1   1 |
                      |       |                     |
                      | 4     |   6 -11  74  53  -9 |
                      |       |                     |
                      | 5     | -12  55  76 -12   8 |
                      |       |                     |
                      | 6     |  -3   3  93  27  -4 |
                      |       |                     |
                      | 7     |  26  39  59   3  -8 |
                      |       |                     |
                      | 8     |   2   0  77  11   9 |
                      |       |                     |
                      | 9     |  -8  22  44  -6   7 |
                      |       |                     |
                      | 10    |  40   9  26   3   9 |
                      |       |                     |
                      | 11    |  -7  20 101  -7   4 |
                      |       |                     |
                      | 12    |   3  -8  42  26   0 |
                      |       |                     |
                      | 13    | -15  33  68   2  23 |
                      |       |                     |
                      | 14    |  -2  55  46  -2  15 |
                      |       |                     |
                      | 15    |   3  -1  21  16  41 |
                      +-------+---------------------+
        

Table 40: Codebook Vectors for LTP Filter, Periodicity Index 1

表40:LTP滤波器的码本向量,周期性指数1

                      +-------+---------------------+
                      | Index |    Filter Taps (Q7) |
                      +-------+---------------------+
                      | 0     |  -6  27  61  39   5 |
                      |       |                     |
                      | 1     | -11  42  88   4   1 |
                      |       |                     |
                      | 2     |  -2  60  65   6  -4 |
                      |       |                     |
                      | 3     |  -1  -5  73  56   1 |
        
                      +-------+---------------------+
                      | Index |    Filter Taps (Q7) |
                      +-------+---------------------+
                      | 0     |  -6  27  61  39   5 |
                      |       |                     |
                      | 1     | -11  42  88   4   1 |
                      |       |                     |
                      | 2     |  -2  60  65   6  -4 |
                      |       |                     |
                      | 3     |  -1  -5  73  56   1 |
        
                      | 4     |  -9  19  94  29  -9 |
                      |       |                     |
                      | 5     |   0  12  99   6   4 |
                      |       |                     |
                      | 6     |   8 -19 102  46 -13 |
                      |       |                     |
                      | 7     |   3   2  13   3   2 |
                      |       |                     |
                      | 8     |   9 -21  84  72 -18 |
                      |       |                     |
                      | 9     | -11  46 104 -22   8 |
                      |       |                     |
                      | 10    |  18  38  48  23   0 |
                      |       |                     |
                      | 11    | -16  70  83 -21  11 |
                      |       |                     |
                      | 12    |   5 -11 117  22  -8 |
                      |       |                     |
                      | 13    |  -6  23 117 -12   3 |
                      |       |                     |
                      | 14    |   3  -8  95  28   4 |
                      |       |                     |
                      | 15    | -10  15  77  60 -15 |
                      |       |                     |
                      | 16    |  -1   4 124   2  -4 |
                      |       |                     |
                      | 17    |   3  38  84  24 -25 |
                      |       |                     |
                      | 18    |   2  13  42  13  31 |
                      |       |                     |
                      | 19    |  21  -4  56  46  -1 |
                      |       |                     |
                      | 20    |  -1  35  79 -13  19 |
                      |       |                     |
                      | 21    |  -7  65  88  -9 -14 |
                      |       |                     |
                      | 22    |  20   4  81  49 -29 |
                      |       |                     |
                      | 23    |  20   0  75   3 -17 |
                      |       |                     |
                      | 24    |   5  -9  44  92  -8 |
                      |       |                     |
                      | 25    |   1  -3  22  69  31 |
                      |       |                     |
                      | 26    |  -6  95  41 -12   5 |
                      |       |                     |
                      | 27    |  39  67  16  -4   1 |
                      |       |                     |
        
                      | 4     |  -9  19  94  29  -9 |
                      |       |                     |
                      | 5     |   0  12  99   6   4 |
                      |       |                     |
                      | 6     |   8 -19 102  46 -13 |
                      |       |                     |
                      | 7     |   3   2  13   3   2 |
                      |       |                     |
                      | 8     |   9 -21  84  72 -18 |
                      |       |                     |
                      | 9     | -11  46 104 -22   8 |
                      |       |                     |
                      | 10    |  18  38  48  23   0 |
                      |       |                     |
                      | 11    | -16  70  83 -21  11 |
                      |       |                     |
                      | 12    |   5 -11 117  22  -8 |
                      |       |                     |
                      | 13    |  -6  23 117 -12   3 |
                      |       |                     |
                      | 14    |   3  -8  95  28   4 |
                      |       |                     |
                      | 15    | -10  15  77  60 -15 |
                      |       |                     |
                      | 16    |  -1   4 124   2  -4 |
                      |       |                     |
                      | 17    |   3  38  84  24 -25 |
                      |       |                     |
                      | 18    |   2  13  42  13  31 |
                      |       |                     |
                      | 19    |  21  -4  56  46  -1 |
                      |       |                     |
                      | 20    |  -1  35  79 -13  19 |
                      |       |                     |
                      | 21    |  -7  65  88  -9 -14 |
                      |       |                     |
                      | 22    |  20   4  81  49 -29 |
                      |       |                     |
                      | 23    |  20   0  75   3 -17 |
                      |       |                     |
                      | 24    |   5  -9  44  92  -8 |
                      |       |                     |
                      | 25    |   1  -3  22  69  31 |
                      |       |                     |
                      | 26    |  -6  95  41 -12   5 |
                      |       |                     |
                      | 27    |  39  67  16  -4   1 |
                      |       |                     |
        
                      | 28    |   0  -6 120  55 -36 |
                      |       |                     |
                      | 29    | -13  44 122   4 -24 |
                      |       |                     |
                      | 30    |  81   5  11   3   7 |
                      |       |                     |
                      | 31    |   2   0   9  10  88 |
                      +-------+---------------------+
        
                      | 28    |   0  -6 120  55 -36 |
                      |       |                     |
                      | 29    | -13  44 122   4 -24 |
                      |       |                     |
                      | 30    |  81   5  11   3   7 |
                      |       |                     |
                      | 31    |   2   0   9  10  88 |
                      +-------+---------------------+
        

Table 41: Codebook Vectors for LTP Filter, Periodicity Index 2

表41:LTP滤波器的码本向量,周期性指数2

4.2.7.6.3. LTP Scaling Parameter
4.2.7.6.3. LTP缩放参数

An LTP scaling parameter appears after the LTP filter coefficients if and only if

LTP缩放参数出现在LTP滤波器系数之后,当且仅当

o This is a voiced frame (see Section 4.2.7.3), and

o 这是一个浊音帧(见第4.2.7.3节),以及

o Either

o 任何一个

* This SILK frame corresponds to the first time interval of the current Opus frame for its type (LBRR or regular), or

* 该丝质相框对应于其类型(LBRR或常规)当前Opus相框的第一时间间隔,或

* This is an LBRR frame where the LBRR flags (see Section 4.2.4) indicate the previous LBRR frame in the same channel is not coded.

* 这是一个LBRR帧,其中LBRR标志(见第4.2.4节)指示同一信道中的前一个LBRR帧未编码。

This allows the encoder to trade off the prediction gain between packets against the recovery time after packet loss. Unlike absolute-coding for pitch lags, regular SILK frames that are not at the start of an Opus frame (i.e., that do not correspond to the first 20 ms time interval in Opus frames of 40 or 60 ms) do not include this field, even if the prior frame was not voiced, or (in the case of the side channel) not even coded. After an uncoded frame in the side channel, the LTP buffer (see Section 4.2.7.9.1) is cleared to zero, and is thus in a known state. In contrast, LBRR frames do include this field when the prior frame was not coded, since the LTP buffer contains the output of the PLC, which is non-normative.

这允许编码器权衡分组之间的预测增益与分组丢失后的恢复时间。与音高滞后的绝对编码不同,不在Opus帧开始处的常规丝绸帧(即,不对应于40或60 ms的Opus帧中的前20 ms时间间隔)不包括该字段,即使前一帧没有浊音,或者(在侧频道的情况下)甚至没有编码。在侧信道中的未编码帧之后,LTP缓冲器(见第4.2.7.9.1节)被清除为零,因此处于已知状态。相反,当前一帧未编码时,LBRR帧包含此字段,因为LTP缓冲区包含PLC的输出,这是非标准的。

If present, the decoder reads a value using the 3-entry PDF in Table 42. The three possible values represent Q14 scale factors of 15565, 12288, and 8192, respectively (corresponding to approximately 0.95, 0.75, and 0.5). Frames that do not code the scaling parameter use the default factor of 15565 (approximately 0.95).

如果存在,解码器使用表42中的3项PDF读取值。这三个可能的值分别代表15565、12288和8192的Q14比例因子(对应于大约0.95、0.75和0.5)。未编码缩放参数的帧使用默认因子15565(约0.95)。

                           +-------------------+
                           | PDF               |
                           +-------------------+
                           | {128, 64, 64}/256 |
                           +-------------------+
        
                           +-------------------+
                           | PDF               |
                           +-------------------+
                           | {128, 64, 64}/256 |
                           +-------------------+
        

Table 42: PDF for LTP Scaling Parameter

表42:LTP缩放参数的PDF

4.2.7.7. Linear Congruential Generator (LCG) Seed
4.2.7.7. 线性同余发生器(LCG)种子

As described in Section 4.2.7.8.6, SILK uses a Linear Congruential Generator (LCG) to inject pseudorandom noise into the quantized excitation. To ensure synchronization of this process between the encoder and decoder, each SILK frame stores a 2-bit seed after the LTP parameters (if any). The encoder may consider the choice of seed during quantization, and the flexibility of this choice lets it reduce distortion, helping to pay for the bit cost required to signal it. The decoder reads the seed using the uniform 4-entry PDF in Table 43, yielding a value between 0 and 3, inclusive.

如第4.2.7.8.6节所述,SILK使用线性同余发生器(LCG)将伪随机噪声注入量化激励。为了确保编码器和解码器之间此过程的同步,每个丝帧在LTP参数(如果有)之后存储一个2位种子。编码器可以考虑种子在量化过程中的选择,并且这种选择的灵活性使其减少失真,有助于支付信号所需的比特成本。解码器使用表43中的统一4项PDF读取种子,产生0到3之间的值(包括0和3)。

                         +----------------------+
                         | PDF                  |
                         +----------------------+
                         | {64, 64, 64, 64}/256 |
                         +----------------------+
        
                         +----------------------+
                         | PDF                  |
                         +----------------------+
                         | {64, 64, 64, 64}/256 |
                         +----------------------+
        

Table 43: PDF for LCG Seed

表43:LCG种子的PDF格式

4.2.7.8. Excitation
4.2.7.8. 激发

SILK codes the excitation using a modified version of the Pyramid Vector Quantizer (PVQ) codebook [PVQ]. The PVQ codebook is designed for Laplace-distributed values and consists of all sums of K signed, unit pulses in a vector of dimension N, where two pulses at the same position are required to have the same sign. Thus, the codebook includes all integer codevectors y of dimension N that satisfy

SILK使用改进版的金字塔矢量量化器(PVQ)码本[PVQ]对激励进行编码。PVQ码本是针对拉普拉斯分布值设计的,由尺寸为N的向量中K个有符号单位脉冲的所有和组成,其中相同位置的两个脉冲需要具有相同的符号。因此,码本包括满足以下条件的维数为N的所有整数码向量y

                              N-1
                              __
                              \  abs(y[j]) = K
                              /_
                              j=0
        
                              N-1
                              __
                              \  abs(y[j]) = K
                              /_
                              j=0
        

Unlike regular PVQ, SILK uses a variable-length, rather than fixed-length, encoding. This encoding is better suited to the more Gaussian-like distribution of the coefficient magnitudes and the non-uniform distribution of their signs (caused by the quantization offset described below). SILK also handles large codebooks by coding

与常规PVQ不同,丝绸使用可变长度编码,而不是固定长度编码。该编码更适合于系数幅度的更高斯分布及其符号的非均匀分布(由下文描述的量化偏移引起)。SILK还通过编码处理大型码本

the least significant bits (LSBs) of each coefficient directly. This adds a small coding efficiency loss, but greatly reduces the computation time and ROM size required for decoding, as implemented in silk_decode_pulses() (decode_pulses.c).

每个系数的最低有效位(LSB)直接。这增加了较小的编码效率损失,但大大减少了解码所需的计算时间和ROM大小,如在silk_decode_pulses()(decode_pulses.c)中实现的那样。

SILK fixes the dimension of the codebook to N = 16. The excitation is made up of a number of "shell blocks", each 16 samples in size. Table 44 lists the number of shell blocks required for a SILK frame for each possible audio bandwidth and frame size. 10 ms MB frames nominally contain 120 samples (10 ms at 12 kHz), which is not a multiple of 16. This is handled by coding 8 shell blocks (128 samples) and discarding the final 8 samples of the last block. The decoder contains no special case that prevents an encoder from placing pulses in these samples, and they must be correctly parsed from the bitstream if present, but they are otherwise ignored.

SILK将码本的尺寸固定为N=16。激发由许多“壳块”组成,每个壳块大小为16个样品。表44列出了每种可能的音频带宽和帧大小的丝质帧所需的壳块数量。10 ms MB帧名义上包含120个样本(12 kHz时为10 ms),这不是16的倍数。这是通过编码8个外壳块(128个样本)并丢弃最后一个块的最后8个样本来处理的。解码器不包含阻止编码器在这些样本中放置脉冲的特殊情况,并且如果存在脉冲,则必须从比特流中正确解析脉冲,否则将忽略脉冲。

         +-----------------+------------+------------------------+
         | Audio Bandwidth | Frame Size | Number of Shell Blocks |
         +-----------------+------------+------------------------+
         | NB              | 10 ms      |                      5 |
         |                 |            |                        |
         | MB              | 10 ms      |                      8 |
         |                 |            |                        |
         | WB              | 10 ms      |                     10 |
         |                 |            |                        |
         | NB              | 20 ms      |                     10 |
         |                 |            |                        |
         | MB              | 20 ms      |                     15 |
         |                 |            |                        |
         | WB              | 20 ms      |                     20 |
         +-----------------+------------+------------------------+
        
         +-----------------+------------+------------------------+
         | Audio Bandwidth | Frame Size | Number of Shell Blocks |
         +-----------------+------------+------------------------+
         | NB              | 10 ms      |                      5 |
         |                 |            |                        |
         | MB              | 10 ms      |                      8 |
         |                 |            |                        |
         | WB              | 10 ms      |                     10 |
         |                 |            |                        |
         | NB              | 20 ms      |                     10 |
         |                 |            |                        |
         | MB              | 20 ms      |                     15 |
         |                 |            |                        |
         | WB              | 20 ms      |                     20 |
         +-----------------+------------+------------------------+
        

Table 44: Number of Shell Blocks Per SILK Frame

表44:每个丝框的壳块数量

4.2.7.8.1. Rate Level
4.2.7.8.1. 费率水平

The first symbol in the excitation is a "rate level", which is an index from 0 to 8, inclusive, coded using the PDF in Table 45 corresponding to the signal type of the current frame (from Section 4.2.7.3). The rate level selects the PDF used to decode the number of pulses in the individual shell blocks. It does not directly convey any information about the bitrate or the number of pulses itself, but merely changes the probability of the symbols in Section 4.2.7.8.2. Level 0 provides a more efficient encoding at low rates generally, and level 8 provides a more efficient encoding at high rates generally, though the most efficient level for a

激励中的第一个符号是“速率水平”,它是一个从0到8(含8)的索引,使用表45中的PDF编码,对应于当前帧的信号类型(来自第4.2.7.3节)。速率级别选择用于解码单个外壳块中脉冲数的PDF。它不直接传达有关比特率或脉冲数本身的任何信息,而只是改变第4.2.7.8.2节中符号的概率。级别0通常以较低的速率提供更高效的编码,级别8通常以较高的速率提供更高效的编码,尽管对于

particular SILK frame may depend on the exact distribution of the coded symbols. An encoder should, but is not required to, use the most efficient rate level.

特定的丝框可能取决于编码符号的精确分布。编码器应该(但不是必须)使用最有效的速率级别。

    +----------------------+------------------------------------------+
    | Signal Type          | PDF                                      |
    +----------------------+------------------------------------------+
    | Inactive or Unvoiced | {15, 51, 12, 46, 45, 13, 33, 27, 14}/256 |
    |                      |                                          |
    | Voiced               | {33, 30, 36, 17, 34, 49, 18, 21, 18}/256 |
    +----------------------+------------------------------------------+
        
    +----------------------+------------------------------------------+
    | Signal Type          | PDF                                      |
    +----------------------+------------------------------------------+
    | Inactive or Unvoiced | {15, 51, 12, 46, 45, 13, 33, 27, 14}/256 |
    |                      |                                          |
    | Voiced               | {33, 30, 36, 17, 34, 49, 18, 21, 18}/256 |
    +----------------------+------------------------------------------+
        

Table 45: PDFs for the Rate Level

表45:费率水平的PDF

4.2.7.8.2. Pulses per Shell Block
4.2.7.8.2. 每个壳块的脉冲数

The total number of pulses in each of the shell blocks follows the rate level. The pulse counts for all of the shell blocks are coded consecutively, before the content of any of the blocks. Each block may have anywhere from 0 to 16 pulses, inclusive, coded using the 18- entry PDF in Table 46 corresponding to the rate level from Section 4.2.7.8.1. The special value 17 indicates that this block has one or more additional LSBs to decode for each coefficient. If the decoder encounters this value, it decodes another value for the actual pulse count of the block, but uses the PDF corresponding to the special rate level 9 instead of the normal rate level. This process repeats until the decoder reads a value less than 17, and it then sets the number of extra LSBs used to the number of 17's decoded for that block. If it reads the value 17 ten times, then the next iteration uses the special rate level 10 instead of 9. The probability of decoding a 17 when using the PDF for rate level 10 is zero, ensuring that the number of LSBs for a block will not exceed 10. The cumulative distribution for rate level 10 is just a shifted version of that for 9 and thus does not require any additional storage.

每个外壳块中的脉冲总数遵循速率级别。在任何块的内容之前,对所有外壳块的脉冲计数进行连续编码。每个块可能有0到16个脉冲(包括),使用表46中的18个条目PDF编码,对应于第4.2.7.8.1节中的速率水平。特殊值17指示该块具有针对每个系数解码的一个或多个附加lsb。如果解码器遇到该值,则它对块的实际脉冲计数的另一个值进行解码,但使用与特殊速率级别9相对应的PDF,而不是正常速率级别。该过程重复进行,直到解码器读取到小于17的值,然后将用于该块解码的17个LSB的数量设置为额外LSB的数量。如果它读取值17十次,那么下一次迭代使用特殊费率级别10而不是9。将PDF用于速率级别10时解码17的概率为零,确保块的LSB数量不超过10。速率级别10的累积分布只是9的一个移位版本,因此不需要任何额外的存储。

   +----------+--------------------------------------------------------+
   | Rate     | PDF                                                    |
   | Level    |                                                        |
   +----------+--------------------------------------------------------+
   | 0        | {131, 74, 25, 8, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   |
   |          | 1, 1}/256                                              |
   |          |                                                        |
   | 1        | {58, 93, 60, 23, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   |
   |          | 1, 1}/256                                              |
   |          |                                                        |
   | 2        | {43, 51, 46, 33, 24, 16, 11, 8, 6, 3, 3, 3, 2, 1, 1,   |
   |          | 2, 1, 2}/256                                           |
   |          |                                                        |
   | 3        | {17, 52, 71, 57, 31, 12, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
   |          | 1, 1}/256                                              |
   |          |                                                        |
   | 4        | {6, 21, 41, 53, 49, 35, 21, 11, 6, 3, 2, 2, 1, 1, 1,   |
   |          | 1, 1, 1}/256                                           |
   |          |                                                        |
   | 5        | {7, 14, 22, 28, 29, 28, 25, 20, 17, 13, 11, 9, 7, 5,   |
   |          | 4, 4, 3, 10}/256                                       |
   |          |                                                        |
   | 6        | {2, 5, 14, 29, 42, 46, 41, 31, 19, 11, 6, 3, 2, 1, 1,  |
   |          | 1, 1, 1}/256                                           |
   |          |                                                        |
   | 7        | {1, 2, 4, 10, 19, 29, 35, 37, 34, 28, 20, 14, 8, 5, 4, |
   |          | 2, 2, 2}/256                                           |
   |          |                                                        |
   | 8        | {1, 2, 2, 5, 9, 14, 20, 24, 27, 28, 26, 23, 20, 15,    |
   |          | 11, 8, 6, 15}/256                                      |
   |          |                                                        |
   | 9        | {1, 1, 1, 6, 27, 58, 56, 39, 25, 14, 10, 6, 3, 3, 2,   |
   |          | 1, 1, 2}/256                                           |
   |          |                                                        |
   | 10       | {2, 1, 6, 27, 58, 56, 39, 25, 14, 10, 6, 3, 3, 2, 1,   |
   |          | 1, 2, 0}/256                                           |
   +----------+--------------------------------------------------------+
        
   +----------+--------------------------------------------------------+
   | Rate     | PDF                                                    |
   | Level    |                                                        |
   +----------+--------------------------------------------------------+
   | 0        | {131, 74, 25, 8, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   |
   |          | 1, 1}/256                                              |
   |          |                                                        |
   | 1        | {58, 93, 60, 23, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   |
   |          | 1, 1}/256                                              |
   |          |                                                        |
   | 2        | {43, 51, 46, 33, 24, 16, 11, 8, 6, 3, 3, 3, 2, 1, 1,   |
   |          | 2, 1, 2}/256                                           |
   |          |                                                        |
   | 3        | {17, 52, 71, 57, 31, 12, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
   |          | 1, 1}/256                                              |
   |          |                                                        |
   | 4        | {6, 21, 41, 53, 49, 35, 21, 11, 6, 3, 2, 2, 1, 1, 1,   |
   |          | 1, 1, 1}/256                                           |
   |          |                                                        |
   | 5        | {7, 14, 22, 28, 29, 28, 25, 20, 17, 13, 11, 9, 7, 5,   |
   |          | 4, 4, 3, 10}/256                                       |
   |          |                                                        |
   | 6        | {2, 5, 14, 29, 42, 46, 41, 31, 19, 11, 6, 3, 2, 1, 1,  |
   |          | 1, 1, 1}/256                                           |
   |          |                                                        |
   | 7        | {1, 2, 4, 10, 19, 29, 35, 37, 34, 28, 20, 14, 8, 5, 4, |
   |          | 2, 2, 2}/256                                           |
   |          |                                                        |
   | 8        | {1, 2, 2, 5, 9, 14, 20, 24, 27, 28, 26, 23, 20, 15,    |
   |          | 11, 8, 6, 15}/256                                      |
   |          |                                                        |
   | 9        | {1, 1, 1, 6, 27, 58, 56, 39, 25, 14, 10, 6, 3, 3, 2,   |
   |          | 1, 1, 2}/256                                           |
   |          |                                                        |
   | 10       | {2, 1, 6, 27, 58, 56, 39, 25, 14, 10, 6, 3, 3, 2, 1,   |
   |          | 1, 2, 0}/256                                           |
   +----------+--------------------------------------------------------+
        

Table 46: PDFs for the Pulse Count

表46:脉冲计数的PDF

4.2.7.8.3. Pulse Location Decoding
4.2.7.8.3. 脉冲位置译码

The locations of the pulses in each shell block follow the pulse counts, as decoded by silk_shell_decoder() (shell_coder.c). As with the pulse counts, these locations are coded for all the shell blocks before any of the remaining information for each block. Unlike many other codecs, SILK places no restriction on the distribution of

每个外壳块中的脉冲位置遵循由silk_shell_decoder()解码的脉冲计数(shell_coder.c)。与脉冲计数一样,在每个块的任何剩余信息之前,对所有外壳块的这些位置进行编码。与许多其他编解码器不同,SILK对数据的分发没有限制

pulses within a shell block. All of the pulses may be placed in a single location, or each one in a unique location, or anything in between.

壳块内的脉冲。所有脉冲可以放置在单个位置,或每个脉冲放置在唯一的位置,或两者之间的任何位置。

The location of pulses is coded by recursively partitioning each block into halves, and coding how many pulses fall on the left side of the split. All remaining pulses must fall on the right side of the split. The process then recurses into the left half, and after that returns, the right half (preorder traversal). The PDF to use is chosen by the size of the current partition (16, 8, 4, or 2) and the number of pulses in the partition (1 to 16, inclusive). Tables 47 through 50 list the PDFs used for each partition size and pulse count. This process skips partitions without any pulses, i.e., where the initial pulse count from Section 4.2.7.8.2 was zero, or where the split in the prior level indicated that all of the pulses fell on the other side. These partitions have nothing to code, so they require no PDF.

脉冲的位置通过递归地将每个块分成两半进行编码,并编码有多少脉冲落在分割的左侧。所有剩余脉冲必须落在分裂的右侧。然后该过程递归到左半部分,然后返回右半部分(前序遍历)。要使用的PDF由当前分区的大小(16、8、4或2)和分区中的脉冲数(1到16,包括1到16)选择。表47到表50列出了用于每个分区大小和脉冲计数的PDF。该过程跳过没有任何脉冲的分区,即,第4.2.7.8.2节中的初始脉冲计数为零,或者先前级别中的分割表明所有脉冲都落在另一侧。这些分区没有代码,因此不需要PDF。

   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {126, 130}/256                                       |
   |            |                                                      |
   | 2          | {56, 142, 58}/256                                    |
   |            |                                                      |
   | 3          | {25, 101, 104, 26}/256                               |
   |            |                                                      |
   | 4          | {12, 60, 108, 64, 12}/256                            |
   |            |                                                      |
   | 5          | {7, 35, 84, 87, 37, 6}/256                           |
   |            |                                                      |
   | 6          | {4, 20, 59, 86, 63, 21, 3}/256                       |
   |            |                                                      |
   | 7          | {3, 12, 38, 72, 75, 42, 12, 2}/256                   |
   |            |                                                      |
   | 8          | {2, 8, 25, 54, 73, 59, 27, 7, 1}/256                 |
   |            |                                                      |
   | 9          | {2, 5, 17, 39, 63, 65, 42, 18, 4, 1}/256             |
   |            |                                                      |
   | 10         | {1, 4, 12, 28, 49, 63, 54, 30, 11, 3, 1}/256         |
   |            |                                                      |
   | 11         | {1, 4, 8, 20, 37, 55, 57, 41, 22, 8, 2, 1}/256       |
   |            |                                                      |
   | 12         | {1, 3, 7, 15, 28, 44, 53, 48, 33, 16, 6, 1, 1}/256   |
   |            |                                                      |
   | 13         | {1, 2, 6, 12, 21, 35, 47, 48, 40, 25, 12, 5, 1,      |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 1, 4, 10, 17, 27, 37, 47, 43, 33, 21, 9, 4, 1,   |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 1, 1, 8, 14, 22, 33, 40, 43, 38, 28, 16, 8, 1,   |
   |            | 1, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 1, 1, 1, 13, 18, 27, 36, 41, 41, 34, 24, 14, 1,  |
   |            | 1, 1, 1}/256                                         |
   +------------+------------------------------------------------------+
        
   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {126, 130}/256                                       |
   |            |                                                      |
   | 2          | {56, 142, 58}/256                                    |
   |            |                                                      |
   | 3          | {25, 101, 104, 26}/256                               |
   |            |                                                      |
   | 4          | {12, 60, 108, 64, 12}/256                            |
   |            |                                                      |
   | 5          | {7, 35, 84, 87, 37, 6}/256                           |
   |            |                                                      |
   | 6          | {4, 20, 59, 86, 63, 21, 3}/256                       |
   |            |                                                      |
   | 7          | {3, 12, 38, 72, 75, 42, 12, 2}/256                   |
   |            |                                                      |
   | 8          | {2, 8, 25, 54, 73, 59, 27, 7, 1}/256                 |
   |            |                                                      |
   | 9          | {2, 5, 17, 39, 63, 65, 42, 18, 4, 1}/256             |
   |            |                                                      |
   | 10         | {1, 4, 12, 28, 49, 63, 54, 30, 11, 3, 1}/256         |
   |            |                                                      |
   | 11         | {1, 4, 8, 20, 37, 55, 57, 41, 22, 8, 2, 1}/256       |
   |            |                                                      |
   | 12         | {1, 3, 7, 15, 28, 44, 53, 48, 33, 16, 6, 1, 1}/256   |
   |            |                                                      |
   | 13         | {1, 2, 6, 12, 21, 35, 47, 48, 40, 25, 12, 5, 1,      |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 1, 4, 10, 17, 27, 37, 47, 43, 33, 21, 9, 4, 1,   |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 1, 1, 8, 14, 22, 33, 40, 43, 38, 28, 16, 8, 1,   |
   |            | 1, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 1, 1, 1, 13, 18, 27, 36, 41, 41, 34, 24, 14, 1,  |
   |            | 1, 1, 1}/256                                         |
   +------------+------------------------------------------------------+
        

Table 47: PDFs for Pulse Count Split, 16 Sample Partitions

表47:脉冲计数分割的PDF,16个示例分区

   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {127, 129}/256                                       |
   |            |                                                      |
   | 2          | {53, 149, 54}/256                                    |
   |            |                                                      |
   | 3          | {22, 105, 106, 23}/256                               |
   |            |                                                      |
   | 4          | {11, 61, 111, 63, 10}/256                            |
   |            |                                                      |
   | 5          | {6, 35, 86, 88, 36, 5}/256                           |
   |            |                                                      |
   | 6          | {4, 20, 59, 87, 62, 21, 3}/256                       |
   |            |                                                      |
   | 7          | {3, 13, 40, 71, 73, 41, 13, 2}/256                   |
   |            |                                                      |
   | 8          | {3, 9, 27, 53, 70, 56, 28, 9, 1}/256                 |
   |            |                                                      |
   | 9          | {3, 8, 19, 37, 57, 61, 44, 20, 6, 1}/256             |
   |            |                                                      |
   | 10         | {3, 7, 15, 28, 44, 54, 49, 33, 17, 5, 1}/256         |
   |            |                                                      |
   | 11         | {1, 7, 13, 22, 34, 46, 48, 38, 28, 14, 4, 1}/256     |
   |            |                                                      |
   | 12         | {1, 1, 11, 22, 27, 35, 42, 47, 33, 25, 10, 1, 1}/256 |
   |            |                                                      |
   | 13         | {1, 1, 6, 14, 26, 37, 43, 43, 37, 26, 14, 6, 1,      |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 1, 4, 10, 20, 31, 40, 42, 40, 31, 20, 10, 4, 1,  |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 1, 3, 8, 16, 26, 35, 38, 38, 35, 26, 16, 8, 3,   |
   |            | 1, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 1, 2, 6, 12, 21, 30, 36, 38, 36, 30, 21, 12, 6,  |
   |            | 2, 1, 1}/256                                         |
   +------------+------------------------------------------------------+
        
   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {127, 129}/256                                       |
   |            |                                                      |
   | 2          | {53, 149, 54}/256                                    |
   |            |                                                      |
   | 3          | {22, 105, 106, 23}/256                               |
   |            |                                                      |
   | 4          | {11, 61, 111, 63, 10}/256                            |
   |            |                                                      |
   | 5          | {6, 35, 86, 88, 36, 5}/256                           |
   |            |                                                      |
   | 6          | {4, 20, 59, 87, 62, 21, 3}/256                       |
   |            |                                                      |
   | 7          | {3, 13, 40, 71, 73, 41, 13, 2}/256                   |
   |            |                                                      |
   | 8          | {3, 9, 27, 53, 70, 56, 28, 9, 1}/256                 |
   |            |                                                      |
   | 9          | {3, 8, 19, 37, 57, 61, 44, 20, 6, 1}/256             |
   |            |                                                      |
   | 10         | {3, 7, 15, 28, 44, 54, 49, 33, 17, 5, 1}/256         |
   |            |                                                      |
   | 11         | {1, 7, 13, 22, 34, 46, 48, 38, 28, 14, 4, 1}/256     |
   |            |                                                      |
   | 12         | {1, 1, 11, 22, 27, 35, 42, 47, 33, 25, 10, 1, 1}/256 |
   |            |                                                      |
   | 13         | {1, 1, 6, 14, 26, 37, 43, 43, 37, 26, 14, 6, 1,      |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 1, 4, 10, 20, 31, 40, 42, 40, 31, 20, 10, 4, 1,  |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 1, 3, 8, 16, 26, 35, 38, 38, 35, 26, 16, 8, 3,   |
   |            | 1, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 1, 2, 6, 12, 21, 30, 36, 38, 36, 30, 21, 12, 6,  |
   |            | 2, 1, 1}/256                                         |
   +------------+------------------------------------------------------+
        

Table 48: PDFs for Pulse Count Split, 8 Sample Partitions

表48:脉冲计数分割的PDF,8个示例分区

   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {127, 129}/256                                       |
   |            |                                                      |
   | 2          | {49, 157, 50}/256                                    |
   |            |                                                      |
   | 3          | {20, 107, 109, 20}/256                               |
   |            |                                                      |
   | 4          | {11, 60, 113, 62, 10}/256                            |
   |            |                                                      |
   | 5          | {7, 36, 84, 87, 36, 6}/256                           |
   |            |                                                      |
   | 6          | {6, 24, 57, 82, 60, 23, 4}/256                       |
   |            |                                                      |
   | 7          | {5, 18, 39, 64, 68, 42, 16, 4}/256                   |
   |            |                                                      |
   | 8          | {6, 14, 29, 47, 61, 52, 30, 14, 3}/256               |
   |            |                                                      |
   | 9          | {1, 15, 23, 35, 51, 50, 40, 30, 10, 1}/256           |
   |            |                                                      |
   | 10         | {1, 1, 21, 32, 42, 52, 46, 41, 18, 1, 1}/256         |
   |            |                                                      |
   | 11         | {1, 6, 16, 27, 36, 42, 42, 36, 27, 16, 6, 1}/256     |
   |            |                                                      |
   | 12         | {1, 5, 12, 21, 31, 38, 40, 38, 31, 21, 12, 5, 1}/256 |
   |            |                                                      |
   | 13         | {1, 3, 9, 17, 26, 34, 38, 38, 34, 26, 17, 9, 3,      |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 3, 7, 14, 22, 29, 34, 36, 34, 29, 22, 14, 7, 3,  |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 2, 5, 11, 18, 25, 31, 35, 35, 31, 25, 18, 11, 5, |
   |            | 2, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 1, 4, 9, 15, 21, 28, 32, 34, 32, 28, 21, 15, 9,  |
   |            | 4, 1, 1}/256                                         |
   +------------+------------------------------------------------------+
        
   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {127, 129}/256                                       |
   |            |                                                      |
   | 2          | {49, 157, 50}/256                                    |
   |            |                                                      |
   | 3          | {20, 107, 109, 20}/256                               |
   |            |                                                      |
   | 4          | {11, 60, 113, 62, 10}/256                            |
   |            |                                                      |
   | 5          | {7, 36, 84, 87, 36, 6}/256                           |
   |            |                                                      |
   | 6          | {6, 24, 57, 82, 60, 23, 4}/256                       |
   |            |                                                      |
   | 7          | {5, 18, 39, 64, 68, 42, 16, 4}/256                   |
   |            |                                                      |
   | 8          | {6, 14, 29, 47, 61, 52, 30, 14, 3}/256               |
   |            |                                                      |
   | 9          | {1, 15, 23, 35, 51, 50, 40, 30, 10, 1}/256           |
   |            |                                                      |
   | 10         | {1, 1, 21, 32, 42, 52, 46, 41, 18, 1, 1}/256         |
   |            |                                                      |
   | 11         | {1, 6, 16, 27, 36, 42, 42, 36, 27, 16, 6, 1}/256     |
   |            |                                                      |
   | 12         | {1, 5, 12, 21, 31, 38, 40, 38, 31, 21, 12, 5, 1}/256 |
   |            |                                                      |
   | 13         | {1, 3, 9, 17, 26, 34, 38, 38, 34, 26, 17, 9, 3,      |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 3, 7, 14, 22, 29, 34, 36, 34, 29, 22, 14, 7, 3,  |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 2, 5, 11, 18, 25, 31, 35, 35, 31, 25, 18, 11, 5, |
   |            | 2, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 1, 4, 9, 15, 21, 28, 32, 34, 32, 28, 21, 15, 9,  |
   |            | 4, 1, 1}/256                                         |
   +------------+------------------------------------------------------+
        

Table 49: PDFs for Pulse Count Split, 4 Sample Partitions

表49:脉冲计数分割的PDF,4个示例分区

   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {128, 128}/256                                       |
   |            |                                                      |
   | 2          | {42, 172, 42}/256                                    |
   |            |                                                      |
   | 3          | {21, 107, 107, 21}/256                               |
   |            |                                                      |
   | 4          | {12, 60, 112, 61, 11}/256                            |
   |            |                                                      |
   | 5          | {8, 34, 86, 86, 35, 7}/256                           |
   |            |                                                      |
   | 6          | {8, 23, 55, 90, 55, 20, 5}/256                       |
   |            |                                                      |
   | 7          | {5, 15, 38, 72, 72, 36, 15, 3}/256                   |
   |            |                                                      |
   | 8          | {6, 12, 27, 52, 77, 47, 20, 10, 5}/256               |
   |            |                                                      |
   | 9          | {6, 19, 28, 35, 40, 40, 35, 28, 19, 6}/256           |
   |            |                                                      |
   | 10         | {4, 14, 22, 31, 37, 40, 37, 31, 22, 14, 4}/256       |
   |            |                                                      |
   | 11         | {3, 10, 18, 26, 33, 38, 38, 33, 26, 18, 10, 3}/256   |
   |            |                                                      |
   | 12         | {2, 8, 13, 21, 29, 36, 38, 36, 29, 21, 13, 8, 2}/256 |
   |            |                                                      |
   | 13         | {1, 5, 10, 17, 25, 32, 38, 38, 32, 25, 17, 10, 5,    |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 4, 7, 13, 21, 29, 35, 36, 35, 29, 21, 13, 7, 4,  |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 2, 5, 10, 17, 25, 32, 36, 36, 32, 25, 17, 10, 5, |
   |            | 2, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 2, 4, 7, 13, 21, 28, 34, 36, 34, 28, 21, 13, 7,  |
   |            | 4, 2, 1}/256                                         |
   +------------+------------------------------------------------------+
        
   +------------+------------------------------------------------------+
   | Pulse      | PDF                                                  |
   | Count      |                                                      |
   +------------+------------------------------------------------------+
   | 1          | {128, 128}/256                                       |
   |            |                                                      |
   | 2          | {42, 172, 42}/256                                    |
   |            |                                                      |
   | 3          | {21, 107, 107, 21}/256                               |
   |            |                                                      |
   | 4          | {12, 60, 112, 61, 11}/256                            |
   |            |                                                      |
   | 5          | {8, 34, 86, 86, 35, 7}/256                           |
   |            |                                                      |
   | 6          | {8, 23, 55, 90, 55, 20, 5}/256                       |
   |            |                                                      |
   | 7          | {5, 15, 38, 72, 72, 36, 15, 3}/256                   |
   |            |                                                      |
   | 8          | {6, 12, 27, 52, 77, 47, 20, 10, 5}/256               |
   |            |                                                      |
   | 9          | {6, 19, 28, 35, 40, 40, 35, 28, 19, 6}/256           |
   |            |                                                      |
   | 10         | {4, 14, 22, 31, 37, 40, 37, 31, 22, 14, 4}/256       |
   |            |                                                      |
   | 11         | {3, 10, 18, 26, 33, 38, 38, 33, 26, 18, 10, 3}/256   |
   |            |                                                      |
   | 12         | {2, 8, 13, 21, 29, 36, 38, 36, 29, 21, 13, 8, 2}/256 |
   |            |                                                      |
   | 13         | {1, 5, 10, 17, 25, 32, 38, 38, 32, 25, 17, 10, 5,    |
   |            | 1}/256                                               |
   |            |                                                      |
   | 14         | {1, 4, 7, 13, 21, 29, 35, 36, 35, 29, 21, 13, 7, 4,  |
   |            | 1}/256                                               |
   |            |                                                      |
   | 15         | {1, 2, 5, 10, 17, 25, 32, 36, 36, 32, 25, 17, 10, 5, |
   |            | 2, 1}/256                                            |
   |            |                                                      |
   | 16         | {1, 2, 4, 7, 13, 21, 28, 34, 36, 34, 28, 21, 13, 7,  |
   |            | 4, 2, 1}/256                                         |
   +------------+------------------------------------------------------+
        

Table 50: PDFs for Pulse Count Split, 2 Sample Partitions

表50:脉冲计数分割的PDF,2个示例分区

4.2.7.8.4. LSB Decoding
4.2.7.8.4. LSB译码

After the decoder reads the pulse locations for all blocks, it reads the LSBs (if any) for each block in turn. Inside each block, it reads all the LSBs for each coefficient in turn, even those where no

解码器读取所有块的脉冲位置后,依次读取每个块的LSB(如果有)。在每个块内,它依次读取每个系数的所有LSB,即使没有

pulses were allocated, before proceeding to the next one. For 10 ms MB frames, it reads LSBs even for the extra 8 samples in the last block. The LSBs are coded from most significant to least significant, and they all use the PDF in Table 51.

在继续下一个之前,已分配脉冲。对于10ms MB帧,即使最后一个块中额外的8个样本,它也会读取LSB。LSB从最显著到最不显著进行编码,它们都使用表51中的PDF。

                            +----------------+
                            | PDF            |
                            +----------------+
                            | {136, 120}/256 |
                            +----------------+
        
                            +----------------+
                            | PDF            |
                            +----------------+
                            | {136, 120}/256 |
                            +----------------+
        

Table 51: PDF for Excitation LSBs

表51:励磁LSB的PDF

The number of LSBs read for each coefficient in a block is determined in Section 4.2.7.8.2. The magnitude of the coefficient is initially equal to the number of pulses placed at that location in Section 4.2.7.8.3. As each LSB is decoded, the magnitude is doubled, and then the value of the LSB added to it, to obtain an updated magnitude.

第4.2.7.8.2节中确定了为块中每个系数读取的LSB数量。系数的大小最初等于第4.2.7.8.3节中放置在该位置的脉冲数。当每个LSB解码时,幅度加倍,然后将LSB的值添加到其中,以获得更新的幅度。

4.2.7.8.5. Sign Decoding
4.2.7.8.5. 符号解码

After decoding the pulse locations and the LSBs, the decoder knows the magnitude of each coefficient in the excitation. It then decodes a sign for all coefficients with a non-zero magnitude, using one of the PDFs from Table 52. If the value decoded is 0, then the coefficient magnitude is negated. Otherwise, it remains positive.

解码脉冲位置和LSB后,解码器知道激励中每个系数的大小。然后,它使用表52中的一个PDF对具有非零幅度的所有系数的符号进行解码。如果解码的值为0,则系数大小为负数。否则,它仍然是积极的。

The decoder chooses the PDF for the sign based on the signal type and quantization offset type (from Section 4.2.7.3) and the number of pulses in the block (from Section 4.2.7.8.2). The number of pulses in the block does not take into account any LSBs. Most PDFs are skewed towards negative signs because of the quantization offset, but the PDFs for zero pulses are highly skewed towards positive signs. If a block contains many positive coefficients, it is sometimes beneficial to code it solely using LSBs (i.e., with zero pulses), since the encoder may be able to save enough bits on the signs to justify the less efficient coefficient magnitude encoding.

解码器根据信号类型和量化偏移类型(第4.2.7.3节)以及块中的脉冲数(第4.2.7.8.2节)为符号选择PDF。块中的脉冲数不考虑任何LSB。由于量化偏移,大多数PDF向负号倾斜,但是零脉冲的PDF向正号高度倾斜。如果一个块包含许多正系数,则有时仅使用lsb(即,零脉冲)对其进行编码是有益的,因为编码器可能能够在符号上保存足够的位,以证明效率较低的系数幅度编码是合理的。

   +-------------+-----------------------+-------------+---------------+
   | Signal Type | Quantization Offset   | Pulse Count | PDF           |
   |             | Type                  |             |               |
   +-------------+-----------------------+-------------+---------------+
   | Inactive    | Low                   | 0           | {2, 254}/256  |
   |             |                       |             |               |
   | Inactive    | Low                   | 1           | {207, 49}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 2           | {189, 67}/256 |
        
   +-------------+-----------------------+-------------+---------------+
   | Signal Type | Quantization Offset   | Pulse Count | PDF           |
   |             | Type                  |             |               |
   +-------------+-----------------------+-------------+---------------+
   | Inactive    | Low                   | 0           | {2, 254}/256  |
   |             |                       |             |               |
   | Inactive    | Low                   | 1           | {207, 49}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 2           | {189, 67}/256 |
        
   | Inactive    | Low                   | 3           | {179, 77}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 4           | {174, 82}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 5           | {163, 93}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 6 or more   | {157, 99}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 0           | {58, 198}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 1           | {245, 11}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 2           | {238, 18}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 3           | {232, 24}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 4           | {225, 31}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 5           | {220, 36}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 6 or more   | {211, 45}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 0           | {1, 255}/256  |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 1           | {210, 46}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 2           | {190, 66}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 3           | {178, 78}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 4           | {169, 87}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 5           | {162, 94}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 6 or more   | {152,         |
   |             |                       |             | 104}/256      |
   |             |                       |             |               |
   | Unvoiced    | High                  | 0           | {48, 208}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 1           | {242, 14}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 2           | {235, 21}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 3           | {224, 32}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 4           | {214, 42}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 5           | {205, 51}/256 |
        
   | Inactive    | Low                   | 3           | {179, 77}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 4           | {174, 82}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 5           | {163, 93}/256 |
   |             |                       |             |               |
   | Inactive    | Low                   | 6 or more   | {157, 99}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 0           | {58, 198}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 1           | {245, 11}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 2           | {238, 18}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 3           | {232, 24}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 4           | {225, 31}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 5           | {220, 36}/256 |
   |             |                       |             |               |
   | Inactive    | High                  | 6 or more   | {211, 45}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 0           | {1, 255}/256  |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 1           | {210, 46}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 2           | {190, 66}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 3           | {178, 78}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 4           | {169, 87}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 5           | {162, 94}/256 |
   |             |                       |             |               |
   | Unvoiced    | Low                   | 6 or more   | {152,         |
   |             |                       |             | 104}/256      |
   |             |                       |             |               |
   | Unvoiced    | High                  | 0           | {48, 208}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 1           | {242, 14}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 2           | {235, 21}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 3           | {224, 32}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 4           | {214, 42}/256 |
   |             |                       |             |               |
   | Unvoiced    | High                  | 5           | {205, 51}/256 |
        
   | Unvoiced    | High                  | 6 or more   | {190, 66}/256 |
   |             |                       |             |               |
   | Voiced      | Low                   | 0           | {1, 255}/256  |
   |             |                       |             |               |
   | Voiced      | Low                   | 1           | {162, 94}/256 |
   |             |                       |             |               |
   | Voiced      | Low                   | 2           | {152,         |
   |             |                       |             | 104}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 3           | {147,         |
   |             |                       |             | 109}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 4           | {144,         |
   |             |                       |             | 112}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 5           | {141,         |
   |             |                       |             | 115}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 6 or more   | {138,         |
   |             |                       |             | 118}/256      |
   |             |                       |             |               |
   | Voiced      | High                  | 0           | {8, 248}/256  |
   |             |                       |             |               |
   | Voiced      | High                  | 1           | {203, 53}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 2           | {187, 69}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 3           | {176, 80}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 4           | {168, 88}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 5           | {161, 95}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 6 or more   | {154,         |
   |             |                       |             | 102}/256      |
   +-------------+-----------------------+-------------+---------------+
        
   | Unvoiced    | High                  | 6 or more   | {190, 66}/256 |
   |             |                       |             |               |
   | Voiced      | Low                   | 0           | {1, 255}/256  |
   |             |                       |             |               |
   | Voiced      | Low                   | 1           | {162, 94}/256 |
   |             |                       |             |               |
   | Voiced      | Low                   | 2           | {152,         |
   |             |                       |             | 104}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 3           | {147,         |
   |             |                       |             | 109}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 4           | {144,         |
   |             |                       |             | 112}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 5           | {141,         |
   |             |                       |             | 115}/256      |
   |             |                       |             |               |
   | Voiced      | Low                   | 6 or more   | {138,         |
   |             |                       |             | 118}/256      |
   |             |                       |             |               |
   | Voiced      | High                  | 0           | {8, 248}/256  |
   |             |                       |             |               |
   | Voiced      | High                  | 1           | {203, 53}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 2           | {187, 69}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 3           | {176, 80}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 4           | {168, 88}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 5           | {161, 95}/256 |
   |             |                       |             |               |
   | Voiced      | High                  | 6 or more   | {154,         |
   |             |                       |             | 102}/256      |
   +-------------+-----------------------+-------------+---------------+
        

Table 52: PDFs for Excitation Signs

表52:激励标志的PDF

4.2.7.8.6. Reconstructing the Excitation
4.2.7.8.6. 重建激励

After the signs have been read, there is enough information to reconstruct the complete excitation signal. This requires adding a constant quantization offset to each non-zero sample and then pseudorandomly inverting and offsetting every sample. The constant quantization offset varies depending on the signal type and quantization offset type (see Section 4.2.7.3).

读取信号后,有足够的信息重建完整的激励信号。这需要向每个非零样本添加一个恒定的量化偏移,然后伪随机反转和偏移每个样本。恒定量化偏移根据信号类型和量化偏移类型而变化(见第4.2.7.3节)。

   +-------------+--------------------------+--------------------------+
   | Signal Type | Quantization Offset Type |      Quantization Offset |
   |             |                          |                    (Q23) |
   +-------------+--------------------------+--------------------------+
   | Inactive    | Low                      |                       25 |
   |             |                          |                          |
   | Inactive    | High                     |                       60 |
   |             |                          |                          |
   | Unvoiced    | Low                      |                       25 |
   |             |                          |                          |
   | Unvoiced    | High                     |                       60 |
   |             |                          |                          |
   | Voiced      | Low                      |                        8 |
   |             |                          |                          |
   | Voiced      | High                     |                       25 |
   +-------------+--------------------------+--------------------------+
        
   +-------------+--------------------------+--------------------------+
   | Signal Type | Quantization Offset Type |      Quantization Offset |
   |             |                          |                    (Q23) |
   +-------------+--------------------------+--------------------------+
   | Inactive    | Low                      |                       25 |
   |             |                          |                          |
   | Inactive    | High                     |                       60 |
   |             |                          |                          |
   | Unvoiced    | Low                      |                       25 |
   |             |                          |                          |
   | Unvoiced    | High                     |                       60 |
   |             |                          |                          |
   | Voiced      | Low                      |                        8 |
   |             |                          |                          |
   | Voiced      | High                     |                       25 |
   +-------------+--------------------------+--------------------------+
        

Table 53: Excitation Quantization Offsets

表53:激励量化偏移

Let e_raw[i] be the raw excitation value at position i, with a magnitude composed of the pulses at that location (see Section 4.2.7.8.3) combined with any additional LSBs (see Section 4.2.7.8.4), and with the corresponding sign decoded in Section 4.2.7.8.5. Additionally, let seed be the current pseudorandom seed, which is initialized to the value decoded from Section 4.2.7.7 for the first sample in the current SILK frame, and updated for each subsequent sample according to the procedure below. Finally, let offset_Q23 be the quantization offset from Table 53. Then the following procedure produces the final reconstructed excitation value, e_Q23[i]:

设e_raw[i]为位置i处的原始激励值,其幅值由该位置的脉冲(见第4.2.7.8.3节)与任何附加LSB(见第4.2.7.8.4节)组合而成,并在第4.2.7.8.5节中解码相应符号。此外,设种子为当前伪随机种子,该种子被初始化为根据第4.2.7.7节对当前丝帧中的第一个样本解码的值,并根据以下程序对每个后续样本进行更新。最后,让offset_Q23是来自表53的量化偏移。然后,以下程序产生最终重构激励值e_Q23[i]:

        e_Q23[i] = (e_raw[i] << 8) - sign(e_raw[i])*20 + offset_Q23;
            seed = (196314165*seed + 907633515) & 0xFFFFFFFF;
        e_Q23[i] = (seed & 0x80000000) ? -e_Q23[i] : e_Q23[i];
            seed = (seed + e_raw[i]) & 0xFFFFFFFF;
        
        e_Q23[i] = (e_raw[i] << 8) - sign(e_raw[i])*20 + offset_Q23;
            seed = (196314165*seed + 907633515) & 0xFFFFFFFF;
        e_Q23[i] = (seed & 0x80000000) ? -e_Q23[i] : e_Q23[i];
            seed = (seed + e_raw[i]) & 0xFFFFFFFF;
        

When e_raw[i] is zero, sign() returns 0 by the definition in Section 1.1.4, so the factor of 20 does not get added. The final e_Q23[i] value may require more than 16 bits per sample, but it will not require more than 23, including the sign.

当e_raw[i]为零时,根据第1.1.4节中的定义,sign()返回0,因此不会添加因子20。最终的e_Q23[i]值可能需要每个样本超过16位,但不需要超过23位,包括符号。

4.2.7.9. SILK Frame Reconstruction
4.2.7.9. 真丝框架重建

The remainder of the reconstruction process for the frame does not need to be bit-exact, as small errors should only introduce proportionally small distortions. Although the reference implementation only includes a fixed-point version of the remaining

帧重建过程的其余部分不需要精确到位,因为小误差只会引入成比例的小失真。尽管参考实现只包括剩余的一个定点版本

steps, this section describes them in terms of a floating-point version for simplicity. This produces a signal with a nominal range of -1.0 to 1.0.

为了简单起见,本节将从浮点版本的角度介绍这些步骤。这将产生标称范围为-1.0至1.0的信号。

silk_decode_core() (decode_core.c) contains the code for the main reconstruction process. It proceeds subframe-by-subframe, since quantization gains, LTP parameters, and (in 20 ms SILK frames) LPC coefficients can vary from one to the next.

silk_decode_core()(decode_core.c)包含主重建过程的代码。它逐子帧进行,因为量化增益、LTP参数和(在20 ms丝绸帧中)LPC系数可以在一个帧到另一个帧之间变化。

Let a_Q12[k] be the LPC coefficients for the current subframe. If this is the first or second subframe of a 20 ms SILK frame and the LSF interpolation factor, w_Q2 (see Section 4.2.7.5.5), is less than 4, then these correspond to the final LPC coefficients produced by Section 4.2.7.5.8 from the interpolated LSF coefficients, n1_Q15[k] (computed in Section 4.2.7.5.5). Otherwise, they correspond to the final LPC coefficients produced from the uninterpolated LSF coefficients for the current frame, n2_Q15[k].

设a_Q12[k]为当前子帧的LPC系数。如果这是20ms真丝帧的第一或第二子帧,且LSF插值因子w_Q2(见第4.2.7.5.5节)小于4,则这些对应于第4.2.7.5.8节根据插值LSF系数n1_Q15[k](在第4.2.7.5.5节中计算)产生的最终LPC系数。否则,它们对应于从当前帧的未合并LSF系数产生的最终LPC系数n2_Q15[k]。

Also, let n be the number of samples in a subframe (40 for NB, 60 for MB, and 80 for WB), s be the index of the current subframe in this SILK frame (0 or 1 for 10 ms frames, or 0 to 3 for 20 ms frames), and j be the index of the first sample in the residual corresponding to the current subframe.

此外,设n是子帧中的样本数(40表示NB,60表示MB,80表示WB),s是该真丝帧中当前子帧的索引(0或1表示10ms帧,或0到3表示20ms帧),j是对应于当前子帧的残差中的第一个样本的索引。

4.2.7.9.1. LTP Synthesis
4.2.7.9.1. LTP合成

For unvoiced frames (see Section 4.2.7.3), the LPC residual for i such that j <= i < (j + n) is simply a normalized copy of the excitation signal, i.e.,

对于清音帧(见第4.2.7.3节),i的LPC残差使得j<=i<(j+n)只是激励信号的标准化副本,即。,

                                       e_Q23[i]
                             res[i] = ---------
                                       2.0**23
        
                                       e_Q23[i]
                             res[i] = ---------
                                       2.0**23
        
   Voiced SILK frames, on the other hand, pass the excitation through an
   LTP filter using the parameters decoded in Section 4.2.7.6 to produce
   an LPC residual.  The LTP filter requires LPC residual values from
   before the current subframe as input.  However, since the LPC
   coefficients may have changed, it obtains this residual by
   "rewhitening" the corresponding output signal using the LPC
   coefficients from the current subframe.  Let out[i] for i such that
   (j - pitch_lags[s] - d_LPC - 2) <= i < j be the fully reconstructed
   output signal from the last (pitch_lags[s] + d_LPC + 2) samples of
   previous subframes (see Section 4.2.7.9.2), where pitch_lags[s] is
   the pitch lag for the current subframe from Section 4.2.7.6.1.
   Additionally, let lpc[i] for i such that (j - s*n - d_LPC) <= i < j
   be the fully reconstructed output signal from the last (s*n + d_LPC)
        
   Voiced SILK frames, on the other hand, pass the excitation through an
   LTP filter using the parameters decoded in Section 4.2.7.6 to produce
   an LPC residual.  The LTP filter requires LPC residual values from
   before the current subframe as input.  However, since the LPC
   coefficients may have changed, it obtains this residual by
   "rewhitening" the corresponding output signal using the LPC
   coefficients from the current subframe.  Let out[i] for i such that
   (j - pitch_lags[s] - d_LPC - 2) <= i < j be the fully reconstructed
   output signal from the last (pitch_lags[s] + d_LPC + 2) samples of
   previous subframes (see Section 4.2.7.9.2), where pitch_lags[s] is
   the pitch lag for the current subframe from Section 4.2.7.6.1.
   Additionally, let lpc[i] for i such that (j - s*n - d_LPC) <= i < j
   be the fully reconstructed output signal from the last (s*n + d_LPC)
        

samples of previous subframes before clamping (see Section 4.2.7.9.2). During reconstruction of the first subframe for this channel after either

夹紧前的副车架样品(见第4.2.7.9.2节)。在以下任一之后重建该信道的第一子帧期间:

o An uncoded regular SILK frame (if this is the side channel), or

o 未编码的常规丝绸框架(如果这是侧通道),或

o A decoder reset (see Section 4.5.2),

o 解码器复位(见第4.5.2节),

out[i] and lpc[i] are initially cleared to all zeros. If this is the third or fourth subframe of a 20 ms SILK frame and the LSF interpolation factor, w_Q2 (see Section 4.2.7.5.5), is less than 4, then let out_end be set to (j - (s-2)*n) and let LTP_scale_Q14 be set to 16384. Otherwise, set out_end to (j - s*n) and set LTP_scale_Q14 to the Q14 LTP scaling value from Section 4.2.7.6.3. Then, for i such that (j - pitch_lags[s] - 2) <= i < out_end, out[i] is rewhitened into an LPC residual, res[i], via

out[i]和lpc[i]最初全部清零。如果这是20 ms真丝帧的第三或第四个子帧,并且LSF插值因子w_Q2(参见第4.2.7.5.5节)小于4,则将“放出来”端设置为(j-(s-2)*n),并将LTP_比例_Q14设置为16384。否则,从第4.2.7.6.3节开始,将_end设置为(j-s*n),并将LTP_比例_Q14设置为Q14 LTP比例值。然后,对于i,使得(j-pitch_lags[s]-2)<=i<out_end,out[i]通过

             4.0*LTP_scale_Q14
    res[i] = ----------------- * clamp(-1.0,
                gain_Q16[s]
                                       d_LPC-1
                                         __              a_Q12[k]
                                out[i] - \  out[i-k-1] * --------, 1.0)
                                         /_               4096.0
                                         k=0
        
             4.0*LTP_scale_Q14
    res[i] = ----------------- * clamp(-1.0,
                gain_Q16[s]
                                       d_LPC-1
                                         __              a_Q12[k]
                                out[i] - \  out[i-k-1] * --------, 1.0)
                                         /_               4096.0
                                         k=0
        

This requires storage to buffer up to 306 values of out[i] from previous subframes. This corresponds to WB with a maximum pitch lag of 18 ms * 16 kHz samples, plus 16 samples for d_LPC, plus 2 samples for the width of the LTP filter. Then, for i such that out_end <= i < j, lpc[i] is rewhitened into an LPC residual, res[i], via

这需要存储来缓冲来自先前子帧的多达306个out[i]值。这对应于WB,最大基音滞后为18 ms*16 kHz样本,加上d_LPC的16个样本,再加上LTP滤波器宽度的2个样本。然后,对于i,使得out_end<=i<j,lpc[i]被重新加权为lpc残差res[i],通过

                                        d_LPC-1
                    65536.0               __              a_Q12[k]
         res[i] = ----------- * (lpc[i] - \  lpc[i-k-1] * --------)
                  gain_Q16[s]             /_               4096.0
                                          k=0
        
                                        d_LPC-1
                    65536.0               __              a_Q12[k]
         res[i] = ----------- * (lpc[i] - \  lpc[i-k-1] * --------)
                  gain_Q16[s]             /_               4096.0
                                          k=0
        

This requires storage to buffer up to 256 values of lpc[i] from previous subframes (240 from the current SILK frame and 16 from the previous SILK frame). This corresponds to WB with up to three previous subframes in the current SILK frame, plus 16 samples for d_LPC. The astute reader will notice that, given the definition of lpc[i] in Section 4.2.7.9.2, the output of this latter equation is merely a scaled version of the values of res[i] from previous subframes.

这需要存储来缓冲来自先前子帧的多达256个lpc[i]值(来自当前丝帧的240个和来自先前丝帧的16个)。这对应于WB,在当前的丝框中有多达三个先前的子帧,加上16个d_LPC样本。精明的读者会注意到,鉴于第4.2.7.9.2节中lpc[i]的定义,后一个方程的输出仅是来自先前子帧的res[i]值的缩放版本。

   Let e_Q23[i] for j <= i < (j + n) be the excitation for the current
   subframe, and b_Q7[k] for 0 <= k < 5 be the coefficients of the LTP
   filter taken from the codebook entry in one of Tables 39 through 41
   corresponding to the index decoded for the current subframe in
   Section 4.2.7.6.2.  Then for i such that j <= i < (j + n), the LPC
   residual is
        
   Let e_Q23[i] for j <= i < (j + n) be the excitation for the current
   subframe, and b_Q7[k] for 0 <= k < 5 be the coefficients of the LTP
   filter taken from the codebook entry in one of Tables 39 through 41
   corresponding to the index decoded for the current subframe in
   Section 4.2.7.6.2.  Then for i such that j <= i < (j + n), the LPC
   residual is
        
                            4
                e_Q23[i]   __                                  b_Q7[k]
      res[i] = --------- + \  res[i - pitch_lags[s] + 2 - k] * -------
                2.0**23    /_                                   128.0
                           k=0
        
                            4
                e_Q23[i]   __                                  b_Q7[k]
      res[i] = --------- + \  res[i - pitch_lags[s] + 2 - k] * -------
                2.0**23    /_                                   128.0
                           k=0
        
4.2.7.9.2. LPC Synthesis
4.2.7.9.2. LPC合成

LPC synthesis uses the short-term LPC filter to predict the next output coefficient. For i such that (j - d_LPC) <= i < j, let lpc[i] be the result of LPC synthesis from the last d_LPC samples of the previous subframe or zeros in the first subframe for this channel after either

LPC合成使用短期LPC滤波器来预测下一个输出系数。对于i,使得(j-d_LPC)<=i<j,让LPC[i]是从前一子帧的最后d_LPC样本或之后该信道的第一子帧中的零进行LPC合成的结果

o An uncoded regular SILK frame (if this is the side channel), or

o 未编码的常规丝绸框架(如果这是侧通道),或

o A decoder reset (see Section 4.5.2).

o 解码器复位(见第4.5.2节)。

   Then, for i such that j <= i < (j + n), the result of LPC synthesis
   for the current subframe is
        
   Then, for i such that j <= i < (j + n), the result of LPC synthesis
   for the current subframe is
        
                                        d_LPC-1
                   gain_Q16[i]            __              a_Q12[k]
          lpc[i] = ----------- * res[i] + \  lpc[i-k-1] * --------
                     65536.0              /_               4096.0
                                          k=0
        
                                        d_LPC-1
                   gain_Q16[i]            __              a_Q12[k]
          lpc[i] = ----------- * res[i] + \  lpc[i-k-1] * --------
                     65536.0              /_               4096.0
                                          k=0
        

The decoder saves the final d_LPC values, i.e., lpc[i] such that (j + n - d_LPC) <= i < (j + n), to feed into the LPC synthesis of the next subframe. This requires storage for up to 16 values of lpc[i] (for WB frames).

解码器保存最终的d_LPC值,即LPC[i],使得(j+n-d_LPC)<=i<(j+n),以馈送到下一子帧的LPC合成中。这需要存储多达16个lpc[i]值(用于WB帧)。

Then, the signal is clamped into the final nominal range:

然后,将信号钳制在最终标称范围内:

out[i] = clamp(-1.0, lpc[i], 1.0)

out[i]=钳位(-1.0,lpc[i],1.0)

This clamping occurs entirely after the LPC synthesis filter has run. The decoder saves the unclamped values, lpc[i], to feed into the LPC filter for the next subframe, but saves the clamped values, out[i], for rewhitening in voiced frames.

这种箝位完全发生在LPC合成滤波器运行之后。解码器保存未压缩的值lpc[i],以便为下一子帧馈送到lpc滤波器,但保存已压缩的值out[i],以便在浊音帧中重新加白。

4.2.8. Stereo Unmixing
4.2.8. 立体解混

For stereo streams, after decoding a frame from each channel, the decoder must convert the mid-side (MS) representation into a left-right (LR) representation. The function silk_stereo_MS_to_LR (stereo_MS_to_LR.c) implements this process. In it, the decoder predicts the side channel using a) a simple low-passed version of the mid channel, and b) the unfiltered mid channel, using the prediction weights decoded in Section 4.2.7.1. This simple low-pass filter imposes a one-sample delay, and the unfiltered mid channel is also delayed by one sample. In order to allow seamless switching between stereo and mono, mono streams must also impose the same one-sample delay. The encoder requires an additional one-sample delay for both mono and stereo streams, though an encoder may omit the delay for mono if it knows it will never switch to stereo.

对于立体声流,在解码来自每个通道的帧后,解码器必须将中间(MS)表示转换为左右(LR)表示。函数silk_stereo_MS_to_LR(stereo_MS_to_LR.c)实现了这个过程。其中,解码器使用a)中间信道的简单低通版本和b)未滤波中间信道预测侧信道,使用第4.2.7.1节中解码的预测权重。这个简单的低通滤波器施加一个采样延迟,未滤波的中间信道也延迟一个采样。为了实现立体声和单声道之间的无缝切换,单声道流还必须施加相同的单采样延迟。编码器对单声道和立体声流都需要额外的一个采样延迟,但如果编码器知道它永远不会切换到立体声,它可能会忽略单声道的延迟。

The unmixing process operates in two phases. The first phase lasts for 8 ms, during which it interpolates the prediction weights from the previous frame, prev_w0_Q13 and prev_w1_Q13, to the values for the current frame, w0_Q13 and w1_Q13. The second phase simply uses these weights for the remainder of the frame.

混合进程分两个阶段进行。第一阶段持续8 ms,在此期间,它将前一帧prev_w0_Q13和prev_w1_Q13的预测权重插值到当前帧w0_Q13和w1_Q13的值。第二阶段只是对帧的其余部分使用这些权重。

Let mid[i] and side[i] be the contents of out[i] (from Section 4.2.7.9.2) for the current mid and side channels, respectively, and let left[i] and right[i] be the corresponding stereo output channels. If the side channel is not coded (see Section 4.2.7.2), then side[i] is set to zero. Also, let j be defined as in Section 4.2.7.9, n1 be the number of samples in phase 1 (64 for NB, 96 for MB, and 128 for WB), and n2 be the total number of samples in the frame. Then, for i such that j <= i < (j + n2), the left and right channel output is

设中间[i]和侧面[i]分别为当前中间和侧面声道的输出[i](来自第4.2.7.9.2节)的内容,并设左[i]和右[i]为相应的立体声输出声道。如果未对侧信道进行编码(见第4.2.7.2节),则侧[i]设置为零。此外,如第4.2.7.9节所述,将j定义为,n1为第1阶段的样本数量(NB为64,MB为96,WB为128),n2为框架中的样本总数。然后,对于i使得j<=i<(j+n2),左和右信道输出为

                   prev_w0_Q13                  (w0_Q13 - prev_w0_Q13)
             w0 =  ----------- + min(i - j, n1)*----------------------
                     8192.0                           8192.0*n1
        
                   prev_w0_Q13                  (w0_Q13 - prev_w0_Q13)
             w0 =  ----------- + min(i - j, n1)*----------------------
                     8192.0                           8192.0*n1
        
                   prev_w1_Q13                  (w1_Q13 - prev_w1_Q13)
             w1 =  ----------- + min(i - j, n1)*----------------------
                     8192.0                            8192.0*n1
        
                   prev_w1_Q13                  (w1_Q13 - prev_w1_Q13)
             w1 =  ----------- + min(i - j, n1)*----------------------
                     8192.0                            8192.0*n1
        
                  mid[i-2] + 2*mid[i-1] + mid[i]
             p0 = ------------------------------
                               4.0
        
                  mid[i-2] + 2*mid[i-1] + mid[i]
             p0 = ------------------------------
                               4.0
        
      left[i] = clamp(-1.0, (1 + w1)*mid[i-1] + side[i-1] + w0*p0, 1.0)
        
      left[i] = clamp(-1.0, (1 + w1)*mid[i-1] + side[i-1] + w0*p0, 1.0)
        
     right[i] = clamp(-1.0, (1 - w1)*mid[i-1] - side[i-1] - w0*p0, 1.0)
        
     right[i] = clamp(-1.0, (1 - w1)*mid[i-1] - side[i-1] - w0*p0, 1.0)
        

These formulas require two samples prior to index j, the start of the frame, for the mid channel, and one prior sample for the side channel. For the first frame after a decoder reset, zeros are used instead.

对于中间通道,这些公式需要在索引j(帧的开始)之前进行两次采样,对于侧通道,需要进行一次采样。对于解码器复位后的第一帧,使用零代替。

4.2.9. Resampling
4.2.9. 重采样

After stereo unmixing (if any), the decoder applies resampling to convert the decoded SILK output to the sample rate desired by the application. This is necessary when decoding a Hybrid frame at SWB or FB sample rates, or whenever the decoder wants the output at a different sample rate than the internal SILK sampling rate (e.g., to allow a constant sample rate when the audio bandwidth changes, or to allow mixing with audio from other applications). The resampler itself is non-normative, and a decoder can use any method it wants to perform the resampling.

在立体分解(如果有)之后,解码器应用重采样以将解码后的丝绸输出转换为应用所需的采样率。当以SWB或FB采样率解码混合帧时,或当解码器希望以不同于内部丝绸采样率的采样率输出时(例如,当音频带宽改变时允许恒定采样率,或允许与来自其他应用的音频混合),这是必需的。重采样器本身是非规范的,解码器可以使用它想要执行重采样的任何方法。

However, a minimum amount of delay is imposed to allow the resampler to operate, and this delay is normative, so that the corresponding delay can be applied to the MDCT layer in the encoder. A decoder is always free to use a resampler that requires more delay than allowed for here (e.g., to improve quality), but it must then delay the output of the MDCT layer by this extra amount. Keeping as much delay as possible on the encoder side allows an encoder that knows it will never use any of the SILK or Hybrid modes to skip this delay. By contrast, if it were all applied by the decoder, then a decoder that processes audio in fixed-size blocks would be forced to delay the output of CELT frames just in case of a later switch to a SILK or Hybrid mode.

然而,施加最小延迟量以允许重采样器操作,并且该延迟是规范性的,因此相应的延迟可以应用于编码器中的MDCT层。解码器总是可以自由地使用需要比此处允许的更多延迟的重采样器(例如,为了提高质量),但随后必须将MDCT层的输出延迟这个额外的量。在编码器侧保持尽可能多的延迟,允许编码器知道它永远不会使用任何丝绸或混合模式跳过此延迟。相反,如果它都由解码器应用,那么在固定大小块中处理音频的解码器将被迫延迟CELT帧的输出,以防稍后切换到SILK或Hybrid模式。

Table 54 gives the maximum resampler delay in samples at 48 kHz for each SILK audio bandwidth. Because the actual output rate may not be 48 kHz, it may not be possible to achieve exactly these delays while using a whole number of input or output samples. The reference implementation is able to resample to any of the supported output sampling rates (8, 12, 16, 24, or 48 kHz) within or near this delay constraint. Some resampling filters (including those used by the reference implementation) may add a delay that is not an exact integer, or is not linear-phase, and so cannot be represented by a single delay at all frequencies. However, such deviations are unlikely to be perceptible, and the comparison tool described in Section 6 is designed to be relatively insensitive to them. The delays listed here are the ones that should be targeted by the encoder.

表54给出了每个音频带宽在48 kHz时的最大重采样延迟。由于实际输出速率可能不是48 kHz,因此在使用完整数量的输入或输出样本时,可能无法精确实现这些延迟。参考实现能够在该延迟约束之内或附近对任何支持的输出采样率(8、12、16、24或48 kHz)进行重采样。一些重采样滤波器(包括参考实现所使用的滤波器)可能会添加非精确整数或非线性相位的延迟,因此不能在所有频率下由单个延迟表示。然而,此类偏差不太可能被察觉,第6节中描述的比较工具被设计为对其相对不敏感。这里列出的延迟是编码器应该针对的延迟。

                +-----------------+-----------------------+
                | Audio Bandwidth | Delay in Milliseconds |
                +-----------------+-----------------------+
                | NB              | 0.538                 |
                |                 |                       |
                | MB              | 0.692                 |
                |                 |                       |
                | WB              | 0.706                 |
                +-----------------+-----------------------+
        
                +-----------------+-----------------------+
                | Audio Bandwidth | Delay in Milliseconds |
                +-----------------+-----------------------+
                | NB              | 0.538                 |
                |                 |                       |
                | MB              | 0.692                 |
                |                 |                       |
                | WB              | 0.706                 |
                +-----------------+-----------------------+
        

Table 54: SILK Resampler Delay Allocations

表54:丝绸重采样器延迟分配

NB is given a smaller decoder delay allocation than MB and WB to allow a higher-order filter when resampling to 8 kHz in both the encoder and decoder. This implies that the audio content of two SILK frames operating at different bandwidths is not perfectly aligned in time. This is not an issue for any transitions described in Section 4.5, because they all involve a SILK decoder reset. When the decoder is reset, any samples remaining in the resampling buffer are discarded, and the resampler is re-initialized with silence.

与MB和WB相比,NB的解码器延迟分配更小,以便在编码器和解码器中重新采样到8 kHz时允许使用高阶滤波器。这意味着在不同带宽下运行的两个真丝框架的音频内容在时间上没有完全对齐。这不是第4.5节中描述的任何转换的问题,因为它们都涉及丝绸解码器重置。重置解码器时,丢弃重采样缓冲区中剩余的所有样本,并使用静默重新初始化重采样器。

4.3. CELT Decoder
4.3. 凯尔特解码器

The CELT layer of Opus is based on the Modified Discrete Cosine Transform [MDCT] with partially overlapping windows of 5 to 22.5 ms. The main principle behind CELT is that the MDCT spectrum is divided into bands that (roughly) follow the Bark scale, i.e., the scale of the ear's critical bands [ZWICKER61]. The normal CELT layer uses 21 of those bands, though Opus Custom (see Section 6.2) may use a different number of bands. In Hybrid mode, the first 17 bands (up to 8 kHz) are not coded. A band can contain as little as one MDCT bin per channel, and as many as 176 bins per channel, as detailed in Table 55. In each band, the gain (energy) is coded separately from the shape of the spectrum. Coding the gain explicitly makes it easy to preserve the spectral envelope of the signal. The remaining unit-norm shape vector is encoded using a Pyramid Vector Quantizer (PVQ) Section 4.3.4.

Opus的CELT层基于改进的离散余弦变换[MDCT],其部分重叠窗口为5至22.5 ms。CELT背后的主要原理是,MDCT谱被划分为(大致)遵循树皮尺度的谱带,即耳朵临界谱带的尺度[ZWICKER61]。虽然Opus Custom(见第6.2节)可能使用不同数量的带,但正常的凯尔特层使用其中的21个带。在混合模式下,前17个频带(高达8 kHz)未编码。如表55所示,一个频带每个通道最多可包含一个MDCT箱,每个通道最多可包含176个箱。在每个频带中,增益(能量)与频谱形状分开编码。对增益进行显式编码可以很容易地保留信号的频谱包络。使用第4.3.4节中的金字塔矢量量化器(PVQ)对剩余单位范数形状矢量进行编码。

   +--------+--------+------+-------+-------+-------------+------------+
   | Frame  | 2.5 ms | 5 ms | 10 ms | 20 ms |       Start |       Stop |
   | Size:  |        |      |       |       |   Frequency |  Frequency |
   +--------+--------+------+-------+-------+-------------+------------+
   | Band   |  Bins: |      |       |       |             |            |
   |        |        |      |       |       |             |            |
   | 0      |      1 |    2 |     4 |     8 |        0 Hz |     200 Hz |
   |        |        |      |       |       |             |            |
   | 1      |      1 |    2 |     4 |     8 |      200 Hz |     400 Hz |
   |        |        |      |       |       |             |            |
        
   +--------+--------+------+-------+-------+-------------+------------+
   | Frame  | 2.5 ms | 5 ms | 10 ms | 20 ms |       Start |       Stop |
   | Size:  |        |      |       |       |   Frequency |  Frequency |
   +--------+--------+------+-------+-------+-------------+------------+
   | Band   |  Bins: |      |       |       |             |            |
   |        |        |      |       |       |             |            |
   | 0      |      1 |    2 |     4 |     8 |        0 Hz |     200 Hz |
   |        |        |      |       |       |             |            |
   | 1      |      1 |    2 |     4 |     8 |      200 Hz |     400 Hz |
   |        |        |      |       |       |             |            |
        
   | 2      |      1 |    2 |     4 |     8 |      400 Hz |     600 Hz |
   |        |        |      |       |       |             |            |
   | 3      |      1 |    2 |     4 |     8 |      600 Hz |     800 Hz |
   |        |        |      |       |       |             |            |
   | 4      |      1 |    2 |     4 |     8 |      800 Hz |    1000 Hz |
   |        |        |      |       |       |             |            |
   | 5      |      1 |    2 |     4 |     8 |     1000 Hz |    1200 Hz |
   |        |        |      |       |       |             |            |
   | 6      |      1 |    2 |     4 |     8 |     1200 Hz |    1400 Hz |
   |        |        |      |       |       |             |            |
   | 7      |      1 |    2 |     4 |     8 |     1400 Hz |    1600 Hz |
   |        |        |      |       |       |             |            |
   | 8      |      2 |    4 |     8 |    16 |     1600 Hz |    2000 Hz |
   |        |        |      |       |       |             |            |
   | 9      |      2 |    4 |     8 |    16 |     2000 Hz |    2400 Hz |
   |        |        |      |       |       |             |            |
   | 10     |      2 |    4 |     8 |    16 |     2400 Hz |    2800 Hz |
   |        |        |      |       |       |             |            |
   | 11     |      2 |    4 |     8 |    16 |     2800 Hz |    3200 Hz |
   |        |        |      |       |       |             |            |
   | 12     |      4 |    8 |    16 |    32 |     3200 Hz |    4000 Hz |
   |        |        |      |       |       |             |            |
   | 13     |      4 |    8 |    16 |    32 |     4000 Hz |    4800 Hz |
   |        |        |      |       |       |             |            |
   | 14     |      4 |    8 |    16 |    32 |     4800 Hz |    5600 Hz |
   |        |        |      |       |       |             |            |
   | 15     |      6 |   12 |    24 |    48 |     5600 Hz |    6800 Hz |
   |        |        |      |       |       |             |            |
   | 16     |      6 |   12 |    24 |    48 |     6800 Hz |    8000 Hz |
   |        |        |      |       |       |             |            |
   | 17     |      8 |   16 |    32 |    64 |     8000 Hz |    9600 Hz |
   |        |        |      |       |       |             |            |
   | 18     |     12 |   24 |    48 |    96 |     9600 Hz |   12000 Hz |
   |        |        |      |       |       |             |            |
   | 19     |     18 |   36 |    72 |   144 |    12000 Hz |   15600 Hz |
   |        |        |      |       |       |             |            |
   | 20     |     22 |   44 |    88 |   176 |    15600 Hz |   20000 Hz |
   +--------+--------+------+-------+-------+-------------+------------+
        
   | 2      |      1 |    2 |     4 |     8 |      400 Hz |     600 Hz |
   |        |        |      |       |       |             |            |
   | 3      |      1 |    2 |     4 |     8 |      600 Hz |     800 Hz |
   |        |        |      |       |       |             |            |
   | 4      |      1 |    2 |     4 |     8 |      800 Hz |    1000 Hz |
   |        |        |      |       |       |             |            |
   | 5      |      1 |    2 |     4 |     8 |     1000 Hz |    1200 Hz |
   |        |        |      |       |       |             |            |
   | 6      |      1 |    2 |     4 |     8 |     1200 Hz |    1400 Hz |
   |        |        |      |       |       |             |            |
   | 7      |      1 |    2 |     4 |     8 |     1400 Hz |    1600 Hz |
   |        |        |      |       |       |             |            |
   | 8      |      2 |    4 |     8 |    16 |     1600 Hz |    2000 Hz |
   |        |        |      |       |       |             |            |
   | 9      |      2 |    4 |     8 |    16 |     2000 Hz |    2400 Hz |
   |        |        |      |       |       |             |            |
   | 10     |      2 |    4 |     8 |    16 |     2400 Hz |    2800 Hz |
   |        |        |      |       |       |             |            |
   | 11     |      2 |    4 |     8 |    16 |     2800 Hz |    3200 Hz |
   |        |        |      |       |       |             |            |
   | 12     |      4 |    8 |    16 |    32 |     3200 Hz |    4000 Hz |
   |        |        |      |       |       |             |            |
   | 13     |      4 |    8 |    16 |    32 |     4000 Hz |    4800 Hz |
   |        |        |      |       |       |             |            |
   | 14     |      4 |    8 |    16 |    32 |     4800 Hz |    5600 Hz |
   |        |        |      |       |       |             |            |
   | 15     |      6 |   12 |    24 |    48 |     5600 Hz |    6800 Hz |
   |        |        |      |       |       |             |            |
   | 16     |      6 |   12 |    24 |    48 |     6800 Hz |    8000 Hz |
   |        |        |      |       |       |             |            |
   | 17     |      8 |   16 |    32 |    64 |     8000 Hz |    9600 Hz |
   |        |        |      |       |       |             |            |
   | 18     |     12 |   24 |    48 |    96 |     9600 Hz |   12000 Hz |
   |        |        |      |       |       |             |            |
   | 19     |     18 |   36 |    72 |   144 |    12000 Hz |   15600 Hz |
   |        |        |      |       |       |             |            |
   | 20     |     22 |   44 |    88 |   176 |    15600 Hz |   20000 Hz |
   +--------+--------+------+-------+-------+-------------+------------+
        

Table 55: MDCT Bins per Channel per Band for Each Frame Size

表55:每个帧大小的每个通道每个频带的MDCT箱

Transients are notoriously difficult for transform codecs to code. CELT uses two different strategies for them:

瞬变对于编码解码器到代码的转换来说是出了名的困难。凯尔特人使用两种不同的策略:

1. Using multiple smaller MDCTs instead of a single large MDCT, and

1. 使用多个较小的MDCT而不是单个较大的MDCT,以及

2. Dynamic time-frequency resolution changes (See Section 4.3.4.5).

2. 动态时频分辨率变化(见第4.3.4.5节)。

To improve quality on highly tonal and periodic signals, CELT includes a pre-filter/post-filter combination. The pre-filter on the encoder side attenuates the signal's harmonics. The post-filter on the decoder side restores the original gain of the harmonics, while shaping the coding noise to roughly follow the harmonics. Such noise shaping reduces the perception of the noise.

为了提高高音调和周期性信号的质量,CELT包括前置滤波器/后置滤波器组合。编码器侧的预滤波器衰减信号的谐波。解码器侧的后滤波器恢复谐波的原始增益,同时使编码噪声大致跟随谐波。这种噪声整形降低了对噪声的感知。

When coding a stereo signal, three coding methods are available:

对立体声信号进行编码时,有三种编码方法:

o mid-side stereo: encodes the mean and the difference of the left and right channels,

o 中间侧立体声:对左右声道的平均值和差值进行编码,

o intensity stereo: only encodes the mean of the left and right channels (discards the difference),

o 强度立体声:仅编码左右声道的平均值(丢弃差值),

o dual stereo: encodes the left and right channels separately.

o 双立体声:分别对左右声道进行编码。

An overview of the decoder is given in Figure 17.

解码器的概述如图17所示。

                       +---------+
                       | Coarse  |
                    +->| decoder |----+
                    |  +---------+    |
                    |                 |
                    |  +---------+    v
                    |  |  Fine   |  +---+
                    +->| decoder |->| + |
                    |  +---------+  +---+
                    |       ^         |
        +---------+ |       |         |
        |  Range  | | +----------+    v
        | Decoder |-+ |   Bit    | +------+
        +---------+ | |Allocation| | 2**x |
                    | +----------+ +------+
                    |       |         |
                    |       v         v               +--------+
                    |  +---------+  +---+  +-------+  | pitch  |
                    +->|   PVQ   |->| * |->| IMDCT |->| post-  |--->
                    |  | decoder |  +---+  +-------+  | filter |
                    |  +---------+                    +--------+
                    |                                      ^
                    +--------------------------------------+
        
                       +---------+
                       | Coarse  |
                    +->| decoder |----+
                    |  +---------+    |
                    |                 |
                    |  +---------+    v
                    |  |  Fine   |  +---+
                    +->| decoder |->| + |
                    |  +---------+  +---+
                    |       ^         |
        +---------+ |       |         |
        |  Range  | | +----------+    v
        | Decoder |-+ |   Bit    | +------+
        +---------+ | |Allocation| | 2**x |
                    | +----------+ +------+
                    |       |         |
                    |       v         v               +--------+
                    |  +---------+  +---+  +-------+  | pitch  |
                    +->|   PVQ   |->| * |->| IMDCT |->| post-  |--->
                    |  | decoder |  +---+  +-------+  | filter |
                    |  +---------+                    +--------+
                    |                                      ^
                    +--------------------------------------+
        

Legend: IMDCT = Inverse MDCT

图例:IMDCT=反向MDCT

Figure 17: Structure of the CELT decoder

图17:CELT解码器的结构

The decoder is based on the following symbols and sets of symbols:

解码器基于以下符号和符号集:

          +---------------+---------------------+---------------+
          |   Symbol(s)   |         PDF         |   Condition   |
          +---------------+---------------------+---------------+
          |    silence    |   {32767, 1}/32768  |               |
          |               |                     |               |
          |  post-filter  |       {1, 1}/2      |               |
          |               |                     |               |
          |     octave    |     uniform (6)     |  post-filter  |
          |               |                     |               |
          |     period    | raw bits (4+octave) |  post-filter  |
          |               |                     |               |
          |      gain     |     raw bits (3)    |  post-filter  |
          |               |                     |               |
          |     tapset    |     {2, 1, 1}/4     |  post-filter  |
          |               |                     |               |
          |   transient   |       {7, 1}/8      |               |
          |               |                     |               |
          |     intra     |       {7, 1}/8      |               |
          |               |                     |               |
          | coarse energy |    Section 4.3.2    |               |
          |               |                     |               |
          |   tf_change   |    Section 4.3.1    |               |
          |               |                     |               |
          |   tf_select   |       {1, 1}/2      | Section 4.3.1 |
          |               |                     |               |
          |     spread    |   {7, 2, 21, 2}/32  |               |
          |               |                     |               |
          |  dyn. alloc.  |    Section 4.3.3    |               |
          |               |                     |               |
          |  alloc. trim  |       Table 58      |               |
          |               |                     |               |
          |      skip     |       {1, 1}/2      | Section 4.3.3 |
          |               |                     |               |
          |   intensity   |       uniform       | Section 4.3.3 |
          |               |                     |               |
          |      dual     |       {1, 1}/2      |               |
          |               |                     |               |
          |  fine energy  |    Section 4.3.2    |               |
          |               |                     |               |
          |    residual   |    Section 4.3.4    |               |
          |               |                     |               |
          | anti-collapse |       {1, 1}/2      | Section 4.3.5 |
          |               |                     |               |
          |    finalize   |    Section 4.3.2    |               |
          +---------------+---------------------+---------------+
        
          +---------------+---------------------+---------------+
          |   Symbol(s)   |         PDF         |   Condition   |
          +---------------+---------------------+---------------+
          |    silence    |   {32767, 1}/32768  |               |
          |               |                     |               |
          |  post-filter  |       {1, 1}/2      |               |
          |               |                     |               |
          |     octave    |     uniform (6)     |  post-filter  |
          |               |                     |               |
          |     period    | raw bits (4+octave) |  post-filter  |
          |               |                     |               |
          |      gain     |     raw bits (3)    |  post-filter  |
          |               |                     |               |
          |     tapset    |     {2, 1, 1}/4     |  post-filter  |
          |               |                     |               |
          |   transient   |       {7, 1}/8      |               |
          |               |                     |               |
          |     intra     |       {7, 1}/8      |               |
          |               |                     |               |
          | coarse energy |    Section 4.3.2    |               |
          |               |                     |               |
          |   tf_change   |    Section 4.3.1    |               |
          |               |                     |               |
          |   tf_select   |       {1, 1}/2      | Section 4.3.1 |
          |               |                     |               |
          |     spread    |   {7, 2, 21, 2}/32  |               |
          |               |                     |               |
          |  dyn. alloc.  |    Section 4.3.3    |               |
          |               |                     |               |
          |  alloc. trim  |       Table 58      |               |
          |               |                     |               |
          |      skip     |       {1, 1}/2      | Section 4.3.3 |
          |               |                     |               |
          |   intensity   |       uniform       | Section 4.3.3 |
          |               |                     |               |
          |      dual     |       {1, 1}/2      |               |
          |               |                     |               |
          |  fine energy  |    Section 4.3.2    |               |
          |               |                     |               |
          |    residual   |    Section 4.3.4    |               |
          |               |                     |               |
          | anti-collapse |       {1, 1}/2      | Section 4.3.5 |
          |               |                     |               |
          |    finalize   |    Section 4.3.2    |               |
          +---------------+---------------------+---------------+
        

Table 56: Order of the Symbols in the CELT Section of the Bitstream

表56:比特流CELT部分中符号的顺序

The decoder extracts information from the range-coded bitstream in the order described in Table 56. In some circumstances, it is possible for a decoded value to be out of range due to a very small amount of redundancy in the encoding of large integers by the range coder. In that case, the decoder should assume there has been an error in the coding, decoding, or transmission and SHOULD take measures to conceal the error and/or report to the application that a problem has occurred. Such out of range errors cannot occur in the SILK layer.

解码器按照表56中描述的顺序从范围编码比特流中提取信息。在某些情况下,由于范围编码器对大整数的编码中存在非常小的冗余,解码值可能超出范围。在这种情况下,解码器应假设编码、解码或传输中存在错误,并应采取措施隐藏错误和/或向应用程序报告发生了问题。这种超出范围的错误不会发生在丝绸层中。

4.3.1. Transient Decoding
4.3.1. 瞬时译码

The "transient" flag indicates whether the frame uses a single long MDCT or several short MDCTs. When it is set, then the MDCT coefficients represent multiple short MDCTs in the frame. When not set, the coefficients represent a single long MDCT for the frame. The flag is encoded in the bitstream with a probability of 1/8. In addition to the global transient flag is a per-band binary flag to change the time-frequency (tf) resolution independently in each band. The change in tf resolution is defined in tf_select_table[][] in celt.c and depends on the frame size, whether the transient flag is set, and the value of tf_select. The tf_select flag uses a 1/2 probability, but is only decoded if it can have an impact on the result knowing the value of all per-band tf_change flags.

“瞬态”标志指示帧使用单个长MDCT还是多个短MDCT。设置时,MDCT系数表示帧中的多个短MDCT。未设置时,系数表示帧的单个长MDCT。该标志以1/8的概率编码在比特流中。除了全局瞬态标志外,还有一个每波段二进制标志,用于在每个波段中独立地改变时频(tf)分辨率。tf分辨率的变化在celt.c中的tf_select_表[]中定义,并取决于帧大小、是否设置了瞬态标志以及tf_select的值。tf_选择标志使用1/2的概率,但只有在知道所有每频带tf_更改标志的值时,它才能对结果产生影响,才会被解码。

4.3.2. Energy Envelope Decoding
4.3.2. 能量包络解码

It is important to quantize the energy with sufficient resolution because any energy quantization error cannot be compensated for at a later stage. Regardless of the resolution used for encoding the spectral shape of a band, it is perceptually important to preserve the energy in each band. CELT uses a three-step coarse-fine-fine strategy for encoding the energy in the base-2 log domain, as implemented in quant_bands.c.

必须以足够的分辨率对能量进行量化,因为任何能量量化误差都无法在后期进行补偿。无论用于编码频带的光谱形状的分辨率如何,在感知上保持每个频带中的能量都很重要。CELT使用三步粗-细策略对base-2对数域中的能量进行编码,如quant_bands.c中实现的。

4.3.2.1. Coarse Energy Decoding
4.3.2.1. 粗能量译码

Coarse quantization of the energy uses a fixed resolution of 6 dB (integer part of base-2 log). To minimize the bitrate, prediction is applied both in time (using the previous frame) and in frequency (using the previous bands). The part of the prediction that is based on the previous frame can be disabled, creating an "intra" frame where the energy is coded without reference to prior frames. The decoder first reads the intra flag to determine what prediction is used. The 2-D z-transform [Z-TRANSFORM] of the prediction filter is

能量的粗略量化使用6 dB的固定分辨率(基2对数的整数部分)。为了最小化比特率,在时间(使用前一帧)和频率(使用前一频带)上应用预测。基于前一帧的预测部分可以被禁用,从而创建一个“帧内”帧,在该帧中,在不参考前一帧的情况下对能量进行编码。解码器首先读取帧内标志以确定使用什么预测。预测滤波器的二维z变换[z变换]为

                                            -1          -1
                              (1 - alpha*z_l  )*(1 - z_b  )
                A(z_l, z_b) = -----------------------------
                                                 -1
                                     1 - beta*z_b
        
                                            -1          -1
                              (1 - alpha*z_l  )*(1 - z_b  )
                A(z_l, z_b) = -----------------------------
                                                 -1
                                     1 - beta*z_b
        

where b is the band index and l is the frame index. The prediction coefficients applied depend on the frame size in use when not using intra energy and are alpha=0, beta=4915/32768 when using intra energy. The time-domain prediction is based on the final fine quantization of the previous frame, while the frequency domain (within the current frame) prediction is based on coarse quantization only (because the fine quantization has not been computed yet). The prediction is clamped internally so that fixed-point implementations with limited dynamic range always remain in the same state as floating point implementations. We approximate the ideal probability distribution of the prediction error using a Laplace distribution with separate parameters for each frame size in intra- and inter-frame modes. These parameters are held in the e_prob_model table in quant_bands.c. The coarse energy decoding is performed by unquant_coarse_energy() (quant_bands.c). The decoding of the Laplace-distributed values is implemented in ec_laplace_decode() (laplace.c).

其中b是波段索引,l是帧索引。应用的预测系数取决于在不使用帧内能量时使用的帧大小,并且在使用帧内能量时为alpha=0、beta=4915/32768。时域预测基于前一帧的最终精细量化,而频域(当前帧内)预测仅基于粗略量化(因为尚未计算精细量化)。预测在内部被钳制,因此具有有限动态范围的定点实现始终保持与浮点实现相同的状态。我们使用拉普拉斯分布近似预测误差的理想概率分布,在帧内和帧间模式中,每个帧大小都有单独的参数。这些参数保存在quant_bands.c中的e_prob_模型表中。粗能量解码由unquant_rough_energy()执行(quant_bands.c)。拉普拉斯分布值的解码在ec_Laplace_decode()(Laplace.c)中实现。

4.3.2.2. Fine Energy Quantization
4.3.2.2. 精细能量量子化

The number of bits assigned to fine energy quantization in each band is determined by the bit allocation computation described in Section 4.3.3. Let B_i be the number of fine energy bits for band i; the refinement is an integer f in the range [0,2**B_i-1]. The mapping between f and the correction applied to the coarse energy is equal to (f+1/2)/2**B_i - 1/2. Fine energy quantization is implemented in quant_fine_energy() (quant_bands.c).

每个频带中分配给精细能量量化的比特数由第4.3.3节中描述的比特分配计算确定。设B_i为带i的精细能量比特数;细化为[0,2**B_i-1]范围内的整数f。f和应用于粗能量的校正之间的映射等于(f+1/2)/2**B_i-1/2。精细能量量化在quant_Fine_energy()中实现(quant_bands.c)。

When some bits are left "unused" after all other flags have been decoded, these bits are assigned to a "final" step of fine allocation. In effect, these bits are used to add one extra fine energy bit per band per channel. The allocation process determines two "priorities" for the final fine bits. Any remaining bits are first assigned only to bands of priority 0, starting from band 0 and going up. If all bands of priority 0 have received one bit per channel, then bands of priority 1 are assigned an extra bit per channel, starting from band 0. If any bits are left after this, they are left unused. This is implemented in unquant_energy_finalise() (quant_bands.c).

当一些位在所有其他标志解码后被保留为“未使用”时,这些位被分配到精细分配的“最后”步骤。实际上,这些比特用于为每个通道的每个频带添加一个额外的精细能量比特。分配过程确定了最终精细位的两个“优先级”。任何剩余位首先仅分配给优先级为0的频带,从频带0开始,向上。如果优先级为0的所有频带每个通道都接收到一位,则优先级为1的频带从频带0开始为每个通道分配一个额外的位。如果在此之后还保留了任何位,则这些位未使用。这在unquant_energy_finalize()中实现(quant_bands.c)。

4.3.3. Bit Allocation
4.3.3. 位分配

Because the bit allocation drives the decoding of the range-coder stream, it MUST be recovered exactly so that identical coding decisions are made in the encoder and decoder. Any deviation from the reference's resulting bit allocation will result in corrupted output, though implementers are free to implement the procedure in any way that produces identical results.

因为比特分配驱动范围编码器流的解码,所以必须准确地恢复它,以便在编码器和解码器中做出相同的编码决策。任何与引用的结果位分配的偏差都将导致输出损坏,尽管实现者可以自由地以任何方式实现该过程,从而产生相同的结果。

The per-band gain-shape structure of the CELT layer ensures that using the same number of bits for the spectral shape of a band in every frame will result in a roughly constant signal-to-noise ratio in that band. This results in coding noise that has the same spectral envelope as the signal. The masking curve produced by a standard psychoacoustic model also closely follows the spectral envelope of the signal. This structure means that the ideal allocation is more consistent from frame to frame than it is for other codecs without an equivalent structure and that a fixed allocation provides fairly consistent perceptual performance [VALIN2010].

CELT层的每频带增益形状结构确保在每个帧中对频带的频谱形状使用相同数量的比特将在该频带中产生大致恒定的信噪比。这导致编码噪声与信号具有相同的频谱包络。标准心理声学模型产生的掩蔽曲线也紧跟着信号的频谱包络线。这种结构意味着,与没有等效结构的其他编解码器相比,理想分配在帧与帧之间更加一致,并且固定分配提供了相当一致的感知性能[VALIN2010]。

Many codecs transmit significant amounts of side information to control the bit allocation within a frame. Often this control is only indirect, and it must be exercised carefully to achieve the desired rate constraints. The CELT layer, however, can adapt over a very wide range of rates, so it has a large number of codebook sizes to choose from for each band. Explicitly signaling the size of each of these codebooks would impose considerable overhead, even though the allocation is relatively static from frame to frame. This is because all of the information required to compute these codebook sizes must be derived from a single frame by itself, in order to retain robustness to packet loss, so the signaling cannot take advantage of knowledge of the allocation in neighboring frames. This problem is exacerbated in low-latency (small frame size) applications, which would include this overhead in every frame.

许多编解码器传输大量的边信息以控制帧内的位分配。通常,这种控制只是间接的,必须谨慎地实施,以实现所需的利率约束。然而,CELT层可以适应非常宽的速率范围,因此每个频带都有大量码本大小可供选择。显式地通知这些码本的大小将带来相当大的开销,即使帧与帧之间的分配是相对静态的。这是因为计算这些码本大小所需的所有信息都必须由单个帧本身导出,以保持对分组丢失的鲁棒性,因此信令不能利用相邻帧中分配的知识。在低延迟(小帧大小)应用程序中,此问题会加剧,这会在每个帧中都包含此开销。

For this reason, in the MDCT mode, Opus uses a primarily implicit bit allocation. The available bitstream capacity is known in advance to both the encoder and decoder without additional signaling, ultimately from the packet sizes expressed by a higher-level protocol. Using this information, the codec interpolates an allocation from a hard-coded table.

因此,在MDCT模式下,Opus主要使用隐式位分配。编码器和解码器在没有附加信令的情况下预先知道可用比特流容量,最终来自由更高级协议表示的分组大小。使用此信息,编解码器从硬编码表中插入分配。

While the band-energy structure effectively models intra-band masking, it ignores the weaker inter-band masking, band-temporal masking, and other less significant perceptual effects. While these effects can often be ignored, they can become significant for particular samples. One mechanism available to encoders would be to

虽然频带能量结构有效地模拟了频带内掩蔽,但它忽略了较弱的频带间掩蔽、频带时间掩蔽和其他不太显著的感知效应。虽然这些影响通常可以忽略,但对于特定样本,它们可能变得非常重要。编码器可用的一种机制是

simply increase the overall rate for these frames, but this is not possible in a constant rate mode and can be fairly inefficient. As a result three explicitly signaled mechanisms are provided to alter the implicit allocation:

只需增加这些帧的总体速率,但在恒定速率模式下这是不可能的,而且效率可能相当低。因此,提供了三种显式信号机制来改变隐式分配:

o Band boost

o 频带增强

o Allocation trim

o 分配微调

o Band skipping

o 跳绳

The first of these mechanisms, band boost, allows an encoder to boost the allocation in specific bands. The second, allocation trim, works by biasing the overall allocation towards higher or lower frequency bands. The third, band skipping, selects which low-precision high frequency bands will be allocated no shape bits at all.

第一种机制是频带增强,允许编码器在特定频带中增强分配。第二种是分配微调,其工作原理是将总体分配偏向更高或更低的频带。第三种方法是跳频,它选择哪些低精度的高频段将被分配到完全没有形状位的位置。

In stereo mode, there are two additional parameters potentially coded as part of the allocation procedure: a parameter to allow the selective elimination of allocation for the 'side' (i.e., intensity stereo) in jointly coded bands, and a flag to deactivate joint coding (i.e., dual stereo). These values are not signaled if they would be meaningless in the overall context of the allocation.

在立体声模式下,有两个额外的参数可能作为分配程序的一部分进行编码:一个参数允许在联合编码的频带中选择性地消除“侧”(即强度立体声)的分配,另一个标志用于停用联合编码(即双立体声)。如果这些值在分配的整体上下文中没有意义,则不会发出信号。

Because every signaled adjustment increases overhead and implementation complexity, none were included speculatively: the reference encoder makes use of all of these mechanisms. While the decision logic in the reference was found to be effective enough to justify the overhead and complexity, further analysis techniques may be discovered that increase the effectiveness of these parameters. As with other signaled parameters, an encoder is free to choose the values in any manner, but, unless a technique is known to deliver superior perceptual results, the methods used by the reference implementation should be used.

因为每一个信号调整都会增加开销和实现复杂性,所以没有一个是推测性的:参考编码器使用所有这些机制。虽然参考文献中的决策逻辑足够有效,足以证明开销和复杂性,但可能会发现进一步的分析技术,以提高这些参数的有效性。与其他信号参数一样,编码器可以以任何方式自由选择值,但是,除非已知一种技术能够提供更好的感知结果,否则应使用参考实现所使用的方法。

The allocation process consists of the following steps: determining the per-band maximum allocation vector, decoding the boosts, decoding the tilt, determining the remaining capacity of the frame, searching the mode table for the entry nearest but not exceeding the available space (subject to the tilt, boosts, band maximums, and band minimums), linear interpolation, reallocation of unused bits with concurrent skip decoding, determination of the fine-energy vs. shape split, and final reallocation. This process results in a per-band shape allocation (in 1/8th-bit units), a per-band fine-energy allocation (in 1 bit per channel units), a set of band priorities for controlling the use of remaining bits at the end of the frame, and a remaining balance of unallocated space, which is usually zero except at very high rates.

分配过程包括以下步骤:确定每频带最大分配向量、解码提升、解码倾斜、确定帧的剩余容量、搜索模式表中最近但不超过可用空间的条目(取决于倾斜、提升、频带最大值和频带最小值),线性插值、使用并行跳过解码重新分配未使用的比特、确定精细能量与形状分割以及最终重新分配。该过程导致每频带形状分配(以1/8比特为单位)、每频带精细能量分配(以每信道1比特为单位)、一组用于控制帧结束时剩余比特的使用的频带优先级,以及未分配空间的剩余平衡,除非常高的速率外,未分配空间通常为零。

The "static" bit allocation (in 1/8 bits) for a quality q, excluding the minimums, maximums, tilt and boosts, is equal to channels*N*alloc[band][q]<<LM>>2, where alloc[][] is given in Table 57 and LM=log2(frame_size/120). The allocation is obtained by linearly interpolating between two values of q (in steps of 1/64) to find the highest allocation that does not exceed the number of bits remaining.

质量q的“静态”位分配(1/8位),不包括最小值、最大值、倾斜和提升,等于信道*N*alloc[band][q]<<LM>>2,其中alloc[][]在表57中给出,LM=log2(帧大小/120)。通过在两个q值之间线性插值(以1/64的步长)来获得分配,以找到不超过剩余位数的最高分配。

Rows indicate the MDCT bands, columns are the different quality (q) parameters. The units are 1/32 bit per MDCT bin.

行表示MDCT带,列表示不同的质量(q)参数。每个MDCT箱的单位为1/32位。

     +---+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     | 0 |  1 |   2 |   3 |   4 |   5 |   6 |   7 |   8 |   9 |  10 |
     +---+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     | 0 | 90 | 110 | 118 | 126 | 134 | 144 | 152 | 162 | 172 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 80 | 100 | 110 | 119 | 127 | 137 | 145 | 155 | 165 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 75 |  90 | 103 | 112 | 120 | 130 | 138 | 148 | 158 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 69 |  84 |  93 | 104 | 114 | 124 | 132 | 142 | 152 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 63 |  78 |  86 |  95 | 103 | 113 | 123 | 133 | 143 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 56 |  71 |  80 |  89 |  97 | 107 | 117 | 127 | 137 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 49 |  65 |  75 |  83 |  91 | 101 | 111 | 121 | 131 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 40 |  58 |  70 |  78 |  85 |  95 | 105 | 115 | 125 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 34 |  51 |  65 |  72 |  78 |  88 |  98 | 108 | 118 | 198 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 29 |  45 |  59 |  66 |  72 |  82 |  92 | 102 | 112 | 193 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 20 |  39 |  53 |  60 |  66 |  76 |  86 |  96 | 106 | 188 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 18 |  32 |  47 |  54 |  60 |  70 |  80 |  90 | 100 | 183 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 10 |  26 |  40 |  47 |  54 |  64 |  74 |  84 |  94 | 178 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |  20 |  31 |  39 |  47 |  57 |  67 |  77 |  87 | 173 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |  12 |  23 |  32 |  41 |  51 |  61 |  71 |  81 | 168 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |  15 |  25 |  35 |  45 |  55 |  65 |  75 | 163 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   4 |  17 |  29 |  39 |  49 |  59 |  69 | 158 |
     |   |    |     |     |     |     |     |     |     |     |     |
        
     +---+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     | 0 |  1 |   2 |   3 |   4 |   5 |   6 |   7 |   8 |   9 |  10 |
     +---+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     | 0 | 90 | 110 | 118 | 126 | 134 | 144 | 152 | 162 | 172 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 80 | 100 | 110 | 119 | 127 | 137 | 145 | 155 | 165 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 75 |  90 | 103 | 112 | 120 | 130 | 138 | 148 | 158 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 69 |  84 |  93 | 104 | 114 | 124 | 132 | 142 | 152 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 63 |  78 |  86 |  95 | 103 | 113 | 123 | 133 | 143 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 56 |  71 |  80 |  89 |  97 | 107 | 117 | 127 | 137 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 49 |  65 |  75 |  83 |  91 | 101 | 111 | 121 | 131 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 40 |  58 |  70 |  78 |  85 |  95 | 105 | 115 | 125 | 200 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 34 |  51 |  65 |  72 |  78 |  88 |  98 | 108 | 118 | 198 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 29 |  45 |  59 |  66 |  72 |  82 |  92 | 102 | 112 | 193 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 20 |  39 |  53 |  60 |  66 |  76 |  86 |  96 | 106 | 188 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 18 |  32 |  47 |  54 |  60 |  70 |  80 |  90 | 100 | 183 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 | 10 |  26 |  40 |  47 |  54 |  64 |  74 |  84 |  94 | 178 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |  20 |  31 |  39 |  47 |  57 |  67 |  77 |  87 | 173 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |  12 |  23 |  32 |  41 |  51 |  61 |  71 |  81 | 168 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |  15 |  25 |  35 |  45 |  55 |  65 |  75 | 163 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   4 |  17 |  29 |  39 |  49 |  59 |  69 | 158 |
     |   |    |     |     |     |     |     |     |     |     |     |
        
     | 0 |  0 |   0 |   0 |  12 |  23 |  33 |  43 |  53 |  63 | 153 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   0 |   1 |  16 |  26 |  36 |  46 |  56 | 148 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   0 |   0 |  10 |  15 |  20 |  30 |  45 | 129 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   0 |   0 |   1 |   1 |   1 |   1 |  20 | 104 |
     +---+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
        
     | 0 |  0 |   0 |   0 |  12 |  23 |  33 |  43 |  53 |  63 | 153 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   0 |   1 |  16 |  26 |  36 |  46 |  56 | 148 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   0 |   0 |  10 |  15 |  20 |  30 |  45 | 129 |
     |   |    |     |     |     |     |     |     |     |     |     |
     | 0 |  0 |   0 |   0 |   0 |   1 |   1 |   1 |   1 |  20 | 104 |
     +---+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
        

Table 57: CELT Static Allocation Table

表57:CELT静态分配表

The maximum allocation vector is an approximation of the maximum space that can be used by each band for a given mode. The value is approximate because the shape encoding is variable rate (due to entropy coding of splitting parameters). Setting the maximum too low reduces the maximum achievable quality in a band while setting it too high may result in waste: bitstream capacity available at the end of the frame that cannot be put to any use. The maximums specified by the codec reflect the average maximum. In the reference implementation, the maximums in bits/sample are precomputed in a static table (see cache_caps50[] in static_modes_float.h) for each band, for each value of LM, and for both mono and stereo. Implementations are expected to simply use the same table data, but the procedure for generating this table is included in rate.c as part of compute_pulse_cache().

最大分配向量是给定模式下每个频带可使用的最大空间的近似值。该值是近似值,因为形状编码是可变速率的(由于分裂参数的熵编码)。将“最大值”设置得太低会降低频带中可达到的最大质量,而将其设置得太高可能会导致浪费:帧末尾的可用比特流容量无法用于任何用途。编解码器指定的最大值反映了平均最大值。在参考实现中,针对每个频带、每个LM值以及单声道和立体声,在静态表中预先计算以位/采样为单位的最大值(参见静态模式下的cache_caps50[]u float.h)。实现只需使用相同的表数据,但生成此表的过程包含在rate.c中,作为compute\u pulse\u cache()的一部分。

To convert the values in cache.caps into the actual maximums: first, set nbBands to the maximum number of bands for this mode, and stereo to zero if stereo is not in use and one otherwise. For each band, set N to the number of MDCT bins covered by the band (for one channel), set LM to the shift value for the frame size. Then, set i to nbBands*(2*LM+stereo). Next, set the maximum for the band to the i-th index of cache.caps + 64 and multiply by the number of channels in the current frame (one or two) and by N, then divide the result by 4 using integer division. The resulting vector will be called cap[]. The elements fit in signed 16-bit integers but do not fit in 8 bits. This procedure is implemented in the reference in the function init_caps() in celt.c.

要将cache.caps中的值转换为实际最大值:首先,将nbBands设置为此模式的最大频带数,如果不使用立体声,则将立体声设置为零,否则设置为一。对于每个频带,将N设置为频带覆盖的MDCT箱数(对于一个通道),将LM设置为帧大小的移位值。然后,将i设置为nbBands*(2*LM+立体声)。接下来,将频带的最大值设置为cache.caps+64的第i个索引,并乘以当前帧中的通道数(一个或两个)和N,然后使用整数除法将结果除以4。结果向量将被称为cap[]。这些元素适合有符号16位整数,但不适合8位整数。此过程在celt.c中函数init_caps()的引用中实现。

The band boosts are represented by a series of binary symbols that are entropy coded with very low probability. Each band can potentially be boosted multiple times, subject to the frame actually having enough room to obey the boost and having enough room to code the boost symbol. The default coding cost for a boost starts out at six bits (probability p=1/64), but subsequent boosts in a band cost only a single bit and every time a band is boosted the initial cost is reduced (down to a minimum of two bits, or p=1/4). Since the

频带增益由一系列二进制符号表示,这些符号以极低的概率进行熵编码。每个波段都可能被放大多次,前提是帧实际上有足够的空间来服从放大,并且有足够的空间来编码放大符号。boost的默认编码成本从6位开始(概率p=1/64),但是在一个频带中后续的boost只消耗一位,并且每次频带被提升时,初始成本都会降低(降到最少两位,或者p=1/4)。自从

initial cost of coding a boost is 6 bits, the coding cost of the boost symbols when completely unused is 0.48 bits/frame for a 21 band mode (21*-log2(1-1/2**6)).

编码boost的初始成本为6位,对于21频带模式(21*-log2(1-1/2**6)),完全未使用时boost符号的编码成本为0.48位/帧。

To decode the band boosts: First, set 'dynalloc_logp' to 6, the initial amount of storage required to signal a boost in bits, 'total_bits' to the size of the frame in 8th bits, 'total_boost' to zero, and 'tell' to the total number of 8th bits decoded so far. For each band from the coding start (0 normally, but 17 in Hybrid mode) to the coding end (which changes depending on the signaled bandwidth), the boost quanta in units of 1/8 bit is calculated as quanta = min(8*N, max(48, N)). This represents a boost step size of six bits, subject to a lower limit of 1/8th bit/sample and an upper limit of 1 bit/sample. Set 'boost' to zero and 'dynalloc_loop_logp' to dynalloc_logp. While dynalloc_loop_log (the current worst case symbol cost) in 8th bits plus tell is less than total_bits plus total_boost and boost is less than cap[] for this band: Decode a bit from the bitstream with dynalloc_loop_logp as the cost of a one and update tell to reflect the current used capacity. If the decoded value is zero break the loop. Otherwise, add quanta to boost and total_boost, subtract quanta from total_bits, and set dynalloc_loop_log to 1. When the loop finishes 'boost' contains the bit allocation boost for this band. If boost is non-zero and dynalloc_logp is greater than 2, decrease dynalloc_logp. Once this process has been executed on all bands, the band boosts have been decoded. This procedure is implemented around line 2474 of celt.c.

要解码频带提升:首先,将“dynalloc_logp”设置为6,以位表示提升所需的初始存储量,“total_bits”设置为第8位的帧大小,“total_boost”设置为零,“tell”设置为目前解码的第8位总数。对于从编码开始(通常为0,但在混合模式下为17)到编码结束(根据信号带宽变化)的每个频带,以1/8位为单位的升压量子计算为量子=最小(8*N,最大(48,N))。这表示6位的升压步长,下限为1/8位/采样,上限为1位/采样。将“boost”设置为零,将“dynalloc\u loop\u logp”设置为dynalloc\u logp。虽然第8位加上tell中的dynalloc_loop_log(当前最坏情况下的符号成本)小于total_bits加上total_boost,且boost小于此频带的cap[]:使用dynalloc_loop_logp解码位流中的一位,作为一位的成本,并更新tell以反映当前使用的容量。如果解码值为零,则中断循环。否则,将量子添加到boost和total_boost,从total_位中减去量子,并将dynalloc_loop_log设置为1。循环完成时,“boost”包含该频带的位分配boost。如果增压非零且dynalloc_logp大于2,则减小dynalloc_logp。一旦在所有波段上执行了此过程,波段增益就被解码。本程序在celt.c.第2474行附近实施。

At very low rates, it is possible that there won't be enough available space to execute the inner loop even once. In these cases, band boost is not possible, but its overhead is completely eliminated. Because of the high cost of band boost when activated, a reasonable encoder should not be using it at very low rates. The reference implements its dynalloc decision logic around line 1304 of celt.c.

在非常低的速率下,可能没有足够的可用空间来执行内部循环,甚至一次。在这些情况下,频带增强是不可能的,但它的开销是完全消除的。由于激活时频带增强的成本很高,合理的编码器不应以很低的速率使用它。该引用围绕celt.c的第1304行实现其dynaloc决策逻辑。

The allocation trim is an integer value from 0-10. The default value of 5 indicates no trim. The trim parameter is entropy coded in order to lower the coding cost of less extreme adjustments. Values lower than 5 bias the allocation towards lower frequencies and values above 5 bias it towards higher frequencies. Like other signaled parameters, signaling of the trim is gated so that it is not included if there is insufficient space available in the bitstream. To decode the trim, first set the trim value to 5, then if and only if the count of decoded 8th bits so far (ec_tell_frac) plus 48 (6 bits) is less than or equal to the total frame size in 8th bits minus total_boost (a product of the above band boost procedure), decode the trim value using the PDF in Table 58.

分配微调是0-10之间的整数值。默认值5表示没有修剪。微调参数采用熵编码,以降低极端调整较少的编码成本。低于5的值使分配偏向较低频率,高于5的值使分配偏向较高频率。与其他信号参数一样,trim的信号是选通的,以便在比特流中没有足够的可用空间时不包括trim。要对微调进行解码,首先将微调值设置为5,然后,如果且仅当迄今已解码的第8位(ec_tell_frac)加48(6位)的计数小于或等于第8位中的总帧大小减去total_boost(上述频带增强过程的产物),则使用表58中的PDF对微调值进行解码。

              +--------------------------------------------+
              | PDF                                        |
              +--------------------------------------------+
              | {2, 2, 5, 10, 22, 46, 22, 10, 5, 2, 2}/128 |
              +--------------------------------------------+
        
              +--------------------------------------------+
              | PDF                                        |
              +--------------------------------------------+
              | {2, 2, 5, 10, 22, 46, 22, 10, 5, 2, 2}/128 |
              +--------------------------------------------+
        

Table 58: PDF for the Trim

表58:PDF格式的修剪

For 10 ms and 20 ms frames using short blocks and that have at least LM+2 bits left prior to the allocation process, one anti-collapse bit is reserved in the allocation process so it can be decoded later. Following the anti-collapse reservation, one bit is reserved for skip if available.

对于使用短块的10ms和20ms帧,并且在分配过程之前至少剩下LM+2位,在分配过程中保留一个防折叠位,以便稍后对其进行解码。在防折叠保留之后,保留一位用于跳过(如果可用)。

For stereo frames, bits are reserved for intensity stereo and for dual stereo. Intensity stereo requires ilog2(end-start) bits. Those bits are reserved if there are enough bits left. Following this, one bit is reserved for dual stereo if available.

对于立体声帧,为强度立体声和双立体声保留位。强度立体声需要ilog2(结束-开始)位。如果剩余的位足够多,则保留这些位。然后,如果可用,为双立体声保留一位。

The allocation computation begins by setting up some initial conditions. 'total' is set to the remaining available 8th bits, computed by taking the size of the coded frame times 8 and subtracting ec_tell_frac(). From this value, one (8th bit) is subtracted to ensure that the resulting allocation will be conservative. 'anti_collapse_rsv' is set to 8 (8th bits) if and only if the frame is a transient, LM is greater than 1, and total is greater than or equal to (LM+2) * 8. Total is then decremented by anti_collapse_rsv and clamped to be equal to or greater than zero. 'skip_rsv' is set to 8 (8th bits) if total is greater than 8, otherwise it is zero. Total is then decremented by skip_rsv. This reserves space for the final skipping flag.

分配计算从设置一些初始条件开始。”“总计”设置为剩余可用的第8位,通过将编码帧的大小乘以8并减去ec_tell_frac()来计算。从该值中减去一(第8位),以确保生成的分配是保守的。”当且仅当帧为瞬态,LM大于1,且总和大于或等于(LM+2)*8时,反折叠rsv'设置为8(第8位)。然后,通过反崩溃rsv将总数减至等于或大于零。”如果总数大于8,则skip_rsv'设置为8(第8位),否则为零。然后通过skip_rsv减少总数。这将为最终跳过标志保留空间。

If the current frame is stereo, intensity_rsv is set to the conservative log2 in 8th bits of the number of coded bands for this frame (given by the table LOG2_FRAC_TABLE in rate.c). If intensity_rsv is greater than total, then intensity_rsv is set to zero. Otherwise, total is decremented by intensity_rsv, and if total is still greater than 8, dual_stereo_rsv is set to 8 and total is decremented by dual_stereo_rsv.

如果当前帧为立体声,则强度rsv设置为该帧编码频带数第8位的保守log2(由rate.c中的log2\u FRAC\u表给出)。如果强度_rsv大于总和,则强度_rsv设置为零。否则,total将按强度rsv递减,如果total仍然大于8,则dual_stereo_rsv将设置为8,total将按dual_stereo_rsv递减。

The allocation process then computes a vector representing the hard minimum amounts allocation any band will receive for shape. This minimum is higher than the technical limit of the PVQ process, but very low rate allocations produce an excessively sparse spectrum and these bands are better served by having no allocation at all. For each coded band, set thresh[band] to 24 times the number of MDCT bins in the band and divide by 16. If 8 times the number of channels is greater, use that instead. This sets the minimum allocation to one

然后,分配过程计算一个向量,该向量表示任何频带将为形状接收的硬最小分配量。这个最小值高于PVQ过程的技术限制,但是非常低的速率分配会产生一个非常稀疏的频谱,并且这些频带可以通过根本不进行分配而得到更好的服务。对于每个编码频带,将thresh[band]设置为频带中MDCT箱数的24倍,然后除以16。如果通道数大于8倍,则使用该选项。这将最小分配设置为1

bit per channel or 48 128th bits per MDCT bin, whichever is greater. The band-size dependent part of this value is not scaled by the channel count, because at the very low rates where this limit is applicable there will usually be no bits allocated to the side.

每个通道位或每个MDCT箱48 128位,以较大者为准。该值的频带大小相关部分不按信道计数缩放,因为在该限制适用的极低速率下,通常不会向该侧分配位。

The previously decoded allocation trim is used to derive a vector of per-band adjustments, 'trim_offsets[]'. For each coded band take the alloc_trim and subtract 5 and LM. Then, multiply the result by the number of channels, the number of MDCT bins in the shortest frame size for this mode, the number of remaining bands, 2**LM, and 8. Next, divide this value by 64. Finally, if the number of MDCT bins in the band per channel is only one, 8 times the number of channels is subtracted in order to diminish the allocation by one bit, because width 1 bands receive greater benefit from the coarse energy coding.

先前解码的分配微调用于导出每频带调整的向量“微调偏移[]”。对于每个编码的频带,进行alloc_修剪并减去5和LM。然后,将结果乘以通道数、此模式下最短帧大小的MDCT箱数、剩余频带数、2**LM和8。接下来,将该值除以64。最后,如果每个信道频带中的MDCT箱数量仅为一个,则减去信道数量的8倍,以便将分配减少一位,因为宽度1频带从粗略能量编码中获得更大的好处。

4.3.4. Shape Decoding
4.3.4. 形状解码

In each band, the normalized "shape" is encoded using Pyramid Vector Quantizer.

在每个频带中,使用金字塔矢量量化器对归一化的“形状”进行编码。

In the simplest case, the number of bits allocated in Section 4.3.3 is converted to a number of pulses as described by Section 4.3.4.1. Knowing the number of pulses and the number of samples in the band, the decoder calculates the size of the codebook as detailed in Section 4.3.4.2. The size is used to decode an unsigned integer (uniform probability model), which is the codeword index. This index is converted into the corresponding vector as explained in Section 4.3.4.2. This vector is then scaled to unit norm.

在最简单的情况下,将第4.3.3节中分配的位数转换为第4.3.4.1节所述的脉冲数。已知脉冲数和频带中的样本数,解码器计算码本的大小,详见第4.3.4.2节。大小用于解码无符号整数(统一概率模型),该整数是码字索引。如第4.3.4.2节所述,将该指数转换为相应的向量。然后将该向量缩放为单位范数。

4.3.4.1. Bits to Pulses
4.3.4.1. 位到脉冲

Although the allocation is performed in 1/8th bit units, the quantization requires an integer number of pulses K. To do this, the encoder searches for the value of K that produces the number of bits nearest to the allocated value (rounding down if exactly halfway between two values), not to exceed the total number of bits available. For efficiency reasons, the search is performed against a precomputed allocation table that only permits some K values for each N. The number of codebook entries can be computed as explained in Section 4.3.4.2. The difference between the number of bits allocated and the number of bits used is accumulated to a "balance" (initialized to zero) that helps adjust the allocation for the next bands. One third of the balance is applied to the bit allocation of each band to help achieve the target allocation. The only exceptions are the band before the last and the last band, for which half the balance and the whole balance are applied, respectively.

虽然分配是以1/8位为单位执行的,但量化需要整数个脉冲K。为此,编码器搜索K的值,该值产生最接近分配值的位数(如果正好在两个值之间的一半,则向下舍入),以不超过可用的总位数。出于效率原因,对预计算的分配表执行搜索,该分配表只允许每个N有一些K值。可以按照第4.3.4.2节中的说明计算码本条目的数量。分配的比特数和使用的比特数之间的差值被累积到“平衡”(初始化为零),这有助于调整下一个频带的分配。平衡的三分之一用于每个频带的位分配,以帮助实现目标分配。唯一的例外是最后一个波段和最后一个波段之前的波段,分别应用余额的一半和全部。

4.3.4.2. PVQ Decoding
4.3.4.2. PVQ译码

Decoding of PVQ vectors is implemented in decode_pulses() (cwrs.c). The unique codeword index is decoded as a uniformly distributed integer value between 0 and V(N,K)-1, where V(N,K) is the number of possible combinations of K pulses in N samples. The index is then converted to a vector in the same way specified in [PVQ]. The indexing is based on the calculation of V(N,K) (denoted N(L,K) in [PVQ]).

PVQ矢量的解码在decode_pulses()中实现(cwrs.c)。唯一码字索引被解码为0和V(N,K)-1之间的均匀分布整数值,其中V(N,K)是N个样本中K个脉冲的可能组合的数量。然后按照[PVQ]中指定的相同方式将索引转换为向量。索引基于V(N,K)(在[PVQ]中表示为N(L,K))的计算。

The number of combinations can be computed recursively as V(N,K) = V(N-1,K) + V(N,K-1) + V(N-1,K-1), with V(N,0) = 1 and V(0,K) = 0, K != 0. There are many different ways to compute V(N,K), including precomputed tables and direct use of the recursive formulation. The reference implementation applies the recursive formulation one line (or column) at a time to save on memory use, along with an alternate, univariate recurrence to initialize an arbitrary line, and direct polynomial solutions for small N. All of these methods are equivalent, and have different trade-offs in speed, memory usage, and code size. Implementations MAY use any methods they like, as long as they are equivalent to the mathematical definition.

组合的数量可以递归计算为V(N,K)=V(N-1,K)+V(N,K-1)+V(N-1,K-1),其中V(N,0)=1和V(0,K)=0,K!=0计算V(N,K)有许多不同的方法,包括预计算表和直接使用递归公式。参考实现一次应用一行(或一列)递归公式以节省内存使用,以及交替的单变量递归来初始化任意行,以及小N的直接多项式解。所有这些方法都是等效的,并且在速度、内存使用和代码大小方面具有不同的权衡。实现可以使用他们喜欢的任何方法,只要它们等同于数学定义。

The decoded vector X is recovered as follows. Let i be the index decoded with the procedure in Section 4.1.5 with ft = V(N,K), so that 0 <= i < V(N,K). Let k = K. Then, for j = 0 to (N - 1), inclusive, do:

解码后的向量X恢复如下。假设i是使用第4.1.5节中的程序解码的索引,ft=V(N,K),因此0<=i<V(N,K)。设k=k。然后,对于j=0到(N-1),包括在内,做:

1. Let p = (V(N-j-1,k) + V(N-j,k))/2.

1. 设p=(V(N-j-1,k)+V(N-j,k))/2。

2. If i < p, then let sgn = 1, else let sgn = -1 and set i = i - p.

2. 如果i<p,那么让sgn=1,否则让sgn=-1,并设置i=i-p。

3. Let k0 = k and set p = p - V(N-j-1,k).

3. 设k0=k,设p=p-V(N-j-1,k)。

4. While p > i, set k = k - 1 and p = p - V(N-j-1,k).

4. 当p>i时,设置k=k-1和p=p-V(N-j-1,k)。

5. Set X[j] = sgn*(k0 - k) and i = i - p.

5. 集合X[j]=sgn*(k0-k)和i=i-p。

The decoded vector X is then normalized such that its L2-norm equals one.

然后对解码向量X进行归一化,使其L2范数等于1。

4.3.4.3. Spreading
4.3.4.3. 传播

The normalized vector decoded in Section 4.3.4.2 is then rotated for the purpose of avoiding tonal artifacts. The rotation gain is equal to

然后旋转第4.3.4.2节中解码的归一化向量,以避免音调伪影。旋转增益等于

                           g_r = N / (N + f_r*K)
        
                           g_r = N / (N + f_r*K)
        

where N is the number of dimensions, K is the number of pulses, and f_r depends on the value of the "spread" parameter in the bitstream.

其中N是维数,K是脉冲数,f_r取决于比特流中“扩展”参数的值。

                 +--------------+------------------------+
                 | Spread value | f_r                    |
                 +--------------+------------------------+
                 | 0            | infinite (no rotation) |
                 |              |                        |
                 | 1            | 15                     |
                 |              |                        |
                 | 2            | 10                     |
                 |              |                        |
                 | 3            | 5                      |
                 +--------------+------------------------+
        
                 +--------------+------------------------+
                 | Spread value | f_r                    |
                 +--------------+------------------------+
                 | 0            | infinite (no rotation) |
                 |              |                        |
                 | 1            | 15                     |
                 |              |                        |
                 | 2            | 10                     |
                 |              |                        |
                 | 3            | 5                      |
                 +--------------+------------------------+
        

Table 59: Spreading Values

表59:扩散值

The rotation angle is then calculated as

然后将旋转角度计算为:

                                              2
                                     pi *  g_r
                             theta = ----------
                                         4
        
                                              2
                                     pi *  g_r
                             theta = ----------
                                         4
        

A 2-D rotation R(i,j) between points x_i and x_j is defined as:

点x_i和x_j之间的二维旋转R(i,j)定义为:

                  x_i' =  cos(theta)*x_i + sin(theta)*x_j
                  x_j' = -sin(theta)*x_i + cos(theta)*x_j
        
                  x_i' =  cos(theta)*x_i + sin(theta)*x_j
                  x_j' = -sin(theta)*x_i + cos(theta)*x_j
        

An N-D rotation is then achieved by applying a series of 2-D rotations back and forth, in the following order: R(x_1, x_2), R(x_2, x_3), ..., R(x_N-2, X_N-1), R(x_N-1, X_N), R(x_N-2, X_N-1), ..., R(x_1, x_2).

然后,通过按以下顺序前后应用一系列二维旋转来实现N-D旋转:R(x_1,x_2),R(x_2,x_3),…,R(x_N-2,x_N-1),R(x_N-1,x_N),R(x_N-2,x_N-1),…,R(x_1,x_2)。

   If the decoded vector represents more than one time block, then this
   spreading process is applied separately on each time block.  Also, if
   each block represents 8 samples or more, then another N-D rotation,
   by (pi/2-theta), is applied _before_ the rotation described above.
   This extra rotation is applied in an interleaved manner with a stride
   equal to round(sqrt(N/nb_blocks)), i.e., it is applied independently
   for each set of sample S_k = {stride*n + k}, n=0..N/stride-1.
        
   If the decoded vector represents more than one time block, then this
   spreading process is applied separately on each time block.  Also, if
   each block represents 8 samples or more, then another N-D rotation,
   by (pi/2-theta), is applied _before_ the rotation described above.
   This extra rotation is applied in an interleaved manner with a stride
   equal to round(sqrt(N/nb_blocks)), i.e., it is applied independently
   for each set of sample S_k = {stride*n + k}, n=0..N/stride-1.
        
4.3.4.4. Split Decoding
4.3.4.4. 分裂译码

To avoid the need for multi-precision calculations when decoding PVQ codevectors, the maximum size allowed for codebooks is 32 bits. When larger codebooks are needed, the vector is instead split in two sub-vectors of size N/2. A quantized gain parameter with precision

为避免解码PVQ码向量时需要多精度计算,码本允许的最大大小为32位。当需要更大的码本时,向量被分成大小为N/2的两个子向量。精确量化增益参数

derived from the current allocation is entropy coded to represent the relative gains of each side of the split, and the entire decoding process is recursively applied. Multiple levels of splitting may be applied up to a limit of LM+1 splits. The same recursive mechanism is applied for the joint coding of stereo audio.

从当前分配中导出的是熵编码,以表示分割的每一侧的相对增益,并且递归地应用整个解码过程。可以应用多个级别的拆分,最多限制为LM+1拆分。同样的递归机制也适用于立体声音频的联合编码。

4.3.4.5. Time-Frequency Change
4.3.4.5. 时频变化

The time-frequency (TF) parameters are used to control the time-frequency resolution trade-off in each coded band. For each band, there are two possible TF choices. For the first band coded, the PDF is {3, 1}/4 for frames marked as transient and {15, 1}/16 for the other frames. For subsequent bands, the TF choice is coded relative to the previous TF choice with probability {15, 1}/16 for transient frames and {31, 1}/32 otherwise. The mapping between the decoded TF choices and the adjustment in TF resolution is shown in the tables below.

时频(TF)参数用于控制每个编码频带中的时频分辨率权衡。对于每个波段,有两种可能的TF选择。对于第一个带编码的帧,对于标记为瞬态的帧,PDF为{3,1}/4,对于其他帧,PDF为{15,1}/16。对于后续频带,TF选择相对于先前TF选择进行编码,对于瞬态帧,概率为{15,1}/16,否则概率为{31,1}/32。解码TF选择和TF分辨率调整之间的映射如下表所示。

                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 0 | -1 |
                       |                 |   |    |
                       |        10       | 0 | -2 |
                       |                 |   |    |
                       |        20       | 0 | -2 |
                       +-----------------+---+----+
        
                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 0 | -1 |
                       |                 |   |    |
                       |        10       | 0 | -2 |
                       |                 |   |    |
                       |        20       | 0 | -2 |
                       +-----------------+---+----+
        

Table 60: TF Adjustments for Non-transient Frames and tf_select=0

表60:非瞬态帧的TF调整和TF_选择=0

                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 0 | -2 |
                       |                 |   |    |
                       |        10       | 0 | -3 |
                       |                 |   |    |
                       |        20       | 0 | -3 |
                       +-----------------+---+----+
        
                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 0 | -2 |
                       |                 |   |    |
                       |        10       | 0 | -3 |
                       |                 |   |    |
                       |        20       | 0 | -3 |
                       +-----------------+---+----+
        

Table 61: TF Adjustments for Non-transient Frames and tf_select=1

表61:非瞬态帧和TF_select=1的TF调整

                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 1 |  0 |
                       |                 |   |    |
                       |        10       | 2 |  0 |
                       |                 |   |    |
                       |        20       | 3 |  0 |
                       +-----------------+---+----+
        
                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 1 |  0 |
                       |                 |   |    |
                       |        10       | 2 |  0 |
                       |                 |   |    |
                       |        20       | 3 |  0 |
                       +-----------------+---+----+
        

Table 62: TF Adjustments for Transient Frames and tf_select=0

表62:瞬态帧的TF调整和TF_选择=0

                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 1 | -1 |
                       |                 |   |    |
                       |        10       | 1 | -1 |
                       |                 |   |    |
                       |        20       | 1 | -1 |
                       +-----------------+---+----+
        
                       +-----------------+---+----+
                       | Frame size (ms) | 0 |  1 |
                       +-----------------+---+----+
                       |       2.5       | 0 | -1 |
                       |                 |   |    |
                       |        5        | 1 | -1 |
                       |                 |   |    |
                       |        10       | 1 | -1 |
                       |                 |   |    |
                       |        20       | 1 | -1 |
                       +-----------------+---+----+
        

Table 63: TF Adjustments for Transient Frames and tf_select=1

表63:瞬态帧的TF调整和TF_选择=1

A negative TF adjustment means that the temporal resolution is increased, while a positive TF adjustment means that the frequency resolution is increased. Changes in TF resolution are implemented using the Hadamard transform [HADAMARD]. To increase the time resolution by N, N "levels" of the Hadamard transform are applied to the decoded vector for each interleaved MDCT vector. To increase the frequency resolution (assumes a transient frame), then N levels of the Hadamard transform are applied _across_ the interleaved MDCT vector. In the case of increased time resolution, the decoder uses the "sequency order" because the input vector is sorted in time.

负TF调整意味着时间分辨率增加,而正TF调整意味着频率分辨率增加。TF分辨率的变化使用Hadamard变换[Hadamard]实现。为了将时间分辨率提高N,对每个交错MDCT向量的解码向量应用N个“级别”的Hadamard变换。为了提高频率分辨率(假设为瞬态帧),然后在交错MDCT矢量上应用N级Hadamard变换。在时间分辨率增加的情况下,解码器使用“序列顺序”,因为输入向量是按时间排序的。

4.3.5. Anti-collapse Processing
4.3.5. 防塌处理

The anti-collapse feature is designed to avoid the situation where the use of multiple short MDCTs causes the energy in one or more of the MDCTs to be zero for some bands, causing unpleasant artifacts. When the frame has the transient bit set, an anti-collapse bit is decoded. When anti-collapse is set, the energy in each small MDCT is prevented from collapsing to zero. For each band of each MDCT where a collapse is detected, a pseudo-random signal is inserted with an

防塌陷功能旨在避免使用多个短MDCT导致一个或多个MDCT中的能量在某些频带为零,从而导致不愉快的伪影的情况。当帧设置了瞬态位时,反折叠位被解码。设置防塌陷功能后,可防止每个小型MDCT中的能量塌陷为零。对于检测到塌陷的每个MDCT的每个频带,使用一个

energy corresponding to the minimum energy over the two previous frames. A renormalization step is then required to ensure that the anti-collapse step did not alter the energy preservation property.

与前两帧上的最小能量相对应的能量。然后需要一个重整化步骤,以确保防崩溃步骤不会改变能量保存特性。

4.3.6. Denormalization
4.3.6. 非规范化

Just as each band was normalized in the encoder, the last step of the decoder before the inverse MDCT is to denormalize the bands. Each decoded normalized band is multiplied by the square root of the decoded energy. This is done by denormalise_bands() (bands.c).

正如在编码器中对每个频带进行规范化一样,在反向MDCT之前,解码器的最后一步是对频带进行非规范化。每个解码的归一化频带乘以解码能量的平方根。这是通过反规范化_bands()(bands.c)实现的。

4.3.7. Inverse MDCT
4.3.7. 逆MDCT

The inverse MDCT implementation has no special characteristics. The input is N frequency-domain samples and the output is 2*N time-domain samples, while scaling by 1/2. A "low-overlap" window reduces the algorithmic delay. It is derived from a basic (full-overlap) 240- sample version of the window used by the Vorbis codec:

逆MDCT实现没有特殊的特性。输入为N个频域样本,输出为2*N个时域样本,比例为1/2。“低重叠”窗口可减少算法延迟。它源自Vorbis编解码器使用的窗口的基本(完全重叠)240示例版本:

                                                         2
                          /   /pi      /pi   n + 1/2\ \ \
                   W(n) = |sin|-- * sin|-- * -------| | |
                          \   \2       \2       L   / / /
        
                                                         2
                          /   /pi      /pi   n + 1/2\ \ \
                   W(n) = |sin|-- * sin|-- * -------| | |
                          \   \2       \2       L   / / /
        

The low-overlap window is created by zero-padding the basic window and inserting ones in the middle, such that the resulting window still satisfies power complementarity [PRINCEN86]. The IMDCT and windowing are performed by mdct_backward (mdct.c).

低重叠窗口是通过零填充基本窗口并在中间插入窗口来创建的,这样得到的窗口仍然满足幂互补性[PRIMCEN86]。IMDCT和窗口化由mdct_backward(mdct.c)执行。

4.3.7.1. Post-Filter
4.3.7.1. 后过滤器

The output of the inverse MDCT (after weighted overlap-add) is sent to the post-filter. Although the post-filter is applied at the end, the post-filter parameters are encoded at the beginning, just after the silence flag. The post-filter can be switched on or off using one bit (logp=1). If the post-filter is enabled, then the octave is decoded as an integer value between 0 and 6 of uniform probability. Once the octave is known, the fine pitch within the octave is decoded using 4+octave raw bits. The final pitch period is equal to (16<<octave)+fine_pitch-1 so it is bounded between 15 and 1022, inclusively. Next, the gain is decoded as three raw bits and is equal to G=3*(int_gain+1)/32. The set of post-filter taps is decoded last, using a pdf equal to {2, 1, 1}/4. Tapset zero corresponds to the filter coefficients g0 = 0.3066406250, g1 = 0.2170410156, g2 = 0.1296386719. Tapset one corresponds to the filter coefficients g0 = 0.4638671875, g1 = 0.2680664062, g2 = 0, and tapset two uses filter coefficients g0 = 0.7998046875, g1 = 0.1000976562, g2 = 0.

逆MDCT的输出(加权叠加后)发送到后滤波器。虽然后期过滤器在末尾应用,但后期过滤器参数在开始时编码,就在静默标志之后。可以使用一个位(logp=1)打开或关闭后滤波器。如果启用后滤波器,则倍频程解码为均匀概率0到6之间的整数值。一旦知道倍频程,倍频程内的精细音高将使用4+倍频程原始位进行解码。最后的音高周期等于(16<<倍频程)+精细音高-1,因此它的范围在15和1022之间,包括15和1022之间。接下来,增益被解码为三个原始比特,并且等于G=3*(int_增益+1)/32。最后使用等于{2,1,1}/4的pdf对后滤波器抽头集进行解码。Tapset zero对应于滤波器系数g0=0.3066406250、g1=0.2170410156、g2=0.1296386719。Tapset one对应于滤波器系数g0=0.4638671875、g1=0.2680664062、g2=0,Tapset II使用滤波器系数g0=0.7998046875、g1=0.1000976562、g2=0。

The post-filter response is thus computed as:

因此,滤波器后响应计算为:

             y(n) = x(n) + G*(g0*y(n-T) + g1*(y(n-T+1)+y(n-T+1))
                                        + g2*(y(n-T+2)+y(n-T+2)))
        
             y(n) = x(n) + G*(g0*y(n-T) + g1*(y(n-T+1)+y(n-T+1))
                                        + g2*(y(n-T+2)+y(n-T+2)))
        

During a transition between different gains, a smooth transition is calculated using the square of the MDCT window. It is important that values of y(n) be interpolated one at a time such that the past value of y(n) used is interpolated.

在不同增益之间的过渡期间,使用MDCT窗口的平方计算平滑过渡。一次内插一个y(n)值非常重要,以便内插使用的y(n)的过去值。

4.3.7.2. De-emphasis
4.3.7.2. 去强调

After the post-filter, the signal is de-emphasized using the inverse of the pre-emphasis filter used in the encoder:

在后滤波器之后,使用编码器中使用的预加重滤波器的逆滤波器对信号进行去加重:

                            1            1
                           ---- = ---------------
                           A(z)                -1
                                  1 - alpha_p*z
        
                            1            1
                           ---- = ---------------
                           A(z)                -1
                                  1 - alpha_p*z
        

where alpha_p=0.8500061035.

式中,αp=0.8500061035。

4.4. Packet Loss Concealment (PLC)
4.4. 包丢失隐藏(PLC)

Packet Loss Concealment (PLC) is an optional decoder-side feature that SHOULD be included when receiving from an unreliable channel. Because PLC is not part of the bitstream, there are many acceptable ways to implement PLC with different complexity/quality trade-offs.

数据包丢失隐藏(PLC)是一种可选的解码器端功能,从不可靠的信道接收数据时应包括该功能。由于可编程逻辑控制器不是比特流的一部分,有许多可接受的方法来实现具有不同复杂性/质量权衡的可编程逻辑控制器。

The PLC in the reference implementation depends on the mode of last packet received. In CELT mode, the PLC finds a periodicity in the decoded signal and repeats the windowed waveform using the pitch offset. The windowed waveform is overlapped in such a way as to preserve the time-domain aliasing cancellation with the previous frame and the next frame. This is implemented in celt_decode_lost() (mdct.c). In SILK mode, the PLC uses LPC extrapolation from the previous frame, implemented in silk_PLC() (PLC.c).

参考实现中的PLC取决于最后接收的数据包的模式。在CELT模式下,PLC在解码信号中发现周期性,并使用俯仰偏移重复加窗波形。加窗波形以这样的方式重叠,以保持与前一帧和下一帧的时域混叠消除。这是在celt_decode_lost()中实现的(mdct.c)。在SILK模式下,PLC使用前一帧的LPC外推,在SILK_PLC()(PLC.c)中实现。

4.4.1. Clock Drift Compensation
4.4.1. 时钟漂移补偿

Clock drift refers to the gradual desynchronization of two endpoints whose sample clocks run at different frequencies while they are streaming live audio. Differences in clock frequencies are generally attributable to manufacturing variation in the endpoints' clock hardware. For long-lived streams, the time difference between sender and receiver can grow without bound.

时钟漂移指的是两个端点的逐渐去同步,其采样时钟在传输实时音频时以不同的频率运行。时钟频率的差异通常归因于端点时钟硬件的制造差异。对于长寿命的流,发送方和接收方之间的时间差可以无限增长。

When the sender's clock runs slower than the receiver's, the effect is similar to packet loss: too few packets are received. The receiver can distinguish between drift and loss if the transport provides packet timestamps. A receiver for live streams SHOULD conceal the effects of drift, and it MAY do so by invoking the PLC.

当发送方的时钟比接收方的时钟慢时,其效果类似于数据包丢失:接收的数据包太少。如果传输提供数据包时间戳,接收器可以区分漂移和丢失。实时流的接收器应该隐藏漂移的影响,并且可以通过调用PLC来实现。

When the sender's clock runs faster than the receiver's, too many packets will be received. The receiver MAY respond by skipping any packet (i.e., not submitting the packet for decoding). This is likely to produce a less severe artifact than if the frame were dropped after decoding.

当发送方的时钟运行速度快于接收方的时钟运行速度时,将收到过多的数据包。接收机可以通过跳过任何分组来响应(即,不提交分组以进行解码)。与解码后丢弃帧相比,这可能会产生不太严重的伪影。

A decoder MAY employ a more sophisticated drift compensation method. For example, the NetEQ component [GOOGLE-NETEQ] of the Google WebRTC codebase [GOOGLE-WEBRTC] compensates for drift by adding or removing one period when the signal is highly periodic. The reference implementation of Opus allows a caller to learn whether the current frame's signal is highly periodic, and if so what the period is, using the OPUS_GET_PITCH() request.

解码器可以采用更复杂的漂移补偿方法。例如,GOOGLE WebRTC代码库[GOOGLE-WebRTC]的NetEQ组件[GOOGLE-NetEQ]通过在信号高度周期时添加或删除一个周期来补偿漂移。Opus的参考实现允许调用者使用Opus_GET_PITCH()请求了解当前帧的信号是否具有高度周期性,如果是,周期是多少。

4.5. Configuration Switching
4.5. 配置切换

Switching between the Opus coding modes, audio bandwidths, and channel counts requires careful consideration to avoid audible glitches. Switching between any two configurations of the CELT-only mode, any two configurations of the Hybrid mode, or from WB SILK to Hybrid mode does not require any special treatment in the decoder, as the MDCT overlap will smooth the transition. Switching from Hybrid mode to WB SILK requires adding in the final contents of the CELT overlap buffer to the first SILK-only packet. This can be done by decoding a 2.5 ms silence frame with the CELT decoder using the channel count of the SILK-only packet (and any choice of audio bandwidth), which will correctly handle the cases when the channel count changes as well.

在Opus编码模式、音频带宽和频道计数之间切换需要仔细考虑,以避免声音故障。在仅CELT模式的任何两种配置、混合模式的任何两种配置或从WB SILK到混合模式之间切换不需要在解码器中进行任何特殊处理,因为MDCT重叠将平滑过渡。从混合模式切换到WB SILK需要将CELT重叠缓冲区的最终内容添加到第一个纯丝数据包中。这可以通过CELT解码器使用纯丝绸数据包的信道计数(以及任何音频带宽选择)解码2.5 ms静默帧来实现,这将正确处理信道计数变化的情况。

When changing the channel count for SILK-only or Hybrid packets, the encoder can avoid glitches by smoothly varying the stereo width of the input signal before or after the transition, and it SHOULD do so. However, other transitions between SILK-only packets or between NB or MB SILK and Hybrid packets may cause glitches, because neither the LSF coefficients nor the LTP, LPC, stereo unmixing, and resampler buffers are available at the new sample rate. These switches SHOULD be delayed by the encoder until quiet periods or transients, where the inevitable glitches will be less audible. Additionally, the bitstream MAY include redundant side information ("redundancy"), in the form of additional CELT frames embedded in each of the Opus frames around the transition.

当更改纯丝绸或混合数据包的通道计数时,编码器可以通过在转换之前或之后平滑地改变输入信号的立体声宽度来避免故障,并且应该这样做。然而,仅真丝数据包之间或NB或MB真丝数据包与混合数据包之间的其他转换可能会导致小故障,因为在新的采样率下,LSF系数以及LTP、LPC、立体分解和重采样缓冲器都不可用。编码器应将这些开关延迟至安静期或瞬变期,此时不可避免的故障将不易听到。此外,比特流可以包括冗余侧信息(“冗余”),其形式为嵌入在围绕转换的每个Opus帧中的附加CELT帧。

The other transitions that cannot be easily handled are those where the lower frequencies switch between the SILK LP-based model and the CELT MDCT model. However, an encoder may not have an opportunity to delay such a switch to a convenient point. For example, if the content switches from speech to music, and the encoder does not have enough latency in its analysis to detect this in advance, there may be no convenient silence period during which to make the transition for quite some time. To avoid or reduce glitches during these problematic mode transitions, and between audio bandwidth changes in the SILK-only modes, transitions MAY include redundant side information ("redundancy"), in the form of an additional CELT frame embedded in the Opus frame.

其他不易处理的转换是那些低频在基于SILK LP的模型和CELT MDCT模型之间切换的转换。然而,编码器可能没有机会将这种切换延迟到方便的点。例如,如果内容从语音切换到音乐,并且编码器在其分析中没有足够的延迟来提前检测到这一点,则可能没有方便的静默期来在相当长的一段时间内进行转换。为了避免或减少在这些有问题的模式转换期间以及在仅丝绸模式中的音频带宽变化之间的小故障,转换可以包括以嵌入Opus帧中的附加CELT帧的形式的冗余侧信息(“冗余”)。

A transition between coding the lower frequencies with the LP model and the MDCT model or a transition that involves changing the SILK bandwidth is only normatively specified when it includes redundancy. For those without redundancy, it is RECOMMENDED that the decoder use a concealment technique (e.g., make use of a PLC algorithm) to "fill in" the gap or discontinuity caused by the mode transition. Therefore, PLC MUST NOT be applied during any normative transition, i.e., when

使用LP模型和MDCT模型对较低频率进行编码之间的转换,或者涉及改变丝绸带宽的转换,只有在包含冗余时才进行规范性规定。对于那些没有冗余的,建议解码器使用隐藏技术(例如,使用PLC算法)来“填充”由模式转换引起的间隙或不连续性。因此,在任何规范转换期间,即

o A packet includes redundancy for this transition (as described below),

o 数据包包括该转换的冗余(如下所述),

o The transition is between any WB SILK packet and any Hybrid packet, or vice versa,

o 转换是在任何WB丝绸包和任何混合包之间进行的,反之亦然,

o The transition is between any two Hybrid mode packets, or

o 转换在任意两个混合模式数据包之间,或

o The transition is between any two CELT mode packets,

o 转换在任意两个CELT模式数据包之间,

unless there is actual packet loss.

除非有实际的数据包丢失。

4.5.1. Transition Side Information (Redundancy)
4.5.1. 过渡侧信息(冗余)

Transitions with side information include an extra 5 ms "redundant" CELT frame within the Opus frame. This frame is designed to fill in the gap or discontinuity in the different layers without requiring the decoder to conceal it. For transitions from CELT-only to SILK-only or Hybrid, the redundant frame is inserted in the first Opus frame after the transition (i.e., the first SILK-only or Hybrid frame). For transitions from SILK-only or Hybrid to CELT-only, the redundant frame is inserted in the last Opus frame before the transition (i.e., the last SILK-only or Hybrid frame).

带有侧边信息的过渡包括Opus帧内额外的5毫秒“冗余”凯尔特帧。该帧用于填充不同层中的间隙或不连续性,而无需解码器隐藏。对于从纯凯尔特到纯丝绸或混合的过渡,冗余帧插入过渡后的第一个Opus帧(即,第一个纯丝绸或混合帧)。对于从纯真丝或混合到纯凯尔特的过渡,冗余帧插入过渡前的最后一个Opus帧(即,最后一个纯真丝或混合帧)。

4.5.1.1. Redundancy Flag
4.5.1.1. 冗余标志

The presence of redundancy is signaled in all SILK-only and Hybrid frames, not just those involved in a mode transition. This allows the frames to be decoded correctly even if an adjacent frame is lost. For SILK-only frames, this signaling is implicit, based on the size of the Opus frame and the number of bits consumed decoding the SILK portion of it. After decoding the SILK portion of the Opus frame, the decoder uses ec_tell() (see Section 4.1.6.1) to check if there are at least 17 bits remaining. If so, then the frame contains redundancy.

冗余的存在在所有纯真丝和混合帧中发出信号,而不仅仅是那些涉及模式转换的帧。这样,即使相邻帧丢失,也可以正确解码帧。对于纯丝绸帧,该信号是隐式的,基于Opus帧的大小和解码其丝绸部分所消耗的比特数。解码Opus帧的丝绸部分后,解码器使用ec_tell()(见第4.1.6.1节)检查是否至少还有17位剩余。如果是,则帧包含冗余。

For Hybrid frames, this signaling is explicit. After decoding the SILK portion of the Opus frame, the decoder uses ec_tell() (see Section 4.1.6.1) to ensure there are at least 37 bits remaining. If so, it reads a symbol with the PDF in Table 64, and if the value is 1, then the frame contains redundancy. Otherwise (if there were fewer than 37 bits left or the value was 0), the frame does not contain redundancy.

对于混合帧,该信令是明确的。解码Opus帧的丝绸部分后,解码器使用ec_tell()(参见第4.1.6.1节)确保至少还有37位剩余。如果是,则读取表64中带有PDF的符号,如果值为1,则帧包含冗余。否则(如果剩余少于37位或值为0),帧不包含冗余。

                            +----------------+
                            | PDF            |
                            +----------------+
                            | {4095, 1}/4096 |
                            +----------------+
        
                            +----------------+
                            | PDF            |
                            +----------------+
                            | {4095, 1}/4096 |
                            +----------------+
        

Table 64: Redundancy Flag PDF

表64:冗余标志PDF

4.5.1.2. Redundancy Position Flag
4.5.1.2. 冗余位置标志

Since the current frame is a SILK-only or a Hybrid frame, it must be at least 10 ms. Therefore, it needs an additional flag to indicate whether the redundant 5 ms CELT frame should be mixed into the beginning of the current frame, or the end. After determining that a frame contains redundancy, the decoder reads a 1 bit symbol with a uniform PDF (Table 65).

由于当前帧是纯真丝帧或混合帧,它必须至少为10 ms。因此,它需要一个额外的标志来指示冗余的5 ms CELT帧是应混合到当前帧的开头还是结尾。在确定帧包含冗余后,解码器读取具有统一PDF的1位符号(表65)。

                               +----------+
                               | PDF      |
                               +----------+
                               | {1, 1}/2 |
                               +----------+
        
                               +----------+
                               | PDF      |
                               +----------+
                               | {1, 1}/2 |
                               +----------+
        

Table 65: Redundancy Position PDF

表65:冗余位置PDF

If the value is zero, this is the first frame in the transition, and the redundancy belongs at the end. If the value is one, this is the second frame in the transition, and the redundancy belongs at the beginning. There is no way to specify that an Opus frame contains separate redundant CELT frames at both the beginning and the end.

如果该值为零,则这是转换中的第一帧,冗余属于末尾。如果该值为1,则这是转换中的第二帧,冗余属于开头。无法指定Opus帧在开头和结尾都包含单独的冗余凯尔特帧。

4.5.1.3. Redundancy Size
4.5.1.3. 冗余大小

Unlike the CELT portion of a Hybrid frame, the redundant CELT frame does not use the same entropy coder state as the rest of the Opus frame, because this would break the CELT bit allocation mechanism in Hybrid frames. Thus, a redundant CELT frame always starts and ends on a byte boundary, even in SILK-only frames, where this is not strictly necessary.

与混合帧的CELT部分不同,冗余CELT帧不使用与Opus帧其余部分相同的熵编码器状态,因为这将破坏混合帧中的CELT比特分配机制。因此,冗余的CELT帧始终在字节边界上开始和结束,即使在仅丝绸帧中也是如此,这在严格意义上是不必要的。

For SILK-only frames, the number of bytes in the redundant CELT frame is simply the number of whole bytes remaining, which must be at least 2, due to the space check in Section 4.5.1.1. For Hybrid frames, the number of bytes is equal to 2, plus a decoded unsigned integer less than 256 (see Section 4.1.5). This may be more than the number of whole bytes remaining in the Opus frame, in which case the frame is invalid. However, a decoder is not required to ignore the entire frame, as this may be the result of a bit error that desynchronized the range coder. There may still be useful data before the error, and a decoder MAY keep any audio decoded so far instead of invoking the PLC, but it is RECOMMENDED that the decoder stop decoding and discard the rest of the current Opus frame.

对于纯真丝帧,冗余CELT帧中的字节数只是剩余的整个字节数,由于第4.5.1.1节中的空间检查,必须至少为2。对于混合帧,字节数等于2,加上一个小于256的解码无符号整数(见第4.1.5节)。这可能超过Opus帧中剩余的整字节数,在这种情况下,帧无效。然而,解码器不需要忽略整个帧,因为这可能是使范围编码器失步的比特错误的结果。在错误发生之前,可能仍然存在有用的数据,解码器可能会保留任何已解码的音频,而不是调用PLC,但建议解码器停止解码并丢弃当前Opus帧的其余部分。

It would have been possible to avoid these invalid states in the design of Opus by limiting the range of the explicit length decoded from Hybrid frames by the actual number of whole bytes remaining. However, this would require an encoder to determine the rate allocation for the MDCT layer up front, before it began encoding that layer. By allowing some invalid sizes, the encoder is able to defer that decision until much later. When encoding Hybrid frames that do not include redundancy, the encoder must still decide up front if it wishes to use the minimum 37 bits required to trigger encoding of the redundancy flag, but this is a much looser restriction.

通过将混合帧解码的显式长度范围限制为实际剩余的整字节数,可以避免OPU设计中的这些无效状态。然而,这需要一个编码器在开始编码MDCT层之前预先确定该层的速率分配。通过允许一些无效的大小,编码器能够将该决定推迟到很久以后。当编码不包括冗余的混合帧时,编码器仍然必须预先决定是否希望使用触发冗余标志编码所需的最小37位,但这是一个更宽松的限制。

After determining the size of the redundant CELT frame, the decoder reduces the size of the buffer currently in use by the range coder by that amount. The MDCT layer reads any raw bits from the end of this reduced buffer, and all calculations of the number of bits remaining in the buffer must be done using this new, reduced size, rather than the original size of the Opus frame.

在确定冗余CELT帧的大小之后,解码器将范围编码器当前使用的缓冲器的大小减小该量。MDCT层从这个缩减的缓冲区的末尾读取任何原始比特,所有关于缓冲区中剩余比特数的计算都必须使用这个新的、缩减的大小,而不是Opus帧的原始大小。

4.5.1.4. Decoding the Redundancy
4.5.1.4. 解码冗余

The redundant frame is decoded like any other CELT-only frame, with the exception that it does not contain a TOC byte. The frame size is fixed at 5 ms, the channel count is set to that of the current frame, and the audio bandwidth is also set to that of the current frame, with the exception that for MB SILK frames, it is set to WB.

除了不包含TOC字节外,冗余帧与任何其他仅CELT帧一样进行解码。帧大小固定为5毫秒,通道数设置为当前帧的通道数,音频带宽也设置为当前帧的音频带宽,但对于MB丝绸帧,则设置为WB。

If the redundancy belongs at the beginning (in a CELT-only to SILK-only or Hybrid transition), the final reconstructed output uses the first 2.5 ms of audio output by the decoder for the redundant frame as is, discarding the corresponding output from the SILK-only or Hybrid portion of the frame. The remaining 2.5 ms is cross-lapped with the decoded SILK/Hybrid signal using the CELT's power-complementary MDCT window to ensure a smooth transition.

如果冗余在开始时(在CELT中仅为纯丝或混合过渡),则最终重构输出将使用解码器为冗余帧原样输出的前2.5 ms音频,丢弃帧的纯丝或混合部分的相应输出。剩余的2.5毫秒使用CELT的功率互补MDCT窗口与解码的丝绸/混合信号交叉重叠,以确保平稳过渡。

If the redundancy belongs at the end (in a SILK-only or Hybrid to CELT-only transition), only the second half (2.5 ms) of the audio output by the decoder for the redundant frame is used. In that case, the second half of the redundant frame is cross-lapped with the end of the SILK/Hybrid signal, again using CELT's power-complementary MDCT window to ensure a smooth transition.

如果冗余属于末尾(在纯丝绸或混合到纯凯尔特的过渡中),则仅使用解码器为冗余帧输出的音频的后半部分(2.5 ms)。在这种情况下,冗余帧的后半部分与丝绸/混合信号的末端交叉重叠,再次使用CELT的功率互补MDCT窗口以确保平稳过渡。

4.5.2. State Reset
4.5.2. 状态重置

When a transition occurs, the state of the SILK or the CELT decoder (or both) may need to be reset before decoding a frame in the new mode. This avoids reusing "out of date" memory, which may not have been updated in some time or may not be in a well-defined state due to, e.g., PLC. The SILK state is reset before every SILK-only or Hybrid frame where the previous frame was CELT-only. The CELT state is reset every time the operating mode changes and the new mode is either Hybrid or CELT-only, except when the transition uses redundancy as described above. When switching from SILK-only or Hybrid to CELT-only with redundancy, the CELT state is reset before decoding the redundant CELT frame embedded in the SILK-only or Hybrid frame, but it is not reset before decoding the following CELT-only frame. When switching from CELT-only mode to SILK-only or Hybrid mode with redundancy, the CELT decoder is not reset for decoding the redundant CELT frame.

当转换发生时,在以新模式解码帧之前,可能需要重置SILK或CELT解码器(或两者)的状态。这避免了重复使用“过期”内存,这些内存可能在一段时间内没有更新,或者可能由于PLC等原因未处于定义良好的状态。丝绸状态在前一帧仅为凯尔特人的每一帧纯丝绸或混合帧之前重置。CELT状态在每次操作模式改变时重置,并且新模式为混合模式或仅CELT模式,除非转换使用如上所述的冗余。当从纯真丝或混合型切换到具有冗余的纯CELT时,在解码嵌入纯真丝或混合型帧中的冗余CELT帧之前重置CELT状态,但在解码以下纯CELT帧之前不会重置CELT状态。当从仅CELT模式切换到仅丝绸模式或具有冗余的混合模式时,CELT解码器不会重置以解码冗余CELT帧。

4.5.3. Summary of Transitions
4.5.3. 过渡概述

Figure 18 illustrates all of the normative transitions involving a mode change, an audio bandwidth change, or both. Each one uses an S, H, or C to represent an Opus frame in the corresponding mode. In addition, an R indicates the presence of redundancy in the Opus frame with which it is cross-lapped. Its location in the first or last 5 ms is assumed to correspond to whether it is the frame before or after the transition. Other uses of redundancy are non-normative. Finally, a c indicates the contents of the CELT overlap buffer after the previously decoded frame (i.e., as extracted by decoding a silence frame).

图18说明了所有涉及模式更改、音频带宽更改或两者的规范性转换。每一个都使用S、H或C来表示相应模式下的Opus帧。此外,R表示与之交叉重叠的Opus帧中存在冗余。假设其在第一个或最后5 ms中的位置对应于它是转换之前还是之后的帧。冗余的其他用途是不规范的。最后,c指示先前解码帧(即,通过解码静默帧提取的)之后的CELT重叠缓冲器的内容。

    SILK to SILK with Redundancy:             S -> S -> S
                                                        &
                                                       !R -> R
                                                             &
                                                            ;S -> S -> S
        
    SILK to SILK with Redundancy:             S -> S -> S
                                                        &
                                                       !R -> R
                                                             &
                                                            ;S -> S -> S
        
    NB or MB SILK to Hybrid with Redundancy:  S -> S -> S
                                                        &
                                                       !R ->;H -> H -> H
        
    NB or MB SILK to Hybrid with Redundancy:  S -> S -> S
                                                        &
                                                       !R ->;H -> H -> H
        
    WB SILK to Hybrid:                        S -> S -> S ->!H -> H -> H
        
    WB SILK to Hybrid:                        S -> S -> S ->!H -> H -> H
        
    SILK to CELT with Redundancy:             S -> S -> S
                                                        &
                                                       !R -> C -> C -> C
        
    SILK to CELT with Redundancy:             S -> S -> S
                                                        &
                                                       !R -> C -> C -> C
        
    Hybrid to NB or MB SILK with Redundancy:  H -> H -> H
                                                        &
                                                       !R -> R
                                                             &
                                                            ;S -> S -> S
        
    Hybrid to NB or MB SILK with Redundancy:  H -> H -> H
                                                        &
                                                       !R -> R
                                                             &
                                                            ;S -> S -> S
        
    Hybrid to WB SILK:                        H -> H -> H -> c
                                                          \  +
                                                           > S -> S -> S
        
    Hybrid to WB SILK:                        H -> H -> H -> c
                                                          \  +
                                                           > S -> S -> S
        
    Hybrid to CELT with Redundancy:           H -> H -> H
                                                        &
                                                       !R -> C -> C -> C
        
    Hybrid to CELT with Redundancy:           H -> H -> H
                                                        &
                                                       !R -> C -> C -> C
        
    CELT to SILK with Redundancy:             C -> C -> C -> R
                                                             &
                                                            ;S -> S -> S
        
    CELT to SILK with Redundancy:             C -> C -> C -> R
                                                             &
                                                            ;S -> S -> S
        
    CELT to Hybrid with Redundancy:           C -> C -> C -> R
                                                             &
                                                            |H -> H -> H
        
    CELT to Hybrid with Redundancy:           C -> C -> C -> R
                                                             &
                                                            |H -> H -> H
        

Key: S SILK-only frame ; SILK decoder reset H Hybrid frame | CELT and SILK decoder resets C CELT-only frame ! CELT decoder reset c CELT overlap + Direct mixing R Redundant CELT frame & Windowed cross-lap

关键:S纯丝绸框架;丝绸解码器重置H混合帧|凯尔特和丝绸解码器重置C凯尔特纯帧!CELT解码器重置c CELT重叠+直接混音R冗余CELT帧和窗口交叉重叠

Figure 18: Normative Transitions

图18:规范性转变

The first two and the last two Opus frames in each example are illustrative, i.e., there is no requirement that a stream remain in the same configuration for three consecutive frames before or after a switch.

每个示例中的前两个和最后两个Opus帧是说明性的,即,不要求流在切换之前或之后的三个连续帧中保持相同的配置。

The behavior of transitions without redundancy where PLC is allowed is non-normative. An encoder might still wish to use these transitions if, for example, it doesn't want to add the extra bitrate required for redundancy or if it makes a decision to switch after it has already transmitted the frame that would have had to contain the redundancy. Figure 19 illustrates the recommended cross-lapping and decoder resets for these transitions.

在允许PLC的情况下,无冗余转换的行为是不规范的。例如,如果编码器不想添加冗余所需的额外比特率,或者在已经传输了必须包含冗余的帧之后决定切换,则编码器可能仍然希望使用这些转换。图19说明了这些转换的建议交叉重叠和解码器重置。

    SILK to SILK (audio bandwidth change):    S -> S -> S   ;S -> S -> S
        
    SILK to SILK (audio bandwidth change):    S -> S -> S   ;S -> S -> S
        
    NB or MB SILK to Hybrid:                  S -> S -> S   |H -> H -> H
        
    NB or MB SILK to Hybrid:                  S -> S -> S   |H -> H -> H
        
    SILK to CELT without Redundancy:          S -> S -> S -> P
                                                             &
                                                            !C -> C -> C
        
    SILK to CELT without Redundancy:          S -> S -> S -> P
                                                             &
                                                            !C -> C -> C
        
    Hybrid to NB or MB SILK:                  H -> H -> H -> c
                                                             +
                                                            ;S -> S -> S
        
    Hybrid to NB or MB SILK:                  H -> H -> H -> c
                                                             +
                                                            ;S -> S -> S
        
    Hybrid to CELT without Redundancy:        H -> H -> H -> P
                                                             &
                                                            !C -> C -> C
        
    Hybrid to CELT without Redundancy:        H -> H -> H -> P
                                                             &
                                                            !C -> C -> C
        
    CELT to SILK without Redundancy:          C -> C -> C -> P
                                                             &
                                                            ;S -> S -> S
        
    CELT to SILK without Redundancy:          C -> C -> C -> P
                                                             &
                                                            ;S -> S -> S
        
    CELT to Hybrid without Redundancy:        C -> C -> C -> P
                                                             &
                                                            |H -> H -> H
        
    CELT to Hybrid without Redundancy:        C -> C -> C -> P
                                                             &
                                                            |H -> H -> H
        

Key: S SILK-only frame ; SILK decoder reset H Hybrid frame | CELT and SILK decoder resets C CELT-only frame ! CELT decoder reset c CELT overlap + Direct mixing P Packet Loss Concealment & Windowed cross-lap

关键:S纯丝绸框架;丝绸解码器重置H混合帧|凯尔特和丝绸解码器重置C凯尔特纯帧!CELT解码器重置c CELT重叠+直接混合P丢包隐藏和加窗交叉重叠

Figure 19: Recommended Non-Normative Transitions

图19:建议的非规范性转换

Encoders SHOULD NOT use other transitions, e.g., those that involve redundancy in ways not illustrated in Figure 18.

编码器不应使用其他转换,例如,以图18中未说明的方式涉及冗余的转换。

5. Opus Encoder
5. Opus编码器

Just like the decoder, the Opus encoder also normally consists of two main blocks: the SILK encoder and the CELT encoder. However, unlike the case of the decoder, a valid (though potentially suboptimal) Opus encoder is not required to support all modes and may thus only include a SILK encoder module or a CELT encoder module. The output bitstream of the Opus encoding contains bits from the SILK and CELT encoders, though these are not separable due to the use of a range coder. A block diagram of the encoder is illustrated below.

与解码器一样,Opus编码器通常也由两个主要模块组成:丝绸编码器和凯尔特编码器。然而,与解码器的情况不同,有效(尽管可能次优)Opus编码器不需要支持所有模式,因此可能仅包括丝绸编码器模块或CELT编码器模块。Opus编码的输出比特流包含来自SILK和CELT编码器的比特,尽管由于使用范围编码器,这些比特不可分离。编码器的框图如下所示。

                        +------------+    +---------+
                        |   Sample   |    |  SILK   |------+
                     +->|    Rate    |--->| Encoder |      V
      +-----------+  |  | Conversion |    |         | +---------+
      | Optional  |  |  +------------+    +---------+ |  Range  |
    ->| High-pass |--+                                | Encoder |---->
      |  Filter   |  |  +--------------+  +---------+ |         | Bit-
      +-----------+  |  |    Delay     |  |  CELT   | +---------+ stream
                     +->| Compensation |->| Encoder |      ^
                        |              |  |         |------+
                        +--------------+  +---------+
        
                        +------------+    +---------+
                        |   Sample   |    |  SILK   |------+
                     +->|    Rate    |--->| Encoder |      V
      +-----------+  |  | Conversion |    |         | +---------+
      | Optional  |  |  +------------+    +---------+ |  Range  |
    ->| High-pass |--+                                | Encoder |---->
      |  Filter   |  |  +--------------+  +---------+ |         | Bit-
      +-----------+  |  |    Delay     |  |  CELT   | +---------+ stream
                     +->| Compensation |->| Encoder |      ^
                        |              |  |         |------+
                        +--------------+  +---------+
        

Figure 20: Opus Encoder

图20:Opus编码器

For a normal encoder where both the SILK and the CELT modules are included, an optimal encoder should select which coding mode to use at run-time depending on the conditions. In the reference implementation, the frame size is selected by the application, but the other configuration parameters (number of channels, bandwidth, mode) are automatically selected (unless explicitly overridden by the application) depending on the following:

对于包含SILK和CELT模块的普通编码器,最佳编码器应根据条件选择运行时使用的编码模式。在参考实现中,帧大小由应用程序选择,但其他配置参数(通道数、带宽、模式)将根据以下情况自动选择(除非应用程序明确覆盖):

o Requested bitrate

o 请求比特率

o Input sampling rate

o 输入采样率

o Type of signal (speech vs. music)

o 信号类型(语音与音乐)

o Frame size in use

o 使用中的帧大小

The type of signal currently needs to be provided by the application (though it can be changed in real-time). An Opus encoder implementation could also do automatic detection, but since Opus is an interactive codec, such an implementation would likely have to either delay the signal (for non-interactive applications) or delay the mode switching decisions (for interactive applications).

应用程序当前需要提供信号类型(尽管可以实时更改)。Opus编码器实现也可以进行自动检测,但由于Opus是一个交互式编解码器,这样的实现可能必须延迟信号(对于非交互式应用)或延迟模式切换决策(对于交互式应用)。

When the encoder is configured for voice over IP applications, the input signal is filtered by a high-pass filter to remove the lowest part of the spectrum that contains little speech energy and may contain background noise. This is a second order Auto Regressive Moving Average (i.e., with poles and zeros) filter with a cut-off frequency around 50 Hz. In the future, a music detector may also be used to lower the cut-off frequency when the input signal is detected to be music rather than speech.

当编码器配置为IP语音应用时,输入信号由高通滤波器过滤,以去除频谱中包含少量语音能量且可能包含背景噪声的最低部分。这是一个二阶自回归移动平均(即,具有极点和零点)滤波器,截止频率约为50 Hz。将来,当检测到输入信号是音乐而不是语音时,还可以使用音乐检测器来降低截止频率。

5.1. Range Encoder
5.1. 距离编码器

The range coder acts as the bit-packer for Opus. It is used in three different ways: to encode

范围编码器充当Opus的位打包器。它有三种不同的使用方式:编码

o Entropy-coded symbols with a fixed probability model using ec_encode() (entenc.c),

o 使用ec_encode()的固定概率模型的熵编码符号(entenc.c),

o Integers from 0 to (2**M - 1) using ec_enc_uint() or ec_enc_bits() (entenc.c),

o 使用ec_enc_uint()或ec_enc_bits()(entenc.c)从0到(2**M-1)的整数,

o Integers from 0 to (ft - 1) (where ft is not a power of two) using ec_enc_uint() (entenc.c).

o 使用ec_enc_uint()(entenc.c)从0到(ft-1)(其中ft不是2的幂)的整数。

The range encoder maintains an internal state vector composed of the four-tuple (val, rng, rem, ext) representing the low end of the current range, the size of the current range, a single buffered output byte, and a count of additional carry-propagating output bytes. Both val and rng are 32-bit unsigned integer values, rem is a byte value or less than 255 or the special value -1, and ext is an unsigned integer with at least 11 bits. This state vector is initialized at the start of each frame to the value (0, 2**31, -1, 0). After encoding a sequence of symbols, the value of rng in the encoder should exactly match the value of rng in the decoder after decoding the same sequence of symbols. This is a powerful tool for detecting errors in either an encoder or decoder implementation. The value of val, on the other hand, represents different things in the encoder and decoder, and is not expected to match.

范围编码器维护由四个元组(val、rng、rem、ext)组成的内部状态向量,表示当前范围的低端、当前范围的大小、单个缓冲输出字节和额外进位传播输出字节的计数。val和rng都是32位无符号整数值,rem是字节值或小于255或特殊值-1,ext是至少有11位的无符号整数。该状态向量在每帧开始时初始化为值(0,2**31,-1,0)。编码一个符号序列后,编码器中的rng值应与解码相同符号序列后解码器中的rng值完全匹配。这是在编码器或解码器实现中检测错误的强大工具。另一方面,val的值表示编码器和解码器中的不同内容,因此不希望匹配。

The decoder has no analog for rem and ext. These are used to perform carry propagation in the renormalization loop below. Each iteration of this loop produces 9 bits of output, consisting of 8 data bits and a carry flag. The encoder cannot determine the final value of the output bytes until it propagates these carry flags. Therefore, the reference implementation buffers a single non-propagating output byte (i.e., one less than 255) in rem and keeps a count of additional

解码器没有rem和ext的模拟。它们用于在下面的重整化循环中执行进位传播。该循环的每次迭代产生9位输出,包括8个数据位和一个进位标志。在传播这些进位标志之前,编码器无法确定输出字节的最终值。因此,参考实现在rem中缓冲单个非传播输出字节(即,小于255的一个字节),并保持额外字节的计数

propagating (i.e., 255) output bytes in ext. An implementation may choose to use any mathematically equivalent scheme to perform carry propagation.

在ext中传播(即255个)输出字节。实现可以选择使用任何数学上等效的方案来执行进位传播。

5.1.1. Encoding Symbols
5.1.1. 编码符号

The main encoding function is ec_encode() (entenc.c), which encodes symbol k in the current context using the same three-tuple (fl[k], fh[k], ft) as the decoder to describe the range of the symbol (see Section 4.1).

主要的编码功能是ec_encode()(entenc.c),它使用与解码器相同的三元组(fl[k],fh[k],ft)在当前上下文中对符号k进行编码,以描述符号的范围(参见第4.1节)。

ec_encode() updates the state of the encoder as follows. If fl[k] is greater than zero, then

ec_encode()更新编码器的状态,如下所示。如果fl[k]大于零,则

                                       rng
                     val = val + rng - --- * (ft - fl)
                                       ft
        
                                       rng
                     val = val + rng - --- * (ft - fl)
                                       ft
        
                           rng
                     rng = --- * (fh - fl)
                           ft
        
                           rng
                     rng = --- * (fh - fl)
                           ft
        

Otherwise, val is unchanged and

否则,val将保持不变,并且

                                    rng
                        rng = rng - --- * (fh - fl)
                                    ft
        
                                    rng
                        rng = rng - --- * (fh - fl)
                                    ft
        

The divisions here are integer division.

这里的除法是整数除法。

5.1.1.1. Renormalization
5.1.1.1. 重整化
   After this update, the range is normalized using a procedure very
   similar to that of Section 4.1.2.1, implemented by ec_enc_normalize()
   (entenc.c).  The following process is repeated until rng > 2**23.
   First, the top 9 bits of val, (val>>23), are sent to the carry
   buffer, described in Section 5.1.1.2.  Then, the encoder sets
        
   After this update, the range is normalized using a procedure very
   similar to that of Section 4.1.2.1, implemented by ec_enc_normalize()
   (entenc.c).  The following process is repeated until rng > 2**23.
   First, the top 9 bits of val, (val>>23), are sent to the carry
   buffer, described in Section 5.1.1.2.  Then, the encoder sets
        
                        val = (val<<8) & 0x7FFFFFFF
        
                        val = (val<<8) & 0x7FFFFFFF
        
                        rng = rng<<8
        
                        rng = rng<<8
        
5.1.1.2. Carry Propagation and Output Buffering
5.1.1.2. 进位传播和输出缓冲

The function ec_enc_carry_out() (entenc.c) implements carry propagation and output buffering. It takes, as input, a 9-bit unsigned value, c, consisting of 8 data bits and an additional carry

函数ec_enc_carry_out()(entenc.c)实现进位传播和输出缓冲。它采用9位无符号值c作为输入,c由8个数据位和一个附加进位组成

   bit.  If c is equal to the value 255, then ext is simply incremented,
   and no other state updates are performed.  Otherwise, let b = (c>>8)
   be the carry bit.  Then,
        
   bit.  If c is equal to the value 255, then ext is simply incremented,
   and no other state updates are performed.  Otherwise, let b = (c>>8)
   be the carry bit.  Then,
        

o If the buffered byte rem contains a value other than -1, the encoder outputs the byte (rem + b). Otherwise, if rem is -1, no byte is output.

o 如果缓冲字节rem包含-1以外的值,编码器输出字节(rem+b)。否则,如果rem为-1,则不输出字节。

o If ext is non-zero, then the encoder outputs ext bytes -- all with a value of 0 if b is set, or 255 if b is unset -- and sets ext to 0.

o 如果ext为非零,则编码器输出ext字节(如果设置了b,则所有字节的值均为0,如果未设置b,则为255),并将ext设置为0。

o rem is set to the 8 data bits:

o rem设置为8个数据位:

rem = c & 255

雷姆=c&255

5.1.2. Alternate Encoding Methods
5.1.2. 替代编码方法

The reference implementation uses three additional encoding methods that are exactly equivalent to the above, but make assumptions and simplifications that allow for a more efficient implementation.

参考实现使用了三种与上述完全相同的额外编码方法,但进行了假设和简化,以实现更高效的实现。

5.1.2.1. ec_encode_bin()
5.1.2.1. ec_encode_bin()
   The first is ec_encode_bin() (entenc.c), defined using the parameter
   ftb instead of ft.  It is mathematically equivalent to calling
   ec_encode() with ft = (1<<ftb), but it avoids using division.
        
   The first is ec_encode_bin() (entenc.c), defined using the parameter
   ftb instead of ft.  It is mathematically equivalent to calling
   ec_encode() with ft = (1<<ftb), but it avoids using division.
        
5.1.2.2. ec_enc_bit_logp()
5.1.2.2. ec_enc_bit_logp()
   The next is ec_enc_bit_logp() (entenc.c), which encodes a single
   binary symbol.  The context is described by a single parameter, logp,
   which is the absolute value of the base-2 logarithm of the
   probability of a "1".  It is mathematically equivalent to calling
   ec_encode() with the 3-tuple (fl[k] = 0, fh[k] = (1<<logp) - 1,
   ft = (1<<logp)) if k is 0 and with (fl[k] = (1<<logp) - 1,
   fh[k] = ft = (1<<logp)) if k is 1.  The implementation requires no
   multiplications or divisions.
        
   The next is ec_enc_bit_logp() (entenc.c), which encodes a single
   binary symbol.  The context is described by a single parameter, logp,
   which is the absolute value of the base-2 logarithm of the
   probability of a "1".  It is mathematically equivalent to calling
   ec_encode() with the 3-tuple (fl[k] = 0, fh[k] = (1<<logp) - 1,
   ft = (1<<logp)) if k is 0 and with (fl[k] = (1<<logp) - 1,
   fh[k] = ft = (1<<logp)) if k is 1.  The implementation requires no
   multiplications or divisions.
        
5.1.2.3. ec_enc_icdf()
5.1.2.3. 欧洲委员会

The last is ec_enc_icdf() (entenc.c), which encodes a single binary symbol with a table-based context of up to 8 bits. This uses the same icdf table as ec_dec_icdf() from Section 4.1.3.3. The function

最后一个是ec_enc_icdf()(entenc.c),它使用最多8位的基于表格的上下文对单个二进制符号进行编码。这使用了与第4.1.3.3节ec_dec_icdf()相同的icdf表。功能

   is mathematically equivalent to calling ec_encode() with
   fl[k] = (1<<ftb) - icdf[k-1] (or 0 if k == 0), fh[k] = (1<<ftb) -
    icdf[k], and ft = (1<<ftb).  This only saves a few arithmetic
   operations over ec_encode_bin(), but it allows the encoder to use the
   same icdf tables as the decoder.
        
   is mathematically equivalent to calling ec_encode() with
   fl[k] = (1<<ftb) - icdf[k-1] (or 0 if k == 0), fh[k] = (1<<ftb) -
    icdf[k], and ft = (1<<ftb).  This only saves a few arithmetic
   operations over ec_encode_bin(), but it allows the encoder to use the
   same icdf tables as the decoder.
        
5.1.3. Encoding Raw Bits
5.1.3. 编码原始位

The raw bits used by the CELT layer are packed at the end of the buffer using ec_enc_bits() (entenc.c). Because the raw bits may continue into the last byte output by the range coder if there is room in the low-order bits, the encoder must be prepared to merge these values into a single byte. The procedure in Section 5.1.5 does this in a way that ensures both the range coded data and the raw bits can be decoded successfully.

CELT层使用的原始位使用ec_enc_bits()(entenc.c)打包在缓冲区的末尾。由于如果低阶位中有空间,原始位可能会继续进入范围编码器输出的最后一个字节,因此编码器必须准备将这些值合并为单个字节。第5.1.5节中的程序以确保范围编码数据和原始位均能成功解码的方式进行。

5.1.4. Encoding Uniformly Distributed Integers
5.1.4. 编码均匀分布整数

The function ec_enc_uint() (entenc.c) encodes one of ft equiprobable symbols in the range 0 to (ft - 1), inclusive, each with a frequency of 1, where ft may be as large as (2**32 - 1). Like the decoder (see Section 4.1.5), it splits up the value into a range coded symbol representing up to 8 of the high bits, and, if necessary, raw bits representing the remainder of the value.

函数ec_enc_uint()(entenc.c)对0到(ft-1)范围内的一个ft等概率符号进行编码,每个符号的频率为1,其中ft可能与(2**32-1)一样大。与解码器一样(参见第4.1.5节),它将值拆分为一个范围编码符号,表示多达8个高位,如有必要,将原始位表示值的剩余部分。

ec_enc_uint() takes a two-tuple (t, ft), where t is the unsigned integer to be encoded, 0 <= t < ft, and ft is not necessarily a power of two. Let ftb = ilog(ft - 1), i.e., the number of bits required to store (ft - 1) in two's complement notation. If ftb is 8 or less, then t is encoded directly using ec_encode() with the three-tuple (t, t + 1, ft).

ec_enc_uint()接受两个元组(t,ft),其中t是要编码的无符号整数,0<=t<ft,ft不一定是2的幂。设ftb=ilog(ft-1),即以2的补码表示法存储(ft-1)所需的位数。若ftb小于等于8,则直接使用带有三个元组(t,t+1,ft)的ec_encode()对t进行编码。

If ftb is greater than 8, then the top 8 bits of t are encoded using the three-tuple (t>>(ftb - 8), (t>>(ftb - 8)) + 1, ((ft - 1)>>(ftb - 8)) + 1), and the remaining bits, (t & ((1<<(ftb - 8)) - 1), are encoded as raw bits with ec_enc_bits().

如果ftb大于8,则使用三元组(t>>(ftb-8),(t>>(ftb-8))+1,((ft-1)>>(ftb-8))+1对t的前8位进行编码,其余位(t&((1<<(ftb-8))-1)用ec_enc bits()作为原始位进行编码。

5.1.5. Finalizing the Stream
5.1.5. 结束流

After all symbols are encoded, the stream must be finalized by outputting a value inside the current range. Let end be the unsigned integer in the interval [val, val + rng) with the largest number of trailing zero bits, b, such that (end + (1<<b) - 1) is also in the interval [val, val + rng). This choice of end allows the maximum number of trailing bits to be set to arbitrary values while still ensuring the range coded part of the buffer can be decoded correctly.

对所有符号进行编码后,必须通过输出当前范围内的值来最终确定流。设end为区间[val,val+rng]中的无符号整数,其尾随零位的数量最大,b,因此(end+(1<<b)-1)也在区间中[val,val+rng]。此结束选择允许将最大尾随位数设置为任意值,同时仍确保缓冲器的范围编码部分可以正确解码。

Then, while end is not zero, the top 9 bits of end, i.e., (end>>23), are passed to the carry buffer in accordance with the procedure in Section 5.1.1.2, and end is updated via

然后,当end不为零时,根据第5.1.1.2节中的程序,end的前9位,即(end>>23)被传递到进位缓冲器,并且end通过

                        end = (end<<8) & 0x7FFFFFFF
        
                        end = (end<<8) & 0x7FFFFFFF
        

Finally, if the buffered output byte, rem, is neither zero nor the special value -1, or the carry count, ext, is greater than zero, then 9 zero bits are sent to the carry buffer to flush it to the output buffer. When outputting the final byte from the range coder, if it would overlap any raw bits already packed into the end of the output buffer, they should be ORed into the same byte. The bit allocation routines in the CELT layer should ensure that this can be done without corrupting the range coder data so long as end is chosen as described above. If there is any space between the end of the range coder data and the end of the raw bits, it is padded with zero bits. This entire process is implemented by ec_enc_done() (entenc.c).

最后,如果缓冲输出字节rem既不是零,也不是特殊值-1,或者进位计数ext大于零,则将9个零位发送到进位缓冲区以将其刷新到输出缓冲区。当从范围编码器输出最后一个字节时,如果它将与已打包到输出缓冲区末尾的任何原始位重叠,则应将它们或入同一字节。CELT层中的位分配例程应确保,只要如上所述选择end,就可以在不损坏范围编码器数据的情况下完成此操作。如果范围编码器数据的结尾和原始位的结尾之间有任何空格,则用零位填充。整个过程由ec_enc_done()实现(entenc.c)。

5.1.6. Current Bit Usage
5.1.6. 当前位使用情况

The bit allocation routines in Opus need to be able to determine a conservative upper bound on the number of bits that have been used to encode the current frame thus far. This drives allocation decisions and ensures that the range coder and raw bits will not overflow the output buffer. This is computed in the reference implementation to whole-bit precision by the function ec_tell() (entcode.h) and to fractional 1/8th bit precision by the function ec_tell_frac() (entcode.c). Like all operations in the range coder, it must be implemented in a bit-exact manner, and it must produce exactly the same value returned by the same functions in the decoder after decoding the same symbols.

Opus中的比特分配例程需要能够确定迄今为止用于编码当前帧的比特数的保守上限。这将驱动分配决策,并确保范围编码器和原始位不会溢出输出缓冲区。这在参考实现中由函数ec_tell()(entcode.h)计算为整位精度,由函数ec_tell_frac()(entcode.c)计算为分数1/8位精度。与范围编码器中的所有操作一样,它必须以位精确的方式实现,并且在解码相同符号后,它必须在解码器中产生由相同函数返回的完全相同的值。

5.2. SILK Encoder
5.2. 丝编码器

In many respects, the SILK encoder mirrors the SILK decoder described in Section 4.2. Details such as the quantization and range coder tables can be found there, while this section describes the high-level design choices that were made. The diagram below shows the basic modules of the SILK encoder.

在许多方面,丝绸编码器与第4.2节中描述的丝绸解码器相一致。量化和范围编码器表等详细信息可在此处找到,而本节描述了所做的高级设计选择。下图显示了丝绸编码器的基本模块。

               +----------+    +--------+    +---------+
               |  Sample  |    | Stereo |    |  SILK   |
        ------>|   Rate   |--->| Mixing |--->|  Core   |---------->
        Input  |Conversion|    |        |    | Encoder |  Bitstream
               +----------+    +--------+    +---------+
        
               +----------+    +--------+    +---------+
               |  Sample  |    | Stereo |    |  SILK   |
        ------>|   Rate   |--->| Mixing |--->|  Core   |---------->
        Input  |Conversion|    |        |    | Encoder |  Bitstream
               +----------+    +--------+    +---------+
        

Figure 21: SILK Encoder

图21:丝绸编码器

5.2.1. Sample Rate Conversion
5.2.1. 采样率转换

The input signal's sampling rate is adjusted by a sample rate conversion module so that it matches the SILK internal sampling rate. The input to the sample rate converter is delayed by a number of samples depending on the sample rate ratio, such that the overall delay is constant for all input and output sample rates.

输入信号的采样率由采样率转换模块调整,以便与内部采样率匹配。根据采样率比率,采样率转换器的输入延迟了大量采样,因此所有输入和输出采样率的总延迟都是恒定的。

5.2.2. Stereo Mixing
5.2.2. 立体声混音

The stereo mixer is only used for stereo input signals. It converts a stereo left-right signal into an adaptive mid-side representation. The first step is to compute non-adaptive mid-side signals as half the sum and difference between left and right signals. The side signal is then minimized in energy by subtracting a prediction of it based on the mid signal. This prediction works well when the left and right signals exhibit linear dependency, for instance, for an amplitude-panned input signal. Like in the decoder, the prediction coefficients are linearly interpolated during the first 8 ms of the frame. The mid signal is always encoded, whereas the residual side signal is only encoded if it has sufficient energy compared to the mid signal's energy. If it has not, the "mid_only_flag" is set without encoding the side signal.

立体声混音器仅用于立体声输入信号。它将立体声左右信号转换为自适应中间表示。第一步是将非自适应中间信号计算为左右信号之和和和差的一半。然后,通过减去基于中间信号的侧信号预测,使侧信号的能量最小化。例如,对于振幅平移输入信号,当左、右信号表现出线性相关性时,该预测效果良好。与解码器中一样,预测系数在帧的前8 ms期间线性插值。mid信号始终被编码,而剩余侧信号仅在其能量与mid信号能量相比足够时才被编码。如果没有,则设置“仅mid__标志”,而不编码侧信号。

The predictor coefficients are coded regardless of whether the side signal is encoded. For each frame, two predictor coefficients are computed, one that predicts between low-passed mid and side channels, and one that predicts between high-passed mid and side channels. The low-pass filter is a simple three-tap filter and creates a delay of one sample. The high-pass filtered signal is the difference between the mid signal delayed by one sample and the low-passed signal. Instead of explicitly computing the high-passed signal, it is computationally more efficient to transform the prediction coefficients before applying them to the filtered mid signal, as follows:

不管侧信号是否被编码,预测器系数被编码。对于每个帧,计算两个预测器系数,一个预测低通中间信道和侧信道之间的关系,另一个预测高通中间信道和侧信道之间的关系。低通滤波器是一个简单的三抽头滤波器,产生一个采样的延迟。高通滤波信号是延迟一个采样的中间信号与低通信号之间的差值。代替显式计算高通信号,在将预测系数应用于滤波的中间信号之前对其进行变换在计算上更有效,如下所示:

               pred(n) = LP(n) * w0 + HP(n) * w1
                       = LP(n) * w0 + (mid(n-1) - LP(n)) * w1
                       = LP(n) * (w0 - w1) + mid(n-1) * w1
        
               pred(n) = LP(n) * w0 + HP(n) * w1
                       = LP(n) * w0 + (mid(n-1) - LP(n)) * w1
                       = LP(n) * (w0 - w1) + mid(n-1) * w1
        

where w0 and w1 are the low-pass and high-pass prediction coefficients, mid(n-1) is the mid signal delayed by one sample, LP(n) and HP(n) are the low-passed and high-passed signals and pred(n) is the prediction signal that is subtracted from the side signal.

其中w0和w1是低通和高通预测系数,mid(n-1)是延迟一个样本的mid信号,LP(n)和HP(n)是低通和高通信号,pred(n)是从侧信号中减去的预测信号。

5.2.3. SILK Core Encoder
5.2.3. 丝芯编码器

What follows is a description of the core encoder and its components. For simplicity, the core encoder is referred to simply as the encoder in the remainder of this section. An overview of the encoder is given in Figure 22.

以下是核心编码器及其组件的说明。为简单起见,核心编码器在本节剩余部分中简称为编码器。编码器的概述如图22所示。

                                                                +---+
                             +--------------------------------->|   |
        +---------+          |      +---------+                 |   |
        |Voice    |          |      |LTP      |12               |   |
    +-->|Activity |--+       +----->|Scaling  |-----------+---->|   |
    |   |Detection|3 |       |      |Control  |<--+       |     |   |
    |   +---------+  |       |      +---------+   |       |     |   |
    |                |       |      +---------+   |       |     |   |
    |                |       |      |Gains    |   |       |     |   |
    |                |       |  +-->|Processor|---|---+---|---->| R |
    |                |       |  |   |         |11 |   |   |     | a |
    |               \/       |  |   +---------+   |   |   |     | n |
    |          +---------+   |  |   +---------+   |   |   |     | g |
    |          |Pitch    |   |  |   |LSF      |   |   |   |     | e |
    |       +->|Analysis |---+  |   |Quantizer|---|---|---|---->|   |
    |       |  |         |4  |  |   |         |8  |   |   |     | E |-->
    |       |  +---------+   |  |   +---------+   |   |   |     | n | 2
    |       |                |  |    9/\  10|     |   |   |     | c |
    |       |                |  |     |    \/     |   |   |     | o |
    |       |  +---------+   |  |   +----------+  |   |   |     | d |
    |       |  |Noise    |   +--|-->|Prediction|--+---|---|---->| e |
    |       +->|Shaping  |---|--+   |Analysis  |7 |   |   |     | r |
    |       |  |Analysis |5  |  |   |          |  |   |   |     |   |
    |       |  +---------+   |  |   +----------+  |   |   |     |   |
    |       |                |  |        /\       |   |   |     |   |
    |       |     +----------|--|--------+        |   |   |     |   |
    |       |     |         \/  \/               \/  \/  \/     |   |
    |       |     |      +----------+          +------------+   |   |
    |       |     |      |          |          |Noise       |   |   |
   -+-------+-----+----->|Pre-filter|--------->|Shaping     |-->|   |
   1                     |          | 6        |Quantization|13 |   |
                         +----------+          +------------+   +---+
        
                                                                +---+
                             +--------------------------------->|   |
        +---------+          |      +---------+                 |   |
        |Voice    |          |      |LTP      |12               |   |
    +-->|Activity |--+       +----->|Scaling  |-----------+---->|   |
    |   |Detection|3 |       |      |Control  |<--+       |     |   |
    |   +---------+  |       |      +---------+   |       |     |   |
    |                |       |      +---------+   |       |     |   |
    |                |       |      |Gains    |   |       |     |   |
    |                |       |  +-->|Processor|---|---+---|---->| R |
    |                |       |  |   |         |11 |   |   |     | a |
    |               \/       |  |   +---------+   |   |   |     | n |
    |          +---------+   |  |   +---------+   |   |   |     | g |
    |          |Pitch    |   |  |   |LSF      |   |   |   |     | e |
    |       +->|Analysis |---+  |   |Quantizer|---|---|---|---->|   |
    |       |  |         |4  |  |   |         |8  |   |   |     | E |-->
    |       |  +---------+   |  |   +---------+   |   |   |     | n | 2
    |       |                |  |    9/\  10|     |   |   |     | c |
    |       |                |  |     |    \/     |   |   |     | o |
    |       |  +---------+   |  |   +----------+  |   |   |     | d |
    |       |  |Noise    |   +--|-->|Prediction|--+---|---|---->| e |
    |       +->|Shaping  |---|--+   |Analysis  |7 |   |   |     | r |
    |       |  |Analysis |5  |  |   |          |  |   |   |     |   |
    |       |  +---------+   |  |   +----------+  |   |   |     |   |
    |       |                |  |        /\       |   |   |     |   |
    |       |     +----------|--|--------+        |   |   |     |   |
    |       |     |         \/  \/               \/  \/  \/     |   |
    |       |     |      +----------+          +------------+   |   |
    |       |     |      |          |          |Noise       |   |   |
   -+-------+-----+----->|Pre-filter|--------->|Shaping     |-->|   |
   1                     |          | 6        |Quantization|13 |   |
                         +----------+          +------------+   +---+
        

1: Input speech signal 2: Range encoded bitstream 3: Voice activity estimate 4: Pitch lags (per 5 ms) and voicing decision (per 20 ms) 5: Noise shaping quantization coefficients - Short-term synthesis and analysis noise shaping coefficients (per 5 ms)

1:输入语音信号2:范围编码比特流3:语音活动估计4:基音滞后(每5ms)和发声决策(每20ms)5:噪声整形量化系数-短期合成和分析噪声整形系数(每5ms)

- Long-term synthesis and analysis noise shaping coefficients (per 5 ms and for voiced speech only) - Noise shaping tilt (per 5 ms) - Quantizer gain/step size (per 5 ms) 6: Input signal filtered with analysis noise shaping filters 7: Short- and Long-Term Prediction coefficients LTP (per 5 ms) and LPC (per 20 ms) 8: LSF quantization indices 9: LSF coefficients 10: Quantized LSF coefficients 11: Processed gains, and synthesis noise shape coefficients 12: LTP state scaling coefficient. Controlling error propagation / prediction gain trade-off 13: Quantized signal

-长期合成和分析噪声整形系数(每5ms和仅用于浊音语音)-噪声整形倾斜(每5ms)-量化器增益/步长(每5ms)6:使用分析噪声整形滤波器滤波的输入信号7:短期和长期预测系数LTP(每5ms)和LPC(每20ms)8:LSF量化指数9:LSF系数10:量化LSF系数11:处理增益,合成噪声形状系数12:LTP状态缩放系数。控制误差传播/预测增益权衡13:量化信号

Figure 22: SILK Core Encoder

图22:丝芯编码器

5.2.3.1. Voice Activity Detection
5.2.3.1. 语音活动检测

The input signal is processed by a Voice Activity Detection (VAD) algorithm to produce a measure of voice activity, spectral tilt, and signal-to-noise estimates for each frame. The VAD uses a sequence of half-band filterbanks to split the signal into four subbands: 0...Fs/16, Fs/16...Fs/8, Fs/8...Fs/4, and Fs/4...Fs/2, where Fs is the sampling frequency (8, 12, 16, or 24 kHz). The lowest subband, from 0 - Fs/16, is high-pass filtered with a first-order moving average (MA) filter (with transfer function H(z) = 1-z**(-1)) to reduce the energy at the lowest frequencies. For each frame, the signal energy per subband is computed. In each subband, a noise level estimator tracks the background noise level and a Signal-to-Noise Ratio (SNR) value is computed as the logarithm of the ratio of energy-to-noise level. Using these intermediate variables, the following parameters are calculated for use in other SILK modules:

输入信号由语音活动检测(VAD)算法处理,以产生每个帧的语音活动度量、频谱倾斜和信噪比估计。VAD使用一系列半带滤波器组将信号分成四个子带:0…Fs/16、Fs/16…Fs/8、Fs/8…Fs/4和Fs/4…Fs/2,其中Fs是采样频率(8、12、16或24 kHz)。使用一阶移动平均(MA)滤波器(传递函数H(z)=1-z**(-1))对0-Fs/16的最低子带进行高通滤波,以降低最低频率处的能量。对于每个帧,计算每个子带的信号能量。在每个子带中,噪声级估计器跟踪背景噪声级,并将信噪比(SNR)值计算为能量与噪声级之比的对数。使用这些中间变量,计算以下参数,以便在其他丝绸模块中使用:

o Average SNR. The average of the subband SNR values.

o 平均信噪比。子带SNR值的平均值。

o Smoothed subband SNRs. Temporally smoothed subband SNR values.

o 平滑子带SNR。时间平滑子带SNR值。

o Speech activity level. Based on the average SNR and a weighted average of the subband energies.

o 言语活动水平。基于平均信噪比和子带能量的加权平均值。

o Spectral tilt. A weighted average of the subband SNRs, with positive weights for the low subbands and negative weights for the high subbands.

o 光谱倾斜。子带SNR的加权平均值,低子带的权重为正,高子带的权重为负。

5.2.3.2. Pitch Analysis
5.2.3.2. 音高分析

The input signal is processed by the open loop pitch estimator shown in Figure 23.

输入信号由图23所示的开环基音估计器处理。

                                    +--------+  +----------+
                                    |2 x Down|  |Time-     |
                                 +->|sampling|->|Correlator|     |
                                 |  |        |  |          |     |4
                                 |  +--------+  +----------+    \/
                                 |                    | 2    +-------+
                                 |                    |  +-->|Speech |5
       +---------+    +--------+ |                   \/  |   |Type   |->
       |LPC      |    |Down    | |              +----------+ |       |
    +->|Analysis | +->|sample  |-+------------->|Time-     | +-------+
    |  |         | |  |to 8 kHz|                |Correlator|----------->
    |  +---------+ |  +--------+                |__________|          6
    |       |      |                                  |3
    |      \/      |                                 \/
    |  +---------+ |                            +----------+
    |  |Whitening| |                            |Time-     |
   -+->|Filter   |-+--------------------------->|Correlator|----------->
   1   |         |                              |          |          7
       +---------+                              +----------+
        
                                    +--------+  +----------+
                                    |2 x Down|  |Time-     |
                                 +->|sampling|->|Correlator|     |
                                 |  |        |  |          |     |4
                                 |  +--------+  +----------+    \/
                                 |                    | 2    +-------+
                                 |                    |  +-->|Speech |5
       +---------+    +--------+ |                   \/  |   |Type   |->
       |LPC      |    |Down    | |              +----------+ |       |
    +->|Analysis | +->|sample  |-+------------->|Time-     | +-------+
    |  |         | |  |to 8 kHz|                |Correlator|----------->
    |  +---------+ |  +--------+                |__________|          6
    |       |      |                                  |3
    |      \/      |                                 \/
    |  +---------+ |                            +----------+
    |  |Whitening| |                            |Time-     |
   -+->|Filter   |-+--------------------------->|Correlator|----------->
   1   |         |                              |          |          7
       +---------+                              +----------+
        

1: Input signal 2: Lag candidates from stage 1 3: Lag candidates from stage 2 4: Correlation threshold 5: Voiced/unvoiced flag 6: Pitch correlation 7: Pitch lags

1:输入信号2:来自第1阶段的滞后候选3:来自第2阶段的滞后候选4:相关阈值5:浊音/清音标志6:基音相关7:基音滞后

Figure 23: Block Diagram of the Pitch Estimator

图23:螺距估计器的方框图

The pitch analysis finds a binary voiced/unvoiced classification, and, for frames classified as voiced, four pitch lags per frame -- one for each 5 ms subframe -- and a pitch correlation indicating the periodicity of the signal. The input is first whitened using a Linear Prediction (LP) whitening filter, where the coefficients are computed through standard Linear Predictive Coding (LPC) analysis. The order of the whitening filter is 16 for best results, but is reduced to 12 for medium complexity and 8 for low complexity modes. The whitened signal is analyzed to find pitch lags for which the time correlation is high. The analysis consists of three stages for reducing the complexity:

基音分析发现二元浊音/清音分类,对于分类为浊音的帧,每帧有四个基音滞后(每5毫秒子帧一个基音滞后)以及指示信号周期性的基音相关。首先使用线性预测(LP)白化滤波器对输入进行白化,其中通过标准线性预测编码(LPC)分析计算系数。对于最佳结果,白化滤波器的阶数为16,但对于中等复杂度模式,其阶数减少到12,对于低复杂度模式,其阶数减少到8。对白化后的信号进行分析,找出时间相关性高的基音滞后。分析分为三个阶段来降低复杂性:

o In the first stage, the whitened signal is downsampled to 4 kHz (from 8 kHz), and the current frame is correlated to a signal delayed by a range of lags, starting from a shortest lag corresponding to 500 Hz, to a longest lag corresponding to 56 Hz.

o 在第一阶段中,将白化信号下采样到4khz(从8khz),并且当前帧与延迟一系列延迟的信号相关,从对应于500hz的最短延迟开始,到对应于56hz的最长延迟。

o The second stage operates on an 8 kHz signal (downsampled from 12, 16, or 24 kHz) and measures time correlations only near the lags corresponding to those that had sufficiently high correlations in the first stage. The resulting correlations are adjusted for a small bias towards short lags to avoid ending up with a multiple of the true pitch lag. The highest adjusted correlation is compared to a threshold depending on:

o 第二级以8 kHz信号(从12、16或24 kHz降采样)运行,并仅在与第一级中具有足够高相关性的滞后相对应的滞后附近测量时间相关性。将所得相关性调整为短滞后的小偏差,以避免以真实音高滞后的倍数结束。将最高调整相关性与阈值进行比较,具体取决于:

* Whether the previous frame was classified as voiced.

* 前一帧是否分类为浊音。

* The speech activity level.

* 言语活动水平。

* The spectral tilt.

* 光谱倾斜。

If the threshold is exceeded, the current frame is classified as voiced and the lag with the highest adjusted correlation is stored for a final pitch analysis of the highest precision in the third stage.

如果超过阈值,则当前帧被分类为浊音,并且具有最高调整相关性的延迟被存储,以便在第三阶段进行最高精度的最终基音分析。

o The last stage operates directly on the whitened input signal to compute time correlations for each of the four subframes independently in a narrow range around the lag with highest correlation from the second stage.

o 最后一级直接对白化输入信号进行操作,以在第二级具有最高相关性的滞后周围的狭窄范围内独立地计算四个子帧中的每一个子帧的时间相关性。

5.2.3.3. Noise Shaping Analysis
5.2.3.3. 噪声整形分析

The noise shaping analysis finds gains and filter coefficients used in the pre-filter and noise shaping quantizer. These parameters are chosen such that they will fulfill several requirements:

噪声整形分析发现在预滤波器和噪声整形量化器中使用的增益和滤波器系数。这些参数的选择应确保其满足以下几个要求:

o Balancing quantization noise and bitrate. The quantization gains determine the step size between reconstruction levels of the excitation signal. Therefore, increasing the quantization gain amplifies quantization noise, but also reduces the bitrate by lowering the entropy of the quantization indices.

o 平衡量化噪声和比特率。量化增益确定激励信号的重构电平之间的步长。因此,增加量化增益放大量化噪声,但也通过降低量化指数的熵来降低比特率。

o Spectral shaping of the quantization noise; the noise shaping quantizer is capable of reducing quantization noise in some parts of the spectrum at the cost of increased noise in other parts without substantially changing the bitrate. By shaping the noise such that it follows the signal spectrum, it becomes less audible. In practice, best results are obtained by making the shape of the noise spectrum slightly flatter than the signal spectrum.

o 量化噪声的频谱整形;噪声整形量化器能够在不实质性改变比特率的情况下,以其他部分中增加的噪声为代价来降低频谱的某些部分中的量化噪声。通过对噪声进行整形,使其跟随信号频谱,从而降低了可听性。在实践中,通过使噪声频谱的形状比信号频谱稍微平坦来获得最佳结果。

o De-emphasizing spectral valleys; by using different coefficients in the analysis and synthesis part of the pre-filter and noise shaping quantizer, the levels of the spectral valleys can be decreased relative to the levels of the spectral peaks such as speech formants and harmonics. This reduces the entropy of the signal, which is the difference between the coded signal and the quantization noise, thus lowering the bitrate.

o 去强调光谱谷;通过在预滤波器和噪声成形量化器的分析和合成部分使用不同的系数,可以相对于语音共振峰和谐波等频谱峰值的水平降低频谱谷的水平。这降低了信号的熵,即编码信号和量化噪声之间的差,从而降低了比特率。

o Matching the levels of the decoded speech formants to the levels of the original speech formants; an adjustment gain and a first order tilt coefficient are computed to compensate for the effect of the noise shaping quantization on the level and spectral tilt.

o 将解码语音共振峰的水平与原始语音共振峰的水平相匹配;计算调整增益和一阶倾斜系数,以补偿噪声整形量化对电平和光谱倾斜的影响。

                 / \   ___
                  |   // \\
                  |  //   \\     ____
                  |_//     \\___//  \\         ____
                  | /  ___  \   /    \\       //  \\
                P |/  /   \  \_/      \\_____//    \\
                o |  /     \     ____  \     /      \\
                w | /       \___/    \  \___/  ____  \\___ 1
                e |/                  \       /    \  \
                r |                    \_____/      \  \__ 2
                  |                                  \
                  |                                   \___ 3
                  |
                  +---------------------------------------->
                                   Frequency
        
                 / \   ___
                  |   // \\
                  |  //   \\     ____
                  |_//     \\___//  \\         ____
                  | /  ___  \   /    \\       //  \\
                P |/  /   \  \_/      \\_____//    \\
                o |  /     \     ____  \     /      \\
                w | /       \___/    \  \___/  ____  \\___ 1
                e |/                  \       /    \  \
                r |                    \_____/      \  \__ 2
                  |                                  \
                  |                                   \___ 3
                  |
                  +---------------------------------------->
                                   Frequency
        

1: Input signal spectrum 2: De-emphasized and level matched spectrum 3: Quantization noise spectrum

1:输入信号频谱2:去加重和电平匹配频谱3:量化噪声频谱

Figure 24: Noise Shaping and Spectral De-emphasis Illustration

图24:噪声整形和频谱去加重说明

Figure 24 shows an example of an input signal spectrum (1). After de-emphasis and level matching, the spectrum has deeper valleys (2). The quantization noise spectrum (3) more or less follows the input signal spectrum, while having slightly less pronounced peaks. The entropy, which provides a lower bound on the bitrate for encoding the excitation signal, is proportional to the area between the de-emphasized spectrum (2) and the quantization noise spectrum (3). Without de-emphasis, the entropy is proportional to the area between input spectrum (1) and quantization noise (3) -- clearly higher.

图24显示了输入信号频谱的示例(1)。在去强调和电平匹配之后,频谱有更深的谷(2)。量化噪声频谱(3)或多或少跟随输入信号频谱,同时具有稍微不太明显的峰值。熵为编码激励信号提供比特率的下限,它与去强调频谱(2)和量化噪声频谱(3)之间的面积成正比。在不去强调的情况下,熵与输入频谱(1)和量化噪声(3)之间的面积成正比——显然更高。

The transformation from input signal to de-emphasized signal can be described as a filtering operation with a filter

从输入信号到去强调信号的转换可以描述为带滤波器的滤波操作

                                             -1    Wana(z)
                  H(z) = G * ( 1 - c_tilt * z  ) * -------
                                                   Wsyn(z)
        
                                             -1    Wana(z)
                  H(z) = G * ( 1 - c_tilt * z  ) * -------
                                                   Wsyn(z)
        

having an adjustment gain G, a first order tilt adjustment filter with tilt coefficient c_tilt, and where

具有调整增益G,具有倾斜系数c_tilt的一阶倾斜调整滤波器,其中

                       16                           d
                       __            -k        -L  __            -k
        Wana(z) = (1 - \ a_ana(k) * z  )*(1 - z  * \ b_ana(k) * z  )
                       /_                          /_
                       k=1                         k=-d
        
                       16                           d
                       __            -k        -L  __            -k
        Wana(z) = (1 - \ a_ana(k) * z  )*(1 - z  * \ b_ana(k) * z  )
                       /_                          /_
                       k=1                         k=-d
        

is the analysis part of the de-emphasis filter, consisting of the short-term shaping filter with coefficients a_ana(k) and the long-term shaping filter with coefficients b_ana(k) and pitch lag L. The parameter d determines the number of long-term shaping filter taps.

是去加重滤波器的分析部分,由系数为a_ana(k)的短期成形滤波器和系数为b_ana(k)和基音滞后L的长期成形滤波器组成。参数d确定长期成形滤波器抽头的数量。

Similarly, but without the tilt adjustment, the synthesis part can be written as

类似地,但是没有倾斜调整,合成部分可以写为

                       16                           d
                       __            -k        -L  __            -k
        Wsyn(z) = (1 - \ a_syn(k) * z  )*(1 - z  * \ b_syn(k) * z  )
                       /_                          /_
                       k=1                         k=-d
        
                       16                           d
                       __            -k        -L  __            -k
        Wsyn(z) = (1 - \ a_syn(k) * z  )*(1 - z  * \ b_syn(k) * z  )
                       /_                          /_
                       k=1                         k=-d
        

All noise shaping parameters are computed and applied per subframe of 5 ms. First, an LPC analysis is performed on a windowed signal block of 15 ms. The signal block has a look-ahead of 5 ms relative to the current subframe, and the window is an asymmetric sine window. The LPC analysis is done with the autocorrelation method, with an order of between 8, in lowest-complexity mode, and 16, for best quality.

每个5ms的子帧计算并应用所有噪声成形参数。首先,对15ms的加窗信号块执行LPC分析。信号块相对于当前子帧具有5ms的前瞻性,且该窗口为非对称正弦窗口。LPC分析采用自相关方法进行,在最低复杂度模式下为8,在最佳质量模式下为16。

Optionally, the LPC analysis and noise shaping filters are warped by replacing the delay elements by first-order allpass filters. This increases the frequency resolution at low frequencies and reduces it at high ones, which better matches the human auditory system and improves quality. The warped analysis and filtering comes at a cost in complexity and is therefore only done in higher complexity modes.

可选地,通过用一阶全通滤波器替换延迟元件来扭曲LPC分析和噪声整形滤波器。这增加了低频时的频率分辨率,降低了高频时的频率分辨率,从而更好地匹配人类听觉系统并提高了质量。扭曲分析和过滤是以复杂度为代价的,因此只能在更高复杂度的模式下进行。

The quantization gain is found by taking the square root of the residual energy from the LPC analysis and multiplying it by a value inversely proportional to the coding quality control parameter and the pitch correlation.

量化增益是通过从LPC分析中获取剩余能量的平方根并将其乘以与编码质量控制参数和基音周期相关性成反比的值来获得的。

Next, the two sets of short-term noise shaping coefficients a_ana(k) and a_syn(k) are obtained by applying different amounts of bandwidth expansion to the coefficients found in the LPC analysis. This bandwidth expansion moves the roots of the LPC polynomial towards the origin, using the formulas

接下来,通过对LPC分析中发现的系数应用不同的带宽扩展量来获得两组短期噪声成形系数a_ana(k)和a_syn(k)。这种带宽扩展使用公式将LPC多项式的根移向原点

                                              k
                         a_ana(k) = a(k)*g_ana   and
        
                                              k
                         a_ana(k) = a(k)*g_ana   and
        
                                              k
                         a_syn(k) = a(k)*g_syn
        
                                              k
                         a_syn(k) = a(k)*g_syn
        

where a(k) is the k'th LPC coefficient, and the bandwidth expansion factors g_ana and g_syn are calculated as

其中a(k)是第k个LPC系数,带宽扩展因子g_ana和g_syn计算如下:

                         g_ana = 0.95 - 0.01*C  and
        
                         g_ana = 0.95 - 0.01*C  and
        
                         g_syn = 0.95 + 0.01*C
        
                         g_syn = 0.95 + 0.01*C
        

where C is the coding quality control parameter between 0 and 1. Applying more bandwidth expansion to the analysis part than to the synthesis part gives the desired de-emphasis of spectral valleys in between formants.

其中C是0和1之间的编码质量控制参数。将更多的带宽扩展应用于分析部分而不是合成部分,可以消除共振峰之间的谱谷。

The long-term shaping is applied only during voiced frames. It uses a three-tap filter, described by

长期整形仅适用于浊音帧。它使用三抽头滤波器,如下所述:

b_ana = F_ana * [0.25, 0.5, 0.25] and

b_ana=F_ana*[0.25,0.5,0.25]和

b_syn = F_syn * [0.25, 0.5, 0.25].

b_syn=F_syn*[0.25,0.5,0.25]。

For unvoiced frames, these coefficients are set to 0. The multiplication factors F_ana and F_syn are chosen between 0 and 1, depending on the coding quality control parameter, as well as the calculated pitch correlation and smoothed subband SNR of the lowest subband. By having F_ana less than F_syn, the pitch harmonics are emphasized relative to the valleys in between the harmonics.

对于清音帧,这些系数设置为0。乘法因子F_ana和F_syn在0和1之间选择,这取决于编码质量控制参数以及计算的基音相关和最低子带的平滑子带SNR。通过使F_ana小于F_syn,基音谐波相对于谐波之间的波谷被强调。

The tilt coefficient c_tilt is for unvoiced frames chosen as

倾斜系数c_tilt适用于选择为

c_tilt = 0.25

c_倾斜=0.25

and as

作为

                         c_tilt = 0.25 + 0.2625 * V
        
                         c_tilt = 0.25 + 0.2625 * V
        

for voiced frames, where V is the voice activity level between 0 and 1.

对于语音帧,其中V是介于0和1之间的语音活动级别。

The adjustment gain G serves to correct any level mismatch between the original and decoded signals that might arise from the noise shaping and de-emphasis. This gain is computed as the ratio of the prediction gain of the short-term analysis and synthesis filter coefficients. The prediction gain of an LPC synthesis filter is the square root of the output energy when the filter is excited by a unit-energy impulse on the input. An efficient way to compute the prediction gain is by first computing the reflection coefficients from the LPC coefficients through the step-down algorithm, and extracting the prediction gain from the reflection coefficients as

调整增益G用于校正可能由噪声整形和去加重引起的原始信号和解码信号之间的任何电平失配。该增益被计算为短期分析和合成滤波器系数的预测增益的比率。LPC合成滤波器的预测增益是当滤波器被输入上的单位能量脉冲激励时输出能量的平方根。计算预测增益的有效方法是首先通过降压算法从LPC系数计算反射系数,然后从反射系数中提取预测增益,如下所示:

                                    K
                                   ___          2  -0.5
                      predGain = ( | | 1 - (r_k)  )
                                   k=1
        
                                    K
                                   ___          2  -0.5
                      predGain = ( | | 1 - (r_k)  )
                                   k=1
        

where r_k is the k'th reflection coefficient.

其中r_k是第k个反射系数。

Initial values for the quantization gains are computed as the square root of the residual energy of the LPC analysis, adjusted by the coding quality control parameter. These quantization gains are later adjusted based on the results of the prediction analysis.

量化增益的初始值被计算为LPC分析的剩余能量的平方根,由编码质量控制参数调整。这些量化增益随后根据预测分析的结果进行调整。

5.2.3.4. Prediction Analysis
5.2.3.4. 预测分析

The prediction analysis is performed in one of two ways depending on how the pitch estimator classified the frame. The processing for voiced and unvoiced speech is described in Section 5.2.3.4.1 and Section 5.2.3.4.2, respectively. Inputs to this function include the pre-whitened signal from the pitch estimator (see Section 5.2.3.2).

根据基音估计器如何对帧进行分类,以两种方式之一执行预测分析。第5.2.3.4.1节和第5.2.3.4.2节分别描述了语音和清音语音的处理。该功能的输入包括来自基音估计器的预白化信号(见第5.2.3.2节)。

5.2.3.4.1. Voiced Speech
5.2.3.4.1. 有声语音

For a frame of voiced speech, the pitch pulses will remain dominant in the pre-whitened input signal. Further whitening is desirable as it leads to higher quality at the same available bitrate. To achieve this, a Long-Term Prediction (LTP) analysis is carried out to estimate the coefficients of a fifth-order LTP filter for each of four subframes. The LTP coefficients are quantized using the method described in Section 5.2.3.6, and the quantized LTP coefficients are used to compute the LTP residual signal. This LTP residual signal is the input to an LPC analysis where the LPC coefficients are estimated using Burg's method [BURG], such that the residual energy is minimized. The estimated LPC coefficients are converted to a Line Spectral Frequency (LSF) vector and quantized as described in Section 5.2.3.5. After quantization, the quantized LSF vector is converted back to LPC coefficients using the full procedure in Section 4.2.7.5. By using quantized LTP coefficients and LPC

对于浊音语音帧,基音脉冲将在预白化输入信号中保持主导地位。进一步的白化是可取的,因为它在相同的可用比特率下导致更高的质量。为此,执行长期预测(LTP)分析以估计四个子帧中的每一个子帧的五阶LTP滤波器的系数。使用第5.2.3.6节中描述的方法对LTP系数进行量化,并使用量化的LTP系数计算LTP剩余信号。该LTP残余信号是LPC分析的输入,其中使用Burg方法[Burg]估计LPC系数,使得残余能量最小化。将估计的LPC系数转换为线谱频率(LSF)矢量,并按照第5.2.3.5节所述进行量化。量化后,使用第4.2.7.5节中的完整程序将量化LSF矢量转换回LPC系数。通过使用量化的LTP系数和LPC

coefficients derived from the quantized LSF coefficients, the encoder remains fully synchronized with the decoder. The quantized LPC and LTP coefficients are also used to filter the input signal and measure residual energy for each of the four subframes.

从量化的LSF系数导出的系数,编码器保持与解码器完全同步。量化的LPC和LTP系数还用于滤波输入信号并测量四个子帧中的每一个子帧的剩余能量。

5.2.3.4.2. Unvoiced Speech
5.2.3.4.2. 清音讲话

For a speech signal that has been classified as unvoiced, there is no need for LTP filtering, as it has already been determined that the pre-whitened input signal is not periodic enough within the allowed pitch period range for LTP analysis to be worth the cost in terms of complexity and bitrate. The pre-whitened input signal is therefore discarded, and, instead, the input signal is used for LPC analysis using Burg's method. The resulting LPC coefficients are converted to an LSF vector and quantized as described in the following section. They are then transformed back to obtain quantized LPC coefficients, which are then used to filter the input signal and measure residual energy for each of the four subframes.

对于已被分类为清音的语音信号,不需要LTP滤波,因为已经确定预白化的输入信号在LTP分析的允许基音周期范围内的周期性不足,因此在复杂性和比特率方面值得付出代价。因此,预白化的输入信号被丢弃,取而代之的是,使用Burg方法将输入信号用于LPC分析。产生的LPC系数被转换为LSF向量,并按照以下部分中的描述进行量化。然后将它们转换回以获得量化的LPC系数,然后使用这些系数对输入信号进行滤波并测量四个子帧中的每一个子帧的剩余能量。

5.2.3.4.2.1. Burg's Method
5.2.3.4.2.1. 伯格法

The main purpose of linear prediction in SILK is to reduce the bitrate by minimizing the residual energy. At least at high bitrates, perceptual aspects are handled independently by the noise shaping filter. Burg's method is used because it provides higher prediction gain than the autocorrelation method and, unlike the covariance method, produces stable filters (assuming numerical errors don't spoil that). SILK's implementation of Burg's method is also computationally faster than the autocovariance method. The implementation of Burg's method differs from traditional implementations in two aspects. The first difference is that it operates on autocorrelations, similar to the Schur algorithm [SCHUR], but with a simple update to the autocorrelations after finding each reflection coefficient to make the result identical to Burg's method. This brings down the complexity of Burg's method to near that of the autocorrelation method. The second difference is that the signal in each subframe is scaled by the inverse of the residual quantization step size. Subframes with a small quantization step size will, on average, spend more bits for a given amount of residual energy than subframes with a large step size. Without scaling, Burg's method minimizes the total residual energy in all subframes, which doesn't necessarily minimize the total number of bits needed for coding the quantized residual. The residual energy of the scaled subframes is a better measure for that number of bits.

丝绸中线性预测的主要目的是通过最小化剩余能量来降低比特率。至少在高比特率下,感知方面由噪声成形滤波器独立处理。之所以使用伯格方法,是因为它提供了比自相关方法更高的预测增益,并且与协方差方法不同,它产生了稳定的滤波器(假设数值误差不会破坏这一点)。SILK对Burg方法的实现在计算上也比自协方差方法快。Burg方法的实现在两个方面不同于传统的实现。第一个区别是,它对自相关进行操作,类似于Schur算法[Schur],但在找到每个反射系数后对自相关进行简单更新,以使结果与Burg的方法相同。这使得伯格方法的复杂性接近于自相关方法。第二个区别是,每个子帧中的信号通过剩余量化步长的倒数进行缩放。平均而言,具有较小量化步长的子帧将比具有较大步长的子帧为给定量的剩余能量花费更多比特。在没有缩放的情况下,Burg的方法使所有子帧中的总剩余能量最小化,这并不一定使编码量化剩余所需的总比特数最小化。缩放子帧的剩余能量是该比特数的更好度量。

5.2.3.5. LSF Quantization
5.2.3.5. LSF量化

Unlike many other speech codecs, SILK uses variable bitrate coding for the LSFs. This improves the average rate-distortion (R-D) trade-off and reduces outliers. The variable bitrate coding minimizes a linear combination of the weighted quantization errors and the bitrate. The weights for the quantization errors are the Inverse Harmonic Mean Weighting (IHMW) function proposed by Laroia et al. (see [LAROIA-ICASSP]). These weights are referred to here as Laroia weights.

与许多其他语音编解码器不同,SILK对LSF使用可变比特率编码。这改进了平均率失真(R-D)权衡,并减少了异常值。可变比特率编码最小化加权量化误差和比特率的线性组合。量化误差的权重为Laroia等人提出的逆谐波平均加权(IHMW)函数(见[Laroia-ICASSP])。这些重量在这里称为Laroia重量。

The LSF quantizer consists of two stages. The first stage is an (unweighted) vector quantizer (VQ), with a codebook size of 32 vectors. The quantization errors for the codebook vector are sorted, and for the N best vectors a second stage quantizer is run. By varying the number N, a trade-off is made between R-D performance and computational efficiency. For each of the N codebook vectors, the Laroia weights corresponding to that vector (and not to the input vector) are calculated. Then, the residual between the input LSF vector and the codebook vector is scaled by the square roots of these Laroia weights. This scaling partially normalizes error sensitivity for the residual vector so that a uniform quantizer with fixed step sizes can be used in the second stage without too much performance loss. Additionally, by scaling with Laroia weights determined from the first-stage codebook vector, the process can be reversed in the decoder.

LSF量化器由两级组成。第一级是(未加权)矢量量化器(VQ),码本大小为32个矢量。对码本矢量的量化误差进行排序,并对N个最佳矢量运行第二级量化器。通过改变N个数,在R-D性能和计算效率之间进行权衡。对于N个码本向量中的每一个,计算对应于该向量(而不是输入向量)的Laroia权重。然后,输入LSF向量和码本向量之间的残差通过这些Laroia权重的平方根进行缩放。这种缩放部分地标准化了残差向量的误差灵敏度,因此具有固定步长的均匀量化器可以在第二阶段使用,而不会造成太多性能损失。此外,通过使用从第一级码本向量确定的Laroia权重进行缩放,可以在解码器中反转该过程。

The second stage uses predictive delayed decision scalar quantization. The quantization error is weighted by Laroia weights determined from the LSF input vector. The predictor multiplies the previous quantized residual value by a prediction coefficient that depends on the vector index from the first stage VQ and on the location in the LSF vector. The prediction is subtracted from the LSF residual value before quantizing the result and is added back afterwards. This subtraction can be interpreted as shifting the quantization levels of the scalar quantizer, and as a result the quantization error of each value depends on the quantization decision of the previous value. This dependency is exploited by the delayed decision mechanism to search for a quantization sequency with best R-D performance with a Viterbi-like algorithm [VITERBI]. The quantizer processes the residual LSF vector in reverse order (i.e., it starts with the highest residual LSF value). This is done because the prediction works slightly better in the reverse direction.

第二阶段使用预测延迟判决标量量化。量化误差由从LSF输入向量确定的Laroia权重加权。预测器将先前量化的残值乘以预测系数,该预测系数取决于来自第一级VQ的向量索引和LSF向量中的位置。在量化结果之前,从LSF残值中减去预测值,然后再加回去。该减法可解释为移位标量量化器的量化电平,并且作为结果,每个值的量化误差取决于先前值的量化判决。延迟决策机制利用这种依赖性,通过类维特比算法[Viterbi]搜索具有最佳R-D性能的量化序列。量化器以相反顺序处理剩余LSF向量(即,它从最高剩余LSF值开始)。之所以这样做,是因为预测在相反方向上效果稍好。

The quantization index of the first stage is entropy coded. The quantization sequence from the second stage is also entropy coded, where for each element the probability table is chosen depending on the vector index from the first stage and the location of that element in the LSF vector.

第一阶段的量化索引是熵编码的。来自第二阶段的量化序列也被熵编码,其中对于每个元素,根据来自第一阶段的向量索引和该元素在LSF向量中的位置来选择概率表。

5.2.3.5.1. LSF Stabilization
5.2.3.5.1. LSF稳定

If the input is stable, finding the best candidate usually results in a quantized vector that is also stable. Because of the two-stage approach, however, it is possible that the best quantization candidate is unstable. The encoder applies the same stabilization procedure applied by the decoder (see Section 4.2.7.5.4) to ensure the LSF parameters are within their valid range, increasingly sorted, and have minimum distances between each other and the border values.

如果输入是稳定的,找到最佳候选通常会得到同样稳定的量化向量。然而,由于两阶段方法,最佳量化候选可能是不稳定的。编码器采用与解码器相同的稳定程序(见第4.2.7.5.4节),以确保LSF参数在其有效范围内,并逐渐排序,且彼此之间和边界值之间的距离最小。

5.2.3.6. LTP Quantization
5.2.3.6. LTP量化

For voiced frames, the prediction analysis described in Section 5.2.3.4.1 resulted in four sets (one set per subframe) of five LTP coefficients, plus four weighting matrices. The LTP coefficients for each subframe are quantized using entropy constrained vector quantization. A total of three vector codebooks are available for quantization, with different rate-distortion trade-offs. The three codebooks have 10, 20, and 40 vectors and average rates of about 3, 4, and 5 bits per vector, respectively. Consequently, the first codebook has larger average quantization distortion at a lower rate, whereas the last codebook has smaller average quantization distortion at a higher rate. Given the weighting matrix W_ltp and LTP vector b, the weighted rate-distortion measure for a codebook vector cb_i with rate r_i is give by

对于浊音帧,第5.2.3.4.1节中描述的预测分析产生了五个LTP系数的四组(每个子帧一组)加上四个加权矩阵。使用熵约束矢量量化对每个子帧的LTP系数进行量化。总共有三个矢量码本可用于量化,具有不同的率失真权衡。这三个码本分别有10、20和40个向量,平均速率约为每个向量3、4和5位。因此,第一码本在较低速率下具有较大的平均量化失真,而最后一码本在较高速率下具有较小的平均量化失真。给定加权矩阵W_ltp和ltp向量b,速率为r_i的码本向量cb_i的加权率失真度量由下式给出:

               RD = u * (b - cb_i)' * W_ltp * (b - cb_i) + r_i
        
               RD = u * (b - cb_i)' * W_ltp * (b - cb_i) + r_i
        

where u is a fixed, heuristically determined parameter balancing the distortion and rate. Which codebook gives the best performance for a given LTP vector depends on the weighting matrix for that LTP vector. For example, for a low valued W_ltp, it is advantageous to use the codebook with 10 vectors as it has a lower average rate. For a large W_ltp, on the other hand, it is often better to use the codebook with 40 vectors, as it is more likely to contain the best codebook vector. The weighting matrix W_ltp depends mostly on two aspects of the input signal. The first is the periodicity of the signal; the more periodic, the larger W_ltp. The second is the change in signal energy in the current subframe, relative to the signal one pitch lag earlier. A decaying energy leads to a larger W_ltp than an increasing energy. Both aspects fluctuate relatively slowly, which causes the W_ltp matrices for different subframes of one frame often

其中u是一个固定的、启发式确定的参数,用于平衡失真和速率。对于给定的LTP向量,哪个码本提供最佳性能取决于该LTP向量的加权矩阵。例如,对于低值W_ltp,使用具有10个向量的码本是有利的,因为它具有较低的平均速率。另一方面,对于较大的W_ltp,通常最好使用具有40个向量的码本,因为它更可能包含最佳码本向量。加权矩阵W_ltp主要取决于输入信号的两个方面。第一是信号的周期性;周期性越强,W_ltp越大。第二个是当前子帧中信号能量的变化,相对于先前一个基音滞后的信号。衰变的能量比增加的能量产生更大的W_ltp。这两个方面的波动相对缓慢,这导致一个帧的不同子帧的W_ltp矩阵经常出现

to be similar. Because of this, one of the three codebooks typically gives good performance for all subframes. Therefore, the codebook search for the subframe LTP vectors is constrained to only allow codebook vectors to be chosen from the same codebook, resulting in a rate reduction.

相似。因此,三个码本中的一个通常为所有子帧提供良好的性能。因此,对子帧LTP向量的码本搜索被约束为仅允许从相同码本中选择码本向量,从而导致速率降低。

To find the best codebook, each of the three vector codebooks is used to quantize all subframe LTP vectors and produce a combined weighted rate-distortion measure for each vector codebook. The vector codebook with the lowest combined rate-distortion over all subframes is chosen. The quantized LTP vectors are used in the noise shaping quantizer, and the index of the codebook plus the four indices for the four subframe codebook vectors are passed on to the range encoder.

为了找到最佳码本,三个向量码本中的每一个都用于量化所有子帧LTP向量,并为每个向量码本生成组合加权率失真度量。选择在所有子帧上具有最低组合率失真的向量码本。量化的LTP向量用于噪声成形量化器,并且码本的索引加上四个子帧码本向量的四个索引被传递到范围编码器。

5.2.3.7. Pre-filter
5.2.3.7. 预滤器

In the pre-filter, the input signal is filtered using the spectral valley de-emphasis filter coefficients from the noise shaping analysis (see Section 5.2.3.3). By applying only the noise shaping analysis filter to the input signal, it provides the input to the noise shaping quantizer.

在预滤波器中,使用噪声成形分析中的谱谷去加重滤波器系数对输入信号进行滤波(见第5.2.3.3节)。通过仅对输入信号应用噪声整形分析滤波器,它向噪声整形量化器提供输入。

5.2.3.8. Noise Shaping Quantizer
5.2.3.8. 噪声整形量化器

The noise shaping quantizer independently shapes the signal and coding noise spectra to obtain a perceptually higher quality at the same bitrate.

噪声成形量化器独立地成形信号和编码噪声谱,以在相同比特率下获得感知上更高的质量。

The pre-filter output signal is multiplied with a compensation gain G computed in the noise shaping analysis. Then, the output of a synthesis shaping filter is added, and the output of a prediction filter is subtracted to create a residual signal. The residual signal is multiplied by the inverse quantized quantization gain from the noise shaping analysis and input to a scalar quantizer. The quantization indices of the scalar quantizer represent a signal of pulses that is input to the pyramid range encoder. The scalar quantizer also outputs a quantization signal, which is multiplied by the quantized quantization gain from the noise shaping analysis to create an excitation signal. The output of the prediction filter is added to the excitation signal to form the quantized output signal y(n). The quantized output signal y(n) is input to the synthesis shaping and prediction filters.

预滤波输出信号与噪声整形分析中计算的补偿增益G相乘。然后,将合成成形滤波器的输出相加,并减去预测滤波器的输出以产生残余信号。剩余信号乘以来自噪声成形分析的逆量化量化量化增益,并输入到标量量化器。标量量化器的量化指数表示输入到金字塔范围编码器的脉冲信号。标量量化器还输出量化信号,量化信号与来自噪声成形分析的量化量化增益相乘,以创建激励信号。预测滤波器的输出被添加到激励信号以形成量化输出信号y(n)。量化输出信号y(n)被输入到合成成形和预测滤波器。

Optionally, the noise shaping quantizer operates in a delayed decision mode. In this mode, it uses a Viterbi algorithm to keep track of multiple rounding choices in the quantizer and select the best one after a delay of 32 samples. This improves the rate/ distortion performance of the quantizer.

可选地,噪声成形量化器在延迟判决模式下操作。在这种模式下,它使用维特比算法跟踪量化器中的多个舍入选择,并在延迟32个样本后选择最佳的一个。这提高了量化器的速率/失真性能。

5.2.3.9. Constant Bitrate Mode
5.2.3.9. 恒定比特率模式

SILK was designed to run in variable bitrate (VBR) mode. However, the reference implementation also has a constant bitrate (CBR) mode for SILK. In CBR mode, SILK will attempt to encode each packet with no more than the allowed number of bits. The Opus wrapper code then pads the bitstream if any unused bits are left in SILK mode, or it encodes the high band with the remaining number of bits in Hybrid mode. The number of payload bits is adjusted by changing the quantization gains and the rate/distortion trade-off in the noise shaping quantizer, in an iterative loop around the noise shaping quantizer and entropy coding. Compared to the SILK VBR mode, the CBR mode has lower audio quality at a given average bitrate and has higher computational complexity.

SILK被设计为在可变比特率(VBR)模式下运行。然而,参考实现对于SILK也具有恒定比特率(CBR)模式。在CBR模式下,SILK将尝试以不超过允许位数的方式对每个数据包进行编码。然后,如果任何未使用的比特保留在SILK模式下,Opus包装器代码将填充比特流,或者在混合模式下使用剩余的比特数对高频段进行编码。在围绕噪声成形量化器和熵编码的迭代循环中,通过改变噪声成形量化器中的量化增益和速率/失真权衡来调整有效载荷比特的数目。与SILK VBR模式相比,CBR模式在给定平均比特率下具有较低的音频质量,并且具有较高的计算复杂度。

5.3. CELT Encoder
5.3. 塞尔特编码器

Most of the aspects of the CELT encoder can be directly derived from the description of the decoder. For example, the filters and rotations in the encoder are simply the inverse of the operation performed by the decoder. Similarly, the quantizers generally optimize for the mean square error (because noise shaping is part of the bitstream itself), so no special search is required. For this reason, only the less straightforward aspects of the encoder are described here.

CELT编码器的大部分方面可以直接从解码器的描述中派生出来。例如,编码器中的滤波器和旋转只是解码器执行的操作的逆。类似地,量化器通常针对均方误差进行优化(因为噪声整形是比特流本身的一部分),因此不需要特殊搜索。出于这个原因,这里只描述编码器的不那么简单的方面。

5.3.1. Pitch Pre-filter
5.3.1. 变桨预滤器

The pitch pre-filter is applied after the pre-emphasis. It is applied in such a way as to be the inverse of the decoder's post-filter. The main non-obvious aspect of the pre-filter is the selection of the pitch period. The pitch search should be optimized for the following criteria:

预加重后应用基音预滤波器。它的应用方式与解码器的后滤波器相反。预滤波器的主要不明显方面是基音周期的选择。音高搜索应根据以下标准进行优化:

o continuity: it is important that the pitch period does not change abruptly between frames; and

o 连续性:重要的是基音周期不会在帧之间突然变化;和

o avoidance of pitch multiples: when the period used is a multiple of the real period (lower frequency fundamental), the post-filter loses most of its ability to reduce noise

o 避免基音倍数:当使用的周期是实际周期(低频基频)的倍数时,后滤波器将失去其大部分降低噪声的能力

5.3.2. Bands and Normalization
5.3.2. 波段与归一化

The MDCT output is divided into bands that are designed to match the ear's critical bands for the smallest (2.5 ms) frame size. The larger frame sizes use integer multiples of the 2.5 ms layout. For each band, the encoder computes the energy that will later be encoded. Each band is then normalized by the square root of the *unquantized* energy, such that each band now forms a unit vector X. The energy and the normalization are computed by compute_band_energies() and normalise_bands() (bands.c), respectively.

MDCT输出分为多个频带,这些频带的设计与耳朵的关键频带相匹配,以获得最小(2.5毫秒)的帧大小。较大的帧大小使用2.5毫秒布局的整数倍。对于每个频带,编码器计算稍后将被编码的能量。然后,通过*未量化*能量的平方根对每个频带进行归一化,使得每个频带现在形成一个单位向量X。能量和归一化分别通过compute_band_energies()和normalize_bands()(bands.c)计算。

5.3.3. Energy Envelope Quantization
5.3.3. 能量包络量化

Energy quantization (both coarse and fine) can be easily understood from the decoding process. For all useful bitrates, the coarse quantizer always chooses the quantized log energy value that minimizes the error for each band. Only at very low rate does the encoder allow larger errors to minimize the rate and avoid using more bits than are available. When the available CPU requirements allow it, it is best to try encoding the coarse energy both with and without inter-frame prediction such that the best prediction mode can be selected. The optimal mode depends on the coding rate, the available bitrate, and the current rate of packet loss.

能量量化(粗和细)可以很容易地从解码过程中理解。对于所有有用的比特率,粗量化器总是选择量化的对数能量值,以使每个频带的误差最小化。只有在非常低的速率下,编码器才允许更大的错误,以最小化速率,并避免使用比可用位更多的位。当可用的CPU需求允许时,最好尝试在有帧间预测和无帧间预测的情况下对粗略能量进行编码,以便选择最佳预测模式。最佳模式取决于编码速率、可用比特率和当前丢包率。

The fine energy quantizer always chooses the quantized log energy value that minimizes the error for each band because the rate of the fine quantization depends only on the bit allocation and not on the values that are coded.

精细能量量化器始终选择使每个频带的误差最小化的量化日志能量值,因为精细量化的速率仅取决于比特分配,而不取决于编码的值。

5.3.4. Bit Allocation
5.3.4. 位分配

The encoder must use exactly the same bit allocation process as used by the decoder and described in Section 4.3.3. The three mechanisms that can be used by the encoder to adjust the bitrate on a frame-by-frame basis are band boost, allocation trim, and band skipping.

编码器必须使用与第4.3.3节所述解码器使用的完全相同的位分配过程。编码器可用于逐帧调整比特率的三种机制是频带提升、分配微调和频带跳过。

5.3.4.1. Band Boost
5.3.4.1. 频带增强

The reference encoder makes a decision to boost a band when the energy of that band is significantly higher than that of the neighboring bands. Let E_j be the log-energy of band j, we define

当一个频带的能量明显高于相邻频带的能量时,参考编码器决定提升该频带。设E_j为带j的对数能量,我们定义

      D_j = 2*E_j - E_j-1 - E_j+1
        
      D_j = 2*E_j - E_j-1 - E_j+1
        

The allocation of band j is boosted once if D_j > t1 and twice if D_j > t2. For LM>=1, t1=2 and t2=4, while for LM<1, t1=3 and t2=5.

如果D_j>t1,则频带j的分配增加一次,如果D_j>t2,则增加两次。对于LM>=1,t1=2和t2=4,而对于LM<1,t1=3和t2=5。

5.3.4.2. Allocation Trim
5.3.4.2. 分配微调

The allocation trim is a value between 0 and 10 (inclusively) that controls the allocation balance between the low and high frequencies. The encoder starts with a safe "default" of 5 and deviates from that default in two different ways. First, the trim can deviate by +/- 2 depending on the spectral tilt of the input signal. For signals with more low frequencies, the trim is increased by up to 2, while for signals with more high frequencies, the trim is decreased by up to 2. For stereo inputs, the trim value can be decreased by up to 4 when the inter-channel correlation at low frequency (first 8 bands) is high.

分配微调是一个介于0和10(包括)之间的值,用于控制低频和高频之间的分配平衡。编码器以安全“默认值”5开始,并以两种不同的方式偏离该默认值。首先,根据输入信号的光谱倾斜,微调可能偏离+/-2。对于频率较低的信号,微调最多增加2,而对于频率较高的信号,微调最多减少2。对于立体声输入,当低频(前8个频带)的通道间相关性较高时,微调值最多可减少4。

5.3.4.3. Band Skipping
5.3.4.3. 跳绳

The encoder uses band skipping to ensure that the shape of the bands is only coded if there is at least 1/2 bit per sample available for the PVQ. If not, then no bit is allocated and folding is used instead. To ensure continuity in the allocation, some amount of hysteresis is added to the process, such that a band that received PVQ bits in the previous frame only needs 7/16 bit/sample to be coded for the current frame, while a band that did not receive PVQ bits in the previous frames needs at least 9/16 bit/sample to be coded.

编码器使用带跳以确保仅当PVQ的每个样本至少有1/2位可用时才对带的形状进行编码。如果不是,则不分配位,而是使用折叠。为了确保分配的连续性,向过程中添加了一定量的滞后,使得在前一帧中接收到PVQ位的频带只需要为当前帧编码7/16位/采样,而在前一帧中未接收到PVQ位的频带需要至少编码9/16位/采样。

5.3.5. Stereo Decisions
5.3.5. 立体声判决

Because CELT applies mid-side stereo coupling in the normalized domain, it does not suffer from important stereo image problems even when the two channels are completely uncorrelated. For this reason, it is always safe to use stereo coupling on any audio frame. That being said, there are some frames for which dual (independent) stereo is still more efficient. This decision is made by comparing the estimated entropy with and without coupling over the first 13 bands, taking into account the fact that all bands with more than two MDCT bins require one extra degree of freedom when coded in mid-side. Let L1_ms and L1_lr be the L1-norm of the mid-side vector and the L1-norm of the left-right vector, respectively. The decision to use mid-side is made if and only if

由于CELT在归一化域中应用了中间侧立体耦合,因此即使两个通道完全不相关,它也不会遇到重要的立体图像问题。因此,在任何音频帧上使用立体声耦合总是安全的。也就是说,对于某些帧,双(独立)立体声仍然更有效。考虑到所有具有两个以上MDCT箱的频带在中间侧编码时需要一个额外的自由度这一事实,通过比较前13个频带上有耦合和无耦合的估计熵来做出此决定。设L1_ms和L1_lr分别为中间向量的L1范数和左右向量的L1范数。当且仅当

                            L1_ms          L1_lr
                           --------    <   -----
                           bins + E        bins
        
                            L1_ms          L1_lr
                           --------    <   -----
                           bins + E        bins
        

where bins is the number of MDCT bins in the first 13 bands and E is the number of extra degrees of freedom for mid-side coding. For LM>1, E=13, otherwise E=5.

其中,bins是前13个频带中MDCT bins的数量,E是中间侧编码的额外自由度的数量。对于LM>1,E=13,否则E=5。

The reference encoder decides on the intensity stereo threshold based on the bitrate alone. After taking into account the frame size by subtracting 80 bits per frame for coarse energy, the first band using intensity coding is as follows:

参考编码器仅基于比特率决定强度立体阈值。在通过每帧减去80比特的粗略能量来考虑帧大小之后,使用强度编码的第一个频带如下所示:

                     +------------------+------------+
                     | bitrate (kbit/s) | start band |
                     +------------------+------------+
                     |        <35       |      8     |
                     |                  |            |
                     |       35-50      |     12     |
                     |                  |            |
                     |       50-68      |     16     |
                     |                  |            |
                     |       84-84      |     18     |
                     |                  |            |
                     |      84-102      |     19     |
                     |                  |            |
                     |      102-130     |     20     |
                     |                  |            |
                     |       >130       |  disabled  |
                     +------------------+------------+
        
                     +------------------+------------+
                     | bitrate (kbit/s) | start band |
                     +------------------+------------+
                     |        <35       |      8     |
                     |                  |            |
                     |       35-50      |     12     |
                     |                  |            |
                     |       50-68      |     16     |
                     |                  |            |
                     |       84-84      |     18     |
                     |                  |            |
                     |      84-102      |     19     |
                     |                  |            |
                     |      102-130     |     20     |
                     |                  |            |
                     |       >130       |  disabled  |
                     +------------------+------------+
        

Table 66: Thresholds for Intensity Stereo

表66:强度立体声的阈值

5.3.6. Time-Frequency Decision
5.3.6. 时频判决

The choice of time-frequency resolution used in Section 4.3.4.5 is based on R-D optimization. The distortion is the L1-norm (sum of absolute values) of each band after each TF resolution under consideration. The L1 norm is used because it represents the entropy for a Laplacian source. The number of bits required to code a change in TF resolution between two bands is higher than the cost of having those two bands use the same resolution, which is what requires the R-D optimization. The optimal decision is computed using the Viterbi algorithm. See tf_analysis() in celt/celt.c.

第4.3.4.5节中使用的时频分辨率的选择基于R-D优化。失真是在考虑的每个TF分辨率之后每个频带的L1范数(绝对值之和)。使用L1范数是因为它表示拉普拉斯源的熵。在两个频带之间编码TF分辨率变化所需的比特数高于使这两个频带使用相同分辨率的成本,这需要R-D优化。使用维特比算法计算最优决策。参见celt/celt.c中的tf_analysis()。

5.3.7. Spreading Values Decision
5.3.7. 传播价值决策

The choice of the spreading value in Table 59 has an impact on the nature of the coding noise introduced by CELT. The larger the f_r value, the lower the impact of the rotation, and the more tonal the coding noise. The more tonal the signal, the more tonal the noise should be, so the CELT encoder determines the optimal value for f_r by estimating how tonal the signal is. The tonality estimate is based on discrete pdf (4-bin histogram) of each band. Bands that

表59中扩展值的选择对CELT引入的编码噪声的性质有影响。f_r值越大,旋转的影响越小,编码噪声的音调越高。信号的音调越高,噪声的音调就越高,因此CELT编码器通过估计信号的音调来确定f_r的最佳值。色调估计基于每个波段的离散pdf(4-bin直方图)。乐队

have a large number of small values are considered more tonal and a decision is made by combining all bands with more than 8 samples. See spreading_decision() in celt/bands.c.

如果有大量的小值,则视为更具音调,并通过组合所有带和8个以上的样本来做出决定。参见celt/bands.c中的displating_decision()。

5.3.8. Spherical Vector Quantization
5.3.8. 球面矢量量化

CELT uses a Pyramid Vector Quantizer (PVQ) [PVQ] for quantizing the details of the spectrum in each band that have not been predicted by the pitch predictor. The PVQ codebook consists of all sums of K signed pulses in a vector of N samples, where two pulses at the same position are required to have the same sign. Thus, the codebook includes all integer codevectors y of N dimensions that satisfy sum(abs(y(j))) = K.

CELT使用金字塔矢量量化器(PVQ)[PVQ]对每个频带中基音预测器未预测的频谱细节进行量化。PVQ码本由N个样本向量中K个有符号脉冲的所有和组成,其中相同位置的两个脉冲需要具有相同的符号。因此,码本包括满足sum(abs(y(j))=K的N维的所有整数码向量y。

In bands where there are sufficient bits allocated, PVQ is used to encode the unit vector that results from the normalization in Section 5.3.2 directly. Given a PVQ codevector y, the unit vector X is obtained as X = y/||y||, where ||.|| denotes the L2 norm.

在分配了足够比特的频带中,PVQ用于直接对第5.3.2节中标准化产生的单位向量进行编码。给定一个PVQ码向量y,单位向量X的形式为X=y/| | | y | | |,其中| |.| |表示L2范数。

5.3.8.1. PVQ Search
5.3.8.1. PVQ搜索

The search for the best codevector y is performed by alg_quant() (vq.c). There are several possible approaches to the search, with a trade-off between quality and complexity. The method used in the reference implementation computes an initial codeword y1 by projecting the normalized spectrum X onto the codebook pyramid of K-1 pulses:

最佳码向量y的搜索由alg_quant()执行(vq.c)。有几种可能的搜索方法,在质量和复杂性之间进行权衡。参考实现中使用的方法通过将归一化频谱X投影到K-1脉冲的码书金字塔上来计算初始码字y1:

   y0 = truncate_towards_zero( (K-1) * X / sum(abs(X)))
        
   y0 = truncate_towards_zero( (K-1) * X / sum(abs(X)))
        

Depending on N, K and the input data, the initial codeword y0 may contain from 0 to K-1 non-zero values. All the remaining pulses, with the exception of the last one, are found iteratively with a greedy search that minimizes the normalized correlation between y and X:

取决于N、K和输入数据,初始码字y0可以包含从0到K-1的非零值。除最后一个脉冲外,所有剩余脉冲都是通过贪婪搜索迭代找到的,贪婪搜索可最小化y和X之间的归一化相关性:

                                   T
                             J = -X * y / ||y||
        
                                   T
                             J = -X * y / ||y||
        

The search described above is considered to be a good trade-off between quality and computational cost. However, there are other possible ways to search the PVQ codebook and the implementers MAY use any other search methods. See alg_quant() in celt/vq.c.

上面描述的搜索被认为是质量和计算成本之间的一个很好的折衷。然而,还有其他可能的方法来搜索PVQ码本,实现者可以使用任何其他搜索方法。参见celt/vq.c中的alg_quant()。

5.3.8.2. PVQ Encoding
5.3.8.2. PVQ编码
   The vector to encode, X, is converted into an index i such that
   0 <= i < V(N,K) as follows.  Let i = 0 and k = 0.  Then, for
   j = (N - 1) down to 0, inclusive, do:
        
   The vector to encode, X, is converted into an index i such that
   0 <= i < V(N,K) as follows.  Let i = 0 and k = 0.  Then, for
   j = (N - 1) down to 0, inclusive, do:
        

1. If k > 0, set i = i + (V(N-j-1,k-1) + V(N-j,k-1))/2.

1. 如果k>0,则设置i=i+(V(N-j-1,k-1)+V(N-j,k-1))/2。

2. Set k = k + abs(X[j]).

2. 设置k=k+abs(X[j])。

3. If X[j] < 0, set i = i + (V(N-j-1,k) + V(N-j,k))/2.

3. 如果X[j]<0,则设置i=i+(V(N-j-1,k)+V(N-j,k))/2。

The index i is then encoded using the procedure in Section 5.1.4 with ft = V(N,K).

然后使用第5.1.4节中的程序对索引i进行编码,ft=V(N,K)。

6. Conformance
6. 一致性

It is our intention to allow the greatest possible choice of freedom in implementing the specification. For this reason, outside of the exceptions noted in this section, conformance is defined through the reference implementation of the decoder provided in Appendix A. Although this document includes a prose description of the codec, should the description contradict the source code of the reference implementation, the latter shall take precedence.

我们的目的是在实现规范时允许最大可能的自由选择。因此,除本节所述的例外情况外,一致性通过附录A中提供的解码器的参考实现来定义。尽管本文件包括编解码器的散文描述,但如果描述与参考实现的源代码相矛盾,则应以参考实现的源代码为准。

Compliance with this specification means that, in addition to following the normative keywords in this document, a decoder's output MUST also be within the thresholds specified by the opus_compare.c tool (included with the code) when compared to the reference implementation for each of the test vectors provided (see Appendix A.4) and for each output sampling rate and channel count supported. In addition, a compliant decoder implementation MUST have the same final range decoder state as that of the reference decoder. It is therefore RECOMMENDED that the decoder implement the same functional behavior as the reference. A decoder implementation is not required to support all output sampling rates or all output channel counts.

符合本规范意味着,除了遵循本文件中的规范性关键字外,与提供的每个测试向量的参考实现进行比较时,解码器的输出还必须在opus_compare.c工具(包括代码)规定的阈值范围内(见附录a.4)以及支持的每个输出采样率和通道计数。此外,兼容解码器实现必须具有与参考解码器相同的最终范围解码器状态。因此,建议解码器实现与参考相同的功能行为。解码器实现不需要支持所有输出采样率或所有输出通道计数。

6.1. Testing
6.1. 测试

Using the reference code provided in Appendix A, a test vector can be decoded with

使用附录A中提供的参考代码,可以使用

      opus_demo -d <rate> <channels> testvectorX.bit testX.out
        
      opus_demo -d <rate> <channels> testvectorX.bit testX.out
        

where <rate> is the sampling rate and can be 8000, 12000, 16000, 24000, or 48000, and <channels> is 1 for mono or 2 for stereo.

其中<rate>是采样率,可以是8000、12000、16000、24000或48000,<channels>对于单声道为1,对于立体声为2。

If the range decoder state is incorrect for one of the frames, the decoder will exit with "Error: Range coder state mismatch between encoder and decoder". If the decoder succeeds, then the output can be compared with the "reference" output with

如果其中一帧的范围解码器状态不正确,则解码器将以“错误:编码器和解码器之间的范围编码器状态不匹配”退出。如果解码器成功,则可以将输出与“参考”输出进行比较

      opus_compare -s -r <rate> testvectorX.dec testX.out
        
      opus_compare -s -r <rate> testvectorX.dec testX.out
        

for stereo or

立体声或

      opus_compare -r <rate> testvectorX.dec testX.out
        
      opus_compare -r <rate> testvectorX.dec testX.out
        

for mono.

对于单声道。

In addition to indicating whether the test vector comparison passes, the opus_compare tool outputs an "Opus quality metric" that indicates how well the tested decoder matches the reference implementation. A quality of 0 corresponds to the passing threshold, while a quality of 100 is the highest possible value and means that the output of the tested decoder is identical to the reference implementation. The passing threshold (quality 0) was calibrated in such a way that it corresponds to additive white noise with a 48 dB SNR (similar to what can be obtained on a cassette deck). It is still possible for an implementation to sound very good with such a low quality measure (e.g., if the deviation is due to inaudible phase distortion), but unless this is verified by listening tests, it is RECOMMENDED that implementations achieve a quality above 90 for 48 kHz decoding. For other sampling rates, it is normal for the quality metric to be lower (typically, as low as 50 even for a good implementation) because of harmless mismatch with the delay and phase of the internal sampling rate conversion.

除了指示测试向量比较是否通过外,opus_比较工具还输出“opus质量度量”,该度量指示测试解码器与参考实现的匹配程度。质量0对应于通过阈值,而质量100是可能的最高值,并且意味着被测试解码器的输出与参考实现相同。通过阈值(质量0)的校准方式使其对应于具有48 dB SNR的加性白噪声(类似于可在盒式磁带组上获得的噪声)。在这种低质量测量中(例如,如果偏差是由于听不见的相位失真造成的),实现仍然可能听起来非常好,但除非通过听力测试进行验证,否则建议实现48 kHz解码的质量达到90以上。对于其他采样率,由于与内部采样率转换的延迟和相位不匹配,质量指标通常较低(通常,即使对于良好的实现,也低至50)。

On POSIX environments, the run_vectors.sh script can be used to verify all test vectors. This can be done with

在POSIX环境中,可以使用run_vectors.sh脚本验证所有测试向量。这可以通过

      run_vectors.sh <exec path> <vector path> <rate>
        
      run_vectors.sh <exec path> <vector path> <rate>
        

where <exec path> is the directory where the opus_demo and opus_compare executables are built and <vector path> is the directory containing the test vectors.

其中<exec path>是构建opus\u demo和opus\u compare可执行文件的目录,<vector path>是包含测试向量的目录。

6.2. Opus Custom
6.2. 作品习俗

Opus Custom is an OPTIONAL part of the specification that is defined to handle special sample rates and frame rates that are not supported by the main Opus specification. Use of Opus Custom is discouraged for all but very special applications for which a frame size different from 2.5, 5, 10, or 20 ms is needed (for either complexity or latency reasons). Because Opus Custom is optional, streams

Opus Custom是规范的可选部分,用于处理主Opus规范不支持的特殊采样率和帧速率。除了非常特殊的应用程序外,不鼓励对所有需要不同于2.5、5、10或20 ms帧大小的应用程序使用Opus Custom(出于复杂性或延迟原因)。因为Opus自定义是可选的,所以流

encoded using Opus Custom cannot be expected to be decodable by all Opus implementations. Also, because no in-band mechanism exists for specifying the sampling rate and frame size of Opus Custom streams, out-of-band signaling is required. In Opus Custom operation, only the CELT layer is available, using the opus_custom_* function calls in opus_custom.h.

不能期望所有Opus实现都能对使用Opus自定义编码的代码进行解码。此外,由于不存在用于指定Opus自定义流的采样率和帧大小的带内机制,因此需要带外信令。在Opus自定义操作中,使用Opus_Custom.h中的Opus_Custom_*函数调用,只有CELT层可用。

7. Security Considerations
7. 安全考虑

Like any other audio codec, Opus should not be used with insecure ciphers or cipher-modes that are vulnerable to known plaintext attacks. In addition to the zeros used in Opus padding, digital silence frames generate predictable compressed results and the TOC byte may have an easily predictable value.

与任何其他音频编解码器一样,Opus不应与易受已知明文攻击的不安全密码或密码模式一起使用。除了Opus填充中使用的零之外,数字静默帧生成可预测的压缩结果,并且TOC字节可能具有易于预测的值。

Implementations of the Opus codec need to take appropriate security considerations into account, as outlined in [DOS]. It is extremely important for the decoder to be robust against malicious payloads. Malicious payloads must not cause the decoder to overrun its allocated memory or to take an excessive amount of resources to decode. Although problems in encoders are typically rarer, the same applies to the encoder. Malicious audio streams must not cause the encoder to misbehave because this would allow an attacker to attack transcoding gateways.

Opus编解码器的实现需要考虑适当的安全因素,如[DOS]中所述。解码器对恶意有效负载的鲁棒性非常重要。恶意有效负载不得导致解码器超出其分配的内存或占用过多的资源进行解码。虽然编码器中的问题通常比较少见,但编码器也是如此。恶意音频流不得导致编码器行为不当,因为这将允许攻击者攻击转码网关。

The reference implementation contains no known buffer overflow or cases where a specially crafted packet or audio segment could cause a significant increase in CPU load. However, on certain CPU architectures where denormalized floating-point operations are much slower than normal floating-point operations, it is possible for some audio content (e.g., silence or near silence) to cause an increase in CPU load. Denormals can be introduced by reordering operations in the compiler and depend on the target architecture, so it is difficult to guarantee that an implementation avoids them. For architectures on which denormals are problematic, adding very small floating-point offsets to the affected signals to prevent significant numbers of denormalized operations is RECOMMENDED. Alternatively, it is often possible to configure the hardware to treat denormals as zero (DAZ). No such issue exists for the fixed-point reference implementation.

参考实现不包含已知的缓冲区溢出,也不包含巧尽心思构建的数据包或音频段可能导致CPU负载显著增加的情况。然而,在非规范化浮点操作比正常浮点操作慢得多的某些CPU架构上,某些音频内容(例如静音或接近静音)可能会导致CPU负载增加。非规范化可以通过在编译器中重新排序操作引入,并且依赖于目标体系结构,因此很难保证实现能够避免它们。对于非规范化有问题的体系结构,建议向受影响的信号添加非常小的浮点偏移量,以防止大量的非规范化操作。或者,通常可以将硬件配置为将非规范化处理为零(DAZ)。定点参考实现不存在此类问题。

The reference implementation was validated in the following conditions:

参考实施在以下条件下进行了验证:

1. Sending the decoder valid packets generated by the reference encoder and verifying that the decoder's final range coder state matches that of the encoder.

1. 发送由参考编码器生成的解码器有效分组,并验证解码器的最终范围编码器状态与编码器的状态匹配。

2. Sending the decoder packets generated by the reference encoder and then subjected to random corruption.

2. 发送由参考编码器生成的解码器分组,然后遭受随机损坏。

3. Sending the decoder random packets.

3. 发送解码器随机数据包。

4. Sending the decoder packets generated by a version of the reference encoder modified to make random coding decisions (internal fuzzing), including mode switching, and verifying that the range coder final states match.

4. 发送由修改以做出随机编码决策(内部模糊)的参考编码器版本生成的解码器分组,包括模式切换,并验证范围编码器最终状态匹配。

In all of the conditions above, both the encoder and the decoder were run inside the Valgrind [VALGRIND] memory debugger, which tracks reads and writes to invalid memory regions as well as the use of uninitialized memory. There were no errors reported on any of the tested conditions.

在上述所有情况下,编码器和解码器都在Valgrind[Valgrind]内存调试器内运行,该调试器跟踪对无效内存区域的读取和写入以及未初始化内存的使用。在任何测试条件下均未报告任何错误。

8. Acknowledgements
8. 致谢

Thanks to all other developers, including Henrik Astrom, Jon Bergenheim, Raymond Chen, Soren Skak Jensen, Gregory Maxwell, Christopher Montgomery, and Karsten Vandborg Sorensen. We would also like to thank Igor Dyakonov, Hoang Thi Minh Nguyet, Christian Hoene, Gian-Carlo Pascutto, and Jan Skoglund for their help with testing of the Opus codec. Thanks to Andrew D'Addesio, Elwyn Davies, Ralph Giles, John Ridges, Ben Schwartz, Kat Walsh, Mark Warner, Keith Yan, and many others on the Opus and CELT mailing lists for their bug reports and feedback. At last, the authors would like to thank Robert Sparks, Cullen Jennings, and Jonathan Rosenberg for their support throughout the standardization process.

感谢所有其他开发者,包括Henrik Astrom、Jon Bergenheim、Raymond Chen、Soren Skak Jensen、Gregory Maxwell、Christopher Montgomery和Karsten Vandborg Sorensen。我们还要感谢Igor Dyakonov、Hoang Thi Minh Nguyet、Christian Hoene、Gian Carlo Pascutto和Jan Skoglund对Opus编解码器测试的帮助。感谢Andrew D'Addesio、Elwyn Davies、Ralph Giles、John Ridges、Ben Schwartz、Kat Walsh、Mark Warner、Keith Yan以及Opus和CELT邮件列表中的许多其他人的错误报告和反馈。最后,作者要感谢Robert Sparks、Cullen Jennings和Jonathan Rosenberg在整个标准化过程中给予的支持。

9. References
9. 工具书类
9.1. Normative References
9.1. 规范性引用文件

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

9.2. Informative References
9.2. 资料性引用

[BURG] Burg, J., "Maximum Entropy Spectral Analysis", Proceedings of the 37th Annual International SEG Meeting, Vol. 6, 1975.

[BURG]BURG,J.,“最大熵谱分析”,第37届国际SEG年会论文集,第6卷,1975年。

[CELT] Valin, JM., Terriberry, T., Maxwell, G., and C. Montgomery, "Constrained-Energy Lapped Transform (CELT) Codec", Work in Progress, July 2010.

[CELT]Valin,JM.,Terriberry,T.,Maxwell,G.,和C.Montgomery,“受限能量重叠变换(CELT)编解码器”,正在进行的工作,2010年7月。

[CODING-THESIS] Pasco, R., "Source coding algorithms for fast data compression", Ph.D. thesis Dept. of Electrical Engineering, Stanford University, May 1976.

[编码-论文]帕斯科,R.,“用于快速数据压缩的信源编码算法”,博士。斯坦福大学电气工程系毕业论文,1976年5月。

[DOS] Handley, M., Rescorla, E., and IAB, "Internet Denial-of-Service Considerations", RFC 4732, December 2006.

[DOS]Handley,M.,Rescorla,E.,和IAB,“互联网拒绝服务注意事项”,RFC 4732,2006年12月。

[FFT] Wikipedia, "Fast Fourier Transform", <http://en.wikipedia.org/w/ index.php?title=Fast_Fourier_transform&oldid=508004516>.

[FFT]维基百科,“快速傅立叶变换”<http://en.wikipedia.org/w/ index.php?title=Fast\u Fourier\u transform&oldid=508004516>。

[GOOGLE-NETEQ] "Google NetEQ code", <http://code.google.com/p/webrtc/ source/browse/trunk/src/modules/audio_coding/NetEQ/main/ source/?r=583>.

[GOOGLE-NETEQ]“GOOGLE-NETEQ代码”<http://code.google.com/p/webrtc/ source/browse/trunk/src/modules/audio_coding/NetEQ/main/source/?r=583>。

[GOOGLE-WEBRTC] "Google WebRTC code", <http://code.google.com/p/webrtc/>.

[GOOGLE-WEBRTC]“GOOGLE WEBRTC代码”<http://code.google.com/p/webrtc/>.

[HADAMARD] Wikipedia, "Hadamard Transform", <http://en.wikipedia.org/ w/index.php?title=Hadamard_transform&oldid=508252957>.

[哈达玛]维基百科,“哈达玛变换”<http://en.wikipedia.org/ w/index.php?title=Hadamard_transform&oldid=508252957>。

[KABAL86] Kabal, P. and R. Ramachandran, "The Computation of Line Spectral Frequencies Using Chebyshev Polynomials", IEEE Trans. Acoustics, Speech, Signal Processing, Vol. 34, no. 6, pp. 1419-1426, December 1986.

[KABAL86]Kabal,P.和R.Ramachandran,“使用切比雪夫多项式计算线谱频率”,IEEE Trans。声学,语音,信号处理,第34卷,第6期,第1419-1426页,1986年12月。

[LAROIA-ICASSP] Laroia, R., Phamdo, N., and N. Farvardin, "Robust and Efficient Quantization of Speech LSP Parameters Using Structured Vector Quantization", ICASSP-1991, Proc. IEEE Int. Conf. Acoust., Speech, Signal Processing, pp. 641- 644, October 1991.

[LAROIA-ICASSP]LAROIA,R.,Phamdo,N.,和N.Farvardin,“使用结构化矢量量化对语音LSP参数进行稳健有效的量化”,ICASSP-1991,Proc。IEEE国际声学会议,语音,信号处理,第641-644页,1991年10月。

[LPC] Wikipedia, "Linear Prediction", <http://en.wikipedia.org/ w/index.php?title=Linear_prediction&oldid=497201278>.

[LPC]维基百科,“线性预测”<http://en.wikipedia.org/ w/index.php?title=Linear\u prediction&oldid=497201278>。

[MARTIN79] Martin, G., "Range encoding: An algorithm for removing redundancy from a digitised message", Proc. Institution of Electronic and Radio Engineers International Conference on Video and Data Recording, 1979.

[MARTIN79]Martin,G.,“范围编码:从数字化信息中消除冗余的算法”,Proc。电子和无线电工程师学会国际视频和数据记录会议,1979年。

[MATROSKA-WEBSITE] "Matroska website", <http://matroska.org/>.

[马特罗斯卡网站]“马特罗斯卡网站”<http://matroska.org/>.

[MDCT] Wikipedia, "Modified Discrete Cosine Transform", <http:// en.wikipedia.org/w/ index.php?title=Modified_discrete_cosine_ transform&oldid=490295438>.

[MDCT]维基百科,“修改的离散余弦变换”,<http://en.Wikipedia.org/w/index.php?title=Modified\u Discrete\u Cosine\u Transform&oldid=490295438>。

[OPUS-GIT] "Opus Git Repository", <https://git.xiph.org/opus.git>.

[OPUS-GIT]“OPUS-GIT存储库”<https://git.xiph.org/opus.git>.

[OPUS-WEBSITE] "Opus website", <http://opus-codec.org/>.

[OPUS-WEBSET]“OPUS网站”<http://opus-codec.org/>.

[PRINCEN86] Princen, J. and A. Bradley, "Analysis/Synthesis Filter Bank Design Based on Time Domain Aliasing Cancellation", IEEE Trans. Acoustics, Speech, and Siginal Processing, ASSP-34 (5), pp. 1153-1161, October, 1986.

[PRINCEN86]Princen,J.和A.Bradley,“基于时域混叠消除的分析/综合滤波器组设计”,IEEE Trans。声学、语音和信号处理,ASSP-34(5),第1153-1161页,1986年10月。

[PVQ] Fischer, T., "A Pyramid Vector Quantizer", IEEE Trans. on Information Theory, Vol. 32, pp. 568-583, July 1986.

[PVQ]Fischer,T.,“金字塔矢量量化器”,IEEE Trans。《信息论》,第32卷,第568-583页,1986年7月。

[RANGE-CODING] Wikipedia, "Range Coding", <http://en.wikipedia.org/w/ index.php?title=Range_encoding&oldid=509582757>.

[范围编码]维基百科,“范围编码”<http://en.wikipedia.org/w/ index.php?title=Range\u encoding&oldid=509582757>。

[REQUIREMENTS] Valin, JM. and K. Vos, "Requirements for an Internet Audio Codec", RFC 6366, August 2011.

[要求]Valin,JM。和K.Vos,“互联网音频编解码器的要求”,RFC6362011年8月。

[RFC3533] Pfeiffer, S., "The Ogg Encapsulation Format Version 0", RFC 3533, May 2003.

[RFC3533]Pfeiffer,S.,“Ogg封装格式版本0”,RFC 3533,2003年5月。

[RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. Jacobson, "RTP: A Transport Protocol for Real-Time Applications", STD 64, RFC 3550, July 2003.

[RFC3550]Schulzrinne,H.,Casner,S.,Frederick,R.,和V.Jacobson,“RTP:实时应用的传输协议”,STD 64,RFC 35502003年7月。

[SCHUR] Le Roux, J. and C. Gueguen, "A fixed point computation of partial correlation coefficients", ICASSP-1977, Proc. IEEE Int. Conf. Acoustics, Speech, and Signal Processing, pp. 257-259, June 1977.

[SCHUR]Le Roux,J.和C.Gueguen,“偏相关系数的定点计算”,ICASSP-1977,Proc。IEEE Int.Conf.声学、语音和信号处理,第257-259页,1977年6月。

[SILK] Vos, K., Jensen, S., and K. Sorensen, "SILK Speech Codec", Work in Progress, September 2010.

[SILK]Vos,K.,Jensen,S.,和K.Sorensen,“丝绸语音编解码器”,正在进行的工作,2010年9月。

[SPECTRAL-PAIRS] Wikipedia, "Line Spectral Pairs", <http:// en.wikipedia.org/w/ index.php?title=Line_spectral_pairs&oldid=365426016>.

[spectrum-PAIRS]维基百科,“线谱对”,http://en.Wikipedia.org/w/index.php?title=Line\u spectrum\u PAIRS&oldid=365426016>。

[SRTP-VBR] Perkins, C. and JM. Valin, "Guidelines for the Use of Variable Bit Rate Audio with Secure RTP", RFC 6562, March 2012.

[SRTP-VBR]Perkins,C.和JM。Valin,“带安全RTP的可变比特率音频使用指南”,RFC 6562,2012年3月。

[VALGRIND] "Valgrind website", <http://valgrind.org/>.

[VALGRIND]“VALGRIND网站”<http://valgrind.org/>.

[VALIN2010] Valin, JM., Terriberry, T., Montgomery, C., and G. Maxwell, "A High-Quality Speech and Audio Codec With Less Than 10 ms Delay", IEEE Trans. on Audio, Speech, and Language Processing, Vol. 18, No. 1, pp. 58-67 2010.

[VALIN2010]Valin,JM.,Terriberry,T.,Montgomery,C.,和G.Maxwell,“延迟小于10 ms的高质量语音和音频编解码器”,IEEE Trans。《音频、语音和语言处理》,第18卷,第1期,第58-67页,2010年。

[VECTORS-PROC] "Opus Testvectors (proceedings)", <http://www.ietf.org/ proceedings/83/slides/slides-83-codec-0.gz>.

[VECTORS-PROC]“Opus Testvectors(会议记录)”<http://www.ietf.org/ 会议记录/83/slides/slides-83-codec-0.gz>。

[VECTORS-WEBSITE] "Opus Testvectors (website)", <http://opus-codec.org/testvectors/>.

[VECTORS-WEBSITE]“Opus Testvectors(网站)”<http://opus-codec.org/testvectors/>.

[VITERBI] Wikipedia, "Viterbi Algorithm", <http://en.wikipedia.org/ w/index.php?title=Viterbi_algorithm&oldid=508835871>.

[维特比]维基百科,“维特比算法”<http://en.wikipedia.org/ w/index.php?title=Viterbi_算法&oldid=508835871>。

[VORBIS-WEBSITE] "Vorbis website", <http://xiph.org/vorbis/>.

[VORBIS-网站]“VORBIS网站”<http://xiph.org/vorbis/>.

[WHITENING] Wikipedia, "White Noise", <http://en.wikipedia.org/w/ index.php?title=White_noise&oldid=497791998>.

[美白]维基百科,“白噪音”<http://en.wikipedia.org/w/ index.php?title=White\u noise&oldid=497791998>。

[Z-TRANSFORM] Wikipedia, "Z-transform", <http://en.wikipedia.org/w/ index.php?title=Z-transform&oldid=508392884>.

[Z-TRANSFORM]维基百科,“Z-TRANSFORM”<http://en.wikipedia.org/w/ index.php?title=Z-transform&oldid=508392884>。

[ZWICKER61] Zwicker, E., "Subdivision of the Audible Frequency Range into Critical Bands", The Journal of the Acoustical Society of America, Vol. 33, No 2 pp. 248, February 1961.

[ZWICKER61]Zwicker,E.,“将可听频率范围细分为临界频带”,《美国声学学会杂志》,第33卷,第2期,第248页,1961年2月。

Appendix A. Reference Implementation
附录A.参考实施

This appendix contains the complete source code for the reference implementation of the Opus codec written in C. By default, this implementation relies on floating-point arithmetic, but it can be compiled to use only fixed-point arithmetic by defining the FIXED_POINT macro. The normative behavior is defined as the output using the floating-point configuration. Information on building and using the reference implementation is available in the README file.

本附录包含用C编写的Opus编解码器参考实现的完整源代码。默认情况下,此实现依赖于浮点算法,但通过定义定点宏,可以将其编译为仅使用定点算法。规范行为定义为使用浮点配置的输出。自述文件中提供了有关构建和使用参考实现的信息。

The implementation can be compiled with either a C89 or a C99 compiler. It is reasonably optimized for most platforms such that only architecture-specific optimizations are likely to be useful. The Fast Fourier Transform (FFT) [FFT] used is a slightly modified version of the KISS-FFT library, but it is easy to substitute any other FFT library.

可以使用C89或C99编译器编译实现。它针对大多数平台进行了合理的优化,因此只有特定于体系结构的优化才可能有用。所使用的快速傅里叶变换(FFT)[FFT]是KISS-FFT库的一个稍加修改的版本,但它很容易替代任何其他FFT库。

While the reference implementation does not rely on any _undefined behavior_ as defined by C89 or C99, it relies on common _implementation-defined behavior_ for two's complement architectures:

虽然参考实现不依赖于C89或C99定义的任何_未定义的行为,但它依赖于两个互补体系结构的公共_实现定义的行为:

o Right shifts of negative values are consistent with two's complement arithmetic, so that a>>b is equivalent to floor(a/(2**b)),

o 负值的右移与二的补码运算一致,因此a>>b相当于下限(a/(2**b)),

o For conversion to a signed integer of N bits, the value is reduced modulo 2**N to be within range of the type,

o 对于转换为N位的有符号整数,该值被减少为模2**N,以在该类型的范围内,

o The result of integer division of a negative value is truncated towards zero, and

o 负值整除的结果被截断为零,并且

o The compiler provides a 64-bit integer type (a C99 requirement which is supported by most C89 compilers).

o 编译器提供64位整数类型(大多数C89编译器都支持C99要求)。

In its current form, the reference implementation also requires the following architectural characteristics to obtain acceptable performance:

在当前形式下,参考实现还需要以下体系结构特征才能获得可接受的性能:

o Two's complement arithmetic,

o 二的补码运算,

o At least a 16 bit by 16 bit integer multiplier (32-bit result), and

o 至少一个16位乘16位整数乘法器(32位结果),以及

o At least a 32-bit adder/accumulator.

o 至少一个32位加法器/累加器。

A.1. Extracting the Source
A.1. 提取源

The complete source code can be extracted from this document, by running the following command line:

通过运行以下命令行,可以从此文档中提取完整的源代码:

o cat rfc6716.txt | grep '^\ \ \ ###' | sed -e 's/...###//' | base64 --decode > opus-rfc6716.tar.gz

o cat rfc6716.txt | grep'^\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

o tar xzvf opus-rfc6716.tar.gz

o tar xzvf opus-rfc6716.tar.gz

o cd opus-rfc6716

o cd opus-rfc6716

o make

o 制作

On systems where the provided Makefile does not work, the following command line may be used to compile the source code:

在提供的Makefile不起作用的系统上,可以使用以下命令行编译源代码:

o cc -O2 -g -o opus_demo src/opus_demo.c `cat *.mk | grep -v fixed | sed -e 's/.*=//' -e 's/\\\\//'` -DOPUS_BUILD -Iinclude -Icelt -Isilk -Isilk/float -DUSE_ALLOCA -Drestrict= -lm

o cc-O2-g-o opus\u demo src/opus\u demo.c`cat*.mk | grep-v fixed | sed-e's/*=/'-e's/\\\\\\\/''`-DOPUS\u BUILD-Iinclude-Icelt-Isilk-Isilk/float-DUSE\u ALLOCA-Drestrict=-lm

On systems where the base64 utility is not present, the following commands can be used instead:

在不存在base64实用程序的系统上,可以使用以下命令:

o cat rfc6716.txt | grep '^\ \ \ ###' | sed -e 's/...###//' > opus.b64

o cat rfc6716.txt | grep'^\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

o openssl base64 -d -in opus.b64 > opus-rfc6716.tar.gz

o opensslbase64-d-in opus.b64>opus-rfc6716.tar.gz

The SHA1 hash of the opus-rfc6716.tar.gz file is 86a927223e73d2476646a1b933fcd3fffb6ecc8c.

opus-rfc6716.tar.gz文件的SHA1散列是86a927223e73d2476646a1b933fcd3fffb6ecc8c。

A.2. Up-to-Date Implementation
A.2. 最新实施

As of the time of publication of this memo, an up-to-date implementation conforming to this RFC is available in a Git repository [OPUS-GIT]. Releases and other resources are available at [OPUS-WEBSITE]. However, although that implementation is expected to remain conformant with the RFC, it is the code in this document that shall remain normative.

截至本备忘录发布之时,符合本RFC的最新实现已在Git存储库[OPUS-Git]中提供。发布和其他资源可在[OPUS-WEBSITE]上获得。然而,尽管该实施预计将与RFC保持一致,但本文件中的规范应保持规范性。

A.3. Base64-Encoded Source Code
A.3. Base64编码源代码
   ###H4sIAEeqNVACA+xde3PixrLfv/kUfXarEvDF2ODHZrNJajHIWCe8LgJ7t+65pSOL
   ###AXRWSEQPe52c891v98xISEI8vMZ7kyqTikHSdE93T0/Pr+ehdRehf+hNzPO31fOj
   ###V8/zOcbP27dn/Bs/2W/+u1o7rp6d1M6qx29fHVfxv7NXcPbqL/TJKvcX+bjJ9m/0
   ###+p/Ubus5THN+frqu/U9O3lZl+x/XzslPqugF1Vfw6qX9n/3TcBcPnjWdBVB99+70
   ###EFuhCqoyvIShF/pBGT5ai1ml503LoH1+WDBoW3MrYOMy9MzA8C2zXICcz9+Z4Rx2
        
   ###H4sIAEeqNVACA+xde3PixrLfv/kUfXarEvDF2ODHZrNJajHIWCe8LgJ7t+65pSOL
   ###AXRWSEQPe52c891v98xISEI8vMZ7kyqTikHSdE93T0/Pr+ehdRehf+hNzPO31fOj
   ###V8/zOcbP27dn/Bs/2W/+u1o7rp6d1M6qx29fHVfxv7NXcPbqL/TJKvcX+bjJ9m/0
   ###+p/Ubus5THN+frqu/U9O3lZl+x/XzslPqugF1Vfw6qX9n/3TcBcPnjWdBVB99+70
   ###EFuhCqoyvIShF/pBGT5ai1ml503LoH1+WDBoW3MrYOMy9MzA8C2zXICcz9+Z4Rx2
        
   ###DM+Ea8O2nDIMrbkbzB7gogJD5nnWLf55yKdtaOqgV4aWx6au9wAd48s9s+0y/vA+
   ###w4XrTZk3tpxpPrHiWZ9hzKBh+IHnQttduBWo2zZwHX3wmM+8OzauFArDmeXDxLIZ
   ###4Df7EniGiYrBxHPnMLhsUIeoQN9mhs/AZwyCmRHQA5i4HhjjsRVYrmPYBcvBG3OD
   ###rpDrgI0trNq6DekGGM4YQmRgOeC7oWcyfufWcgxUjej8MtxbwQyQJ327YVCYu2Nr
   ###YpmcYxkMj8GCeWh1km7huXfWGH9waYIZQya27d6jQcB0HSGUXyCiOQt+LBQOIS2R
   ###D+4kEsV00VJzbGY0S2CgiMTPuHXv6JF0i4LjBpbJyvgMzWQjJ2KwrIrrk5YDqzNt
   ###w5ozr5JXP9aT0D+qHxUbhybbuwgg1CqMXTOcMycwomY5QoujS2IJbDvmWYbtL63L
   ###m4RYJkXn2nSZxYnooWPMGYmiOsjAYQFormmx4KEsehBWkOxJjsupCkQlWmHBTGpo
   ###UkVU4nroDnPjAW4ZeQ1q5QJzxnibETcUD3sRKwhboTePUe67yGe5dXx3EtxT60tn
   ###Wlay8CzyMY/8yClwj/J9odXwStVA610Ob+oDBfB3f9C7VptKEy4+wfBKARoXBmrr
   ###aghXvXZTGWhQ7zbxbnc4UC9Gw95AK/zzn3UNSb//nj+qdz+B8rE/UDQNegNQO/22
   ###iuyQ/6DeHaqKhibqNtqjJo42ZUAW0O0NC221ow6x2BC7P1W7Sga9S+gog8YVXtYv
   ###1LY6/MTru1SHXarrsjco1KFfHwzVxqhdH0B/NOj3NAVIsaaqNdp1taM0K1g71gjK
   ###tdIdgnZVb7czevZuusqggKInlYQLBdpq/aKtUEVcyaY6UBpD0mb5q4GmQ/HaGDL7
   ###SkPFHwXlo4K61AefyiB4asp/j7AQPoRmvVNvoWrFVYtAwiIFbJTGaKB0SGQ0gza6
   ###0IbqcDRUoNXrNbmdNWVwrTYU7T20exo31khTyljDsE4VEwu0FD7GshcjTeU2U7tD
   ###ZTAY9Ydqr1vCBr5Bq6CMdSRtcuP2ulxVNFBv8AmZFsgG3PZluLlS8P6A7MktVScT
   ###aGixxhASxbA+NOAwoWOhq7TaakvpNhR62iMuN6qmlLCpVJSsRSyp2ps61jniKlMT
   ###oVTip6oVIpct84YE9RLqzWuVxJaFsek1VboJN1njSpq7Unj18lnBfyazA10MDn5l
   ###/vlb4b/zM4H/T8+rteo54f+T4/PjF/z3LT5vYIkAi2YJCAASCqylxq4MnlsDqd4U
   ###3gDsC1YhqxSy4sz3gK6Qyx4AFnKJMRaX7Mk4C3k8DWqtEePxcOuJkkSIC9nsBXRJ
   ###vZ4OvEivJ2MvZLIH+EVcEghMdJw9oDBksw8ghmz2g8WQ0R7hGHLbGyJDXvsAZchm
   ###D7hMcNkHNOMttwd0hnz2ANCQy5MwWqGhtIe61hsN0HjwMxA+ObrFOOJXTPhHgV/S
   ###n8TVvZd4hqGHYm/qxpiZqWvmJK4/Y4/UJ5MEQ9tY2IaZYIGBa+YuEpXMx2aiPI4t
   ###LPFwYQXmLC2sbi8SNf4WGk6gZ3TyMDgur+5+q5iFb4L/LMe0wzE7egZo9Lj5X5oK
   ###fJn//eb4P2p/uqnPQzuggZgZ88rsGfF/rfr2uJaZ/z2rnZ6+4P9v8Tk62CkBiKaB
   ###4dINnbGA5PlJAADcCJQDtw/ZxAEOjgpHBwUqtK88ATJ5At3YQ5oAe0kTIJEm0MWT
   ###swR4apaQL8XjkwTYT5IAe0oShFpPzxFgHzkC7CVHgHSOwPvMHlIE2E+KAPtKEWCv
   ###KQLsMUWA/aQIsJcUAfaWIsCeUgTYS4oAT0wRcEDBEeWgAAfwgY8mq9iFP7v1LDaB
   ###Hj7EwDZhHsJ+HBDmC5stY0+CCup9tUCjVeGNNXHGRNofaXpn1B6qaB2l3tGvCm/w
   ###vuWwvEdIJrAUvCaBKrPXnBMx0nVzYYc+/V/AcQ+DE7xuvIY/Cm8wlFiTQiF4WDAq
   ###iJJgCOEydzTFofHBS1+9zy/bZMmy8up9IZZX17mRzBkzP+toCB/1Z/oi8Ir4fwmK
   ###4uu/oh+HUCROss6DgxK/XSrl88P8ajd+Uq4Ev/UGbSlDHd2shyFN14b1oaIPqCNq
   ###QzhD4LiZrqmsoas9psLil/JD6RGCldNWsZyg+KVU3mD6h9Ij1NggTa66u0iTajiU
   ###hroVQTwXEZBATJaDIzvCuN/xMtVZmHROTg/u7b8YpsTU7aBhIEbMdkldlscqaZX+
   ###oViigdRjHOxxMj5QCj5wP0MoiXax/BniS+qTXG8csiggpXvHwdqqTLwKWFFuGuDF
   ###0AonNbjEIT3xQaV/As3AwECAxeP6TFDzBQ3U1hQRJxSvfi+RGIIAuYA5MxyH2WlO
   ###glU3nN+iYISMZCEJfdI8U+yE6Blugt3QDbC0EzOVRQUQ4QhSAo2If1pON8SAN9bT
   ###FWTlFIWg6GNsYm4pp46YaeiQ/FgYlUPrz43FgrZmRExFs4xB3kfYFNwzbM3YFORV
   ###EfuUpEhgx9A7bYKGS9s/CJ0zDCTkCvU+Ao9GnYZA/bqn9o9W7tZxyOplGu2AeR7C
   ###LcixssKfRKqW3ou+oCbcH4GqjWKPH/Bb9JDx+h6x4rRU/VpPpV4W+WnGuwmppuRM
   ###9btYuxfv/ut4N+zVuyNXHbAg9DAFs5kzpbx2IlImIzBgYTzYroEGoJzvIWB+iVIX
   ###Axw2RYEwx2Mp59/RbYXDrnfXTQ6L6ZUfxE5bPYeDhTlPtp6a9CWDXAzbDgcLyqt8
   ###cmbmV6AtVKVJBQ8zON3HfnoQN4WsijRYPt7o0JIx5WCCZKWnSJ4ZLyEjp3tpLwyI
   ###6jacTIiXyDRR6/nCYz5lkXGTOC42vMfnOhCNGl90YqbzVgLbdaalpB6Z52k96suo
   ###xOauyOujet5jyu18H/ApkQlvakxvMUfnPmwFnmya/frSY2KgPkGuT4yBwqk4o6Q/
   ###5bpU0p+suP+iKsi3Eum92bE2udbXOtYm13oux9rkWvtyLIDItVos8LnMZDIyA0qX
   ###bm6R14Qeo4lFTOM86YxEQHfSPpUY+NYOr1MW8BYqft2QJEJ+blTPjD/wuPEn0eOa
        
   ###DM+Ea8O2nDIMrbkbzB7gogJD5nnWLf55yKdtaOqgV4aWx6au9wAd48s9s+0y/vA+
   ###w4XrTZk3tpxpPrHiWZ9hzKBh+IHnQttduBWo2zZwHX3wmM+8OzauFArDmeXDxLIZ
   ###4Df7EniGiYrBxHPnMLhsUIeoQN9mhs/AZwyCmRHQA5i4HhjjsRVYrmPYBcvBG3OD
   ###rpDrgI0trNq6DekGGM4YQmRgOeC7oWcyfufWcgxUjej8MtxbwQyQJ327YVCYu2Nr
   ###YpmcYxkMj8GCeWh1km7huXfWGH9waYIZQya27d6jQcB0HSGUXyCiOQt+LBQOIS2R
   ###D+4kEsV00VJzbGY0S2CgiMTPuHXv6JF0i4LjBpbJyvgMzWQjJ2KwrIrrk5YDqzNt
   ###w5ozr5JXP9aT0D+qHxUbhybbuwgg1CqMXTOcMycwomY5QoujS2IJbDvmWYbtL63L
   ###m4RYJkXn2nSZxYnooWPMGYmiOsjAYQFormmx4KEsehBWkOxJjsupCkQlWmHBTGpo
   ###UkVU4nroDnPjAW4ZeQ1q5QJzxnibETcUD3sRKwhboTePUe67yGe5dXx3EtxT60tn
   ###Wlay8CzyMY/8yClwj/J9odXwStVA610Ob+oDBfB3f9C7VptKEy4+wfBKARoXBmrr
   ###aghXvXZTGWhQ7zbxbnc4UC9Gw95AK/zzn3UNSb//nj+qdz+B8rE/UDQNegNQO/22
   ###iuyQ/6DeHaqKhibqNtqjJo42ZUAW0O0NC221ow6x2BC7P1W7Sga9S+gog8YVXtYv
   ###1LY6/MTru1SHXarrsjco1KFfHwzVxqhdH0B/NOj3NAVIsaaqNdp1taM0K1g71gjK
   ###tdIdgnZVb7czevZuusqggKInlYQLBdpq/aKtUEVcyaY6UBpD0mb5q4GmQ/HaGDL7
   ###SkPFHwXlo4K61AefyiB4asp/j7AQPoRmvVNvoWrFVYtAwiIFbJTGaKB0SGQ0gza6
   ###0IbqcDRUoNXrNbmdNWVwrTYU7T20exo31khTyljDsE4VEwu0FD7GshcjTeU2U7tD
   ###ZTAY9Ydqr1vCBr5Bq6CMdSRtcuP2ulxVNFBv8AmZFsgG3PZluLlS8P6A7MktVScT
   ###aGixxhASxbA+NOAwoWOhq7TaakvpNhR62iMuN6qmlLCpVJSsRSyp2ps61jniKlMT
   ###oVTip6oVIpct84YE9RLqzWuVxJaFsek1VboJN1njSpq7Unj18lnBfyazA10MDn5l
   ###/vlb4b/zM4H/T8+rteo54f+T4/PjF/z3LT5vYIkAi2YJCAASCqylxq4MnlsDqd4U
   ###3gDsC1YhqxSy4sz3gK6Qyx4AFnKJMRaX7Mk4C3k8DWqtEePxcOuJkkSIC9nsBXRJ
   ###vZ4OvEivJ2MvZLIH+EVcEghMdJw9oDBksw8ghmz2g8WQ0R7hGHLbGyJDXvsAZchm
   ###D7hMcNkHNOMttwd0hnz2ANCQy5MwWqGhtIe61hsN0HjwMxA+ObrFOOJXTPhHgV/S
   ###n8TVvZd4hqGHYm/qxpiZqWvmJK4/Y4/UJ5MEQ9tY2IaZYIGBa+YuEpXMx2aiPI4t
   ###LPFwYQXmLC2sbi8SNf4WGk6gZ3TyMDgur+5+q5iFb4L/LMe0wzE7egZo9Lj5X5oK
   ###fJn//eb4P2p/uqnPQzuggZgZ88rsGfF/rfr2uJaZ/z2rnZ6+4P9v8Tk62CkBiKaB
   ###4dINnbGA5PlJAADcCJQDtw/ZxAEOjgpHBwUqtK88ATJ5At3YQ5oAe0kTIJEm0MWT
   ###swR4apaQL8XjkwTYT5IAe0oShFpPzxFgHzkC7CVHgHSOwPvMHlIE2E+KAPtKEWCv
   ###KQLsMUWA/aQIsJcUAfaWIsCeUgTYS4oAT0wRcEDBEeWgAAfwgY8mq9iFP7v1LDaB
   ###Hj7EwDZhHsJ+HBDmC5stY0+CCup9tUCjVeGNNXHGRNofaXpn1B6qaB2l3tGvCm/w
   ###vuWwvEdIJrAUvCaBKrPXnBMx0nVzYYc+/V/AcQ+DE7xuvIY/Cm8wlFiTQiF4WDAq
   ###iJJgCOEydzTFofHBS1+9zy/bZMmy8up9IZZX17mRzBkzP+toCB/1Z/oi8Ir4fwmK
   ###4uu/oh+HUCROss6DgxK/XSrl88P8ajd+Uq4Ev/UGbSlDHd2shyFN14b1oaIPqCNq
   ###QzhD4LiZrqmsoas9psLil/JD6RGCldNWsZyg+KVU3mD6h9Ij1NggTa66u0iTajiU
   ###hroVQTwXEZBATJaDIzvCuN/xMtVZmHROTg/u7b8YpsTU7aBhIEbMdkldlscqaZX+
   ###oViigdRjHOxxMj5QCj5wP0MoiXax/BniS+qTXG8csiggpXvHwdqqTLwKWFFuGuDF
   ###0AonNbjEIT3xQaV/As3AwECAxeP6TFDzBQ3U1hQRJxSvfi+RGIIAuYA5MxyH2WlO
   ###glU3nN+iYISMZCEJfdI8U+yE6Blugt3QDbC0EzOVRQUQ4QhSAo2If1pON8SAN9bT
   ###FWTlFIWg6GNsYm4pp46YaeiQ/FgYlUPrz43FgrZmRExFs4xB3kfYFNwzbM3YFORV
   ###EfuUpEhgx9A7bYKGS9s/CJ0zDCTkCvU+Ao9GnYZA/bqn9o9W7tZxyOplGu2AeR7C
   ###LcixssKfRKqW3ou+oCbcH4GqjWKPH/Bb9JDx+h6x4rRU/VpPpV4W+WnGuwmppuRM
   ###9btYuxfv/ut4N+zVuyNXHbAg9DAFs5kzpbx2IlImIzBgYTzYroEGoJzvIWB+iVIX
   ###Axw2RYEwx2Mp59/RbYXDrnfXTQ6L6ZUfxE5bPYeDhTlPtp6a9CWDXAzbDgcLyqt8
   ###cmbmV6AtVKVJBQ8zON3HfnoQN4WsijRYPt7o0JIx5WCCZKWnSJ4ZLyEjp3tpLwyI
   ###6jacTIiXyDRR6/nCYz5lkXGTOC42vMfnOhCNGl90YqbzVgLbdaalpB6Z52k96suo
   ###xOauyOujet5jyu18H/ApkQlvakxvMUfnPmwFnmya/frSY2KgPkGuT4yBwqk4o6Q/
   ###5bpU0p+suP+iKsi3Eum92bE2udbXOtYm13oux9rkWvtyLIDItVos8LnMZDIyA0qX
   ###bm6R14Qeo4lFTOM86YxEQHfSPpUY+NYOr1MW8BYqft2QJEJ+blTPjD/wuPEn0eOa
        
   ###zIhhN0cVuTA7o/uda423I+2VzpRoCuq7Pn0t5NSksxHmPwbTmIFdzOnHROOx30JG
   ###F5VKJRJmt6xjzB6Xdcjy+8s6ojz7YG1VT8g6UDbBBTCCPRWULZl9LRRL+70EecnW
   ###2CMU28R9CybTRHHUN4riEToLjFubPTkDWHoixtg7yw19O5kC5LrkTj0l8phV9B97
   ###2R7RP/vzY//dA2350YF2kyvBI1wpC5H4usPKQC+advw0mC2YJGF2nl9I0ZtsLczO
   ###hxQJTCTH8gqMfHLz7qjdhoXLIRLZwnLGFg/NC8P8jIOF7fopdI1oqZx3MCPTOgJY
   ###oL9EEEWyyM8CVjGPcK5ybONNEA52xHDPkRwQT9F0+oSZOSa5tI0pFI+PqnI04oOh
   ###WFU0nAekP6S9IQSn7g1vHHuN52FkofSR4/DbRPdf/+H1SWesgDoBRIV+aM4ED7SN
   ###cWdYNvdtvmzH9bKW/kuZF2qJYyN2KGp4Edq+eSdIpgffoitIgP3MPSKuLOoZvFUk
   ###n7w8JsXnIp0DuMleQulZondku0fppXt8i+6xPtdZuui+cp0ITPwFcp1d8o4xe2ze
   ###EePvOO9IhYh1ecdK4rUp1dgtAcsmHSvSUN05K4P/iZcDxTfaNmedkWR4rv1ftLTo
   ###P3Hn1y77v6q12slZZv/X6fHpycv+r2+0/6vYKCX2UUTHgL9u/5fY4AUdvnWKjV+2
   ###gL1sAXvZAvayBexlC9jLFrDn3AKGQ04Ss8CtQV0TY4k7ncY3ef+zrVu8B/G2MUhu
   ###G5Ml+d1dNozx8lR/apPY8FNf0bLbw6KbJCrlkRSfECDaCCnHCEdRPJ48fM9zBIwM
   ###xcD4TDPQJHPfCG248i02w8eLiIDP1GHFUBT1jIu6rg2bDV0vwXffQXSR+I1uodF6
   ###sQ6//Ezj/LvjarsE//53kkOrO4o4LO8iNTqZfsULr9zVS8n7ULyqXytLktJyK9xP
   ###kei/8FAW7V3j0z16cgX4ffJxmHoerhbgSVCC/qS2Qr98HsoCb5iNpot1uVG7JzXa
   ###gQaQvK03PrXwERqEnhDMkJroLR2HhIk1JWV47hNVh0/WCJQqky9VDqfqedYwK3yi
   ###IpFtUNS0dnoHe+INVod6pBj4M9cL1vOPZ0gS5cK8gnESlqdHzCUuFTfCqqA3yuBX
   ###bUXOr+S/L125nD4ryCQXOtp14+jC9WzCN1FeHDdKMivfKG+qZL4LbPOANK88R4iS
   ###yIyd640eN7M4Zx31zwf/SMbAX5JdSFPzpIiejtTVmjPEq+ZIEmdNIKVNRCXa7aLI
   ###sJRS4kqn6ENNYpg9DT7CJU3L3LveZ7gNLXsstvDuoOK2IKQ/NQrpuR1+pWEuFNku
   ###wtMu+HxHUgEkXCv/FumfVXZA4ZXOx4TsPe2oBq1GQ/aQjf1wx4izIR5sjwZZeZt/
   ###b/X7sbT86s8panFw9u74OJa0r9VAUTKi7lJNNs48Wc0V79U+dS7UeleMNFJc7WF+
   ###axlOniesMP5qK2cN+QRjIwa+VFv6UNUbZ6cf09Am+ezsY6mwb2ehvThbFVgW2q7B
   ###+TMI+dVGxhFU+kSLFn/CRRkI5YJBSNh3HT63Pg1ZvH7yZ5Bajp8Sy0cc4onz5O/0
   ###hLqYHhD7oEKagfCBBeZ72s5BU1oBYEC+tQKua5b9+alkw9ua/qwU+SGqKbGIlZEz
   ###TAiX0nE/coYJQdPOuSpwmJA4te4Wz2/HE9wyU3r61PbL50nz/6L59rECsHn+//T0
   ###7Wn2/PfpSe3l/Pf/2/nv453m/zNvBP2q4+CUP/3q4rNr139ZGHhZGHhZGHhZGHhZ
   ###GHhZGHjOs+Exrtn5XDjfLmY4gZ9zIrypXJKxs9P9y9uZk+DRGsMjzoPTzpQPWHLq
   ###ueFCbHGi8cBPbFL2uS5/FMQYegBdV26F+jDDyLjcQe8lMDyXs/drNnE55gx6Do9a
   ###/NCI5dwhMYbekEdxz3CmGPO9KY/M/tYqLupNvT5oLWs4rPIqhrTFm8Y1eXZ9YfAz
   ###K5YfVbid8+jyUhnow15P1zrU6w9r4viAI/aD0kYzYYZ7g6JtwDiM2MaWd5tuva1j
   ###50HXRYFPYoETh2vkCahIaNp0Fi52439db6tNvV9v/KoMif+p3F0u7Iz5UbhYYC6L
   ###vKIdb3JT1jbWoy4FWh5MsIsQ67PIItHhDbTGOLvhLGl0QlDyaOvEY49Qhx8453We
   ###8zo74nyQ3FFF/WiGrTAxLHsHptiavYZ+WVfbkdO8JaYf/iP7NHwgMJFpr2avITuA
   ###8oXsFx1A4rCQOh9MQscUAER2ZMhd+YpuSi9T201a/0nKJ/d86boRiOGf6ToUi3eW
   ###b91athU8QPE1ljdCO3jNX5WQmqCRq01vQESAZTV8lSm3Hmwzm8BAcWzbjGtH9HxO
   ###ZScaDGkRDY8qbyTpKmEq7qDP06ZXTwI99BbsU9HBg8awDWpT+qYvdi0iwQPNxIT2
   ###mEBgjIbGFm3JtB8oC0gcf/UrkG16TRmmTrdGb2yIPqeYXaUpWtspqqt1XKg4oiXe
   ###CJH8IEVttY4tFCerdXTqHzH+dZs3anN4laFDitPVOrZQnK3WcX0xyJVIUpyv1rGF
   ###4m2OrdZIJCl+yLHVZop3q3U0ehS6PuJAvkpyiknpah1bKHLaXO2SXPql0silyGnz
   ###LRQ5bS7Cuk5QTe8jwE3SIUVOm2+hyGnz5vDjhhas5rT5Foq3+X5FqBZ9nlbyU8Sn
   ###x7XjfL/aQJHTHoi6G4pOOUBXaWsrFDntsYUipz00tUWDQ67ySJHTHlsozlYp2r3e
   ###r/UrBZFOnrfXaOyCFBFmVFQRHzKxwA8rUZDrqnIx6t2WkhPTTqo5nqQOG1dr2hkp
   ###Tvj2k45hei4/E4hD13TKPI5qLFsM0hww+eL8I8X8e49mdDlqFfMc8eyGCwYfAhKi
   ###57xlBkfFIm2NLhXp4uefobichS8dl0rl1A0sU1rLbeMrhZZMtrygKNyJU5hhxTEH
   ###DowcdsQgJEblOLQhfEKoBn2PHUbrRfIWwQ8yFAelE8NkYn8/zVxNmcM8y0RyvxxB
   ###NLoQJf4Q2/6xza6XnKhR7gyPzh7GoA65+ysuVMccd8N5h8MqDqR8y349DNwjiVZo
        
   ###zIhhN0cVuTA7o/uda423I+2VzpRoCuq7Pn0t5NSksxHmPwbTmIFdzOnHROOx30JG
   ###F5VKJRJmt6xjzB6Xdcjy+8s6ojz7YG1VT8g6UDbBBTCCPRWULZl9LRRL+70EecnW
   ###2CMU28R9CybTRHHUN4riEToLjFubPTkDWHoixtg7yw19O5kC5LrkTj0l8phV9B97
   ###2R7RP/vzY//dA2350YF2kyvBI1wpC5H4usPKQC+advw0mC2YJGF2nl9I0ZtsLczO
   ###hxQJTCTH8gqMfHLz7qjdhoXLIRLZwnLGFg/NC8P8jIOF7fopdI1oqZx3MCPTOgJY
   ###oL9EEEWyyM8CVjGPcK5ybONNEA52xHDPkRwQT9F0+oSZOSa5tI0pFI+PqnI04oOh
   ###WFU0nAekP6S9IQSn7g1vHHuN52FkofSR4/DbRPdf/+H1SWesgDoBRIV+aM4ED7SN
   ###cWdYNvdtvmzH9bKW/kuZF2qJYyN2KGp4Edq+eSdIpgffoitIgP3MPSKuLOoZvFUk
   ###n7w8JsXnIp0DuMleQulZondku0fppXt8i+6xPtdZuui+cp0ITPwFcp1d8o4xe2ze
   ###EePvOO9IhYh1ecdK4rUp1dgtAcsmHSvSUN05K4P/iZcDxTfaNmedkWR4rv1ftLTo
   ###P3Hn1y77v6q12slZZv/X6fHpycv+r2+0/6vYKCX2UUTHgL9u/5fY4AUdvnWKjV+2
   ###gL1sAXvZAvayBexlC9jLFrDn3AKGQ04Ss8CtQV0TY4k7ncY3ef+zrVu8B/G2MUhu
   ###G5Ml+d1dNozx8lR/apPY8FNf0bLbw6KbJCrlkRSfECDaCCnHCEdRPJ48fM9zBIwM
   ###xcD4TDPQJHPfCG248i02w8eLiIDP1GHFUBT1jIu6rg2bDV0vwXffQXSR+I1uodF6
   ###sQ6//Ezj/LvjarsE//53kkOrO4o4LO8iNTqZfsULr9zVS8n7ULyqXytLktJyK9xP
   ###kei/8FAW7V3j0z16cgX4ffJxmHoerhbgSVCC/qS2Qr98HsoCb5iNpot1uVG7JzXa
   ###gQaQvK03PrXwERqEnhDMkJroLR2HhIk1JWV47hNVh0/WCJQqky9VDqfqedYwK3yi
   ###IpFtUNS0dnoHe+INVod6pBj4M9cL1vOPZ0gS5cK8gnESlqdHzCUuFTfCqqA3yuBX
   ###bUXOr+S/L125nD4ryCQXOtp14+jC9WzCN1FeHDdKMivfKG+qZL4LbPOANK88R4iS
   ###yIyd640eN7M4Zx31zwf/SMbAX5JdSFPzpIiejtTVmjPEq+ZIEmdNIKVNRCXa7aLI
   ###sJRS4kqn6ENNYpg9DT7CJU3L3LveZ7gNLXsstvDuoOK2IKQ/NQrpuR1+pWEuFNku
   ###wtMu+HxHUgEkXCv/FumfVXZA4ZXOx4TsPe2oBq1GQ/aQjf1wx4izIR5sjwZZeZt/
   ###b/X7sbT86s8panFw9u74OJa0r9VAUTKi7lJNNs48Wc0V79U+dS7UeleMNFJc7WF+
   ###axlOniesMP5qK2cN+QRjIwa+VFv6UNUbZ6cf09Am+ezsY6mwb2ehvThbFVgW2q7B
   ###+TMI+dVGxhFU+kSLFn/CRRkI5YJBSNh3HT63Pg1ZvH7yZ5Bajp8Sy0cc4onz5O/0
   ###hLqYHhD7oEKagfCBBeZ72s5BU1oBYEC+tQKua5b9+alkw9ua/qwU+SGqKbGIlZEz
   ###TAiX0nE/coYJQdPOuSpwmJA4te4Wz2/HE9wyU3r61PbL50nz/6L59rECsHn+//T0
   ###7Wn2/PfpSe3l/Pf/2/nv453m/zNvBP2q4+CUP/3q4rNr139ZGHhZGHhZGHhZGHhZ
   ###GHhZGHjOs+Exrtn5XDjfLmY4gZ9zIrypXJKxs9P9y9uZk+DRGsMjzoPTzpQPWHLq
   ###ueFCbHGi8cBPbFL2uS5/FMQYegBdV26F+jDDyLjcQe8lMDyXs/drNnE55gx6Do9a
   ###/NCI5dwhMYbekEdxz3CmGPO9KY/M/tYqLupNvT5oLWs4rPIqhrTFm8Y1eXZ9YfAz
   ###K5YfVbid8+jyUhnow15P1zrU6w9r4viAI/aD0kYzYYZ7g6JtwDiM2MaWd5tuva1j
   ###50HXRYFPYoETh2vkCahIaNp0Fi52439db6tNvV9v/KoMif+p3F0u7Iz5UbhYYC6L
   ###vKIdb3JT1jbWoy4FWh5MsIsQ67PIItHhDbTGOLvhLGl0QlDyaOvEY49Qhx8453We
   ###8zo74nyQ3FFF/WiGrTAxLHsHptiavYZ+WVfbkdO8JaYf/iP7NHwgMJFpr2avITuA
   ###8oXsFx1A4rCQOh9MQscUAER2ZMhd+YpuSi9T201a/0nKJ/d86boRiOGf6ToUi3eW
   ###b91athU8QPE1ljdCO3jNX5WQmqCRq01vQESAZTV8lSm3Hmwzm8BAcWzbjGtH9HxO
   ###ZScaDGkRDY8qbyTpKmEq7qDP06ZXTwI99BbsU9HBg8awDWpT+qYvdi0iwQPNxIT2
   ###mEBgjIbGFm3JtB8oC0gcf/UrkG16TRmmTrdGb2yIPqeYXaUpWtspqqt1XKg4oiXe
   ###CJH8IEVttY4tFCerdXTqHzH+dZs3anN4laFDitPVOrZQnK3WcX0xyJVIUpyv1rGF
   ###4m2OrdZIJCl+yLHVZop3q3U0ehS6PuJAvkpyiknpah1bKHLaXO2SXPql0silyGnz
   ###LRQ5bS7Cuk5QTe8jwE3SIUVOm2+hyGnz5vDjhhas5rT5Foq3+X5FqBZ9nlbyU8Sn
   ###x7XjfL/aQJHTHoi6G4pOOUBXaWsrFDntsYUipz00tUWDQ67ySJHTHlsozlYp2r3e
   ###r/UrBZFOnrfXaOyCFBFmVFQRHzKxwA8rUZDrqnIx6t2WkhPTTqo5nqQOG1dr2hkp
   ###Tvj2k45hei4/E4hD13TKPI5qLFsM0hww+eL8I8X8e49mdDlqFfMc8eyGCwYfAhKi
   ###57xlBkfFIm2NLhXp4uefobichS8dl0rl1A0sU1rLbeMrhZZMtrygKNyJU5hhxTEH
   ###DowcdsQgJEblOLQhfEKoBn2PHUbrRfIWwQ8yFAelE8NkYn8/zVxNmcM8y0RyvxxB
   ###NLoQJf4Q2/6xza6XnKhR7gyPzh7GoA65+ysuVMccd8N5h8MqDqR8y349DNwjiVZo
        
   ###J35A8zFbwbccDHHAWlsB594xvljzcB6fAM9hzI15QTh3wpMO/HHtqv0jcjSX9tnI
   ###vCwJHMhD6ZyF5QfMIYF/Q2hCwEucGQ4YYp5pBMbmCNOY4MwzpYwIq6bLvHMjq1rt
   ###+PSHtNC3nmuMTcMPjmbWdHY4wQqENIlXfQiJ+QRVdGYkHFtuBJcQKiFANm3X5z8W
   ###ro9g0uYngeNTlY+Wnr8bZFX6dzLLQ0BGs5+8t9vuPWpzaJgzi93xtTgMCWj3B0oP
   ###7mkuU5jR53asYBNZJjukUxtzFGPMkzmU33ASuK/yaIExMvIZBqWJUfWmqbTrn1Dg
   ###s2rmZV0yRmPjNJQ85ztBzCfPcYoTR7eMnITJd7agRnck/ir6FHw7I01trOFb28x3
   ###HvqWCatZcISHunVMK2/oOsm3Wo3kPf189TvQqSbKLXfIriO+HaWpjjo5fKW851/J
   ###F/8qWa6c74ng+8NX8tVGfZoSyjBHvqecb7X2lXwvR+12rrxnnG/teBvfZaKZnXpZ
   ###xuc4B/KYzU9+UwSmaB0lQTJrwuB1h+GJR6+5GHcpWvA+F81W/8MUE1Py5SfInjOJ
   ###R4uKSKqIXTSxzIcN/paAGY+KnrvwLLr2cTThM9ScxXKSRgwc2IVNg/4tNVKdn2Tm
   ###Uxr8tBwf4svidBp/cZHLWdC0O63BLMTcCfFhGCGQgxdYZmgbXjRHUYnV19w5iWpM
   ###GRKKo4A/xg8/kJKRgrSc8Z5f4A/4OWkHcXgLf+P3l3JOKlKMB7lSSfCgPWPE528/
   ###R5NbJRCH6OJ6lhWjtQTVljpTyUzxO6KT9e1CncB5UkgBIoQJ1uAA4ilZpnAAd8cG
   ###33YaekycJpTlvvc5iAvFjCWGJbqy2RccguK8HBLTSnwOD4PVMaIAsbfMpy0Z3Cfx
   ###Dq3voAs7QeQkNKjRUJfHNkIOHO0Q0+qxPMGITmLM/8dy/he+wE9B8Asa/qcj/P6R
   ###5hmx5vKyakGwbaBI54kEKDekj7kvPUyfxUxbTygGprSwXNzj7ZNTTVJFNwwSOh5I
   ###Jb9KxVa+iq0dVeTI9ksp11ciBCbXD6Xyoq0GBh075itRZwgLMcbQmzXxF9/6QQd5
   ###fcaxr1izNAhyTUL+Oi765xnpW6yRHYg1K3RBiX5TaJFjUiOauUtgyKU7CTdawZiI
   ###K5JLa6YRyl30pIRJt0KBm+Z0Zpf0FCHQpyO5SFxGCGOZ/JAzFiTRs68o4lvyyT40
   ###RTX+V+jH3i+OU3N+8mVLFCbXOPkyEYl9PWH4jDkru/u9NEbK6TMzUo/y+Eioje4u
   ###K1jj64mcS+r6ZE1bOZq2dtF0neNfXwxyHX6YWn2WvsqH7BDHQ4emKuN4yUcvWkQ+
   ###hsbFILqoct5FGf5KMdfIoHT8UZqD1oUlKv4/9t68r41rSRiev/0pOs7vJlpB3VoA
   ###g7jD6vAEsAM4cR4Po7cltaCDNndLBm7i57O/tZy1uyUExknujEgMUvdZ69SpU1Wn
   ###lgEcUHAqsi40YDQmX3LiHAWSUYRJZABQOh+mo2aww74A6a0fkQBE3DzO82R/74Kv
   ###Vkbiags3jxDcnWt0lIdpQC/X/qdwFC1CrDdhtvZMF8JZAJCFr4bm8VG4ioCei6c/
   ###i2WZT49hFotjoTn21w+NfRb20dVh5JM24Jkx8d0w2bi9QIShUvgeDWXEAiZgZHEB
   ###rCtQujieDojQAVMQ07UJcQE+8ZIIHxZegaqjCTFH/xuOoAoKP4zfYhpowCC0B3ih
   ###FGFsrU/+cKKVSVJfQfdNhISIpo/AYwWRaxhNLOi/gAJzoI5zDiMFQk8VQUYb4TqE
   ###knWZBP37knN9345Cllhpb+KtFB4hozYw2iFvQmQnsf3jt3sgCN8HxLXHfCUq9zXF
   ###07MH4dySMA9bi8GiDYMW2Wd6DRfG1bSuNrXl0krZR/JGNp5ZOzG9EY3uvsKezJrn
   ###60fMc9ZOHYyGo1UOVIGcQYewOHO3IvIqJkKhNgpWMOqb4eg21pZfVtCT0ERgn3pk
   ###homNvAIg890uBzCC3cdDEUHsH0YdrfIzUcjJ4VxIOTMcwQNPPRAxORbHMVvzbuFY
   ###tlL+UTgmRiUj08wl9nZ3D+OYAs3mI9FtxpRfP2LK8/hxPfuB1JFKtQTemt9imnU9
   ###89TtYIZcpw8PdVDM1z6Rsgl7xJ5nVEkolhoLVEmoddYXqGKrg1j780AVW9PDih1Z
   ###JcmtzNs6u1D+NuzCoUfwW3xLWMth7YjMa9zsDTGH6ko2chH0OM9Ej7n74knzfj1z
   ###3q8Xn/diu0JON7kLnrIDbMr4v3xzfMUtkb0dHrMVEuiAakmyuM1Qt9snsu9cE/9F
   ###Yv510B+nqCxZmwFT2mHD4MWxR9wKzEEi8z4i6wVdKDwMd3GpgJNeHObchQVw+wr7
   ###sdyepDuxHk2S1HAHWok5j848elKv05N6vcCkFFWZT1ZQrh7S7Zu+m9PIIMaltZnA
   ###qPno8kDGbEKhLu/k7OwiyrzsMaiVump8G4066AIngI9aqnCAwjsuCIs2ievNme3x
   ###5d+h/wnaABFncg0c6xDbFsMfRdAGR0CX+q2sZrKu5BR0OVQvQA0PKHVn2eE0BiRi
   ###JpEkG/MdZ8e4Kn0k1TFGa22DDKuwp+4FKyOJvReMXhbbEE+e6+sZc3296Fytg1dN
   ###eEKB/2TUxlFPqgZIGmnfC6BMwkhoWw26K9SyH6d48WQUZjlfuHmwhKQsR9LRQbkV
   ###FoZuwvGYg7eoZB/xxI8mKvNAIFdHRLkEZJa6rUk4CIA5kp6OEqlxGFx4xTmUjYJc
   ###jppqikOK4Ri5YcRa885exWkRkSRhv8TsqwFUgXeenAReBK6Yd4DK0FY5iVCLI67P
   ###MMajq4uw7Yi9jqHLRT1gfNrTidKrS6AiQcGGFDywHdRifCInHZxfMk7NKPGkRA1+
   ###gi7Ea/GxhOa/wSdYsG4wDoa0CkniyeTREtAYH3ZM64xhEGgKQLqXYBgLTRKbO6DA
   ###zJBA2xhoiL1z/CE1hlrKslwP3iIri2wsHX2yPxrd+NeBr3KELL7FlDmXtcFSRl5P
   ###5WtR5UsBUefGLhXTHY7gYJEszghVYwI9DdMQpaJajNQeHuw5vb5/VSJ9UxhjU908
        
   ###J35A8zFbwbccDHHAWlsB594xvljzcB6fAM9hzI15QTh3wpMO/HHtqv0jcjSX9tnI
   ###vCwJHMhD6ZyF5QfMIYF/Q2hCwEucGQ4YYp5pBMbmCNOY4MwzpYwIq6bLvHMjq1rt
   ###+PSHtNC3nmuMTcMPjmbWdHY4wQqENIlXfQiJ+QRVdGYkHFtuBJcQKiFANm3X5z8W
   ###ro9g0uYngeNTlY+Wnr8bZFX6dzLLQ0BGs5+8t9vuPWpzaJgzi93xtTgMCWj3B0oP
   ###7mkuU5jR53asYBNZJjukUxtzFGPMkzmU33ASuK/yaIExMvIZBqWJUfWmqbTrn1Dg
   ###s2rmZV0yRmPjNJQ85ztBzCfPcYoTR7eMnITJd7agRnck/ir6FHw7I01trOFb28x3
   ###HvqWCatZcISHunVMK2/oOsm3Wo3kPf189TvQqSbKLXfIriO+HaWpjjo5fKW851/J
   ###F/8qWa6c74ng+8NX8tVGfZoSyjBHvqecb7X2lXwvR+12rrxnnG/teBvfZaKZnXpZ
   ###xuc4B/KYzU9+UwSmaB0lQTJrwuB1h+GJR6+5GHcpWvA+F81W/8MUE1Py5SfInjOJ
   ###R4uKSKqIXTSxzIcN/paAGY+KnrvwLLr2cTThM9ScxXKSRgwc2IVNg/4tNVKdn2Tm
   ###Uxr8tBwf4svidBp/cZHLWdC0O63BLMTcCfFhGCGQgxdYZmgbXjRHUYnV19w5iWpM
   ###GRKKo4A/xg8/kJKRgrSc8Z5f4A/4OWkHcXgLf+P3l3JOKlKMB7lSSfCgPWPE528/
   ###R5NbJRCH6OJ6lhWjtQTVljpTyUzxO6KT9e1CncB5UkgBIoQJ1uAA4ilZpnAAd8cG
   ###33YaekycJpTlvvc5iAvFjCWGJbqy2RccguK8HBLTSnwOD4PVMaIAsbfMpy0Z3Cfx
   ###Dq3voAs7QeQkNKjRUJfHNkIOHO0Q0+qxPMGITmLM/8dy/he+wE9B8Asa/qcj/P6R
   ###5hmx5vKyakGwbaBI54kEKDekj7kvPUyfxUxbTygGprSwXNzj7ZNTTVJFNwwSOh5I
   ###Jb9KxVa+iq0dVeTI9ksp11ciBCbXD6Xyoq0GBh075itRZwgLMcbQmzXxF9/6QQd5
   ###fcaxr1izNAhyTUL+Oi765xnpW6yRHYg1K3RBiX5TaJFjUiOauUtgyKU7CTdawZiI
   ###K5JLa6YRyl30pIRJt0KBm+Z0Zpf0FCHQpyO5SFxGCGOZ/JAzFiTRs68o4lvyyT40
   ###RTX+V+jH3i+OU3N+8mVLFCbXOPkyEYl9PWH4jDkru/u9NEbK6TMzUo/y+Eioje4u
   ###K1jj64mcS+r6ZE1bOZq2dtF0neNfXwxyHX6YWn2WvsqH7BDHQ4emKuN4yUcvWkQ+
   ###hsbFILqoct5FGf5KMdfIoHT8UZqD1oUlKv4/9t68r41rSRiev/0pOs7vJlpB3VoA
   ###g7jD6vAEsAM4cR4Po7cltaCDNndLBm7i57O/tZy1uyUExknujEgMUvdZ69SpU1Wn
   ###lgEcUHAqsi40YDQmX3LiHAWSUYRJZABQOh+mo2aww74A6a0fkQBE3DzO82R/74Kv
   ###Vkbiags3jxDcnWt0lIdpQC/X/qdwFC1CrDdhtvZMF8JZAJCFr4bm8VG4ioCei6c/
   ###i2WZT49hFotjoTn21w+NfRb20dVh5JM24Jkx8d0w2bi9QIShUvgeDWXEAiZgZHEB
   ###rCtQujieDojQAVMQ07UJcQE+8ZIIHxZegaqjCTFH/xuOoAoKP4zfYhpowCC0B3ih
   ###FGFsrU/+cKKVSVJfQfdNhISIpo/AYwWRaxhNLOi/gAJzoI5zDiMFQk8VQUYb4TqE
   ###knWZBP37knN9345Cllhpb+KtFB4hozYw2iFvQmQnsf3jt3sgCN8HxLXHfCUq9zXF
   ###07MH4dySMA9bi8GiDYMW2Wd6DRfG1bSuNrXl0krZR/JGNp5ZOzG9EY3uvsKezJrn
   ###60fMc9ZOHYyGo1UOVIGcQYewOHO3IvIqJkKhNgpWMOqb4eg21pZfVtCT0ERgn3pk
   ###homNvAIg890uBzCC3cdDEUHsH0YdrfIzUcjJ4VxIOTMcwQNPPRAxORbHMVvzbuFY
   ###tlL+UTgmRiUj08wl9nZ3D+OYAs3mI9FtxpRfP2LK8/hxPfuB1JFKtQTemt9imnU9
   ###89TtYIZcpw8PdVDM1z6Rsgl7xJ5nVEkolhoLVEmoddYXqGKrg1j780AVW9PDih1Z
   ###JcmtzNs6u1D+NuzCoUfwW3xLWMth7YjMa9zsDTGH6ko2chH0OM9Ej7n74knzfj1z
   ###3q8Xn/diu0JON7kLnrIDbMr4v3xzfMUtkb0dHrMVEuiAakmyuM1Qt9snsu9cE/9F
   ###Yv510B+nqCxZmwFT2mHD4MWxR9wKzEEi8z4i6wVdKDwMd3GpgJNeHObchQVw+wr7
   ###sdyepDuxHk2S1HAHWok5j848elKv05N6vcCkFFWZT1ZQrh7S7Zu+m9PIIMaltZnA
   ###qPno8kDGbEKhLu/k7OwiyrzsMaiVump8G4066AIngI9aqnCAwjsuCIs2ievNme3x
   ###5d+h/wnaABFncg0c6xDbFsMfRdAGR0CX+q2sZrKu5BR0OVQvQA0PKHVn2eE0BiRi
   ###JpEkG/MdZ8e4Kn0k1TFGa22DDKuwp+4FKyOJvReMXhbbEE+e6+sZc3296Fytg1dN
   ###eEKB/2TUxlFPqgZIGmnfC6BMwkhoWw26K9SyH6d48WQUZjlfuHmwhKQsR9LRQbkV
   ###FoZuwvGYg7eoZB/xxI8mKvNAIFdHRLkEZJa6rUk4CIA5kp6OEqlxGFx4xTmUjYJc
   ###jppqikOK4Ri5YcRa885exWkRkSRhv8TsqwFUgXeenAReBK6Yd4DK0FY5iVCLI67P
   ###MMajq4uw7Yi9jqHLRT1gfNrTidKrS6AiQcGGFDywHdRifCInHZxfMk7NKPGkRA1+
   ###gi7Ea/GxhOa/wSdYsG4wDoa0CkniyeTREtAYH3ZM64xhEGgKQLqXYBgLTRKbO6DA
   ###zJBA2xhoiL1z/CE1hlrKslwP3iIri2wsHX2yPxrd+NeBr3KELL7FlDmXtcFSRl5P
   ###5WtR5UsBUefGLhXTHY7gYJEszghVYwI9DdMQpaJajNQeHuw5vb5/VSJ9UxhjU908
        
   ###xzIl1mZxwqvNIy26m7aafIDsZpLcxeCUpMa678WIsYTG4uiRMenXC056MQRR1+1m
   ###SGGgVx3cv1diI/yAV7KR5CvYmkDY8wE5vEIvBSBtgC+ksaQm4FlInixK959QcTG1
   ###ZNUVDmLIK6BMqyawF69CpA+Ju0Rsvo+cRcePAyZbV8QTRbIyNT0dIgHDwiuLoeqx
   ###PXPZHd9f4/2qecH6iMu0pMmthb2z7HGfyjpkr2ISb5O9Loa9XwNAr+cB6PWjAPQo
   ###goguoCO0OZiibSPdRygXx69FC/cv3j8XLYSmLDQyTK6/gPrNBkoSgaC/BdlPOenF
   ###0cGc2+uH5iYX3XbYUWZUhq0LTJ8+Z5lPCXMpZfaUspcygjw7Uqlh21LxO2Q0Ystq
   ###yjfMl4T1UcKE6RdkWkmlTzwQsKfQspG1FAfC2HfPiOczohhmUZL5C8l5EM24Uo3K
   ###IRvpVVMNCwOteIzO08AMiRs2aZxFNw3qWk10VcK7K2HB82VmWUaU8XE46VynjLXM
   ###SNvwOWE4Rfboue+oatJKq/mAldajLaseGE+qQnKC2H77toQLB3+fYhzGLeQXG0+i
   ###LvdqAolbQ2s28c75nUV0dAYfTnq5l+JgaStlHVCGgQ+w/ua/hi9FS5/nWJ0Zhmal
   ###1HBLqcmnjdHOAMUmsWGGwwHSAXFBJoQ9FQJ3ItQlProTxtf9eyOhU1fkxzTuj5Up
   ###tNgndL8W3yICEfbrFEGc24OEP5RYeP+RmRNAhYaAf5VQR3IR8C4ca6BHJuWI6DHm
   ###16K3YksFzOaQKClrL3hwJr06EmJ2j3QtIoZ8T0MNOT40QxrfO9kXjWx3OQnYImk8
   ###jcajOIhLSs40xW07VL2Gp5Yy/d6EZFIhW4nEE9RYTlkDDEcs8Qq3VpI3Ix2foD29
   ###ivNzThvTh0KcOgfmFHl4uoGFbuO0O4x9FZd2kynNcPlIaT6IMsnF6GO0I2maT9YS
   ###REhV3oe02kOtDSajgEWZlMesvSPQ9q9GERxaAzpewkhak4mDnbrmNQxWrlYY4RC/
   ###GdVXKZwVuTZQNgo1QDbjQI9mtCgiK/Yuye1sr8DHEE1LlhGm6UOdt6LEWhmA9AhR
   ###jMmv0KfrSZLPimC0lP5ATDh5uqUZ+rl2YjxA4FvDURf3W23dwQuKHLRcwYngsBXc
   ###84/DEz50LH7VdItaVCmWyZSpGzjhiKOVUbQ2WTdW56kbq69zKZd9IffIy7gsfq0f
   ###tjGKDlvgwJcI1UxGXB3tVZ1prfwpiCYY8IU9sI2MP9A1HgvX04GPR7/fJTYeI7cI
   ###gpvk3rmuzcFzDATWKNppU/gNN5dOn8IpgDjzD4EDdx7WwGQ53FMqcwvGjsY5SL1Z
   ###aqiy65+tAgt0jolaRKstrsQ+c5t6TR6TI0RFn3g4iNrM+F/Pkvljkfhfda/RaCTi
   ###f3mN6jL/xzL+1zL+1zL+1zL+1zL+1zL+1zL+13PF/3pE3K+dt0cZEb8Skb7mRPhK
   ###PFeBxx4X+4uGOwCiP0bNHY74hUMPUfJnq3hSvZDKWkTWJaMRJG4+328LuxGkuuxy
   ###buqRHaDeTBclPSSv7aOJ1aS42SfCuEcd/jKKbpByvyYpgd3uO6NoPIrIl2wCPQ5H
   ###/dHVvdCuFJhhAFnp/Oj4RzFqrCaZC3izd3B8oWwMHpolUNhrqN9Hhe4tXv/zrQdd
   ###Geq584TN0AGlF6TmxLXB8ZMfOwPh6G3JsYMOUHLpcFi+wiMDOHY4D3DIdEceBUjS
   ###4Xj7FLDXN7YLdJk4DpKJEYioKog7fj8QCWhGt3h5ViZFNByr0eiWrjfFEvFd/D05
   ###XOqrs4I0B6dusFm0P4Bzshf4E7pQIbsiQpV+aGcSF15969g0i9my2K4YhijRcG7a
   ###q7FTdyv0QTXGJkwc5QDOXhUOT08jt7d7lie4YGAKEuP0u5/hnWxrh9ZC6yupXwMI
   ###MMTetN8vs5Fiun8DjxXAk2XQ0p09mAlksgglhiC/PTFdb6XuDOheoFGBD7Lc69Go
   ###K25LR204/8leCpszb/EABJ3A75MpWO7t8Z6a4CEmaiUlHSaIpXq98C7olvm7TWAE
   ###hu9bTE7Mt9qomucmQars2S7BiedCB2E9BwaNhovaAuuFEOZfZMQwMfrgHXeQ8kHm
   ###e4QQaSWVIPM4UuWhLwTt0JJWnhAcpDUbmvCIa2qyliMN2dC6eGZlsKVg66I+FivN
   ###uqlQPySys8rbvE4pQAeb0nwm5WFOV9Q5TJOuE51bhl7fSU1AphL9UDFutLwlGBt1
   ###k9QOKmjAcxHyg906zMB8SiMKhxNz2fDXDKHWkwEZyesIASOykwopI0YERy3iCizR
   ###IOz7Ebo6JW/3WS+c7iIKyqZiXjn6k77QvBhTgTQTUMzLUH/oTMOx/2S4GuqzxOmt
   ###gGMfKTtB1tmPjCsB1OaXZUNd0dCDi4/bevMJOEHRDhJIoZLmSpTIm/gzoLHlsIB8
   ###TnqmRCM4IbzAKTkzkWsWUnGUmOwhyZuyWNiloVqZ7HT/FShgW/i04pyO2E+N70d6
   ###U4r3KHRNMWu+w1gImGipdU1nqExUXAKRBO8C8F5ApOfVVwoDv0vCH8gp4cS2fLMG
   ###QWSif+vfE+GUV9lwegk0IfM8us2Hxsm1gYRJrBZPeyD9hOp6ZyTeANklpTm00Bnf
   ###5/JaRcxsixk8R0wpHg3UtYvW7YrrVLxmUd7eyTu/fDIexw5ZrgWkfRDVZcxMGQxB
   ###3N1GQJsHAzY3Jn0uAXSigySKSydyBhYjFZdewwAJJ8jdKyJUKodfGNAZIXpFIoCr
   ###duvzJZuYqjQyTmyZrMvMUtrBXJj2WNeYs2sZsQp0DIUF6wobb7Z0Jr45P3dX6Dn5
   ###0ZU2QYoz3M2dHLAweV3YiO9AhxabdxMj4CLkMFID7zwXC7BN060d8oIQFeNlxGZM
   ###DN2HMQ9SXLHCIcP9pJT2GaAbnEyHAT5zg4DPbzMGDQ6HHpoWFaQCU86uSvdCWvSA
   ###ojeJODB0RMWcfluY7644J4hlRlm7mMRPkX2dr0inEd8jGp6KTAZGYrB09UuXTgY6
   ###ACkTQVll3BvKcQ+P6VwyLoCRY5AO89qNOQfsW8mB/3HhPPhXq2CDxMrlyZ6Xzlm8
        
   ###xzIl1mZxwqvNIy26m7aafIDsZpLcxeCUpMa678WIsYTG4uiRMenXC056MQRR1+1m
   ###SGGgVx3cv1diI/yAV7KR5CvYmkDY8wE5vEIvBSBtgC+ksaQm4FlInixK959QcTG1
   ###ZNUVDmLIK6BMqyawF69CpA+Ju0Rsvo+cRcePAyZbV8QTRbIyNT0dIgHDwiuLoeqx
   ###PXPZHd9f4/2qecH6iMu0pMmthb2z7HGfyjpkr2ISb5O9Loa9XwNAr+cB6PWjAPQo
   ###goguoCO0OZiibSPdRygXx69FC/cv3j8XLYSmLDQyTK6/gPrNBkoSgaC/BdlPOenF
   ###0cGc2+uH5iYX3XbYUWZUhq0LTJ8+Z5lPCXMpZfaUspcygjw7Uqlh21LxO2Q0Ystq
   ###yjfMl4T1UcKE6RdkWkmlTzwQsKfQspG1FAfC2HfPiOczohhmUZL5C8l5EM24Uo3K
   ###IRvpVVMNCwOteIzO08AMiRs2aZxFNw3qWk10VcK7K2HB82VmWUaU8XE46VynjLXM
   ###SNvwOWE4Rfboue+oatJKq/mAldajLaseGE+qQnKC2H77toQLB3+fYhzGLeQXG0+i
   ###LvdqAolbQ2s28c75nUV0dAYfTnq5l+JgaStlHVCGgQ+w/ua/hi9FS5/nWJ0Zhmal
   ###1HBLqcmnjdHOAMUmsWGGwwHSAXFBJoQ9FQJ3ItQlProTxtf9eyOhU1fkxzTuj5Up
   ###tNgndL8W3yICEfbrFEGc24OEP5RYeP+RmRNAhYaAf5VQR3IR8C4ca6BHJuWI6DHm
   ###16K3YksFzOaQKClrL3hwJr06EmJ2j3QtIoZ8T0MNOT40QxrfO9kXjWx3OQnYImk8
   ###jcajOIhLSs40xW07VL2Gp5Yy/d6EZFIhW4nEE9RYTlkDDEcs8Qq3VpI3Ix2foD29
   ###ivNzThvTh0KcOgfmFHl4uoGFbuO0O4x9FZd2kynNcPlIaT6IMsnF6GO0I2maT9YS
   ###REhV3oe02kOtDSajgEWZlMesvSPQ9q9GERxaAzpewkhak4mDnbrmNQxWrlYY4RC/
   ###GdVXKZwVuTZQNgo1QDbjQI9mtCgiK/Yuye1sr8DHEE1LlhGm6UOdt6LEWhmA9AhR
   ###jMmv0KfrSZLPimC0lP5ATDh5uqUZ+rl2YjxA4FvDURf3W23dwQuKHLRcwYngsBXc
   ###84/DEz50LH7VdItaVCmWyZSpGzjhiKOVUbQ2WTdW56kbq69zKZd9IffIy7gsfq0f
   ###tjGKDlvgwJcI1UxGXB3tVZ1prfwpiCYY8IU9sI2MP9A1HgvX04GPR7/fJTYeI7cI
   ###gpvk3rmuzcFzDATWKNppU/gNN5dOn8IpgDjzD4EDdx7WwGQ53FMqcwvGjsY5SL1Z
   ###aqiy65+tAgt0jolaRKstrsQ+c5t6TR6TI0RFn3g4iNrM+F/Pkvljkfhfda/RaCTi
   ###f3mN6jL/xzL+1zL+1zL+1zL+1zL+1zL+1zL+13PF/3pE3K+dt0cZEb8Skb7mRPhK
   ###PFeBxx4X+4uGOwCiP0bNHY74hUMPUfJnq3hSvZDKWkTWJaMRJG4+328LuxGkuuxy
   ###buqRHaDeTBclPSSv7aOJ1aS42SfCuEcd/jKKbpByvyYpgd3uO6NoPIrIl2wCPQ5H
   ###/dHVvdCuFJhhAFnp/Oj4RzFqrCaZC3izd3B8oWwMHpolUNhrqN9Hhe4tXv/zrQdd
   ###Geq584TN0AGlF6TmxLXB8ZMfOwPh6G3JsYMOUHLpcFi+wiMDOHY4D3DIdEceBUjS
   ###4Xj7FLDXN7YLdJk4DpKJEYioKog7fj8QCWhGt3h5ViZFNByr0eiWrjfFEvFd/D05
   ###XOqrs4I0B6dusFm0P4Bzshf4E7pQIbsiQpV+aGcSF15969g0i9my2K4YhijRcG7a
   ###q7FTdyv0QTXGJkwc5QDOXhUOT08jt7d7lie4YGAKEuP0u5/hnWxrh9ZC6yupXwMI
   ###MMTetN8vs5Fiun8DjxXAk2XQ0p09mAlksgglhiC/PTFdb6XuDOheoFGBD7Lc69Go
   ###K25LR204/8leCpszb/EABJ3A75MpWO7t8Z6a4CEmaiUlHSaIpXq98C7olvm7TWAE
   ###hu9bTE7Mt9qomucmQars2S7BiedCB2E9BwaNhovaAuuFEOZfZMQwMfrgHXeQ8kHm
   ###e4QQaSWVIPM4UuWhLwTt0JJWnhAcpDUbmvCIa2qyliMN2dC6eGZlsKVg66I+FivN
   ###uqlQPySys8rbvE4pQAeb0nwm5WFOV9Q5TJOuE51bhl7fSU1AphL9UDFutLwlGBt1
   ###k9QOKmjAcxHyg906zMB8SiMKhxNz2fDXDKHWkwEZyesIASOykwopI0YERy3iCizR
   ###IOz7Ebo6JW/3WS+c7iIKyqZiXjn6k77QvBhTgTQTUMzLUH/oTMOx/2S4GuqzxOmt
   ###gGMfKTtB1tmPjCsB1OaXZUNd0dCDi4/bevMJOEHRDhJIoZLmSpTIm/gzoLHlsIB8
   ###TnqmRCM4IbzAKTkzkWsWUnGUmOwhyZuyWNiloVqZ7HT/FShgW/i04pyO2E+N70d6
   ###U4r3KHRNMWu+w1gImGipdU1nqExUXAKRBO8C8F5ApOfVVwoDv0vCH8gp4cS2fLMG
   ###QWSif+vfE+GUV9lwegk0IfM8us2Hxsm1gYRJrBZPeyD9hOp6ZyTeANklpTm00Bnf
   ###5/JaRcxsixk8R0wpHg3UtYvW7YrrVLxmUd7eyTu/fDIexw5ZrgWkfRDVZcxMGQxB
   ###3N1GQJsHAzY3Jn0uAXSigySKSydyBhYjFZdewwAJJ8jdKyJUKodfGNAZIXpFIoCr
   ###duvzJZuYqjQyTmyZrMvMUtrBXJj2WNeYs2sZsQp0DIUF6wobb7Z0Jr45P3dX6Dn5
   ###0ZU2QYoz3M2dHLAweV3YiO9AhxabdxMj4CLkMFID7zwXC7BN060d8oIQFeNlxGZM
   ###DN2HMQ9SXLHCIcP9pJT2GaAbnEyHAT5zg4DPbzMGDQ6HHpoWFaQCU86uSvdCWvSA
   ###ojeJODB0RMWcfluY7644J4hlRlm7mMRPkX2dr0inEd8jGp6KTAZGYrB09UuXTgY6
   ###ACkTQVll3BvKcQ+P6VwyLoCRY5AO89qNOQfsW8mB/3HhPPhXq2CDxMrlyZ6Xzlm8
        
   ###w3yV2AZ92FwWuWaspAotMVIz0T1zUqjcuWvx5weR1Nma9rf5Qz/cNlqWuKNHR1fZ
   ###KrMN3YARJFTQ2gR88lur0KRqWw9UNt2VjrmC1ol+h8pOOYe7RBxJidYEjytawnAD
   ###QEsin0xR2K9mkhEEGcODsWLKbk0DTLYoHdmSIQ1MlBRNyftK0UDO9dYaMgBCbNJV
   ###cwqrAuxJ4pNj6cQCJ4JFHaisFkyMisPdAtrJIQmizkPSTh6iCSYpW+1tMZFhcOWj
   ###BLq12t5W0UdArGcWiabsi3iLFBp51CHv4K667jXb5SMoBuqEYysZVvUMn+4o4Mte
   ###NLwWBhhCyCeldG7/4n1eb843Q6G7TRzUePNK6Xsw7gS0hFfLoVoakcRe7MqHThiZ
   ###8h6+z9owR9ZxTBfWzE2KfZ/mqfKmpXg2H1qSliBD4lxInGKcEeySH6OygGj/GLij
   ###IbKefQ53LXkAwZnQIuGoQJ4nVGADWcWekp4F7018DiGDTdB8NTfGllasI1dcipC9
   ###SIay+TXDxABYJT8cxmrLET1X1iMwe7P6is38hDzpIZvxB0IUFcuIo+yjIcY4VFEJ
   ###pDlQApql1Arw8FVmLo7dbnLXxufNF9a1p0qvleJr8Y3Bbgu1l4DSjhIrWMckRYXY
   ###kB8V9GhHRjJkNUxUGrpQdMJXQuSmUzPb/QrNm2OAEhxCc8yecXnJ9OIFGWSJo58V
   ###PsHwmrQ/tHB2BIA2K3bKZELQC/sTjsQhtB0osQzGQArCfxEykRppwtO+9iPg/MIO
   ###dPFmzNdbsISIfELJiEyQ0pvAzyxzeeEug7HwHf8KEWxiqjZWRHbiMBbtkNMkYfP9
   ###mMyHMDJnIoT3rohjo7hrAgDqNEpyXgg8gCOptQQQYyO2EnGxMd4tGsZZyv+HYLgy
   ###d+3Y1W3xxZOhQOmualjmYJBiFYFpugmkqk2CQwOCAzySDgpVO6KVHD1epYbytHlx
   ###+jouKOsNrQim2iwITedFO0TXXFJN0ZWZ9qKZD4AsJ72ONrgGZrYsPIVwHiwQUofC
   ###6JlXgxVsiaCeeBQHd0K2IDVcH+/5AP+Amk4xbIM1vsdFyMjsERVFIGMJ1QQfRE5O
   ###RU0EbCMJmqOLErvqkIXIYZwdgstSiLKC2NiVuR/+lU+2JKlRwtxEuxepAjl31csj
   ###iMw2k82ZLmV2i3uaPDm52XRpdQ7ary6MEdY0yf7IsqmRNkgsaahEIy+U7f0ZsDRR
   ###lxw9xF6PLcgiigsuSsGHHa6RkZhIVb6hySTtOJl3spEoCl2R1NkntMUjMxaWal+E
   ###6VGhiAqqR+I6R8jP3AqtIimfMHqdQMCQzsvY75GiQOgoEM2EPZrQuqvQuzg/OIYt
   ###pkVirqX3XHmRtPmxFFBZfAsldjbMkQ/JwJMzTCoFknpiainVwwKt2QtpuHRkHpVk
   ###JotBo/v3BgOTVj5eaO6HlJqCmwTqPFGimdQOKcNBfJ95stumrMrzmoRUO5gzcsci
   ###pF8IQL0dylGO2MgQHflg2Vn/Np9pARZwhvpMCqZonzKxYZKySpajSZv27l0cm76I
   ###vMMBMriLjGXWhq8pBe8zkaznpllPI1rZ9GoGqVqQSglrOhB9VJ6i82mHbhIwq1GS
   ###PiU3W4rTJNmB9om1D+NJ6cnbTm0zbi1WHLnWmNNmEimCDEGdtpE0iOype6mkBhe1
   ###kyYScJOHqJhnoaLElrNIqIRDsxD2jBhyLupGvBoqSNYrpGTaaIjwrG9FEGAKN2Vq
   ###DYi+Mx9SATYkBzWV8kD2mKcTmo2N2f7eIorEummVKjploZSrw67Fz7eDxp2BtYXc
   ###hqx3ZG0ZUuD2Ax9NbuDQ8LTEsSICKiKN0utUkO8L+G3Uy+kO0nvPWN5Zu0+CcEzw
   ###ESZIMzcgnc6kXsH20FZUhbNijlnY7Ts5lagX9S1Yo8XqCxTj0wNNFLIHu5O4eCGU
   ###FB1t4mXc9xMii8nQqWYcQGUFK2Aq3dQ5XZYYMypssf/8U7bznI3MlrWGPq0A2KG3
   ###r6HWe5FKRewUcIy6sA2p+dudEb5n3/5KsWVJCP5cQkDL8JVoALW93P5/5fYXmvCH
   ###iABr0Z9//x9Ggd79sm/NUSc5YWZJUwEcZ+P4ueFCRxn4VtIQQeeAbGVrAiBy0G/Z
   ###Kklk7JEOG8K1NaVHpMGSay5pmeRdcxCzGjGetmP8ivyQyjCANEY62PKtJobRTidA
   ###MFj3RL6bB1g4vD5MLrdwVqWhlZyVlRXTYyJt3SKdlmjC+0GWdYsdu8W0YCHZMduM
   ###xekGj7BiWdCCRXoaF6Bxfor2b0m32ywLlplGK8YFFRkrxfJeJi3FS1FvvYIRBCgU
   ###PPxp0B+vRn9g69bwtWpPi+Rx4j7FEDywmpdXdUR+TtT2XI/6bBRu+QhRRAmHA1j1
   ###0XYhJy9KQSbAu3AWC3SLyZsTvu8dBreo8haXC7aTJO81ZWMjVz7L5iUB969t8/Jl
   ###9i5pDDLtXeRUZtm7MLY9YO8iGyH5iqy/TFSciYIzRrCIeYu1dH+VeYuNP3+mecvF
   ###SHSeuFXnh8atOj+Ye6vuS8U/KZrVne7sm3ODy7HWny/Q5T05HPwl6UbLt+YG9mST
   ###I7V5Z15Ai9swnbTGuoJW9fFuX1Qmm4HUna5oR/vDco+qAen+Ky/TrURdi93X25DX
   ###hElCwrgMf+Rlvb4n79HFj7iPFoMUFgYEL/sSXCGHugSXY5x3Ca6GkLfGoB2kZSA1
   ###4zqcLnR9IxeMvAQXN9bpC2+871ZnJT2RGl2NCzq3snJz5hUxU3IIZW88oLhiI32c
   ###WGu48uKFdftqk5NH376K6s92+2qfL6UUjZ15+7pvsDbic9J9lXBPj30/mQV65ekK
   ###RZvzx47mMHQpsp9x+zvv0jdrzf4NNKqzr1ueouG0zvcs1uRxes3H3xxkbhy5Qx6+
   ###KEgiwde6KFhwb8lh/DkXBGLh5Prv/3vh83Po5S2+UUnyCqEX1MsrfN0XLJGpknvq
   ###AqTqZWphWK0kFBpsJeA7p++Oj8WtWcQsPlt7mQYWqeaRZZm1HCrhj+iokKYos7Xf
   ###QlG0uOpLpD15Dh14ttpLZncYGUFVnBiAQyyPVNVw6hWtezQNBw0laQ6EUrT1JLtu
        
   ###w3yV2AZ92FwWuWaspAotMVIz0T1zUqjcuWvx5weR1Nma9rf5Qz/cNlqWuKNHR1fZ
   ###KrMN3YARJFTQ2gR88lur0KRqWw9UNt2VjrmC1ol+h8pOOYe7RBxJidYEjytawnAD
   ###QEsin0xR2K9mkhEEGcODsWLKbk0DTLYoHdmSIQ1MlBRNyftK0UDO9dYaMgBCbNJV
   ###cwqrAuxJ4pNj6cQCJ4JFHaisFkyMisPdAtrJIQmizkPSTh6iCSYpW+1tMZFhcOWj
   ###BLq12t5W0UdArGcWiabsi3iLFBp51CHv4K667jXb5SMoBuqEYysZVvUMn+4o4Mte
   ###NLwWBhhCyCeldG7/4n1eb843Q6G7TRzUePNK6Xsw7gS0hFfLoVoakcRe7MqHThiZ
   ###8h6+z9owR9ZxTBfWzE2KfZ/mqfKmpXg2H1qSliBD4lxInGKcEeySH6OygGj/GLij
   ###IbKefQ53LXkAwZnQIuGoQJ4nVGADWcWekp4F7018DiGDTdB8NTfGllasI1dcipC9
   ###SIay+TXDxABYJT8cxmrLET1X1iMwe7P6is38hDzpIZvxB0IUFcuIo+yjIcY4VFEJ
   ###pDlQApql1Arw8FVmLo7dbnLXxufNF9a1p0qvleJr8Y3Bbgu1l4DSjhIrWMckRYXY
   ###kB8V9GhHRjJkNUxUGrpQdMJXQuSmUzPb/QrNm2OAEhxCc8yecXnJ9OIFGWSJo58V
   ###PsHwmrQ/tHB2BIA2K3bKZELQC/sTjsQhtB0osQzGQArCfxEykRppwtO+9iPg/MIO
   ###dPFmzNdbsISIfELJiEyQ0pvAzyxzeeEug7HwHf8KEWxiqjZWRHbiMBbtkNMkYfP9
   ###mMyHMDJnIoT3rohjo7hrAgDqNEpyXgg8gCOptQQQYyO2EnGxMd4tGsZZyv+HYLgy
   ###d+3Y1W3xxZOhQOmualjmYJBiFYFpugmkqk2CQwOCAzySDgpVO6KVHD1epYbytHlx
   ###+jouKOsNrQim2iwITedFO0TXXFJN0ZWZ9qKZD4AsJ72ONrgGZrYsPIVwHiwQUofC
   ###6JlXgxVsiaCeeBQHd0K2IDVcH+/5AP+Amk4xbIM1vsdFyMjsERVFIGMJ1QQfRE5O
   ###RU0EbCMJmqOLErvqkIXIYZwdgstSiLKC2NiVuR/+lU+2JKlRwtxEuxepAjl31csj
   ###iMw2k82ZLmV2i3uaPDm52XRpdQ7ary6MEdY0yf7IsqmRNkgsaahEIy+U7f0ZsDRR
   ###lxw9xF6PLcgiigsuSsGHHa6RkZhIVb6hySTtOJl3spEoCl2R1NkntMUjMxaWal+E
   ###6VGhiAqqR+I6R8jP3AqtIimfMHqdQMCQzsvY75GiQOgoEM2EPZrQuqvQuzg/OIYt
   ###pkVirqX3XHmRtPmxFFBZfAsldjbMkQ/JwJMzTCoFknpiainVwwKt2QtpuHRkHpVk
   ###JotBo/v3BgOTVj5eaO6HlJqCmwTqPFGimdQOKcNBfJ95stumrMrzmoRUO5gzcsci
   ###pF8IQL0dylGO2MgQHflg2Vn/Np9pARZwhvpMCqZonzKxYZKySpajSZv27l0cm76I
   ###vMMBMriLjGXWhq8pBe8zkaznpllPI1rZ9GoGqVqQSglrOhB9VJ6i82mHbhIwq1GS
   ###PiU3W4rTJNmB9om1D+NJ6cnbTm0zbi1WHLnWmNNmEimCDEGdtpE0iOype6mkBhe1
   ###kyYScJOHqJhnoaLElrNIqIRDsxD2jBhyLupGvBoqSNYrpGTaaIjwrG9FEGAKN2Vq
   ###DYi+Mx9SATYkBzWV8kD2mKcTmo2N2f7eIorEummVKjploZSrw67Fz7eDxp2BtYXc
   ###hqx3ZG0ZUuD2Ax9NbuDQ8LTEsSICKiKN0utUkO8L+G3Uy+kO0nvPWN5Zu0+CcEzw
   ###ESZIMzcgnc6kXsH20FZUhbNijlnY7Ts5lagX9S1Yo8XqCxTj0wNNFLIHu5O4eCGU
   ###FB1t4mXc9xMii8nQqWYcQGUFK2Aq3dQ5XZYYMypssf/8U7bznI3MlrWGPq0A2KG3
   ###r6HWe5FKRewUcIy6sA2p+dudEb5n3/5KsWVJCP5cQkDL8JVoALW93P5/5fYXmvCH
   ###iABr0Z9//x9Ggd79sm/NUSc5YWZJUwEcZ+P4ueFCRxn4VtIQQeeAbGVrAiBy0G/Z
   ###Kklk7JEOG8K1NaVHpMGSay5pmeRdcxCzGjGetmP8ivyQyjCANEY62PKtJobRTidA
   ###MFj3RL6bB1g4vD5MLrdwVqWhlZyVlRXTYyJt3SKdlmjC+0GWdYsdu8W0YCHZMduM
   ###xekGj7BiWdCCRXoaF6Bxfor2b0m32ywLlplGK8YFFRkrxfJeJi3FS1FvvYIRBCgU
   ###PPxp0B+vRn9g69bwtWpPi+Rx4j7FEDywmpdXdUR+TtT2XI/6bBRu+QhRRAmHA1j1
   ###0XYhJy9KQSbAu3AWC3SLyZsTvu8dBreo8haXC7aTJO81ZWMjVz7L5iUB969t8/Jl
   ###9i5pDDLtXeRUZtm7MLY9YO8iGyH5iqy/TFSciYIzRrCIeYu1dH+VeYuNP3+mecvF
   ###SHSeuFXnh8atOj+Ye6vuS8U/KZrVne7sm3ODy7HWny/Q5T05HPwl6UbLt+YG9mST
   ###I7V5Z15Ai9swnbTGuoJW9fFuX1Qmm4HUna5oR/vDco+qAen+Ky/TrURdi93X25DX
   ###hElCwrgMf+Rlvb4n79HFj7iPFoMUFgYEL/sSXCGHugSXY5x3Ca6GkLfGoB2kZSA1
   ###4zqcLnR9IxeMvAQXN9bpC2+871ZnJT2RGl2NCzq3snJz5hUxU3IIZW88oLhiI32c
   ###WGu48uKFdftqk5NH376K6s92+2qfL6UUjZ15+7pvsDbic9J9lXBPj30/mQV65ekK
   ###RZvzx47mMHQpsp9x+zvv0jdrzf4NNKqzr1ueouG0zvcs1uRxes3H3xxkbhy5Qx6+
   ###KEgiwde6KFhwb8lh/DkXBGLh5Prv/3vh83Po5S2+UUnyCqEX1MsrfN0XLJGpknvq
   ###AqTqZWphWK0kFBpsJeA7p++Oj8WtWcQsPlt7mQYWqeaRZZm1HCrhj+iokKYos7Xf
   ###QlG0uOpLpD15Dh14ttpLZncYGUFVnBiAQyyPVNVw6hWtezQNBw0laQ6EUrT1JLtu
        
   ###kUEJj1hhNCBO/fRqCs4HpBsb6od9/8rJVVbdPC6d1HcIM717aV0z265GBIjlCYje
   ###yZQP5IsYc5JJW0k9dYPjizWbQlfawN/dBhy3UbBW6njVsJVVVOTex2/BOZuP1Whz
   ###VWTI6lsb9UGNOz7TS5CxgQ1dOAkpCZ26kYrtf9jenr21LX32V9nVD2u1lxv632RD
   ###J7XjX7StF9Ghz9jRD2ucTdnpT9I4G44SCzAnUuNsgjBL45y+FpA10tcCNhM671og
   ###Qccedy0guzGvBYxpqEXyMTyFpLpS4Ea9Amqspb8h78UVpVcUrbPWVvg7s55tNA6E
   ###PoPoEhuposkVupVYfHyXZXfTYn0qLS2TaRSMR9rOnRRlar/FJUPvizFYmFAzkqgv
   ###ODMVJjAUVF4rLx48GN4YUOKVGCMAuwvQfSl8a22VSenhV2sy6qQ6vHizJ0efriRI
   ###pKrzobZ+SfXwYsUfx1POTM3F0tXVZSUFmtOV2UVaO8o93JI4wFqjXg+lpoR0a6p0
   ###lW5kJFU8fCGIJ33C30NdEdq0Uqun9GhmbGNuqUVLRPRwPuUzCV+ijFie0sxGeCwI
   ###QypDECVAqkckZNuAepEKMGaYOmoV01MxNC2sZSY6OtXe9zkr9Xx+XgNG2qOToBvC
   ###olADjYUbUMmMfgm7AVdeX7iynQ7pfApU51Y1YyeOn9uOypF0OO33ubadHj6j9tHp
   ###zzvHR/siBrZI+Gr7QwlDj6TiktcUMEflhJEZceYjMOomFGbkZiJxCpuGc0wPSHn7
   ###PBj2aE0F7GyMQZHNAaWG+ndZATGwFgxMqM1nkxNbbzFnYZS65RnXIw3TlJb2Lwbl
   ###sN2SQ3oSOouDLxw+CDFxmDwGh9NH97EyZJkPZvN4/FsAmQeUCWIu+OGyJI+9BajH
   ###ImeSEMIeLYf/qQtl5YP5i1bKVDzDUokhibVKXt6XnEXXcIbxixkOxjmzYsPYsV3Y
   ###ndUobIYymaDvRHSF6v3+JESvRmN9YhnPFW39+ta9KmU1InFgwhlJoFwMB8LErk+S
   ###OeZNNrXu7SAYcq86OjFML+MGzJxW6sEsT0RzrvpCSsReTV24WF0U0g2QNjtdMBo/
   ###pTFxj5M1Fi3nWTVMYe+hEWRDAKSzzNqlObyzSUHMHowzMN0RctQUrWtGdyHlqLkK
   ###h/wxGHZLszsf+HcZ/c9eY00aF4HUQ/OYMYMFRvuk2L4LxPR9zI8V/zcO+zctDjka
   ###rwxu/pz4v65XbbgU/7fWcD2v4v1Hxa1WGpVl/N8/4+fbdPhfNx3+NxG3d0as329f
   ###fPt8sXu/TcTupcafIXjvt88SvPdbI3gvjeyLo/d++6XRe2cM4/Hhe799nvC93z5T
   ###+F4xry+P3/vtc8Tv/fZZ4vd+a8fv5Y3zDAF8v32eAL7fPlcA32+fNYDvt88YwPfb
   ###5wng++2zBPD99tkC+H77TAF8v32WAL7ffmEA3xcYKLZ1/ubdGQDPaTr/9QI5lNW9
   ###09crHfmFLp6Q1Yr1M+TDpYSln4pLKpDbgtRD9tlMPtWBsFKv6Po3SD8fT/tx+nHU
   ###ioHv7NnPWztvj/QDzPaUfJDZkXie7AhDebQ+Tv3hxIQDjH08osS06uHx25aM0trq
   ###AN3r9fS70+PzQwE44+H5T9YXKNDHQvrh2+M9/SW+Dvr9VgL2Ewox0cJBph4eX7xN
   ###PaOB7O22TndbJ7sz3/6SfkWnS+oppZtp9f2r9BsCI2n12v1R50YX+Hln38Qy8nZq
   ###cSgvpY3VBQjyOBWao7EuP//U+uXEn7QODBD98NAS8BonHv78U+LBdIhCR2r1aHGS
   ###qCC8WAh0xug4wEHr+Kw1GbVOzlMvTs7xxfGZAQlKGyPhwS6OKTCdn54ldqN0L0oV
   ###5WDP6vGOhyPU3/2h38JAOQjzm5arX7RDmGG35feN7tu3wd3YxxyjraqX9djcf+3p
   ###VXr3Ip6YIx9CU3jet0RSaf0O2GCvPzKagC9e30Tv47d7LRh+/z4O4xYH+7FfhsNP
   ###0HjQzdoWLVzLzii2V9fbSax2DIVDtElM4UrrNiD+HLA+GoW+gQm0F4J40uItoN8A
   ###J09qqCjjUas7uh16rerMV1kvgOn5BLSntXM29zXWbx0enc0rc3R09lCR6dhr/fBT
   ###VgngzwzMDq8GrZ/cuvFkFBlIFE8HrfgjUOzrsDdJbQiJKJGJC+KdpMxZ73pAx+lN
   ###2AFWM/WayQfXfGGfezDt93BcqtOP4kmvIqVJIBcW1A3rYhR8vNWZRP2sEqjGBPoU
   ###hXdZb81geVnvaVqIyzPfwQBmvVNUOZ5dBLdHZxT0MosMR2EMh/+1Pw40MDLKQSuz
   ###QSQpI9HtrAJRcIUJPWGTtcg6qM8mDNlF47A79fsttDO5uncbCxTKKhKP+p+QBGS9
   ###A/liDEDx4dwwhpNVkrKIAm80DFogo8Euyywk2sl6155GVy2WlqHHjAI3nj/r8U/Z
   ###k+c1V4uFzFhWsU8BbpPWaJwJ5rhzPY0atZmv+EVyGx2/2bkwthGaNmWB6NjgRriQ
   ###uUXSb+0tkn6vt8isd7hFZrwzt8isIsYWSRfJOIQyi2WRk+xiJjlJl8jekulyxpbM
   ###emltyXSBmVsyq2hit6WL6N2Wfjdrt2WUjACZQFTIerdA9cReyyigmZtMLJw1O83E
   ###TDuTrAK0idOP+8EngP5o2J1G7XA4C7csHiZzLbM2fMYaMFaNxvctsfdnFpr3njZ/
   ###1gpHYuov/mP5M1P/3wn6k9Wvoxpfw7x+mfp//sz5/7y6W1n7j4rrVqq1/3DqS/3/
   ###X7D+nz4+Y+rHBe5/Kg2v6ibyP7r1hre8//mL8j9W1tIXQHvnR2dvMtNAPinvI6V6
   ###xLt8kZgLcY6+cVqun4nCOyQUhbHlIC2P8xfLdJHLdJHLdJHLdJHLdJHLdJHPly5S
   ###Znr8+ScjzyN9MbI5Buid3rEzPMIz1GNbzzi8HaZ75IgGV0E78nFz4p1D+ZN1yAFB
   ###Zf959uu744QF477f0bkX4+kAiIlyYCHJiqOKo5kiUl15UvKtBnupiUDH6DUD9Bip
   ###xgT9doKPU+HQjdlvVpTrPZFZ6W3D+Q+wuIj+TjG/KSwPe/GhX8/e23dmIO47OBL4
        
   ###kUEJj1hhNCBO/fRqCs4HpBsb6od9/8rJVVbdPC6d1HcIM717aV0z265GBIjlCYje
   ###yZQP5IsYc5JJW0k9dYPjizWbQlfawN/dBhy3UbBW6njVsJVVVOTex2/BOZuP1Whz
   ###VWTI6lsb9UGNOz7TS5CxgQ1dOAkpCZ26kYrtf9jenr21LX32V9nVD2u1lxv632RD
   ###J7XjX7StF9Ghz9jRD2ucTdnpT9I4G44SCzAnUuNsgjBL45y+FpA10tcCNhM671og
   ###Qccedy0guzGvBYxpqEXyMTyFpLpS4Ea9Amqspb8h78UVpVcUrbPWVvg7s55tNA6E
   ###PoPoEhuposkVupVYfHyXZXfTYn0qLS2TaRSMR9rOnRRlar/FJUPvizFYmFAzkqgv
   ###ODMVJjAUVF4rLx48GN4YUOKVGCMAuwvQfSl8a22VSenhV2sy6qQ6vHizJ0efriRI
   ###pKrzobZ+SfXwYsUfx1POTM3F0tXVZSUFmtOV2UVaO8o93JI4wFqjXg+lpoR0a6p0
   ###lW5kJFU8fCGIJ33C30NdEdq0Uqun9GhmbGNuqUVLRPRwPuUzCV+ijFie0sxGeCwI
   ###QypDECVAqkckZNuAepEKMGaYOmoV01MxNC2sZSY6OtXe9zkr9Xx+XgNG2qOToBvC
   ###olADjYUbUMmMfgm7AVdeX7iynQ7pfApU51Y1YyeOn9uOypF0OO33ubadHj6j9tHp
   ###zzvHR/siBrZI+Gr7QwlDj6TiktcUMEflhJEZceYjMOomFGbkZiJxCpuGc0wPSHn7
   ###PBj2aE0F7GyMQZHNAaWG+ndZATGwFgxMqM1nkxNbbzFnYZS65RnXIw3TlJb2Lwbl
   ###sN2SQ3oSOouDLxw+CDFxmDwGh9NH97EyZJkPZvN4/FsAmQeUCWIu+OGyJI+9BajH
   ###ImeSEMIeLYf/qQtl5YP5i1bKVDzDUokhibVKXt6XnEXXcIbxixkOxjmzYsPYsV3Y
   ###ndUobIYymaDvRHSF6v3+JESvRmN9YhnPFW39+ta9KmU1InFgwhlJoFwMB8LErk+S
   ###OeZNNrXu7SAYcq86OjFML+MGzJxW6sEsT0RzrvpCSsReTV24WF0U0g2QNjtdMBo/
   ###pTFxj5M1Fi3nWTVMYe+hEWRDAKSzzNqlObyzSUHMHowzMN0RctQUrWtGdyHlqLkK
   ###h/wxGHZLszsf+HcZ/c9eY00aF4HUQ/OYMYMFRvuk2L4LxPR9zI8V/zcO+zctDjka
   ###rwxu/pz4v65XbbgU/7fWcD2v4v1Hxa1WGpVl/N8/4+fbdPhfNx3+NxG3d0as329f
   ###fPt8sXu/TcTupcafIXjvt88SvPdbI3gvjeyLo/d++6XRe2cM4/Hhe799nvC93z5T
   ###+F4xry+P3/vtc8Tv/fZZ4vd+a8fv5Y3zDAF8v32eAL7fPlcA32+fNYDvt88YwPfb
   ###5wng++2zBPD99tkC+H77TAF8v32WAL7ffmEA3xcYKLZ1/ubdGQDPaTr/9QI5lNW9
   ###09crHfmFLp6Q1Yr1M+TDpYSln4pLKpDbgtRD9tlMPtWBsFKv6Po3SD8fT/tx+nHU
   ###ioHv7NnPWztvj/QDzPaUfJDZkXie7AhDebQ+Tv3hxIQDjH08osS06uHx25aM0trq
   ###AN3r9fS70+PzQwE44+H5T9YXKNDHQvrh2+M9/SW+Dvr9VgL2Ewox0cJBph4eX7xN
   ###PaOB7O22TndbJ7sz3/6SfkWnS+oppZtp9f2r9BsCI2n12v1R50YX+Hln38Qy8nZq
   ###cSgvpY3VBQjyOBWao7EuP//U+uXEn7QODBD98NAS8BonHv78U+LBdIhCR2r1aHGS
   ###qCC8WAh0xug4wEHr+Kw1GbVOzlMvTs7xxfGZAQlKGyPhwS6OKTCdn54ldqN0L0oV
   ###5WDP6vGOhyPU3/2h38JAOQjzm5arX7RDmGG35feN7tu3wd3YxxyjraqX9djcf+3p
   ###VXr3Ip6YIx9CU3jet0RSaf0O2GCvPzKagC9e30Tv47d7LRh+/z4O4xYH+7FfhsNP
   ###0HjQzdoWLVzLzii2V9fbSax2DIVDtElM4UrrNiD+HLA+GoW+gQm0F4J40uItoN8A
   ###J09qqCjjUas7uh16rerMV1kvgOn5BLSntXM29zXWbx0enc0rc3R09lCR6dhr/fBT
   ###VgngzwzMDq8GrZ/cuvFkFBlIFE8HrfgjUOzrsDdJbQiJKJGJC+KdpMxZ73pAx+lN
   ###2AFWM/WayQfXfGGfezDt93BcqtOP4kmvIqVJIBcW1A3rYhR8vNWZRP2sEqjGBPoU
   ###hXdZb81geVnvaVqIyzPfwQBmvVNUOZ5dBLdHZxT0MosMR2EMh/+1Pw40MDLKQSuz
   ###QSQpI9HtrAJRcIUJPWGTtcg6qM8mDNlF47A79fsttDO5uncbCxTKKhKP+p+QBGS9
   ###A/liDEDx4dwwhpNVkrKIAm80DFogo8Euyywk2sl6155GVy2WlqHHjAI3nj/r8U/Z
   ###k+c1V4uFzFhWsU8BbpPWaJwJ5rhzPY0atZmv+EVyGx2/2bkwthGaNmWB6NjgRriQ
   ###uUXSb+0tkn6vt8isd7hFZrwzt8isIsYWSRfJOIQyi2WRk+xiJjlJl8jekulyxpbM
   ###emltyXSBmVsyq2hit6WL6N2Wfjdrt2WUjACZQFTIerdA9cReyyigmZtMLJw1O83E
   ###TDuTrAK0idOP+8EngP5o2J1G7XA4C7csHiZzLbM2fMYaMFaNxvctsfdnFpr3njZ/
   ###1gpHYuov/mP5M1P/3wn6k9Wvoxpfw7x+mfp//sz5/7y6W1n7j4rrVqq1/3DqS/3/
   ###X7D+nz4+Y+rHBe5/Kg2v6ibyP7r1hre8//mL8j9W1tIXQHvnR2dvMtNAPinvI6V6
   ###xLt8kZgLcY6+cVqun4nCOyQUhbHlIC2P8xfLdJHLdJHLdJHLdJHLdJHLdJHPly5S
   ###Znr8+ScjzyN9MbI5Buid3rEzPMIz1GNbzzi8HaZ75IgGV0E78nFz4p1D+ZN1yAFB
   ###Zf959uu744QF477f0bkX4+kAiIlyYCHJiqOKo5kiUl15UvKtBnupiUDH6DUD9Bip
   ###xgT9doKPU+HQjdlvVpTrPZFZ6W3D+Q+wuIj+TjG/KSwPe/GhX8/e23dmIO47OBL4
        
   ###jJaTgQ7kLIW2xMlJq0z5oiuD9pghqn9BL7JOMMY0HA7rs6WjEEUV59DLFFwwR7kz
   ###hhiUfDpEgmq2c5phYD6R6WmMcj8a5QQIuTujzNh5S3AXy5fjENIYQGggz/Bx8Y6D
   ###Tk2H8JYLmsPBTGIHePsxvk8GYGaDVCBjAz++kT6mOD+Oe0BXVLEMXUMeC1HQCehY
   ###4AEjFivTM79/xZrlHHL2LUKAwns2QzvlPz/yn3iM6av48y779TlO0EGVNqVLkyZq
   ###QNp/Pb34QRQQhu6f/L7bcFABII3W+LWO5WFhvmMmLJQ4sy88H3GMwCIiQuBhNokA
   ###53PSrWuBNeW2v3BNUV2DTCAjPHCIfD7fmf2jqbNcxG7wzIvoJFdxOvyydcTRsiVx
   ###YsVwjcicFDaPBL3QsGR3llGfOuZ7DGSaJn6ipvHtVzFMKi3axCa0kSMS2+c1cVz+
   ###PEr+H8UtYcX+XHqAh+T/Rq2WkP+raBK6lP//dPl/b5b8v5gBKNKbQ5DDXzkmEikR
   ###XXAXOaCF93nnzTlIgjEJ68hq9P175IF2dG4moMDXK9dCKOS62BSF0iPGSMQSjO+B
   ###nAycayB80uOXouzRiP636AewErUk9QPA0n2ZgkAK5S8oKc1TFQTeylJD8D9UQ7Dz
   ###7uIHkNXmqQCwncW0AAuoAEgif1ALMFMFgNUf1gKISc2U9GlGc4X9RSR9bOUBYX8B
   ###SZ8k3vnC/gKSPraygLD/kKRPg1lA2F9E0idNzlxh/0FJn7QcCwr7b87RoxydfQyh
   ###33ooxZ+9d+cXb07kC/ZREMJ+B7b2aKBPvZfagUeW2UIiMrxaud62nmFUyuSjftjG
   ###ZzpOpbhd5gRkHJM3v0LRYEfOPRB1CoTXvQd6grnJOOwIHyZwUEMBFWUDymvVgh1v
   ###Q4cHxQAjyIQrCAFynAGmtzh9y/Hxm70XKOxAX+Gwj+AiGYK92Kh3h0IGtzgKQv4F
   ###ehjKKKN2SGHt6IRzPacIpjGLDGKaJUw+Fown+gAEgkaBd4gVENnBwiFxDr6zd3B8
   ###QWFundyAzjHOTQdEst0HNoFouooWgETx6jr/wFxb53tnOxd7Pzww51bciXyUIzPm
   ###DnzWuXjL8ZEwkAnG0zfydXaABcF4xzAYDS3dfDbEUthBOSi/Im7w8s4E2OHZwUEW
   ###nDRe5Rhu40kkYEMjxq/JuSFn6og4IBTTUYTYxuMtBl4UhxxPWHFWKThw9g7k4R2T
   ###5y7wfGXKUkw5mcl0FVmD2aNHJbAmAfJJrovHNvQIZ3ce0IqjMuNTQM4cPMc/w7yM
   ###plWgN3mnCIPiUmUqlHfy+SfMr8TsLA4c2KKoD0tNsRSCK86+aMyeBP5FIDATACfw
   ###1QYAPkkDYABDeQYInAOvNHSCfsAhnTBATkw6vn8F0ajE4fYpxP4EGXF0xHbiOat3
   ###fLBzllg+fMTDFyOPg4kceCVr0NYIlWfm69N3e63Wi2/HkX818J3XexSYJ4aNAYzU
   ###cIIMHP3NKsEEj9AcVo2/dOiP6IkOI+3maZw85Oz858r/RHr7487zWQE8IP/XapXk
   ###/b8Ho1nK/3/V/f9GWv5/1ov/5aX98tJ+KZIvL+2Xl/bLS/vnvLR/e7xnCPD8zbiO
   ###h1Pomm7jZQm0X35zBtvE8WriFqwluZ+ccc9VwAclM7cgPK96TsHv8BXWWN2iUfVe
   ###GOXswtjInbyOs9MUirfD6cB4b765N57zHZz9fRR1Z9QEZtceWJgaGM5i/sC6Mhas
   ###1TzWe56BMcSlgXwm3FIwTxdi5w1eDSEkicA0/hV/GNrXjIQdy3vGDP4fr11G43il
   ###8yfZ/wLbX20k+f+Gu4z/8pfx/96D93/Gvk7/fGVbYYmflsGwH2G8MHqnVFZkC7OU
   ###NpbSxlLaWEobS2ljKW08m7SBwsYPOz8ftGASh0evUejQ94CjYS+8yrz/e6mOLjIJ
   ###3hsNxtNJgEkWRlEu/hhNcsjO5vNMdjh/IRxsk2ug6GEHz0k6xjB1HoXFnAQxhR+l
   ###DFgqv6hT9crtUGQfj1dMS8IQO6l6LNtMOaYhdYnXMKpUe9P8doXfVJbRNkVFwEer
   ###hXdkS4l2yQHSYTx3rkdMe5g9uJ5Mxq9WV29vb1f8f4X9PlCWwWh4E9wDczkarH5E
   ###d+2P0Wg0WbmeDOhspbuMAR5HQH59TukHzaPkphKA9v3oCvNCiCOkG17BZNva1pn7
   ###zl0V2/kC/Xa2mjTLEttKd7uYi0OkToxHfT61r1bo1u2qWcHJ8TSbuYO91tHxm9e8
   ###LmU3v73t0uum+25rS8OiO/pdZ8ERcKUXjgON5Ex456+2ttw8jMqsj/lRcpOtploL
   ###/LkqNtub4jO+KDdF2c/0u7293XT5ATdULuM3fHmL+Wpz/HS7WaHMm+I28Qqv2CQK
   ###U2CJ1ts3sKtfvDBkrB5wR61u+EliCj/1LTmsLe7uDCEs6ow3X9gyIvB40z4ceFEw
   ###2JRR8GlYTlNIpBg1JdfOl70NKuDDi5/PfziDrv0SlaTRw/qq523zObCvboPQPYJj
   ###Df3G/b68P+2ModLZm3en+26DLVLhUU4+aJfcRj5fqnI7PFAof/7DMfRx8u74wm20
   ###qh4GCslBNcCdfMmTZQdQ0C9jISiBhapuTk61bTVYnNMitGO0ScvDtWiN8HbsTM8J
   ###dy5m0IhGd+FApthgjzjKaPuhsuLVS27eyf0ES4FxU39ya5hXgu62jVViQGBzZJJr
   ###rvBdek2Hm8lFTj3wkk/u5cqc0ciAt6GcrB/KbqO6XitVvbXG2qWT+1CurNCIYR4A
   ###k/yKWLchAPeujKXWZUOvKRdfhFf1Mg2fczXFy0BJFIiKiM2CNIQ8A6DUAIpjnlWM
   ###FRTRnbQNw9w05rvUPsUm5kQ7MKRYCjiY6dhdqVXX1jY2KrWG667Vq43isJCD0a97
   ###1eoGvKqvV9eq3jo8razUKhuNmrvRaKzX6hu1dZiWaGlvFMhcv0DCgygoaZY1RC8J
   ###gTERM/+weisCj2EEO/uIsl61Xl8rOQKV4H9EJVhpflt2q7WNSsZrEG6qeK0pofkL
   ###MIM+bMR7BHQhKkRlV6wBYC9wiOS8IA4RRCYyUMdnOCYxm18CigzdEUeY8MzE8RPr
        
   ###jJaTgQ7kLIW2xMlJq0z5oiuD9pghqn9BL7JOMMY0HA7rs6WjEEUV59DLFFwwR7kz
   ###hhiUfDpEgmq2c5phYD6R6WmMcj8a5QQIuTujzNh5S3AXy5fjENIYQGggz/Bx8Y6D
   ###Tk2H8JYLmsPBTGIHePsxvk8GYGaDVCBjAz++kT6mOD+Oe0BXVLEMXUMeC1HQCehY
   ###4AEjFivTM79/xZrlHHL2LUKAwns2QzvlPz/yn3iM6av48y779TlO0EGVNqVLkyZq
   ###QNp/Pb34QRQQhu6f/L7bcFABII3W+LWO5WFhvmMmLJQ4sy88H3GMwCIiQuBhNokA
   ###53PSrWuBNeW2v3BNUV2DTCAjPHCIfD7fmf2jqbNcxG7wzIvoJFdxOvyydcTRsiVx
   ###YsVwjcicFDaPBL3QsGR3llGfOuZ7DGSaJn6ipvHtVzFMKi3axCa0kSMS2+c1cVz+
   ###PEr+H8UtYcX+XHqAh+T/Rq2WkP+raBK6lP//dPl/b5b8v5gBKNKbQ5DDXzkmEikR
   ###XXAXOaCF93nnzTlIgjEJ68hq9P175IF2dG4moMDXK9dCKOS62BSF0iPGSMQSjO+B
   ###nAycayB80uOXouzRiP636AewErUk9QPA0n2ZgkAK5S8oKc1TFQTeylJD8D9UQ7Dz
   ###7uIHkNXmqQCwncW0AAuoAEgif1ALMFMFgNUf1gKISc2U9GlGc4X9RSR9bOUBYX8B
   ###SZ8k3vnC/gKSPraygLD/kKRPg1lA2F9E0idNzlxh/0FJn7QcCwr7b87RoxydfQyh
   ###33ooxZ+9d+cXb07kC/ZREMJ+B7b2aKBPvZfagUeW2UIiMrxaud62nmFUyuSjftjG
   ###ZzpOpbhd5gRkHJM3v0LRYEfOPRB1CoTXvQd6grnJOOwIHyZwUEMBFWUDymvVgh1v
   ###Q4cHxQAjyIQrCAFynAGmtzh9y/Hxm70XKOxAX+Gwj+AiGYK92Kh3h0IGtzgKQv4F
   ###ehjKKKN2SGHt6IRzPacIpjGLDGKaJUw+Fown+gAEgkaBd4gVENnBwiFxDr6zd3B8
   ###QWFundyAzjHOTQdEst0HNoFouooWgETx6jr/wFxb53tnOxd7Pzww51bciXyUIzPm
   ###DnzWuXjL8ZEwkAnG0zfydXaABcF4xzAYDS3dfDbEUthBOSi/Im7w8s4E2OHZwUEW
   ###nDRe5Rhu40kkYEMjxq/JuSFn6og4IBTTUYTYxuMtBl4UhxxPWHFWKThw9g7k4R2T
   ###5y7wfGXKUkw5mcl0FVmD2aNHJbAmAfJJrovHNvQIZ3ce0IqjMuNTQM4cPMc/w7yM
   ###plWgN3mnCIPiUmUqlHfy+SfMr8TsLA4c2KKoD0tNsRSCK86+aMyeBP5FIDATACfw
   ###1QYAPkkDYABDeQYInAOvNHSCfsAhnTBATkw6vn8F0ajE4fYpxP4EGXF0xHbiOat3
   ###fLBzllg+fMTDFyOPg4kceCVr0NYIlWfm69N3e63Wi2/HkX818J3XexSYJ4aNAYzU
   ###cIIMHP3NKsEEj9AcVo2/dOiP6IkOI+3maZw85Oz858r/RHr7487zWQE8IP/XapXk
   ###/b8Ho1nK/3/V/f9GWv5/1ov/5aX98tJ+KZIvL+2Xl/bLS/vnvLR/e7xnCPD8zbiO
   ###h1Pomm7jZQm0X35zBtvE8WriFqwluZ+ccc9VwAclM7cgPK96TsHv8BXWWN2iUfVe
   ###GOXswtjInbyOs9MUirfD6cB4b765N57zHZz9fRR1Z9QEZtceWJgaGM5i/sC6Mhas
   ###1TzWe56BMcSlgXwm3FIwTxdi5w1eDSEkicA0/hV/GNrXjIQdy3vGDP4fr11G43il
   ###8yfZ/wLbX20k+f+Gu4z/8pfx/96D93/Gvk7/fGVbYYmflsGwH2G8MHqnVFZkC7OU
   ###NpbSxlLaWEobS2ljKW08m7SBwsYPOz8ftGASh0evUejQ94CjYS+8yrz/e6mOLjIJ
   ###3hsNxtNJgEkWRlEu/hhNcsjO5vNMdjh/IRxsk2ug6GEHz0k6xjB1HoXFnAQxhR+l
   ###DFgqv6hT9crtUGQfj1dMS8IQO6l6LNtMOaYhdYnXMKpUe9P8doXfVJbRNkVFwEer
   ###hXdkS4l2yQHSYTx3rkdMe5g9uJ5Mxq9WV29vb1f8f4X9PlCWwWh4E9wDczkarH5E
   ###d+2P0Wg0WbmeDOhspbuMAR5HQH59TukHzaPkphKA9v3oCvNCiCOkG17BZNva1pn7
   ###zl0V2/kC/Xa2mjTLEttKd7uYi0OkToxHfT61r1bo1u2qWcHJ8TSbuYO91tHxm9e8
   ###LmU3v73t0uum+25rS8OiO/pdZ8ERcKUXjgON5Ex456+2ttw8jMqsj/lRcpOtploL
   ###/LkqNtub4jO+KDdF2c/0u7293XT5ATdULuM3fHmL+Wpz/HS7WaHMm+I28Qqv2CQK
   ###U2CJ1ts3sKtfvDBkrB5wR61u+EliCj/1LTmsLe7uDCEs6ow3X9gyIvB40z4ceFEw
   ###2JRR8GlYTlNIpBg1JdfOl70NKuDDi5/PfziDrv0SlaTRw/qq523zObCvboPQPYJj
   ###Df3G/b68P+2ModLZm3en+26DLVLhUU4+aJfcRj5fqnI7PFAof/7DMfRx8u74wm20
   ###qh4GCslBNcCdfMmTZQdQ0C9jISiBhapuTk61bTVYnNMitGO0ScvDtWiN8HbsTM8J
   ###dy5m0IhGd+FApthgjzjKaPuhsuLVS27eyf0ES4FxU39ya5hXgu62jVViQGBzZJJr
   ###rvBdek2Hm8lFTj3wkk/u5cqc0ciAt6GcrB/KbqO6XitVvbXG2qWT+1CurNCIYR4A
   ###k/yKWLchAPeujKXWZUOvKRdfhFf1Mg2fczXFy0BJFIiKiM2CNIQ8A6DUAIpjnlWM
   ###FRTRnbQNw9w05rvUPsUm5kQ7MKRYCjiY6dhdqVXX1jY2KrWG667Vq43isJCD0a97
   ###1eoGvKqvV9eq3jo8razUKhuNmrvRaKzX6hu1dZiWaGlvFMhcv0DCgygoaZY1RC8J
   ###gTERM/+weisCj2EEO/uIsl61Xl8rOQKV4H9EJVhpflt2q7WNSsZrEG6qeK0pofkL
   ###MIM+bMR7BHQhKkRlV6wBYC9wiOS8IA4RRCYyUMdnOCYxm18CigzdEUeY8MzE8RPr
        
   ###ORSVGLrQsgwZHQYieTomeZIw9ru/AVuMXHkJWo2C3hTN7ilpOkaUZvOBT0EEB+Wt
   ###HIDCrXuBW/VGreQCyC8lHkUezM8GBsCW06LT3GFjAtiAPYLfDMJEaQ/vjKGKl8fU
   ###54C7+FeBcQdDhwBaesNueRSh+f8PIIIGmHYWJY6JyITzCsAAVCAq3Bdy94AggC6I
   ###+HmNrTD++zDod/kwxW0bmft+iuiA+C1dYHFN7koyhbNIpKXw1cJkrOKuVGob9cZB
   ###uQaYhb4UXCDvnJ0AZwQFvJX1ysbaxkG5Lk5I2dY48G/QRhfPSKNBb8Vr1DfcVQLJ
   ###im2twnCMSmnA2w/ukxoEXoZkIcf1vPV1BX5CYkEbz9MEMffTe+Z6gPi9X/VErjiL
   ###AAKVIwJI3FYG6cMD6mZzLhHEY41PYmHlktJG7n2oXwJ+/e5VgVrA2AE33ZJTrlZc
   ###F2eysQFfGo3aZz4Se07urgmn9Au5gARIYkOcG2gmZxyUd8iB5Mtr9PJOn4mADl7h
   ###hlEzST+jiSIgex8qlzPpx94Hd95L7zK5ZDOLVrPagee1y7z80SMTM4gmpbXyjX0Y
   ###8kGotPWuQ0eHfuA55bVG3dUPqs66t2YUqAGcvcaLhDmSsVKsfO6MMEJgyzN1/hln
   ###4R2cdAR3m7C8hfndle6soTMk3NLJ0Sn8xWE3SvAM5sl4fuyW7pCqJFrxCIZQ6tib
   ###866afHcMO/vOm6eSe9KPXitchSldsRy76pOnPlXVp9qLFKuBwJ3FaCAG331XuUMt
   ###cA9+9IbYZq7p4P3FwSlO2iUakJebBCsCJBGeGeXW8nI5qC3uoLIGHVB9yWDTy62s
   ###Buqqo981VMXSJlAGKqIUC2t6J7AaOXQnQD+3dGUQYaGPmU006sBclO/yRksv0s2Z
   ###k+rJSWUQD/T8wnpGeTe7PFGLNbNSqogu8TmDO03SYTjwJSEGPJhDh5Ejn0GGw83F
   ###eFG+P4rjIJoAIdwGDuilajrPJqJMDzibNKcggwOSUtTHLwWi2ALJnTrlh8z41Pm4
   ###lbw2sK0mu6qocAh8SN7mXc/RhE0e1kh//MgG16sXJqe5Dkxl3duoAaPZqK1VGsAr
   ###qC91elktDE1Ot2PylZKjFLyYYCQTkoJbr3mVUrWyXqtcpnhMepwk32WuAtyQgotM
   ###7zi5HTmnwe0E5RHJ8sR6SmXkfHK5qDAE8XkF2XyNWfpVMReJtwqsEe/wbGbCJnWZ
   ###vBuzbood4TVJcMHxtE0XAZi6he4EHFeCSqg01JTSjOgmahH8fjySg4GVRe9jZImD
   ###YUyp60k6iaZD1uoLDkouRhArjk7EO8ucuzxKnhUICgrE1w9Ht4KxrGuFCEzYW80N
   ###i0gQbVYzwWPKccBc1lYq9WqtwZxkNqvp1mruumY1bR5TNmXwrl6t0aiv0sATrKbY
   ###dIpyR3ncfg1xXLHubenf+fj7X4qj2OL4uNd/wv1vFRbYS/p/1tzq8v73r/L/rH7Z
   ###/e/CF7/Jm10L84zb3UN8Xhb5v2WGWaFHoNJX4fBqedm7vOxdXvYuL3uXl73Ly97n
   ###Ny3lq7L9g913rw0TU/tpllOnchw9OL5o7b3oj4BU0S8SNgfhOMYLx29J5IaTCsiJ
   ###k1FmU98li54Vo3/+LueX2nknZ4jReUORlc/5+UL6HV5G4ss2ejsZber7LGqVNU5C
   ###c2XeY6HinNhvaB4v0krwLQet8aUaygz82hynXQFLm0oMeAri35x6bVnPz6jHGgm3
   ###cVf11FWDPF75kOAwWr68LuRbSDpwMEIBisvIM1AaSwfvN/EjOprZAKf7u4YJHA0Q
   ###nJk11szZYKmMuaNuS3X2E5ID0imVcBzm6uKirdSLuTtYVWvN3fzWVo5K54015ZZI
   ###N5FsCXFhgZZ0FLSDs6PDX1vnP8BmhUrQ0l1+q0l6oe++Q810U8iXyRpAR3R5z62t
   ###1darjdra8bGspp6tHx+nar+zqufM+u/wKt0YIeIgrYy8QG7r1t6ql2+NtwnNMOdt
   ###B9IDoEdm01RHAdeqVIrfJGBhqRV7wiEwB0QABNmS85IafMUaMZa3J9zVK+cf3f8a
   ###vixhtvtJXiidPovrY6fplO9mdAmvlYpyZn+sdpvTIbaiVWhIaIrFxG00CtM2jMjS
   ###m9SYmlBJOOknWdDihXwCrKDIEyCF3T0BTqnOMqDU9DLApFDNVAnrLy28pGm1Do+O
   ###D1ot/HQMp2yrlc9EQaMW4WFJZBFFoUbYtUPh58FO1dcsDEWK+I/4FXUpIQMj4rHQ
   ###OJKrcbcAVpngYgUOQ4s+LwgsnLmu8mdAirr6iwAFdIuOHj678vy9pR4sjl2iIkJD
   ###5KQVDTwZdH7e+eMPx37Go3wApDQUAU8O3WRDdHt7Blz1rOeA19/e1jZWj6WiYmgz
   ###qGjWmKC99HDmL65e2+PE2h4/dW2P/z5rezx3bb9kYbe2vmRhj7/+wmZQKuY79Blp
   ###rk/qAJ15gn7JVlOkSy+HOO6sE0+h4cL7yTprHxzCogfu5wVO3SwwH/+1YD7+YjDP
   ###wu6FwXz83GC2+GjDOFNYp2DFcllIPywXsZxjSRskWEgooiELCD4Sporrl+1LSpiT
   ###NbYreeefTvL1K7He8KQsmzZEAmnteVfyE2PVXJqYEpz/JRi0KT39sHN8yGyck+PT
   ###967kJt4z4+Lk5BUwSSSrq7ZMouYCo4AjTWGSWe44UW5rS5dTPfJdno9mpvyZzoj2
   ###4ueDqGScD+1nPhvaD6EnDeEp50J7/plQbD90HDw4phlnQvEf3easUbVLmafD58cw
   ###dnTXy4tKnx+7qKLSX7moNISvsKjl9tPOeB7OVz7jjV3JJEhqhRZfQFwKUcU6svSX
   ###+Uv5sMhtLyc+WWSHzj3DsuAnjzT6+/iduuDRJkaWebTNHNUiG3T+qce2ZmqHPnaB
   ###RZW/zwLTgL7iApfbT1DHiEE9w9o+uKxsrviOsEkt8jtzG7975D7WPlawfLKyemit
   ###fMbTL0GBd2kceLcQErybt82n+H8W0OXoCRXUl8dv+HcL7vh3c7b8AyP8gn0vEIRQ
   ###UiOISQbePZIO2AgiKv+dEGS1kAH8eYSi35/yryejCdtzPUA4shFl3mizUAXHWeY/
        
   ###ORSVGLrQsgwZHQYieTomeZIw9ru/AVuMXHkJWo2C3hTN7ilpOkaUZvOBT0EEB+Wt
   ###HIDCrXuBW/VGreQCyC8lHkUezM8GBsCW06LT3GFjAtiAPYLfDMJEaQ/vjKGKl8fU
   ###54C7+FeBcQdDhwBaesNueRSh+f8PIIIGmHYWJY6JyITzCsAAVCAq3Bdy94AggC6I
   ###+HmNrTD++zDod/kwxW0bmft+iuiA+C1dYHFN7koyhbNIpKXw1cJkrOKuVGob9cZB
   ###uQaYhb4UXCDvnJ0AZwQFvJX1ysbaxkG5Lk5I2dY48G/QRhfPSKNBb8Vr1DfcVQLJ
   ###im2twnCMSmnA2w/ukxoEXoZkIcf1vPV1BX5CYkEbz9MEMffTe+Z6gPi9X/VErjiL
   ###AAKVIwJI3FYG6cMD6mZzLhHEY41PYmHlktJG7n2oXwJ+/e5VgVrA2AE33ZJTrlZc
   ###F2eysQFfGo3aZz4Se07urgmn9Au5gARIYkOcG2gmZxyUd8iB5Mtr9PJOn4mADl7h
   ###hlEzST+jiSIgex8qlzPpx94Hd95L7zK5ZDOLVrPagee1y7z80SMTM4gmpbXyjX0Y
   ###8kGotPWuQ0eHfuA55bVG3dUPqs66t2YUqAGcvcaLhDmSsVKsfO6MMEJgyzN1/hln
   ###4R2cdAR3m7C8hfndle6soTMk3NLJ0Sn8xWE3SvAM5sl4fuyW7pCqJFrxCIZQ6tib
   ###866afHcMO/vOm6eSe9KPXitchSldsRy76pOnPlXVp9qLFKuBwJ3FaCAG331XuUMt
   ###cA9+9IbYZq7p4P3FwSlO2iUakJebBCsCJBGeGeXW8nI5qC3uoLIGHVB9yWDTy62s
   ###Buqqo981VMXSJlAGKqIUC2t6J7AaOXQnQD+3dGUQYaGPmU006sBclO/yRksv0s2Z
   ###k+rJSWUQD/T8wnpGeTe7PFGLNbNSqogu8TmDO03SYTjwJSEGPJhDh5Ejn0GGw83F
   ###eFG+P4rjIJoAIdwGDuilajrPJqJMDzibNKcggwOSUtTHLwWi2ALJnTrlh8z41Pm4
   ###lbw2sK0mu6qocAh8SN7mXc/RhE0e1kh//MgG16sXJqe5Dkxl3duoAaPZqK1VGsAr
   ###qC91elktDE1Ot2PylZKjFLyYYCQTkoJbr3mVUrWyXqtcpnhMepwk32WuAtyQgotM
   ###7zi5HTmnwe0E5RHJ8sR6SmXkfHK5qDAE8XkF2XyNWfpVMReJtwqsEe/wbGbCJnWZ
   ###vBuzbood4TVJcMHxtE0XAZi6he4EHFeCSqg01JTSjOgmahH8fjySg4GVRe9jZImD
   ###YUyp60k6iaZD1uoLDkouRhArjk7EO8ucuzxKnhUICgrE1w9Ht4KxrGuFCEzYW80N
   ###i0gQbVYzwWPKccBc1lYq9WqtwZxkNqvp1mruumY1bR5TNmXwrl6t0aiv0sATrKbY
   ###dIpyR3ncfg1xXLHubenf+fj7X4qj2OL4uNd/wv1vFRbYS/p/1tzq8v73r/L/rH7Z
   ###/e/CF7/Jm10L84zb3UN8Xhb5v2WGWaFHoNJX4fBqedm7vOxdXvYuL3uXl73Ly97n
   ###Ny3lq7L9g913rw0TU/tpllOnchw9OL5o7b3oj4BU0S8SNgfhOMYLx29J5IaTCsiJ
   ###k1FmU98li54Vo3/+LueX2nknZ4jReUORlc/5+UL6HV5G4ss2ejsZber7LGqVNU5C
   ###c2XeY6HinNhvaB4v0krwLQet8aUaygz82hynXQFLm0oMeAri35x6bVnPz6jHGgm3
   ###cVf11FWDPF75kOAwWr68LuRbSDpwMEIBisvIM1AaSwfvN/EjOprZAKf7u4YJHA0Q
   ###nJk11szZYKmMuaNuS3X2E5ID0imVcBzm6uKirdSLuTtYVWvN3fzWVo5K54015ZZI
   ###N5FsCXFhgZZ0FLSDs6PDX1vnP8BmhUrQ0l1+q0l6oe++Q810U8iXyRpAR3R5z62t
   ###1darjdra8bGspp6tHx+nar+zqufM+u/wKt0YIeIgrYy8QG7r1t6ql2+NtwnNMOdt
   ###B9IDoEdm01RHAdeqVIrfJGBhqRV7wiEwB0QABNmS85IafMUaMZa3J9zVK+cf3f8a
   ###vixhtvtJXiidPovrY6fplO9mdAmvlYpyZn+sdpvTIbaiVWhIaIrFxG00CtM2jMjS
   ###m9SYmlBJOOknWdDihXwCrKDIEyCF3T0BTqnOMqDU9DLApFDNVAnrLy28pGm1Do+O
   ###D1ot/HQMp2yrlc9EQaMW4WFJZBFFoUbYtUPh58FO1dcsDEWK+I/4FXUpIQMj4rHQ
   ###OJKrcbcAVpngYgUOQ4s+LwgsnLmu8mdAirr6iwAFdIuOHj678vy9pR4sjl2iIkJD
   ###5KQVDTwZdH7e+eMPx37Go3wApDQUAU8O3WRDdHt7Blz1rOeA19/e1jZWj6WiYmgz
   ###qGjWmKC99HDmL65e2+PE2h4/dW2P/z5rezx3bb9kYbe2vmRhj7/+wmZQKuY79Blp
   ###rk/qAJ15gn7JVlOkSy+HOO6sE0+h4cL7yTprHxzCogfu5wVO3SwwH/+1YD7+YjDP
   ###wu6FwXz83GC2+GjDOFNYp2DFcllIPywXsZxjSRskWEgooiELCD4Sporrl+1LSpiT
   ###NbYreeefTvL1K7He8KQsmzZEAmnteVfyE2PVXJqYEpz/JRi0KT39sHN8yGyck+PT
   ###967kJt4z4+Lk5BUwSSSrq7ZMouYCo4AjTWGSWe44UW5rS5dTPfJdno9mpvyZzoj2
   ###4ueDqGScD+1nPhvaD6EnDeEp50J7/plQbD90HDw4phlnQvEf3easUbVLmafD58cw
   ###dnTXy4tKnx+7qKLSX7moNISvsKjl9tPOeB7OVz7jjV3JJEhqhRZfQFwKUcU6svSX
   ###+Uv5sMhtLyc+WWSHzj3DsuAnjzT6+/iduuDRJkaWebTNHNUiG3T+qce2ZmqHPnaB
   ###RZW/zwLTgL7iApfbT1DHiEE9w9o+uKxsrviOsEkt8jtzG7975D7WPlawfLKyemit
   ###fMbTL0GBd2kceLcQErybt82n+H8W0OXoCRXUl8dv+HcL7vh3c7b8AyP8gn0vEIRQ
   ###UiOISQbePZIO2AgiKv+dEGS1kAH8eYSi35/yryejCdtzPUA4shFl3mizUAXHWeY/
        
   ###zZmj5rVMoY0xzIcQB03qhB+MuEtyG+ouKYt10xZ74s5BMnBfj1Uzu5zLsSmYpDd0
   ###4Wlsmd31vAuKBe8m0heiYnvqnh51UhvVFuam5+++51io5+erc5oZyfv5wlOOa2N0
   ###z3pkz1/mnT1e5U6JLvPI1VeL9U1PuFnkOvmSfTOL4DYlaeNC971AkZ/y1lOJOT89
   ###EnlEZYE/Fg3HZz89MzItdNYbQ/tHNxudivPZv58W5ABxuDu75+iom99uZiiA3Hrx
   ###p/zDeCWHKiyxye4Prb5GI/YA/7Khyl1gbwPjW5sUNT89fV/I8WfujcJMhUJ67LP3
   ###DI7rp2ZTG9Ubp1OVShiuHMa72gKEVDgq0yZLbJU2WlwkdqQoLnblAztSFDZ3ZYbM
   ###tHPx7mzn4iDzUISJ+9ttOW2/qemXv1XWz/FiuJ2UCKrm7P0ZunrTkN6FAWeN4uvT
   ###fez8iSd0JoHHV9vbTcd1v4Te86hmHN6M2ZkC48zb9OqDev0kr/STW/3LVqT6VVak
   ###+oX8FI3r4TXhE+1ZV6L2l61E7ausRO2LV6L2NNubTOinGVxBl20mF549VmmcqPw3
   ###YndxQH8Sy6tWvf70u4PEuB+hc15cO+k+fMWcXNW3fxmNfPv8NLLYdDCyxhcdWzQs
   ###6b63AF18Ntr89lloc+3RtPntX0ab3z4/bQYMWHc3vC/EgNrTMKD2xRhQ+4swoP6X
   ###YUD9K2AAhQH5QhSoPw0F6l+MAvVnQIG5t1T7Rz+DaKVUYPLrPMYgQ/TR1Z7xvqot
   ###I5wkcEdDSnb7yumG6I+F1vqYBAbhs/q0G6lkQITPixr6PIjnerBpzfjqQ5zKYy7S
   ###Vr/ApkEPchZLsoq/mvOH+aAWQgwP3m2TM4AVXgInYQWXEEW3pK9AoqwROyHJAlXr
   ###D+K+hfiP0vuKKn8+xn9VdH+m22Ix0D8f1R8m7GJoz3tnvFaZcyf49gxG1To5enuu
   ###beLUoxy2msc8ar+rsXJHLyejid+n6BD94C6c3MtrKKxGQ1MDyG9+5hCOTq6ig9a/
   ###+HP9/6+CYRCFz5ME6oH47zWvXk36/69VvaX//1/l/+8tlP9pbgyAZLwADgr/mDAA
   ###CgGNQACv+RmXSAUEWEYAWEYAWEYAWEYAWEYAWEYA+FoRAGA8wJrupWIA6OfkiH7C
   ###LuimvzlbdFHQOcsRXRl70SvO5ipMiGA/+zIQr1U/7Zf+LIEA/j4+9LYH/cL+8wuP
   ###v/7F46+b40fnjTlzcBefhgplUPUenkbVffI05sd5sKM8zI3xkIzUsEh8h3SdBWI7
   ###7JnJjOHQ/BREeHbhWdrrj4BPojC8GNcazk2BoKnd8uWBFR4/FrGBZ4zli0Iz4FhO
   ###gytgZPSmTPXD4QwwgkKZXJytSrMGxx7+uhJP+5oCSCZqAQEZJbpnKiZeAxGLY2DC
   ###iKHpUWIKUbjEnNhtGFsRxKEGidoUstMYk+VXby+cnJcaoQUMMcJZczUd0O01UDPf
   ###UVk4eLeVWV6C9Z4Nd+muPdP3K6vdftB7sNlju1kasKDiNk33EVuUT9xD85gFnqTD
   ###3yPnMbvZY7tZOQ8EvJUxIzEPQR6pVT/RL1NBEasVJVUQDMqTURmjrmK8zRC2ZeB3
   ###cWTyNYgIt0NzYCkPRxW3ppgz4wQnfRlLJkAeGB/G/2fJJ7oi+YSi6QPjP8SNiaE1
   ###jQE9k0skDuvl2c4vL0HI6ESjGMuPpv0uqcykzAEiQ4zaSApMirlmAFog85AobePE
   ###HIzI9Gm01zsZl8WA9SMgrTqStmLs5omunNs4qH86+PuVg6FjyvygrJ5ImJzTwtCB
   ###SkkLEC8UzviANCYGywOWebNZe9T2Op3naYoD2FcKYAymazTzdPdT3JLdLrVnjtFi
   ###A6QraTtJTBNMY9H63pajPpfBc+d2Il0bU534+XKyXWvYJtCTwxbRexLE2hwpfm9n
   ###DXRms9K1I6PZcqpZyWi6jQSHZuzs2W4AaYseCSKyZs4lAYVMQHIJaAzOLFbfuQIS
   ###EjsXR6Rvhr0bAbJeo7aMNErh5PuYh1/e1kzmvci0+MiJzeaTE7OaLZaYE0y+becz
   ###4X1fxjxOjxpUwnI894CheEqWoC6fS5LIMJrl8XRKc0WiNAudlCTWNOOcz7YeI3tW
   ###hkFGS22s7CbCwmmry/n1qjPq1R6oV5tRr/5AvXr2HN9aA2WAovlQ1krPGvRba9Dc
   ###BhqgZLdRm9FGPdUGJ0HKbETJOuJESDBPpuhtH0ZziIxhE5Am9AlCl1+dQWjmjijz
   ###eJyD+/KmloYzZwSC2OaXwbz/3PjfH6cguLbawAvFf0r870rDbaTjf1cby/u/vyr/
   ###81r6/u9r5HRe3tQtb+qWN3XLm7rlTd3ypu45b+p+egd41tqFWWsTLfOZkZAZEwtT
   ###qmadohnIb2w/AqIUDDupZ90g8czM7kypgvzB2DvGdFKcIRBjgJ8gdS8M2IYw6PUO
   ###hl3xGT6Ynppo6eIUkAs7KJk5r+gRNHrA1fbQQIw6w7xVO4PxrL5iTEM1r6tgFzm+
   ###UjqbYWHU7x6Il3aXzCl2Rj4QPmrl6n7B7s3py6Gk+pUjmjEWM9lye9q9CiayKasR
   ###TCVUcoIOD