A coding method and apparatus

By calculating the number of encoded bits and substream header bits in the encoding unit during video encoding and combining them for bitrate control, the problem of inaccurate bitrate control in existing technologies is solved, thereby improving video encoding quality and image display effect.

CN118632001BActive Publication Date: 2026-11-06HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410643699.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-09-08
Filing Date
2022-12-28
Publication Date
2026-11-06
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

In existing video encoding methods, the bitrate control module only controls the bitrate based on the number of encoded bits in the encoding unit, which affects accuracy and results in low video encoding quality.

Method used

The encoding device performs entropy encoding by acquiring the sub-stream of the encoding unit, calculates the number of encoded bits and the estimated number of sub-stream header bits, and combines the two to control the bit rate, thus avoiding the problem of excessively small QP value caused by the failure to consider the sub-stream header bits.

Benefits of technology

It improves the bitrate and image quality of video encoding, ensures the accuracy of bitrate control, and enhances the display effect of video content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118632001B_ABST
    Figure CN118632001B_ABST
Patent Text Reader

Abstract

A coding method and device are disclosed, and relate to the technical field of video coding. The decoding device can decode the coding unit according to the coding bit number corresponding to the coding unit and the estimated bit number indicating the substream head bits corresponding to the plurality of substreams, thereby avoiding the problem that the rate control module only controls the rate according to the coding bit number corresponding to the coding unit, the accuracy of the rate control is affected, and the quality of the video decoding is improved. Moreover, since the decoding device considers the bit number occupied by the substream head bits, the part of the substream head bits is also considered in the process of video decoding, thereby avoiding the problem that the QP value is too small because the part of the substream head bits is not considered by the rate control module, and the image quality of the video content obtained by the decoding device in parsing the bit stream is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese patent application filed on September 8, 2022, with application number 202211097579.9 and entitled "Encoding / Decoding Method", the entire contents of which are incorporated herein by reference.

[0002] This application is a divisional application. The original application has the application number 202211698950.7 and the original application date is December 28, 2022. The entire contents of the original application are incorporated herein by reference. Technical Field

[0003] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method and apparatus. Background Technology

[0004] Video is a sequence of images consisting of multiple consecutive frames, with each frame corresponding to an image. Due to the high similarity between these consecutive frames, video is encoded and compressed for easier storage and transmission. During video encoding, multiple entropy encoders interleave multiple sub-streams corresponding to the encoding units of the images, thereby obtaining the bitstream (or bit stream) corresponding to the encoding units. The rate control module takes the number of encoded bits of the data content corresponding to the encoding unit as input to achieve rate control in video encoding. However, data packets corresponding to different sub-streams have their own sub-stream header bits, causing errors when the rate control module only performs rate control based on the number of encoded bits corresponding to the encoding unit. This affects the accuracy of rate control and results in lower video encoding quality. Therefore, providing a more efficient encoding and decoding method is a pressing issue that needs to be addressed. Summary of the Invention

[0005] This application provides an encoding and decoding method and apparatus, which solves the problem that when the bitrate control module performs bitrate control based solely on the number of encoded bits corresponding to the encoding unit, errors occur, affecting the accuracy of bitrate control and resulting in low video encoding quality.

[0006] In a first aspect, embodiments of this application provide an encoding method applied to a video encoding / decoding system, such as when the encoding method is executed by an encoding device included in the video encoding / decoding system. The encoding method includes: the encoding device acquiring at least one sub-stream of an encoding unit of an image to be encoded, and performing entropy encoding on the at least one sub-stream to obtain a first number of bits. Then, the encoding device encodes the at least one sub-stream according to the first number of bits, outputting a bitstream of the encoding unit. The aforementioned first number of bits includes an encoded number of bits and an estimated number of bits, wherein the encoded number of bits indicates the number of bits occupied by the main data content included in the at least one sub-stream, and the estimated number of bits indicates the sub-stream header bits of each sub-stream in the at least one sub-stream.

[0007] In this embodiment, the encoding device can encode the encoding unit based on the number of encoded bits corresponding to the encoding unit and the estimated number of bits indicating the substream header bits corresponding to multiple substreams. This avoids the problem of errors occurring when the bitrate control module only performs bitrate control based on the number of encoded bits corresponding to the encoding unit, which affects the accuracy of bitrate control and is beneficial to improving the quality of video encoding. Moreover, since the encoding device considers the number of bits occupied by the substream header bits, these substream header bits are also taken into account during the video encoding process. This avoids the problem of excessively small quantizer parameter (QP) values ​​caused by the bitrate control module not considering these substream header bits, which is beneficial to improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0008] For example, each sub-stream segment corresponding to the aforementioned sub-stream includes: a sub-stream segment data body and a sub-stream index for each sub-stream. The sub-stream segment data body refers to the data content carried by the sub-stream segment, and the sub-stream index refers to the sub-stream header bits carried by the sub-stream segment. In some optional examples, the above sub-stream segment is also referred to as the data packet corresponding to the sub-stream, which carries the data body content and the sub-stream header bits.

[0009] In one optional implementation, the encoding device performs entropy encoding on at least one sub-stream to obtain a first number of bits, including: the encoding device performs entropy encoding on the aforementioned at least one sub-stream to obtain a number of encoded bits; and, for each sub-stream slice corresponding to each sub-stream in the at least one sub-stream, the encoding device estimates the number of sub-stream header bits for each sub-stream, and determines the estimated number of bits based on the number of at least one sub-stream header bits corresponding to the at least one sub-stream. Then, the encoding device obtains the first number of bits based on the number of encoded bits and the estimated number of bits.

[0010] In this embodiment, the encoding device obtains the encoded bit count and the estimated bit count in the first bit count. The estimated bit count does not only indicate the sub-stream header bits corresponding to a single sub-stream, but also considers the sub-stream header bits of all sub-streams corresponding to the encoding unit. This further avoids the problem of the QP value being too small due to the fact that the sub-stream header bits are not considered by the bitrate control module, which is beneficial to improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0011] In one optional implementation, the encoding device estimates the number of substream header bits for each substream, including: the encoding device obtaining a first number of substream slices before encoding the first substream based on the number of encoded bits of a first historical substream in a historical encoding unit; wherein the first substream is a substream corresponding to the first historical substream among at least one substream. The encoding device then updates the number of substream header bits of the first substream based on the first number and the substream index length of the substream slice corresponding to the first substream.

[0012] In this embodiment, the encoding device uses the number of encoded bits of the first historical sub-stream in the historical encoding unit to determine the first number of sub-stream slices before encoding the first sub-stream, thereby updating the number of sub-stream header bits contained in the first sub-stream. This helps to avoid the problem of incorrect estimation of the number of sub-stream header bits, improves the accuracy of the first number of bits, and helps to improve the accuracy of QP decision based on the first number of bits, thereby improving the quality of video encoding using the QP value obtained from the decision.

[0013] In one optional implementation, the encoding device updates the number of substream header bits of the first substream based on a first quantity and the substream index length of the substream slice corresponding to the first substream. This includes: the encoding device obtaining a second quantity based on the number of encoded bits of the first substream, and obtaining the difference between the second quantity and the first quantity. The second quantity indicates the second number of encoded substream slices corresponding to the first substream, and this second quantity includes not only the number of substream slices in the first historical substream but also the number of substream slices corresponding to the first substream in the unit to be encoded. Furthermore, the encoding device updates the number of substream header bits of the first substream based on the aforementioned difference and the substream index length of the substream slice corresponding to the first substream.

[0014] For example, the encoding device not only takes into account the substream header bits of the historical substream in the historical encoding unit, but also the number of substream slices of the first substream in the unit to be encoded before encoding, so that the number of input bits required for QP value decision (such as the first number of bits mentioned above) is more accurate, which is beneficial to improving the quality of video encoding.

[0015] In one optional implementation, the encoding device includes at least one encoded substream buffer, which includes a first buffer for temporarily storing substream slices corresponding to a first historical substream and the substream slices corresponding to the first substream. The encoding method provided in this application further includes: the encoding device updating the number of substream slices stored in the first buffer according to the aforementioned second quantity.

[0016] In this embodiment, each time the encoding device updates the number of encoded data packets in the encoded substream buffer, it updates the number of encoded data packets in the encoded substream buffer. Thus, during the encoding process of the encoding device encoding the unencoded substream segments in the encoded substream buffer, the substream header bits corresponding to the substream are updated, thereby improving the accuracy of the first number of bits required for QP decision and improving the quality of video encoding.

[0017] In an optional example, if the sub-stream only includes the sub-stream data body and sub-stream index, the estimated bit count can be the sum of at least one sub-stream header bit count corresponding to the coding unit. When the sub-stream corresponding to a sub-stream includes the sub-stream data body and sub-stream header bits, the encoded bit count indicates these data contents, while the estimated bit count indicates these sub-stream header bits (sub-stream index). This avoids the problem of excessively small QP values ​​caused by the sub-stream header bits not being considered by the rate control module, which is beneficial for improving the bit rate of video coding and the image quality corresponding to the video content in the bitstream.

[0018] In one alternative implementation, each sub-stream segment corresponding to at least one of the aforementioned sub-streams further includes a preset flag bit, and the estimated number of bits is also used to indicate the flag bit. This flag bit can be used to implement user-defined functions, provide encryption for video encoding / decoding, or implement other optional functions, etc.

[0019] In this embodiment, the encoding device may also consider other preset flag bits in the estimated number of bits. These flag bits can be used to implement specific functions required by the user, and during the video encoding process, these flag bits are also used by the encoding device as input to the bitrate control module, thereby improving the accuracy of QP value decision and further improving the quality of video encoding.

[0020] In one optional implementation, the encoding device encodes at least one sub-stream based on a first number of bits and outputs a bitstream of the encoding unit. This includes: the encoding device determining the QP value of the encoding unit based on the first number of bits, and encoding at least one sub-stream based on the QP value, thus outputting a bitstream of the encoding unit. In this embodiment, since the first number of bits includes not only the number of encoded bits indicating the data content but also the estimated number of bits indicating the sub-stream header bits, when the encoding device makes QP decisions based on the first number of bits, the problem of excessively small QP values ​​caused by the sub-stream header bits not being considered by the rate control module is avoided. This is beneficial for improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0021] In one optional implementation, the encoding device outputs the bitstream of the encoding unit, including: the encoding device sending the bitstream corresponding to the aforementioned encoding unit. For example, the encoding device sends the bitstream to a storage device included in the video codec system, or the encoding device sends the bitstream to a decoding device included in the video codec system. Since the encoding device considers the substream header bits of multiple substreams when generating the bitstream corresponding to the encoding unit, the QP value required for encoding also takes into account these substream header bits, thereby avoiding the image quality degradation problem caused by an excessively small QP value and improving the quality of video encoding.

[0022] Secondly, embodiments of this application also provide a decoding method applied to a video encoding / decoding system, such as being executed by a decoding device included in the video encoding / decoding system. The decoding method includes: the decoding device acquiring at least one sub-stream corresponding to an encoding unit based on a bitstream, and performing entropy decoding on the at least one sub-stream to obtain a first number of bits. Then, the decoding device decodes the at least one sub-stream based on the first number of bits, outputting a reconstructed image of the encoding unit. The first number of bits includes an encoded number of bits and an estimated number of bits. The encoded number of bits indicates the number of bits occupied by the main data content of the aforementioned at least one sub-stream, and the estimated number of bits indicates the sub-stream header bits of each sub-stream in the aforementioned at least one sub-stream.

[0023] In this embodiment, the decoding device can decode the encoding unit based on the number of encoded bits corresponding to the encoding unit and the estimated number of bits indicating the substream header bits corresponding to multiple substreams. This avoids the problem of errors occurring when the bitrate control module only performs bitrate control based on the number of encoded bits corresponding to the encoding unit, which affects the accuracy of bitrate control and is beneficial to improving the quality of video decoding. Moreover, since the decoding device considers the number of bits occupied by the substream header bits, these substream header bits are also taken into account during the video decoding process. This avoids the problem of excessively small QP values ​​caused by the bitrate control module not considering these substream header bits, which is beneficial to improving the image quality of the video content obtained by the decoding device in parsing the bitstream.

[0024] For example, each sub-stream corresponds to a sub-stream slice, which includes: the sub-stream slice data body and the sub-stream index for each sub-stream.

[0025] In one optional implementation, the decoding device performs entropy decoding on at least one sub-stream to obtain a first number of bits, including: the decoding device entropy decodes at least one sub-stream to obtain a number of encoded bits. Furthermore, for each sub-stream segment corresponding to each of the at least one sub-stream, the decoding device estimates the number of sub-stream header bits for each sub-stream, and determines the estimated number of bits based on the number of at least one sub-stream header bits corresponding to the at least one sub-stream. Then, the decoding device obtains the first number of bits based on the number of encoded bits and the estimated number of bits.

[0026] In one optional implementation, the decoding device estimates the number of substream header bits for each substream, including: the decoding device obtaining a first number of substream slices before decoding the first substream based on the number of encoded bits of the first historical substream in the historical coding unit; and the decoding device updating the number of substream header bits of the first substream based on the first number and the substream index length of the substream slice corresponding to the first substream. The first substream is the substream corresponding to the first historical substream in at least one substream of the coding unit to be encoded.

[0027] In one optional implementation, the decoding device updates the number of substream header bits of the first substream based on a first quantity and the substream index length of the substream slice corresponding to the first substream. This includes: the decoding device obtaining a second quantity based on the number of encoded bits of the first substream, and obtaining the difference between the second quantity and the first quantity. The second quantity indicates the second quantity of the substream slice before decoding corresponding to the first substream. Then, the decoding device updates the number of substream header bits of the first substream based on the difference and the substream index length of the substream slice corresponding to the first substream.

[0028] In one optional implementation, the decoding device includes at least one decoding sub-stream buffer, which includes a first buffer for temporarily storing sub-stream slices corresponding to a first historical sub-stream and the sub-stream slices corresponding to the first sub-stream. The decoding method provided in this application further includes: the decoding device updating the number of sub-stream slices stored in the first buffer according to a second quantity.

[0029] In one feasible scenario, the aforementioned estimated number of bits is the sum of the number of at least one substream header bits corresponding to at least one substream of the unit to be encoded.

[0030] In one alternative implementation, each sub-stream slice corresponding to at least one of the aforementioned sub-streams further includes a preset flag bit, and the estimated number of bits is also used to indicate the flag bit.

[0031] In one alternative implementation, the decoding device decodes at least one substream based on a first number of bits and outputs a reconstructed image of the encoding unit, including: the decoding device determining the QP value of the encoding unit based on the first number of bits, and decoding at least one substream based on the QP value to output a reconstructed image corresponding to the encoding unit.

[0032] In one optional implementation, the decoding device outputs the reconstructed image corresponding to the encoding unit, including: the decoding device displays the reconstructed image corresponding to the encoding unit. The decoding device can display one or more frames of images, thereby enabling the viewing of image information carried by the bitstream, which is beneficial for displaying video content, etc.

[0033] Thirdly, embodiments of this application provide an encoding apparatus, which includes modules for implementing the encoding method provided in any implementation of the first aspect. Exemplarily, the encoding apparatus includes: an acquisition module, a bit count determination module, and an encoding module. The acquisition module is used to acquire at least one sub-stream of an encoding unit of an image to be encoded. The bit count determination module is used to perform entropy encoding on the at least one sub-stream to obtain a first bit count; wherein the first bit count includes an encoded bit count and an estimated bit count, the encoded bit count indicating the number of bits occupied by the main data content of the at least one sub-stream, and the estimated bit count indicating the sub-stream header bits of each sub-stream in the at least one sub-stream. The encoding module is used to encode the at least one sub-stream according to the first bit count and output the bit stream of the encoding unit.

[0034] In one alternative implementation, the bit count determination module is specifically used for: entropy coding at least one sub-stream to obtain the number of encoded bits; and, for each sub-stream slice corresponding to each sub-stream in the at least one sub-stream, estimating the number of sub-stream header bits for each sub-stream, and determining the estimated number of bits based on the number of at least one sub-stream header bits corresponding to the at least one sub-stream; and further, obtaining a first number of bits based on the number of encoded bits and the estimated number of bits.

[0035] In one optional implementation, the bit count determination module is specifically used to: obtain a first number of sub-stream slices before encoding the first sub-stream based on the number of encoded bits of the first historical sub-stream in the historical coding unit; the first sub-stream is a sub-stream corresponding to the first historical sub-stream in at least one sub-stream; and update the sub-stream header bit count of the first sub-stream based on the first number and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream.

[0036] In one optional implementation, the bit count determination module is specifically configured to: obtain a second quantity based on the encoded bit count of the first sub-stream, and obtain the difference between the second quantity and the first quantity; and update the sub-stream header bit count of the first sub-stream based on the difference and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream. The second quantity is used to indicate the second quantity of the encoded sub-stream slice corresponding to the first sub-stream.

[0037] In one optional implementation, the encoding device includes at least one encoded substream buffer, the at least one encoded substream buffer including a first buffer, the first buffer being used to temporarily store the substream slices corresponding to the first historical substream and the substream slices corresponding to the first substream; the encoding device provided in this application embodiment further includes: an update module, used to update the number of substream slices stored in the first buffer according to a second quantity.

[0038] In one alternative implementation, each sub-stream segment includes: the sub-stream segment data body and the sub-stream index for each sub-stream.

[0039] In one alternative implementation, the estimated number of bits is the sum of the number of bits in at least one substream header.

[0040] In one alternative implementation, each sub-stream slice corresponding to at least one sub-stream further includes a preset flag bit, and the estimated number of bits is also used to indicate the flag bit.

[0041] In one alternative implementation, the encoding module is specifically configured to determine the QP value of the encoding unit based on a first number of bits; and to encode at least one substream based on the QP value, outputting a bitstream of the encoding unit.

[0042] In one alternative implementation, the encoding module is specifically used to send the bit stream of the encoding unit.

[0043] Fourthly, embodiments of this application provide a decoding apparatus, which includes units for implementing the decoding method provided in any implementation of the second aspect. Exemplarily, the decoding apparatus includes: an acquisition unit, a bit count determination unit, and a decoding unit. The acquisition unit is used to acquire at least one sub-stream corresponding to the encoding unit based on the bit stream. The bit count determination unit is used to perform entropy decoding on the at least one sub-stream to obtain a first bit count. The first bit count includes an encoded bit count and an estimated bit count; the encoded bit count indicates the number of bits occupied by the data body content included in the at least one sub-stream, and the estimated bit count indicates the sub-stream header bits of each sub-stream in the at least one sub-stream. The decoding unit is used to decode the at least one sub-stream based on the first bit count and output a reconstructed image of the encoding unit.

[0044] In one optional implementation, the bit count determination unit is specifically configured to: entropy decode at least one sub-stream to obtain the encoded bit count; for each sub-stream slice corresponding to each sub-stream in the at least one sub-stream, estimate the sub-stream header bit count of each sub-stream, and determine the estimated bit count based on the at least one sub-stream header bit count corresponding to the at least one sub-stream. Furthermore, the bit count determination unit is also specifically configured to: obtain a first bit count based on the encoded bit count and the estimated bit count.

[0045] In one optional implementation, the bit count determination unit is specifically used to: obtain a first number of sub-stream slices before decoding the first sub-stream based on the number of encoded bits of the first historical sub-stream in the historical encoding unit; and update the sub-stream header bit count of the first sub-stream based on the first number and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream. The first sub-stream is at least one sub-stream corresponding to the first historical sub-stream.

[0046] In one optional implementation, the bit count determination unit is specifically configured to: obtain a second quantity based on the encoded bit count of the first sub-stream, and obtain the difference between the second quantity and the first quantity. The second quantity is used to indicate the second quantity of the pre-decoding sub-stream slice corresponding to the first sub-stream. Furthermore, the bit count determination unit is also specifically configured to update the sub-stream header bit count of the first sub-stream based on the aforementioned difference and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream.

[0047] In one optional implementation, the decoding device includes at least one decoding substream buffer, which includes a first buffer for temporarily storing substream slices corresponding to a first historical substream and the substream slices corresponding to the first substream. The decoding device provided in this application embodiment further includes an update unit for updating the number of substream slices stored in the first buffer according to a second quantity.

[0048] In one alternative implementation, each sub-stream segment includes: the sub-stream segment data body and the sub-stream index for each sub-stream.

[0049] In one alternative implementation, the estimated number of bits is the sum of the number of bits in at least one substream header.

[0050] In one alternative implementation, each sub-stream slice corresponding to at least one of the aforementioned sub-streams further includes a preset flag bit, and the estimated number of bits is also used to indicate the flag bit.

[0051] In one alternative implementation, the encoding unit is specifically configured to: determine the QP value of the encoding unit based on a first number of bits, and decode at least one substream based on the QP value to output the reconstructed image corresponding to the encoding unit.

[0052] In one alternative implementation, the decoding device may include a display unit for displaying the reconstructed image corresponding to the encoding unit.

[0053] Fifthly, embodiments of this application provide an electronic device, including a processor and an interface circuit. The interface circuit is used to receive signals from other devices outside the electronic device and transmit them to the processor, or to send signals from the processor to other devices outside the electronic device. The processor, through logic circuits or executing code instructions, is used to implement the method described in any implementation of the first aspect, or to implement the method described in any implementation of the second aspect.

[0054] For example, the electronic device refers to an encoding device or a decoding device, etc.

[0055] In a sixth aspect, embodiments of this application provide an encoding / decoding system, including an encoding device and a decoding device, wherein the encoding device and the decoding device are communicatively connected, the decoding device is used to implement the method described in any of the implementations of the second aspect, and the encoding device is used to implement the method described in any of the implementations of the first aspect.

[0056] In a seventh aspect, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions that, when executed by an electronic device, are used to implement the method described in any of the implementations of the first aspect, or to implement the method described in any of the implementations of the second aspect.

[0057] Eighthly, embodiments of this application provide a computer program product including instructions that, when the computer program product is run on an encoding or decoding device, cause the encoding or decoding device to execute the instructions to implement the operational steps of the method described in any of the above-mentioned aspects or possible implementations of any of the aspects.

[0058] The beneficial effects of aspects two through eight above can be referenced to any implementation of aspect one, and will not be repeated here. Based on the implementations provided in the above aspects, this application can be further combined to provide more implementations. Attached Figure Description

[0059] Figure 1 A schematic diagram of a video transmission system provided in an embodiment of this application;

[0060] Figure 2 This is a schematic diagram of a video encoding and decoding system provided in an embodiment of this application;

[0061] Figure 3 A flowchart illustrating an encoding method provided in this application embodiment. Figure 1 ;

[0062] Figure 4 A flowchart illustrating an encoding method provided in this application embodiment. Figure 2 ;

[0063] Figure 5 A flowchart illustrating an encoding method provided in this application embodiment. Figure 3 ;

[0064] Figure 6 A flowchart illustrating an encoding method provided in this application embodiment. Figure 4 ;

[0065] Figure 7 Schematic diagrams of two types of counters provided in embodiments of this application;

[0066] Figure 8 A flowchart illustrating an image decoding method provided in an embodiment of this application;

[0067] Figure 9 This is a schematic diagram of the structure of an encoding device provided in an embodiment of this application;

[0068] Figure 10 This is a schematic diagram of the structure of a decoding device provided in an embodiment of this application;

[0069] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0070] This application provides an encoding method in which the encoding device encodes the encoding unit based on the number of encoded bits corresponding to the encoding unit and the estimated number of bits indicating the substream header bits corresponding to multiple substreams. This avoids the problem of errors occurring when the bitrate control module only performs bitrate control based on the number of encoded bits corresponding to the encoding unit, which affects the accuracy of bitrate control and is beneficial to improving the quality of video encoding. Moreover, since the encoding device considers the number of bits occupied by the substream header bits, these substream header bits are also taken into account during the video encoding process. This avoids the problem of excessively small quantizer parameter (QP) values ​​caused by the bitrate control module not considering these substream header bits, which is beneficial to improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0071] Accordingly, this application also provides a decoding method. The decoding device can decode the bitstream output by the above-mentioned encoding device, thereby achieving similar beneficial effects as the encoding side. For example, the decoding device considers the number of bits occupied by the sub-stream header bits, so that these sub-stream header bits are also taken into account during the video decoding process. This avoids the problem of the QP value being too small due to the fact that these sub-stream header bits are not considered by the bitrate control module, which is beneficial to improving the image quality of the video content obtained by the decoding device in parsing the bitstream.

[0072] To make the following description of the embodiments clear and concise, the relevant technologies are introduced first.

[0073] Interface compression: Media devices use display interfaces when transmitting images and videos. The compression and decompression of image and video data transmitted through the display interface is abbreviated as interface compression.

[0074] Bitstream: A binary stream generated after encoding image or video content. In some cases, bitstream is also called bit stream, etc.

[0075] Syntax elements: Data obtained after performing typical encoding operations such as prediction and transformation on image patches. Syntax elements are the main input content of the entropy coding module.

[0076] Entropy encoder: An encoder module that converts input syntax elements into a bit stream.

[0077] Substream: A component of a bitstream. Bitstream portions output by the same entropy encoder are defined as the same substream.

[0078] Substream segment: The basic unit of substream interleaving, a data segment of fixed length N bits. A substream segment consists of: the substream segment data body (substream_segment_data) and the substream index (substream_index). The substream segment data body refers to the main data content carried by the substream segment, and the substream index refers to the substream header bits carried by the substream segment. In some optional examples, the above substream segment is also called the corresponding data packet, which carries both the main data body and the substream header bits.

[0079] For example, the sub-slice length is related to the bit depth and image format, and includes a 2-bit sub-slice index value (to indicate the sub-slice to which the current sub-slice belongs) and a 512-bit sub-slice data body.

[0080] Substream interleaving: The operation of combining multiple substreams into a single bitstream, also known as multiplexing. In some cases, the interleaving of multiple substreams is also referred to as combining these multiple substreams.

[0081] Substream deinterleaving: The operation of separating different substreams from a bitstream, also known as demultiplexing. In some cases, deinterleaving multiple substreams is also called substream reassembly.

[0082] Encoded substream buffer: A first-in-first-out (FIFO) buffer. Each substream has a corresponding encoded substream buffer. The encoded substream buffer stores the data of the corresponding substream generated after entropy encoding (such as the main data of the substream slice excluding the substream index in the substream slice).

[0083] Decoding substream buffer: A FIFO buffer, each substream has a one-to-one corresponding decoding substream buffer, which stores the data of each substream after the bitstream is deinterleaved.

[0084] Substream header bits: Substream slices are used to indicate the bit length occupied by the header information of the substream to which they belong.

[0085] Figure 1This is a schematic diagram of a video transmission system provided in an embodiment of this application. The video processing process includes video acquisition, video encoding, video transmission, video decoding, and display. The video transmission system includes multiple terminal devices (such as...). Figure 1 The terminal devices 111 to 115 shown are a network, wherein the network can realize the function of video transmission, and the network can include one or more network devices, such as routers or switches.

[0086] Figure 1 The terminal devices shown can be, but are not limited to, user equipment (UE), mobile station (MS), and mobile terminal (MT). The terminal device can be a mobile phone (e.g., Figure 1 The terminal device 114 shown), tablet computer, computer with wireless transceiver function (such as...) Figure 1 The terminal device 115 shown), virtual reality (VR) terminal device (such as...) Figure 1 The terminal devices shown include: terminal device 113, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in smart cities, wireless terminals in smart homes, and so on.

[0087] like Figure 1 As shown, the terminal devices differ in different video processing stages. For example, during video acquisition, terminal device 111 can be a camera device used for road monitoring (such as a camcorder, camera, etc.), a mobile phone, tablet computer, or smart wearable device with video acquisition capabilities. Similarly, during video encoding, terminal device 112 can be a server or a data center, which may include one or more physical devices with encoding capabilities, such as servers, mobile phones, tablet computers, or other encoding devices. Furthermore, during video decoding and display, terminal device 113 can be VR glasses, allowing users to control the viewing angle by turning their heads; terminal device 114 can be a mobile phone, allowing users to control the viewing angle on the phone through touch or air gestures; and terminal device 115 can be a personal computer, allowing users to control the viewing angle displayed on the screen through input devices such as a mouse or keyboard.

[0088] Understandably, "video" is a general term. A video consists of a sequence of multiple consecutive frames, with each frame corresponding to one image. For example, panoramic video can refer to 360° video or 180° video; in some possible cases, panoramic video can also refer to a "large" range of video that exceeds the human eye's field of view (110° to 120°), such as 270° video.

[0089] Figure 1 This is just an illustration; the video transmission system may also include other devices. Figure 1 Not shown in the figure. The embodiments of this application do not limit the number and type of terminal devices included in the system.

[0090] exist Figure 1 Based on the video transmission system shown, Figure 2 This is a schematic diagram of a video encoding and decoding system provided in an embodiment of this application. The video encoding and decoding system 200 includes an encoding device 210 and a decoding device 220. The encoding device 210 establishes a communication connection with the decoding device 220 through a communication channel 230.

[0091] The aforementioned encoding device 210 can perform video encoding functions, such as... Figure 1 As shown, the encoding device 210 can be the terminal device 112, or it can be a data center with video encoding capabilities, for example, the data center includes multiple servers.

[0092] The encoding device 210 may include a data source 211, a preprocessing module 212, an encoder 213, and a communication interface 214.

[0093] Data source 211 may include or can be any type of electronic device for capturing video, and / or any type of source video generation device, such as a computer graphics processor for generating computer animation scenes or any type of device for acquiring and / or providing source video, or computer-generated source video. Data source 211 may be any type of memory or storage device for storing the aforementioned source video. The aforementioned source video may include multiple video streams or images captured by multiple video capture devices (such as cameras).

[0094] The preprocessing module 212 is used to receive the source video and preprocess it to obtain panoramic video or multi-frame images. For example, the preprocessing performed by the preprocessing module 212 may include color format conversion (e.g., from RGB to YCbCr), octree structuring, video stitching, etc.

[0095] Encoder 213 is used to receive video or images and encode the images to obtain encoded data. For example, encoder 213 encodes video to obtain a base layer bitstream and an enhancement layer bitstream. In some optional cases, the encoded bitstream may also be referred to as a bitstream or bit stream.

[0096] The communication interface 214 in the encoding device 210 can be used to: receive encoded data and send the encoded data (or a version of the encoded data after any other processing) to another device such as the decoding device 220 or any other device through the communication channel 230, so as to store, display or directly reconstruct, etc.

[0097] Optionally, the encoding device 210 includes a bitstream buffer for storing bitstreams corresponding to one or more encoding units.

[0098] The aforementioned decoding device 220 can perform image decoding or video decoding functions, such as... Figure 1 As shown, the decoding device 220 can be Figure 1 The terminal device shown is any one of terminal devices 113 to 115.

[0099] The decoding device 220 may include a display device 221, a post-processing module 222, a decoder 223, and a communication interface 224.

[0100] The communication interface 224 in the decoding device 220 is used to receive encoded data (or a version of the encoded data after any other processing) from the encoding device 210 or from any other encoding device such as a storage device.

[0101] Communication interfaces 214 and 224 can be used to send or receive encoded data through a direct communication link between encoding device 210 and decoding device 220, such as a direct wired or wireless connection, or through any type of network, such as a wired network, a wireless network or any combination thereof, any type of private network and public network or any combination thereof.

[0102] Communication interface 224 corresponds to communication interface 214. For example, it can be used to receive transmitted data and process the transmitted data using any type of corresponding transmission decoding or processing and / or decapsulation to obtain encoded data.

[0103] Both communication interface 224 and communication interface 214 can be configured as follows: Figure 2 The arrow pointing from the encoding device 210 to the corresponding communication channel 230 of the decoding device 220 indicates a one-way communication interface or a two-way communication interface, and can be used to send and receive messages, etc., to establish a connection, confirm and exchange any other information related to the communication link, or data transmission such as encoded compressed data transmission, etc.

[0104] Decoder 223 is used to receive encoded data and decode the encoded data to obtain decoded data (images or videos, etc.).

[0105] The post-processing module 222 is used to post-process the decoded data to obtain post-processed data (such as an image to be displayed, a reconstructed image, or a decoded image). The post-processing performed by the post-processing module 222 may include, for example, color format conversion (e.g., from YCbCr to RGB), octree reconstruction, video splitting and merging, or any other processing to generate data for display device 221, etc.

[0106] Display device 221 is used to receive post-processed data for display to a user or viewer. Display device 221 can be or includes any type of display for representing the reconstructed image, such as an integrated or external display screen or monitor. For example, the display screen may include a liquid crystal display (LCD), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro-LED display, a liquid crystal on silicon (LCoS), a digital light processor (DLP), or any other type of display screen.

[0107] As an optional implementation, the encoding device 210 and the decoding device 220 can transmit the encoded data through a data forwarding device. For example, the data forwarding device can be a router or a switch.

[0108] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0109] Here, the image encoding method of this application is used as an example. Figure 2 The following explanation uses the encoding device 210 shown as an example. Figure 3 A flowchart illustrating an encoding method provided in this application embodiment. Figure 1 The image encoding method includes the following steps S310 to S330.

[0110] S310, The encoding device acquires at least one substream of the encoding unit of the image to be encoded.

[0111] like Figure 3 As shown, the image to be encoded may include one or more encoding units.

[0112] In the first possible example, the image to be encoded includes a coding unit that includes all image regions of the image to be encoded.

[0113] In the second possible example, the image to be encoded comprises multiple coding units, with each coding unit corresponding to a sub-region of the image to be encoded (e.g., Figure 3 (The small black square in the middle).

[0114] It is worth noting that one coding unit can correspond to one or more substreams.

[0115] In one possible scenario, one coding unit corresponds to one substream. For example, the coding unit may only contain a substream corresponding to the luminance component, such as a YUV400 format substream.

[0116] In another possible scenario, one encoding unit corresponds to multiple substreams, such as three substreams: substream 1, substream 2, and substream 3. In some alternative implementations, substream 1 is also called the first substream, substream 2 is also called the second substream, and substream 3 is also called the third substream. In this embodiment, substream 1 is represented by Substream[0], substream 2 by Substream[1], and substream 3 by Substream[2].

[0117] For example, substream 1 is used to indicate the luminance component corresponding to the coding unit, and substreams 2 and 3 are used to indicate the chrominance component corresponding to the coding unit. It is worth noting that the above examples and possible scenarios are merely examples provided in this embodiment and should not be construed as limiting this application. For example, in some optional implementations, substream 2 is used to indicate the luminance component of the coding unit, and substreams 1 and 3 are used to indicate the chrominance component of the coding unit. This application does not limit this.

[0118] In this embodiment, the sub-stream slice corresponding to a sub-stream is sent to an encoded sub-stream buffer. For example, the sub-stream slice corresponding to sub-stream 1 is stored in encoded sub-stream buffer 1, the sub-stream slice corresponding to sub-stream 2 is stored in encoded sub-stream buffer 2, and the sub-stream slice corresponding to sub-stream 3 is stored in encoded sub-stream buffer 3.

[0119] S320, The encoding device performs entropy encoding on at least one substream to obtain the first number of bits.

[0120] The first number of bits includes the number of encoded bits and the estimated number of bits. In some alternative implementations, this first number of bits is also referred to as the total number of bits required for the rate control process of the coding unit.

[0121] The encoded bit count here indicates the number of bits occupied by the data body content of at least one sub-stream. For example, since the sub-stream slice corresponding to the sub-stream includes: the sub-stream slice data body and the sub-stream index. The content of the sub-stream slice data body and the sub-stream index can be found in the aforementioned related technology descriptions, and will not be repeated here. For example, the encoded bit count of the above at least one sub-stream may include: the number of bits occupied by the sub-stream slice data body of all sub-stream slices corresponding to the encoding unit in S310.

[0122] The aforementioned estimated bit count is used to indicate the substream header bits of each substream in at least one substream. For example, the estimated bit count above includes the number of substream header bits occupied by the substream indexes of all substream slices corresponding to the coding unit in S310. In some possible cases, the estimated bit count is the sum of the aforementioned at least one substream header bit count.

[0123] When a sub-stream segment corresponding to a sub-stream includes the main data content and sub-stream header bits, the encoded bit count indicates this data content, while the estimated bit count indicates these sub-stream header bits (sub-stream index). This avoids the problem of excessively low QP values ​​caused by the sub-stream header bits not being considered by the rate control module, thus improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream. Possible implementation methods for the encoding device to obtain the first bit count can be found below. Figure 5 The relevant content will not be elaborated here.

[0124] In one alternative implementation, each sub-stream segment corresponding to the at least one sub-stream further includes preset flag bits, and the estimated number of bits is also used to indicate the flag bits. These flag bits can be used to implement user-defined functions, provide encryption for video encoding / decoding, or implement other optional functions, etc.

[0125] In other words, the encoding device can also consider other preset flag bits in the estimated number of bits. These flag bits can be used to realize specific functions required by the user. During the video encoding process, these flag bits are also used as input to the bitrate control module by the encoding device, thereby improving the accuracy of QP value decision and further improving the quality of video encoding.

[0126] S330. The encoding device encodes at least one sub-stream corresponding to the encoding unit according to the first number of bits, and outputs the bit stream of the encoding unit.

[0127] Optionally, the bit stream of the encoding unit may also be referred to as the bit stream, code stream, or data stream corresponding to the encoding unit. This application does not limit the name of the bit stream.

[0128] For example, the encoding device (the substream interleaving module in it) can interleave at least one encoded substream to output a bitstream. The encoding here includes, but is not limited to, encoding operations such as entropy coding, prediction, and quantization.

[0129] In one alternative implementation, the encoding device encodes at least one sub-stream based on a first number of bits and outputs a bit stream of the encoding unit. This may include the following: the encoding device determines the QP value of the encoding unit based on the first number of bits, and encodes at least one sub-stream based on the QP value, outputting a bit stream of the encoding unit. For example, the QP value here is determined by a rate control module included in the encoding device.

[0130] Regarding the specific implementation of S330 above, this embodiment provides a possible example, such as... Figure 4 As shown, Figure 4 A flowchart illustrating an encoding method provided in this application embodiment. Figure 2 The above S330 may include the following steps S331 to S333.

[0131] S331. The encoding device determines the QP value of the encoding unit based on the first number of bits.

[0132] The QP value of the coding unit here is the QP value for all the substreams included in the coding unit. However, in some possible cases, the QP value may be slightly different for multiple substreams corresponding to the coding unit.

[0133] S332. The encoding device obtains the QP value of each substream based on the QP value of the encoding unit.

[0134] For example, the encoding device obtains two QP values ​​based on the QP value of the encoding unit: QP1 and QP2, where QP1 is the QP value to be used for sub-stream 1 of the luminance component of the encoding unit, and QP is the QP value to be used for sub-streams 2 and 3 of the chrominance component of the encoding unit.

[0135] In some optional cases, such as when the coding unit corresponds only to sub-stream 1 with a luminance component, the coding device can directly apply the QP value of the coding unit to sub-stream 1 and use the QP value to quantize and predict sub-stream 1, thereby achieving the coding of the coding unit.

[0136] S333: The encoding device encodes all sub-streams corresponding to the encoding unit based on the QP value of each sub-stream, and outputs the bit stream of the encoding unit.

[0137] In this embodiment, since the first bit count includes not only the number of encoded bits indicating the data content, but also the estimated number of bits indicating the substream header bits, when the encoding device makes QP decisions based on the first bit count, it avoids the problem of the QP value being too small due to the fact that the substream header bits are not considered by the bitrate control module. This is beneficial to improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0138] For example, the bitstream output by the encoding device may include: the encoding device sending the bitstream to a storage device included in the video encoding / decoding system, such as the storage device referring to... Figure 1 During video transmission, this could refer to storage devices included in the network or databases with storage provided by data centers (DCs). Alternatively, the bitstream output by the encoding device could include: the encoding device sending the bitstream to the decoding device included in the video encoding / decoding system. For example, the decoding device refers to... Figure 1 Any one of the terminal devices 113 to 115 shown, or the decoding device refers to Figure 2 The decoding device 220 shown is an example.

[0139] Since the encoding device considers the substream header bits of multiple substreams when generating the bitstream corresponding to the encoding unit, the QP value required for encoding also takes into account these substream header bits, thereby avoiding the problem of image quality degradation caused by an excessively small QP value and improving the quality of video encoding.

[0140] In this embodiment, the encoding device can encode the encoding unit according to the number of encoded bits corresponding to the encoding unit and the estimated number of bits indicating the sub-stream header bits corresponding to multiple sub-streams. This avoids the problem that the bitrate control module makes a mistake when it only controls the bitrate according to the number of encoded bits corresponding to the encoding unit, which affects the accuracy of the bitrate control and is beneficial to improving the quality of video encoding.

[0141] Regarding the specific implementation method for the encoding device to obtain the above first number of bits, this embodiment provides a possible example, such as... Figure 5 As shown, Figure 5 A flowchart illustrating an encoding method provided in this application embodiment. Figure 3 The encoding device may obtain the first number of bits required for encoding by the encoding unit, including the following steps S510 to S540.

[0142] S510, The encoding device performs entropy encoding on at least one substream corresponding to the encoding unit to obtain the number of encoded bits.

[0143] For example, the number of encoded bits refers to the number of bits that the encoding device actually needs to encode for a given encoding unit. More details regarding the number of encoded bits can be found in the description of S320 above, and will not be repeated here.

[0144] S520, the encoding device estimates the number of substream header bits for each substream segment corresponding to each substream in at least one substream.

[0145] Regarding the process of an encoding device estimating the number of substream header bits for each substream, this embodiment provides a possible implementation method, such as... Figure 6 As shown, Figure 6 A flowchart illustrating an encoding method provided in this application embodiment. Figure 4 The above S520 may include the following steps S521 to S524.

[0146] S521. The encoding device obtains the first number of sub-stream slices before encoding the first sub-stream based on the number of encoded bits of the first historical sub-stream in the historical encoding unit.

[0147] The first sub-stream is the sub-stream that corresponds to the first historical sub-stream among at least one sub-streams corresponding to the unit to be encoded. Here, "corresponding" can mean that the sub-stream slices corresponding to the first sub-stream and the first historical sub-stream are stored in an encoded sub-stream buffer (e.g., ...). Figure 3 As shown, the sub-stream slice corresponding to sub-stream 1 is stored in the encoded sub-stream buffer 1), or the first sub-stream and the first historical sub-stream correspond to the same entropy encoder, etc.

[0148] The historical coding unit here refers to the coding unit corresponding to other sub-streams that the coding device used to encode the first sub-stream using the entropy encoder before S310.

[0149] In one possible example, the historical coding unit and the coding unit in S310 can be different coding units for different image sub-regions of the same frame image.

[0150] In another possible example, the historical coding unit and the coding unit in S310 can also refer to different image sub-regions corresponding to the same part of an object in multiple frames of images, and these different image sub-regions belong to the same or different images.

[0151] For example, an encoding device can deploy two counters: a sub-stream counter and a sub-stream valid data length counter. For example... Figure 7 As shown, Figure 7The diagram illustrates two types of counters provided in the embodiments of this application. The substream segment counter records the number of processed substream segments (SubstreamSegmentNum) for each substream. SubstreamSegmentNum is an array of length K, where K represents the number of substreams and SubstreamSegmentNum[i] represents the number of processed substream segments for the i-th substream.

[0152] like Figure 7 As shown, the effective data length counter of the substream records the total number of actual encoded bits (SubstreamBits) for each substream. SubstreamBits is an array of length K, where K represents the number of substreams, and SubstreamBits[i] represents the total number of actual encoded (or decoded) bits for the i-th substream.

[0153] Before the encoding device encodes (or decodes) an image or slice (or the corresponding bitstream), the encoding device initializes the values ​​of each SubstreamSegmentNum[i] and SubstreamBits[i] to 0.

[0154] For the content in S521, the encoding device refreshes the value corresponding to SubstreamBits[0] according to the number of encoded bits of the first historical substream in the historical encoding unit, and records the SubstreamBits[0] as the first quantity, that is: the encoding device confirms that the number of substream slices before encoding the substream 1 corresponding to the encoding unit is SubstreamBits[0], or: the encoding device records bitsRecordSubstream[0] = SubstreamBits[0].

[0155] Accordingly, the encoding device will also initialize the estimated number of bits, such as the total number of header bits value (headerBits). 初始 =0.

[0156] S522, The encoding device obtains the second quantity based on the number of encoded bits of substream 1.

[0157] The second quantity is used to indicate the second quantity of the encoded sub-stream slices corresponding to sub-stream 1.

[0158] For example, the second quantity recorded by the encoding device is the number of temporary substream segments (tmpSubstreamSegmentNum): tmpSubstreamSegmentNum = (SubstreamBits[ssIdx] + MN - 1) / (MN), where SubstreamBits[ssIdx] is the number of substream segments corresponding to substream 1, M is the length of a single substream segment, and N is the length of the header bits in a single substream segment, such as... Figure 5 The format of sub-stream 1 shown includes a data body and N bits of sub-stream header information (hereinafter referred to as "header information"), wherein the total number of bits for the data body and the sub-stream header information is M. In some alternative implementations, N bits are also referred to as the sub-stream index length of the sub-stream.

[0159] It is worth noting that the first quantity mentioned above is only used to indicate the number of sub-stream slices corresponding to the historical sub-stream, while the second quantity includes not only the number of sub-stream slices corresponding to the historical sub-stream, but also the number of sub-stream slices corresponding to the unit to be encoded (or: the current encoding unit).

[0160] S523, The encoding device obtains the difference between the second quantity and the first quantity.

[0161] If the encoding record shows the difference as: AddNum = SubstreamSegmentNum[ssIdx] - tmpSubstreamSegmentNum, SubstreamSegmentNum[ssIdx] is the number of substream segments before the substream segment corresponding to the encoded substream 1 (first quantity), and tmpSubstreamSegmentNum is the number of substream segments after the substream segment corresponding to the encoded substream 1 (second quantity).

[0162] The physical meaning of this difference is the number of sub-segments corresponding to sub-flow 1.

[0163] S524. The encoding device updates the number of substream header bits of substream 1 based on the difference recorded in S523 and the substream index length of the substream slice corresponding to substream 1.

[0164] For example, the encoding device records the number of header bits for the substream: headerBits = headerBits before +AddNum*N, where headerBits before This represents the number of header bits for the substream preceding the substream slice corresponding to substream 1. If the encoding device has not encoded any other historical substreams before encoding the substream slice corresponding to substream 1, then headerBits... before =headerBits 初始=0; if the encoding device has encoded other historical substreams before the substream slice corresponding to substream 1, then headerBits before This is the sum of the number of sub-stream header bits in the encoded sub-stream slices.

[0165] In this embodiment, the encoding device uses the number of encoded bits of the first historical sub-stream in the historical encoding unit to determine the first number of sub-stream slices before encoding the first sub-stream, thereby updating the number of sub-stream header bits contained in the first sub-stream. This helps to avoid the problem of incorrect estimation of the number of sub-stream header bits, improves the accuracy of the first number of bits, and helps to improve the accuracy of QP decision based on the first number of bits, thereby improving the quality of video encoding using the QP value obtained from the decision.

[0166] In one possible example, the encoding device includes at least one encoded substream buffer, which includes a first buffer (such as...). Figure 3 The first buffer (1) is used to temporarily store the sub-stream slices corresponding to the first historical sub-stream and the sub-stream slices corresponding to the first sub-stream (sub-stream 1).

[0167] In some feasible scenarios, the number of encoding substream buffers included in the encoding device is the same as the number of entropy encoders included in the encoding device. One encoding substream buffer is used to temporarily store the substream slices that an entropy encoder needs to process. For example, the data content stored in an encoding substream buffer is the substream slice data body contained in the substream slice.

[0168] For example, the encoding device divides the encoding unit into multiple substreams and sends different substreams into different encoding substream buffers according to the substream index value in the corresponding substream slice. For instance, the substream index length of each substream slice is 2 bits (e.g., 2 binary bits). Here, a substream index value of '00' represents that the current substream slice belongs to the first substream, a value of '01' represents that the current substream slice belongs to the second substream, and a value of '10' represents that the current substream slice belongs to the third substream. The value of SubstreamIndex is equal to the value of substream_index converted to a 2-bit unsigned integer. The value of SubstreamIndex should not be 3. If image_format equals '000', the value of SubstreamIndex should not be 1, 2, or 3.

[0169] In an alternative implementation, the encoding device further updates the number of substream segments stored in the first buffer according to the aforementioned second quantity. For example, the number of encoded substream segments in the first buffer is updated to the subsequent second quantity, such as the encoding device setting: SubstreamSegmentNum[ssIdx] = tmpSubstreamSegmentNum.

[0170] In this embodiment, each time the encoding device updates the number of encoded data packets in the encoded substream buffer, it updates the number of encoded data packets in the encoded substream buffer. Thus, during the encoding process of the encoding device encoding the unencoded substream segments in the encoded substream buffer, the substream header bits corresponding to the substream are updated, thereby improving the accuracy of the first number of bits required for QP decision and improving the quality of video encoding.

[0171] S530, The encoding device determines the estimated number of bits based on the number of bits in the header of at least one substream corresponding to at least one substream.

[0172] Optionally, when the sub-stream slice does not include flag bits, the estimated number of bits can refer to the sum of the number of header bits of all sub-streams corresponding to at least one sub-stream. When the sub-stream slice corresponding to a sub-stream includes the data body content and header bits, the encoded bit count indicates the data content, while the estimated bit count indicates these header bits (sub-stream indexes). This avoids the problem of excessively low QP values ​​caused by the bitrate control module not considering these header bits, which is beneficial for improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0173] S540: The encoding device obtains the first number of bits based on the number of encoded bits and the estimated number of bits.

[0174] In this embodiment, the encoding device obtains the encoded bit count and the estimated bit count in the first bit count. The estimated bit count does not only indicate the sub-stream header bits corresponding to a single sub-stream, but also considers the sub-stream header bits of all sub-streams corresponding to the encoding unit. This further avoids the problem of the QP value being too small due to the fact that the sub-stream header bits are not considered by the bitrate control module, which is beneficial to improving the bitrate of video encoding and the image quality corresponding to the video content in the bitstream.

[0175] Correspondingly, in the image decoding method, the decoding device first obtains at least one sub-stream of the coding unit based on the bit stream, and after estimating the first number of bits of the at least one sub-stream, it performs QP decision on the coding unit using the first number of bits, and then performs inverse quantization and prediction using the QP value obtained from the decision, and outputs the reconstructed image corresponding to the coding unit.

[0176] exist Figure 2 Based on the decoding device 220 shown, this application also provides an image decoding method, such as... Figure 8 As shown, Figure 8This is a flowchart illustrating an image decoding method provided in an embodiment of this application. The decoding method can be executed by a decoding device 220 or by a decoding end that supports the functions of the decoding device 220. Here, the decoding method is described using the decoding device 220 as an example. The decoding method includes the following steps S810 to S830.

[0177] S810, the decoding device obtains at least one sub-stream corresponding to the encoding unit based on the bit stream.

[0178] For example, the bit stream here can be the bit stream output in the embodiment corresponding to the aforementioned encoding method.

[0179] S820, The decoding device performs entropy decoding on at least one sub-stream to obtain the first number of bits.

[0180] The first number of bits includes the number of encoded bits and the number of estimated bits. The number of encoded bits is used to indicate the number of bits occupied by the data body content included in the aforementioned at least one sub-stream, and the number of estimated bits is used to indicate the sub-stream header bits of each sub-stream in the aforementioned at least one sub-stream.

[0181] Regarding the specific implementation methods for the decoding device to obtain the above-mentioned number of encoded bits, estimated number of bits, and first number of bits, the corresponding examples and beneficial effects can be found in the descriptions of the above-mentioned encoding method embodiments, and will not be elaborated here.

[0182] The difference between the decoding side and the encoding side is: ① The sub-stream buffer included in the decoding device is the decoding sub-stream buffer; ② The decoding device can only obtain multiple sub-streams after deinterleaving (or reassembling) the bit stream.

[0183] S830: The decoding device decodes at least one sub-stream according to the first number of bits and outputs the reconstructed image of the encoding unit.

[0184] In this embodiment, the decoding device can decode the encoding unit based on the number of encoded bits corresponding to the encoding unit and the estimated number of bits indicating the sub-stream header bits corresponding to multiple sub-streams. This avoids the problem that the bitrate control module makes a mistake when it only controls the bitrate based on the number of encoded bits corresponding to the encoding unit, which affects the accuracy of the bitrate control and helps to improve the quality of video decoding.

[0185] Furthermore, since the decoding device takes into account the number of bits occupied by the sub-stream header bits, these sub-stream header bits are also taken into account during the video decoding process. This avoids the problem of excessively small QP values ​​caused by the sub-stream header bits not being considered by the bitrate control module, which is beneficial to improving the image quality of the video content obtained by the decoding device in parsing the bitstream.

[0186] In one alternative implementation, the decoding device outputting the reconstructed image of the encoding unit may include: the decoding device displaying the reconstructed image. Figure 2 For example, the decoding device 220 includes a display device 221, which can be used to display the reconstructed image.

[0187] In this embodiment, the decoding device can display one or more frames of images, thereby enabling the viewing of image information carried by the bitstream, which is beneficial for the display of video content.

[0188] It is worth noting that the encoding and decoding methods proposed in this application estimate the substream header bits based on the actual bits consumed by the encoding and decoding devices. This method does not rely on the substream interleaving and deinterleaving modules. It decouples the rate control module and the substream interleaving module on the encoding device side and the rate control module and the substream deinterleaving module on the decoding device side. This helps to reduce the complexity of video encoding and decoding and improve the accuracy of video encoding and decoding.

[0189] It is understood that, in order to achieve the functions in the above embodiments, the encoding and decoding devices include hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and method steps of the various examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0190] Figure 9 This is a schematic diagram of an encoding device provided in an embodiment of this application. This encoding device can be used to implement the functions of the encoding device in the above-described method embodiments, and therefore can also achieve the beneficial effects of the above-described encoding method embodiments. In the embodiments of this application, the encoding device can be as follows: Figure 1 The terminal device 112 shown can also be as follows: Figure 2 The encoding device 210 shown can also be a module (such as a chip) applied to the encoding device.

[0191] like Figure 9As shown, the encoding device 900 includes: an acquisition module 910, a bit count determination module 920, and an encoding module 930. The acquisition module 910 is used to acquire at least one sub-stream of the encoding unit of the image to be encoded. The bit count determination module 920 is used to perform entropy encoding on the at least one sub-stream to obtain a first bit count; wherein the first bit count includes an encoded bit count and an estimated bit count, the encoded bit count indicating the number of bits occupied by the main data content of the at least one sub-stream, and the estimated bit count indicating the sub-stream header bits of each sub-stream in the at least one sub-stream. The encoding module 930 is used to encode the at least one sub-stream according to the first bit count and output the bit stream of the encoding unit.

[0192] In one alternative implementation, the bit count determination module 920 is specifically used for: entropy coding at least one sub-stream to obtain the number of encoded bits; and, for each sub-stream slice corresponding to each sub-stream in the at least one sub-stream, estimating the number of sub-stream header bits for each sub-stream, and determining the estimated number of bits based on the number of at least one sub-stream header bits corresponding to the at least one sub-stream; and further, obtaining a first number of bits based on the number of encoded bits and the estimated number of bits.

[0193] In one optional implementation, the bit count determination module 920 is specifically used to: obtain a first number of sub-stream slices before encoding the first sub-stream based on the number of encoded bits of the first historical sub-stream in the historical coding unit; the first sub-stream is a sub-stream corresponding to the first historical sub-stream in at least one sub-stream; and update the sub-stream header bit count of the first sub-stream based on the first number and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream.

[0194] In one optional implementation, the bit count determination module 920 is specifically configured to: obtain a second quantity based on the encoded bit count of the first sub-stream, and obtain the difference between the second quantity and the first quantity; and update the sub-stream header bit count of the first sub-stream based on the difference and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream. The second quantity is used to indicate the second quantity of the encoded sub-stream slice corresponding to the first sub-stream.

[0195] In one alternative implementation, the encoding device includes at least one encoded substream buffer, the at least one encoded substream buffer including a first buffer, the first buffer being used to temporarily store the substream slice corresponding to the first historical substream and the substream slice corresponding to the first substream.

[0196] Optionally, the encoding apparatus provided in this application embodiment further includes: an update module, used to update the number of sub-slices stored in the first buffer according to a second quantity.

[0197] In one alternative implementation, each sub-stream segment includes: the sub-stream segment data body and the sub-stream index for each sub-stream.

[0198] In one alternative implementation, the estimated number of bits is the sum of the number of bits in at least one substream header.

[0199] In one alternative implementation, each sub-stream slice corresponding to at least one sub-stream further includes a preset flag bit, and the estimated number of bits is also used to indicate the flag bit.

[0200] In one alternative implementation, the encoding module 930 is specifically configured to determine the QP value of the encoding unit based on the first number of bits; and to encode at least one substream based on the QP value, outputting a bitstream of the encoding unit.

[0201] In one alternative implementation, the encoding module 930 is specifically used to send the bit stream of the encoding unit.

[0202] The encoding device 900 can be used to implement the operation steps corresponding to the methods in the aforementioned encoding method embodiments, and thus can also achieve the corresponding beneficial effects, which will not be elaborated here. More details about the acquisition module 910, the bit count determination module 920, and the encoding module 930 can be found in the above encoding method embodiments, and will not be elaborated here.

[0203] Accordingly, embodiments of this application also provide a decoding device, such as... Figure 10 As shown, Figure 10 This is a schematic diagram of a decoding device provided in an embodiment of this application. This decoding device can be used to implement the functions of the decoding device in the above-described method embodiments, and therefore can also achieve the beneficial effects of the above-described decoding method embodiments. In the embodiments of this application, the decoding device can be as follows: Figure 1 Any one of the terminal devices 113 to 115 shown can also be as follows: Figure 2 The decoding device 220 shown can also be a module (such as a chip) applied to the decoding device.

[0204] like Figure 10 As shown, the decoding device 1000 includes: an acquisition unit 1010, a bit count determination unit 1020, and a decoding unit 1030. The acquisition unit 1010 is used to acquire at least one sub-stream corresponding to the encoding unit based on the bit stream. The bit count determination unit 1020 is used to perform entropy decoding on the at least one sub-stream to obtain a first bit count. The first bit count includes an encoded bit count and an estimated bit count. The encoded bit count indicates the number of bits occupied by the main data content of the at least one sub-stream, and the estimated bit count indicates the sub-stream header bits of each sub-stream in the at least one sub-stream. The decoding unit 1030 is used to decode the at least one sub-stream based on the first bit count and output the reconstructed image of the encoding unit.

[0205] In one optional implementation, the bit count determination unit 1020 is specifically configured to: entropy decode at least one substream to obtain the number of encoded bits; for each substream slice corresponding to each substream in the at least one substream, estimate the number of substream header bits for each substream, and determine the estimated number of bits based on the number of at least one substream header bits corresponding to the at least one substream. Furthermore, the bit count determination unit 1020 is also specifically configured to: obtain a first number of bits based on the number of encoded bits and the estimated number of bits.

[0206] In one optional implementation, the bit count determination unit 1020 is specifically used to: obtain a first number of sub-stream slices before decoding the first sub-stream based on the number of encoded bits of the first historical sub-stream in the historical encoding unit; and update the sub-stream header bit count of the first sub-stream based on the first number and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream. The first sub-stream is at least one sub-stream corresponding to the first historical sub-stream.

[0207] In one optional implementation, the bit count determination unit 1020 is specifically configured to: obtain a second quantity based on the encoded bit count of the first sub-stream, and obtain the difference between the second quantity and the first quantity. The second quantity is used to indicate the second quantity of the pre-decoding sub-stream slice corresponding to the first sub-stream. Furthermore, the bit count determination unit 1020 is also specifically configured to update the sub-stream header bit count of the first sub-stream based on the aforementioned difference and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream.

[0208] In one alternative implementation, the decoding device includes at least one decoding substream buffer, the at least one decoding substream buffer including a first buffer, the first buffer being used to temporarily store the substream slice corresponding to the first historical substream and the substream slice corresponding to the first substream.

[0209] Optionally, the decoding apparatus provided in this application embodiment further includes: an update unit, used to update the number of sub-slices stored in the first buffer according to a second quantity.

[0210] In one alternative implementation, each sub-stream segment includes: the sub-stream segment data body and the sub-stream index for each sub-stream.

[0211] In one alternative implementation, the estimated number of bits is the sum of the number of bits in at least one substream header.

[0212] In one alternative implementation, each sub-stream slice corresponding to at least one of the aforementioned sub-streams further includes a preset flag bit, and the estimated number of bits is also used to indicate the flag bit.

[0213] In one alternative implementation, the encoding unit is specifically configured to: determine the QP value of the encoding unit based on a first number of bits, and decode at least one substream based on the QP value to output the reconstructed image corresponding to the encoding unit.

[0214] In one alternative implementation, the decoding device may include a display unit for displaying the reconstructed image corresponding to the encoding unit.

[0215] The decoding device 1000 can be used to implement the operation steps corresponding to the methods in the aforementioned decoding method embodiments, and thus can also achieve the corresponding beneficial effects, which will not be elaborated here. More details about the acquisition unit 1010, the bit count determination unit 1020, and the decoding unit 1030 can be found in the above encoding method embodiments, and will not be elaborated here.

[0216] When the encoding or decoding device implements any of the methods shown in the foregoing figures through software, the encoding or decoding device and its various units can also be software modules. The above-described method is implemented by the processor calling the software module. The processor can be a central processing unit (CPU) or other application-specific integrated circuit (ASIC), or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0217] A more detailed description of the encoding or decoding device described above can be found in the embodiments shown in the foregoing figures, and will not be repeated here. It is understood that the encoding or decoding devices shown in the foregoing figures are merely examples provided in this embodiment, and the encoding or decoding device may include more or fewer units, which is not limited in this application.

[0218] When the encoding or decoding device is implemented in hardware, this hardware can be implemented using a processor or a chip. The chip includes interface circuitry and control circuitry. The interface circuitry is used to receive data from other devices outside the processor and transmit it to the control circuitry, or to send data from the control circuitry to other devices outside the processor.

[0219] The control circuit and interface circuit are used, through logic circuits or executable code instructions, to implement any of the possible implementation methods in the above embodiments. The beneficial effects can be found in the descriptions of any aspect of the above embodiments, and will not be repeated here.

[0220] Alternatively, the encoding or decoding device can also be implemented by an electronic device, which can refer to the encoding or decoding device in the foregoing embodiments, or, when the electronic device is a chip or chip system applied to a server, the encoding or decoding device can also be implemented by a chip or chip system.

[0221] like Figure 11 As shown, Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 1100 includes: a processor 1110, a bus 1120, a memory 1130, a memory unit 1150 (also referred to as a main memory unit), and a communication interface 1140. The processor 1110, the memory 1130, the memory unit 1150, and the communication interface 1140 are connected via the bus 1120.

[0222] It should be understood that in this embodiment, the processor 1110 can be a CPU, but it can also be other general-purpose processors, DSPs, ASICs, FPGAs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0223] The communication interface 1140 is used to enable communication between the electronic device 1100 and external devices or components. In this embodiment, the communication interface 1140 is used for data interaction with other electronic devices.

[0224] Bus 1120 may include a pathway for transferring information between the aforementioned components (such as processor 1110, memory unit 1150, and memory 1130). In addition to a data bus, bus 1120 may also include a power bus, control bus, and status signal bus. However, for clarity, all buses are labeled as bus 1120 in the figure. Bus 1120 may be a Peripheral Component Interconnect Express (PCIe) bus, or an Extended Industry Standard Architecture (EISA) bus, a Unified Bus (Ubus or UB), a Compute Express Link (CXL), a Cache Coherent Interconnect for Accelerators (CCIX), etc.

[0225] As an example, electronic device 1100 may include multiple processors. A processor may be a multi-core (multi-CPU) processor. Here, "processor" can refer to one or more devices, circuits, and / or computing units used to process data (e.g., computer program instructions). Processor 1110 may call encoding units stored in memory unit 1150 and perform encoding based on the encoding units; or, processor 1110 may call bit streams stored in memory unit 1150 and perform decoding based on the bit streams, etc.

[0226] It is worth noting that, Figure 11 Taking the electronic device 1100 as an example, which includes a processor 1110 and a memory 1130, the processor 1110 and the memory 1130 are used to indicate a type of device or equipment. In specific embodiments, the number of each type of device or equipment can be determined according to business needs.

[0227] Memory unit 1150 can correspond to the storage medium used to store information such as encoding units and bit streams in the above method embodiments. Memory unit 1150 can be volatile memory or non-volatile memory, or it can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0228] The memory 1130 is used to store bit streams or encoding units to be encoded, and can be a solid-state drive or a hard disk drive.

[0229] It should be understood that the aforementioned electronic device 1100 can be a DPU. The electronic device 1100 according to this embodiment can correspond to the encoding or decoding device in this embodiment, and can correspond to the execution of... Figure 2 The corresponding entities in the encoding or decoding device, and the above and other operations and / or functions of each module in the encoding or decoding device, are respectively for implementing the corresponding processes in the foregoing method embodiments. For the sake of brevity, they will not be described in detail here.

[0230] The method steps in this embodiment can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a computing device. Of course, the processor and storage medium can also exist as discrete components in a network device or terminal device.

[0231] This application also provides a chip system including a processor for implementing the functions of the data processing unit in the above-described method. In one possible design, the chip system further includes a memory for storing program instructions and / or data. This chip system may be composed of chips or may include chips and other discrete devices.

[0232] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).

[0233] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A decoding method, characterized in that, The method is performed by a decoding device, and the method includes: Obtain one or more sub-streams corresponding to the encoding unit based on the bitstream; The number of encoded bits and the number of bits occupied by the sub-stream index are obtained based on entropy decoding. The number of encoded bits is used to indicate the number of bits occupied by the main data content carried by the sub-stream slices included in the one or more sub-streams. The sub-stream slice is the basic unit of sub-stream interleaving. The quantization parameter QP value of the coding unit is obtained based on the number of coded bits of the one or more sub-streams and the number of bits occupied by the sub-stream index; The one or more sub-streams are decoded according to the QP value, and the decoded image of the encoding unit is output.

2. The method according to claim 1, characterized in that, The step of obtaining the number of bits occupied by the sub-stream index of the one or more sub-streams includes: Get the first number of substream segments before decoding the first substream; the first number is SubstreamSegmentNum[ssIdx], and the value of SubstreamSegmentNum[ssIdx] is the number of substream segments before decoding the substream segment corresponding to the first substream; Update the number of bits in the sub-stream index of the first sub-stream based on the first quantity and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream.

3. The method according to claim 2, characterized in that, Based on the first quantity and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream, update the number of bits in the sub-stream index of the first sub-stream, including: The second quantity is obtained based on the number of encoded bits of the first substream. The second quantity is tmpSubstreamSegmentNum, and the value of tmpSubstreamSegmentNum is the number of substream segments after decoding the substream segment corresponding to the first substream. Based on the difference between the second quantity and the first quantity, and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream, update the number of bits in the sub-stream index of the first sub-stream.

4. The method according to claim 3, characterized in that, The decoding device includes at least one decoding sub-stream buffer, the at least one decoding sub-stream buffer includes a first decoding sub-stream buffer, the first decoding sub-stream buffer is used to temporarily store the sub-stream slice corresponding to the first sub-stream; The method further includes: Update the number of sub-stream slices stored in the first decoding sub-stream buffer according to the second quantity.

5. The method according to claim 4, characterized in that, The number of bits occupied by the sub-stream index in the one or more sub-streams is used to indicate a preset flag bit, which is carried by the sub-stream slice corresponding to each of the one or more sub-streams.

6. An encoding method, characterized in that, The method is performed by an encoding device, and the method includes: Obtain one or more substreams corresponding to the encoding units of an image; The number of encoded bits and the number of bits occupied by the sub-stream index are obtained based on entropy coding. The number of encoded bits is used to indicate the number of bits occupied by the main data content carried by the sub-stream slices included in the one or more sub-streams. The sub-stream slice is the basic unit of sub-stream interleaving. The quantization parameter QP value of the coding unit is obtained based on the number of coded bits of the one or more sub-streams and the number of bits occupied by the sub-stream index; The one or more sub-streams are encoded according to the QP value, and the bit stream of the encoded unit is output.

7. The method according to claim 6, characterized in that, The step of obtaining the number of bits occupied by the sub-stream index of the one or more sub-streams includes: Get the first number of substream segments before encoding the first substream; the first number is SubstreamSegmentNum[ssIdx], and the value of SubstreamSegmentNum[ssIdx] is the number of substream segments before encoding the substream segment corresponding to the first substream; Update the number of bits in the sub-stream index of the first sub-stream based on the first quantity and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream.

8. The method according to claim 7, characterized in that, Based on the first quantity and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream, update the number of bits in the sub-stream index of the first sub-stream, including: The second quantity is obtained based on the number of encoded bits of the first substream. The second quantity is tmpSubstreamSegmentNum, and the value of tmpSubstreamSegmentNum is the number of substream segments after encoding the substream segment corresponding to the first substream. Based on the difference between the second quantity and the first quantity, and the sub-stream index length of the sub-stream slice corresponding to the first sub-stream, update the number of bits in the sub-stream index of the first sub-stream.

9. The method according to claim 8, characterized in that, The encoding device includes at least one encoding sub-stream buffer, the at least one encoding sub-stream buffer includes a first encoding sub-stream buffer, the first encoding sub-stream buffer is used to temporarily store the sub-stream slice corresponding to the first sub-stream; The method further includes: Update the number of sub-stream slices stored in the first encoded sub-stream buffer according to the second quantity.

10. A decoding device, characterized in that, include: The acquisition unit is used to acquire one or more sub-streams corresponding to the encoding unit based on the bitstream; The bit count determination unit is used to obtain the number of encoded bits and the number of bits occupied by the sub-stream index of the one or more sub-streams based on entropy decoding. The number of encoded bits is used to indicate the number of bits occupied by the main data content carried by the sub-stream slices included in the one or more sub-streams. The sub-stream slice is the basic unit of sub-stream interleaving. A decoding unit is used to obtain the quantization parameter QP value of the encoding unit based on the number of encoded bits of the one or more sub-streams and the number of bits occupied by the sub-stream index; The one or more sub-streams are decoded according to the QP value, and the decoded image of the encoding unit is output.

11. An encoding device, characterized in that, include: The acquisition module is used to acquire one or more sub-streams corresponding to the encoding units of an image; The bit count determination module is used to obtain the number of encoded bits and the number of bits occupied by the sub-stream index of the one or more sub-streams based on entropy coding. The number of encoded bits is used to indicate the number of bits occupied by the main data content carried by the sub-stream slices included in the one or more sub-streams. The sub-stream slice is the basic unit of sub-stream interleaving. The encoding module is used to obtain the quantization parameter QP value of the encoding unit based on the number of encoded bits of the one or more sub-streams and the number of bits occupied by the sub-stream index; The one or more sub-streams are encoded according to the QP value, and the bit stream of the encoded unit is output.

12. An electronic device, characterized in that, include: Processor and interface circuitry; The interface circuit is used to receive signals from other devices besides the electronic device and transmit them to the processor, or to send signals from the processor to other devices besides the electronic device. The processor implements the method of any one of claims 1 to 5 through logic circuits or executable code instructions, or the processor implements the method of any one of claims 6 to 9 through logic circuits or executable code instructions.

13. A codec system, characterized in that, It includes an encoding device and a decoding device, the encoding device being communicatively connected to the decoding device, the decoding device being used to implement the method of any one of claims 1 to 5, and the encoding device being used to implement the method of any one of claims 6 to 9.

14. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions, which, when executed by an electronic device, implement the method of any one of claims 1 to 5. And / or, when the computer program or instructions are executed by an electronic device, the method of any one of claims 6 to 9 is implemented.

15. A computer program product, characterized in that, The computer program product includes instructions that, when the computer program product is run on an encoding device, the encoding device executes the instructions to implement the method of any one of claims 6 to 9; And / or, when the computer program product is run on a decoding device, the decoding device executes the instructions to implement the method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Encoding bit rate control method, device, program, and recording medium containing the program

    CN101632308A

  • Adaptive video coding method

    US5790196A