TW202337212A - Video decoding method, apparatus, video decoder and storage medium - Google Patents

Video decoding method, apparatus, video decoder and storage medium Download PDF

Info

Publication number
TW202337212A
TW202337212A TW112102125A TW112102125A TW202337212A TW 202337212 A TW202337212 A TW 202337212A TW 112102125 A TW112102125 A TW 112102125A TW 112102125 A TW112102125 A TW 112102125A TW 202337212 A TW202337212 A TW 202337212A
Authority
TW
Taiwan
Prior art keywords
current block
image
decoded
bits
quantization
Prior art date
Application number
TW112102125A
Other languages
Chinese (zh)
Other versions
TWI838089B (en
Inventor
王岩
陳方棟
曹小強
孫煜程
Original Assignee
大陸商杭州海康威視數字技術股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商杭州海康威視數字技術股份有限公司 filed Critical 大陸商杭州海康威視數字技術股份有限公司
Publication of TW202337212A publication Critical patent/TW202337212A/en
Application granted granted Critical
Publication of TWI838089B publication Critical patent/TWI838089B/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/44Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

Embodiments of the present application provide a video decoding method, apparatus, video decoder and storage medium, which relate to the field of video decoding technology and can save resources in a bit stream and improve the transmission efficiency of the bit stream. The method includes: obtaining one or more code rate control parameters of a current block in a picture to be decoded; determining a quantization parameter of the current block based on the one or more code rate control parameters; and decoding the current block based on the quantization parameter of the current block.

Description

一種視頻解碼方法、裝置、視頻解碼器及存儲介質 A video decoding method, device, video decoder and storage medium

本發明涉及視頻解碼技術領域,尤其涉及一種視頻解碼方法和裝置、視頻解碼器以及存儲介質。 The present invention relates to the technical field of video decoding, and in particular, to a video decoding method and device, a video decoder and a storage medium.

視頻編解碼技術在視頻傳輸與存儲領域發揮著重要的作用。其中,量化在視頻編解碼過程中是決定圖像品質的關鍵步驟。量化主要通過量化參數降低資料的冗餘,但同時可能帶來圖像失真的風險。當前,用於進行量化的量化參數在視頻編碼階段寫入碼流,視頻解碼端通過解析碼流中的量化參數,實現解碼。而量化參數在碼流中佔據較多資源,影響傳輸效率。 Video coding and decoding technology plays an important role in the field of video transmission and storage. Among them, quantization is a key step in determining image quality in the video encoding and decoding process. Quantization mainly reduces the redundancy of data by quantifying parameters, but it may also bring the risk of image distortion. Currently, the quantization parameters used for quantization are written into the code stream during the video encoding stage, and the video decoding end implements decoding by parsing the quantization parameters in the code stream. The quantization parameters occupy more resources in the code stream and affect the transmission efficiency.

本發明實施例提供一種視頻解碼方法、裝置及存儲介質,有助於節省碼流中的資源,提升碼流的傳輸效率。 Embodiments of the present invention provide a video decoding method, device and storage medium, which help save resources in the code stream and improve the transmission efficiency of the code stream.

為達到上述目的,本發明實施例採用如下技術方案: In order to achieve the above objects, the embodiments of the present invention adopt the following technical solutions:

第一方面,本發明實施例提供一種視頻解碼方法,該方法應用於視頻解碼設備或視頻解碼設備的晶片中,該方法包括:獲取待解碼圖像中當前塊的一個或多個碼率控制參數;根據一個或多個碼率控制參數確定當前塊的量化參數;基於當前塊的量化參數對當前塊進行解碼。 In a first aspect, embodiments of the present invention provide a video decoding method, which method is applied to a video decoding device or a chip of a video decoding device. The method includes: obtaining one or more rate control parameters of a current block in an image to be decoded. ; Determine the quantization parameter of the current block based on one or more code rate control parameters; decode the current block based on the quantization parameter of the current block.

由於量化參數在碼流中佔據較多資源,影響傳輸效率。因此,採用本發明提出的視頻解碼方法,解碼端獲取碼率控制參數,通過碼率控制參數計算得到量化參數用於實現解碼,實現節省碼流中的資源,提升碼流傳輸的效率。 Since quantization parameters occupy more resources in the code stream, they affect transmission efficiency. Therefore, using the video decoding method proposed by the present invention, the decoding end obtains the code rate control parameters, and calculates the quantization parameters through the code rate control parameters for decoding, thereby saving resources in the code stream and improving the efficiency of code stream transmission.

在一種可能的實現方式中,獲取待解碼圖像中當前塊的一個或多個碼率控制參數,包括:獲取待解碼圖像的資訊,待解碼圖像的資訊包括待解碼圖像的基本資訊和待解碼圖像中圖像塊的資訊;根據待解碼圖像的資訊中的部分或全部確定當前塊的一個或多個碼率控制參數。 In a possible implementation, obtaining one or more rate control parameters of the current block in the image to be decoded includes: obtaining information of the image to be decoded, and the information of the image to be decoded includes basic information of the image to be decoded. and information of the image block in the image to be decoded; determining one or more rate control parameters of the current block based on part or all of the information of the image to be decoded.

該種可能的實現方式,提供了獲取碼率控制參數的具體實現方式,通過獲取待解碼圖像的基本資訊和該待解碼圖像中圖像塊的資訊,計算用於生成量化參數的碼率控制參數。通過圖像的部分特徵完成量化參數的計算。 This possible implementation provides a specific implementation method for obtaining rate control parameters. By obtaining the basic information of the image to be decoded and the information of the image blocks in the image to be decoded, the code rate used to generate the quantization parameters is calculated. control parameters. The calculation of quantitative parameters is completed through some features of the image.

在一種可能的實現方式中,碼率控制參數包括當前塊的資源充裕度、當前塊的複雜度、當前塊的預測比特數、當前塊的平均量化參數和當前塊的量化參數的變化值;其中,平均量化參數用於表徵待解碼圖像中已解碼圖像塊的量化參數的平均程度,資源充裕度是指用於存儲當前塊的資源在用於存儲待解碼圖像的資源中的充足程度,複雜度是指待解碼圖像中已解碼圖像塊的複雜程度,預測比特數是指預估當前塊解碼後佔用的資源,量化參數的變化值是指待解碼圖像中已解碼圖像塊之間量化參數的變化值。 In a possible implementation, the code rate control parameters include the resource adequacy of the current block, the complexity of the current block, the number of predicted bits of the current block, the average quantization parameter of the current block, and the change value of the quantization parameter of the current block; where , the average quantization parameter is used to characterize the average degree of quantization parameters of the decoded image blocks in the image to be decoded, and the resource adequacy refers to the adequacy of the resources used to store the current block in the resources used to store the image to be decoded. , complexity refers to the complexity of the decoded image block in the image to be decoded, the number of predicted bits refers to the estimated resources occupied by the current block after decoding, and the change value of the quantization parameter refers to the decoded image in the image to be decoded The changing value of the quantization parameter between blocks.

該種可能的實現方式,提供了多種碼率控制參數,該多種碼率控制參數均可通過不同方式生成量化參數,提升方案可實施性。 This possible implementation method provides a variety of code rate control parameters, and these various code rate control parameters can generate quantization parameters in different ways, improving the implementability of the solution.

在一種可能的實現方式中,根據一個或多個碼率控制參數確定當前塊的量化參數,包括:獲取已解碼圖像塊的碼率控制參數;根據已解碼圖像塊的碼率控制參數確定當前塊的量化參數。 In a possible implementation, determining the quantization parameters of the current block based on one or more code rate control parameters includes: obtaining the code rate control parameters of the decoded image block; determining based on the code rate control parameters of the decoded image block Quantization parameters of the current block.

該種可能的實現方式,提供了一種根據碼率控制參數生成量化參數的具體實現方式,通過已解碼圖像塊的碼率控制參數確定當前塊的量化參數,有助於建立圖像塊之間的相關性。 This possible implementation provides a specific implementation method of generating quantization parameters based on code rate control parameters. The quantization parameters of the current block are determined through the code rate control parameters of the decoded image blocks, which helps to establish the relationship between image blocks. correlation.

在一種可能的實現方式中,根據一個或多個碼率控制參數確定當前塊的量化參數,包括:獲取已解碼圖像塊的量化參數;根據已解碼圖像塊的量化參數確定當前塊的量化參數。 In a possible implementation, determining the quantization parameter of the current block based on one or more code rate control parameters includes: obtaining the quantization parameter of the decoded image block; determining the quantization parameter of the current block based on the quantization parameter of the decoded image block. parameters.

該種可能的實現方式,提供了一種根據碼率控制參數生成量化參數的具體實現方式,通過已解碼圖像塊的量化參數確定當前塊的量化參數,有助於建立圖像塊之間的相關性。 This possible implementation provides a specific implementation method of generating quantization parameters based on code rate control parameters. The quantization parameters of the current block are determined through the quantization parameters of the decoded image blocks, which helps to establish correlation between image blocks. sex.

在一種可能的實現方式中,在獲取待解碼圖像的資訊之後,該方法還包括:根據當前塊資訊計算當前塊的總比特數,當前塊的總比特數為當前塊解碼後所佔用的比特數;根據總比特數確定可用比特數,可用比特數為存儲當前塊解碼後的圖像資料,可用比特數用於確定當前塊的一個或多個碼率控制參數。 In a possible implementation, after obtaining the information of the image to be decoded, the method further includes: calculating the total number of bits of the current block based on the current block information. The total number of bits of the current block is the bits occupied by the current block after decoding. number; determine the number of available bits based on the total number of bits, the number of available bits is to store the decoded image data of the current block, and the number of available bits is used to determine one or more rate control parameters of the current block.

該種可能的實現方式,提供了一種根據待解碼圖像的資訊確定碼率控制參數的具體實現方式,通過計算圖像塊的可用比特數,有助於提升碼率控制參數的精確度,提升方案可實施性。 This possible implementation provides a specific implementation method for determining the rate control parameters based on the information of the image to be decoded. By calculating the number of available bits of the image block, it helps to improve the accuracy of the rate control parameters and improves Plan feasibility.

在一種可能的實現方式中,根據總比特數確定可用比特數,包括:去除總比特數中用於存儲非圖像資料的其他比特數。 In one possible implementation, determining the number of available bits based on the total number of bits includes: removing other bits used to store non-image data from the total number of bits.

該種可能的實現方式,提供了一種確定可用比特數的具體實現方式,其中,通過去除部分用於存儲非圖像資料的其他比特數,確定用於存儲圖像資料的可用比特數,有助於提升碼率控制參數的精確度,提升方案可實施性。 This possible implementation provides a specific implementation method for determining the number of available bits, in which the number of available bits for storing image data is determined by removing some of the other bits used to store non-image data, which is helpful. In order to improve the accuracy of code rate control parameters and improve the implementability of the solution.

在一種可能的實現方式中,該方法還包括:初始化中間參數,中間參數用於結合一個或多個碼率控制參數確定當前塊的量化參數。 In a possible implementation, the method further includes: initializing intermediate parameters, which are used to determine the quantization parameter of the current block in combination with one or more rate control parameters.

該種可能的實現方式,提供了用於確定量化參數的中間參數的初始化過程,有助於量化參數的生成。 This possible implementation provides an initialization process for determining the intermediate parameters of the quantization parameters, which is helpful for the generation of the quantization parameters.

在一種可能的實現方式中,在根據一個或多個碼率控制參數確定當前塊的量化參數之後,方法還包括:基於一個或多個碼率控制參數,修正量化參數。 In a possible implementation, after determining the quantization parameter of the current block based on one or more code rate control parameters, the method further includes: modifying the quantization parameter based on the one or more code rate control parameters.

該種可能的實現方式中,提供了確定量化參數後,修正量化參數的方法,有助於提升解碼後圖像的品質。 This possible implementation provides a method of correcting the quantization parameters after determining the quantization parameters, which helps to improve the quality of the decoded image.

在一種可能的實現方式中,在根據一個或多個碼率控制參數確定量化參數之後,該方法還包括:更新一個或多個碼率控制參數。 In a possible implementation, after determining the quantization parameter according to the one or more rate control parameters, the method further includes: updating the one or more rate control parameters.

該種可能的實現方式中,提供了更新碼率控制參數的方法,針對待解碼圖像中圖像塊適應性調整,有助於提升方案應用的靈活性。 This possible implementation provides a method for updating the code rate control parameters, and adaptively adjusts the image blocks in the image to be decoded, which helps to improve the flexibility of the solution application.

第二方面,本發明實施例提供一種視頻解碼裝置,該裝置具有實現上述第一方面中任一項的視頻解碼方法的功能。該功能可以通過硬體實現,也可以通過硬體執行相應的軟體實現。該硬體或軟體包括一個或多個與上述功能相對應的模組。 In a second aspect, embodiments of the present invention provide a video decoding device, which has the function of implementing any of the video decoding methods in the first aspect. This function can be realized by hardware, or it can be realized by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

第三方面,提供一種視頻解碼裝置,包括:處理器和記憶體;該記憶體用於存儲電腦執行指令,當該視頻解碼裝置運行時,該處理器執行該記憶體存儲的該電腦執行指令,以使該視頻解碼裝置執行如上述第一方面中任一項的視頻解碼方法。 In a third aspect, a video decoding device is provided, including: a processor and a memory; the memory is used to store computer execution instructions, and when the video decoding device is running, the processor executes the computer execution instructions stored in the memory, So that the video decoding device performs the video decoding method in any one of the above-mentioned first aspects.

第四方面,提供一種電腦可讀存儲介質,該電腦可讀存儲介質中存儲有指令,當其在電腦上運行時,使得電腦可以執行上述第一方面中任一項的視頻解碼方法。 In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions that, when run on a computer, enable the computer to execute any of the video decoding methods of the first aspect.

第五方面,提供一種包含指令的電腦程式產品,當其在電腦上運行時,使得電腦可以執行上述第一方面中任一項的視頻解碼方法。 A fifth aspect provides a computer program product containing instructions that, when run on a computer, enables the computer to execute any of the video decoding methods of the first aspect.

第六方面,提供一種電子設備,電子設備包括視頻解碼裝置,處理電路被配置為執行如上述第一方面中任一項的視頻解碼方法。 A sixth aspect provides an electronic device. The electronic device includes a video decoding device, and the processing circuit is configured to perform the video decoding method in any one of the above-mentioned first aspects.

第七方面,提供一種晶片,晶片包括處理器,處理器和記憶體耦合,記憶體存儲有程式指令,當記憶體存儲的程式指令被處理器執行時實現上述第一方面中任意一項的視頻解碼方法。 A seventh aspect provides a chip. The chip includes a processor. The processor is coupled to a memory. The memory stores program instructions. When the program instructions stored in the memory are executed by the processor, the video of any one of the above first aspects is realized. Decoding method.

第二方面至第七方面中的任一種實現方式所帶來的技術效果可參見第一方面中對應實現方式所帶來的技術效果,此處不再贅述。 The technical effects brought by any implementation method in the second to seventh aspects can be found in the technical effects brought by the corresponding implementation method in the first aspect, and will not be described again here.

Figure 112102125-A0202-12-0043-93
,
Figure 112102125-A0202-12-0043-94
,
Figure 112102125-A0202-12-0043-95
,
Figure 112102125-A0202-12-0043-96
,
Figure 112102125-A0202-12-0043-97
:過程
Figure 112102125-A0202-12-0043-93
,
Figure 112102125-A0202-12-0043-94
,
Figure 112102125-A0202-12-0043-95
,
Figure 112102125-A0202-12-0043-96
,
Figure 112102125-A0202-12-0043-97
:Process

0,1:中央處理器(CPU) 0,1:Central processing unit (CPU)

10:源裝置 10: Source device

100:解碼裝置 100:Decoding device

1001:獲取模組 1001: Get the module

1002:確定模組 1002: Confirm module

1003:解碼模組 1003:Decoding module

101:視頻源 101:Video source

102:視頻編碼器 102:Video encoder

103:輸出介面 103:Output interface

11:目的裝置 11:Destination device

111:顯示裝置 111:Display device

112:視頻解碼器 112:Video decoder

113:輸入介面 113:Input interface

12:鏈路 12:Link

13:存儲裝置 13:Storage device

2:並行單元 2: Parallel unit

20:預處理模組 20: Preprocessing module

201,202,301:求和器 201,202,301:summer

21,31:預測模組 21,31: Prediction module

22:變換模組 22:Transformation module

23:量化模組 23:Quantization module

24:熵編碼模組 24:Entropy coding module

25,32:反量化模組 25,32: Anti-quantization module

26,33:反變換模組 26,33:Inverse transformation module

27,34:參考圖像記憶體 27,34: Reference image memory

30:熵解碼模組 30:Entropy decoding module

50:編解碼裝置 50: Codec device

501:處理器 501: Processor

502:記憶體 502:Memory

503:通信介面 503: Communication interface

504:匯流排 504:Bus

S601,S602,S603,S901,S902,S903:步驟 S601, S602, S603, S901, S902, S903: steps

圖1為本發明實施例提供的編解碼系統的系統架構圖; Figure 1 is a system architecture diagram of a coding and decoding system provided by an embodiment of the present invention;

圖2為本發明實施例提供的視頻編碼器的結構示意圖; Figure 2 is a schematic structural diagram of a video encoder provided by an embodiment of the present invention;

圖3為本發明實施例提供的視頻解碼器的結構示意圖; Figure 3 is a schematic structural diagram of a video decoder provided by an embodiment of the present invention;

圖4為本發明實施例提供的一種視頻解碼的流程示意圖; Figure 4 is a schematic flow chart of video decoding provided by an embodiment of the present invention;

圖5為本發明實施例提供的視頻解碼器結構示意圖; Figure 5 is a schematic structural diagram of a video decoder provided by an embodiment of the present invention;

圖6為本發明實施例提供的視頻解碼方法的流程圖; Figure 6 is a flow chart of a video decoding method provided by an embodiment of the present invention;

圖7為本發明實施例提供的圖像塊位置資訊的示意圖; Figure 7 is a schematic diagram of image block position information provided by an embodiment of the present invention;

圖8為本發明實施例提供的sigmoid函數示意圖; Figure 8 is a schematic diagram of the sigmoid function provided by the embodiment of the present invention;

圖9為本發明實施例提供的確定參數初始化的流程圖; Figure 9 is a flow chart for determining parameter initialization provided by an embodiment of the present invention;

圖10為本發明實施例提供的編碼裝置的結構示意圖。 Figure 10 is a schematic structural diagram of an encoding device provided by an embodiment of the present invention.

在本發明的描述中,除非另有說明,“/”表示“或”的意思,例如,A/B可以表示A或B。本文中的“和/或”僅僅是一種描述關聯對象的關聯關係,表示可以存在三種關係,例如,A和/或B,可以表示:單獨存在A,同時存在A和B,單獨存在B這三種情況。此外,“至少一個”是指一個或多個,“多個”是指兩個或兩個以上。“第一”、“第二”等字樣並不對數量和執行次序進行限定,並且“第一”、“第二”等字樣也並不限定一定不同。 In the description of the present invention, unless otherwise stated, "/" means "or". For example, A/B can mean A or B. "And/or" in this article is just an association relationship that describes related objects, indicating that there can be three kinds of relationships, for example, A and/or B, which can mean: A alone exists, A and B exist simultaneously, and B alone exists. condition. In addition, "at least one" means one or more, and "plurality" means two or more. Words such as "first" and "second" do not limit the quantity and order of execution, and words such as "first" and "second" do not limit the number or order of execution.

需要說明的是,本發明中,“示例性的”或者“例如”等詞用於表示作例子、例證或說明。本發明中被描述為“示例性的”或者“例如”的任何實施例或設計方案不應被解釋為比其他實施例或設計方案更優選或更具優勢。確切而言,使用“示例性的”或者“例如”等詞旨在以具體方式呈現相關概念。 It should be noted that in the present invention, words such as “exemplary” or “for example” are used to represent examples, illustrations or explanations. Any embodiment or design described in the invention as "exemplary" or "such as" is not intended to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the words "exemplary" or "such as" is intended to present the concept in a concrete manner.

首先,對本發明實施例涉及的技術術語進行介紹: First, the technical terms involved in the embodiments of the present invention are introduced:

1、視頻編碼技術 1. Video coding technology

視頻序列存在空間冗餘、時間冗餘、視覺冗餘、資訊熵冗餘、結構冗餘、知識冗餘、重要性冗餘等一系列的冗餘資訊。為了盡可能的去除視頻序列中的冗餘資訊,減少表徵視頻的資料量,提出了視頻編碼技術,以達 到減小存儲空間和節省傳輸頻寬的效果。視頻編碼技術也稱為視頻壓縮技術。 Video sequences have a series of redundant information such as spatial redundancy, temporal redundancy, visual redundancy, information entropy redundancy, structural redundancy, knowledge redundancy, and importance redundancy. In order to remove redundant information in video sequences as much as possible and reduce the amount of data representing videos, video coding technology is proposed to achieve To reduce storage space and save transmission bandwidth. Video encoding technology is also called video compression technology.

在國際通用範圍內,視頻壓縮編碼標準包括但不限於:由運動圖像專家組(Motion Picture Experts Group,MPEG)制定的MPEG-2和MPEG-4標準中第10部分的高級視頻編解碼(Advanced Video Coding,AVC),由國際電信聯盟電信標準化組(International Telecommunication Union-Telecommunication Standardization Sector,ITU-T)制定的H.263、H.264和H.265(又稱高效率視頻編碼(High Efficiency Video Coding,HEVC)標準)。 Internationally, video compression coding standards include but are not limited to: Advanced Video Codec (Advanced Video Codec) Part 10 of the MPEG-2 and MPEG-4 standards developed by the Motion Picture Experts Group (MPEG). Video Coding (AVC), H.263, H.264 and H.265 (also known as High Efficiency Video Coding) formulated by the International Telecommunication Union-Telecommunication Standardization Sector (ITU-T) Coding, HEVC) standard).

需要說明的是,在基於混合編碼架構的編碼演算法中,上述壓縮編碼方式可以被混合使用。 It should be noted that in a coding algorithm based on a hybrid coding architecture, the above compression coding methods can be mixed and used.

視頻壓縮編碼過程中的基本處理單位是圖像塊,該圖像塊是編碼端將一幀/幅圖像進行劃分得到的。以HEVC為例,HEVC定義了編碼樹單元(Coding Tree Unit,CTU)、編碼單元(Coding Unit,CU)、預測單元(Prediction Unit,PU)和變換單元(Transform Unit,TU)。CTU、CU、PU和TU均可作為劃分後得到的圖像塊。其中PU和TU均基於CU進行劃分。 The basic processing unit in the video compression encoding process is the image block, which is obtained by dividing a frame/image at the encoding end. Taking HEVC as an example, HEVC defines a Coding Tree Unit (CTU), a Coding Unit (CU), a Prediction Unit (PU), and a Transform Unit (TU). CTU, CU, PU and TU can all be used as image blocks obtained after division. Both PU and TU are divided based on CU.

2、視頻採樣 2. Video sampling

像素為視頻或圖像最小的完整採樣,因此,對圖像塊進行資料處理是以像素為單位。其中,每個像素記錄顏色資訊,例如,可以通過RGB表示顏色,包括三個圖像通道,R表示紅色red,G表示綠色green,B表示藍色blue;又例如,可以通過YUV表示顏色,包括三個圖像通道,Y表示亮度(luminance),U表示第一色度Cb,V表示第二色度Cr。由於人們對亮度的敏感程度強於對色度的敏感程度,因此,可以通過多存儲亮度,少存儲色度實現減少存儲空間。具體地,在視頻編解碼中,通常採用YUV格式進行視頻採樣,包括420採樣格式、444採樣格式等。該採樣格式基於亮度的取樣數量,確定兩個色度的取樣數量,例如,假設一個CU有4×2 個像素,格式如下: A pixel is the smallest complete sample of a video or image. Therefore, data processing of image blocks is based on pixels. Among them, each pixel records color information. For example, color can be represented by RGB, including three image channels, R represents red, G represents green, and B represents blue. For example, color can be represented by YUV, including Three image channels, Y represents luminance, U represents the first chromaticity Cb, and V represents the second chromaticity Cr. Since people are more sensitive to brightness than chroma, storage space can be reduced by storing more brightness and less chroma. Specifically, in video encoding and decoding, YUV format is usually used for video sampling, including 420 sampling format, 444 sampling format, etc. This sampling format determines the number of samples for two chroma based on the number of luma samples. For example, assuming a CU has 4×2 pixels in the following format:

[Y0,U0,V0][Y1,U1,V1][Y2,U2,V2][Y3,U3,V3] [Y0,U0,V0][Y1,U1,V1][Y2,U2,V2][Y3,U3,V3]

[Y4,U4,V4][Y5,U5,V5][Y6,U6,V6][Y7,U7,V7] [Y4, U4, V4] [Y5, U5, V5] [Y6, U6, V6] [Y7, U7, V7]

420採樣格式表示YUV以4:2:0的格式進行採樣,即亮度與第一色度或第二色度以4:2的比例進行選取,其中第一色度與第二色度隔行選取。則上述CU採樣選取第一行的亮度Y0-Y3,以及第一色度U0和U2,選取第二行的亮度Y4-Y7,以及第二色度V4和V6。該CU經採樣由亮度編碼單元及色度編碼單元構成,其中,亮度編碼單元為: The 420 sampling format means that YUV is sampled in a 4:2:0 format, that is, the brightness and the first chroma or the second chroma are selected in a 4:2 ratio, where the first chroma and the second chroma are selected in alternate rows. Then the above-mentioned CU sampling selects the brightness Y0-Y3 of the first row, and the first chroma U0 and U2, and selects the brightness Y4-Y7 of the second row, and the second chroma V4 and V6. The CU is sampled and composed of a brightness coding unit and a chroma coding unit, where the brightness coding unit is:

[Y0][Y1][Y2][Y3] [Y0][Y1][Y2][Y3]

[Y4][Y5][Y6][Y7] [Y4][Y5][Y6][Y7]

色度編碼單元為: The chroma coding unit is:

[U0][U2] [U0][U2]

[V4][V6] [V4][V6]

類似地,444採樣格式表示YUV以4:4:4的格式進行採樣,即亮度與第一色度和第二色度以4:4:4的比例進行選取。則上述CU經採樣的亮度編碼單元為: Similarly, the 444 sampling format means that YUV is sampled in a 4:4:4 format, that is, the brightness, first chroma and second chroma are selected in a 4:4:4 ratio. Then the sampled brightness coding unit of the above CU is:

[Y0][Y1][Y2][Y3] [Y0][Y1][Y2][Y3]

[Y4][Y5][Y6][Y7] [Y4][Y5][Y6][Y7]

色度編碼單元為: The chroma coding unit is:

[U0,V0][U1,V1][U2,V2][U3,V3] [U0,V0][U1,V1][U2,V2][U3,V3]

[U4,V4][U5,V5][U6,V6][U7,V7] [U4,V4][U5,V5][U6,V6][U7,V7]

上述經採樣得到的亮度編碼單元與色度編碼單元作為後續進行編碼處理的資料單元。 The above-sampled brightness coding unit and chroma coding unit are used as data units for subsequent coding processing.

本發明提供的解碼方法適用於視頻編解碼系統。圖1示出了視頻編解碼系統的結構。 The decoding method provided by the present invention is suitable for video encoding and decoding systems. Figure 1 shows the structure of a video encoding and decoding system.

如圖1所示,視頻編解碼系統包含源裝置10和目的裝置11。源裝置10產生經過編碼後的視頻資料,源裝置10也可以被稱為視頻編碼裝置或視頻編碼設備,目的裝置11可以對源裝置10產生的經過編碼後的視頻資料進行解碼,目的裝置11也可以被稱為視頻解碼裝置或視頻解碼設備。源裝置10和/或目的裝置11可包含至少一個處理器以及耦合到所述至少一個處理器的記憶體。所述記憶體可包含但不限於唯讀記憶體(Read-Only Memory,ROM)、隨機存取記憶體(Random Access Memory,RAM)、電子可抹除可程式唯讀記憶體(Electrically Erasable Programmable Read-Only Memory,EEPROM)、快閃記憶體或可用於以可由電腦存取的指令或資料結構的形式存儲所要的程式碼的任何其它媒體,本發明對此不作具體限定。 As shown in FIG. 1 , the video coding and decoding system includes a source device 10 and a destination device 11 . The source device 10 generates encoded video data. The source device 10 may also be called a video encoding device or a video encoding device. The destination device 11 may decode the encoded video data generated by the source device 10. The destination device 11 also Can be called a video decoding device or video decoding device. Source device 10 and/or destination device 11 may include at least one processor and memory coupled to the at least one processor. The memory may include but is not limited to Read-Only Memory (ROM), Random Access Memory (RAM), Electronically Erasable Programmable Read -Only Memory, EEPROM), flash memory or any other media that can be used to store the required program code in the form of instructions or data structures that can be accessed by the computer, which is not specifically limited by the present invention.

源裝置10和目的裝置11可以包括各種裝置,包含桌上型電腦、移動計算裝置、筆記型(例如,膝上型)電腦、平板電腦、機上盒、例如所謂的“智慧”電話等電話手持機、電視機、相機、顯示裝置、數位媒體播放機、視頻遊戲控制台、車載電腦或其類似者等電子設備。 Source device 10 and destination device 11 may include a variety of devices, including desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, telephone handsets such as so-called "smart" phones. Computers, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers or the like.

目的裝置11可經由鏈路12從源裝置10接收經編碼視頻資料。鏈路12可包括能夠將經編碼視頻資料從源裝置10移動到目的裝置11的一個或多個媒體和/或裝置。在一個實例中,鏈路12可包括使得源裝置10能夠即時地將編碼後的視頻資料直接發射到目的裝置11的一個或多個通信媒體。在此實例中,源裝置10可根據通信標準(例如:無線通訊協定)來調製編碼後的視頻資料,並且可以將調製後的視頻資料發射到目的裝置11。上述一個或多個通信媒體可包含無線和/或有線通信媒體,例如:射頻(Radio Frequency,RF)頻譜、一個或多個物理傳輸線。上述一個或多個通信媒體可形成基於分組的網路的一部分,基於分組的網路例如為局域網、廣域網路或全球網路(例如,網際網路)等。上述一個或多個通信媒體可以包含路由器、交換器、基地台,或者實現從源裝置10到目的裝置11的通信的其它設備。 Destination device 11 may receive encoded video material from source device 10 via link 12 . Link 12 may include one or more media and/or devices capable of moving encoded video material from source device 10 to destination device 11 . In one example, link 12 may include one or more communication media that enables source device 10 to instantly transmit encoded video material directly to destination device 11 . In this example, the source device 10 can modulate the encoded video material according to a communication standard (eg, a wireless communication protocol), and can transmit the modulated video material to the destination device 11 . The one or more communication media mentioned above may include wireless and/or wired communication media, such as: radio frequency (Radio Frequency, RF) spectrum, one or more physical transmission lines. The above one or more communication media may form part of a packet-based network, such as a local area network, a wide area network, or a global network (eg, the Internet). The above-mentioned one or more communication media may include routers, switches, base stations, or other devices that implement communication from the source device 10 to the destination device 11 .

在另一實例中,可將編碼後的視頻資料從輸出介面103輸出 到存儲裝置13。類似地,可通過輸入介面113從存儲裝置13存取編碼後的視頻資料。存儲裝置13可包含多種本地存取式資料存儲媒體,例如藍光光碟、數位影音光碟(Digital Video Disc,DVD)、光碟唯讀記憶體(Compact Disc Read-Only Memory,CD-ROM)、快閃記憶體,或用於存儲經編碼視頻資料的其它合適數位存儲媒體。 In another example, the encoded video data can be output from the output interface 103 to storage device 13. Similarly, the encoded video data can be accessed from the storage device 13 through the input interface 113 . The storage device 13 may include a variety of local access data storage media, such as Blu-ray Disc, Digital Video Disc (DVD), Compact Disc Read-Only Memory (CD-ROM), and flash memory. media, or other suitable digital storage media for storing encoded video material.

在另一實例中,存儲裝置13可對應於檔案伺服器或存儲由源裝置10產生的編碼後的視頻資料的另一中間存儲裝置。在此實例中,目的裝置11可經由資料流或下載從存儲裝置13獲取其存儲的視頻資料。檔案伺服器可為任何類型的能夠存儲經編碼的視頻資料並且將經編碼的視頻資料發射到目的裝置11的伺服器。例如,檔案伺服器可以包含全球資訊網(World Wide Web,Web)伺服器(例如,用於網站)、檔案傳輸協定(File Transfer Protocol,FTP)伺服器、網路連結儲存(Network Attached Storage,NAS)裝置以及本地磁碟機。 In another example, storage device 13 may correspond to a file server or another intermediate storage device that stores encoded video data generated by source device 10 . In this example, the destination device 11 may obtain its stored video material from the storage device 13 via data streaming or downloading. The file server may be any type of server capable of storing encoded video data and transmitting the encoded video data to destination device 11 . For example, file servers may include World Wide Web (Web) servers (for example, used for websites), File Transfer Protocol (FTP) servers, Network Attached Storage (NAS) ) device and the local drive.

目的裝置11可通過任何標準資料連接(例如,網際網路連接)存取編碼後的視頻資料。資料連接的實例類型包含適合於存取存儲於檔案伺服器上的編碼後的視頻資料的無線通道、有線連接(例如,纜線數據機等),或兩者的組合。編碼後的視頻資料從檔案伺服器發射的方式可為資料流、下載傳輸或兩者的組合。 Destination device 11 can access the encoded video data through any standard data connection (eg, an Internet connection). Instance types of data connections include wireless channels, wired connections (eg, cable modems, etc.), or a combination of both, suitable for accessing encoded video data stored on a file server. The encoded video data can be transmitted from the file server by streaming, downloading, or a combination of the two.

本發明的解碼方法不限於無線應用場景,示例性的,本發明的解碼方法可以應用於支援以下多種多媒體應用的視頻編解碼:空中電視廣播、有線電視發射、衛星電視發射、資料流視頻發射(例如,經由網際網路)、存儲於資料存儲媒體上的視頻資料的編碼、存儲於資料存儲媒體上的視頻資料的解碼,或其它應用。在一些實例中,視頻編解碼系統可經配置,以支援單向或雙向視頻發射,以支援例如視頻資料流、視頻播放、視頻廣播及/或視頻電話等應用。 The decoding method of the present invention is not limited to wireless application scenarios. For example, the decoding method of the present invention can be applied to video codecs that support the following multimedia applications: over-the-air TV broadcasting, cable TV transmission, satellite TV transmission, data stream video transmission ( For example, via the Internet), encoding of video data stored on a data storage medium, decoding of video data stored on a data storage medium, or other applications. In some examples, the video codec system may be configured to support one-way or two-way video transmission to support applications such as video streaming, video playback, video broadcasting, and/or video telephony.

需要說明的是,圖1示出的視頻編解碼系統僅僅是視頻編解碼系統的示例,並不是對本發明中視頻編解碼系統的限定。本發明提供的編解碼方法還可適用於編碼裝置與解碼裝置之間無資料通信的場景。在其 它實例中,待編碼視頻資料或編碼後的視頻資料可以從本機存放區器檢索,也可以在網路上資料流等。視頻編碼裝置可對待編碼視頻資料進行編碼並且將編碼後的視頻資料存儲到記憶體,視頻解碼裝置也可從記憶體中獲取編碼後的視頻資料並且對該編碼後的視頻資料進行解碼。 It should be noted that the video coding and decoding system shown in FIG. 1 is only an example of the video coding and decoding system, and does not limit the video coding and decoding system in the present invention. The encoding and decoding method provided by the present invention can also be applied to scenarios where there is no data communication between the encoding device and the decoding device. In its In this example, the video data to be encoded or the encoded video data can be retrieved from the local storage area or streamed on the network. The video encoding device can encode the video data to be encoded and store the encoded video data in the memory. The video decoding device can also obtain the encoded video data from the memory and decode the encoded video data.

在圖1中,源裝置10包含視頻源101、視頻編碼器102和輸出介面103。在一些實例中,輸出介面103可包含調製器/解調器(數據機)和/或發射器。視頻源101可包括視頻捕獲裝置(例如,照相機)、含有先前捕獲的視頻資料的視頻存檔、用以從視頻內容提供者接收視頻資料的視頻輸入介面,和/或用於產生視頻資料的電腦圖形系統,或視頻資料的此些來源的組合。 In FIG. 1, source device 10 includes video source 101, video encoder 102, and output interface 103. In some examples, output interface 103 may include a modulator/demodulator (modem) and/or a transmitter. Video source 101 may include a video capture device (e.g., a camera), a video archive containing previously captured video material, a video input interface for receiving video material from a video content provider, and/or computer graphics for generating video material. system, or a combination of these sources of video material.

視頻編碼器102可對來自視頻源101的視頻資料進行編碼。在一些實例中,源裝置10經由輸出介面103將編碼後的視頻資料直接發射到目的裝置11。在其它實例中,編碼後的視頻資料還可存儲到存儲裝置13上,供目的裝置11稍後存取來用於解碼和/或播放。 Video encoder 102 may encode video material from video source 101. In some examples, the source device 10 transmits the encoded video data directly to the destination device 11 via the output interface 103 . In other examples, the encoded video material can also be stored on the storage device 13 for later access by the destination device 11 for decoding and/or playing.

在圖1的實例中,目的裝置11包含顯示裝置111、視頻解碼器112以及輸入介面113。在一些實例中,輸入介面113包含接收器和/或數據機。輸入介面113可經由鏈路12和/或從存儲裝置13接收編碼後的視頻資料。顯示裝置111可與目的裝置11集成或可在目的裝置11外部。一般來說,顯示裝置111顯示解碼後的視頻資料。顯示裝置111可包括多種顯示裝置,例如,液晶顯示器、等離子顯示器、有機發光二極體顯示器或其它類型的顯示裝置。 In the example of FIG. 1 , the destination device 11 includes a display device 111 , a video decoder 112 and an input interface 113 . In some examples, input interface 113 includes a receiver and/or modem. The input interface 113 may receive encoded video data via the link 12 and/or from the storage device 13 . Display device 111 may be integrated with destination device 11 or may be external to destination device 11 . Generally speaking, the display device 111 displays the decoded video material. The display device 111 may include a variety of display devices, such as a liquid crystal display, a plasma display, an organic light emitting diode display, or other types of display devices.

可選的,視頻編碼器102和視頻解碼器112可各自與音訊編碼器和解碼器集成,且可包含適當的多工器-多路分用器單元或其它硬體和軟體,以處理共同資料流程或單獨資料流程中的音訊和視頻兩者的編碼。 Optionally, video encoder 102 and video decoder 112 may each be integrated with an audio encoder and decoder, and may include appropriate multiplexer-demultiplexer units or other hardware and software to process common data. Encoding of both audio and video in the process or in separate data streams.

視頻編碼器102和視頻解碼器112可以包括微處理器、數位訊號處理器(Digital Signal Processor,DSP)、特殊應用積體電路(Application-Specific Integrated Circuit,ASIC)、現場可程式邏輯閘陣列 (Field Programmable Gate Array,FPGA)、離散邏輯電路、硬體或其任何組合。若本發明提供的解碼方法採用軟體實現,則可將用於軟體的指令存儲在合適的非易失性電腦可讀存儲媒體中,且可使用至少一個處理器執行所述指令從而實施本發明。 The video encoder 102 and the video decoder 112 may include a microprocessor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or a field programmable logic gate array. (Field Programmable Gate Array, FPGA), discrete logic circuits, hardware, or any combination thereof. If the decoding method provided by the present invention is implemented by software, the instructions for the software can be stored in a suitable non-volatile computer-readable storage medium, and at least one processor can be used to execute the instructions to implement the present invention.

本發明中的視頻編碼器102和視頻解碼器112可以根據視頻壓縮標準(例如HEVC)操作,也可根據其它業界標準操作,本發明對此不作具體限定。 The video encoder 102 and the video decoder 112 in the present invention may operate according to a video compression standard (such as HEVC) or other industry standards, which are not specifically limited by the present invention.

圖2是本發明實施例中視頻編碼器102的一種示意性框圖。視頻編碼器102可以在預測模組21、變換模組22、量化模組23以及熵編碼模組24分別進行預測、變換、量化以及熵編碼的過程。視頻編碼器102中還包括預處理模組20和求和器202,其中預處理模組20包括分割模組和碼率控制模組。對於視頻塊重構建,視頻編碼器102也包括反量化模組25、反變換模組26、求和器201和參考圖像記憶體27。 FIG. 2 is a schematic block diagram of the video encoder 102 in the embodiment of the present invention. The video encoder 102 may perform prediction, transformation, quantization and entropy coding processes in the prediction module 21, the transformation module 22, the quantization module 23 and the entropy coding module 24 respectively. The video encoder 102 also includes a preprocessing module 20 and a summer 202, where the preprocessing module 20 includes a segmentation module and a code rate control module. For video block reconstruction, the video encoder 102 also includes an inverse quantization module 25, an inverse transform module 26, a summer 201 and a reference image memory 27.

如圖2中所展示,視頻編碼器102接收視頻資料,預處理模組20中的分割模組將資料分割成原始塊。此分割也可包含分割成片(slice)、圖像塊或其它較大單元,以及(例如)根據最大編碼單元(Largest Coding Unit,LCU)及CU的四叉樹結構進行視頻塊分割。示例性的,視頻編碼器102編碼在待編碼的視頻條帶內的視頻塊的組件。一般的,片可劃分成多個原始塊(且可能劃分成稱作圖像塊的原始塊的集合)。通常在分割模組中確定CU、PU以及TU的尺寸。 As shown in Figure 2, video encoder 102 receives video data, and a segmentation module in pre-processing module 20 segments the data into original blocks. This partitioning may also include partitioning into slices, image blocks, or other larger units, and video block partitioning, for example, based on a quadtree structure of a Largest Coding Unit (LCU) and a CU. Illustratively, video encoder 102 encodes components of video blocks within a video slice to be encoded. Generally, a slice may be divided into a plurality of primitive blocks (and possibly into a collection of primitive blocks called image blocks). The sizes of CU, PU and TU are usually determined in the partition module.

預處理模組20中的碼率控制模組獲取CU、PU以及TU的尺寸,以及視頻資料的輸入參數,其中,該輸入參數包括該視頻資料中圖像的解析度、圖像的格式、位寬和輸入像素深度(bits per pixel,bpp);目標bpp。碼率控制模組根據輸入參數和圖像塊尺寸生成碼率控制參數,該碼率控制參數用於生成量化參數以使得量化模組23和反量化模組25進行相關計算。碼率控制模組還可以根據求和器201經重構得到的重建塊,更新碼率控制參數。 The code rate control module in the preprocessing module 20 obtains the sizes of CU, PU and TU, as well as the input parameters of the video data, where the input parameters include the resolution, format, and bits of the image in the video data. Width and input pixel depth (bits per pixel, bpp); target bpp. The code rate control module generates code rate control parameters according to the input parameters and the image block size. The code rate control parameters are used to generate quantization parameters so that the quantization module 23 and the inverse quantization module 25 perform related calculations. The code rate control module can also update the code rate control parameters based on the reconstructed block obtained by the summer 201.

預測模組21可將預測塊提供到求和器202以產生殘差塊,且將該預測塊提供到求和器201經重構得到重建塊,該重建塊用於後續進行預測的參考像素。其中,視頻編碼器102通過原始塊的像素值減去預測塊的像素值來形成像素差值,該像素差值即組成殘差塊,該殘差塊中的資料可包含亮度差及色度差。求和器201表示執行此加法運算的一個或多個組件。預測模組21還可將相關的語法元素發送至熵編碼模組24用於將語法元素合併至碼流。 The prediction module 21 may provide the prediction block to the summer 202 to generate a residual block, and provide the prediction block to the summer 201 for reconstruction to obtain a reconstruction block, which is used as a reference pixel for subsequent prediction. The video encoder 102 forms a pixel difference value by subtracting the pixel value of the prediction block from the pixel value of the original block. The pixel difference value constitutes a residual block. The data in the residual block may include a brightness difference and a chroma difference. . Summer 201 represents one or more components that perform this addition operation. The prediction module 21 may also send relevant syntax elements to the entropy encoding module 24 for merging the syntax elements into the code stream.

變換模組22可將殘差塊劃分為一個或多個TU進行變換。變換模組22可將殘差塊從像素域轉換到變換域(例如,頻域)。例如,使用離散餘弦變換(Discrete Cosine Transform,DCT)或離散正弦變換(Discrete Sine Transform,DST)將殘差塊經變換得到變換係數。變換模組22可將所得變換係數發送到量化模組23。 The transformation module 22 may divide the residual block into one or more TUs for transformation. Transform module 22 may transform the residual block from the pixel domain to the transform domain (eg, frequency domain). For example, a discrete cosine transform (Discrete Cosine Transform, DCT) or a discrete sine transform (Discrete Sine Transform, DST) is used to transform the residual block to obtain the transform coefficient. Transform module 22 may send the resulting transform coefficients to quantization module 23.

量化模組23對變換係數進行量化以進一步減小碼率得到量化係數。量化過程可減少與係數中的一些或全部相關聯的比特深度。可通過調整量化參數來修改量化的程度。在一些可行的實施方式中,量化模組23可接著執行包含經量化變換係數的矩陣的掃描。替代的,熵編碼模組24可執行掃描。 The quantization module 23 quantizes the transform coefficients to further reduce the code rate to obtain quantized coefficients. The quantization process can reduce the bit depth associated with some or all of the coefficients. The degree of quantization can be modified by adjusting the quantization parameters. In some possible implementations, quantization module 23 may then perform a scan of the matrix containing the quantized transform coefficients. Alternatively, entropy encoding module 24 may perform scanning.

在量化之後,熵編碼模組24可熵編碼量化係數。例如,熵編碼模組24可執行基於上下文(或前文參考)之適應性變動長度編碼法(Context-Based Adaptive Variable-Length Coding,CAVLC)、前文參考之可適性算術編碼(Context-based Adaptive Binary Arithmetic Coding,CABAC)、基於語法的上下文自我調整性二進位算術解碼(Syntax-Based Context-Adaptive Binary Arithmetic Coding,SBAC)、概率區間分割熵(Probability Interval Partitioning Entropy,PIPE)解碼或其他熵編碼方法或技術。在通過熵編碼模組24進行熵編碼之後,可將經編碼碼流傳輸到視頻解碼器112或存檔以供稍後傳輸或由視頻解碼器112檢索。 After quantization, entropy encoding module 24 may entropy encode the quantized coefficients. For example, the entropy coding module 24 can execute context-based (or previously referenced) adaptive variable length coding (Context-Based Adaptive Variable-Length Coding, CAVLC), previously referenced adaptive arithmetic coding (Context-based Adaptive Binary Arithmetic). Coding (CABAC), Syntax-Based Context-Adaptive Binary Arithmetic Coding (SBAC), Probability Interval Partitioning Entropy (PIPE) decoding or other entropy coding methods or technologies . After entropy encoding by entropy encoding module 24, the encoded codestream may be transmitted to video decoder 112 or archived for later transmission or retrieval by video decoder 112.

反量化模組25及反變換模組26分別應用反量化與反變換,求和器201將反變換後的殘差塊得和預測的殘差塊相加以產生重建塊,該 重建塊用作後續原始塊進行預測的參考像素。該重建塊存儲於參考圖像記憶體27中。 The inverse quantization module 25 and the inverse transform module 26 apply inverse quantization and inverse transform respectively, and the summer 201 adds the inversely transformed residual block and the predicted residual block to generate a reconstruction block. The reconstructed block is used as a reference pixel for subsequent original blocks for prediction. The reconstructed block is stored in the reference image memory 27 .

圖3是本發明實施例中視頻解碼器112的結構示意圖。如圖3所示,視頻解碼器112包含熵解碼模組30、預測模組31、反量化模組32、反變換模組33、求和器301和參考圖像記憶體34。其中,熵解碼模組30包括解析模組和碼率控制模組。在一些可行的實施方式中,視頻解碼器112可執行與關於來自圖2的視頻編碼器102描述的編碼流程的示例性地互逆的解碼流程。 FIG. 3 is a schematic structural diagram of the video decoder 112 in an embodiment of the present invention. As shown in FIG. 3 , the video decoder 112 includes an entropy decoding module 30 , a prediction module 31 , an inverse quantization module 32 , an inverse transform module 33 , a summer 301 and a reference image memory 34 . Among them, the entropy decoding module 30 includes an analysis module and a code rate control module. In some possible implementations, video decoder 112 may perform an exemplary reciprocal decoding process to the encoding process described with respect to video encoder 102 from FIG. 2 .

在解碼過程期間,視頻解碼器112從視頻編碼器102接收經編碼的視頻的碼流。視頻解碼器112的熵解碼模組30中的解析模組對碼流進行熵解碼,以產生量化係數和語法元素。熵解碼模組30將語法元素轉遞到預測模組31。視頻解碼器112可在視頻片層級和/或視頻塊層級處接收語法元素。 During the decoding process, video decoder 112 receives a codestream of encoded video from video encoder 102 . The parsing module in the entropy decoding module 30 of the video decoder 112 entropy decodes the code stream to generate quantization coefficients and syntax elements. Entropy decoding module 30 passes the syntax elements to prediction module 31. Video decoder 112 may receive syntax elements at the video slice level and/or the video block level.

熵解碼模組30中的碼率控制模組根據解析模組得到的待解碼圖像的資訊,生成碼率控制參數,該碼率控制參數用於生成量化參數以使得反量化模組32進行相關計算。碼率控制模組還可以根據求和器301經重構得到的重建塊,更新碼率控制參數。 The code rate control module in the entropy decoding module 30 generates code rate control parameters based on the information of the image to be decoded obtained by the analysis module. The code rate control parameters are used to generate quantization parameters to enable the inverse quantization module 32 to perform correlation calculate. The code rate control module can also update the code rate control parameters based on the reconstructed block obtained by the summer 301.

反量化模組32對碼流中所提供且通過熵解碼模組30所解碼的量化係數以及所生成的量化參數進行反量化(例如,解量化)。反量化過程可包含使用通過視頻編碼器102針對視頻片中的每一視頻塊所計算的量化參數確定量化的程度,且同樣地確定應用的反量化的程度。反變換模組33將反變換(例如,DCT、DST等變換方法對應的反變換方法)應用於反量化後的變換係數,將反量化後的變換係數按照反變換單元在像素域中產生反變換後的殘差塊。其中,反變換單元的尺寸與TU的尺寸相同,反變換方法與變換方法採用同樣的變換方法中相應的正變換與反變換,例如,DCT、DST的反變換為反DCT、反DST或概念上類似的反變換過程。 The inverse quantization module 32 performs inverse quantization (eg, dequantization) on the quantization coefficients provided in the code stream and decoded by the entropy decoding module 30 and the generated quantization parameters. The inverse quantization process may include determining the degree of quantization using quantization parameters calculated by video encoder 102 for each video block in the video slice, and likewise determining the degree of inverse quantization applied. The inverse transform module 33 applies the inverse transform (for example, the inverse transform method corresponding to DCT, DST and other transform methods) to the inverse quantized transform coefficients, and uses the inverse transform coefficients to generate inverse transforms in the pixel domain according to the inverse transform unit. The final residual block. Among them, the size of the inverse transformation unit is the same as the size of the TU, and the inverse transformation method and the transformation method adopt the corresponding forward transformation and inverse transformation in the same transformation method. For example, the inverse transformation of DCT and DST is inverse DCT, inverse DST or conceptually Similar inverse transformation process.

預測模組31生成預測塊後,視頻解碼器112通過將來自反變 換模組33的反變換後的殘差塊與通過與預測塊求和來形成經解碼視頻塊。求和器301表示執行此求和運算的一個或多個組件。在需要時,也可應用解塊濾波器來對經解碼塊進行濾波以便去除塊效應偽影。給定幀或圖像中的經解碼的視塊存儲於參考圖像記憶體34中,作為後續進行預測的參考像素。 After the prediction module 31 generates the prediction block, the video decoder 112 inverts the The decoded video block is formed by summing the inverse-transformed residual block of transform group 33 with the prediction block. Summer 301 represents one or more components that perform this summation operation. When necessary, a deblocking filter may also be applied to filter the decoded blocks in order to remove blocking artifacts. Decoded visual blocks in a given frame or image are stored in reference image memory 34 as reference pixels for subsequent predictions.

本發明提供一種可能的視頻編/解碼實現方式,如圖4所示,圖4為本發明提供的一種視頻編/解碼的流程示意圖,該視頻編/解碼實現方式包括過程

Figure 112102125-A0202-12-0014-12
至過程
Figure 112102125-A0202-12-0014-13
,過程
Figure 112102125-A0202-12-0014-15
至過程
Figure 112102125-A0202-12-0014-17
可以由上述的源裝置10、視頻編碼器102、目的裝置11或視頻解碼器112中的任意一個或多個執行。 The present invention provides a possible video encoding/decoding implementation, as shown in Figure 4. Figure 4 is a schematic flow chart of a video encoding/decoding provided by the present invention. The video encoding/decoding implementation includes a process
Figure 112102125-A0202-12-0014-12
to process
Figure 112102125-A0202-12-0014-13
,Process
Figure 112102125-A0202-12-0014-15
to process
Figure 112102125-A0202-12-0014-17
It may be executed by any one or more of the above-mentioned source device 10, video encoder 102, destination device 11 or video decoder 112.

過程

Figure 112102125-A0202-12-0014-18
:將一幀圖像分成一個或多個互相不重疊的並行單元。該一個或多個並行單元間無依賴關係,可完全並行/獨立編碼和解碼,如圖4所示出的並行單元1和並行單元2。 Process
Figure 112102125-A0202-12-0014-18
: Divide a frame of image into one or more parallel units that do not overlap with each other. There is no dependency between the one or more parallel units, and they can be fully parallel/independently encoded and decoded, as shown in Figure 4 as parallel unit 1 and parallel unit 2.

過程

Figure 112102125-A0202-12-0014-19
:對於每個並行單元,可再將其分成一個或多個互相不重疊的獨立單元,各個獨立單元間可相互不依賴,但可以共用一些並行單元頭資訊。 Process
Figure 112102125-A0202-12-0014-19
: For each parallel unit, it can be divided into one or more independent units that do not overlap with each other. The independent units may not depend on each other, but they can share some parallel unit header information.

獨立單元既可以是包括亮度Y、第一色度Cb、第二色度Cr三個分量,或RGB三個分量,也可以僅包含其中的某一個分量。若獨立單元包含三個分量,則這三個分量的尺寸可以完全一樣,也可以不一樣,具體與圖像的輸入格式相關。 The independent unit may include three components of brightness Y, first chromaticity Cb, and second chromaticity Cr, or three components of RGB, or may include only one of the components. If the independent unit contains three components, the sizes of the three components can be exactly the same or different, depending on the input format of the image.

過程

Figure 112102125-A0202-12-0014-20
:對於每個獨立單元,可再將其分成一個或多個互相不重疊的編碼單元,獨立單元內的各個編碼單元可相互依賴,如多個編碼單元可以進行相互參考預編解碼。 Process
Figure 112102125-A0202-12-0014-20
: For each independent unit, it can be divided into one or more coding units that do not overlap with each other. Each coding unit within the independent unit can be dependent on each other. For example, multiple coding units can perform mutual reference precoding and decoding.

若編碼單元與獨立單元尺寸相同(即獨立單元僅分成一個編碼單元),則其尺寸可為過程

Figure 112102125-A0202-12-0014-21
所述的所有尺寸。 If the coding unit is the same size as the independent unit (that is, the independent unit is only divided into one coding unit), its size can be
Figure 112102125-A0202-12-0014-21
All sizes stated.

編碼單元既可以是包括亮度Y、第一色度Cb、第二色度Cr三個分量(或RGB三分量),也可以僅包含其中的某一個分量。若包含三個分量,幾個分量的尺寸可以完全一樣,也可以不一樣,具體與圖像輸入 格式相關。 The coding unit may include three components of brightness Y, first chroma Cb, and second chroma Cr (or three RGB components), or may include only one of the components. If it contains three components, the sizes of the components can be exactly the same or different, depending on the image input. Format related.

值得注意的是,過程

Figure 112102125-A0202-12-0015-23
是視頻編解碼方法中一個可選的步驟,視頻編/解碼器可以對過程
Figure 112102125-A0202-12-0015-26
獲得的獨立單元進行殘差係數(或殘差值)進行編/解碼。 It is worth noting that the process
Figure 112102125-A0202-12-0015-23
It is an optional step in the video encoding and decoding method. The video encoding/decoder can
Figure 112102125-A0202-12-0015-26
The obtained independent unit performs encoding/decoding on the residual coefficients (or residual values).

過程

Figure 112102125-A0202-12-0015-27
:對於編碼單元,可以將其可再將其分成一個或多個互相不重疊的預測組(Prediction Group,PG),PG也可簡稱為Group,各個PG按照選定預測模式進行編解碼,得到PG的預測值,組成整個編碼單元的預測值,基於預測值和編碼單元的原始值,獲得編碼單元的殘差值。 Process
Figure 112102125-A0202-12-0015-27
: For the coding unit, it can be divided into one or more non-overlapping prediction groups (PG). PG can also be referred to as Group. Each PG is encoded and decoded according to the selected prediction mode to obtain the PG The predicted value constitutes the predicted value of the entire coding unit. Based on the predicted value and the original value of the coding unit, the residual value of the coding unit is obtained.

過程

Figure 112102125-A0202-12-0015-28
:基於編碼單元的殘差值,對編碼單元進行分組,獲得一個或多個相不重疊的殘差小塊(Residual Block,RB),各個RB的殘差係數按照選定模式進行編解碼,形成殘差係數流。具體的,可分為對殘差係數進行變換和不進行變換兩類。 Process
Figure 112102125-A0202-12-0015-28
: Based on the residual value of the coding unit, the coding units are grouped to obtain one or more non-overlapping residual blocks (RB). The residual coefficients of each RB are encoded and decoded according to the selected mode to form a residual block. Differential coefficient flow. Specifically, it can be divided into two categories: transforming the residual coefficients and not transforming them.

其中,過程

Figure 112102125-A0202-12-0015-29
中殘差係數編解碼方法的選定模式可以包括,但不限於下述任一種:半定長編碼方式、指數哥倫布(Golomb)編碼方法、Golomb-Rice編碼方法、截斷一元碼編碼方法、游程編碼方法、直接編碼原始殘差值等。 Among them, the process
Figure 112102125-A0202-12-0015-29
The selected mode of the residual coefficient encoding and decoding method may include, but is not limited to any of the following: semi-fixed length encoding method, exponential Golomb encoding method, Golomb-Rice encoding method, truncated unary code encoding method, run-length encoding method , directly encoding the original residual value, etc.

例如,視頻編碼器可直接對RB內的係數進行編碼。又如,視頻編碼器也可對殘差塊進行變換,如DCT、DST、Hadamard變換等,再對變換後的係數進行編碼。 For example, the video encoder may directly encode the coefficients within the RB. As another example, the video encoder can also transform the residual block, such as DCT, DST, Hadamard transform, etc., and then encode the transformed coefficients.

作為一種可能的示例,當RB較小時,視頻編碼器可直接對RB內的各個係數進行統一量化,再進行二值化編碼。若RB較大,可進一步劃分為多個係數組(Coefficient Group,CG),再對各個CG進行統一量化,再進行二值化編碼。在本發明的一些實施例中,係數組(CG)和量化組(QG)可以相同。 As a possible example, when the RB is small, the video encoder can directly quantize each coefficient in the RB uniformly, and then perform binary encoding. If the RB is large, it can be further divided into multiple coefficient groups (CG), and then each CG can be uniformly quantized and then binary encoded. In some embodiments of the invention, the coefficient group (CG) and the quantization group (QG) may be the same.

下面以半定長編碼方式對殘差係數編碼的部分進行示例性說明。首先,將一個RB塊內殘差絕對值的最大值定義為修整最大值(modified maximum,mm)。其次,確定該RB塊內殘差係數的編碼比特 數(同一個RB塊內殘差係數的編碼比特數一致)。例如,若當前RB塊的關鍵限值(Critical Limit,CL)為2,當前殘差係數為1,則編碼殘差係數1需要2個比特,表示為01。若當前RB塊的CL為7,則表示編碼8-bit的殘差係數和1-bit的符號位。CL的確定是去找滿足當前子塊所有殘差都在[-2^(M-1),2^(M-1)]範圍之內的最小M值。若同時存在-2^(M-1)和2^(M-1)兩個邊界值,則M應增加1,即需要M+1個比特編碼當前RB塊的所有殘差;若僅存在-2^(M-1)和2^(M-1)兩個邊界值中的一個,則需要編碼一個Trailing位來確定該邊界值是-2^(M-1)還是2^(M-1);若所有殘差均不存在-2^(M-1)和2^(M-1)中的任何一個,則無需編碼該Trailing位。 The following is an exemplary description of the residual coefficient coding part using semi-fixed length coding. First, the maximum value of the absolute value of the residual within an RB block is defined as the modified maximum (mm). Secondly, determine the coding bits of the residual coefficient in the RB block number (the number of coding bits of the residual coefficient in the same RB block is consistent). For example, if the critical limit (CL) of the current RB block is 2 and the current residual coefficient is 1, then 2 bits are needed to encode the residual coefficient 1, which is expressed as 01. If the CL of the current RB block is 7, it means encoding an 8-bit residual coefficient and a 1-bit sign bit. The determination of CL is to find the minimum M value that satisfies all residuals of the current sub-block to be within the range of [-2^(M-1), 2^(M-1)]. If there are two boundary values -2^(M-1) and 2^(M-1) at the same time, M should be increased by 1, that is, M+1 bits are needed to encode all the residuals of the current RB block; if there are only - One of the two boundary values 2^(M-1) and 2^(M-1), you need to encode a Trailing bit to determine whether the boundary value is -2^(M-1) or 2^(M-1 ); If none of -2^(M-1) and 2^(M-1) exists in all residuals, there is no need to encode the Trailing bit.

另外,對於某些特殊的情況,視頻編碼器也可以直接編碼圖像的原始值,而不是殘差值。 In addition, for some special cases, the video encoder can also directly encode the original value of the image instead of the residual value.

上述視頻編碼器102以及視頻解碼器112也可以通過另外一種實現形態來實現,例如,採用通用的數位處理器系統實現,如圖5所示的編解碼裝置50,該編解碼裝置50可以為上述視頻編碼器102中的部分或全部裝置,也可以為上述視頻解碼器112中的部分或全部裝置。 The above-mentioned video encoder 102 and video decoder 112 can also be implemented in another implementation form, for example, using a general-purpose digital processor system, such as the codec device 50 shown in Figure 5. The codec device 50 can be the above-mentioned codec device 50. Some or all of the devices in the video encoder 102 may also be some or all of the devices in the video decoder 112 described above.

該編解碼裝置50可以是應用於編碼側,也可以是應用於解碼側。編解碼裝置50包括處理器501以及記憶體502。所述處理器501與記憶體502相連接(如通過匯流排504相互連接)。可選的,編解碼裝置50還可包括通信介面503,通信介面503連接處理器501和記憶體502,用於接收/發送資料。 The codec device 50 may be applied to the encoding side or the decoding side. The encoding and decoding device 50 includes a processor 501 and a memory 502. The processor 501 is connected to the memory 502 (eg, connected to each other through a bus 504). Optionally, the encoding and decoding device 50 may also include a communication interface 503, which is connected to the processor 501 and the memory 502 for receiving/sending data.

記憶體502可以為隨機存取記憶體(Random Access Memory,RAM)、唯讀記憶體(Read-Only Memory,ROM)、可抹除可程式唯讀記憶體(Erasable Programmable Read Only Memory,EPROM)或光碟唯讀記憶體(Compact Disc Read-Only Memory,CD-ROM)。該記憶體502用於存儲相關程式碼及視頻資料。 The memory 502 can be a random access memory (Random Access Memory, RAM), a read-only memory (Read-Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM) or Compact Disc Read-Only Memory (CD-ROM). The memory 502 is used to store relevant program codes and video data.

處理器501可以是一個或多個中央處理器(Central Processing Unit,CPU),例如圖5中所示的CPU 0和CPU 1。在處理器501是一個 CPU的情況下,該CPU可以是單核CPU,也可以是多核CPU。 The processor 501 may be one or more central processing units (Central Processing Units, CPUs), such as CPU 0 and CPU 1 shown in FIG. 5 . The processor 501 is a In the case of a CPU, the CPU can be a single-core CPU or a multi-core CPU.

該處理器501用於讀取所記憶體502中存儲的程式碼,執行圖6所對應的任意一個實施方案及其各種可行的實施方式的操作。 The processor 501 is used to read the program code stored in the memory 502 and perform operations corresponding to any one of the implementations and various feasible implementations corresponding to FIG. 6 .

以下,結合上述圖1示出的視頻編解碼系統、圖2示出的視頻編碼器102以及圖3示出的視頻解碼器112對本發明提供的解碼方法進行詳細描述。 The decoding method provided by the present invention will be described in detail below with reference to the above-mentioned video encoding and decoding system shown in FIG. 1 , the video encoder 102 shown in FIG. 2 , and the video decoder 112 shown in FIG. 3 .

如圖6所示,為本發明提供的一種視頻解碼方法的流程圖。該方法包括以下步驟。 As shown in Figure 6, it is a flow chart of a video decoding method provided by the present invention. The method includes the following steps.

步驟S601、視頻解碼器獲取待解碼圖像中當前塊的一個或多個碼率控制參數。其中,待解碼圖像由多個圖像塊構成,當前塊為多個圖像塊中的任意一塊。其中,碼率控制參數用於生成量化參數,該量化參數應用於解碼過程中的反量化過程,如上述圖3中關於反量化模組32的描述。碼率控制參數包括當前塊的資源充裕度、當前塊的複雜度、當前塊的預測比特數、當前塊的平均量化參數和量化參數變化值。資源充裕度是指用於存儲當前塊的資源在用於存儲該待解碼圖像的資源中的充足程度。當前塊的複雜度是指待解碼圖像中已解碼圖像塊的複雜程度。當前塊的預測比特數是指預估當前塊解碼後佔用的資源。當前塊的平均量化參數用於表徵待解碼圖像中已解碼圖像塊的量化參數的平均程度。量化參數的變化值是指待解碼圖像中已解碼圖像塊之間量化參數的變化值。 Step S601: The video decoder obtains one or more rate control parameters of the current block in the image to be decoded. The image to be decoded is composed of multiple image blocks, and the current block is any one of the multiple image blocks. Among them, the code rate control parameters are used to generate quantization parameters, and the quantization parameters are used in the inverse quantization process in the decoding process, as described above for the inverse quantization module 32 in FIG. 3 . The code rate control parameters include the resource adequacy of the current block, the complexity of the current block, the number of predicted bits of the current block, the average quantization parameter of the current block, and the change value of the quantization parameter. The resource adequacy refers to the adequacy of the resources used to store the current block among the resources used to store the image to be decoded. The complexity of the current block refers to the complexity of the decoded image blocks in the image to be decoded. The predicted number of bits of the current block refers to the estimated resources occupied by the current block after decoding. The average quantization parameter of the current block is used to characterize the average degree of the quantization parameter of the decoded image block in the image to be decoded. The change value of the quantization parameter refers to the change value of the quantization parameter between decoded image blocks in the image to be decoded.

可選的,在步驟S601之前,該方法還包括,視頻解碼器獲取待解碼圖像的資訊,該待解碼圖像的資訊包括待解碼圖像的基本資訊和待解碼圖像中圖像塊的資訊。其中,基本資訊包括以下資訊的一種或多種。 Optionally, before step S601, the method also includes: the video decoder obtains information of the image to be decoded, where the information of the image to be decoded includes basic information of the image to be decoded and image blocks in the image to be decoded. information. Among them, basic information includes one or more of the following information.

待解碼圖像的解析度,用於表示待解碼圖像中所包含的像素個數,通常由水平像素和垂直像素構成。示例性的,640×480表示水平像素為640個單位,垂直像素為480個單位,該圖像的解析度為307200像素,也可以表示為30萬像素。 The resolution of the image to be decoded is used to represent the number of pixels contained in the image to be decoded, which is usually composed of horizontal pixels and vertical pixels. For example, 640×480 means that the horizontal pixels are 640 units and the vertical pixels are 480 units. The resolution of the image is 307,200 pixels, which can also be expressed as 300,000 pixels.

待解碼圖像的格式,是指待解碼圖像的採樣格式,可參考上 述關於視頻採樣的描述。 The format of the image to be decoded refers to the sampling format of the image to be decoded. Please refer to the above Describes video sampling.

待解碼圖像的位寬,是指用於存儲待解碼圖像的每個像素的深度。例如,一幅彩色圖像的每個像素用R,G,B三個分量表示,若每個分量用8位,那麼一個像素共用24位表示,也就說像素的深度為24。 The bit width of the image to be decoded refers to the depth of each pixel used to store the image to be decoded. For example, each pixel of a color image is represented by three components: R, G, and B. If each component is represented by 8 bits, then one pixel is represented by a total of 24 bits, which means that the depth of the pixel is 24.

其中,待解碼圖像中圖像塊的資訊包括以下資訊的一種或多種。 The information of the image blocks in the image to be decoded includes one or more of the following information.

待解碼圖像的輸入像素深度(bpp),是指傳輸待解碼圖像的每個像素的深度。例如,期望該圖像在碼流中以每個像素佔用18位進行傳輸,若該圖像以RGB三個分量表示,則每個分量佔用6位,相比上述用於存儲圖像的位寬節省2個比特位。需要說明的是,bpp通常情況下小於等於位寬,該bpp通常在編碼階段確定並寫入碼流中供解碼端獲取。 The input pixel depth (bpp) of the image to be decoded refers to the depth of each pixel of the image to be decoded. For example, it is expected that the image will be transmitted in the code stream with each pixel occupying 18 bits. If the image is represented by RGB three components, each component will occupy 6 bits. Compared with the above bit width used to store the image Save 2 bits. It should be noted that bpp is usually less than or equal to the bit width. The bpp is usually determined during the encoding stage and written into the code stream for the decoder to obtain.

待解碼圖像中圖像塊的尺寸資訊(block_size),其中,圖像塊的尺寸可以相同或不同,相應地,待解碼圖像中所有圖像塊的尺寸資訊也可根據該資訊推算,或在碼流中直接獲取,本發明對此不作限制。關於圖像塊的尺寸資訊可參考上述關於圖2的描述,例如CU、PU以及TU的一種或多種尺寸,具體可以為8×8、16×8等其他尺寸。 The size information (block_size) of the image blocks in the image to be decoded, where the sizes of the image blocks can be the same or different. Correspondingly, the size information of all image blocks in the image to be decoded can also be calculated based on this information, or It is obtained directly from the code stream, and the present invention does not limit this. Regarding the size information of the image block, please refer to the above description of Figure 2, such as one or more sizes of CU, PU, and TU, which may be other sizes such as 8×8, 16×8, etc.

當前塊的位置資訊,是指當前塊在待編碼圖像中的位置資訊。如圖7所示,待編碼圖像的尺寸為8×4,並按照2×2的圖像塊大小進行劃分,則可分為8小塊,假設圖中陰影部分為當前塊,則當前塊在待編碼圖像中的位置可以以座標的形式表示為(1,1)。 The position information of the current block refers to the position information of the current block in the image to be encoded. As shown in Figure 7, the size of the image to be encoded is 8×4 and is divided according to the image block size of 2×2, which can be divided into 8 small blocks. Assume that the shaded part in the figure is the current block, then the current block The position in the image to be encoded can be expressed in the form of coordinates as (1, 1).

重建圖像塊,也可以稱為重建塊,是指根據反變換後的殘差塊與預測的殘差塊經重構得到多個像素形成的圖像塊,如圖3中所示的重建塊。 The reconstructed image block, which can also be called a reconstruction block, refers to an image block formed by multiple pixels obtained by reconstructing the inverse-transformed residual block and the predicted residual block. The reconstruction block shown in Figure 3 .

其中,根據上述基本資訊和各個圖像塊的資訊至少可以得到該待解碼圖像的資源,以及該待解碼圖像中每個圖像塊所佔用的資源,該資源可以通過以下部分或全部資訊表示:當前塊的剩餘比特數(remain_bits),是指存儲待解碼圖像的資源中未被已解碼圖像塊佔用的 比特資源; Among them, according to the above basic information and the information of each image block, at least the resources of the image to be decoded and the resources occupied by each image block in the image to be decoded can be obtained. The resources can be obtained through some or all of the following information: Represents: the remaining bits of the current block (remain_bits), which refers to the resources that store the image to be decoded that are not occupied by the decoded image block. bit resources;

當前塊的剩餘塊個數(remain_blocks),是指待解碼圖像中未解碼圖像塊的個數; The number of remaining blocks (remain_blocks) of the current block refers to the number of undecoded image blocks in the image to be decoded;

實際比特數,是指存儲待解碼圖像的資源中每塊已解碼圖像塊分別佔用的比特資源。 The actual number of bits refers to the bit resources occupied by each decoded image block in the resource that stores the image to be decoded.

需要說明的是,上述待解碼圖像的資訊的獲取方式為本領域技術人員所熟知,例如視頻解碼器可通過獲取碼流的頭資訊,以獲取該待解碼圖像的基本資訊,該基本資訊是指該影像檔的格式、解析度、尺寸等資訊,碼流中還包括該待解碼圖像中圖像塊的資訊,例如圖像塊的尺寸以及bpp等資訊。 It should be noted that the above-mentioned method of obtaining the information of the image to be decoded is well known to those skilled in the art. For example, a video decoder can obtain the basic information of the image to be decoded by obtaining the header information of the code stream. The basic information It refers to the format, resolution, size and other information of the image file. The code stream also includes information about the image blocks in the image to be decoded, such as the size of the image blocks and bpp information.

視頻解碼器根據部分或全部的待解碼圖像的資訊確定碼率控制參數。具體地,包括以下5種情況。 The video decoder determines the rate control parameters based on part or all of the information of the image to be decoded. Specifically, the following five situations are included.

情況1、視頻解碼器根據待解碼圖像的資訊確定當前塊的資源充裕度(sufficiency)。 Case 1: The video decoder determines the resource sufficiency of the current block based on the information of the image to be decoded.

1)視頻解碼器根據剩餘比特數(remain_bits)、剩餘塊個數(remain_blocks)、當前塊的尺寸資訊(block_size)和輸入像素深度bpp確定資源充裕度。 1) The video decoder determines resource adequacy based on the number of remaining bits (remain_bits), the number of remaining blocks (remain_blocks), the size information of the current block (block_size), and the input pixel depth bpp.

如果(remain_bits/remain_blocks)>block_size×bpp×M,則表示資源充足;如果(remain_bits/remain_blocks)<block_size×bpp×N,則表示資源不足;其中,M>N>0。 If (remain_bits/remain_blocks)>block_size×bpp×M, it means that the resources are sufficient; if (remain_bits/remain_blocks)<block_size×bpp×N, it means that the resources are insufficient; where, M>N>0.

2)視頻解碼器根據剩餘比特數、剩餘塊個數和當前塊的位置資訊確定資源充裕度。 2) The video decoder determines resource adequacy based on the number of remaining bits, the number of remaining blocks, and the location information of the current block.

具體地,視頻解碼器確定當前塊在待解碼圖像中的位置,進一步地,確定當前塊在該待解碼圖像中並行單元的位置,該並行單元可以為slice和/或組處理單元。具體地,若當前塊處於該並行單元的前1/n位置,則將第一權重係數w1設為1+a;若當前塊處於該並行單元的中間1/n位置, 則將w1設為1;若當前塊處於該並行單元的後1/n位置,則將w1設為1-a,其中,0<a<1。 Specifically, the video decoder determines the position of the current block in the image to be decoded, and further determines the position of the current block in the parallel unit in the image to be decoded. The parallel unit may be a slice and/or group processing unit. Specifically, if the current block is in the first 1/n position of the parallel unit, then the first weight coefficient w1 is set to 1+a; if the current block is in the middle 1/n position of the parallel unit, Then set w1 to 1; if the current block is at the last 1/n position of the parallel unit, set w1 to 1-a, where 0<a<1.

可選的,a隨著前1/n與後1/n相對中間1/n的距離的增加而增加。通過a取值的改變,調整相應的第一權重係數。 Optionally, a increases as the distance between the front 1/n and the back 1/n increases relative to the middle 1/n. By changing the value of a, the corresponding first weight coefficient is adjusted.

sufficiency=w1×(remain_bits/remain_blocks)。 sufficiency=w1×(remain_bits/remain_blocks).

可以理解的是,並行單元不同,第一權重係數不同,當同時考慮當前塊在待解碼圖像中slice的位置和組處理單元的位置時,視頻解碼器可以將各自並行單元的權重係數的乘積作為第一權重係數。 It can be understood that the parallel units are different and the first weight coefficients are different. When considering the position of the current block in the slice in the image to be decoded and the position of the group processing unit at the same time, the video decoder can multiply the weight coefficients of the respective parallel units. as the first weight coefficient.

情況2、視頻解碼器根據已解碼圖像塊的資訊中的重建圖像塊確定當前塊的複雜度(complexity)。 Case 2: The video decoder determines the complexity of the current block based on the reconstructed image block in the information of the decoded image block.

1)變換係數加權法。 1) Transform coefficient weighting method.

具體地,視頻解碼器根據當前塊的前n個重建塊的變換係數進行加權,1

Figure 112102125-A0202-12-0020-30
n
Figure 112102125-A0202-12-0020-31
已解碼圖像塊的個數。已解碼圖像塊的個數可以通過解析碼流獲取,或者根據剩餘塊個數與待解碼圖像的圖像塊個數進行計算得到。其中,變換方法可以為DCT變換、Hadamard變換或DST變換。 Specifically, the video decoder weights the transform coefficients of the previous n reconstructed blocks of the current block, 1
Figure 112102125-A0202-12-0020-30
n
Figure 112102125-A0202-12-0020-31
The number of decoded image blocks. The number of decoded image blocks can be obtained by parsing the code stream, or calculated based on the number of remaining blocks and the number of image blocks of the image to be decoded. Among them, the transformation method can be DCT transformation, Hadamard transformation or DST transformation.

Figure 112102125-A0202-12-0020-98
Figure 112102125-A0202-12-0020-98

其中,Ci表示第i個重建塊的變換係數,Wi表示第i個重建塊的變換係數的權重係數。示例性的,在DCT變換中,包括DC係數和AC係數,DC係數表示已解碼圖像塊中第一個圖像塊的變換係數,AC係數表示已解碼圖像塊中其他圖像塊的變換係數。示例性的,當n為已解碼圖像塊的個數時,DC係數的權重係數設為0,其它AC係數的權重係數設為1。通過上述選取方式,有助於簡化計算過程。 Among them, C i represents the transformation coefficient of the i-th reconstruction block, and Wi represents the weight coefficient of the transformation coefficient of the i-th reconstruction block. For example, in the DCT transformation, DC coefficients and AC coefficients are included. The DC coefficient represents the transformation coefficient of the first image block in the decoded image block, and the AC coefficient represents the transformation of other image blocks in the decoded image block. coefficient. For example, when n is the number of decoded image blocks, the weight coefficient of the DC coefficient is set to 0, and the weight coefficient of other AC coefficients is set to 1. The above selection method helps simplify the calculation process.

需要說明的是,本發明對於n的選取方式不作限制,例如,n為預設的固定值,或者n可以參考上述資源充裕度,當資源充足時n取值較小,當資源不足時n取值較大。 It should be noted that the present invention does not limit the selection method of n. For example, n is a preset fixed value, or n can refer to the above-mentioned resource adequacy. When resources are sufficient, n takes a smaller value. When resources are insufficient, n takes a smaller value. The value is larger.

2)視頻解碼器將當前塊的前n個重建塊的像素值的方差作為 複雜度,其中,1

Figure 112102125-A0202-12-0021-33
n
Figure 112102125-A0202-12-0021-34
已解碼圖像塊的個數。 2) The video decoder takes the variance of the pixel values of the first n reconstructed blocks of the current block as the complexity, where, 1
Figure 112102125-A0202-12-0021-33
n
Figure 112102125-A0202-12-0021-34
The number of decoded image blocks.

3)梯度加權法 3)Gradient weighting method

具體地,視頻解碼器根據當前塊的前n個重建塊的梯度進行加權,1

Figure 112102125-A0202-12-0021-35
n
Figure 112102125-A0202-12-0021-36
已解碼圖像塊的個數。 Specifically, the video decoder is weighted according to the gradient of the previous n reconstructed blocks of the current block, 1
Figure 112102125-A0202-12-0021-35
n
Figure 112102125-A0202-12-0021-36
The number of decoded image blocks.

水平梯度x=第t列重建-第t-1列重建; Horizontal gradient x = reconstruction of column t - reconstruction of column t-1;

垂直梯度y=第s行重建-第s-1行重建; Vertical gradient y = sth row reconstruction - s-1th row reconstruction;

水平複雜度(complexity1)=水平梯度的和(gradx)/grad_block_size; Horizontal complexity (complexity1) = sum of horizontal gradients (gradx)/grad_block_size;

垂直複雜度(complexity2)=垂直梯度的和(grady)/grad_block_size; Vertical complexity (complexity2) = sum of vertical gradients (grady)/grad_block_size;

其中,0

Figure 112102125-A0202-12-0021-37
x
Figure 112102125-A0202-12-0021-38
重建塊的總列數,0
Figure 112102125-A0202-12-0021-41
y
Figure 112102125-A0202-12-0021-40
重建塊的總行數,第t列重建-第t-1列重建表示第t列和第t-1列對應位置的樣本的值兩兩相減,第s行重建-第s-1行重建表示第s行和第s-1行對應位置的樣本的值兩兩相減,grad_block_size是計算梯度重建塊中涉及到的像素點的個數。例如,當前重建塊為4×2,水平複雜度中的grad_block_size為3×2=6(水平方向減少一行),垂直複雜度中的grad_block_size為4×1=4(垂直方向減少一列)。 Among them, 0
Figure 112102125-A0202-12-0021-37
x
Figure 112102125-A0202-12-0021-38
The total number of columns in the reconstruction block, 0
Figure 112102125-A0202-12-0021-41
y
Figure 112102125-A0202-12-0021-40
The total number of rows of the reconstruction block, the tth column reconstruction - the t-1th column reconstruction means that the values of the samples at the corresponding positions in the tth column and the t-1th column are subtracted, the sth row reconstruction - the s-1th row reconstruction means The values of the samples at the corresponding positions in row s and row s-1 are subtracted. grad_block_size is the number of pixels involved in calculating the gradient reconstruction block. For example, the current reconstruction block is 4×2, the grad_block_size in the horizontal complexity is 3×2=6 (reduce one row in the horizontal direction), and the grad_block_size in the vertical complexity is 4×1=4 (reduce one column in the vertical direction).

4)銳化加權法 4) Sharpening weighting method

具體地,視頻解碼器根據當前塊的前n個重建塊進行銳化,對銳化結果進行加權。其中,1

Figure 112102125-A0202-12-0021-42
n
Figure 112102125-A0202-12-0021-43
已解碼圖像塊的個數。常見的銳化演算法包括Robert、Prewitt、Sobel、Laplacian和Kirsch。 Specifically, the video decoder performs sharpening based on the first n reconstructed blocks of the current block and weights the sharpening results. Among them, 1
Figure 112102125-A0202-12-0021-42
n
Figure 112102125-A0202-12-0021-43
The number of decoded image blocks. Common sharpening algorithms include Robert, Prewitt, Sobel, Laplacian and Kirsch.

complexity1=A1×P; complexity1=A1×P;

complexity2=A2×P; complexity2=A2×P;

complexity=| complexity1|+| complexity2|; complexity=| complexity1|+| complexity2|;

其中,P表示重建塊的所有像素值,A1和A2分別表示上述任意一種銳化演算法的水平運算元和垂直運算元,A1×P表示在P上應用A1運算元。 Among them, P represents all pixel values of the reconstruction block, A1 and A2 respectively represent the horizontal and vertical operands of any of the above-mentioned sharpening algorithms, and A1×P represents the application of the A1 operand on P.

情況3、視頻解碼器根據待解碼圖像的資訊確定當前塊的預 測比特數(pred_bits)。 Case 3: The video decoder determines the prediction of the current block based on the information of the image to be decoded. Number of measured bits (pred_bits).

1)視頻解碼器根據剩餘比特數和剩餘塊個數得到預測比特數。 1) The video decoder obtains the number of predicted bits based on the number of remaining bits and the number of remaining blocks.

pred_bits=remain_bits/remain_blocks。 pred_bits=remain_bits/remain_blocks.

2)視頻解碼器根據已解碼圖像塊的實際比特數(real_bits)加權得到預測比特數。 2) The video decoder weights the number of predicted bits according to the actual number of bits (real_bits) of the decoded image block.

具體地,視頻解碼器根據前n個已解碼圖像塊的實際比特數進行加權,1

Figure 112102125-A0202-12-0022-44
n
Figure 112102125-A0202-12-0022-45
已解碼圖像塊的個數。 Specifically, the video decoder is weighted according to the actual number of bits of the first n decoded image blocks, 1
Figure 112102125-A0202-12-0022-44
n
Figure 112102125-A0202-12-0022-45
The number of decoded image blocks.

pred_bits=B1×real_bits1+B2×real_bits2+......+Bn×real_bitsn; pred_bits=B1×real_bits1+B2×real_bits2+……+Bn×real_bitsn;

其中,B1,B2,......,Bn均大於0,且B1+B2+......+Bn=1。 Among them, B1, B2,..., Bn are all greater than 0, and B1+B2+...+Bn=1.

可選的,在上述通過待編碼圖像的資訊確定至少一種碼率控制參數的基礎上,其他碼率控制參數還可以根據至少一種碼率控制參數推算得到。具體地,包括以下3種情形: Optionally, on the basis of determining at least one rate control parameter through the information of the image to be encoded, other rate control parameters can also be calculated based on at least one rate control parameter. Specifically, the following three situations are included:

情形1、視頻解碼器根據預測比特數和複雜度確定資源充裕度 Scenario 1. The video decoder determines resource adequacy based on the number of predicted bits and complexity.

1)視頻解碼器根據當前塊的資訊(剩餘比特數、剩餘塊個數)和預測比特數確定資源充裕度。 1) The video decoder determines resource adequacy based on the information of the current block (number of remaining bits, number of remaining blocks) and the number of predicted bits.

如果(remain_bits/remain_blocks)>1+a×pred_bits,則表示資源充足; If (remain_bits/remain_blocks)>1+a×pred_bits, it means that the resources are sufficient;

如果(remain_bits/remain_blocks)

Figure 112102125-A0202-12-0022-46
1-a×pred_bits,則表示資源不足; if(remain_bits/remain_blocks)
Figure 112102125-A0202-12-0022-46
1-a×pred_bits means insufficient resources;

其中,0<a<1。 Among them, 0<a<1.

2)視頻解碼器根據當前塊的複雜度和預測比特數,以及前n個已解碼圖像塊的複雜度的最大值(max_complexity),結合當前塊的尺寸資訊和輸入像素深度確定資源充裕度。其中,1

Figure 112102125-A0202-12-0022-47
n
Figure 112102125-A0202-12-0022-48
已解碼圖像塊的個數。 2) The video decoder determines resource adequacy based on the complexity and number of predicted bits of the current block, as well as the maximum complexity (max_complexity) of the first n decoded image blocks, combined with the size information of the current block and the input pixel depth. Among them, 1
Figure 112102125-A0202-12-0022-47
n
Figure 112102125-A0202-12-0022-48
The number of decoded image blocks.

如果complexity/max_complexity×C×block_size×bpp<pred_bits,則表示資源充足; If complexity/max_complexity×C×block_size×bpp<pred_bits, it means that the resources are sufficient;

如果complexity/max_complexity×C×block_size×bpp>pred_bits,則表示資源不足。 If complexity/max_complexity×C×block_size×bpp>pred_bits, it means insufficient resources.

其中,C>1。 Among them, C>1.

情形2、視頻解碼器根據預測比特數和資源充裕度確定複雜度 Scenario 2. The video decoder determines the complexity based on the number of predicted bits and resource abundance.

1)複雜度加權法 1) Complexity weighting method

視頻解碼器根據前n個已解碼圖像塊的複雜度進行加權,1

Figure 112102125-A0202-12-0023-49
n
Figure 112102125-A0202-12-0023-50
已解碼圖像塊的個數; The video decoder is weighted based on the complexity of the first n decoded image blocks, 1
Figure 112102125-A0202-12-0023-49
n
Figure 112102125-A0202-12-0023-50
The number of decoded image blocks;

complexity=D1×complexity1+D2×complexity2+......+Dn×complexityn complexity=D1×complexity1+D2×complexity2+……+Dn×complexityn

其中,D1,D2,......,Dn均大於0,且D1+D2+......+Dn=1。 Among them, D1, D2,..., Dn are all greater than 0, and D1+D2+...+Dn=1.

2)視頻解碼器根據前n個已解碼圖像塊的複雜度(pre_complexity)和當前塊的位置資訊確定當前塊的複雜度。其中,1

Figure 112102125-A0202-12-0023-51
n
Figure 112102125-A0202-12-0023-52
已解碼圖像塊的個數。 2) The video decoder determines the complexity of the current block based on the complexity of the previous n decoded image blocks (pre_complexity) and the position information of the current block. Among them, 1
Figure 112102125-A0202-12-0023-51
n
Figure 112102125-A0202-12-0023-52
The number of decoded image blocks.

具體地,視頻解碼器確定當前塊在待解碼圖像中的位置,進一步地,確定當前塊在該待解碼圖像中並行單元的位置,該並行單元可以為slice和/或組處理單元。若當前塊處於該並行單元的前1/n位置,則將第二權重係數w2設為1+a;若當前塊處於該並行單元的中間1/n位置,則將w2設為1;若當前塊處於該並行單元的後1/n位置,則將w2設為1-a,其中,0<a<1。 Specifically, the video decoder determines the position of the current block in the image to be decoded, and further determines the position of the current block in the parallel unit in the image to be decoded. The parallel unit may be a slice and/or group processing unit. If the current block is in the first 1/n position of the parallel unit, set the second weight coefficient w2 to 1+a; if the current block is in the middle 1/n position of the parallel unit, set w2 to 1; if the current block is in the middle 1/n position of the parallel unit, set w2 to 1 If the block is at the last 1/n position of the parallel unit, then w2 is set to 1-a, where 0<a<1.

可選的,a隨著前1/n與後1/n相對中間1/n的距離的增加而增加。通過a取值的改變,調整相應的第二權重係數。 Optionally, a increases as the distance between the front 1/n and the back 1/n increases relative to the middle 1/n. By changing the value of a, the corresponding second weight coefficient is adjusted.

complexity=w2×pre_complexity; complexity=w2×pre_complexity;

可以理解的是,並行單元不同,第二權重係數不同,當同時考慮當前塊在待解碼圖像中slice的位置和組處理單元的位置時,視頻解碼器可以將各自的權重係數的乘積作為第二權重係數。 It can be understood that the parallel units are different and the second weight coefficients are different. When considering both the position of the slice of the current block in the image to be decoded and the position of the group processing unit, the video decoder can use the product of the respective weight coefficients as the third Two weight coefficients.

3)視頻解碼器根據前n個已解碼圖像塊的預測比特數(pre_pred_bits)、前n個已解碼圖像塊的資源充裕度(pre_sufficiency),以及當前塊的預測比特數、資源充裕度確定當前塊的複雜度。 3) The video decoder determines based on the number of predicted bits (pre_pred_bits) of the first n decoded image blocks, the resource sufficiency (pre_sufficiency) of the first n decoded image blocks, and the number of predicted bits and resource sufficiency of the current block. The complexity of the current block.

如果pred_bits>pre_pred_bits且sufficiency>pre_sufficiency認為是複雜度小; If pred_bits>pre_pred_bits and sufficiency>pre_sufficiency is considered to have low complexity;

如果pred_bits<pre_pred_bits且sufficiency<pre_sufficiency認為是複雜度大。 If pred_bits<pre_pred_bits and sufficiency<pre_sufficiency is considered to be complex.

情形3、視頻解碼器根據資源充裕度和複雜度確定預測比特數 Scenario 3. The video decoder determines the number of predicted bits based on resource abundance and complexity.

1)視頻解碼器根據前n個已解碼圖像塊的預測比特數加權得到當前塊的預測比特數,1

Figure 112102125-A0202-12-0024-53
n
Figure 112102125-A0202-12-0024-56
已解碼圖像塊的個數。 1) The video decoder weights the predicted bit numbers of the previous n decoded image blocks to obtain the predicted bit number of the current block, 1
Figure 112102125-A0202-12-0024-53
n
Figure 112102125-A0202-12-0024-56
The number of decoded image blocks.

pred_bits=E1×pred_bits1+E2×pred_bits2+......+En×pred_bitsn; pred_bits=E1×pred_bits1+E2×pred_bits2+……+En×pred_bitsn;

其中,E1,E2,......,En均大於0,且E1+E2+......+En=1。 Among them, E1, E2,..., En are all greater than 0, and E1+E2+...+En=1.

2)視頻解碼器根據前n個已解碼圖像塊的預測比特數和實際比特數加權得到當前塊的預測比特數,1

Figure 112102125-A0202-12-0024-57
n
Figure 112102125-A0202-12-0024-58
已解碼圖像塊的個數。 2) The video decoder weights the predicted bit number of the previous n decoded image blocks and the actual bit number to obtain the predicted bit number of the current block, 1
Figure 112102125-A0202-12-0024-57
n
Figure 112102125-A0202-12-0024-58
The number of decoded image blocks.

pred_bits=F1×pred_bits1+......+Fn×pred_bitsn+G1×real_bits1+......+Gn×real_bitsn pred_bits=F1×pred_bits1+……+Fn×pred_bitsn+G1×real_bits1+……+Gn×real_bitsn

其中,F1,......,Fn,G1,......,Gn均大於0,且F1+......+Fn+G1+......+Gn=1。 Among them, F1,...,Fn,G1,...,Gn are all greater than 0, and F1+...+Fn+G1+...+Gn=1.

3)視頻解碼器根據前n個已解碼圖像塊的整體複雜度(pre_complexity)、前n個已解碼圖像塊的預測比特數(pre_pred_bits),以及當前塊的複雜度(complexity)加權得到當前塊的預測比特數,1

Figure 112102125-A0202-12-0024-59
n
Figure 112102125-A0202-12-0024-60
已解碼圖像塊的個數。其中,pre_complexity為可變值,以滿足以下公式的計算: 3) The video decoder weights the current block based on the overall complexity of the first n decoded image blocks (pre_complexity), the number of predicted bits of the first n decoded image blocks (pre_pred_bits), and the complexity of the current block (complexity). Number of predicted bits for the block, 1
Figure 112102125-A0202-12-0024-59
n
Figure 112102125-A0202-12-0024-60
The number of decoded image blocks. Among them, pre_complexity is a variable value to satisfy the calculation of the following formula:

pred_bits=clip(complexity/pre_complexity,1-a,1+a)×pre_pred_bits; pred_bits=clip(complexity/pre_complexity,1-a,1+a)×pre_pred_bits;

其中,clip(complexity/pre_complexity,1-a,1+a)表示通過調整pre_complexity使得complexity/pre_complexity的值處於(1-a,1+a)的區間範圍內,0<a<1。 Among them, clip(complexity/pre_complexity, 1-a, 1+a) means adjusting pre_complexity so that the value of complexity/pre_complexity is within the interval range of (1-a, 1+a), 0<a<1.

需要說明的是,其中,pre_complexity可以為前n個已解碼圖像塊的複雜度均值;或者,為前n個已解碼圖像塊的任意一個複雜度;或者,為前n個已解碼圖像塊的複雜度的最大值等其他表示整體複雜度的係數。 It should be noted that pre_complexity can be the average complexity of the first n decoded image blocks; or, it can be any complexity of the first n decoded image blocks; or, it can be the first n decoded images. The maximum complexity of the block and other coefficients that represent the overall complexity.

4)視頻解碼器根據前n個已解碼圖像塊的整體複雜度、實際比特數以及當前塊的複雜度加權得到當前塊的預測比特數,1

Figure 112102125-A0202-12-0025-61
n
Figure 112102125-A0202-12-0025-62
已解碼圖像塊的個數。其中,pre_complexity為可變值,以滿足以下公式的計算; 4) The video decoder obtains the predicted number of bits of the current block based on the overall complexity of the previous n decoded image blocks, the actual number of bits, and the complexity of the current block, 1
Figure 112102125-A0202-12-0025-61
n
Figure 112102125-A0202-12-0025-62
The number of decoded image blocks. Among them, pre_complexity is a variable value to satisfy the calculation of the following formula;

pred_bits=clip(complexity/pre_complexity,1-a,1+a)×real_bits; pred_bits=clip(complexity/pre_complexity,1-a,1+a)×real_bits;

相關係數取值與上述3)相同,此處不再贅述。 The value of the correlation coefficient is the same as 3) above, and will not be described again here.

5)視頻解碼器根據位置資訊獲得經驗值,以及當前塊的複雜度,和前n個已解碼圖像塊的預測比特數加權得到當前塊的預測比特數,1

Figure 112102125-A0202-12-0025-63
n
Figure 112102125-A0202-12-0025-64
已解碼圖像塊的個數。 5) The video decoder obtains the empirical value based on the position information, the complexity of the current block, and the predicted bit number of the previous n decoded image blocks to obtain the predicted bit number of the current block, 1
Figure 112102125-A0202-12-0025-63
n
Figure 112102125-A0202-12-0025-64
The number of decoded image blocks.

具體地,視頻解碼器確定當前塊在待解碼圖像中的位置,進一步地,確定當前塊在該待解碼圖像中並行單元的位置,該並行單元可以為slice和/或組處理單元。具體地,若當前塊處於該並行單元的前1/n位置且複雜度小於第一預設複雜度,則將第三權重係數w3設為1+a;若當前塊處於該並行單元的中間1/n位置,則將w3設為1;若當前塊處於該並行單元的後1/n位置且複雜度大於第二預設複雜度,則將w3設為1-a,其中,0<a<1,第一預設複雜度小於第二預設複雜度。示例性的,a為0.2,第一預設複雜度為2000,第二預設複雜度為10000。 Specifically, the video decoder determines the position of the current block in the image to be decoded, and further determines the position of the current block in the parallel unit in the image to be decoded. The parallel unit may be a slice and/or group processing unit. Specifically, if the current block is in the first 1/n position of the parallel unit and the complexity is less than the first preset complexity, then the third weight coefficient w3 is set to 1+a; if the current block is in the middle 1 of the parallel unit /n position, then set w3 to 1; if the current block is at the last 1/n position of the parallel unit and the complexity is greater than the second preset complexity, then set w3 to 1-a, where 0<a< 1. The first preset complexity is smaller than the second preset complexity. For example, a is 0.2, the first preset complexity is 2000, and the second preset complexity is 10000.

可選的,a隨著前1/n與後1/n相對中間1/n的距離的增加而增加。通過a取值的改變,調整相應的第三權重係數。 Optionally, a increases as the distance between the front 1/n and the back 1/n increases relative to the middle 1/n. By changing the value of a, the corresponding third weight coefficient is adjusted.

可以理解的是,並行單元不同,第三權重係數不同,當同時考慮當前塊在待解碼圖像中slice的位置和組處理單元的位置時,視頻解碼 器可以將各自的權重係數的乘積作為第三權重係數。 It can be understood that the parallel units are different and the third weight coefficient is different. When considering both the position of the slice of the current block in the image to be decoded and the position of the group processing unit, video decoding The device may use the product of respective weight coefficients as the third weight coefficient.

通過上述三種情形,利用碼率控制參數之間的相關性,有助於提升方案可實施性。 Through the above three scenarios, utilizing the correlation between code rate control parameters can help improve the implementability of the solution.

情況4、視頻解碼器根據待解碼圖像的資訊確定平均量化參數(average_quantization)。 Case 4: The video decoder determines the average quantization parameter (average_quantization) based on the information of the image to be decoded.

可選的,視頻解碼器採用上述三種情況中的任意一種情況獲取前n個已解碼圖像塊的量化參數,1

Figure 112102125-A0202-12-0026-65
n
Figure 112102125-A0202-12-0026-66
已解碼圖像塊的個數,獲取前n個已解碼圖像塊的量化參數可參考下文步驟S602的描述。 Optionally, the video decoder uses any of the above three situations to obtain the quantization parameters of the first n decoded image blocks, 1
Figure 112102125-A0202-12-0026-65
n
Figure 112102125-A0202-12-0026-66
The number of decoded image blocks. To obtain the quantization parameters of the first n decoded image blocks, please refer to the description of step S602 below.

1)全域平均 1)Global average

average_quantization=前n塊量化參數之和(total_sum)/n(total_blocks) average_quantization=sum of the quantization parameters of the first n blocks (total_sum)/n(total_blocks)

2)滑動平均 2) Moving average

具體地,視頻解碼器根據位置資訊對應不同權重計算平均量化參數: Specifically, the video decoder calculates the average quantization parameters according to different weights corresponding to the position information:

average_quantizationt=average_quantizationt-1×H1+H2×pre_quantization average_quantization t =average_quantization t-1 ×H1+H2×pre_quantization

其中,t表示當前塊,t-1表示當前塊的前一個已解碼圖像塊,average_quantizationt-1表示前一個已解碼圖像塊的平均量化參數,pre_quantization表示前一個已解碼圖像塊的量化參數。其中,H1+H2=1,H1、H2均大於0。 Among them, t represents the current block, t-1 represents the previous decoded image block of the current block, average_quantization t-1 represents the average quantization parameter of the previous decoded image block, and pre_quantization represents the quantization of the previous decoded image block. parameters. Among them, H1+H2=1, H1 and H2 are both greater than 0.

3)視頻解碼器根據前n個已解碼圖像塊的複雜度和當前塊的複雜度確定平均量化參數。 3) The video decoder determines the average quantization parameter based on the complexity of the previous n decoded image blocks and the complexity of the current block.

具體地,視頻解碼器將前n個已解碼圖像塊的複雜度劃分k個級別,確定當前塊的複雜度在k個級別中的位置,並計算該級別的量化參數的平均值作為當前塊的量化參數。示例性的,級別1為complexity>10000,級別2為1000<complexity<10000,級別3為complexity<1000,若當前塊的複雜度在級別3的範圍內,則計算級別3的量化參數的平均值作為該當前塊的平均量化參數。 Specifically, the video decoder divides the complexity of the first n decoded image blocks into k levels, determines the position of the complexity of the current block in the k levels, and calculates the average of the quantization parameters of this level as the current block quantification parameters. For example, level 1 is complexity>10000, level 2 is 1000<complexity<10000, and level 3 is complexity<1000. If the complexity of the current block is within the range of level 3, calculate the average value of the quantization parameters of level 3. As the average quantization parameter of the current block.

4)視頻解碼器根據前n個已解碼圖像塊的資源充裕度和當前塊的資源充裕度確定平均量化參數。 4) The video decoder determines the average quantization parameter based on the resource adequacy of the previous n decoded image blocks and the resource adequacy of the current block.

5)視頻解碼器根據前n個已解碼圖像塊的預測比特數和當前塊的預測比特數確定平均量化參數。 5) The video decoder determines the average quantization parameter based on the number of predicted bits of the previous n decoded image blocks and the number of predicted bits of the current block.

其中,4)、5)與上述3)類似,劃分級別並計算相應級別的量化參數的平均值,此處不再贅述。 Among them, 4) and 5) are similar to the above 3), dividing levels and calculating the average value of the quantization parameters of the corresponding levels, which will not be described again here.

6)視頻解碼器用當前塊的預測比特數和之前塊的實際比特數進行聚類。 6) The video decoder uses the predicted bit number of the current block and the actual bit number of the previous block to perform clustering.

需要說明的是,上述3)-6)的方法主要採用了根據當前塊的某種資訊和之前N個塊的某種資訊進行聚類,相似類中的塊的量化參數進行平均,其中,還可以針對級別中不同塊使用不同的係數進行加權平均,得到平均量化參數。此外,用於聚類的資訊可以是多種資訊的組合,例如複雜度,資源充裕度,預測比特數中的至少兩個。 It should be noted that the above methods 3)-6) mainly use clustering based on certain information of the current block and certain information of the previous N blocks, and average the quantification parameters of the blocks in similar categories. Among them, Different coefficients can be used for weighted averaging for different blocks in the level to obtain the average quantization parameter. In addition, the information used for clustering can be a combination of multiple information, such as at least two of complexity, resource adequacy, and number of predicted bits.

情況5、視頻解碼器根據待解碼圖像的資訊確定量化參數的變化值(△quantization)。 Case 5: The video decoder determines the change value of the quantization parameter (Δquantization) based on the information of the image to be decoded.

1)視頻解碼器根據前n個已解碼圖像塊的預測比特數和實際比特數的差值的累加,以及當前塊的尺寸資訊映射得到量化參數的變化值。 1) The video decoder obtains the change value of the quantization parameter based on the accumulation of the difference between the predicted bit number and the actual bit number of the previous n decoded image blocks, and the size information mapping of the current block.

其中,前n個已解碼圖像塊的預測比特數和實際比特數的差值的累加由pred_real_sum表示,即

Figure 112102125-A0202-12-0027-102
,1
Figure 112102125-A0202-12-0027-68
n
Figure 112102125-A0202-12-0027-69
已解碼圖像塊的個數。 Among them, the accumulation of the difference between the predicted number of bits and the actual number of bits of the first n decoded image blocks is represented by pred_real_sum, that is
Figure 112102125-A0202-12-0027-102
,1
Figure 112102125-A0202-12-0027-68
n
Figure 112102125-A0202-12-0027-69
The number of decoded image blocks.

△quantization=clip(pred_real_sum/block_size,J1,J2); △quantization=clip(pred_real_sum/block_size,J1,J2);

其中,|J1|和|J2|均小於最大量化參數,該最大量化參數為預設值,表示待解碼圖像塊可採用的最大的量化參數。 Among them, |J1| and |J2| are both smaller than the maximum quantization parameter. The maximum quantization parameter is a preset value and represents the maximum quantization parameter that can be used for the image block to be decoded.

可選的,pred_real_sum可替換為target_real_sum,該target_real_sum表示前n個已解碼圖像塊的目標比特數和實際比特數的差值的累加。其中,目標比特數(target_bits)是指目標像素深度(target bpp) 與當前塊的尺寸資訊的乘積。 Optionally, pred_real_sum can be replaced by target_real_sum, which represents the accumulation of differences between the target number of bits and the actual number of bits of the first n decoded image blocks. Among them, the target number of bits (target_bits) refers to the target pixel depth (target bpp) The product of the current block's size information.

可以理解的是,目標像素深度以塊處理單元為單位,用於表示傳輸當前塊的像素深度,即在基於傳輸待解碼圖像的輸入bpp的基礎上,進一步限定的參數。 It can be understood that the target pixel depth is in units of block processing units and is used to represent the pixel depth of the current block to be transmitted, that is, a further defined parameter based on the input bpp of the image to be decoded.

target_bits=target bpp×block_size; target_bits=target bpp×block_size;

Figure 112102125-A0202-12-0028-100
,1
Figure 112102125-A0202-12-0028-71
n
Figure 112102125-A0202-12-0028-72
已解碼圖像塊的個數
Figure 112102125-A0202-12-0028-100
,1
Figure 112102125-A0202-12-0028-71
n
Figure 112102125-A0202-12-0028-72
The number of decoded image blocks

△quantization=clip(target_real_sum/block_size,J1,J2) △quantization=clip(target_real_sum/block_size,J1,J2)

可選的,pred_real_sum可替換為target_pred_sum,該target_pred_sum表示前n個已解碼圖像塊的目標比特數和預測比特數的差值的累加。 Optionally, pred_real_sum can be replaced by target_pred_sum, which represents the accumulation of the difference between the target bit number and the predicted bit number of the first n decoded image blocks.

Figure 112102125-A0202-12-0028-101
,1
Figure 112102125-A0202-12-0028-75
n
Figure 112102125-A0202-12-0028-76
已解碼圖像塊的個數
Figure 112102125-A0202-12-0028-101
,1
Figure 112102125-A0202-12-0028-75
n
Figure 112102125-A0202-12-0028-76
The number of decoded image blocks

△quantization=clip(target_pred_sum/block_size,J1,J2) △quantization=clip(target_pred_sum/block_size,J1,J2)

示例性的,最大量化參數用max_quantization來表示,J1為-max_quantization/3,J2為max_quantization/3。示例性的,J1為-4,J2為4。 For example, the maximum quantization parameter is represented by max_quantization, J1 is -max_quantization/3, and J2 is max_quantization/3. For example, J1 is -4 and J2 is 4.

2)視頻解碼器根據前n個已解碼圖像塊的目標比特數和預測bits數比特數的差值的累加,映射得到量化參數的變化值。 2) The video decoder maps the change value of the quantization parameter based on the accumulation of the difference between the target number of bits and the number of predicted bits of the first n decoded image blocks.

△quantization=sigmoid(target_pred_sum/block_size)×J3,其中J3為參數。 △quantization=sigmoid(target_pred_sum/block_size)×J3, where J3 is the parameter.

如圖8所示,函數y=sigmoid(x)是一個s形函數,y的取值範圍是[0,1],x趨於正無窮時,y=1,x趨於負無窮時,y=0。 As shown in Figure 8, the function y=sigmoid(x) is a sigmoid function. The value range of y is [0, 1]. When x goes to positive infinity, y=1. When x goes to negative infinity, y =0.

需要說明的是,target_pred_sum還可以替換為pred_real_sum或target_real_sum。 It should be noted that target_pred_sum can also be replaced by pred_real_sum or target_real_sum.

3)視頻解碼器根據當前塊的複雜度、前一個已解碼圖像塊的複雜度以及最大量化參數確定量化參數的變化值。 3) The video decoder determines the change value of the quantization parameter based on the complexity of the current block, the complexity of the previous decoded image block, and the maximum quantization parameter.

若complexity>pre_complexity,則△quantization= clip(△pre_quantization+1,0,max_△quantization); If complexity>pre_complexity, then △quantization= clip(△pre_quantization+1,0,max_△quantization);

若complexity<pre_complexity,則△quantization=clip(△pre_quantization-1,0,max_△quantization)。 If complexity<pre_complexity, then △quantization=clip(△pre_quantization-1,0,max_△quantization).

其中,△pre_quantization表示前一個已解碼圖像塊的量化參數的變化值,max_△quantization表示待解碼圖像中圖像塊的最大的量化參數的變化值,該最大值可以為預設固定值。 Among them, △pre_quantization represents the change value of the quantization parameter of the previous decoded image block, and max_△quantization represents the change value of the maximum quantization parameter of the image block in the image to be decoded. The maximum value can be a preset fixed value.

5)視頻解碼器設定量化參數的變化值為固定值。 5) The video decoder sets the change value of the quantization parameter to a fixed value.

示例性的,固定值為△quantization=1。 For example, the fixed value is Δquantization=1.

6)視頻解碼器根據待解碼圖像的資訊以及當前塊的其他碼控參數調整量化參數的變化值。 6) The video decoder adjusts the change value of the quantization parameter according to the information of the image to be decoded and other coding control parameters of the current block.

如果圖像位寬大於8bit,則△quantization=2;或者,如果當前通道為色度分量時,則△quantization=2;或者,如果當前塊的位置處於並行單元的前1/n位置,則△quantization=1;如果當前塊的位置處於並行單元的後1/n位置,則△quantization=2;如果當前塊的位置處於並行單元的邊界處,則△quantization=1。 If the image bit width is greater than 8 bits, then △quantization=2; or if the current channel is a chrominance component, then △quantization=2; or if the position of the current block is in the first 1/n position of the parallel unit, then △ quantization=1; if the position of the current block is at the last 1/n position of the parallel unit, then △quantization=2; if the position of the current block is at the boundary of the parallel unit, then △quantization=1.

需要說明的是,視頻解碼器還可以根據其他輸入參數調整固定值。 It should be noted that the video decoder can also adjust fixed values based on other input parameters.

可選的,視頻解碼器根據當前塊的其他碼控參數中的資源充裕度設定量化參數的變化值為固定值。示例性的,如果當前塊的資源充足,則△quantization=1;如果當前塊的資源不足,則△quantization=4。 Optionally, the video decoder sets the change value of the quantization parameter to a fixed value according to the resource adequacy in other coding control parameters of the current block. For example, if the resources of the current block are sufficient, then △quantization=1; if the resources of the current block are insufficient, then △quantization=4.

可選的,在上述步驟S601之前,該方法還包括,視頻解碼器初始化碼率控制參數,如圖9所示,包括以下步驟。 Optionally, before the above step S601, the method also includes the video decoder initializing the code rate control parameters, as shown in Figure 9, including the following steps.

步驟S901、視頻解碼器根據待解碼圖像的資訊計算當前塊的總比特數。 Step S901: The video decoder calculates the total number of bits of the current block based on the information of the image to be decoded.

其中,總比特數是指當前塊所佔用的比特數,根據上述待解碼圖像的基本資訊中的採樣格式、解析度、bpp計算總比特數。 The total number of bits refers to the number of bits occupied by the current block. The total number of bits is calculated based on the sampling format, resolution, and bpp in the basic information of the image to be decoded.

可選的,總比特數可以按照圖像的採樣格式進行計算,例如,圖像為YUV格式,則可以分別計算Y通道的總比特數,U通道的總比特數和V通道的總比特數。其中,多個通道還可以組成不同的集合計算總比特數。 Optionally, the total number of bits can be calculated according to the sampling format of the image. For example, if the image is in YUV format, the total number of bits of the Y channel, the total number of bits of the U channel, and the total number of bits of the V channel can be calculated respectively. Among them, multiple channels can also form different sets to calculate the total number of bits.

具體地,N通道圖像劃分為M個集合(M

Figure 112102125-A0202-12-0030-78
N)。示例性的,Y通道為第一集合,U通道和V通道為第二集合。 Specifically, the N-channel image is divided into M sets (M
Figure 112102125-A0202-12-0030-78
N). For example, the Y channel is the first set, and the U channel and V channel are the second set.

第一種可能的實現方式,各集合的參數相互獨立。其中,參數包括初始化參數,碼率控制參數、量化參數等解碼過程中的所有可變參數。該參數也可以包括上述所有可變參數中的部分參數,即各集合的部分參數或全部參數相互獨立。 In the first possible implementation, the parameters of each set are independent of each other. Among them, the parameters include initialization parameters, rate control parameters, quantization parameters and other variable parameters in the decoding process. This parameter may also include some of the above-mentioned variable parameters, that is, some or all of the parameters in each set are independent of each other.

第二種可能的實現方式,各集合的參數公用。類似地,該參數可以包括上述所有可變參數中的部分或全部參數,各集合公用部分或全部參數。示例性的,第一集合和第二集合的公用參數包括初始化的參數、更新的參數閾值和量化參數,獨立參數包括中間變數,碼率控制參數。其中,該中間變數是指計算量化參數中產生的中間參數,例如,基於當前塊的已解碼的圖像塊的個數。 The second possible implementation method is that the parameters of each collection are common. Similarly, the parameters may include some or all of the above-mentioned variable parameters, and some or all of the parameters are common to each set. For example, the common parameters of the first set and the second set include initialized parameters, updated parameter thresholds and quantization parameters, and independent parameters include intermediate variables and code rate control parameters. The intermediate variable refers to an intermediate parameter generated in calculating the quantization parameter, for example, the number of decoded image blocks based on the current block.

可選的,上述參數按照M個集合進行更新。具體地,各個集合完成解碼後,更新參數;或者,所有集合完成解碼後,更新參數。 Optionally, the above parameters are updated according to M sets. Specifically, after each set completes decoding, the parameters are updated; or after all sets complete decoding, the parameters are updated.

步驟S902、視頻解碼器根據總比特數確定可用比特數,該可用比特數用於存儲當前塊解碼前的圖像資料。 Step S902: The video decoder determines the number of available bits based on the total number of bits. The number of available bits is used to store the image data before the current block is decoded.

可選的,視頻解碼器去除掉總比特數中用於存儲非圖像資料的其他比特數為可用比特數。示例性的,其他比特包括以下多種類型的資料,例如用於存儲圖像的頭資訊的預留比特,用於確定資料在碼流中的位置的塊間偏移比特。可選的,視頻解碼器將總比特數作為可用比特數,這是因為在某些應用中,總比特中不包含其他比特。 Optionally, the video decoder removes other bits used to store non-image data from the total number of bits to obtain the number of available bits. For example, other bits include the following types of data, such as reserved bits used to store header information of an image, and inter-block offset bits used to determine the position of the data in the code stream. Optionally, the video decoder uses the total number of bits as the number of available bits, because in some applications, the total number of bits does not include other bits.

可選的,在上述步驟S902之後,還可以包括分支步驟、視頻解碼器根據通道劃分結合,並計算各集合的可用總比特數目;將總資源按 照M個集合的比例分配到各個集合。 Optionally, after the above step S902, a branching step may also be included, in which the video decoder combines according to channel division and calculates the total number of available bits in each set; the total resources are divided into Distribute to each set according to the proportion of M sets.

其中,M個集合的比例可以參考各個集合的圖像塊數確定。視頻解碼器將當前塊的可用總比特數按照集合的比例分配。 Among them, the proportion of the M sets can be determined with reference to the number of image blocks in each set. The video decoder allocates the total number of available bits for the current block in proportion to the set.

可選的,該分支步驟還可以應用與步驟S902之前,視頻解碼器計算M個集合分別的可用比特數。 Optionally, this branching step can also be applied to the video decoder calculating the number of available bits for each of the M sets before step S902.

其中,步驟S902中的其他非圖像比特數在劃分集合後分別去除。 Among them, other non-image bit numbers in step S902 are removed respectively after dividing the set.

可以理解的是,先劃分集合再分別去除各個集合中的用於存儲非圖像資料的其他比特數,有助於提升各個集合中可用比特數的靈活性,提升視頻解碼器的性能;先在總比特數中去除用於存儲非圖像資料的其他比特數,得到總的可用比特數,再劃分各個集合的可用比特數時,有助於保證各個集合中可用比特數的一致性。 It can be understood that first dividing the sets and then removing other bits used to store non-image data in each set will help increase the flexibility of the number of available bits in each set and improve the performance of the video decoder; first, The total number of bits used to store non-image data is removed from the total number of bits to obtain the total number of available bits. When the number of available bits in each set is divided, it helps to ensure the consistency of the number of available bits in each set.

可選的,在上述步驟S901之後,視頻解碼器還根據bpp,計算目標bpp(target_bpp);示例性的,target_bpp=bpp-0.1;可選的,該target_bpp可以是M個集合公用的,也可以是每個集合獨立的target_bpp。 Optionally, after the above step S901, the video decoder also calculates the target bpp (target_bpp) based on bpp; for example, target_bpp=bpp-0.1; optionally, the target_bpp can be common to M sets, or it can Is an independent target_bpp for each collection.

如果每個集合具有獨立的target_bpp,此時全部集合加權得到的target_bpp要滿足bpp的限制,例如bpp=target_bpp+0.1(經驗值)。 If each set has an independent target_bpp, the target_bpp obtained by weighting all sets must meet the bpp limit, for example, bpp=target_bpp+0.1 (empirical value).

需要說明的是,該目標bpp用於確定目標比特數,以及與目標比特數的其他參數。 It should be noted that the target bpp is used to determine the target number of bits and other parameters related to the target number of bits.

步驟S903、視頻解碼器初始化中間參數,該中間參數用於結合一個或多個碼率控制參數確定當前塊的量化參數。 Step S903: The video decoder initializes intermediate parameters, which are used to determine the quantization parameters of the current block in combination with one or more rate control parameters.

示例性的,包括以下參數target_bits、target_real_sum以及pred_real_sum。在初始化時,可以將這些參數設置為: For example, the following parameters target_bits, target_real_sum and pred_real_sum are included. During initialization, these parameters can be set to:

target_bits=total_bits/total_blocks; target_bits=total_bits/total_blocks;

target_real_sum=target_bits×total_blocks-total_bits; target_real_sum=target_bits×total_blocks-total_bits;

pred_real_sum=0。 pred_real_sum=0.

可選的,在計算碼率控制參數中的部分中間變數也可以在該步驟中預先定義,例如最大量化參數、允許複雜度的最大值等等。 Optionally, some intermediate variables in calculating the rate control parameters can also be predefined in this step, such as the maximum quantization parameter, the maximum allowed complexity, etc.

步驟S602、視頻解碼器根據一個或多個碼率控制參數確定當前塊的量化參數。 Step S602: The video decoder determines the quantization parameter of the current block according to one or more rate control parameters.

具體地,包括以下7種方案。 Specifically, the following 7 options are included.

方案1、將平均量化參數作為量化參數。 Solution 1: Use the average quantization parameter as the quantization parameter.

方案2、根據平均量化參數和量化參數變化值加權得到量化參數。 Option 2: Obtain the quantization parameters by weighting them based on the average quantization parameters and the change values of the quantization parameters.

quantization=clip(average_quantization+△quantization,0,max_quantization)。 quantization=clip(average_quantization+△quantization,0,max_quantization).

方案3、根據當前塊的複雜度、前一個已解碼圖像塊的複雜度以及前一個已解碼圖像塊的量化參數確定量化參數。 Solution 3: Determine the quantization parameter based on the complexity of the current block, the complexity of the previous decoded image block, and the quantization parameter of the previous decoded image block.

quantization=clip(complexity/pre_complexity,1-a,1+a)×pre_quantization; quantization=clip(complexity/pre_complexity,1-a,1+a)×pre_quantization;

其中,0<a<1。 Among them, 0<a<1.

方案4、根據當前塊的位置資訊、複雜度,以及前一個已解碼圖像塊的量化參數確定當前塊的量化參數。 Solution 4: Determine the quantization parameter of the current block based on the position information and complexity of the current block, and the quantization parameter of the previous decoded image block.

如果當前塊處於該並行單元的前1/n位置,則第四權重係數w4為1-a;處於該並行單元的後1/2位置,則w4為1+a,0<a<1; If the current block is in the first 1/n position of the parallel unit, the fourth weight coefficient w4 is 1-a; if it is in the last 1/2 position of the parallel unit, then w4 is 1+a, 0<a<1;

quantization=w4×pre_quantization; quantization=w4×pre_quantization;

可選的,如果當前塊的複雜度大於K1(或資源充裕度小於L1),則quantization=w4×pre_quantization×(1+b);如果複雜度小於K2(或資源充裕度大於L2),則quantization=w4×pre_quantization×(1-b),0<b<1,0<K1<K2,0<L1<L2; Optional, if the complexity of the current block is greater than K1 (or the resource abundance is less than L1), then quantization=w4×pre_quantization×(1+b); if the complexity is less than K2 (or the resource abundance is greater than L2), then quantization =w4×pre_quantization×(1-b), 0<b<1, 0<K1<K2, 0<L1<L2;

方案5、根據前一個已解碼圖像塊的資訊確定當前塊的量化參數。 Solution 5: Determine the quantization parameter of the current block based on the information of the previous decoded image block.

1)如果前一個已解碼圖像塊的target_real_sum>0,則quantization=clip(pre_quantization+M,0,max_quantization);如果前一個已解碼圖像塊的target_real_sum<0,則quantization=clip(pre_quantization-M,0,max_quantization);其中,M>1。 1) If the target_real_sum of the previous decoded image block>0, then quantization=clip(pre_quantization+M,0,max_quantization); if the target_real_sum of the previous decoded image block<0, then quantization=clip(pre_quantization-M ,0,max_quantization); where, M>1.

2)或者根據pred_real_sum,如果pred_real_sum大於預設閾值,則量化參數增加,反之,量化參數減少。 2) Or according to pred_real_sum, if pred_real_sum is greater than the preset threshold, the quantization parameter increases, otherwise, the quantization parameter decreases.

方案6、根據當前塊的位置資訊確定當前塊的量化參數。 Solution 6: Determine the quantization parameter of the current block based on the position information of the current block.

示例性的,如果當前塊是並行單元中的第一個塊,quantization=0。 For example, if the current block is the first block in the parallel unit, quantization=0.

方案7、根據當前塊的多個複雜度確定當前塊的量化參數。 Solution 7: Determine the quantization parameters of the current block based on multiple complexities of the current block.

如果{complexity1<N1∥ complexity2<N2},其中,complexity1<N1與complexity2<N2至少一個滿足條件即成立;則quantization=0。N1與N2可通過位寬進行標定,N1、N2均大於0。 If {complexity1<N1∥complexity2<N2}, at least one of complexity1<N1 and complexity2<N2 satisfies the condition; then quantization=0. N1 and N2 can be calibrated by bit width, and both N1 and N2 are greater than 0.

需要說明的是,結合上文針對圖2描述的編碼過程,視頻編碼器基於碼率控制參數生成量化參數的具體實現方式與上述解碼側的實施例為互逆的編碼流程,不再重複描述。 It should be noted that, in conjunction with the encoding process described above with respect to Figure 2, the specific implementation method of the video encoder generating quantization parameters based on the code rate control parameters is a reciprocal encoding process with the above-mentioned embodiment on the decoding side, and will not be described again.

可選的,在上述確定量化參數後,視頻解碼器修正量化參數。 Optionally, after the quantization parameter is determined above, the video decoder corrects the quantization parameter.

第一種可能的實現方式,根據當前塊的資源充裕度調整;若超過該資源充裕度的範圍則進行相應的調整。 The first possible implementation method is to adjust according to the resource abundance of the current block; if it exceeds the range of the resource abundance, make corresponding adjustments.

示例性的,若資源充足,則quantization=clip(quantization -x,0,max_quantization);若資源不足,則quantization=clip(quantization +x,0,max_quantization);x>0。 For example, if resources are sufficient, then quantization=clip(quantization -x,0,max_quantization); if resources are insufficient, then quantization=clip(quantization +x,0,max_quantization); x>0.

第二種可能的實現方式,基於上述比特數進行調整。 The second possible implementation method is to adjust based on the above number of bits.

1)根據之前全部目標比特數和實際比特數調整。 1) Adjust based on all previous target bit numbers and actual bit numbers.

如果target_real_sum

Figure 112102125-A0202-12-0033-79
P1×target_bits且quntization
Figure 112102125-A0202-12-0033-80
pre_quantization,則quantization=clip(quantization+Q1,0,max_quantization); 如果target_real_sum<P2×target_bits且quantization>pre_quantization,quantization=clip(quantization+Q2,0,max_quantization)。其中,P1、P2、Q1、Q2的絕對值均大於1。 if target_real_sum
Figure 112102125-A0202-12-0033-79
P1×target_bits and quntization
Figure 112102125-A0202-12-0033-80
pre_quantization, then quantization=clip(quantization+Q1,0,max_quantization); If target_real_sum<P2×target_bits and quantization>pre_quantization, quantization=clip(quantization+Q2,0,max_quantization). Among them, the absolute values of P1, P2, Q1, and Q2 are all greater than 1.

2)根據預測比特數和實際比特數目調整。 2) Adjust according to the predicted number of bits and the actual number of bits.

如果pred_real_sum<P3,則quantization=clip(quantization+Q3,0,max_quantization);如果pred_real_sum>P4,則quantization=clip(quantization+Q4,0,max_quantization)。其中,P3、P4、Q3、Q4的絕對值均大於1。 If pred_real_sum<P3, then quantization=clip(quantization+Q3,0,max_quantization); if pred_real_sum>P4, then quantization=clip(quantization+Q4,0,max_quantization). Among them, the absolute values of P3, P4, Q3, and Q4 are all greater than 1.

第三種可能的實現方式,根據前n個塊的實際比特數,以及當前塊的碼控緩衝區大小(buffer_size)調整。 The third possible implementation method is adjusted according to the actual number of bits of the first n blocks and the code control buffer size (buffer_size) of the current block.

target_real_sum實際和buffer_size相同。 target_real_sum is actually the same as buffer_size.

示例性的,如果是8bit圖像,且buffer_size

Figure 112102125-A0202-12-0034-81
((max_buffer_size * 63)>>6),則quantization=max_quantization;如果是10bit圖像,且((max_buffer_size *15)>>4)
Figure 112102125-A0202-12-0034-82
buffer_size,則quantization=max_quantization;如果是其它比特圖像,且((max_buffer_size * 7)>>3)
Figure 112102125-A0202-12-0034-83
buffer_size,則quantization=max_quantization;如果buffer_size>0,則quantization=max(buffer_size * max_quantization/max_buffer_size,quantization);如果buffer_size<0,則quantization=0,buffer_size=0。 For example, if it is an 8bit image and buffer_size
Figure 112102125-A0202-12-0034-81
((max_buffer_size * 63)>>6), then quantization=max_quantization; if it is a 10bit image, and ((max_buffer_size *15)>>4)
Figure 112102125-A0202-12-0034-82
buffer_size, then quantization=max_quantization; if it is other bit images, and ((max_buffer_size * 7)>>3)
Figure 112102125-A0202-12-0034-83
buffer_size, then quantization=max_quantization; if buffer_size>0, then quantization=max(buffer_size * max_quantization/max_buffer_size,quantization); if buffer_size<0, then quantization=0, buffer_size=0.

第四種可能的實現方式,根據當前塊的位置調整量化參數。 The fourth possible implementation is to adjust the quantization parameters according to the position of the current block.

示例性的,如果處於並行單元的邊界處,則quantization=quantization/2;並行單元的邊界左右的並行單元的差距不能大於3;同一個並行單元的中上下左右塊的量化參數差距不能大於max_quantization/4。 For example, if it is at the boundary of a parallel unit, then quantization=quantization/2; the difference between the parallel units on the left and right of the boundary of the parallel unit cannot be greater than 3; the quantization parameter difference between the middle, upper, lower, and left blocks of the same parallel unit cannot be greater than max_quantization/ 4.

第五種可能的實現方式,基於碼率控制的平滑度進行調整。 The fifth possible implementation method is to adjust based on the smoothness of code rate control.

恆定碼率控制(Constant Bit Rate,CBR):該碼率控制方法存在一個buffer_size,每個塊都會根據實際比特數目和目標比特數更新 buffer_size,buffer_size嚴格不能超過第一預設閾值且不能小於0。其中,buffer_size為target_real_sum,或採用輸入bpp作為目標bpp計算target_real_sum。示例性的,採用了兩級緩衝區,兩級緩衝區並行獨立,來進行CBR。 Constant Bit Rate (CBR): This rate control method has a buffer_size, and each block is updated according to the actual number of bits and the target number of bits. buffer_size, buffer_size strictly cannot exceed the first preset threshold and cannot be less than 0. Among them, buffer_size is target_real_sum, or the input bpp is used as the target bpp to calculate target_real_sum. As an example, two-level buffers are used, and the two-level buffers are parallel and independent to perform CBR.

a)一級緩衝,視頻解碼器限制量化參數的修正。 a) First-level buffering, the video decoder limits the modification of quantization parameters.

如果max_buffer_size×R1

Figure 112102125-A0202-12-0035-85
buffer_size,則quantization=max_quantization;如果max_buffer_size×R1<buffer_size<max_buffer_size×R2,則quantization=max(buffer_size×max_quantization/max_buffer_size,quantization);如果max_buffer_size×R2
Figure 112102125-A0202-12-0035-86
buffer_size,則quantization=0;如果buffer_size<0,表示編碼端在編碼過程中該當前塊包括多個無效資料;相應地,解碼端填充-buffer_size個比特數,該比特數為多個無效資料的比特數,並令buffer_size=0,使得解碼後圖像塊於編碼的圖像塊相同。 If max_buffer_size×R1
Figure 112102125-A0202-12-0035-85
buffer_size, then quantization=max_quantization; if max_buffer_size×R1<buffer_size<max_buffer_size×R2, then quantization=max(buffer_size×max_quantization/max_buffer_size,quantization); if max_buffer_size×R2
Figure 112102125-A0202-12-0035-86
buffer_size, then quantization=0; if buffer_size<0, it means that the current block at the encoding end includes multiple invalid data during the encoding process; accordingly, the decoding end fills in -buffer_size bits, which is the number of bits of multiple invalid data. number, and set buffer_size=0, so that the decoded image block is the same as the encoded image block.

需要說明的是,上述一級緩衝還可以應用於視頻編碼器計算量化參數後進行修正。 It should be noted that the above-mentioned first-level buffer can also be applied to the video encoder to calculate the quantization parameters and then correct them.

可選的,b)二級緩衝,該量化參數的修正應用於編碼過程。 Optional, b) secondary buffering, the correction of the quantization parameter is applied to the encoding process.

如果當前選擇的最優模式的real_bits會使得buffer_size<max_buffer_size×U1,此時選擇一個失真最小的模式;如果當前選擇的最優模式的real_bits會使得buffer_size<max_buffer_size×U2,此時選擇無失真的模式或者失真最小的模式;如果當前選擇的最優模式的real_bits會使得buffer_size>max_buffer_size×U3,此時選擇一個不會超過max_buffer_size x U3且失真較小;如果當前選擇的最優模式的real_bits會使得buffer_size>max_buffer_size×U4,此時選擇一個cost最小的新模式。 If the real_bits of the currently selected optimal mode will make buffer_size<max_buffer_size×U1, then select a mode with the smallest distortion; if the currently selected real_bits of the optimal mode will make buffer_size<max_buffer_size×U2, then choose the mode without distortion. Or the mode with the smallest distortion; if the real_bits of the currently selected optimal mode will make buffer_size>max_buffer_size×U3, then choose a mode that will not exceed max_buffer_size x U3 and have less distortion; if the real_bits of the currently selected optimal mode will make buffer_size >max_buffer_size×U4, at this time select a new mode with the smallest cost.

需要說明的是,該U1-U4可以根據max_buffer_size中cost最小模式的cost計算得到,或者預設不同的固定值。 It should be noted that U1-U4 can be calculated based on the cost of the minimum cost mode in max_buffer_size, or different fixed values can be preset.

第六種可能的實現方式,為了保證不出現buffer_size<0或buffer_size

Figure 112102125-A0202-12-0035-87
max_buffer_size的情況,要求buffer_size處於理想範圍內,即 max_buffer_size×V1<buffer_size<max_buffer_size×V2,其中,0
Figure 112102125-A0202-12-0036-88
V1
Figure 112102125-A0202-12-0036-89
V2
Figure 112102125-A0202-12-0036-90
1。 The sixth possible implementation method is to ensure that buffer_size<0 or buffer_size does not occur.
Figure 112102125-A0202-12-0035-87
In the case of max_buffer_size, buffer_size is required to be within the ideal range, that is, max_buffer_size×V1<buffer_size<max_buffer_size×V2, where, 0
Figure 112102125-A0202-12-0036-88
V1
Figure 112102125-A0202-12-0036-89
V2
Figure 112102125-A0202-12-0036-90
1.

為了實現buffer_size處於上述理想範圍內,編碼端或解碼端可以在參數初始化時預留資源,該預留資源為max_buffer_size×V3,其中,V3

Figure 112102125-A0202-12-0036-91
1。其中,該預留資源在參數初始化中確定可用比特數時,屬於預留比特數,需要扣除以滿足後續資源的補充。 In order to achieve buffer_size within the above ideal range, the encoding end or decoding end can reserve resources during parameter initialization. The reserved resources are max_buffer_size×V3, where, V3
Figure 112102125-A0202-12-0036-91
1. Among them, when the number of available bits of the reserved resource is determined in parameter initialization, it belongs to the number of reserved bits and needs to be deducted to meet the subsequent replenishment of resources.

可以理解的是,該預留資源在實現buffer_size不外溢的情況下,還可以用於為最後幾個圖像塊編解碼,或者用於並行單元的邊界,將該預留資源釋放於資源相對不充裕的地方。 It can be understood that, under the condition that the buffer_size does not overflow, the reserved resources can also be used to encode and decode the last few image blocks, or used for the boundaries of parallel units, and the reserved resources can be released when the resources are relatively infrequent. Plenty of space.

需要說明的是,上述修正量化參數的方案中未進行特殊說明的方案,均可在解碼端或編碼端生成量化參數後進行。 It should be noted that any of the above solutions for modifying quantization parameters that are not specifically explained can be performed after the quantization parameters are generated at the decoding end or the encoding end.

可選的,上述步驟S601-S603按照不同的並行單元實施。 Optionally, the above steps S601-S603 are implemented according to different parallel units.

實施例一、塊、行、組、slice級並行 Embodiment 1, block, row, group, slice level parallelism

具體地,編碼端記錄當前塊的資料的偏移資訊。該偏移資訊是指當前塊在並行單元中的位置,通過並行單元的第一個塊到當前塊的前一個圖像塊的實際比特數之和表示。 Specifically, the encoding end records the offset information of the current block of data. The offset information refers to the position of the current block in the parallel unit, represented by the sum of actual bit numbers from the first block of the parallel unit to the previous image block of the current block.

在編碼端,視頻編碼器將該偏移資訊寫入碼流,用於解碼端解析碼流並獲取該偏移資訊,實現定位當前塊在並行單元中的位置。 On the encoding side, the video encoder writes the offset information into the code stream, which is used at the decoding end to parse the code stream and obtain the offset information to locate the position of the current block in the parallel unit.

可選的,編碼端寫入碼流中的位置是整個並行單元碼流的開頭。 Optionally, the position written by the encoding end in the code stream is the beginning of the entire parallel unit code stream.

在解碼端,視頻解碼器獲取碼流中的偏移資訊,根據該偏移資訊定位該當前塊的位置,進行解碼。 At the decoding end, the video decoder obtains the offset information in the code stream, locates the position of the current block based on the offset information, and performs decoding.

需要說明的是,該偏移資訊在上述方案執行過程中,可以在參數初始化階段作為存儲非圖像資料的其他比特數去除,或者在編解碼過程中作為對並行單元的消耗計入實際比特數,或者在編解碼過程中不計入實際比特數的消耗。其中,計入方式不同,對於上述方案中的部分參數計 算產生影響,綜合考慮進行選擇。 It should be noted that during the execution of the above solution, this offset information can be removed as the number of other bits for storing non-image data during the parameter initialization stage, or it can be included in the actual number of bits as consumption of parallel units during the encoding and decoding process. , or the actual bit consumption is not included in the encoding and decoding process. Among them, the counting methods are different. For some parameters in the above scheme, Calculate the impact and make a choice based on comprehensive considerations.

實施例二、行級並行 Embodiment 2, row-level parallelism

具體地,編碼端按照規則填充於碼流中。 Specifically, the encoding end fills the code stream according to rules.

第一種可能的實現方式,每行分成若干個單元,每個單元按照某個給定參數(如128bit)對齊;(若該單元比特數不是128bit的倍數,則將該單元填充到128bits的倍數)。其中給定參數可以是:經驗參數,或者由行的寬、高以及bpp中的一個或多個資訊得到。 The first possible implementation is that each row is divided into several units, and each unit is aligned according to a given parameter (such as 128bit); (if the number of bits in the unit is not a multiple of 128bits, fill the unit to a multiple of 128bits ). The given parameters can be: empirical parameters, or obtained from the width, height and one or more information in the bpp.

第二種可能的實現方式,slice行間最大bits數:所有slice同位置行中最長行的消耗bits數。按照slice行間最大比特數進行對齊;(若該行消耗比特數不是slice行間最大bits數的倍數,則將該消耗bits數填充到是slice行間最大比特數的倍數)。 The second possible implementation method is the maximum number of bits between slice rows: the number of bits consumed by the longest row among all slice rows at the same position. Align according to the maximum number of bits between slice rows; (if the number of bits consumed by the row is not a multiple of the maximum number of bits between slice rows, fill the number of consumed bits to a multiple of the maximum number of bits between slice rows).

第三種可能的實現方式,slice的編碼結束後,填充-buffer_size個bits數(CBR保證了buffer_size

Figure 112102125-A0202-12-0037-92
0) The third possible implementation method is to fill in -buffer_size bits after the encoding of the slice is completed (CBR guarantees buffer_size
Figure 112102125-A0202-12-0037-92
0)

針對上述三種可能的實現方式,解碼端包括三種可能的實現方式: For the above three possible implementation methods, the decoding end includes three possible implementation methods:

第一種可能的實現方式,讀取到單元末尾時,判斷當前消耗bits是否滿足給定參數bits的對齊,滿足則無需讀取填充bits,否則讀取滿足給定bits倍數所填充的bits數。 The first possible implementation method is to determine whether the currently consumed bits satisfy the alignment of the given parameter bits when reading to the end of the unit. If so, there is no need to read the filling bits. Otherwise, read the number of bits filled that satisfies the given bits multiple.

第二種可能的實現方式,解碼到行末尾時,判斷當前消耗bits是否滿足slice行間最大比特數的對齊,滿足則無需讀取填充bits,否則讀取slice行間最大比特數倍數所填充的比特數。 The second possible implementation method is to determine whether the currently consumed bits satisfy the alignment of the maximum number of bits between slice rows when decoding to the end of the row. If so, there is no need to read the filling bits. Otherwise, read the number of filling bits that is a multiple of the maximum number of bits between slice rows. .

第三種可能的實現方式,讀取-buffer_size個填充比特數。 The third possible implementation is to read -buffer_size padding bits.

示例性的,一種碼流排布方法,以2個slice為例,其中,slice只會縱向劃分:slice1的第一個單元(填充),slice2的第一個單元(填充),slice1的第二個單元,slice2的第二個單元(填充)......slice1第一行的最後一個單元,slice2第一行的最後一個單元(填充)。 An exemplary code stream arrangement method, taking 2 slices as an example, in which the slice will only be divided vertically: the first unit of slice1 (filling), the first unit of slice2 (filling), the second unit of slice1 units, the second unit of slice2 (padding)...the last unit of the first row of slice1, the last unit of the first row of slice2 (padding).

需要說明的是,slice第一行間最大比特數是slice1編碼一行 所消耗的比特數。 It should be noted that the maximum number of bits between the first row of slice is slice1 encoding one row. The number of bits consumed.

需要說明的是,該填充所消耗的比特數計入對應塊的實際比特數消耗,或者,填充所消耗的比特數不計入對應塊的實際比特數消耗。 It should be noted that the number of bits consumed by the filling is included in the actual bit consumption of the corresponding block, or the number of bits consumed by the filling is not included in the actual bit consumption of the corresponding block.

實施例三、slice級並行 Embodiment 3, slice-level parallelism

編碼端計算單元比特數寫入碼流。 The encoding end calculates the unit bit number and writes it into the code stream.

可選的,當單元確定時,可以根據slice的寬度和高度以及bpp(或者target_bpp)中的一個或多個計算得到每個單元的比特數。示例性的,slice的寬×高×bpp=10000比特,該10000比特為slice中單元的比特數。 Optionally, when the unit is determined, the number of bits of each unit can be calculated based on one or more of the width and height of the slice and bpp (or target_bpp). For example, the width of the slice × height × bpp = 10,000 bits, and the 10,000 bits are the number of bits of the unit in the slice.

可選的,該單元的比特數也可以為預設的固定值。 Optionally, the number of bits of the unit can also be a preset fixed value.

其中,碼流排布一種碼流排布方法,以2個slice為例,其中,slice只會縱向劃分:slice1的第一個單元,slice2的第一個單元,slice1的第二個單元,slice2的第二個單元......slice1的最後一個單元,slice2的最後一個單元。 Among them, code stream arrangement is a code stream arrangement method. Taking 2 slices as an example, the slice will only be divided vertically: the first unit of slice1, the first unit of slice2, the second unit of slice1, slice2 The second unit of...the last unit of slice1, the last unit of slice2.

需要說明的是,每個單元的比特數為上述兩種可選方式中任意一種確定的恆定大小。 It should be noted that the number of bits of each unit is a constant size determined by either of the above two optional methods.

解碼端按照第一slice的第一個單元、第二個slice的第一個單元、第一個slice的第二個單元、第二個slice的第二個單元的順序解析碼流。 The decoding end parses the code stream in the order of the first unit of the first slice, the first unit of the second slice, the second unit of the first slice, and the second unit of the second slice.

需要說明的是,上述並行方案中未進行特殊說明的方案,均可在解碼側或編碼側進行。 It should be noted that any of the above parallel solutions that are not specifically explained can be performed on the decoding side or the encoding side.

需要說明的是,在不衝突的情況下是,上文中任意多個實施例中的部分或全部內容可以構成新的實施例。 It should be noted that, as long as there is no conflict, part or all of the contents of any of the above embodiments may constitute a new embodiment.

本發明實施例提供一種解碼裝置,該解碼裝置可以為視頻解碼器。具體的,解碼裝置用於執行以上解碼方法中的視頻解碼器所執行的步驟。本發明實施例提供的解碼裝置可以包括相應步驟所對應的模組。 An embodiment of the present invention provides a decoding device, which may be a video decoder. Specifically, the decoding device is used to perform the steps performed by the video decoder in the above decoding method. The decoding device provided by the embodiment of the present invention may include modules corresponding to corresponding steps.

本發明實施例可以根據上述方法示例對解碼裝置進行功能模組的劃分,例如,可以對應各個功能劃分各個功能模組,也可以將兩個或兩個以上的功能集成在一個處理模組中。上述集成的模組既可以採用硬體的形式實現,也可以採用軟體功能模組的形式實現。本發明實施例中對模組的劃分是示意性的,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。 Embodiments of the present invention can divide the decoding device into functional modules according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or software function modules. The division of modules in the embodiment of the present invention is schematic and is only a logical function division. In actual implementation, there may be other division methods.

在採用對應各個功能劃分各個功能模組的情況下,圖10示出上述實施例中所涉及的解碼裝置的一種可能的結構示意圖。如圖10所示,解碼裝置100包括獲取模組1001、確定模組1002和解碼模組1003。 In the case where each functional module is divided according to each function, FIG. 10 shows a possible structural diagram of the decoding device involved in the above embodiment. As shown in Figure 10, the decoding device 100 includes an acquisition module 1001, a determination module 1002 and a decoding module 1003.

獲取模組1001,用於獲取待解碼圖像中當前塊的一個或多個碼率控制參數,例如上述步驟S601。 The acquisition module 1001 is used to acquire one or more code rate control parameters of the current block in the image to be decoded, such as the above step S601.

確定模組1002,用於根據一個或多個碼率控制參數確定當前塊的量化參數;例如上述步驟S602。 The determination module 1002 is used to determine the quantization parameter of the current block according to one or more code rate control parameters; for example, step S602 above.

解碼模組1003,用於基於當前塊的量化參數對當前塊進行解碼,例如上述步驟S603。 The decoding module 1003 is used to decode the current block based on the quantization parameters of the current block, such as the above step S603.

在一種示例中,獲取模組1001,具體用於獲取待解碼圖像的資訊,待解碼圖像的資訊包括待解碼圖像的基本資訊和待解碼圖像中圖像塊的資訊;根據待解碼圖像的資訊中的部分或全部確定當前塊的一個或多個碼率控制參數。 In one example, the acquisition module 1001 is specifically used to obtain the information of the image to be decoded. The information of the image to be decoded includes the basic information of the image to be decoded and the information of the image blocks in the image to be decoded; according to the image to be decoded, Some or all of the image's information determines one or more rate control parameters for the current block.

在一種示例中,碼率控制參數包括當前塊的資源充裕度、當前塊的複雜度、當前塊的預測比特數、當前塊的平均量化參數和當前塊的量化參數的變化值;其中,平均量化參數用於表徵待解碼圖像中已解碼圖像塊的量化參數的平均程度,資源充裕度是指用於存儲當前塊的資源在用於存儲待解碼圖像的資源中的充足程度,複雜度是指待解碼圖像中已解碼圖像塊的複雜程度,預測比特數是指預估當前塊解碼後佔用的資源,量化參數的變化值是指待解碼圖像中已解碼圖像塊之間量化參數的變化值。 In one example, the code rate control parameters include the resource adequacy of the current block, the complexity of the current block, the predicted number of bits of the current block, the average quantization parameter of the current block, and the change value of the quantization parameter of the current block; wherein, the average quantization Parameters are used to characterize the average degree of quantization parameters of decoded image blocks in the image to be decoded. Resource adequacy refers to the adequacy of the resources used to store the current block in the resources used to store the image to be decoded. Complexity It refers to the complexity of the decoded image blocks in the image to be decoded. The number of predicted bits refers to the estimated resources occupied by the current block after decoding. The change value of the quantization parameter refers to the difference between the decoded image blocks in the image to be decoded. The change value of the quantization parameter.

在一種示例中,確定模組1002,具體用於獲取已解碼圖像塊 的碼率控制參數;根據已解碼圖像塊的碼率控制參數確定當前塊的量化參數。 In one example, the determination module 1002 is specifically used to obtain the decoded image block The rate control parameters of the decoded image block; determine the quantization parameters of the current block according to the rate control parameters of the decoded image block.

在一種示例中,確定模組1002,具體用於獲取已解碼圖像塊的量化參數;根據已解碼圖像塊的量化參數確定當前塊的量化參數。 In one example, the determination module 1002 is specifically used to obtain the quantization parameter of the decoded image block; and determine the quantization parameter of the current block based on the quantization parameter of the decoded image block.

在一種示例中,確定模組1002,還用於根據當前塊資訊計算當前塊的總比特數,當前塊的總比特數為當前塊解碼後所佔用的比特數;根據總比特數確定可用比特數,可用比特數為存儲當前塊解碼後的圖像資料,可用比特數用於確定當前塊的一個或多個碼率控制參數。 In one example, the determination module 1002 is also used to calculate the total number of bits of the current block based on the current block information. The total number of bits of the current block is the number of bits occupied by the current block after decoding; determine the number of available bits based on the total number of bits. , the number of available bits is to store the decoded image data of the current block, and the number of available bits is used to determine one or more rate control parameters of the current block.

在一種示例中,確定模組1002,具體用於去除總比特數中用於存儲非圖像資料的其他比特數。 In one example, the determination module 1002 is specifically configured to remove the number of other bits used to store non-image data from the total number of bits.

在一種示例中,確定模組1002,還用於初始化中間參數,中間參數用於結合一個或多個碼率控制參數確定當前塊的量化參數。 In one example, the determination module 1002 is also used to initialize intermediate parameters, which are used to determine the quantization parameters of the current block in combination with one or more code rate control parameters.

在一種示例中,確定模組1002,還用於基於一個或多個碼率控制參數,修正量化參數。 In one example, the determination module 1002 is also used to correct the quantization parameter based on one or more rate control parameters.

在一種示例中,確定模組1002,還用於更新一個或多個碼率控制參數。 In one example, the determination module 1002 is also used to update one or more rate control parameters.

本發明實施例還提供了一種電子設備,該電子設備包括上述解碼裝置100,該解碼裝置100執行上文提供的任意一種視頻解碼器所執行的方法。 An embodiment of the present invention also provides an electronic device. The electronic device includes the above-mentioned decoding device 100. The decoding device 100 executes any of the methods performed by the video decoder provided above.

本發明實施例還提供了一種通信系統,該通信系統包括上述解碼裝置100和編碼裝置,該解碼裝置100執行上文提供的任意一種視頻解碼器所執行的方法,該編碼裝置執行上文中提供的任意一種視頻編碼器所執行的方法。 Embodiments of the present invention also provide a communication system. The communication system includes the above-mentioned decoding device 100 and an encoding device. The decoding device 100 executes any of the methods performed by the video decoder provided above. The encoding device executes the method provided above. Any method performed by a video encoder.

本發明實施例還提供了一種電腦可讀存儲介質,該電腦可讀存儲介質上存儲有電腦程式,當該電腦程式在電腦上運行時,使得該電腦執行上文提供的任意一種視頻解碼器所執行的方法。 Embodiments of the present invention also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run on a computer, it causes the computer to execute any of the video decoders provided above. method of execution.

關於上述提供的任一種電腦可讀存儲介質中相關內容的解釋及有益效果的描述,均可以參考上述對應的實施例,此處不再贅述。 For explanations of relevant contents and descriptions of beneficial effects in any of the computer-readable storage media provided above, please refer to the above corresponding embodiments and will not be described again here.

本發明實施例還提供了一種晶片。該晶片中集成了用於實現上述解碼裝置100的功能的控制電路和一個或者多個埠。可選的,該晶片支援的功能可以參考上文,此處不再贅述。本領域普通技術人員可以理解實現上述實施例的全部或部分步驟可通過程式來指令相關的硬體完成。所述的程式可以存儲於一種電腦可讀存儲介質中。上述提到的存儲介質可以是唯讀記憶體,隨機接入記憶體等。上述處理單元或處理器可以是中央處理器,通用處理器、特殊應用積體電路(Application Specific Integrated Circuit,ASIC)、數位信號處理器(Digital Signal Processor,DSP),現場可程式邏輯閘陣列(Field Programmable Gate Array,FPGA)或者其他可程式邏輯器件、電晶體邏輯器件、硬體部件或者其任意組合。 An embodiment of the present invention also provides a wafer. The chip integrates a control circuit and one or more ports for realizing the functions of the decoding device 100 described above. Optionally, the functions supported by this chip can be referred to above and will not be described again here. Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by instructing relevant hardware through programs. The program can be stored in a computer-readable storage medium. The storage media mentioned above can be read-only memory, random access memory, etc. The above-mentioned processing unit or processor may be a central processing unit, a general-purpose processor, an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), or a Field Programmable Logic Array (Field Programmable Logic Array). Programmable Gate Array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.

本發明實施例還提供了一種包含指令的電腦程式產品,當該指令在電腦上運行時,使得電腦執行上述實施例中的任意一種方法。該電腦程式產品包括一個或多個電腦指令。在電腦上載入和執行電腦程式指令時,全部或部分地產生按照本發明實施例的流程或功能。電腦可以是通用電腦、專用電腦、電腦網路、或者其他可程式設計裝置。電腦指令可以存儲在電腦可讀存儲介質中,或者從一個電腦可讀存儲介質向另一個電腦可讀存儲介質傳輸,例如,電腦指令可以從一個網站站點、電腦、伺服器或者資料中心通過有線(例如同軸電纜、光纖、數位用戶線路(Digital Subscriber Line,DSL))或無線(例如紅外、無線、微波等)方式向另一個網站站點、電腦、伺服器或資料中心進行傳輸。電腦可讀存儲介質可以是電腦能夠存取的任何可用介質或者是包含一個或多個可以用介質集成的伺服器、資料中心等資料存放裝置。可用介質可以是磁性介質(例如,磁片、硬碟、磁帶),光介質(例如,DVD)、或者半導體介質(例如固態硬碟(Solid State Disk,SSD))等。 Embodiments of the present invention also provide a computer program product containing instructions. When the instructions are run on a computer, they cause the computer to execute any of the methods in the above embodiments. The computer program product includes one or more computer instructions. When computer program instructions are loaded and executed on a computer, processes or functions according to embodiments of the present invention are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from a website, computer, server, or data center over a wired (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website, computer, server or data center. Computer-readable storage media can be any available media that can be accessed by a computer or include one or more servers, data centers, and other data storage devices that can be integrated with the media. Available media may be magnetic media (eg, magnetic disks, hard disks, tapes), optical media (eg, DVD), or semiconductor media (eg, solid state disk (Solid State Disk, SSD)), etc.

應注意,本發明實施例提供的上述用於存儲電腦指令或者電腦程式的器件,例如但不限於,上述記憶體、電腦可讀存儲介質和通信晶 片等,均具有非易失性(non-transitory)。 It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided by embodiments of the present invention include, but are not limited to, the above-mentioned memories, computer-readable storage media and communication crystals. Chips, etc., are all non-transitory.

在上述實施例中,可以全部或部分地通過軟體、硬體、韌體或者其任意組合來實現。當使用軟體程式實現時,可以全部或部分地以電腦程式產品的形式來實現。該電腦程式產品包括一個或多個電腦指令。在電腦上載入和執行電腦程式指令時,全部或部分地產生按照本發明實施例的流程或功能。電腦可以是通用電腦、專用電腦、電腦網路、或者其他可程式設計裝置。電腦指令可以存儲在電腦可讀存儲介質中,或者從一個電腦可讀存儲介質向另一個電腦可讀存儲介質傳輸,例如,電腦指令可以從一個網站站點、電腦、伺服器或者資料中心通過有線(例如同軸電纜、光纖、數位用戶線路(Digital Subscriber Line,DSL))或無線(例如紅外、無線、微波等)方式向另一個網站站點、電腦、伺服器或資料中心進行傳輸。電腦可讀存儲介質可以是電腦能夠存取的任何可用介質或者是包含一個或多個可以用介質集成的伺服器、資料中心等資料存放裝置。可用介質可以是磁性介質(例如,磁片、硬碟、磁帶),光介質(例如,DVD)、或者半導體介質(例如固態硬碟(Solid State Disk,SSD))等。 In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When computer program instructions are loaded and executed on a computer, processes or functions according to embodiments of the present invention are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from a website, computer, server, or data center over a wired (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website, computer, server or data center. Computer-readable storage media can be any available media that can be accessed by a computer or include one or more servers, data centers, and other data storage devices that can be integrated with the media. Available media may be magnetic media (eg, magnetic disks, hard disks, tapes), optical media (eg, DVD), or semiconductor media (eg, solid state disk (Solid State Disk, SSD)), etc.

儘管在此結合各實施例對本發明進行了描述,然而,在實施所要求保護的本發明過程中,本領域技術人員通過查看圖式、發明內容、以及所附申請專利範圍,可理解並實現發明實施例的其他變化。在請求項中,“包括”(comprising)一詞不排除其他組成部分或步驟,“一”或“一個”不排除多個的情況。單個處理器或其他單元可以實現請求項中列舉的若干項功能。相互不同的從屬請求項中記載了某些措施,但這並不表示這些措施不能組合起來產生良好的效果。 Although the present invention has been described herein in conjunction with various embodiments, those skilled in the art can understand and implement the invention by reviewing the drawings, the content of the invention, and the appended patent scope in implementing the claimed invention. Other variations of the embodiment. In a request, the word "comprising" does not exclude other components or steps, and the word "a" or "an" does not exclude a plurality. A single processor or other unit may perform several of the functions listed in the request. The fact that certain measures are described in mutually different dependent claims does not mean that these measures cannot be combined to good effect.

儘管結合具體特徵及其實施例對本發明進行了描述,顯而易見的,在不脫離本發明的精神和範圍的情況下,可對其進行各種修改和組合。相應地,本說明書和圖式僅僅是所附請求項所界定的本發明的示例性說明,且視為已覆蓋本發明範圍內的任意和所有修改、變化、組合或等同物。顯然,本領域的技術人員可以對本發明進行各種改動和變型而不脫離本發明的精神和範圍。這樣,倘若本發明的這些修改和變型屬於本發明請 求項及其等同技術的範圍之內,則本發明也意圖包含這些改動和變型在內。 Although the invention has been described in conjunction with specific features and embodiments thereof, it will be apparent that various modifications and combinations may be made without departing from the spirit and scope of the invention. Accordingly, the specification and drawings are merely illustrative of the invention defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the invention. Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the invention. In this way, if these modifications and variations of the present invention belong to the present invention, Within the scope of the claims and equivalent technologies, the present invention is also intended to include these changes and modifications.

S601,S602,S603:步驟 S601, S602, S603: steps

Claims (13)

一種視頻解碼方法,其特徵在於,包括: A video decoding method, characterized by including: 獲取待解碼圖像中當前塊的一個或多個碼率控制參數; Obtain one or more rate control parameters of the current block in the image to be decoded; 根據所述一個或多個碼率控制參數確定所述當前塊的量化參數; Determine the quantization parameter of the current block according to the one or more rate control parameters; 基於所述當前塊的量化參數對所述當前塊進行解碼。 The current block is decoded based on a quantization parameter of the current block. 如請求項1所述的方法,其中,所述獲取待解碼圖像中當前塊的一個或多個碼率控制參數,包括: The method according to claim 1, wherein the obtaining one or more rate control parameters of the current block in the image to be decoded includes: 獲取所述待解碼圖像的資訊,所述待解碼圖像的資訊包括所述待解碼圖像的基本資訊和所述待解碼圖像中圖像塊的資訊; Obtaining information of the image to be decoded, where the information of the image to be decoded includes basic information of the image to be decoded and information of image blocks in the image to be decoded; 根據所述待解碼圖像的資訊中的部分或全部確定所述當前塊的一個或多個碼率控制參數。 One or more rate control parameters of the current block are determined based on part or all of the information of the image to be decoded. 如請求項1或2所述的方法,其中,所述碼率控制參數包括所述當前塊的資源充裕度、所述當前塊的複雜度、所述當前塊的預測比特數、所述當前塊的平均量化參數和所述當前塊的量化參數的變化值; The method according to claim 1 or 2, wherein the code rate control parameters include resource adequacy of the current block, complexity of the current block, predicted bit number of the current block, The average quantization parameter and the change value of the quantization parameter of the current block; 其中,所述平均量化參數用於表徵所述待解碼圖像中已解碼圖像塊的量化參數的平均程度,所述資源充裕度是指用於存儲所述當前塊的資源在用於存儲所述待解碼圖像的資源中的充足程度,所述複雜度是指所述待解碼圖像中已解碼圖像塊的複雜程度,所述預測比特數是指預估所述當前塊解碼後佔用的資源,所述量化參數的變化值是指所述待解碼圖像中已解碼圖像塊之間量化參數的變化值。 Wherein, the average quantization parameter is used to characterize the average degree of quantization parameters of the decoded image blocks in the image to be decoded, and the resource adequacy refers to the resource used to store the current block. The sufficiency of the resources of the image to be decoded, the complexity refers to the complexity of the decoded image blocks in the image to be decoded, and the number of predicted bits refers to the estimated occupation of the current block after decoding resource, the change value of the quantization parameter refers to the change value of the quantization parameter between decoded image blocks in the image to be decoded. 如請求項1所述的方法,其中,所述根據所述一個或多個碼率控制參數確定所述當前塊的量化參數,包括: The method according to claim 1, wherein the determining the quantization parameter of the current block according to the one or more rate control parameters includes: 獲取所述已解碼圖像塊的碼率控制參數; Obtain the code rate control parameters of the decoded image block; 根據所述已解碼圖像塊的碼率控制參數確定所述當前塊的量化參數。 The quantization parameter of the current block is determined according to the rate control parameter of the decoded image block. 如請求項1所述的方法,其中,所述根據所述一個或多個碼率控制參數確定所述當前塊的量化參數,包括: The method according to claim 1, wherein the determining the quantization parameter of the current block according to the one or more rate control parameters includes: 獲取所述已解碼圖像塊的量化參數; Obtain the quantization parameters of the decoded image block; 根據所述已解碼圖像塊的量化參數確定所述當前塊的量化參數。 The quantization parameter of the current block is determined based on the quantization parameter of the decoded image block. 如請求項2所述的方法,其中,在所述獲取所述待解碼圖像的資訊之後,所述方法還包括: The method according to claim 2, wherein after obtaining the information of the image to be decoded, the method further includes: 根據所述當前塊資訊計算當前塊的總比特數,所述當前塊的總比特數為所述當前塊解碼後所佔用的比特數; Calculate the total number of bits of the current block according to the current block information, where the total number of bits of the current block is the number of bits occupied by the current block after decoding; 根據所述總比特數確定可用比特數,所述可用比特數為存儲所述當前塊解碼後的圖像資料,所述可用比特數用於確定所述當前塊的一個或多個碼率控制參數。 The number of available bits is determined according to the total number of bits. The number of available bits is to store the decoded image data of the current block. The number of available bits is used to determine one or more code rate control parameters of the current block. . 如請求項6所述的方法,其中,根據所述總比特數確定所述可用比特數,包括: The method according to claim 6, wherein determining the number of available bits according to the total number of bits includes: 去除所述總比特數中用於存儲非圖像資料的其他比特數。 Other bits used to store non-image data are removed from the total number of bits. 如請求項6所述的方法,其中,所述方法還包括: The method as described in request item 6, wherein the method further includes: 初始化中間參數,所述中間參數用於結合所述一個或多個碼率控制參數確定所述當前塊的量化參數。 Initialize intermediate parameters, which are used to determine the quantization parameter of the current block in combination with the one or more rate control parameters. 如請求項1或2中所述的方法,其中,在所述根據所述一個或多個碼率控制參數確定所述當前塊的量化參數之後,所述方法還包括: The method as described in claim 1 or 2, wherein, after determining the quantization parameter of the current block according to the one or more rate control parameters, the method further includes: 基於所述一個或多個碼率控制參數,修正所述量化參數。 The quantization parameter is modified based on the one or more rate control parameters. 如請求項1或2中所述的方法,其中,在所述根據所述一個或多個碼率控制參數確定量化參數之後,所述方法還包括: The method as described in claim 1 or 2, wherein after determining the quantization parameter according to the one or more rate control parameters, the method further includes: 更新所述一個或多個碼率控制參數。 Update the one or more rate control parameters. 一種視頻解碼裝置,其特徵在於,包括: A video decoding device, characterized by including: 獲取模組,用於獲取待解碼圖像中當前塊的一個或多個碼率控制參數; The acquisition module is used to obtain one or more rate control parameters of the current block in the image to be decoded; 確定模組,根據所述一個或多個碼率控制參數確定所述當前塊的量化參數; Determine the module to determine the quantization parameter of the current block according to the one or more code rate control parameters; 解碼模組,用於基於所述當前塊的量化參數對所述當前塊進行解碼。 A decoding module configured to decode the current block based on the quantization parameter of the current block. 一種視頻解碼器,其特徵在於,所述視頻解碼器用於執行如請求項1至10中任一項所述的方法。 A video decoder, characterized in that the video decoder is used to perform the method described in any one of claims 1 to 10. 一種電腦可讀存儲介質,其特徵在於,所述電腦可讀存儲介質中存儲有程式,當所述程式在所述電腦上運行時,使得所述電腦執行如請求項1至10中任一項所述的方法。 A computer-readable storage medium, characterized in that a program is stored in the computer-readable storage medium, and when the program is run on the computer, the computer is caused to execute any one of claims 1 to 10. the method described.
TW112102125A 2022-01-21 2023-01-17 Video decoding method, apparatus, video decoding and storage medium TWI838089B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210074669.X 2022-01-21
CN202210074669.XA CN116095335A (en) 2022-01-21 2022-01-21 Video decoding method, device and storage medium

Publications (2)

Publication Number Publication Date
TW202337212A true TW202337212A (en) 2023-09-16
TWI838089B TWI838089B (en) 2024-04-01

Family

ID=

Also Published As

Publication number Publication date
CN116095335A (en) 2023-05-09
WO2023138532A1 (en) 2023-07-27
CN117221564A (en) 2023-12-12

Similar Documents

Publication Publication Date Title
CN110603812B (en) Apparatus, method and storage medium for display stream compressed sub-stream multiplexing
JP6921873B2 (en) Substream multiplexing for display stream compression
TW201841501A (en) Multi-type-tree framework for video coding
TW201931853A (en) Quantization parameter control for video coding with joined pixel/transform based quantization
TW201725905A (en) Entropy coding techniques for display stream compression (DSC) of non-4:4:4 chroma sub-sampling
WO2023231866A1 (en) Video decoding method and apparatus and storage medium
US11496754B2 (en) Video encoder, video decoder, and corresponding method of predicting random access pictures
TW202349950A (en) Picture coding and decoding methods and apparatuses
WO2023039859A1 (en) Video encoding method, video decoding method, and device, system and storage medium
WO2024061055A1 (en) Image coding method and apparatus, image decoding method and apparatus, and storage medium
WO2024022039A1 (en) Video image decoding method and coding method, apparatus, and storage medium
WO2024022359A1 (en) Image encoding method and device, and image decoding method and device
WO2024022367A1 (en) Image decoding method and apparatus, and image coding method and apparatus
TWI838089B (en) Video decoding method, apparatus, video decoding and storage medium
WO2023138532A1 (en) Video decoding method and apparatus, video decoder and storage medium
TWI821013B (en) Mehtods and devices for video encoding and decoding
WO2024104382A1 (en) Image encoding method and apparatus, image decoding method and apparatus, and storage medium
TWI829424B (en) Decoding method, encoding method and apparatus
WO2022174475A1 (en) Video encoding method and system, video decoding method and system, video encoder, and video decoder
WO2022193389A1 (en) Video coding method and system, video decoding method and system, and video coder and decoder
WO2022193390A1 (en) Video coding and decoding method and system, and video coder and video decoder
TW202415067A (en) Image encoding method and image decoding method, device and storage medium